@openparachute/app 0.22.11 → 0.22.13
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/CHANGELOG.md +141 -75
- package/dist/.parachute/info +1 -1
- package/dist/assets/{Account-Cl5c8tEo.js → Account-CRPq4eky.js} +1 -1
- package/dist/assets/Activity-BLLN2kgu.js +1 -0
- package/dist/assets/{AddVault-DoCaI37K.js → AddVault-BR5gZWT3.js} +1 -1
- package/dist/assets/{AddVaultChooser-Xvu3Uphy.js → AddVaultChooser-Bq8pAkVc.js} +1 -1
- package/dist/assets/{AddVaultCreate-Di9wcscn.js → AddVaultCreate-m_9BeV_Q.js} +1 -1
- package/dist/assets/Calendar-65Irth8Y.js +1 -0
- package/dist/assets/{CheckEmail-ntqd1kZe.js → CheckEmail-encZZOxl.js} +1 -1
- package/dist/assets/{ConnectAI-CUJNLwHZ.js → ConnectAI-B7gqvDkQ.js} +1 -1
- package/dist/assets/DayView-DsQr2XvT.js +1 -0
- package/dist/assets/{Export-BFGWcvOW.js → Export-BRO5DUzT.js} +1 -1
- package/dist/assets/{Import-2WIsPfSi.js → Import-_1c63gXI.js} +1 -1
- package/dist/assets/NoteEditor-C1s0DRwJ.js +1 -0
- package/dist/assets/NoteNew-D2gDWKnW.js +8 -0
- package/dist/assets/{NoteRenderer-DG6I-BOG.js → NoteRenderer-BwgvmHZD.js} +1 -1
- package/dist/assets/{NoteView-Dy3cUyrT.js → NoteView-BtXvo-Ke.js} +3 -3
- package/dist/assets/{OAuthCallback-W5STO-7I.js → OAuthCallback-Dne6nN7G.js} +1 -1
- package/dist/assets/{PinArchiveButtons-8xFKv2oH.js → PinArchiveButtons-BaeSYCvb.js} +1 -1
- package/dist/assets/{Settings-ClPAPWCJ.js → Settings-C5Q_6IiY.js} +1 -1
- package/dist/assets/{TagPage-pYbWcmlY.js → TagPage-Bz58IORf.js} +1 -1
- package/dist/assets/{TagSchemaEditor-ve19B-tr.js → TagSchemaEditor-YXqxcc95.js} +1 -1
- package/dist/assets/{Tags-DGl9Zubj.js → Tags-DIhbbif6.js} +1 -1
- package/dist/assets/{VaultGraph-BrDsta1c.js → VaultGraph-OyvE7-1G.js} +3 -3
- package/dist/assets/{Vaults-DWoDm-Th.js → Vaults-DZTvLJL0.js} +1 -1
- package/dist/assets/{ViewNew-D3N3bUyp.js → ViewNew-CEWGH98c.js} +1 -1
- package/dist/assets/ViewSurface-BVVt4eto.js +1 -0
- package/dist/assets/Welcome-DcaF7cVO.js +1 -0
- package/dist/assets/{WizardShell-eATuMAXz.js → WizardShell-BpDtpsOX.js} +1 -1
- package/dist/assets/{attachment-upload-D6wfJsr6.js → attachment-upload-BqMcsBiB.js} +1 -1
- package/dist/assets/{history-BHtc79G3.js → history-v1ErfO2u.js} +1 -1
- package/dist/assets/index-BBWRhmyM.css +1 -0
- package/dist/assets/index-C2wr_d3O.js +66 -0
- package/dist/assets/{provenance-BFQb2w9-.js → provenance-C8B5Q0ir.js} +1 -1
- package/dist/assets/{react-force-graph-2d-BZd7whjL.js → react-force-graph-2d-BtLtJaOD.js} +1 -1
- package/dist/assets/{transcribe-default-Cjxt7F_e.js → transcribe-default-BCVfDb3s.js} +1 -1
- package/dist/assets/{useAttachmentUploader-Be6yFw7I.js → useAttachmentUploader-BmtZQjNW.js} +2 -2
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/meta.json +1 -1
- package/package.json +3 -2
- package/dist/assets/Activity-BcJHDfuw.js +0 -1
- package/dist/assets/Calendar-DBe5DpLx.js +0 -1
- package/dist/assets/DayView-jTXjnokv.js +0 -1
- package/dist/assets/NoteEditor-DT4kYH2h.js +0 -1
- package/dist/assets/NoteNew-B7fbwu7C.js +0 -8
- package/dist/assets/ViewSurface-CB97Dtg8.js +0 -1
- package/dist/assets/Welcome-C6zOVULl.js +0 -1
- package/dist/assets/index-BKfqr8sS.js +0 -66
- package/dist/assets/index-DBJfPBlG.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aa as te,ab as ee,V as re,ac as Mt,ad as kt,ae as ne,a as se,a7 as ie,b as ae,C as oe,a8 as le,r as gt,j as D,N as Tt,L as ce}from"./index-C2wr_d3O.js";import{f as ue,A as he}from"./attachment-upload-BqMcsBiB.js";const de=new Set(["png","jpg","jpeg","gif","webp"]),fe=new Set(["wav","mp3","m4a","ogg","webm"]),pe=new Set(["mp4"]),me=new Set(["txt","json","csv","yaml","yml","svg","tsv","log"]);function ge(y){const S=y.toLowerCase();return de.has(S)?"image":S==="pdf"?"pdf":fe.has(S)?"audio":pe.has(S)?"video":me.has(S)?"text":"unsupported"}function _e(y){return ge(ue(y))}function be(y){return y==="image"||y==="pdf"||y==="audio"||y==="video"}function $t(y){return typeof y.text=="function"?y.text():new Promise((S,o)=>{const b=new FileReader;b.onload=()=>S(b.result),b.onerror=()=>o(b.error??new Error("FileReader failed")),b.readAsText(y)})}function ye(y){const S=new Map,o=new Map;for(const b of y){const h=b.filename.toLowerCase();S.has(h)||S.set(h,b),o.set(Nt(b.sourcePath),b)}return{byBasename:S,byPath:o}}function Nt(y){let S=y.trim();try{S=decodeURIComponent(S)}catch{}return S=S.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,""),S.toLowerCase()}function Ct(y){const S=Nt(y),o=S.lastIndexOf("/");return o>=0?S.slice(o+1):S}function Bt(y){return/\.[a-z0-9]+$/i.test(Ct(y))}function Dt(y,S){const o=Nt(S),b=y.byPath.get(o);if(b)return b;for(const[h,i]of y.byPath)if(h===o||h.endsWith(`/${o}`))return i;return y.byBasename.get(Ct(S))??null}function Ft(y,S){const o=`/api/storage/${y.storagePath}`,b=S||y.filename;return y.isImage?``:`[${b}](${o})`}function ve(y,S){let o=0;const b=new Set,h=/(!?)\[\[([^\]|#]+)(?:[#|][^\]]*)?\]\]/g,i=y.replace(h,(c,m,v)=>{if(!Bt(v))return c;const _=Dt(S,v);return _?(o++,b.add(_.sourcePath),Ft(_,Ct(v))):c}),n=/(!?)\[([^\]]*)\]\(\s*(<[^>]+>|[^)\s]+)(\s+[^)]*)?\)/g;return{content:i.replace(n,(c,m,v,_,w)=>{const s=_.startsWith("<")&&_.endsWith(">")?_.slice(1,-1):_;if(/^(https?:|mailto:|tel:|#|\/api\/storage\/)/i.test(s.trim())||!Bt(s))return c;const d=Dt(S,s);if(!d)return c;o++,b.add(d.sourcePath);const a=v.trim()||Ct(s);return Ft(d,a)}),rewritten:o,referenced:b}}const we=5,ke=500;async function It(y){const{client:S,notes:o,onProgress:b,signal:h}=y,i=Math.max(1,y.concurrency??we),n=[];let r=0,c=0,m=!1;const v=o.map(ze);async function _(){for(;;){if(h!=null&&h.aborted||m)return;const l=r++;if(l>=o.length)return;const u=o[l],p=v[l],x=await xe(S,u,p,h);n[l]=x,c++,x.status==="errored"&&x.reason.startsWith("auth:")&&(m=!0),b==null||b({done:c,total:o.length})}}const w=Array.from({length:Math.min(i,o.length)},()=>_());await Promise.all(w);for(let l=0;l<o.length;l++)n[l]||(n[l]={status:"errored",sourcePath:o[l].sourcePath,reason:m?"Skipped — vault session ended before this note was reached.":"Skipped — import was cancelled."});let s=0,d=0,a=0;for(const l of n)l.status==="created"?s++:l.status==="skipped"?d++:a++;return{created:s,skipped:d,errored:a,outcomes:n}}async function xe(y,S,o,b){try{const h=await Se(y,o,b);return{status:"created",sourcePath:S.sourcePath,noteId:h.id}}catch(h){return h instanceof te||h instanceof ee?{status:"skipped",sourcePath:S.sourcePath,reason:h.message||"Already exists in vault"}:h instanceof re?{status:"errored",sourcePath:S.sourcePath,reason:`auth: ${h.message}`}:h instanceof Mt?{status:"errored",sourcePath:S.sourcePath,reason:`vault unreachable (${h.status}): ${h.message}`}:{status:"errored",sourcePath:S.sourcePath,reason:h instanceof Error?h.message:String(h)}}}async function Se(y,S,o){const b={};o&&(b.signal=o);try{return await y.createNote(S,b)}catch(h){if(!Ce(h)||o!=null&&o.aborted)throw h;return await Ee(ke,o),await y.createNote(S,b)}}function Ce(y){return y instanceof Mt}function Ee(y,S){return new Promise(o=>{const b=setTimeout(()=>{S==null||S.removeEventListener("abort",h),o()},y),h=()=>{clearTimeout(b),o()};S&&S.addEventListener("abort",h,{once:!0})})}function ze(y){const S={content:y.content};y.path&&(S.path=y.path),y.tags.length>0&&(S.tags=y.tags),Object.keys(y.metadata).length>0&&(S.metadata=y.metadata);const o=S;return y.id&&(o.id=y.id),y.createdAt&&(o.created_at=y.createdAt),S}const Lt="Imported files",Ae=20;async function Ie(y){const{client:S,parsed:o,signal:b}=y,h=[],i=[],n=[],r=[];for(const l of o.attachments)be(l.kind)?i.push(l):l.kind==="text"?n.push(l):r.push(l);const c=new Map;for(const l of i){if(b!=null&&b.aborted){h.push({status:"skipped",sourcePath:l.sourcePath,reason:"Skipped — import was cancelled."});continue}try{const u=new File([l.blob],l.filename,{type:l.blob.type||void 0}),p=await S.uploadStorageFile(u,{signal:b});c.set(l.sourcePath,{attachment:l,storagePath:p.path,mimeType:p.mimeType,isImage:p.mimeType.startsWith("image/")})}catch(u){h.push({status:"errored",sourcePath:l.sourcePath,reason:`Upload failed: ${u instanceof Error?u.message:String(u)}`})}}const m=Ne(c),v=new Map,_=o.notes.map(l=>{const{content:u,referenced:p}=ve(l.content,m);return v.set(l.sourcePath,p),{...l,content:u}}),w=await It({client:S,notes:_,...y.concurrency!==void 0?{concurrency:y.concurrency}:{},...y.onProgress?{onProgress:y.onProgress}:{},...b?{signal:b}:{}}),s=new Map;for(const l of w.outcomes)l.status==="created"&&s.set(l.sourcePath,l.noteId);const d=new Map;for(const[l,u]of v){const p=s.get(l);if(p)for(const x of u){let E=d.get(x);E||(E=new Set,d.set(x,E)),E.add(p)}}for(const[l,u]of c){const p=d.get(l);if(!p||p.size===0)continue;let x=0;for(const E of p){if(b!=null&&b.aborted)break;try{await S.linkAttachment(E,{path:u.storagePath,mimeType:u.mimeType}),x++}catch{}}h.push({status:"uploaded",sourcePath:l,storagePath:u.storagePath,references:x})}if(n.length>0&&!(b!=null&&b.aborted)){const l=[];for(const p of n)l.push(await je(p));const u=await It({client:S,notes:l,...y.concurrency!==void 0?{concurrency:y.concurrency}:{},...b?{signal:b}:{}});for(let p=0;p<n.length;p++){const x=n[p],E=u.outcomes[p];(E==null?void 0:E.status)==="created"?h.push({status:"uploaded",sourcePath:x.sourcePath,storagePath:`note:${E.noteId}`,references:1,asNote:!0}):h.push({status:"skipped",sourcePath:x.sourcePath,reason:(E==null?void 0:E.status)==="skipped"?`Imported as note, but ${E.reason}`:`Could not import as note: ${(E==null?void 0:E.status)==="errored"?E.reason:"unknown"}`})}}else if(n.length>0)for(const l of n)h.push({status:"skipped",sourcePath:l.sourcePath,reason:"Skipped — import was cancelled."});const a=[...c.entries()].filter(([l])=>{var u;return!(((u=d.get(l))==null?void 0:u.size)??0)}).map(([,l])=>l);if(a.length>0)if(b!=null&&b.aborted)for(const l of a)h.push({status:"uploaded",sourcePath:l.attachment.sourcePath,storagePath:l.storagePath,references:0});else await Re(S,a,h,y.concurrency,b);for(const l of r)h.push({status:"skipped",sourcePath:l.sourcePath,reason:`.${l.ext||"?"} is not a vault storage type — not imported. (Re-save it in a supported format to bring it across.)`});return Te(w,h)}function Ne(y){return ye([...y.values()].map(S=>({sourcePath:S.attachment.sourcePath,storagePath:S.storagePath,isImage:S.isImage,filename:S.attachment.filename})))}async function je(y){let S="";try{S=await $t(y.blob)}catch{S=""}const o=Pe(y.ext)?`\`\`\`${Oe(y.ext)}
|
|
2
2
|
${S}
|
|
3
3
|
\`\`\`
|
|
4
4
|
`:`${S}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,j as e,a8 as H,af as oe,V as I,a9 as le,ag as ce,a as K,ah as de,N as ue,L as $,E as me,z as fe,b as he,ai as q,aj as xe,ak as pe,al as ge,am as be,aa as ve,an as P,ao as je,ap as Ne,aq as we,A as F,ar as ye}from"./index-C2wr_d3O.js";import{A as Se}from"./attachment-upload-BqMcsBiB.js";import{u as ke,C as Ce,A as Ee,a as Re}from"./useAttachmentUploader-BmtZQjNW.js";import{P as Ae,D as De}from"./PinArchiveButtons-BaeSYCvb.js";import{b as Te,N as Pe}from"./NoteRenderer-BwgvmHZD.js";import{r as Ie}from"./editor-mode-D9fveTEx.js";const $e=250;function Fe({noteId:t,attachment:a}){const[r,l]=n.useState(!1),x=Ve(a);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>l(!0),"aria-label":`Remove attachment ${x}`,className:"shrink-0 rounded border border-transparent px-1.5 py-0.5 text-fg-dim hover:border-red-500/40 hover:text-red-400",children:"✕"}),r?e.jsx(Le,{noteId:t,attachment:a,label:x,onClose:()=>l(!1)}):null]})}function Le({noteId:t,attachment:a,label:r,onClose:l}){const x=H(o=>o.push),i=oe(),[u,m]=n.useState(!1),[f,N]=n.useState(null),c=n.useRef(null);n.useEffect(()=>{const o=setTimeout(()=>m(!0),$e);return()=>clearTimeout(o)},[]),n.useEffect(()=>{var o;(o=c.current)==null||o.focus()},[]),n.useEffect(()=>{const o=k=>{k.key==="Escape"&&l()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[l]);const g=n.useCallback(()=>{!u||i.isPending||(N(null),i.mutate({noteId:t,attachmentId:a.id},{onSuccess:()=>{x(`Removed ${r}`,"success"),l()},onError:o=>{if(o instanceof I){N("Session expired. Reconnect to remove attachments.");return}if(o instanceof le){x(`Already removed ${r}`,"info"),l();return}N(o instanceof Error?o.message:"Remove failed")}}))},[u,a.id,r,i,t,l,x]);return e.jsx("dialog",{open:!0,"aria-labelledby":"confirm-remove-attachment-title",className:"fixed inset-0 z-40 m-0 flex h-full max-h-full w-full max-w-full items-center justify-center bg-black/60 p-4",onMouseDown:o=>{o.target===o.currentTarget&&l()},children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card p-6 shadow-lift",children:[e.jsx("h2",{id:"confirm-remove-attachment-title",className:"mb-2 font-serif text-lg text-red-400",children:"Remove attachment?"}),e.jsxs("p",{className:"mb-3 text-sm text-fg-muted",children:[e.jsx("span",{className:"rounded bg-bg/60 px-1 py-0.5 font-mono text-xs text-fg",children:r})," ","will be detached from this note. If no other note references the file, it will also be deleted from storage. Markdown referencing it will show a broken link until you update it."]}),f?e.jsx("p",{role:"alert",className:"mb-3 text-sm text-red-400",children:f}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{ref:c,type:"button",onClick:l,className:"min-h-11 rounded-lg border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-fg",children:"Cancel"}),e.jsx("button",{type:"button",onClick:g,disabled:!u||i.isPending,className:"btn btn-danger-solid btn-touch",children:i.isPending?"Removing…":"Remove"})]})]})})}function Ve(t){if(t.filename)return t.filename;if(t.path){const a=t.path.split("/").pop();return a||t.path}return t.id}function Qe(){const{id:t}=ce(),a=K(l=>l.getActiveVault()),r=de(t);return a?e.jsxs("div",{className:"page",children:[e.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:e.jsx($,{to:t?`/n/${encodeURIComponent(t)}`:"/",className:"focus-ring hover:text-accent",children:"← Back to note"})}),r.isPending?e.jsx(Oe,{}):r.isError?e.jsx(ze,{error:r.error}):r.data?e.jsx(Be,{note:r.data}):e.jsx(_e,{id:t??""})]}):e.jsx(ue,{to:"/",replace:!0})}function S(t){return{content:t.content??"",path:t.path??"",tags:[...t.tags??[]]}}function Be({note:t}){const a=he(),r=H(s=>s.push),l=q(s=>s.on),x=q(s=>s.setOn),i=n.useRef(K.getState().activeVaultId).current,u=n.useRef(Ie()).current,m=n.useMemo(()=>Te(t),[t]),[f,N]=n.useState(()=>S(t)),[c,g]=n.useState(()=>S(t)),[o,k]=n.useState(()=>{if(!i)return null;const s=xe(i,t.id);return!s||pe(s.body,S(t))?null:s}),[Z,L]=n.useState(""),[V,C]=n.useState(null),[B,E]=n.useState(null),[M,U]=n.useState(!1),w=n.useRef(null);n.useEffect(()=>()=>{w.current!==null&&window.clearTimeout(w.current)},[]);const[R,G]=n.useState("edit"),j=ge(t.id),A=n.useRef(t),D=n.useRef(null),O=n.useRef(null),v=ke({noteId:t.id,onInsert:s=>{D.current?D.current.insertAtCursor(s):g(d=>({...d,content:`${d.content}${s}`}))},onLinked:()=>{r("Attachment added","success")},onError:s=>r(s,"error")});n.useEffect(()=>{A.current=t},[t]);const h=c.content!==f.content||c.path!==f.path||!We(c.tags,f.tags);be(i,t.id,c,h);const y=v.uploads.some(s=>s.status==="uploading"||s.status==="linking"),T=n.useCallback(({navigateToView:s})=>{if(!h||j.isPending||y)return;const d={};c.content!==f.content&&(d.content=c.content),c.path!==f.path&&(d.path=c.path);const b=qe(f.tags,c.tags);(b.add.length||b.remove.length)&&(d.tags=b);const W=A.current.updatedAt??A.current.createdAt;W&&(d.if_updated_at=W),E(null),C(null),j.mutate(d,{onSuccess:p=>{N(S(p)),g(S(p)),A.current=p,i&&P(i,t.id),s?a(`/n/${encodeURIComponent(p.id)}`,{replace:!0}):p.id!==t.id&&a(`/n/${encodeURIComponent(p.id)}/edit`,{replace:!0}),s||(U(!0),w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>U(!1),1500))},onError:p=>{p instanceof ve?C(p):p instanceof I?E("Session expired. Reconnect to save."):E(p instanceof Error?p.message:"Save failed")}})},[f,c,h,j,a,t.id,y,i]),Q=n.useCallback(()=>{o&&g(o.body),k(null)},[o]),X=n.useCallback(()=>{i&&P(i,t.id),k(null)},[i,t.id]),ee=n.useCallback(()=>T({navigateToView:!0}),[T]),te=n.useCallback(()=>T({navigateToView:!1}),[T]),se=n.useCallback(()=>{h&&confirm("Discard all edits and revert to last saved version?")&&(g(f),C(null),E(null))},[f,h]),_=n.useCallback(()=>{h&&!confirm("Discard unsaved changes?")||(i&&P(i,t.id),a(`/n/${encodeURIComponent(t.id)}`))},[h,a,t.id,i]);n.useEffect(()=>{if(!h)return;const s=d=>{d.preventDefault(),d.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[h]);const ne=c.path!==f.path,ae=s=>{const d=ye(s);d&&(c.tags.includes(d)||(g(b=>({...b,tags:[...b.tags,d]})),L("")))},re=s=>{g(d=>({...d,tags:d.tags.filter(b=>b!==s)}))},ie=c.content,z=l?"h-[85dvh]":"h-[60dvh]";return e.jsxs("article",{children:[l?e.jsx("div",{className:"glass-panel enter-fade fixed top-4 left-4 z-30 rounded-full border border-border px-3 py-1.5 text-xs shadow-lift",style:{marginTop:"env(safe-area-inset-top)"},children:e.jsx(Y,{isDirty:h,justSaved:M,updatedAt:t.updatedAt})}):e.jsxs("header",{className:"card mb-6 p-5 shadow-soft md:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"eyebrow",children:"Editing"}),e.jsx(Y,{isDirty:h,justSaved:M,updatedAt:t.updatedAt})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ae,{note:t}),e.jsx(De,{note:t}),e.jsxs("button",{type:"button",onClick:()=>{var s;(s=D.current)==null||s.focus(),x(!0)},className:"btn btn-ghost btn-touch",title:"Focus (⌘.)",children:[e.jsx(je,{width:16,height:16}),"Focus"]}),e.jsx("span",{className:"mx-1 h-5 w-px bg-border","aria-hidden":"true"}),e.jsx("button",{type:"button",onClick:se,disabled:!h||j.isPending,className:"btn btn-secondary btn-touch",children:"Revert"}),e.jsx("button",{type:"button",onClick:_,className:"btn btn-secondary btn-touch",children:"Cancel"}),e.jsx("button",{type:"button",onClick:ee,disabled:!h||j.isPending||y,className:"btn btn-primary btn-touch",title:y?"Waiting for upload…":"Save (⌘S)","aria-label":y?"Save — waiting for upload…":"Save",children:j.isPending?"Saving…":"Save"})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(Ne,{tags:c.tags,input:Z,onInputChange:L,onAdd:ae,onRemove:re})}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 text-fg-dim",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-xs",children:"Path"}),e.jsx("input",{type:"text",value:c.path,onChange:s=>g(d=>({...d,path:s.target.value})),className:"focus-ring w-full min-w-0 truncate rounded border-0 bg-transparent font-mono text-xs text-fg-dim outline-none transition-colors hover:text-fg-muted focus:text-fg placeholder:text-fg-dim","aria-label":"Note path",placeholder:"(no path)",title:c.path||void 0})]}),ne?e.jsx("p",{className:"mt-1 text-xs text-accent",children:"Renaming moves the note — its id may change."}):null,we(c.path)?e.jsx("p",{className:"mt-1 text-xs text-danger",children:"This path is reserved for a built-in view. Notes saved here will not appear in the Views rail."}):null]}),o?e.jsxs("div",{role:"status","data-testid":"draft-offer",className:"mb-4 flex flex-wrap items-center justify-between gap-2 rounded-xl border border-accent/30 bg-accent/5 px-3 py-2 text-sm",children:[e.jsxs("span",{className:"text-fg-muted",children:["You have an unsaved draft from ",F(o.savedAt),"."]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:Q,className:"focus-ring font-medium text-accent hover:underline",children:"Restore"}),e.jsx("button",{type:"button",onClick:X,className:"focus-ring text-fg-dim hover:text-danger",children:"Discard"})]})]}):null,V?e.jsx(Ue,{conflict:V,onReload:()=>{i&&P(i,t.id),window.location.reload()},onDismiss:()=>C(null)}):null,B?e.jsx("div",{className:"mb-4 rounded-xl border border-danger-border bg-danger-soft p-3 text-sm text-danger",children:B}):null,u?null:e.jsx("div",{role:"tablist","aria-label":"Editor view",className:"mb-3 inline-flex rounded-lg border border-border bg-card p-0.5 text-sm lg:hidden",children:["edit","preview"].map(s=>e.jsx("button",{type:"button",role:"tab","aria-selected":R===s,onClick:()=>G(s),className:`rounded-sm px-3 py-1.5 capitalize ${R===s?"bg-accent text-on-accent":"text-fg-muted hover:text-accent"}`,children:s},s))}),e.jsxs("div",{className:`grid ${l?"min-h-[85dvh]":"min-h-[60dvh]"} gap-4 ${u?"":"lg:grid-cols-2"}`,children:[e.jsx(Se,{onDropFiles:v.start,className:`card min-h-0 ${z} min-w-0 ${u||R==="edit"?"":"hidden lg:block"}`,hint:J,children:e.jsx(Ce,{ref:D,value:c.content,onChange:s=>g(d=>({...d,content:s})),onSave:te,onCancel:_,onPasteFile:s=>(v.start(s),!0),onRequestAttachment:()=>{var s;return(s=O.current)==null?void 0:s.open()},livePreview:u})}),u?null:e.jsx("div",{className:`card min-h-0 ${z} min-w-0 overflow-auto p-4 ${R==="preview"?"":"hidden lg:block"}`,children:e.jsx(Pe,{note:{path:c.path,content:ie},resolve:m})})]}),e.jsx(Me,{noteId:t.id,pickerRef:O,attachments:t.attachments??[],uploads:v.uploads,onPickFiles:v.start,onCancel:v.cancel,onDismiss:v.dismiss})]})}const J=e.jsxs(e.Fragment,{children:["Images, audio, webm video."," ",e.jsx("a",{href:"https://github.com/ParachuteComputer/parachute-vault/issues/127",target:"_blank",rel:"noreferrer",className:"text-accent hover:underline",children:"PDF + mp4 coming"})]});function Me({noteId:t,pickerRef:a,attachments:r,uploads:l,onPickFiles:x,onCancel:i,onDismiss:u}){return e.jsxs("section",{className:"mt-6 border-t border-border pt-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"font-serif text-xl",children:"Attachments"}),e.jsx(Ee,{ref:a,onPickFiles:x})]}),e.jsxs("p",{className:"mb-3 text-xs text-fg-dim",children:["Drop or paste files into the editor. Max 100 MB each. ",J,"."]}),e.jsx(Re,{uploads:l,onCancel:i,onDismiss:u}),r.length>0?e.jsx("ul",{className:"mt-3 space-y-1 text-sm",children:r.map(m=>e.jsxs("li",{className:"flex items-center justify-between gap-2 rounded-lg border border-border bg-card/50 px-3 py-1.5 font-mono text-xs",children:[e.jsx("span",{className:"truncate",title:m.path??m.id,children:m.filename??m.path??m.id}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[m.mimeType?e.jsx("span",{className:"text-fg-dim",children:m.mimeType}):null,e.jsx(Fe,{noteId:t,attachment:m})]})]},m.id))}):null]})}function Ue({conflict:t,onReload:a,onDismiss:r}){return e.jsxs("div",{className:"mb-4 rounded-xl border border-warning bg-warning-soft p-4",children:[e.jsx("p",{className:"mb-1 font-medium text-warning",children:"This note was edited elsewhere."}),e.jsxs("p",{className:"mb-3 text-sm text-fg-muted",children:["Your save was rejected to avoid overwriting the other edit.",t.currentUpdatedAt?` Latest update ${F(t.currentUpdatedAt)}.`:""]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:a,className:"btn btn-primary btn-touch",children:"Reload latest (discard my edits)"}),e.jsx("button",{type:"button",onClick:r,className:"btn btn-secondary btn-touch",children:"Keep editing"})]})]})}function Oe(){return e.jsxs("div",{className:"grid min-h-[60dvh] gap-4 lg:grid-cols-2","aria-busy":"true",children:[e.jsx("div",{className:"card animate-pulse"}),e.jsx("div",{className:"card animate-pulse"})]})}function _e({id:t}){return e.jsx(fe,{title:e.jsx("span",{className:"font-serif text-xl text-fg",children:"Note not found"}),description:e.jsxs(e.Fragment,{children:["No note with id ",e.jsx("span",{className:"font-mono",children:t})," in this vault."]}),action:e.jsx($,{to:"/notes",className:"text-sm text-accent hover:underline",children:"Back to all notes"})})}function Y({isDirty:t,justSaved:a,updatedAt:r}){return t?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-accent","aria-label":"unsaved changes",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-accent"}),"unsaved"]}):a?e.jsx("span",{className:"text-xs text-accent","aria-label":"saved",children:"Saved ✓"}):e.jsxs("span",{className:"text-xs text-fg-dim",children:["saved ",F(r)]})}function ze({error:t}){const a=t instanceof I;return e.jsx(me,{title:a?"Session expired":"Could not load note",message:t.message,action:a?e.jsx($,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):void 0})}function We(t,a){if(t.length!==a.length)return!1;const r=new Set(t);for(const l of a)if(!r.has(l))return!1;return!0}function qe(t,a){const r=new Set(t),l=new Set(a),x=a.filter(u=>!r.has(u)),i=t.filter(u=>!l.has(u));return{add:x,remove:i}}export{Qe as NoteEditor};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{as as Le,r as o,at as Ue,au as qe,av as xe,a as Fe,b as Ve,a8 as Oe,aw as Be,ax as Ge,ay as He,az as We,a3 as Ke,a7 as Ye,aA as ze,aj as Je,aB as Qe,C as Ze,am as Xe,j as e,N as et,aC as tt,aD as be,V as st,an as H,aE as nt,aF as at,aG as rt,aH as ee,aI as ot,aJ as it,aK as D,L as ct,ap as lt,A as dt,aL as ut,ar as mt}from"./index-C2wr_d3O.js";import{v as pt,A as ft}from"./attachment-upload-BqMcsBiB.js";import{u as ht,C as gt,A as xt,a as bt}from"./useAttachmentUploader-BmtZQjNW.js";import{b as vt,N as yt}from"./NoteRenderer-BwgvmHZD.js";import{l as ve,u as jt,a as kt,b as wt}from"./transcribe-default-BCVfDb3s.js";import{r as Rt}from"./editor-mode-D9fveTEx.js";import"./types-BaJkUfo6.js";const Nt=30*6e4,Tt=20*1024*1024,St=1e4;function Ct(t){const c=t.segmentMs??Nt,l=t.setTimer??((x,S)=>setTimeout(x,S)),b=t.clearTimer??(x=>clearTimeout(x)),k=t.makeRecorder??(x=>Le({...x,releaseStreamOnStop:!1})),g=[];let n=null,d=null,f="idle",u=0,h=0,y=!1;const m=()=>{for(const x of t.stream.getTracks())x.stop()},r=()=>{d!==null&&(b(d),d=null)},p=()=>{d=l(()=>{d=null,R()},c)},i=()=>{h+=1;const x=h;n=k({stream:t.stream,mimeType:t.mimeType,releaseStreamOnStop:!1,now:t.now,MediaRecorderCtor:t.MediaRecorderCtor,dataIntervalMs:St,onData:S=>{x===h&&S>=Tt&&R()}}),n.start(),u+=1,p()},R=()=>{var x;f!=="recording"||!n||y||(y=!0,r(),g.push(n.stop()),i(),(x=t.onRoll)==null||x.call(t,u),y=!1)};return{get state(){return f},get activePart(){return u},start(){if(f!=="idle")throw new Error(`Cannot start from ${f}`);f="recording",i()},async stop(){if(f!=="recording"||!n)throw new Error(`Cannot stop from ${f}`);f="stopped",r(),g.push(n.stop()),n=null;const x=await Promise.all(g);return m(),x},cancel(){r(),n&&n.cancel(),n=null,f="stopped",m()}}}function At(){const[t,c]=o.useState({kind:"idle"}),[l,b]=o.useState(0),[k,g]=o.useState(0),n=o.useRef(null),d=o.useRef(null);o.useEffect(()=>{if(t.kind!=="recording")return;const m=setInterval(()=>b(Date.now()-t.startedAt),250);return()=>clearInterval(m)},[t]),o.useEffect(()=>()=>{d.current&&URL.revokeObjectURL(d.current),n.current&&n.current.state==="recording"&&n.current.cancel()},[]);const f=o.useCallback(async()=>{if(!(t.kind==="recording"||t.kind==="requesting")){c({kind:"requesting"});try{const m=Ue();if(!m){c({kind:"denied",message:"This browser can't record audio in a format we can save."});return}const r=await qe(),p=Ct({stream:r,mimeType:m,onRoll:i=>g(i)});n.current=p,p.start(),b(0),g(p.activePart),c({kind:"recording",startedAt:Date.now()})}catch(m){const r=m,p=r.kind==="permission-denied"?"Microphone access was denied. Update your browser's site settings to record.":r.kind==="no-device"?"No microphone was found on this device.":r instanceof Error?r.message:"Microphone is not available in this browser.";c({kind:"denied",message:p})}}},[t]),u=o.useCallback(async()=>{var r;const m=n.current;if(!(!m||t.kind!=="recording"))try{const p=await m.stop();n.current=null,g(0);const i=((r=p[0])==null?void 0:r.mimeType)??"",R=p.reduce((W,F)=>W+F.durationMs,0),x=p[0],S=x?URL.createObjectURL(new Blob([x.data],{type:x.mimeType})):"";d.current&&URL.revokeObjectURL(d.current),d.current=S||null,c({kind:"have-audio",segments:p,mimeType:i,url:S,durationMs:R})}catch(p){console.warn(p instanceof Error?`Recording failed: ${p.message}`:"Recording failed."),g(0),c({kind:"idle"})}},[t]),h=o.useCallback(()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null),c({kind:"idle"}),b(0),g(0)},[]),y=o.useCallback(()=>{h()},[h]);return{phase:t,elapsedMs:l,parts:k,startRecording:f,stopRecording:u,discardAudio:h,reset:y}}function Et(t){const{segments:c,mimeType:l,recordedAt:b,willTranscribe:k}=t,g=c.length>1,n=t.typedText.trim(),d=c.map((y,m)=>({filename:g?xe(l,b,m+1):xe(l,b),transcribe:k,...k&&g?{segment_index:m}:{}})),f=k?g?c.map((y,m)=>`_Transcript pending (part ${m+1})._`).join(`
|
|
2
|
+
|
|
3
|
+
`):"_Transcript pending._":"",u=d.map(y=>`![[${y.filename}]]`).join(`
|
|
4
|
+
|
|
5
|
+
`),h=[];return n&&h.push(n),f&&h.push(f),h.push(u),{body:`${h.join(`
|
|
6
|
+
|
|
7
|
+
`)}
|
|
8
|
+
`,segments:d}}const ye={content:"",path:"",tags:[]};function Vt(){const t=Fe(s=>s.getActiveVault()),c=Ve(),l=Oe(s=>s.push),b=Be(),k=Ge(),g=He(),{db:n,blobStore:d,engine:f}=We(),{roles:u}=Ke((t==null?void 0:t.id)??null),h=Ye(),y=o.useRef(ze()),m=o.useRef(Rt()).current,r=o.useRef((t==null?void 0:t.id)??null).current,p=o.useRef(null),[i,R]=o.useState(()=>{if(r){const s=Je(r,D);if(s)return p.current=s.savedAt,s.body}return{...ye,path:y.current}}),[x,S]=o.useState(()=>p.current),[W,F]=o.useState(""),[se,A]=o.useState(null),[V,ke]=o.useState([]),[we,ne]=o.useState(!1),K=o.useRef(null),ae=o.useRef(null),v=At(),_=Qe(),T=_.capability,Re=v.phase.kind==="requesting"||v.phase.kind==="recording"||v.phase.kind==="have-audio",Ne=(T==null?void 0:T.enabled)===!1&&!Re,Y=typeof(T==null?void 0:T.minutes_remaining)=="number"?T.minutes_remaining:void 0,z=Y!==void 0&&Y<=0,[J,re]=o.useState(()=>r?ve(r):!0),Te=(T==null?void 0:T.enabled)!==!1,oe=o.useRef(v.phase.kind);o.useEffect(()=>{const s=oe.current,a=v.phase.kind;oe.current=a,a==="idle"&&s!=="idle"&&r&&re(ve(r))},[v.phase.kind,r]);const[Se]=Ze(),ie=Se.has("voice"),ce=o.useRef(!1);o.useEffect(()=>{var s;!ie||ce.current||_.settled&&((s=_.capability)==null?void 0:s.enabled)!==!1&&(ce.current=!0,v.startRecording())},[ie,_.settled,_.capability,v.startRecording]);const E=ht({noteId:null,onInsert:s=>{K.current?K.current.insertAtCursor(s):R(a=>({...a,content:`${a.content}${s}`}))},onStaged:s=>ke(a=>[...a,s]),onError:s=>l(s,"error")}),M=o.useRef(p.current!==null),O=o.useRef(null);o.useEffect(()=>{M.current||(R(s=>{const a=O.current?s.tags.filter(I=>I!==O.current):s.tags,j=a.includes(u.captureText)?a:[...a,u.captureText];return j===s.tags?s:{...s,tags:j}}),O.current=u.captureText)},[u.captureText]);const le=!M.current&&(i.tags.length===0||i.tags.length===1&&i.tags[0]===u.captureText),Ce=i.content.trim().length>0||!le||i.path.trim().length>0&&i.path!==y.current;if(Xe(r,D,i,Ce),!t)return e.jsx(et,{to:"/",replace:!0});const $=v.phase.kind==="have-audio",Q=i.content.trim().length>0,B=i.content.length>0||i.path!==y.current||!le||$,L=i.path.trim().length>0&&(Q||$),P=b.isPending||we,de=o.useCallback(()=>{if(!L||P)return;const s=tt({content:i.content,path:i.path,tags:i.tags});h&&be(t.id,h),A(null),b.mutate(s,{onSuccess:async a=>{for(const j of V)try{await k.mutateAsync({noteId:a.id,path:j.path,mimeType:j.mimeType})}catch(I){const Z=I instanceof Error?I.message:"Link failed";l(`Failed to attach ${j.filename}: ${Z}`,"error")}r&&H(r,D),l(`Created ${a.path??a.id}`,"success"),c(`/n/${encodeURIComponent(a.id)}`,{replace:!0})},onError:a=>{a instanceof st?A("Session expired. Reconnect to save."):A(a instanceof Error?`${a.message} — if the path is taken, try a different one.`:"Create failed")}})},[t,r,h,i,L,k,b,c,P,l,V]),ue=o.useCallback(async()=>{if(!L||P||v.phase.kind!=="have-audio")return;if(!n||!d){l("Sync queue not ready — try again in a moment.","error");return}A(null);const s=v.phase,a=s.segments,j=s.mimeType,I=i.path.trim(),Z=i.tags,De=nt(i.content),fe=Array.from(new Set([u.captureVoice,...Z,...De].filter(w=>w.length>0)));Q&&fe.push(u.captureText);const he=Array.from(new Set(fe)),_e=new Date,U=at(),Me=!z&&J,X=Et({segments:a,mimeType:j,typedText:i.content,recordedAt:_e,willTranscribe:Me});for(let w=0;w<a.length;w++){const C=pt(new File([a[w].data],X.segments[w].filename,{type:j}));if(C){l(C,"error"),A(C);return}}ne(!0),h&&be(t.id,h);const ge={content:X.body,path:I,metadata:{source:"voice"},...he.length?{tags:he}:{}};try{const w=X.segments.map((N,q)=>({segment:N,data:a[q].data,blobId:rt()})),C=[];try{for(const N of w)await d.put(N.blobId,N.data,j,t.id),C.push(N.blobId)}catch(N){throw(await Promise.allSettled(C.map(G=>d.delete(G)))).forEach((G,$e)=>{G.status==="rejected"&&console.warn(`Could not roll back staged voice blob ${C[$e]}; it may need cleanup.`,G.reason)}),N}await ee(n,{kind:"create-note",localId:U,payload:ge},{vaultId:t.id});for(const{segment:N,blobId:q}of w)await ee(n,{kind:"upload-attachment",blobId:q,filename:N.filename,mimeType:j},{vaultId:t.id}),await ee(n,{kind:"link-attachment",noteId:U,pathRef:ot(q),mimeType:j,transcribe:N.transcribe,...N.segment_index!==void 0?{segment_index:N.segment_index}:{}},{vaultId:t.id});f==null||f.runOnce(),g.setQueryData(["note",t.id,U],it(ge,U)),r&&H(r,D),l("Captured — syncing audio.","success"),v.discardAudio(),c(`/n/${encodeURIComponent(U)}`,{replace:!0})}catch(w){l(w instanceof Error?`Capture failed: ${w.message}`:"Capture failed.","error"),A(w instanceof Error?w.message:"Capture failed")}finally{ne(!1)}},[t,r,d,h,n,i,f,Q,L,c,z,P,l,g,u.captureText,u.captureVoice,J,v]),me=o.useCallback(()=>{$?ue():de()},[$,de,ue]),pe=o.useCallback(()=>{B&&!confirm("Discard this draft?")||(r&&H(r,D),v.discardAudio(),c("/"))},[r,B,c,v]),Ae=o.useCallback(()=>{r&&H(r,D),M.current=!1,O.current=u.captureText,R({...ye,path:y.current,tags:[u.captureText]}),v.discardAudio(),S(null)},[r,v,u.captureText]);o.useEffect(()=>{if(!B)return;const s=a=>{a.preventDefault(),a.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[B]);const Ee=s=>{const a=mt(s);!a||i.tags.includes(a)||(M.current=!0,R(j=>({...j,tags:[...j.tags,a]})),F(""))},Pe=s=>{M.current=!0,R(a=>({...a,tags:a.tags.filter(j=>j!==s)}))},Ie=vt({id:"__new__",createdAt:new Date().toISOString()});return e.jsxs("div",{className:"page",children:[e.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:e.jsx(ct,{to:"/notes",className:"hover:text-accent",children:"← All notes"})}),e.jsxs("article",{children:[e.jsxs("header",{className:"composer mb-6 p-5 md:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("span",{className:"eyebrow",children:"New note"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:pe,className:"btn btn-secondary btn-touch",children:"Cancel"}),e.jsx("button",{type:"button",onClick:me,disabled:!L||P,className:"btn btn-primary btn-touch",title:"Create (⌘S)",children:P?"Creating…":"Create"})]})]}),e.jsx("input",{type:"text",value:i.path,onChange:s=>R(a=>({...a,path:s.target.value})),className:i.path===y.current?"mt-4 w-full border-0 bg-transparent font-sans text-sm text-fg-dim outline-none placeholder:text-fg-dim":"mt-4 w-full border-0 bg-transparent font-serif text-2xl text-fg outline-none placeholder:text-fg-dim md:text-3xl","aria-label":"Note path",placeholder:"Name your note — or just start writing"}),e.jsx("div",{className:"mt-4",children:e.jsx(lt,{tags:i.tags,input:W,onInputChange:F,onAdd:Ee,onRemove:Pe})})]}),x?e.jsxs("div",{role:"status","data-testid":"draft-restored",className:"mb-4 flex flex-wrap items-center justify-between gap-2 rounded-xl border border-accent/30 bg-accent/5 px-3 py-2 text-sm",children:[e.jsxs("span",{className:"text-fg-muted",children:["Unsaved draft restored from ",dt(x),"."]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:Ae,className:"text-fg-dim hover:text-danger",children:"Discard draft"}),e.jsx("button",{type:"button",onClick:()=>S(null),"aria-label":"Dismiss draft-restored notice",className:"text-fg-dim hover:text-accent",children:"✕"})]})]}):null,se?e.jsx("div",{role:"alert",className:"mb-4 rounded-xl border border-danger-border bg-danger-soft p-3 text-sm text-danger",children:se}):null,Ne?e.jsx(ut,{capability:T}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{voice:v,minutesRemaining:Y,outOfMinutes:z,transcribe:J,onTranscribeChange:re,showTranscribeToggle:Te}),e.jsx(Pt,{vaultId:t.id,captureEngaged:$})]}),e.jsxs("div",{className:`grid min-h-[60dvh] gap-4 ${m?"":"lg:grid-cols-2"}`,children:[e.jsx(ft,{onDropFiles:E.start,className:"card min-h-0 h-[60dvh] min-w-0",hint:"Images, audio, webm video",children:e.jsx(gt,{ref:K,value:i.content,onChange:s=>R(a=>({...a,content:s})),onSave:me,onCancel:pe,placeholder:"Start writing…",onPasteFile:s=>(E.start(s),!0),onRequestAttachment:()=>{var s;return(s=ae.current)==null?void 0:s.open()},livePreview:m})}),m?null:e.jsx("div",{className:"card min-w-0 overflow-auto p-4 lg:h-[60dvh] lg:min-h-0",children:i.content.trim()?e.jsx(yt,{note:{path:i.path,content:i.content},resolve:Ie}):e.jsx("p",{className:"text-sm text-fg-dim",children:"Preview appears here as you type."})})]}),e.jsxs("section",{className:"mt-6 border-t border-border pt-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"font-serif text-xl",children:"Attachments"}),e.jsx(xt,{ref:ae,onPickFiles:E.start})]}),e.jsxs("p",{className:"mb-3 text-xs text-fg-dim",children:["Drop or paste files into the editor. Attachments link to the note when you save. Max 100 MB each. Images, audio, webm video."," ",e.jsx("a",{href:"https://github.com/ParachuteComputer/parachute-vault/issues/127",target:"_blank",rel:"noreferrer",className:"text-accent hover:underline",children:"PDF + mp4 coming"}),"."]}),e.jsx(bt,{uploads:E.uploads,onCancel:E.cancel,onDismiss:E.dismiss}),V.length>0?e.jsx("ul",{className:"mt-3 space-y-1 text-sm",children:V.map(s=>e.jsxs("li",{className:"flex items-center justify-between gap-2 rounded-lg border border-border bg-card/50 px-3 py-1.5 font-mono text-xs text-fg-muted",children:[e.jsx("span",{className:"truncate",children:s.filename}),e.jsx("span",{className:"shrink-0 text-fg-dim",children:"staged"})]},s.path))}):null]})]})]})}function Pt({vaultId:t,captureEngaged:c}){const l=jt(),b=kt(),{made:k,markMade:g}=wt(t),[n,d]=o.useState(null);if(!(c&&!k&&l.supported&&l.value==="keep"))return null;const u=h=>{d(null),b.mutate(h,{onSuccess:()=>g(),onError:()=>d("Couldn't save that choice — this recording is kept (the vault default). We'll ask again next time; you can also set it in Settings.")})};return e.jsxs("div",{"data-testid":"retention-choice",className:"mb-4 flex flex-col gap-2 rounded-xl border border-border bg-card/60 p-3",children:[e.jsx("p",{className:"text-xs text-fg-muted",children:"First voice note here — should this vault keep your audio files after transcribing?"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>u("keep"),disabled:b.isPending,className:"btn btn-secondary btn-touch",children:"Keep my recordings"}),e.jsx("button",{type:"button",onClick:()=>u("until_transcribed"),disabled:b.isPending,className:"btn btn-secondary btn-touch",children:"Just keep the words"}),e.jsx("span",{className:"text-xs text-fg-dim",children:"(audio deleted after transcribing)"})]}),e.jsx("p",{className:"text-xs text-fg-dim",children:"Either way your capture saves now. Change this anytime in Settings."}),n?e.jsx("p",{className:"text-xs text-danger","data-testid":"retention-choice-error",children:n}):null]})}const It=30;function je({checked:t,disabled:c,onChange:l}){return e.jsxs("div",{className:"flex basis-full items-center gap-3",children:[e.jsx("span",{className:"text-xs text-fg-dim",children:"Transcribe this recording"}),e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":"Transcribe this recording","data-testid":"transcribe-toggle",disabled:c,onClick:()=>l(!t),className:`relative h-7 w-12 shrink-0 rounded-full transition-colors disabled:opacity-40 ${t?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0 h-6 w-6 rounded-full bg-card shadow-sm transition-transform ${t?"translate-x-5":"translate-x-0.5"}`})})]})}function Dt({voice:t,minutesRemaining:c,outOfMinutes:l,transcribe:b,onTranscribeChange:k,showTranscribeToggle:g}){const{phase:n,elapsedMs:d,parts:f,startRecording:u,stopRecording:h,discardAudio:y}=t,m=n.kind==="recording",r=n.kind==="requesting",p=!l&&b,i=typeof c=="number"&&c<=It;return n.kind==="have-audio"?e.jsxs("div",{className:"mb-4 flex flex-col gap-2 rounded-xl border border-accent/30 bg-accent/5 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"text-sm text-fg-muted",children:["🎙 Recorded ",te(n.durationMs),n.segments.length>1?` · ${n.segments.length} parts`:""]}),e.jsx("button",{type:"button",onClick:y,className:"text-xs text-fg-dim hover:text-danger",children:"Discard"})]}),e.jsx("audio",{controls:!0,src:n.url,className:"w-full",children:e.jsx("track",{kind:"captions"})}),g?e.jsx(je,{checked:p,disabled:l,onChange:k}):null,e.jsx("p",{className:"text-xs text-fg-dim",children:l?"Saved as audio-only — you're out of transcription minutes this month.":p?"Transcript will be appended once your vault processes it. Save to commit.":"Saved as audio-only — transcription is off for this recording."})]}):e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-border bg-card/60 p-3",children:[e.jsx("div",{className:"text-xs text-fg-dim",children:m?f>1?`Recording — tap Stop to finish. (part ${f})`:"Recording — tap Stop to finish.":r?"Requesting microphone…":l?"You're out of transcription minutes this month — this saves as audio-only.":p?"Add a voice memo to this note. Audio gets transcribed and appended.":"Add a voice memo to this note. Saved as audio-only — transcription is off for this recording."}),m?e.jsxs("button",{type:"button",onClick:()=>void h(),"aria-label":`Recording — ${te(d)} — stop`,"aria-pressed":"true",className:"flex min-h-11 items-center gap-2 rounded-full border border-danger-border bg-danger-soft px-4 py-2 text-sm font-medium text-danger",children:[e.jsx("span",{"aria-hidden":"true",className:"animate-pulse",children:"🎙"}),e.jsxs("span",{children:["Stop ",te(d)]})]}):e.jsxs("button",{type:"button",onClick:()=>void u(),"aria-label":"Record voice memo",disabled:r,className:"flex min-h-11 items-center gap-2 rounded-full border border-accent/30 bg-accent/10 px-4 py-2 text-sm font-medium text-accent hover:bg-accent/15 disabled:opacity-40",children:[e.jsx("span",{"aria-hidden":"true",children:"🎙"}),e.jsx("span",{children:r?"Requesting…":"Record"})]}),g?e.jsx(je,{checked:p,disabled:l,onChange:k}):null,i&&!l?e.jsxs("p",{className:"basis-full text-xs text-fg-dim","data-testid":"voice-minutes-left",children:["About ",Math.round(c)," min of transcription left this month."]}):null,n.kind==="denied"?e.jsx("p",{className:"basis-full rounded-xl border border-danger-border bg-danger-soft px-3 py-2 text-xs text-danger",children:n.message}):null]})}function te(t){const c=Math.floor(t/1e3),l=Math.floor(c/60),b=c%60;return`${String(l).padStart(2,"0")}:${String(b).padStart(2,"0")}`}export{Vt as NoteNew};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ac as fr,j as H,r as gn,a5 as ts,L as Wr}from"./index-BKfqr8sS.js";function rs(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const is=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,as=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,os={};function Vr(e,n){return(os.jsx?as:is).test(e)}const ss=/[ \t\n\f\r]/g;function ls(e){return typeof e=="object"?e.type==="text"?Yr(e.value):!1:Yr(e)}function Yr(e){return e.replace(ss,"")===""}class Zn{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Zn.prototype.normal={};Zn.prototype.property={};Zn.prototype.space=void 0;function Xi(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Zn(t,r,n)}function nr(e){return e.toLowerCase()}class Le{constructor(n,t){this.attribute=t,this.property=n}}Le.prototype.attribute="";Le.prototype.booleanish=!1;Le.prototype.boolean=!1;Le.prototype.commaOrSpaceSeparated=!1;Le.prototype.commaSeparated=!1;Le.prototype.defined=!1;Le.prototype.mustUseProperty=!1;Le.prototype.number=!1;Le.prototype.overloadedBoolean=!1;Le.prototype.property="";Le.prototype.spaceSeparated=!1;Le.prototype.space=void 0;let cs=0;const Z=xn(),xe=xn(),tr=xn(),A=xn(),ge=xn(),yn=xn(),Ue=xn();function xn(){return 2**++cs}const rr=Object.freeze(Object.defineProperty({__proto__:null,boolean:Z,booleanish:xe,commaOrSpaceSeparated:Ue,commaSeparated:yn,number:A,overloadedBoolean:tr,spaceSeparated:ge},Symbol.toStringTag,{value:"Module"})),Dt=Object.keys(rr);class gr extends Le{constructor(n,t,r,i){let o=-1;if(super(n,t),Zr(this,"space",i),typeof r=="number")for(;++o<Dt.length;){const a=Dt[o];Zr(this,Dt[o],(r&rr[a])===rr[a])}}}gr.prototype.defined=!0;function Zr(e,n,t){t&&(e[n]=t)}function Rn(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const o=new gr(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),n[r]=o,t[nr(r)]=r,t[nr(o.attribute)]=r}return new Zn(n,t,e.space)}const Qi=Rn({properties:{ariaActiveDescendant:null,ariaAtomic:xe,ariaAutoComplete:null,ariaBusy:xe,ariaChecked:xe,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:ge,ariaCurrent:null,ariaDescribedBy:ge,ariaDetails:null,ariaDisabled:xe,ariaDropEffect:ge,ariaErrorMessage:null,ariaExpanded:xe,ariaFlowTo:ge,ariaGrabbed:xe,ariaHasPopup:null,ariaHidden:xe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ge,ariaLevel:A,ariaLive:null,ariaModal:xe,ariaMultiLine:xe,ariaMultiSelectable:xe,ariaOrientation:null,ariaOwns:ge,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:xe,ariaReadOnly:xe,ariaRelevant:null,ariaRequired:xe,ariaRoleDescription:ge,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:xe,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Ji(e,n){return n in e?e[n]:n}function ea(e,n){return Ji(e,n.toLowerCase())}const us=Rn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yn,acceptCharset:ge,accessKey:ge,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alpha:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:ge,autoFocus:Z,autoPlay:Z,blocking:ge,capture:null,charSet:null,checked:Z,cite:null,className:ge,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:xe,controls:Z,controlsList:ge,coords:A|yn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:tr,draggable:xe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:ge,height:A,hidden:tr,high:A,href:null,hrefLang:null,htmlFor:ge,httpEquiv:ge,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:ge,itemRef:ge,itemScope:Z,itemType:ge,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Z,optimum:A,pattern:null,ping:ge,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:ge,required:Z,reversed:Z,rows:A,rowSpan:A,sandbox:ge,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootCustomElementRegistry:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shadowRootSerializable:Z,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:xe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:xe,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ge,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:xe,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Z,disablePictureInPicture:Z,disableRemotePlayback:Z,exportParts:yn,part:ge,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:ea}),ds=Rn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ue,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:ge,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:yn,g2:yn,glyphName:yn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:Ue,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ge,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ue,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ue,rev:Ue,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ue,requiredFeatures:Ue,requiredFonts:Ue,requiredFormats:Ue,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:Ue,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ue,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ue,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ji}),na=Rn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),ta=Rn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ea}),ra=Rn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),ps={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},fs=/[A-Z]/g,jr=/-[a-z]/g,gs=/^data[-\w.:]+$/i;function ms(e,n){const t=nr(n);let r=n,i=Le;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&gs.test(n)){if(n.charAt(4)==="-"){const o=n.slice(5).replace(jr,bs);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=n.slice(4);if(!jr.test(o)){let a=o.replace(fs,hs);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}i=gr}return new i(r,n)}function hs(e){return"-"+e.toLowerCase()}function bs(e){return e.charAt(1).toUpperCase()}const Es=Xi([Qi,us,na,ta,ra],"html"),mr=Xi([Qi,ds,na,ta,ra],"svg");function _s(e){return e.join(" ").trim()}var An={},Pt,Xr;function ys(){if(Xr)return Pt;Xr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
1
|
+
import{ae as fr,j as H,r as gn,a7 as ts,L as Wr}from"./index-C2wr_d3O.js";function rs(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const is=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,as=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,os={};function Vr(e,n){return(os.jsx?as:is).test(e)}const ss=/[ \t\n\f\r]/g;function ls(e){return typeof e=="object"?e.type==="text"?Yr(e.value):!1:Yr(e)}function Yr(e){return e.replace(ss,"")===""}class Zn{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Zn.prototype.normal={};Zn.prototype.property={};Zn.prototype.space=void 0;function Xi(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Zn(t,r,n)}function nr(e){return e.toLowerCase()}class Le{constructor(n,t){this.attribute=t,this.property=n}}Le.prototype.attribute="";Le.prototype.booleanish=!1;Le.prototype.boolean=!1;Le.prototype.commaOrSpaceSeparated=!1;Le.prototype.commaSeparated=!1;Le.prototype.defined=!1;Le.prototype.mustUseProperty=!1;Le.prototype.number=!1;Le.prototype.overloadedBoolean=!1;Le.prototype.property="";Le.prototype.spaceSeparated=!1;Le.prototype.space=void 0;let cs=0;const Z=xn(),xe=xn(),tr=xn(),A=xn(),ge=xn(),yn=xn(),Ue=xn();function xn(){return 2**++cs}const rr=Object.freeze(Object.defineProperty({__proto__:null,boolean:Z,booleanish:xe,commaOrSpaceSeparated:Ue,commaSeparated:yn,number:A,overloadedBoolean:tr,spaceSeparated:ge},Symbol.toStringTag,{value:"Module"})),Dt=Object.keys(rr);class gr extends Le{constructor(n,t,r,i){let o=-1;if(super(n,t),Zr(this,"space",i),typeof r=="number")for(;++o<Dt.length;){const a=Dt[o];Zr(this,Dt[o],(r&rr[a])===rr[a])}}}gr.prototype.defined=!0;function Zr(e,n,t){t&&(e[n]=t)}function Rn(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const o=new gr(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),n[r]=o,t[nr(r)]=r,t[nr(o.attribute)]=r}return new Zn(n,t,e.space)}const Qi=Rn({properties:{ariaActiveDescendant:null,ariaAtomic:xe,ariaAutoComplete:null,ariaBusy:xe,ariaChecked:xe,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:ge,ariaCurrent:null,ariaDescribedBy:ge,ariaDetails:null,ariaDisabled:xe,ariaDropEffect:ge,ariaErrorMessage:null,ariaExpanded:xe,ariaFlowTo:ge,ariaGrabbed:xe,ariaHasPopup:null,ariaHidden:xe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ge,ariaLevel:A,ariaLive:null,ariaModal:xe,ariaMultiLine:xe,ariaMultiSelectable:xe,ariaOrientation:null,ariaOwns:ge,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:xe,ariaReadOnly:xe,ariaRelevant:null,ariaRequired:xe,ariaRoleDescription:ge,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:xe,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Ji(e,n){return n in e?e[n]:n}function ea(e,n){return Ji(e,n.toLowerCase())}const us=Rn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yn,acceptCharset:ge,accessKey:ge,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alpha:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:ge,autoFocus:Z,autoPlay:Z,blocking:ge,capture:null,charSet:null,checked:Z,cite:null,className:ge,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:xe,controls:Z,controlsList:ge,coords:A|yn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:tr,draggable:xe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:ge,height:A,hidden:tr,high:A,href:null,hrefLang:null,htmlFor:ge,httpEquiv:ge,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:ge,itemRef:ge,itemScope:Z,itemType:ge,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Z,optimum:A,pattern:null,ping:ge,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:ge,required:Z,reversed:Z,rows:A,rowSpan:A,sandbox:ge,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootCustomElementRegistry:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shadowRootSerializable:Z,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:xe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:xe,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ge,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:xe,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Z,disablePictureInPicture:Z,disableRemotePlayback:Z,exportParts:yn,part:ge,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:ea}),ds=Rn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ue,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:ge,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:yn,g2:yn,glyphName:yn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:Ue,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ge,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ue,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ue,rev:Ue,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ue,requiredFeatures:Ue,requiredFonts:Ue,requiredFormats:Ue,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:Ue,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ue,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ue,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ji}),na=Rn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),ta=Rn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ea}),ra=Rn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),ps={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},fs=/[A-Z]/g,jr=/-[a-z]/g,gs=/^data[-\w.:]+$/i;function ms(e,n){const t=nr(n);let r=n,i=Le;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&gs.test(n)){if(n.charAt(4)==="-"){const o=n.slice(5).replace(jr,bs);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=n.slice(4);if(!jr.test(o)){let a=o.replace(fs,hs);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}i=gr}return new i(r,n)}function hs(e){return"-"+e.toLowerCase()}function bs(e){return e.charAt(1).toUpperCase()}const Es=Xi([Qi,us,na,ta,ra],"html"),mr=Xi([Qi,ds,na,ta,ra],"svg");function _s(e){return e.join(" ").trim()}var An={},Pt,Xr;function ys(){if(Xr)return Pt;Xr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
2
2
|
`,c="/",u="*",d="",f="comment",p="declaration";function g(y,E){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];E=E||{};var S=1,w=1;function I(L){var v=L.match(n);v&&(S+=v.length);var j=L.lastIndexOf(l);w=~j?L.length-j:w+L.length}function R(){var L={line:S,column:w};return function(v){return v.position=new k(L),G(),v}}function k(L){this.start=L,this.end={line:S,column:w},this.source=E.source}k.prototype.content=y;function U(L){var v=new Error(E.source+":"+S+":"+w+": "+L);if(v.reason=L,v.filename=E.source,v.line=S,v.column=w,v.source=y,!E.silent)throw v}function $(L){var v=L.exec(y);if(v){var j=v[0];return I(j),y=y.slice(j.length),v}}function G(){$(t)}function x(L){var v;for(L=L||[];v=P();)v!==!1&&L.push(v);return L}function P(){var L=R();if(!(c!=y.charAt(0)||u!=y.charAt(1))){for(var v=2;d!=y.charAt(v)&&(u!=y.charAt(v)||c!=y.charAt(v+1));)++v;if(v+=2,d===y.charAt(v-1))return U("End of comment missing");var j=y.slice(2,v-2);return w+=2,I(j),y=y.slice(v),w+=2,L({type:f,comment:j})}}function B(){var L=R(),v=$(r);if(v){if(P(),!$(i))return U("property missing ':'");var j=$(o),se=L({type:p,property:_(v[0].replace(e,d)),value:j?_(j[0].replace(e,d)):d});return $(a),se}}function ee(){var L=[];x(L);for(var v;v=B();)v!==!1&&(L.push(v),x(L));return L}return G(),ee()}function _(y){return y?y.replace(s,d):d}return Pt=g,Pt}var Qr;function ks(){if(Qr)return An;Qr=1;var e=An&&An.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(An,"__esModule",{value:!0}),An.default=t;const n=e(ys());function t(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,n.default)(r),s=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;s?i(c,u,l):u&&(o=o||{},o[c]=u)}),o}return An}var zn={},Jr;function xs(){if(Jr)return zn;Jr=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||t.test(c)||e.test(c)},a=function(c,u){return u.toUpperCase()},s=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),o(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,s):c=c.replace(r,s),c.replace(n,a))};return zn.camelCase=l,zn}var Un,ei;function ws(){if(ei)return Un;ei=1;var e=Un&&Un.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},n=e(ks()),t=xs();function r(i,o){var a={};return!i||typeof i!="string"||(0,n.default)(i,function(s,l){s&&l&&(a[(0,t.camelCase)(s,o)]=l)}),a}return r.default=r,Un=r,Un}var Ss=ws();const Ns=fr(Ss),ia=aa("end"),hr=aa("start");function aa(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Ts(e){const n=hr(e),t=ia(e);if(n&&t)return{start:n,end:t}}function Kn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ni(e.position):"start"in e||"end"in e?ni(e):"line"in e||"column"in e?ir(e):""}function ir(e){return ti(e&&e.line)+":"+ti(e&&e.column)}function ni(e){return ir(e&&e.start)+"-"+ir(e&&e.end)}function ti(e){return e&&typeof e=="number"?e:1}class ve extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",o={},a=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof n=="string"?i=n:!o.cause&&n&&(a=!0,i=n.message,o.cause=n),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=Kn(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ve.prototype.file="";ve.prototype.name="";ve.prototype.reason="";ve.prototype.message="";ve.prototype.stack="";ve.prototype.column=void 0;ve.prototype.line=void 0;ve.prototype.ancestors=void 0;ve.prototype.cause=void 0;ve.prototype.fatal=void 0;ve.prototype.place=void 0;ve.prototype.ruleId=void 0;ve.prototype.source=void 0;const br={}.hasOwnProperty,As=new Map,vs=/[A-Z]/g,Cs=new Set(["table","tbody","thead","tfoot","tr"]),Is=new Set(["td","th"]),oa="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Os(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=zs(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Fs(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?mr:Es,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},o=sa(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function sa(e,n,t){if(n.type==="element")return Rs(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Ms(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Ds(e,n,t);if(n.type==="mdxjsEsm")return Ls(e,n);if(n.type==="root")return Ps(e,n,t);if(n.type==="text")return Bs(e,n)}function Rs(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=mr,e.schema=i),e.ancestors.push(n);const o=ca(e,n.tagName,!1),a=Us(e,n);let s=_r(e,n);return Cs.has(n.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!ls(l):!0})),la(e,a,o,n),Er(a,s),e.ancestors.pop(),e.schema=r,e.create(n,o,a,t)}function Ms(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Vn(e,n.position)}function Ls(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Vn(e,n.position)}function Ds(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=mr,e.schema=i),e.ancestors.push(n);const o=n.name===null?e.Fragment:ca(e,n.name,!0),a=$s(e,n),s=_r(e,n);return la(e,a,o,n),Er(a,s),e.ancestors.pop(),e.schema=r,e.create(n,o,a,t)}function Ps(e,n,t){const r={};return Er(r,_r(e,n)),e.create(n,e.Fragment,r,t)}function Bs(e,n){return n.value}function la(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function Er(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function Fs(e,n,t){return r;function r(i,o,a,s){const c=Array.isArray(a.children)?t:n;return s?c(o,a,s):c(o,a)}}function zs(e,n){return t;function t(r,i,o,a){const s=Array.isArray(o.children),l=hr(r);return n(i,o,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Us(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&br.call(n.properties,i)){const o=Hs(e,i,n.properties[i]);if(o){const[a,s]=o;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&Is.has(n.tagName)?r=s:t[a]=s}}if(r){const o=t.style||(t.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function $s(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const s=a.properties[0];s.type,Object.assign(t,e.evaluater.evaluateExpression(s.argument))}else Vn(e,n.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else Vn(e,n.position);else o=r.value===null?!0:r.value;t[i]=o}return t}function _r(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:As;for(;++r<n.children.length;){const o=n.children[r];let a;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=i.get(l)||0;a=l+"-"+c,i.set(l,c+1)}}const s=sa(e,o,a);s!==void 0&&t.push(s)}return t}function Hs(e,n,t){const r=ms(e.schema,n);if(!(t==null||typeof t=="number"&&Number.isNaN(t))){if(Array.isArray(t)&&(t=r.commaSeparated?rs(t):_s(t)),r.property==="style"){let i=typeof t=="object"?t:Gs(e,String(t));return e.stylePropertyNameCase==="css"&&(i=Ks(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?ps[r.property]||r.property:r.attribute,t]}}function Gs(e,n){try{return Ns(n,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const r=t,i=new ve("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=oa+"#cannot-parse-style-attribute",i}}function ca(e,n,t){let r;if(!t)r={type:"Literal",value:n};else if(n.includes(".")){const i=n.split(".");let o=-1,a;for(;++o<i.length;){const s=Vr(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:s,computed:!!(o&&s.type==="Literal"),optional:!1}:s}r=a}else r=Vr(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(r.type==="Literal"){const i=r.value;return br.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Vn(e)}function Vn(e,n){const t=new ve("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=oa+"#cannot-handle-mdx-estrees-without-createevaluater",t}function Ks(e){const n={};let t;for(t in e)br.call(e,t)&&(n[qs(t)]=e[t]);return n}function qs(e){let n=e.replace(vs,Ws);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Ws(e){return"-"+e.toLowerCase()}const Bt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Vs={};function yr(e,n){const t=Vs,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return ua(e,r,i)}function ua(e,n,t){if(Ys(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ri(e.children,n,t)}return Array.isArray(e)?ri(e,n,t):""}function ri(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=ua(e[i],n,t);return r.join("")}function Ys(e){return!!(e&&typeof e=="object")}const ii=document.createElement("i");function kr(e){const n="&"+e+";";ii.innerHTML=n;const t=ii.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function $e(e,n,t,r){const i=e.length;let o=0,a;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);o<r.length;)a=r.slice(o,o+1e4),a.unshift(n,0),e.splice(...a),o+=1e4,n+=1e4}function Ge(e,n){return e.length>0?($e(e,e.length,0,n),e):n}const ai={}.hasOwnProperty;function da(e){const n={};let t=-1;for(;++t<e.length;)Zs(n,e[t]);return n}function Zs(e,n){let t;for(t in n){const i=(ai.call(e,t)?e[t]:void 0)||(e[t]={}),o=n[t];let a;if(o)for(a in o){ai.call(i,a)||(i[a]=[]);const s=o[a];js(i[a],Array.isArray(s)?s:s?[s]:[])}}}function js(e,n){let t=-1;const r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);$e(e,0,0,r)}function pa(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Ve(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Re=mn(/[A-Za-z]/),Ae=mn(/[\dA-Za-z]/),Xs=mn(/[#-'*+\--9=?A-Z^-~]/);function ht(e){return e!==null&&(e<32||e===127)}const ar=mn(/\d/),Qs=mn(/[\dA-Fa-f]/),Js=mn(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function me(e){return e!==null&&(e<0||e===32)}function re(e){return e===-2||e===-1||e===32}const xt=mn(new RegExp("\\p{P}|\\p{S}","u")),kn=mn(/\s/);function mn(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Mn(e){const n=[];let t=-1,r=0,i=0;for(;++t<e.length;){const o=e.charCodeAt(t);let a="";if(o===37&&Ae(e.charCodeAt(t+1))&&Ae(e.charCodeAt(t+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const s=e.charCodeAt(t+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(n.push(e.slice(r,t),encodeURIComponent(a)),r=t+i+1,a=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function ae(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return re(l)?(e.enter(t),s(l)):n(l)}function s(l){return re(l)&&o++<i?(e.consume(l),s):(e.exit(t),n(l))}}const el={tokenize:nl};function nl(e){const n=e.attempt(this.parser.constructs.contentInitial,r,i);let t;return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ae(e,n,"linePrefix")}function i(s){return e.enter("paragraph"),o(s)}function o(s){const l=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,a(s)}function a(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return W(s)?(e.consume(s),e.exit("chunkText"),o):(e.consume(s),a)}}const tl={tokenize:rl},oi={tokenize:il};function rl(e){const n=this,t=[];let r=0,i,o,a;return s;function s(w){if(r<t.length){const I=t[r];return n.containerState=I[1],e.attempt(I[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&S();const I=n.events.length;let R=I,k;for(;R--;)if(n.events[R][0]==="exit"&&n.events[R][1].type==="chunkFlow"){k=n.events[R][1].end;break}E(r);let U=I;for(;U<n.events.length;)n.events[U][1].end={...k},U++;return $e(n.events,R+1,0,n.events.slice(I)),n.events.length=U,c(w)}return s(w)}function c(w){if(r===t.length){if(!i)return f(w);if(i.currentConstruct&&i.currentConstruct.concrete)return g(w);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(oi,u,d)(w)}function u(w){return i&&S(),E(r),f(w)}function d(w){return n.parser.lazy[n.now().line]=r!==t.length,a=n.now().offset,g(w)}function f(w){return n.containerState={},e.attempt(oi,p,g)(w)}function p(w){return r++,t.push([n.currentConstruct,n.containerState]),f(w)}function g(w){if(w===null){i&&S(),E(0),e.consume(w);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),_(w)}function _(w){if(w===null){y(e.exit("chunkFlow"),!0),E(0),e.consume(w);return}return W(w)?(e.consume(w),y(e.exit("chunkFlow")),r=0,n.interrupt=void 0,s):(e.consume(w),_)}function y(w,I){const R=n.sliceStream(w);if(I&&R.push(null),w.previous=o,o&&(o.next=w),o=w,i.defineSkip(w.start),i.write(R),n.parser.lazy[w.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<a&&(!i.events[k][1].end||i.events[k][1].end.offset>a))return;const U=n.events.length;let $=U,G,x;for(;$--;)if(n.events[$][0]==="exit"&&n.events[$][1].type==="chunkFlow"){if(G){x=n.events[$][1].end;break}G=!0}for(E(r),k=U;k<n.events.length;)n.events[k][1].end={...x},k++;$e(n.events,$+1,0,n.events.slice(U)),n.events.length=k}}function E(w){let I=t.length;for(;I-- >w;){const R=t[I];n.containerState=R[1],R[0].exit.call(n,e)}t.length=w}function S(){i.write([null]),o=void 0,i=void 0,n.containerState._closeFlow=void 0}}function il(e,n,t){return ae(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function On(e){if(e===null||me(e)||kn(e))return 1;if(xt(e))return 2}function wt(e,n,t){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(n=o(n,t),r.push(o))}return n}const or={name:"attention",resolveAll:al,tokenize:ol};function al(e,n){let t=-1,r,i,o,a,s,l,c,u;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[t][1].start};si(d,-l),si(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:f},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[t][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Ge(c,[["enter",e[r][1],n],["exit",e[r][1],n]])),c=Ge(c,[["enter",i,n],["enter",a,n],["exit",a,n],["enter",o,n]]),c=Ge(c,wt(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),c=Ge(c,[["exit",o,n],["enter",s,n],["exit",s,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(u=2,c=Ge(c,[["enter",e[t][1],n],["exit",e[t][1],n]])):u=0,$e(e,r-1,t-r+3,c),t=r+c.length-u-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function ol(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=On(r);let o;return a;function a(l){return o=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===o)return e.consume(l),s;const c=e.exit("attentionSequence"),u=On(l),d=!u||u===2&&i||t.includes(l),f=!i||i===2&&u||t.includes(r);return c._open=!!(o===42?d:d&&(i||!f)),c._close=!!(o===42?f:f&&(u||!d)),n(l)}}function si(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const sl={name:"autolink",tokenize:ll};function ll(e,n,t){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return Re(p)?(e.consume(p),a):p===64?t(p):c(p)}function a(p){return p===43||p===45||p===46||Ae(p)?(r=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Ae(p))&&r++<32?(e.consume(p),s):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):p===null||p===32||p===60||ht(p)?t(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):Xs(p)?(e.consume(p),c):t(p)}function u(p){return Ae(p)?d(p):t(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):f(p)}function f(p){if((p===45||Ae(p))&&r++<63){const g=p===45?f:d;return e.consume(p),g}return t(p)}}const jn={partial:!0,tokenize:cl};function cl(e,n,t){return r;function r(o){return re(o)?ae(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||W(o)?n(o):t(o)}}const fa={continuation:{tokenize:dl},exit:pl,name:"blockQuote",tokenize:ul};function ul(e,n,t){const r=this;return i;function i(a){if(a===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return t(a)}function o(a){return re(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(a))}}function dl(e,n,t){const r=this;return i;function i(a){return re(a)?ae(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(fa,n,t)(a)}}function pl(e){e.exit("blockQuote")}const ga={name:"characterEscape",tokenize:fl};function fl(e,n,t){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return Js(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(o)}}const ma={name:"characterReference",tokenize:gl};function gl(e,n,t){const r=this;let i=0,o,a;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,a=Ae,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=Qs,u):(e.enter("characterReferenceValue"),o=7,a=ar,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return a===Ae&&!kr(r.sliceSerialize(f))?t(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return a(d)&&i++<o?(e.consume(d),u):t(d)}}const li={partial:!0,tokenize:hl},ci={concrete:!0,name:"codeFenced",tokenize:ml};function ml(e,n,t){const r=this,i={partial:!0,tokenize:R};let o=0,a=0,s;return l;function l(k){return c(k)}function c(k){const U=r.events[r.events.length-1];return o=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,s=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===s?(a++,e.consume(k),u):a<3?t(k):(e.exit("codeFencedFenceSequence"),re(k)?ae(e,d,"whitespace")(k):d(k))}function d(k){return k===null||W(k)?(e.exit("codeFencedFence"),r.interrupt?n(k):e.check(li,_,I)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||W(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):re(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ae(e,p,"whitespace")(k)):k===96&&k===s?t(k):(e.consume(k),f)}function p(k){return k===null||W(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||W(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===s?t(k):(e.consume(k),g)}function _(k){return e.attempt(i,I,y)(k)}function y(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),E}function E(k){return o>0&&re(k)?ae(e,S,"linePrefix",o+1)(k):S(k)}function S(k){return k===null||W(k)?e.check(li,_,I)(k):(e.enter("codeFlowValue"),w(k))}function w(k){return k===null||W(k)?(e.exit("codeFlowValue"),S(k)):(e.consume(k),w)}function I(k){return e.exit("codeFenced"),n(k)}function R(k,U,$){let G=0;return x;function x(v){return k.enter("lineEnding"),k.consume(v),k.exit("lineEnding"),P}function P(v){return k.enter("codeFencedFence"),re(v)?ae(k,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):B(v)}function B(v){return v===s?(k.enter("codeFencedFenceSequence"),ee(v)):$(v)}function ee(v){return v===s?(G++,k.consume(v),ee):G>=a?(k.exit("codeFencedFenceSequence"),re(v)?ae(k,L,"whitespace")(v):L(v)):$(v)}function L(v){return v===null||W(v)?(k.exit("codeFencedFence"),U(v)):$(v)}}}function hl(e,n,t){const r=this;return i;function i(a){return a===null?t(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}const Ft={name:"codeIndented",tokenize:El},bl={partial:!0,tokenize:_l};function El(e,n,t){const r=this;return i;function i(c){return e.enter("codeIndented"),ae(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):t(c)}function a(c){return c===null?l(c):W(c)?e.attempt(bl,a,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||W(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),n(c)}}function _l(e,n,t){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?t(a):W(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):ae(e,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(a):W(a)?i(a):t(a)}}const yl={name:"codeText",previous:xl,resolve:kl,tokenize:wl};function kl(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function xl(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wl(e,n,t){let r=0,i,o;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),s(d)}function s(d){return d===96?(e.consume(d),r++,s):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?t(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(o=e.enter("codeTextSequence"),i=0,u(d)):W(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||W(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(d)):(o.type="codeTextData",c(d))}}class Sl{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){const r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(n,r):n>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const i=t||0;this.setCursor(Math.trunc(n));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&$n(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),$n(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),$n(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const t=this.left.splice(n,Number.POSITIVE_INFINITY);$n(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);$n(this.left,t.reverse())}}}function $n(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function ha(e){const n={};let t=-1,r,i,o,a,s,l,c;const u=new Sl(e);for(;++t<u.length;){for(;t in n;)t=n[t];if(r=u.get(t),t&&r[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,Nl(u,t)),t=n[t],c=!0);else if(r[1]._container){for(o=t,i=void 0;o--;)if(a=u.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,t),s.unshift(r),u.splice(i,t-i+1,s))}}return $e(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Nl(e,n){const t=e.get(n)[1],r=e.get(n)[2];let i=n-1;const o=[];let a=t._tokenizer;a||(a=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],c={};let u,d,f=-1,p=t,g=0,_=0;const y=[_];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=t;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(_=f+1,y.push(_),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),f=y.length;f--;){const E=s.slice(y[f],y[f+1]),S=o.pop();l.push([S,S+E.length-1]),e.splice(S,2,E)}for(l.reverse(),f=-1;++f<l.length;)c[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return c}const Tl={resolve:vl,tokenize:Cl},Al={partial:!0,tokenize:Il};function vl(e){return ha(e),e}function Cl(e,n){let t;return r;function r(s){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?o(s):W(s)?e.check(Al,a,o)(s):(e.consume(s),i)}function o(s){return e.exit("chunkContent"),e.exit("content"),n(s)}function a(s){return e.consume(s),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function Il(e,n,t){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ae(e,o,"linePrefix")}function o(a){if(a===null||W(a))return t(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(a):e.interrupt(r.parser.constructs.flow,t,n)(a)}}function ba(e,n,t,r,i,o,a,s,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(E){return E===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(E),e.exit(o),f):E===null||E===32||E===41||ht(E)?t(E):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),_(E))}function f(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(i),e.exit(r),n):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===62?(e.exit("chunkString"),e.exit(s),f(E)):E===null||E===60||W(E)?t(E):(e.consume(E),E===92?g:p)}function g(E){return E===60||E===62||E===92?(e.consume(E),p):p(E)}function _(E){return!u&&(E===null||E===41||me(E))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),n(E)):u<c&&E===40?(e.consume(E),u++,_):E===41?(e.consume(E),u--,_):E===null||E===32||E===40||ht(E)?t(E):(e.consume(E),E===92?y:_)}function y(E){return E===40||E===41||E===92?(e.consume(E),_):_(E)}}function Ea(e,n,t,r,i,o){const a=this;let s=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(o),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?t(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),n):W(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||W(p)||s++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!re(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,d):d(p)}}function _a(e,n,t,r,i,o){let a;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,l):t(f)}function l(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),n):(e.enter(o),c(f))}function c(f){return f===a?(e.exit(o),l(a)):f===null?t(f):W(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ae(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||W(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===a||f===92?(e.consume(f),u):u(f)}}function qn(e,n){let t;return r;function r(i){return W(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):re(i)?ae(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}const Ol={name:"definition",tokenize:Ml},Rl={partial:!0,tokenize:Ll};function Ml(e,n,t){const r=this;let i;return o;function o(p){return e.enter("definition"),a(p)}function a(p){return Ea.call(r,e,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=Ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):t(p)}function l(p){return me(p)?qn(e,c)(p):c(p)}function c(p){return ba(e,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Rl,d,d)(p)}function d(p){return re(p)?ae(e,f,"whitespace")(p):f(p)}function f(p){return p===null||W(p)?(e.exit("definition"),r.parser.defined.push(i),n(p)):t(p)}}function Ll(e,n,t){return r;function r(s){return me(s)?qn(e,i)(s):t(s)}function i(s){return _a(e,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return re(s)?ae(e,a,"whitespace")(s):a(s)}function a(s){return s===null||W(s)?n(s):t(s)}}const Dl={name:"hardBreakEscape",tokenize:Pl};function Pl(e,n,t){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return W(o)?(e.exit("hardBreakEscape"),n(o)):t(o)}}const Bl={name:"headingAtx",resolve:Fl,tokenize:zl};function Fl(e,n){let t=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},o={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},$e(e,r,t-r+1,[["enter",i,n],["enter",o,n],["exit",o,n],["exit",i,n]])),e}function zl(e,n,t){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&r++<6?(e.consume(u),a):u===null||me(u)?(e.exit("atxHeadingSequence"),s(u)):t(u)}function s(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||W(u)?(e.exit("atxHeading"),n(u)):re(u)?ae(e,s,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||me(u)?(e.exit("atxHeadingText"),s(u)):(e.consume(u),c)}}const Ul=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ui=["pre","script","style","textarea"],$l={concrete:!0,name:"htmlFlow",resolveTo:Kl,tokenize:ql},Hl={partial:!0,tokenize:Vl},Gl={partial:!0,tokenize:Wl};function Kl(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function ql(e,n,t){const r=this;let i,o,a,s,l;return c;function c(b){return u(b)}function u(b){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(b),d}function d(b){return b===33?(e.consume(b),f):b===47?(e.consume(b),o=!0,_):b===63?(e.consume(b),i=3,r.interrupt?n:m):Re(b)?(e.consume(b),a=String.fromCharCode(b),y):t(b)}function f(b){return b===45?(e.consume(b),i=2,p):b===91?(e.consume(b),i=5,s=0,g):Re(b)?(e.consume(b),i=4,r.interrupt?n:m):t(b)}function p(b){return b===45?(e.consume(b),r.interrupt?n:m):t(b)}function g(b){const Ce="CDATA[";return b===Ce.charCodeAt(s++)?(e.consume(b),s===Ce.length?r.interrupt?n:B:g):t(b)}function _(b){return Re(b)?(e.consume(b),a=String.fromCharCode(b),y):t(b)}function y(b){if(b===null||b===47||b===62||me(b)){const Ce=b===47,He=a.toLowerCase();return!Ce&&!o&&ui.includes(He)?(i=1,r.interrupt?n(b):B(b)):Ul.includes(a.toLowerCase())?(i=6,Ce?(e.consume(b),E):r.interrupt?n(b):B(b)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(b):o?S(b):w(b))}return b===45||Ae(b)?(e.consume(b),a+=String.fromCharCode(b),y):t(b)}function E(b){return b===62?(e.consume(b),r.interrupt?n:B):t(b)}function S(b){return re(b)?(e.consume(b),S):x(b)}function w(b){return b===47?(e.consume(b),x):b===58||b===95||Re(b)?(e.consume(b),I):re(b)?(e.consume(b),w):x(b)}function I(b){return b===45||b===46||b===58||b===95||Ae(b)?(e.consume(b),I):R(b)}function R(b){return b===61?(e.consume(b),k):re(b)?(e.consume(b),R):w(b)}function k(b){return b===null||b===60||b===61||b===62||b===96?t(b):b===34||b===39?(e.consume(b),l=b,U):re(b)?(e.consume(b),k):$(b)}function U(b){return b===l?(e.consume(b),l=null,G):b===null||W(b)?t(b):(e.consume(b),U)}function $(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||me(b)?R(b):(e.consume(b),$)}function G(b){return b===47||b===62||re(b)?w(b):t(b)}function x(b){return b===62?(e.consume(b),P):t(b)}function P(b){return b===null||W(b)?B(b):re(b)?(e.consume(b),P):t(b)}function B(b){return b===45&&i===2?(e.consume(b),j):b===60&&i===1?(e.consume(b),se):b===62&&i===4?(e.consume(b),ue):b===63&&i===3?(e.consume(b),m):b===93&&i===5?(e.consume(b),pe):W(b)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Hl,fe,ee)(b)):b===null||W(b)?(e.exit("htmlFlowData"),ee(b)):(e.consume(b),B)}function ee(b){return e.check(Gl,L,fe)(b)}function L(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),v}function v(b){return b===null||W(b)?ee(b):(e.enter("htmlFlowData"),B(b))}function j(b){return b===45?(e.consume(b),m):B(b)}function se(b){return b===47?(e.consume(b),a="",X):B(b)}function X(b){if(b===62){const Ce=a.toLowerCase();return ui.includes(Ce)?(e.consume(b),ue):B(b)}return Re(b)&&a.length<8?(e.consume(b),a+=String.fromCharCode(b),X):B(b)}function pe(b){return b===93?(e.consume(b),m):B(b)}function m(b){return b===62?(e.consume(b),ue):b===45&&i===2?(e.consume(b),m):B(b)}function ue(b){return b===null||W(b)?(e.exit("htmlFlowData"),fe(b)):(e.consume(b),ue)}function fe(b){return e.exit("htmlFlow"),n(b)}}function Wl(e,n,t){const r=this;return i;function i(a){return W(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):t(a)}function o(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}function Vl(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(jn,n,t)}}const Yl={name:"htmlText",tokenize:Zl};function Zl(e,n,t){const r=this;let i,o,a;return s;function s(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),l}function l(m){return m===33?(e.consume(m),c):m===47?(e.consume(m),R):m===63?(e.consume(m),w):Re(m)?(e.consume(m),$):t(m)}function c(m){return m===45?(e.consume(m),u):m===91?(e.consume(m),o=0,g):Re(m)?(e.consume(m),S):t(m)}function u(m){return m===45?(e.consume(m),p):t(m)}function d(m){return m===null?t(m):m===45?(e.consume(m),f):W(m)?(a=d,se(m)):(e.consume(m),d)}function f(m){return m===45?(e.consume(m),p):d(m)}function p(m){return m===62?j(m):m===45?f(m):d(m)}function g(m){const ue="CDATA[";return m===ue.charCodeAt(o++)?(e.consume(m),o===ue.length?_:g):t(m)}function _(m){return m===null?t(m):m===93?(e.consume(m),y):W(m)?(a=_,se(m)):(e.consume(m),_)}function y(m){return m===93?(e.consume(m),E):_(m)}function E(m){return m===62?j(m):m===93?(e.consume(m),E):_(m)}function S(m){return m===null||m===62?j(m):W(m)?(a=S,se(m)):(e.consume(m),S)}function w(m){return m===null?t(m):m===63?(e.consume(m),I):W(m)?(a=w,se(m)):(e.consume(m),w)}function I(m){return m===62?j(m):w(m)}function R(m){return Re(m)?(e.consume(m),k):t(m)}function k(m){return m===45||Ae(m)?(e.consume(m),k):U(m)}function U(m){return W(m)?(a=U,se(m)):re(m)?(e.consume(m),U):j(m)}function $(m){return m===45||Ae(m)?(e.consume(m),$):m===47||m===62||me(m)?G(m):t(m)}function G(m){return m===47?(e.consume(m),j):m===58||m===95||Re(m)?(e.consume(m),x):W(m)?(a=G,se(m)):re(m)?(e.consume(m),G):j(m)}function x(m){return m===45||m===46||m===58||m===95||Ae(m)?(e.consume(m),x):P(m)}function P(m){return m===61?(e.consume(m),B):W(m)?(a=P,se(m)):re(m)?(e.consume(m),P):G(m)}function B(m){return m===null||m===60||m===61||m===62||m===96?t(m):m===34||m===39?(e.consume(m),i=m,ee):W(m)?(a=B,se(m)):re(m)?(e.consume(m),B):(e.consume(m),L)}function ee(m){return m===i?(e.consume(m),i=void 0,v):m===null?t(m):W(m)?(a=ee,se(m)):(e.consume(m),ee)}function L(m){return m===null||m===34||m===39||m===60||m===61||m===96?t(m):m===47||m===62||me(m)?G(m):(e.consume(m),L)}function v(m){return m===47||m===62||me(m)?G(m):t(m)}function j(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),n):t(m)}function se(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),X}function X(m){return re(m)?ae(e,pe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):pe(m)}function pe(m){return e.enter("htmlTextData"),a(m)}}const xr={name:"labelEnd",resolveAll:Jl,resolveTo:ec,tokenize:nc},jl={tokenize:tc},Xl={tokenize:rc},Ql={tokenize:ic};function Jl(e){let n=-1;const t=[];for(;++n<e.length;){const r=e[n][1];if(t.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",n+=i}}return e.length!==t.length&&$e(e,0,e.length,t),e}function ec(e,n){let t=e.length,r=0,i,o,a,s;for(;t--;)if(i=e[t][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=t);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,n],["enter",c,n]],s=Ge(s,e.slice(o+1,o+r+3)),s=Ge(s,[["enter",u,n]]),s=Ge(s,wt(n.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),n)),s=Ge(s,[["exit",u,n],e[a-2],e[a-1],["exit",c,n]]),s=Ge(s,e.slice(a+1)),s=Ge(s,[["exit",l,n]]),$e(e,o,e.length,s),e}function nc(e,n,t){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return s;function s(f){return o?o._inactive?d(f):(a=r.parser.defined.includes(Ve(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):t(f)}function l(f){return f===40?e.attempt(jl,u,a?u:d)(f):f===91?e.attempt(Xl,u,a?c:d)(f):a?u(f):d(f)}function c(f){return e.attempt(Ql,u,d)(f)}function u(f){return n(f)}function d(f){return o._balanced=!0,t(f)}}function tc(e,n,t){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return me(d)?qn(e,o)(d):o(d)}function o(d){return d===41?u(d):ba(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return me(d)?qn(e,l)(d):u(d)}function s(d){return t(d)}function l(d){return d===34||d===39||d===40?_a(e,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return me(d)?qn(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),n):t(d)}}function rc(e,n,t){const r=this;return i;function i(s){return Ea.call(r,e,o,a,"reference","referenceMarker","referenceString")(s)}function o(s){return r.parser.defined.includes(Ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(s):t(s)}function a(s){return t(s)}}function ic(e,n,t){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),n):t(o)}}const ac={name:"labelStartImage",resolveAll:xr.resolveAll,tokenize:oc};function oc(e,n,t){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),o}function o(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),a):t(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(s):n(s)}}const sc={name:"labelStartLink",resolveAll:xr.resolveAll,tokenize:lc};function lc(e,n,t){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):n(a)}}const zt={name:"lineEnding",tokenize:cc};function cc(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ae(e,n,"linePrefix")}}const mt={name:"thematicBreak",tokenize:uc};function uc(e,n,t){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),a(c)}function a(c){return i=c,s(c)}function s(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||W(c))?(e.exit("thematicBreak"),n(c)):t(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),re(c)?ae(e,s,"whitespace")(c):s(c))}}const Me={continuation:{tokenize:gc},exit:hc,name:"list",tokenize:fc},dc={partial:!0,tokenize:bc},pc={partial:!0,tokenize:mc};function fc(e,n,t){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:ar(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(mt,t,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return t(p)}function l(p){return ar(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):t(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(jn,r.interrupt?t:u,e.attempt(dc,f,d))}function u(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function d(p){return re(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):t(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(p)}}function gc(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(jn,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ae(e,n,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!re(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(pc,n,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,ae(e,e.attempt(Me,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function mc(e,n,t){const r=this;return ae(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?n(o):t(o)}}function hc(e){e.exit(this.containerState.type)}function bc(e,n,t){const r=this;return ae(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!re(o)&&a&&a[1].type==="listItemPrefixWhitespace"?n(o):t(o)}}const di={name:"setextUnderline",resolveTo:Ec,tokenize:_c};function Ec(e,n){let t=e.length,r,i,o;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!o&&e[t][1].type==="definition"&&(o=t);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,n]),e.splice(o+1,0,["exit",e[r][1],n]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,n]),e}function _c(e,n,t){const r=this;let i;return o;function o(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,a(c)):t(c)}function a(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),re(c)?ae(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||W(c)?(e.exit("setextHeadingLine"),n(c)):t(c)}}const yc={tokenize:kc};function kc(e){const n=this,t=e.attempt(jn,r,e.attempt(this.parser.constructs.flowInitial,i,ae(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Tl,i)),"linePrefix")));return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const xc={resolveAll:ka()},wc=ya("string"),Sc=ya("text");function ya(e){return{resolveAll:ka(e==="text"?Nc:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],o=t.attempt(i,a,s);return a;function a(u){return c(u)?o(u):s(u)}function s(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),o(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function ka(e){return n;function n(t,r){let i=-1,o;for(;++i<=t.length;)o===void 0?t[i]&&t[i][1].type==="data"&&(o=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==o+2&&(t[o][1].end=t[i-1][1].end,t.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(t,r):t}}function Nc(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const r=e[t-1][1],i=n.sliceStream(r);let o=i.length,a=-1,s=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){o++;break}}if(n._contentTypeTextTrailing&&t===e.length&&(s=0),s){const c={type:t===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(t,0,["enter",c,n],["exit",c,n]),t+=2)}t++}return e}const Tc={42:Me,43:Me,45:Me,48:Me,49:Me,50:Me,51:Me,52:Me,53:Me,54:Me,55:Me,56:Me,57:Me,62:fa},Ac={91:Ol},vc={[-2]:Ft,[-1]:Ft,32:Ft},Cc={35:Bl,42:mt,45:[di,mt],60:$l,61:di,95:mt,96:ci,126:ci},Ic={38:ma,92:ga},Oc={[-5]:zt,[-4]:zt,[-3]:zt,33:ac,38:ma,42:or,60:[sl,Yl],91:sc,92:[Dl,ga],93:xr,95:or,96:yl},Rc={null:[or,xc]},Mc={null:[42,95]},Lc={null:[]},Dc=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Mc,contentInitial:Ac,disable:Lc,document:Tc,flow:Cc,flowInitial:vc,insideSpan:Rc,string:Ic,text:Oc},Symbol.toStringTag,{value:"Module"}));function Pc(e,n,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const i={},o=[];let a=[],s=[];const l={attempt:U(R),check:U(k),consume:S,enter:w,exit:I,interrupt:U(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:_,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=n.tokenize.call(c,l);return n.resolveAll&&o.push(n),c;function d(P){return a=Ge(a,P),y(),a[a.length-1]!==null?[]:($(n,0),c.events=wt(o,c.events,c),c.events)}function f(P,B){return Fc(p(P),B)}function p(P){return Bc(a,P)}function g(){const{_bufferIndex:P,_index:B,line:ee,column:L,offset:v}=r;return{_bufferIndex:P,_index:B,line:ee,column:L,offset:v}}function _(P){i[P.line]=P.column,x()}function y(){let P;for(;r._index<a.length;){const B=a[r._index];if(typeof B=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<B.length;)E(B.charCodeAt(r._bufferIndex));else E(B)}}function E(P){u=u(P)}function S(P){W(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,x()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=P}function w(P,B){const ee=B||{};return ee.type=P,ee.start=g(),c.events.push(["enter",ee,c]),s.push(ee),ee}function I(P){const B=s.pop();return B.end=g(),c.events.push(["exit",B,c]),B}function R(P,B){$(P,B.from)}function k(P,B){B.restore()}function U(P,B){return ee;function ee(L,v,j){let se,X,pe,m;return Array.isArray(L)?fe(L):"tokenize"in L?fe([L]):ue(L);function ue(Ee){return Je;function Je(De){const en=De!==null&&Ee[De],Pe=De!==null&&Ee.null,ln=[...Array.isArray(en)?en:en?[en]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return fe(ln)(De)}}function fe(Ee){return se=Ee,X=0,Ee.length===0?j:b(Ee[X])}function b(Ee){return Je;function Je(De){return m=G(),pe=Ee,Ee.partial||(c.currentConstruct=Ee),Ee.name&&c.parser.constructs.disable.null.includes(Ee.name)?He():Ee.tokenize.call(B?Object.assign(Object.create(c),B):c,l,Ce,He)(De)}}function Ce(Ee){return P(pe,m),v}function He(Ee){return m.restore(),++X<se.length?b(se[X]):j}}}function $(P,B){P.resolveAll&&!o.includes(P)&&o.push(P),P.resolve&&$e(c.events,B,c.events.length-B,P.resolve(c.events.slice(B),c)),P.resolveTo&&(c.events=P.resolveTo(c.events,c))}function G(){const P=g(),B=c.previous,ee=c.currentConstruct,L=c.events.length,v=Array.from(s);return{from:L,restore:j};function j(){r=P,c.previous=B,c.currentConstruct=ee,c.events.length=L,s=v,x()}}function x(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Bc(e,n){const t=n.start._index,r=n.start._bufferIndex,i=n.end._index,o=n.end._bufferIndex;let a;if(t===i)a=[e[t].slice(r,o)];else{if(a=e.slice(t,i),r>-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function Fc(e,n){let t=-1;const r=[];let i;for(;++t<e.length;){const o=e[t];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
|
|
3
3
|
`;break}case-3:{a=`\r
|
|
4
4
|
`;break}case-2:{a=n?" ":" ";break}case-1:{if(!n&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function zc(e){const r={constructs:da([Dc,...(e||{}).extensions||[]]),content:i(el),defined:[],document:i(tl),flow:i(yc),lazy:{},string:i(wc),text:i(Sc)};return r;function i(o){return a;function a(s){return Pc(r,o,s)}}}function Uc(e){for(;!ha(e););return e}const pi=/[\0\t\n\r]/g;function $c(){let e=1,n="",t=!0,r;return i;function i(o,a,s){const l=[];let c,u,d,f,p;for(o=n+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),d=0,n="",t&&(o.charCodeAt(0)===65279&&d++,t=void 0);d<o.length;){if(pi.lastIndex=d,c=pi.exec(o),f=c&&c.index!==void 0?c.index:o.length,p=o.charCodeAt(f),!c){n=o.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(o.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return s&&(r&&l.push(-5),n&&l.push(n),l.push(null)),l}}const Hc=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Gc(e){return e.replace(Hc,Kc)}function Kc(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),o=i===120||i===88;return pa(t.slice(o?2:1),o?16:10)}return kr(t)||e}const xa={}.hasOwnProperty;function qc(e,n,t){return n&&typeof n=="object"&&(t=n,n=void 0),Wc(t)(Uc(zc(t).document().write($c()(e,n,!0))))}function Wc(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Nn),autolinkProtocol:G,autolinkEmail:G,atxHeading:o(Sn),blockQuote:o(Pe),characterEscape:G,characterReference:G,codeFenced:o(ln),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(ln,a),codeText:o(Ln,a),codeTextData:G,data:G,codeFlowValue:G,definition:o(Dn),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Pn),hardBreakEscape:o(oe),hardBreakTrailing:o(oe),htmlFlow:o(nn,a),htmlFlowData:G,htmlText:o(nn,a),htmlTextData:G,image:o(tn),label:a,link:o(Nn),listItem:o(At),listItemValue:f,listOrdered:o(Bn,d),listUnordered:o(Bn),paragraph:o(vt),reference:b,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Sn),strong:o(Jn),thematicBreak:o(et)},exit:{atxHeading:l(),atxHeadingSequence:R,autolink:l(),autolinkEmail:en,autolinkProtocol:De,blockQuote:l(),characterEscapeValue:x,characterReferenceMarkerHexadecimal:He,characterReferenceMarkerNumeric:He,characterReferenceValue:Ee,characterReference:Je,codeFenced:l(y),codeFencedFence:_,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:x,codeIndented:l(E),codeText:l(v),codeTextData:x,data:x,definition:l(),definitionDestinationString:I,definitionLabelString:S,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(ee),htmlFlowData:x,htmlText:l(L),htmlTextData:x,image:l(se),label:pe,labelText:X,lineEnding:P,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Ce,resourceDestinationString:m,resourceTitleString:ue,resource:fe,setextHeading:l($),setextHeadingLineSequence:U,setextHeadingText:k,strong:l(),thematicBreak:l()}};wa(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(N){let O={type:"root",children:[]};const V={stack:[O],tokenStack:[],config:n,enter:s,exit:c,buffer:a,resume:u,data:t},te=[];let le=-1;for(;++le<N.length;)if(N[le][1].type==="listOrdered"||N[le][1].type==="listUnordered")if(N[le][0]==="enter")te.push(le);else{const Be=te.pop();le=i(N,Be,le)}for(le=-1;++le<N.length;){const Be=n[N[le][0]];xa.call(Be,N[le][1].type)&&Be[N[le][1].type].call(Object.assign({sliceSerialize:N[le][2].sliceSerialize},V),N[le][1])}if(V.tokenStack.length>0){const Be=V.tokenStack[V.tokenStack.length-1];(Be[1]||fi).call(V,void 0,Be[0])}for(O.position={start:fn(N.length>0?N[0][1].start:{line:1,column:1,offset:0}),end:fn(N.length>0?N[N.length-2][1].end:{line:1,column:1,offset:0})},le=-1;++le<n.transforms.length;)O=n.transforms[le](O)||O;return O}function i(N,O,V){let te=O-1,le=-1,Be=!1,an,Ke,cn,hn;for(;++te<=V;){const Ie=N[te];switch(Ie[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ie[0]==="enter"?le++:le--,hn=void 0;break}case"lineEndingBlank":{Ie[0]==="enter"&&(an&&!hn&&!le&&!cn&&(cn=te),hn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:hn=void 0}if(!le&&Ie[0]==="enter"&&Ie[1].type==="listItemPrefix"||le===-1&&Ie[0]==="exit"&&(Ie[1].type==="listUnordered"||Ie[1].type==="listOrdered")){if(an){let un=te;for(Ke=void 0;un--;){const Fe=N[un];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;Ke&&(N[Ke][1].type="lineEndingBlank",Be=!0),Fe[1].type="lineEnding",Ke=un}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}cn&&(!Ke||cn<Ke)&&(an._spread=!0),an.end=Object.assign({},Ke?N[Ke][1].start:Ie[1].end),N.splice(Ke||te,0,["exit",an,Ie[2]]),te++,V++}if(Ie[1].type==="listItemPrefix"){const un={type:"listItem",_spread:!1,start:Object.assign({},Ie[1].start),end:void 0};an=un,N.splice(te,0,["enter",un,Ie[2]]),te++,V++,cn=void 0,hn=!0}}}return N[O][1]._spread=Be,V}function o(N,O){return V;function V(te){s.call(this,N(te),te),O&&O.call(this,te)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(N,O,V){this.stack[this.stack.length-1].children.push(N),this.stack.push(N),this.tokenStack.push([O,V||void 0]),N.position={start:fn(O.start),end:void 0}}function l(N){return O;function O(V){N&&N.call(this,V),c.call(this,V)}}function c(N,O){const V=this.stack.pop(),te=this.tokenStack.pop();if(te)te[0].type!==N.type&&(O?O.call(this,N,te[0]):(te[1]||fi).call(this,N,te[0]));else throw new Error("Cannot close `"+N.type+"` ("+Kn({start:N.start,end:N.end})+"): it’s not open");V.position.end=fn(N.end)}function u(){return yr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(N){if(this.data.expectingFirstListItemValue){const O=this.stack[this.stack.length-2];O.start=Number.parseInt(this.sliceSerialize(N),10),this.data.expectingFirstListItemValue=void 0}}function p(){const N=this.resume(),O=this.stack[this.stack.length-1];O.lang=N}function g(){const N=this.resume(),O=this.stack[this.stack.length-1];O.meta=N}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const N=this.resume(),O=this.stack[this.stack.length-1];O.value=N.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const N=this.resume(),O=this.stack[this.stack.length-1];O.value=N.replace(/(\r?\n|\r)$/g,"")}function S(N){const O=this.resume(),V=this.stack[this.stack.length-1];V.label=O,V.identifier=Ve(this.sliceSerialize(N)).toLowerCase()}function w(){const N=this.resume(),O=this.stack[this.stack.length-1];O.title=N}function I(){const N=this.resume(),O=this.stack[this.stack.length-1];O.url=N}function R(N){const O=this.stack[this.stack.length-1];if(!O.depth){const V=this.sliceSerialize(N).length;O.depth=V}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function U(N){const O=this.stack[this.stack.length-1];O.depth=this.sliceSerialize(N).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function G(N){const V=this.stack[this.stack.length-1].children;let te=V[V.length-1];(!te||te.type!=="text")&&(te=rn(),te.position={start:fn(N.start),end:void 0},V.push(te)),this.stack.push(te)}function x(N){const O=this.stack.pop();O.value+=this.sliceSerialize(N),O.position.end=fn(N.end)}function P(N){const O=this.stack[this.stack.length-1];if(this.data.atHardBreak){const V=O.children[O.children.length-1];V.position.end=fn(N.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(O.type)&&(G.call(this,N),x.call(this,N))}function B(){this.data.atHardBreak=!0}function ee(){const N=this.resume(),O=this.stack[this.stack.length-1];O.value=N}function L(){const N=this.resume(),O=this.stack[this.stack.length-1];O.value=N}function v(){const N=this.resume(),O=this.stack[this.stack.length-1];O.value=N}function j(){const N=this.stack[this.stack.length-1];if(this.data.inReference){const O=this.data.referenceType||"shortcut";N.type+="Reference",N.referenceType=O,delete N.url,delete N.title}else delete N.identifier,delete N.label;this.data.referenceType=void 0}function se(){const N=this.stack[this.stack.length-1];if(this.data.inReference){const O=this.data.referenceType||"shortcut";N.type+="Reference",N.referenceType=O,delete N.url,delete N.title}else delete N.identifier,delete N.label;this.data.referenceType=void 0}function X(N){const O=this.sliceSerialize(N),V=this.stack[this.stack.length-2];V.label=Gc(O),V.identifier=Ve(O).toLowerCase()}function pe(){const N=this.stack[this.stack.length-1],O=this.resume(),V=this.stack[this.stack.length-1];if(this.data.inReference=!0,V.type==="link"){const te=N.children;V.children=te}else V.alt=O}function m(){const N=this.resume(),O=this.stack[this.stack.length-1];O.url=N}function ue(){const N=this.resume(),O=this.stack[this.stack.length-1];O.title=N}function fe(){this.data.inReference=void 0}function b(){this.data.referenceType="collapsed"}function Ce(N){const O=this.resume(),V=this.stack[this.stack.length-1];V.label=O,V.identifier=Ve(this.sliceSerialize(N)).toLowerCase(),this.data.referenceType="full"}function He(N){this.data.characterReferenceType=N.type}function Ee(N){const O=this.sliceSerialize(N),V=this.data.characterReferenceType;let te;V?(te=pa(O,V==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):te=kr(O);const le=this.stack[this.stack.length-1];le.value+=te}function Je(N){const O=this.stack.pop();O.position.end=fn(N.end)}function De(N){x.call(this,N);const O=this.stack[this.stack.length-1];O.url=this.sliceSerialize(N)}function en(N){x.call(this,N);const O=this.stack[this.stack.length-1];O.url="mailto:"+this.sliceSerialize(N)}function Pe(){return{type:"blockquote",children:[]}}function ln(){return{type:"code",lang:null,meta:null,value:""}}function Ln(){return{type:"inlineCode",value:""}}function Dn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Pn(){return{type:"emphasis",children:[]}}function Sn(){return{type:"heading",depth:0,children:[]}}function oe(){return{type:"break"}}function nn(){return{type:"html",value:""}}function tn(){return{type:"image",title:null,url:"",alt:null}}function Nn(){return{type:"link",title:null,url:"",children:[]}}function Bn(N){return{type:"list",ordered:N.type==="listOrdered",start:null,spread:N._spread,children:[]}}function At(N){return{type:"listItem",spread:N._spread,checked:null,children:[]}}function vt(){return{type:"paragraph",children:[]}}function Jn(){return{type:"strong",children:[]}}function rn(){return{type:"text",value:""}}function et(){return{type:"thematicBreak"}}}function fn(e){return{line:e.line,column:e.column,offset:e.offset}}function wa(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?wa(e,r):Vc(e,r)}}function Vc(e,n){let t;for(t in n)if(xa.call(n,t))switch(t){case"canContainEols":{const r=n[t];r&&e[t].push(...r);break}case"transforms":{const r=n[t];r&&e[t].push(...r);break}case"enter":case"exit":{const r=n[t];r&&Object.assign(e[t],r);break}}}function fi(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Kn({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Kn({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Kn({start:n.start,end:n.end})+") is still open")}function Yc(e){const n=this;n.parser=t;function t(r){return qc(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Zc(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function jc(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-force-graph-2d-
|
|
2
|
-
import{
|
|
3
|
-
`)}function Fe({content:e,attachments:n,onRetry:s,retrying:r=!1}){const i={content:e,attachments:n},l=z(i);if(l==="pending"){const a=G(i);return t.jsxs("output",{"aria-live":"polite",className:"mb-4 inline-flex items-center gap-2 rounded-md border border-sky-500/30 bg-sky-500/5 px-3 py-1.5 text-xs text-sky-300",children:[t.jsx("span",{"aria-hidden":!0,className:"inline-block h-2 w-2 animate-pulse rounded-full bg-sky-400"}),"Transcribing…",a?t.jsxs("span",{className:"text-sky-300/80",children:["part ",Math.min(a.done+1,a.total)," of ",a.total]}):null]})}return l==="failed"?t.jsxs("output",{className:"mb-4 inline-flex flex-wrap items-center gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-1.5 text-xs text-amber-200",children:[t.jsx("span",{children:"Transcription unavailable — open the audio below and add a note by hand."}),s?t.jsx("button",{type:"button",onClick:s,disabled:r,className:"rounded border border-amber-500/40 px-2 py-0.5 font-medium text-amber-100 hover:bg-amber-500/15 disabled:opacity-50",children:r?"Retrying…":"Retry"}):null]}):l==="voice-limit"?t.jsx("output",{className:"mb-4 inline-flex items-center gap-2 rounded-md border border-border bg-bg/40 px-3 py-1.5 text-xs text-fg-muted",children:"Monthly voice limit reached — transcription resumes next month. The audio is saved below."}):null}function et(){const{id:e}=W(),n=k(r=>r.getActiveVault()),s=F(e);return fe(e,s.data),d.useEffect(()=>{n&&e&&K(n.id,e)},[n,e]),n?t.jsxs("div",{className:"page",children:[t.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:t.jsx(g,{to:"/notes",className:"focus-ring hover:text-accent",children:"← All notes"})}),s.isPending?t.jsx(Ge,{}):s.data?t.jsxs(t.Fragment,{children:[s.isError?t.jsx(Y,{}):null,t.jsx($e,{note:s.data,cacheId:e})]}):s.isError?t.jsx(qe,{error:s.error,retry:()=>s.refetch()}):t.jsx(Ye,{id:e??""})]}):t.jsx(Q,{to:"/",replace:!0})}function $e({note:e,cacheId:n}){var R,T;const s=k(x=>x.getActiveVault()),{roles:r}=q((s==null?void 0:s.id)??null),i=X(),{mirror:l}=Z(),a=l.state==="offline",o=e.contentEvicted===!0,u=d.useMemo(()=>xe(e),[e]),m=L(x=>x.on),c=L(x=>x.setOn);d.useEffect(()=>{if(!m)return;const x=y=>{y.key==="Escape"&&c(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[m,c]);const h=e.path??e.id,f=J(e.content),p=f!==null&&!ee(f,e)?f:null,j=p!==null?{kind:"title",text:p}:e.path?te(e.path):{kind:"title",text:e.id},C=d.useMemo(()=>p!==null?{...e,content:se(e.content??"")}:e,[e,p]),I=typeof((R=e.metadata)==null?void 0:R.summary)=="string"?e.metadata.summary:null,E=d.useMemo(()=>(e.links??[]).filter(x=>x.targetId===e.id&&x.sourceId!==e.id&&x.sourceNote),[e]),S=d.useMemo(()=>{const x=new Set,y=[];for(const N of e.links??[])N.sourceId!==e.id||N.targetId===e.id||N.targetNote&&(x.has(N.targetId)||(x.add(N.targetId),y.push(N)));return y},[e]);return t.jsxs("article",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("header",{className:"mb-8 border-b border-border pb-5",children:[t.jsx("h1",{className:j.kind==="timestamp"?"page-title title-timestamp":"page-title",children:j.text}),a?t.jsx(Ke,{}):null,e.tags&&e.tags.length>0?t.jsx(Ue,{tags:e.tags}):null,I?t.jsx("p",{className:"mt-3 text-fg-muted",children:I}):null,t.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[t.jsx(g,{to:`/n/${encodeURIComponent(e.id)}/edit`,className:"btn btn-secondary btn-touch",children:"Edit"}),t.jsx(ue,{note:e,keyboard:!0}),t.jsx(me,{note:e}),t.jsxs("button",{type:"button",onClick:()=>c(!0),className:"btn btn-ghost btn-touch",title:"Focus (⌘.)",children:[t.jsx(ne,{width:16,height:16}),"Focus"]}),re(e,r.view)?t.jsx(g,{to:`/views/${encodeURIComponent(e.id)}`,className:"btn btn-secondary btn-touch",children:"Open as view"}):null]}),t.jsx(Ve,{value:h,isPath:!!e.path})]}),t.jsx(Fe,{content:e.content??"",attachments:e.attachments,onRetry:()=>i.mutate({cacheId:n??e.id,serverId:e.id}),retrying:i.isPending}),o?t.jsx(Qe,{preview:e.preview}):(T=C.content)!=null&&T.trim()?t.jsx(he,{note:C,resolve:u}):p===null?t.jsx(We,{noteId:e.id}):null,e.attachments&&e.attachments.length>0?t.jsxs("section",{className:"mt-10 border-t border-border pt-6",children:[t.jsx("h2",{className:"mb-3 font-serif text-xl",children:"Attachments"}),t.jsx("div",{className:"space-y-6",children:e.attachments.map(x=>t.jsx(Oe,{attachment:x},x.id))})]}):null,t.jsx(Ce,{anchor:e})]}),t.jsxs("aside",{className:"space-y-6 text-sm lg:sticky lg:top-24 lg:self-start",children:[t.jsx(Be,{note:e}),S.length>0?t.jsx(A,{title:"Outbound",links:S,peer:"target"}):null,E.length>0?t.jsx(A,{title:"Inbound",links:E,peer:"source"}):null]})]})}function Be({note:e}){const n=e.createdAt,s=e.updatedAt,r=Object.entries(e.metadata??{}).filter(([i])=>i!=="summary");return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsx("h2",{className:"eyebrow mb-2",children:"Metadata"}),t.jsxs("dl",{className:"space-y-1.5 text-sm",children:[e.path?t.jsx(v,{label:"Title",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.path})}):null,t.jsx(v,{label:"ID",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.id})}),t.jsx(v,{label:"Created",value:t.jsx("time",{title:n,children:P(n)})}),s?t.jsx(v,{label:"Updated",value:t.jsx("time",{title:s,children:P(s)})}):null,e.path?t.jsx(v,{label:"Path",value:t.jsx(oe,{value:e.path,label:"note path",className:"mt-1"})}):null,r.map(([i,l])=>t.jsx(v,{label:i,value:t.jsx("span",{className:"break-all text-fg-muted",children:String(l)})},i))]}),e.path?t.jsx(Me,{path:e.path}):null,t.jsx(le,{note:e,variant:"detail",className:"mt-3"})]})}function Me({path:e}){const{copied:n,copy:s}=$();return t.jsx("button",{type:"button",onClick:()=>s(e),className:"btn btn-secondary btn-touch mt-3 w-full","aria-label":"Copy reference to this note",children:n?"Copied ✓":"Copy reference"})}function v({label:e,value:n}){return t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("dt",{className:"eyebrow",children:e}),t.jsx("dd",{children:n})]})}function Ue({tags:e}){return t.jsx("div",{className:"mt-2 flex flex-wrap gap-1","aria-label":"Tags",children:e.map(n=>t.jsxs(g,{to:`/tags/${encodeURIComponent(n)}`,className:"chip chip-tag focus-ring max-w-full break-all",children:["#",n]},n))})}function De(e){return t.jsxs("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[t.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),t.jsx("path",{d:"M5 15H4.5A1.5 1.5 0 0 1 3 13.5v-9A1.5 1.5 0 0 1 4.5 3h9A1.5 1.5 0 0 1 15 4.5V5"})]})}function Ve({value:e,isPath:n}){const{copied:s,copy:r}=$();return t.jsxs("button",{type:"button",onClick:()=>r(e),"aria-label":n?"Copy path":"Copy note id",className:"focus-ring group mt-4 flex max-w-full items-center gap-1.5 rounded text-fg-dim transition-colors hover:text-fg-muted",children:[t.jsx(De,{className:"shrink-0 opacity-70 transition-opacity group-hover:opacity-100"}),t.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:e}),s?t.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:"Copied"}):null]})}function A({title:e,links:n,peer:s}){return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsxs("h2",{className:"eyebrow mb-2 tabular-nums",children:[e," (",n.length,")"]}),t.jsx("ul",{className:"space-y-1.5",children:n.map(r=>{var o;const i=s==="source"?r.sourceNote:r.targetNote;if(!i)return null;const l=i.path??i.id,a=typeof((o=i.metadata)==null?void 0:o.summary)=="string"?i.metadata.summary:null;return t.jsx("li",{children:t.jsxs(g,{to:`/n/${encodeURIComponent(i.id)}`,className:"block rounded px-1 py-0.5 hover:bg-bg/50",children:[t.jsx("div",{className:"truncate font-mono text-xs text-fg-muted hover:text-accent",children:l}),a?t.jsx("div",{className:"mt-0.5 line-clamp-2 text-xs text-fg-dim",children:a}):null]})},`${r.sourceId}->${r.targetId}:${r.relationship}`)})})]})}function Oe({attachment:e}){const n=e.filename;if(!n||!e.url)return t.jsx("figure",{className:"card shadow-soft p-3",children:t.jsx(M,{})});const s=(e.mimeType??"").toLowerCase();return t.jsxs("figure",{className:"card shadow-soft p-3",children:[t.jsxs("figcaption",{className:"mb-2 flex items-baseline justify-between gap-3",children:[t.jsx("span",{className:"truncate font-mono text-xs text-fg-muted",children:n}),typeof e.size=="number"?t.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:ze(e.size)}):null]}),t.jsx(_e,{attachment:e,mime:s,filename:n})]})}function M(){return t.jsxs("div",{className:"flex items-center gap-2 text-sm text-fg-dim","aria-busy":"true",children:[t.jsx(b,{className:"h-4 w-32"}),t.jsx("span",{children:"Processing…"})]})}function _e({attachment:e,mime:n,filename:s}){const r=w(),[i,l]=d.useState(null),[a,o]=d.useState(null),u=He(n,s),m=u!=="other",c=e.url;if(d.useEffect(()=>{if(!m||!c||!r)return;let f=!1,p=null;return o(null),r.fetchAttachmentBlob(c).then(j=>{f||(p=URL.createObjectURL(j),l(p))}).catch(j=>{f||o(j instanceof Error?j.message:"Failed to load attachment")}),()=>{f=!0,p&&URL.revokeObjectURL(p)}},[m,c,r]),!c)return t.jsx(M,{});if(a)return t.jsx("p",{className:"text-sm text-danger",children:a});if(m&&!i)return t.jsx(b,{className:"h-32 w-full"});const h=i??c;return u==="image"?t.jsx("img",{src:h,alt:s,className:"max-h-[32rem] rounded"}):u==="audio"?t.jsx("audio",{controls:!0,src:h,className:"w-full"}):u==="video"?t.jsx("video",{controls:!0,src:h,className:"w-full rounded"}):u==="pdf"?t.jsxs(t.Fragment,{children:[t.jsx("iframe",{src:h,title:s,className:"h-[40rem] w-full rounded border border-border"}),t.jsxs("a",{href:h,download:s,className:"mt-2 inline-block text-sm text-accent hover:underline",children:["Download ",s]})]}):t.jsxs("a",{href:h,download:s,className:"text-sm text-accent hover:underline",children:["Download ",s]})}function He(e,n){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e==="application/pdf")return"pdf";const s=n.toLowerCase().split(".").pop()??"";return["png","jpg","jpeg","gif","webp","svg"].includes(s)?"image":["mp3","wav","ogg","m4a","flac"].includes(s)?"audio":["mp4","webm","mov"].includes(s)?"video":s==="pdf"?"pdf":"other"}function ze(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Ge(){return t.jsxs("div",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]","aria-busy":"true",children:[t.jsxs("div",{className:"min-w-0 space-y-3",children:[t.jsx(b,{className:"h-3 w-32"}),t.jsx(b,{className:"h-8 w-2/3"}),t.jsx(b,{className:"h-4 w-full"}),t.jsx("div",{className:"mt-6 space-y-2",children:[0,1,2,3,4,5].map(e=>t.jsx(b,{className:"h-3",width:`${70+e*13%25}%`},e))})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(b,{className:"h-32"}),t.jsx(b,{className:"h-24"})]})]})}function We({noteId:e}){return t.jsxs("p",{className:"my-8 font-serif text-lg italic text-fg-muted",children:["Nothing here yet."," ",t.jsx(g,{to:`/n/${encodeURIComponent(e)}/edit`,className:"not-italic text-accent hover:underline",children:"Start writing →"})]})}function Ke(){return t.jsx("p",{className:"mt-2",children:t.jsx("span",{className:"chip bg-bg-soft text-fg-muted",title:"Served from your offline copy",children:"Saved copy"})})}function Qe({preview:e}){return t.jsxs("div",{className:"my-8",children:[e?t.jsx("p",{className:"mb-4 text-fg-muted",children:e}):null,t.jsx("p",{className:"font-serif text-lg italic text-fg-muted",children:"Connect to load this note."})]})}function Ye({id:e}){return t.jsx(ie,{title:t.jsx("span",{className:"font-serif text-xl text-fg",children:"Note not found"}),description:t.jsxs(t.Fragment,{children:["No note with id ",t.jsx("span",{className:"font-mono",children:e})," in this vault."]}),action:t.jsx(g,{to:"/notes",className:"text-sm text-accent hover:underline",children:"Back to all notes"})})}function qe({error:e,retry:n}){const s=e instanceof ce,r=e instanceof de,i=s?"Session expired":r?"Note not found":"Could not load note",l=s?e.message:r?"Couldn't find this note. It may have been deleted, or the link may be wrong.":"Something went wrong loading this note. You can try again, or head back to your notes.";return t.jsx(ae,{title:i,message:t.jsxs(t.Fragment,{children:[l,s?null:t.jsxs("details",{className:"mt-3",children:[t.jsx("summary",{className:"cursor-pointer text-xs text-fg-dim hover:text-fg-muted",children:"Technical detail"}),t.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-xs text-fg-dim",children:e.message})]})]}),retry:s?void 0:n,action:s?t.jsx(g,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):t.jsx(g,{to:"/notes",className:"btn btn-secondary btn-touch",children:"Back to notes"})})}export{et as NoteView};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-force-graph-2d-BtLtJaOD.js","assets/index-C2wr_d3O.js","assets/index-BBWRhmyM.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a7 as w,a as k,ay as U,r as d,aP as D,j as t,ah as F,aQ as V,L as g,aR as O,aS as _,aT as z,aU as H,aV as G,ag as W,aW as K,N as Q,a2 as q,y as b,a3 as X,aX as Y,az as Z,ai as L,aY as J,aZ as ee,a_ as te,a$ as se,ao as ne,b0 as re,E as ae,z as ie,b1 as $,A as P,$ as oe,b2 as le,V as ce,a9 as de}from"./index-C2wr_d3O.js";import{P as ue,D as me}from"./PinArchiveButtons-BaeSYCvb.js";import{b as xe,N as he}from"./NoteRenderer-BwgvmHZD.js";function fe(e,n){const s=w(),r=k(u=>u.activeVaultId),i=U(),[l,a]=d.useState(!1),o=n&&!pe(n)?n.path:void 0;return d.useEffect(()=>{if(a(!1),!s||!r||!e||!o)return;let u=!0;const m=()=>{u&&i.invalidateQueries({queryKey:["note",r,e]})},c=ge(s,o,{onUpsert:m,onRemove:m,onStatus:h=>{u&&a(h==="open")}});return()=>{u=!1,a(!1),c()}},[s,r,e,o,i]),{isLive:l}}function pe(e){return D(e.id)}function ge(e,n,s){return e.subscribe({path:n},{onSnapshot:()=>{},onUpsert:()=>s.onUpsert(),onRemove:()=>s.onRemove(),onStatus:s.onStatus})}const be=1,je=3,Ne=1;function ve(e,n){const s=new Map,r=new Map;for(const l of n.values())for(const a of l.links??[]){if(a.sourceId===a.targetId||!n.has(a.sourceId)||!n.has(a.targetId))continue;const o=`${a.sourceId}|${a.targetId}|${a.relationship}`;s.has(o)||(s.set(o,{source:a.sourceId,target:a.targetId,relationship:a.relationship}),r.set(a.sourceId,(r.get(a.sourceId)??0)+1),r.set(a.targetId,(r.get(a.targetId)??0)+1))}return{nodes:[...n.values()].map(l=>{var a;return{id:l.id,path:l.path,tags:l.tags,summary:typeof((a=l.metadata)==null?void 0:a.summary)=="string"?l.metadata.summary:void 0,isAnchor:l.id===e,linkCount:r.get(l.id)??0}}),edges:[...s.values()]}}async function ye(e,n,s,r){const i=new Map;i.set(e.id,e);let l=[e];for(let a=1;a<=n;a++){const o=new Set;for(const c of l)for(const h of c.links??[]){const f=h.sourceId===c.id?h.targetId:h.sourceId;f!==c.id&&(i.has(f)||o.add(f))}if(o.size===0)break;const u=await Promise.all([...o].map(c=>s(c).catch(()=>null)));if(r!=null&&r.cancelled)return i;const m=[];for(const c of u)c&&!i.has(c.id)&&(i.set(c.id,c),m.push(c));l=m}return i}function we(e,n,s){const[r,i]=d.useState(null),[l,a]=d.useState(!1);return d.useEffect(()=>{if(!e||!n){i(null),a(!1);return}const o={cancelled:!1};return a(!0),ye(n,s,u=>e.getNote(u,{includeLinks:!0}),o).then(u=>{o.cancelled||(i(ve(n.id,u)),a(!1))}).catch(()=>{o.cancelled||a(!1)}),()=>{o.cancelled=!0}},[e,n,s]),{data:r,isLoading:l}}const ke=d.lazy(()=>_(()=>import("./react-force-graph-2d-BtLtJaOD.js"),__vite__mapDeps([0,1,2])));function Ce({anchor:e}){const[n,s]=d.useState(!0),[r,i]=d.useState(Ne),l=w(),{data:a,isLoading:o}=we(l,n?e:void 0,r);return t.jsxs("section",{className:"mt-10 border-t border-border pt-6",children:[t.jsxs("header",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("button",{type:"button",onClick:()=>s(u=>!u),"aria-expanded":n,className:"font-serif text-xl text-fg hover:text-accent",children:[n?"▾":"▸"," Neighborhood"]}),n&&a?t.jsxs("span",{className:"text-xs text-fg-dim",children:[a.nodes.length," ",a.nodes.length===1?"note":"notes"]}):null]}),n?t.jsx(Ie,{depth:r,onChange:i}):null]}),n?t.jsx(Ee,{data:a,isLoading:o}):null]})}function Ie({depth:e,onChange:n}){const s=[];for(let r=be;r<=je;r++)s.push(r);return t.jsxs("fieldset",{className:"flex items-center gap-1 text-xs text-fg-dim",children:[t.jsx("legend",{className:"mr-1 inline-block",children:"Hops"}),s.map(r=>t.jsx("button",{type:"button","aria-pressed":r===e,onClick:()=>n(r),className:r===e?"rounded border border-accent bg-accent/10 px-2 py-0.5 text-accent":"rounded border border-border bg-card px-2 py-0.5 hover:text-accent",children:r},r))]})}function Ee({data:e,isLoading:n}){const[s,r]=d.useState(null),i=d.useRef(null);if(d.useEffect(()=>{s&&e&&!e.nodes.some(m=>m.id===s)&&r(null)},[e,s]),!e&&n)return t.jsx(B,{});if(!e)return null;if(e.nodes.length<=1)return t.jsx("div",{className:"rounded-md border border-border bg-card p-6 text-center text-sm text-fg-dim",children:"This note has no neighbors yet."});const l=e.nodes.filter(m=>!m.isAnchor),a=s?e.nodes.find(m=>m.id===s)??null:null,o=m=>{i.current=document.activeElement??null,r(m)},u=m=>{var c,h;r(null),m!=null&&m.restoreFocus&&((h=(c=i.current)==null?void 0:c.focus)==null||h.call(c))};return t.jsxs(t.Fragment,{children:[t.jsx(Pe,{data:e,onSelect:o}),a?t.jsx(Re,{node:a,onClose:u},a.id):null,t.jsx(Se,{neighbors:l,selectedId:s,onSelect:o})]})}function Se({neighbors:e,selectedId:n,onSelect:s}){return e.length===0?null:t.jsxs("div",{className:"mt-4",children:[t.jsx("h3",{className:"eyebrow mb-2",children:"Neighbors"}),t.jsx("ul",{className:"flex flex-wrap gap-2",children:e.map(r=>{const i=O(r.path??r.id);return t.jsx("li",{children:t.jsx("button",{type:"button",onClick:()=>s(r.id),"aria-haspopup":"dialog","aria-pressed":n===r.id,"aria-label":`Preview ${i}`,className:`btn btn-sm btn-touch max-w-full ${n===r.id?"btn-primary":"btn-secondary"}`,children:t.jsx("span",{className:"truncate",children:i})})},r.id)})})]})}function Re({node:e,onClose:n}){var a;const s=F(e.id),r=d.useRef(null);d.useEffect(()=>{var o;(o=r.current)==null||o.focus()},[]);const i=V({id:e.id,path:e.path,content:(a=s.data)==null?void 0:a.content}),l=Le(s.data);return t.jsxs("div",{role:"dialog",ref:r,"aria-label":"Note preview",tabIndex:-1,"data-testid":"neighbor-preview",onKeyDown:o=>{o.key==="Escape"&&n({restoreFocus:!0})},onBlur:o=>{o.currentTarget.contains(o.relatedTarget)||n()},className:"focus-ring card mt-3 p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx("h3",{className:"min-w-0 truncate font-serif text-lg text-fg",children:i}),t.jsx("button",{type:"button",onClick:()=>n({restoreFocus:!0}),"aria-label":"Close preview",className:"shrink-0 text-fg-dim hover:text-accent",children:"✕"})]}),e.tags&&e.tags.length>0?t.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.tags.map(o=>t.jsxs("span",{className:"chip chip-tag max-w-full break-all",children:["#",o]},o))}):null,t.jsx(Te,{isPaused:s.fetchStatus==="paused",isPending:s.isPending,isError:s.isError,snippet:l}),t.jsx("div",{className:"mt-3",children:t.jsx(g,{to:`/n/${encodeURIComponent(e.id)}`,className:"btn btn-primary btn-touch",children:"Open note"})})]})}function Te({isPaused:e,isPending:n,isError:s,snippet:r}){return e&&n?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Preview unavailable offline."}):n?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Loading preview…"}):s?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Couldn't load preview."}):r?t.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:r}):t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"No preview text."})}function Le(e){if(!e)return null;const n=(e.preview??z(e.content??"")).trim();return n?n.length>200?`${n.slice(0,200).trimEnd()}…`:n:null}function B(){return t.jsx("div",{"aria-busy":"true",className:"h-[24rem] w-full animate-pulse rounded-md border border-border bg-card"})}function Pe({data:e,onSelect:n}){const s=d.useRef(null),[r,i]=d.useState({w:600,h:384});d.useEffect(()=>{const a=s.current;if(!a)return;const o=()=>{const m=a.getBoundingClientRect();i({w:Math.max(320,Math.floor(m.width)),h:384})};o();const u=new ResizeObserver(o);return u.observe(a),()=>u.disconnect()},[]);const l=d.useMemo(()=>({nodes:e.nodes.map(a=>({...a})),links:e.edges.map(a=>({source:a.source,target:a.target,rel:a.relationship}))}),[e]);return t.jsx("div",{ref:s,"data-testid":"neighborhood-graph-canvas",className:"overflow-hidden rounded-md border border-border bg-card",children:t.jsx(d.Suspense,{fallback:t.jsx(B,{}),children:t.jsx(ke,{graphData:l,width:r.w,height:r.h,nodeLabel:a=>Ae(a),nodeVal:a=>{const o=a;return o.isAnchor?8:3+Math.min(o.linkCount,8)},nodeColor:a=>a.isAnchor?"#c9b170":"#8a9a7a",linkColor:()=>"rgba(160, 160, 160, 0.4)",linkDirectionalArrowLength:3,linkDirectionalArrowRelPos:1,cooldownTicks:80,onNodeClick:a=>{n(a.id)}})})})}function Ae(e){const n=[e.path??e.id];return e.tags&&e.tags.length>0&&n.push(`tags: ${e.tags.join(", ")}`),e.summary&&n.push(e.summary),n.join(`
|
|
3
|
+
`)}function Fe({content:e,attachments:n,onRetry:s,retrying:r=!1}){const i={content:e,attachments:n},l=H(i);if(l==="pending"){const a=G(i);return t.jsxs("output",{"aria-live":"polite",className:"mb-4 inline-flex items-center gap-2 rounded-md border border-sky-500/30 bg-sky-500/5 px-3 py-1.5 text-xs text-sky-300",children:[t.jsx("span",{"aria-hidden":!0,className:"inline-block h-2 w-2 animate-pulse rounded-full bg-sky-400"}),"Transcribing…",a?t.jsxs("span",{className:"text-sky-300/80",children:["part ",Math.min(a.done+1,a.total)," of ",a.total]}):null]})}return l==="failed"?t.jsxs("output",{className:"mb-4 inline-flex flex-wrap items-center gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-1.5 text-xs text-amber-200",children:[t.jsx("span",{children:"Transcription unavailable — open the audio below and add a note by hand."}),s?t.jsx("button",{type:"button",onClick:s,disabled:r,className:"rounded border border-amber-500/40 px-2 py-0.5 font-medium text-amber-100 hover:bg-amber-500/15 disabled:opacity-50",children:r?"Retrying…":"Retry"}):null]}):l==="voice-limit"?t.jsx("output",{className:"mb-4 inline-flex items-center gap-2 rounded-md border border-border bg-bg/40 px-3 py-1.5 text-xs text-fg-muted",children:"Monthly voice limit reached — transcription resumes next month. The audio is saved below."}):null}function et(){const{id:e}=W(),n=k(r=>r.getActiveVault()),s=F(e);return fe(e,s.data),d.useEffect(()=>{n&&e&&K(n.id,e)},[n,e]),n?t.jsxs("div",{className:"page",children:[t.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:t.jsx(g,{to:"/notes",className:"focus-ring hover:text-accent",children:"← All notes"})}),s.isPending?t.jsx(Ge,{}):s.data?t.jsxs(t.Fragment,{children:[s.isError?t.jsx(q,{}):null,t.jsx($e,{note:s.data,cacheId:e})]}):s.isError?t.jsx(Xe,{error:s.error,retry:()=>s.refetch()}):t.jsx(qe,{id:e??""})]}):t.jsx(Q,{to:"/",replace:!0})}function $e({note:e,cacheId:n}){var R,T;const s=k(x=>x.getActiveVault()),{roles:r}=X((s==null?void 0:s.id)??null),i=Y(),{mirror:l}=Z(),a=l.state==="offline",o=e.contentEvicted===!0,u=d.useMemo(()=>xe(e),[e]),m=L(x=>x.on),c=L(x=>x.setOn);d.useEffect(()=>{if(!m)return;const x=y=>{y.key==="Escape"&&c(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[m,c]);const h=e.path??e.id,f=J(e.content),p=f!==null&&!ee(f,e)?f:null,j=p!==null?{kind:"title",text:p}:e.path?te(e.path):{kind:"title",text:e.id},C=d.useMemo(()=>p!==null?{...e,content:se(e.content??"")}:e,[e,p]),I=typeof((R=e.metadata)==null?void 0:R.summary)=="string"?e.metadata.summary:null,E=d.useMemo(()=>(e.links??[]).filter(x=>x.targetId===e.id&&x.sourceId!==e.id&&x.sourceNote),[e]),S=d.useMemo(()=>{const x=new Set,y=[];for(const N of e.links??[])N.sourceId!==e.id||N.targetId===e.id||N.targetNote&&(x.has(N.targetId)||(x.add(N.targetId),y.push(N)));return y},[e]);return t.jsxs("article",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("header",{className:"mb-8 border-b border-border pb-5",children:[t.jsx("h1",{className:j.kind==="timestamp"?"page-title title-timestamp":"page-title",children:j.text}),a?t.jsx(Ke,{}):null,e.tags&&e.tags.length>0?t.jsx(Ue,{tags:e.tags}):null,I?t.jsx("p",{className:"mt-3 text-fg-muted",children:I}):null,t.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[t.jsx(g,{to:`/n/${encodeURIComponent(e.id)}/edit`,className:"btn btn-secondary btn-touch",children:"Edit"}),t.jsx(ue,{note:e,keyboard:!0}),t.jsx(me,{note:e}),t.jsxs("button",{type:"button",onClick:()=>c(!0),className:"btn btn-ghost btn-touch",title:"Focus (⌘.)",children:[t.jsx(ne,{width:16,height:16}),"Focus"]}),re(e,r.view)?t.jsx(g,{to:`/views/${encodeURIComponent(e.id)}`,className:"btn btn-secondary btn-touch",children:"Open as view"}):null]}),t.jsx(Ve,{value:h,isPath:!!e.path})]}),t.jsx(Fe,{content:e.content??"",attachments:e.attachments,onRetry:()=>i.mutate({cacheId:n??e.id,serverId:e.id}),retrying:i.isPending}),o?t.jsx(Qe,{preview:e.preview}):(T=C.content)!=null&&T.trim()?t.jsx(he,{note:C,resolve:u}):p===null?t.jsx(We,{noteId:e.id}):null,e.attachments&&e.attachments.length>0?t.jsxs("section",{className:"mt-10 border-t border-border pt-6",children:[t.jsx("h2",{className:"mb-3 font-serif text-xl",children:"Attachments"}),t.jsx("div",{className:"space-y-6",children:e.attachments.map(x=>t.jsx(Oe,{attachment:x},x.id))})]}):null,t.jsx(Ce,{anchor:e})]}),t.jsxs("aside",{className:"space-y-6 text-sm lg:sticky lg:top-24 lg:self-start",children:[t.jsx(Be,{note:e}),S.length>0?t.jsx(A,{title:"Outbound",links:S,peer:"target"}):null,E.length>0?t.jsx(A,{title:"Inbound",links:E,peer:"source"}):null]})]})}function Be({note:e}){const n=e.createdAt,s=e.updatedAt,r=Object.entries(e.metadata??{}).filter(([i])=>i!=="summary");return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsx("h2",{className:"eyebrow mb-2",children:"Metadata"}),t.jsxs("dl",{className:"space-y-1.5 text-sm",children:[e.path?t.jsx(v,{label:"Title",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.path})}):null,t.jsx(v,{label:"ID",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.id})}),t.jsx(v,{label:"Created",value:t.jsx("time",{title:n,children:P(n)})}),s?t.jsx(v,{label:"Updated",value:t.jsx("time",{title:s,children:P(s)})}):null,e.path?t.jsx(v,{label:"Path",value:t.jsx(oe,{value:e.path,label:"note path",className:"mt-1"})}):null,r.map(([i,l])=>t.jsx(v,{label:i,value:t.jsx("span",{className:"break-all text-fg-muted",children:String(l)})},i))]}),e.path?t.jsx(Me,{path:e.path}):null,t.jsx(le,{note:e,variant:"detail",className:"mt-3"})]})}function Me({path:e}){const{copied:n,copy:s}=$();return t.jsx("button",{type:"button",onClick:()=>s(e),className:"btn btn-secondary btn-touch mt-3 w-full","aria-label":"Copy reference to this note",children:n?"Copied ✓":"Copy reference"})}function v({label:e,value:n}){return t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("dt",{className:"eyebrow",children:e}),t.jsx("dd",{children:n})]})}function Ue({tags:e}){return t.jsx("div",{className:"mt-2 flex flex-wrap gap-1","aria-label":"Tags",children:e.map(n=>t.jsxs(g,{to:`/tags/${encodeURIComponent(n)}`,className:"chip chip-tag focus-ring max-w-full break-all",children:["#",n]},n))})}function De(e){return t.jsxs("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[t.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),t.jsx("path",{d:"M5 15H4.5A1.5 1.5 0 0 1 3 13.5v-9A1.5 1.5 0 0 1 4.5 3h9A1.5 1.5 0 0 1 15 4.5V5"})]})}function Ve({value:e,isPath:n}){const{copied:s,copy:r}=$();return t.jsxs("button",{type:"button",onClick:()=>r(e),"aria-label":n?"Copy path":"Copy note id",className:"focus-ring group mt-4 flex max-w-full items-center gap-1.5 rounded text-fg-dim transition-colors hover:text-fg-muted",children:[t.jsx(De,{className:"shrink-0 opacity-70 transition-opacity group-hover:opacity-100"}),t.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:e}),s?t.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:"Copied"}):null]})}function A({title:e,links:n,peer:s}){return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsxs("h2",{className:"eyebrow mb-2 tabular-nums",children:[e," (",n.length,")"]}),t.jsx("ul",{className:"space-y-1.5",children:n.map(r=>{var o;const i=s==="source"?r.sourceNote:r.targetNote;if(!i)return null;const l=i.path??i.id,a=typeof((o=i.metadata)==null?void 0:o.summary)=="string"?i.metadata.summary:null;return t.jsx("li",{children:t.jsxs(g,{to:`/n/${encodeURIComponent(i.id)}`,className:"block rounded px-1 py-0.5 hover:bg-bg/50",children:[t.jsx("div",{className:"truncate font-mono text-xs text-fg-muted hover:text-accent",children:l}),a?t.jsx("div",{className:"mt-0.5 line-clamp-2 text-xs text-fg-dim",children:a}):null]})},`${r.sourceId}->${r.targetId}:${r.relationship}`)})})]})}function Oe({attachment:e}){const n=e.filename;if(!n||!e.url)return t.jsx("figure",{className:"card shadow-soft p-3",children:t.jsx(M,{})});const s=(e.mimeType??"").toLowerCase();return t.jsxs("figure",{className:"card shadow-soft p-3",children:[t.jsxs("figcaption",{className:"mb-2 flex items-baseline justify-between gap-3",children:[t.jsx("span",{className:"truncate font-mono text-xs text-fg-muted",children:n}),typeof e.size=="number"?t.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:He(e.size)}):null]}),t.jsx(_e,{attachment:e,mime:s,filename:n})]})}function M(){return t.jsxs("div",{className:"flex items-center gap-2 text-sm text-fg-dim","aria-busy":"true",children:[t.jsx(b,{className:"h-4 w-32"}),t.jsx("span",{children:"Processing…"})]})}function _e({attachment:e,mime:n,filename:s}){const r=w(),[i,l]=d.useState(null),[a,o]=d.useState(null),u=ze(n,s),m=u!=="other",c=e.url;if(d.useEffect(()=>{if(!m||!c||!r)return;let f=!1,p=null;return o(null),r.fetchAttachmentBlob(c).then(j=>{f||(p=URL.createObjectURL(j),l(p))}).catch(j=>{f||o(j instanceof Error?j.message:"Failed to load attachment")}),()=>{f=!0,p&&URL.revokeObjectURL(p)}},[m,c,r]),!c)return t.jsx(M,{});if(a)return t.jsx("p",{className:"text-sm text-danger",children:a});if(m&&!i)return t.jsx(b,{className:"h-32 w-full"});const h=i??c;return u==="image"?t.jsx("img",{src:h,alt:s,className:"max-h-[32rem] rounded"}):u==="audio"?t.jsx("audio",{controls:!0,src:h,className:"w-full"}):u==="video"?t.jsx("video",{controls:!0,src:h,className:"w-full rounded"}):u==="pdf"?t.jsxs(t.Fragment,{children:[t.jsx("iframe",{src:h,title:s,className:"h-[40rem] w-full rounded border border-border"}),t.jsxs("a",{href:h,download:s,className:"mt-2 inline-block text-sm text-accent hover:underline",children:["Download ",s]})]}):t.jsxs("a",{href:h,download:s,className:"text-sm text-accent hover:underline",children:["Download ",s]})}function ze(e,n){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e==="application/pdf")return"pdf";const s=n.toLowerCase().split(".").pop()??"";return["png","jpg","jpeg","gif","webp","svg"].includes(s)?"image":["mp3","wav","ogg","m4a","flac"].includes(s)?"audio":["mp4","webm","mov"].includes(s)?"video":s==="pdf"?"pdf":"other"}function He(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Ge(){return t.jsxs("div",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]","aria-busy":"true",children:[t.jsxs("div",{className:"min-w-0 space-y-3",children:[t.jsx(b,{className:"h-3 w-32"}),t.jsx(b,{className:"h-8 w-2/3"}),t.jsx(b,{className:"h-4 w-full"}),t.jsx("div",{className:"mt-6 space-y-2",children:[0,1,2,3,4,5].map(e=>t.jsx(b,{className:"h-3",width:`${70+e*13%25}%`},e))})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(b,{className:"h-32"}),t.jsx(b,{className:"h-24"})]})]})}function We({noteId:e}){return t.jsxs("p",{className:"my-8 font-serif text-lg italic text-fg-muted",children:["Nothing here yet."," ",t.jsx(g,{to:`/n/${encodeURIComponent(e)}/edit`,className:"not-italic text-accent hover:underline",children:"Start writing →"})]})}function Ke(){return t.jsx("p",{className:"mt-2",children:t.jsx("span",{className:"chip bg-bg-soft text-fg-muted",title:"Served from your offline copy",children:"Saved copy"})})}function Qe({preview:e}){return t.jsxs("div",{className:"my-8",children:[e?t.jsx("p",{className:"mb-4 text-fg-muted",children:e}):null,t.jsx("p",{className:"font-serif text-lg italic text-fg-muted",children:"Connect to load this note."})]})}function qe({id:e}){return t.jsx(ie,{title:t.jsx("span",{className:"font-serif text-xl text-fg",children:"Note not found"}),description:t.jsxs(t.Fragment,{children:["No note with id ",t.jsx("span",{className:"font-mono",children:e})," in this vault."]}),action:t.jsx(g,{to:"/notes",className:"text-sm text-accent hover:underline",children:"Back to all notes"})})}function Xe({error:e,retry:n}){const s=e instanceof ce,r=e instanceof de,i=s?"Session expired":r?"Note not found":"Could not load note",l=s?e.message:r?"Couldn't find this note. It may have been deleted, or the link may be wrong.":"Something went wrong loading this note. You can try again, or head back to your notes.";return t.jsx(ae,{title:i,message:t.jsxs(t.Fragment,{children:[l,s?null:t.jsxs("details",{className:"mt-3",children:[t.jsx("summary",{className:"cursor-pointer text-xs text-fg-dim hover:text-fg-muted",children:"Technical detail"}),t.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-xs text-fg-dim",children:e.message})]})]}),retry:s?void 0:n,action:s?t.jsx(g,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):t.jsx(g,{to:"/notes",className:"btn btn-secondary btn-touch",children:"Back to notes"})})}export{et as NoteView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as R,b as U,a as u,r as d,b4 as z,b5 as E,b6 as I,b7 as C,k as A,b8 as H,b9 as O,j as e,P as p}from"./index-C2wr_d3O.js";import{W as m}from"./WizardShell-BpDtpsOX.js";import{s as P}from"./url-QSQwrjSV.js";import"./history-v1ErfO2u.js";function $(r){try{return new URL(r).host}catch{return"your hub"}}function W(){const[r]=R(),i=U(),h=u(s=>s.addVault),[n,l]=d.useState({kind:"working"}),f=d.useRef(!1);if(d.useEffect(()=>{if(f.current)return;f.current=!0;const s=r.get("code"),x=r.get("state"),b=r.get("error");if(b){const o=r.get("error_description");l({kind:"error",message:`Vault returned: ${b}${o?` — ${o}`:""}`});return}if(!s||!x){l({kind:"error",message:"Missing code or state in callback URL."});return}(async()=>{var o,g,v,j;try{const{pending:t,token:a}=await z(s,x),k=a.vault?`vault:${a.vault}`:void 0,N=(k?(g=(o=a.services)==null?void 0:o[k])==null?void 0:g.url:void 0)??((j=(v=a.services)==null?void 0:v.vault)==null?void 0:j.url)??t.issuerUrl,S=u.getState().activeVaultId,c=h({url:N,name:a.vault??t.issuer,issuer:t.issuer,tokenEndpoint:t.tokenEndpoint,clientId:t.clientId,scope:a.scope},E(a));a.services&&I(c,a.services);const y=C.getState();y.clearHalt(c),t.priorHaltedVaultId&&t.priorHaltedVaultId!==c&&y.clearHalt(t.priorHaltedVaultId);const V=P(t.redirect)??"/";if(c!==S){const w=u.getState().vaults[c];w&&A(H(w))}i(V,{replace:!0})}catch(t){if(t instanceof O){l({kind:"pending-approval",approveUrl:t.approveUrl});return}l({kind:"error",message:t.message})}})()},[r,i,h]),n.kind==="working")return e.jsxs(m,{escape:{kind:"none"},children:[e.jsx(p,{size:72,className:"mx-auto mb-4 animate-pulse"}),e.jsx("p",{className:"eyebrow mb-3",children:"One moment"}),e.jsxs("h1",{className:"hero-title mb-2",style:{fontSize:"clamp(1.8rem, 4vw, 2.3rem)"},children:["Connecting",e.jsx("span",{className:"accent-word",children:"…"})]}),e.jsx("output",{"aria-live":"polite",className:"font-round text-sm text-fg-muted",children:"Exchanging the authorization code with your vault."})]});if(n.kind==="pending-approval"){const s=$(n.approveUrl);return e.jsxs(m,{escape:{kind:"back",to:"/"},children:[e.jsx(p,{size:60,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"Redirected"}),e.jsxs("h1",{className:"hero-title mb-4",style:{fontSize:"clamp(1.6rem, 3.5vw, 2.1rem)"},children:["Approving Parachute on ",e.jsx("span",{className:"accent-word",children:s})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-fg-muted",children:"Your hub admin needs to approve this app before sign-in can complete. Open the approval page in your hub, approve, then try again."}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4",children:[e.jsx("a",{href:n.approveUrl,target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:"Open approval page →"}),e.jsx("button",{type:"button",onClick:()=>i("/add",{replace:!0}),className:"font-round text-sm font-semibold text-fg-dim hover:text-accent",children:"Retry now"})]})]})}return e.jsxs(m,{escape:{kind:"back",to:"/"},children:[e.jsx(p,{size:60,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"Connection failed"}),e.jsxs("h1",{className:"hero-title mb-4",style:{fontSize:"clamp(1.6rem, 3.5vw, 2.1rem)"},children:["Something went ",e.jsx("span",{className:"accent-word",children:"sideways."})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-fg-muted",children:n.message}),e.jsx("button",{type:"button",onClick:()=>i("/add",{replace:!0}),className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:"Try again →"})]})}export{W as OAuthCallback};
|