PageSourceSearch

https://khososy.ai/assets/detail-DdI2kkN8.js

js khososy.ai collected 2026-10-05 12:09:14 UTC 4,194 bytes, 1 lines download raw bytes

1import{j as e,C as T,k as A,o as b,n as s,p as v}from"./index-euS5ES71.js";import{D as h,T as I}from"./DashboardLayout-TCCDm6mW.js";import{N as R}from"./NoteEditor-D-nOgxie.js";import{I as O}from"./card-DKdbKAHj.js";import{b as U}from"./UIContext-DKDal-U7.js";import{c as B,d as M,b as P}from"./use-notes-rdO5vabe.js";import{A as j}from"./arrow-left-BFgkYHoc.js";import"./select-CrAATXg5.js";import"./check-1wLzMGyy.js";import"./user-W8rK_TNB.js";import"./log-out-Uu_NP1QR.js";import"./label-DIZRt-dd.js";import"./eye-D9rBhEDD.js";import"./external-link-DhW4zbbl.js";import"./notes-B5NxumnD.js";import"./separator-Dk3-0r9I.js";import"./link-2-DA297Y4s.js";import"./table-CsuXDXbW.js";const _=1500;function $(){const{id:a}=T(),l=A(),{t:n}=b(),{data:i,isLoading:r,isError:c}=B(a),m=M(),N=P(),[S,p]=s.useState(""),[k,f]=s.useState("idle"),[E,C]=s.useState(null),g=s.useRef(!1);s.useEffect(()=>{i&&!g.current&&(p(i.title||""),g.current=!0)},[i]);const u=s.useRef({}),o=s.useRef(null),d=s.useCallback(async()=>{if(!a)return;const t=u.current;if(!(!t||Object.keys(t).length===0)){u.current={},o.current!==null&&(window.clearTimeout(o.current),o.current=null),f("saving");try{await m.mutateAsync({id:a,payload:t}),f("saved"),C(Date.now())}catch(x){console.error("Auto-save failed:",x),f("error")}}},[a,m]),w=s.useCallback(t=>{u.current={...u.current,...t},f("pending"),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(d,_)},[d]);s.useEffect(()=>()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null),Object.keys(u.current).length>0&&d()},[d]),s.useEffect(()=>{const t=()=>{Object.keys(u.current).length>0&&d()};return window.addEventListener("beforeunload",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("beforeunload",t),document.removeEventListener("visibilitychange",t)}},[d]);const y=t=>{p(t),w({title:t})},L=(t,x)=>{w({content:t,content_text:x})},D=async()=>{a&&window.confirm(n("notes.deleteConfirm")||"Delete this note?")&&(await N.mutateAsync(a),l("/notes"))};return r?e.jsx(h,{children:e.jsxs("div",{className:"p-6 max-w-4xl mx-auto text-muted-foreground",children:[n("loading"),"…"]})}):c||!i?e.jsx(h,{children:e.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[e.jsx("p",{className:"text-destructive",children:n("notes.notFound")||"Note not found."}),e.jsxs(v,{variant:"ghost",className:"mt-4",onClick:()=>l("/notes"),children:[e.jsx(j,{className:"mr-2 h-4 w-4"}),n("notes.backToList")||"Back to notes"]})]})}):e.jsx(h,{children:e.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs(v,{variant:"ghost",size:"sm",onClick:()=>l("/notes"),children:[e.jsx(j,{className:"mr-2 h-4 w-4"}),n("notes.backToList")||"Back"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(z,{state:k,lastSavedAt:E}),e.jsx(v,{variant:"ghost",size:"icon",onClick:D,"aria-label":n("notes.delete")||"Delete",children:e.jsx(I,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]})]}),e.jsx(O,{value:S,onChange:t=>y(t.target.value),placeholder:n("notes.titlePlaceholder")||"Untitled note",className:"text-2xl md:text-3xl font-bold border-0 shadow-none px-0 mb-4 focus-visible:ring-0 bg-transparent",maxLength:200}),e.jsx(R,{noteId:i.id,initialContent:i.content,onChange:L})]})})}function z({state:a,lastSavedAt:l}){const{t:n}=b(),[,i]=s.useState(0);s.useEffect(()=>{const c=window.setInterval(()=>i(m=>m+1),6e4);return()=>window.clearInterval(c)},[]);let r="";switch(a){case"pending":r=n("notes.saving")||"Saving…";break;case"saving":r=n("notes.saving")||"Saving…";break;case"error":r=n("notes.saveError")||"Save failed";break;case"saved":if(l){const c=Math.max(0,Math.floor((Date.now()-l)/1e3));c<5?r=n("notes.savedJustNow")||"Saved · just now":c<60?r=`${n("notes.saved")||"Saved"} · ${c}s`:r=`${n("notes.saved")||"Saved"} · ${Math.floor(c/60)}m`}else r=n("notes.saved")||"Saved";break;default:r=""}return r?e.jsx("span",{className:a==="error"?"text-xs text-destructive":"text-xs text-muted-foreground",children:r}):null}function oe(){return e.jsx(U,{children:e.jsx($,{})})}
1export{oe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.