1import{j as e,r as o,P as B}from"./schemas-CrpkIz7J.js";import{b as $}from"./video-intelligence-BkkU9_e8.js";import{cn as S,B as C,bg as W,K,as as V,ca as G,c as m,c6 as U,g as F,a as P,l as k,cC as H,cD as b,cE as Y,cF as q,co as J,cp as N,cq as X,az as R,b7 as _,bG as Z,bH as Q,bI as ee,aR as A,cG as te,cH as se,cI as ae,aS as ne,cJ as ie,cK as re,cL as oe}from"./index-DImuld4O.js";import{K as le,h as ce}from"./video-intelligence-api-C7PnHvp0.js";import{A as de,B as ue,L as xe}from"./app-chrome-DOPvXUuX.js";import{a as pe,v as me,u as he,w as fe,x as ge,y as ve,z as be}from"./auth-gate-BFLub-6C.js";import{G as je,H as ke,D as we,I as ye}from"./mcp-access-dialog-Byo3nOnr.js";import{bl as Se,bm as Ne,c4 as Ce,c5 as Ae,c6 as Ee,bU as Te,c7 as Ie}from"./mcp-connections-api-D4y4Pj0o.js";import{T as Pe}from"./trash-2-IPjyOJln.js";import"./media-api-v6imSOF4.js";import"./auth-page-CtamGj1t.js";import"./web-sources-CIhqxwuH.js";import"./recording-keyboard-data-HHfXGFe8.js";const Re={account:"sign out firebase session email signed in",editor:"video intelligence automatic indexing embeddings moments global analysis auto add first asset upload timeline duration scene resolution fps native",billing:"plan usage quota allowance stripe subscription checkout portal spark invoice manage billing",mcp:`connected clients coding agents ${S.map(s=>s.name).join(" ")} command revoke`,"local-data":"projects media chat layout delete wipe reset browser",about:"build code version privacy policy terms of service"};function _e(s){return s.toLowerCase().split(/\s+/).filter(t=>t.length>0)}function w(s,...t){if(s.length===0)return!0;const a=t.filter(n=>n!==void 0).join(" ").toLowerCase();return s.every(n=>a.includes(n))}const D=o.createContext({terms:[]}),M=o.createContext(!1);function De({query:s,children:t}){const a=_e(s);return e.jsx(D.Provider,{value:{terms:a},children:t})}function Me({matched:s,children:t}){return e.jsx(M.Provider,{value:s,children:t})}function E(){return o.useContext(D).terms}function Oe(){return o.useContext(M)}function O(s,t=[]){return o.Children.forEach(s,a=>{if(!o.isValidElement(a))return;const n=a.props,r=[];typeof n.label=="string"&&r.push(n.label),typeof n.description=="string"&&r.push(n.description),typeof n.title=="string"&&r.push(n.title),r.length>0&&t.push(r.join(" ")),O(n.children,t)}),t}async function ze(s){const t=s.trim();if(t.length===0)throw new Error("Wipe requires a non-empty userId");if(typeof navigator>"u"||typeof navigator.storage?.getDirectory!="function")throw new Error("Origin private file system is not available in this browser");for(const a of await pe())await Se(t,a.id),await Ne(t,a.id),me().removeItem(je(t,a.id)),ke(t,a.id);for(const a of await indexedDB.databases())a.name?.startsWith(`vidova-project:${t}:`)===!0&&indexedDB.deleteDatabase(a.name);window.localStorage.removeItem(Ce),window.localStorage.removeItem(Ae),window.localStorage.removeItem(Ee),we(t)}const y=[{id:"account",label:"Account"},{id:"editor",label:"Editor"},{id:"billing",label:"Billing"},{id:"mcp",label:"MCP"},{id:"local-data",label:"Local data"},{id:"about",label:"About"}];function nt(){const{user:s}=he(),t=o.useRef(null),[a,n]=o.useState("account"),[r,d]=o.useState(""),[i,u]=o.useState(!1),c=r.trim().length>0;return o.useEffect(()=>{const l=window.location.hash.replace(/^#/,"");l.length!==0&&document.getElementById(l)?.scrollIntoView({block:"start"})},[]),o.useEffect(()=>{if(c)return;const l=y.map(h=>document.getElementById(h.id)).filter(h=>h!==null),x=new Map,j=new IntersectionObserver(h=>{for(const p of h)p.isIntersecting?x.set(p.target.id,p.boundingClientRect.top):x.delete(p.target.id);const T=[...x.entries()].sort((p,L)=>p[1]-L[1])[0];if(T===void 0)return;const I=y.find(p=>p.id===T[0]);I!==void 0&&n(I.id)},{rootMargin:"-10% 0px -70% 0px",threshold:0});for(const h of l)j.observe(h);return()=>{j.disconnect()}},[c]),o.useLayoutEffect(()=>{const l=t.current;u(l!==null&&l.querySelectorAll("section[id]").length===0)},[r]),e.jsx(de,{children:e.jsxs("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-8 px-4 pt-20 pb-24 sm:px-8",children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("p",{className:"text-[22px] font-semibold tracking-[-0.02em]",children:"Settings"}),e.jsx(Le,{query:r,$$pi:d})]}),e.jsxs("div",{className:"flex gap-10",children:[e.jsx("nav",{"aria-label":"Settings sections",className:"sticky top-20 hidden w-44 shrink-0 flex-col self-start md:flex",children:e.jsx("ul",{className:"flex flex-col gap-0.5",children:y.map(l=>{const x=a===l.id;return e.jsx("li",{children:e.jsx("a",{href:`#${l.id}`,"aria-current":x?"location":void 0,className:C("flex items-center gap-2 rounded-[var(--k2-radius)] px-3 py-1.5 text-[13px] transition-colors duration-[var(--k2-speed)]",x?"bg-[var(--k2-accent-soft)] font-medium text-[var(--k2-fg)]":"text-[var(--k2-muted)] hover:bg-[var(--k2-hover)] hover:text-[var(--k2-fg)]"),onClick:j=>{c&&(j.preventDefault(),d(""),n(l.id),window.setTimeout(()=>{document.getElementById(l.id)?.scrollIntoView({block:"start"}),window.history.replaceState(null,"",`#${l.id}`)},0))},children:l.label})},l.id)})})}),e.jsxs("div",{ref:t,className:"flex min-w-0 flex-1 flex-col gap-12",children:[e.jsxs(De,{query:r,children:[e.jsx(Be,{user:s}),e.jsx($e,{}),e.jsx(g,{id:"billing",title:"Billing",description:"Plan, usage, and Stripe billing for this account.",children:e.jsx(ue,{enabled:!0})}),e.jsx(g,{id:"mcp",title:"MCP",description:"Coding agents that can call Vidova tools on your behalf.",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs(v,{children:[e.jsx(z,{title:"Connected clients",icon:e.jsx(B,{className:"size-3.5"})}),e.jsx("div",{className:"px-4 py-3",children:e.jsx(ye,{enabled:!0})})]}),e.jsx(We,{})]})}),e.jsx(Ke,{userId:s.uid}),e.jsx(Ge,{})]}),i?e.jsx(le,{title:"No matching settings",body:`Nothing matches "${r.trim()}".`}):null]})]})]})})}function Le({query:s,$$pi:t}){const a=s.trim().length>0;return e.jsxs("div",{className:"relative w-full sm:w-64",role:"search",children:[e.jsx(W,{className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-[var(--k2-faint)]"}),e.jsx(K,{value:s,placeholder:"Search settings","aria-label":"Search settings",autoComplete:"off",spellCheck:!1,className:C("h-8 min-h-8 pl-8 text-[13px]",a&&"pr-8"),onChange:n=>{t(n.currentTarget.value)},onKeyDown:n=>{n.key==="Escape"&&t("")}}),a?e.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute top-1/2 right-2 -translate-y-1/2 text-[var(--k2-faint)] hover:text-[var(--k2-fg)]",onClick:()=>{t("")},children:e.jsx(V,{className:"size-3.5"})}):null]})}function g({id:s,title:t,description:a,children:n}){const r=E(),d=w(r,t,a,Re[s]);return d||O(n).some(u=>w(r,u))?e.jsx(Me,{matched:d,children:e.jsxs("section",{id:s,className:"scroll-mt-20",children:[e.jsx("h2",{className:"text-[17px] font-semibold tracking-tight text-[var(--k2-fg)]",children:t}),e.jsx("p",{className:"mt-1 mb-5 text-[13px] text-[var(--k2-muted)]",children:a}),n]})}):null}function v({children:s,className:t}){return e.jsx("div",{className:C("overflow-hidden rounded-[var(--k2-radius-lg)] border border-[var(--k2-line-strong)] bg-[var(--k2-panel)] shadow-[var(--k2-sheen)]",t),children:s})}function z({title:s,icon:t,action:a}){return e.jsxs("div",{className:"flex min-h-10 items-center gap-2 border-b border-[var(--k2-line)] px-4",children:[t===void 0?null:e.jsx("span",{className:"text-[var(--k2-accent)]",children:t}),e.jsx("span",{className:"flex-1 text-[12px] font-medium text-[var(--k2-fg)]",children:s}),a]})}function f({label:s,description:t,children:a}){const n=E();return!Oe()&&!w(n,typeof s=="string"?s:void 0,typeof t=="string"?t:void 0)?null:e.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[13px] font-medium text-[var(--k2-fg)]",children:s}),t===void 0?null:e.jsx("p",{className:"mt-0.5 text-[12px] leading-snug text-[var(--k2-muted)]",children:t})]}),a]})}function Be({user:s}
1){const[t,a]=o.useState(null),[n,r]=o.useState(null),[,d]=o.useState(0),i=["apple","google"];function u(c){t===null&&(a(c),r(null),ae(s,c,{userAgent:navigator.userAgent,maxTouchPoints:navigator.maxTouchPoints}).then(l=>{l&&(d(x=>x+1),ne("success",`${b[c]} added`,`You can sign in to this account with ${b[c]}.`))}).catch(l=>{k(`Could not add ${b[c]}`,l),r(P(l))}).finally(()=>{a(null)}))}return e.jsxs(g,{id:"account",title:"Account",description:"Who is signed in to this browser.",children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-4 px-4 py-4",children:[e.jsx("span",{className:"grid size-12 shrink-0 place-items-center rounded-[var(--k2-radius)] bg-[var(--k2-accent-soft)] text-[var(--k2-accent)]",children:e.jsx(G,{className:"size-7"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-[15px] font-semibold text-[var(--k2-fg)]",children:s.email??s.uid}),e.jsx("p",{className:"text-[12px] text-[var(--k2-muted)]",children:"Signed in with Firebase"})]}),e.jsxs(m,{variant:"secondary",disabled:t!==null,onClick:()=>{a("sign-out"),r(null),U(F()).catch(c=>{r(P(c)),k("Sign out failed",c)}).finally(()=>{a(null)})},children:[e.jsx(xe,{className:"size-3.5"}),t==="sign-out"?"Signing out":"Sign out"]})]}),e.jsx("div",{className:"border-t border-[var(--k2-line)]",children:i.map(c=>{const l=s.providerData.some(x=>x.providerId===H[c]);return e.jsx(f,{label:e.jsxs("span",{className:"flex items-center gap-2",children:[c==="google"?e.jsx(Y,{className:"size-4"}):e.jsx(q,{className:"size-4"}),b[c]]}),description:l?"Linked to this account":`Add ${b[c]} to sign in to this account`,children:e.jsx(m,{variant:"secondary",disabled:l||t!==null,onClick:()=>{u(c)},children:l?"Linked":t===c?"Linking":"Link"})},c)})}),e.jsx("p",{className:"border-t border-[var(--k2-line)] px-4 py-2.5 text-[12px] text-[var(--k2-faint)]",children:"Signing out ends this browser session. Local projects stay on this device."})]}),n!==null?e.jsx("p",{className:"mt-2 text-[13px] text-[var(--k2-danger)]",children:n}):null]})}function $e(){const[s,t]=o.useState(()=>Te());return e.jsxs(g,{id:"editor",title:"Editor",description:"Editor preferences and account-wide video settings.",children:[e.jsx(v,{children:e.jsx(f,{label:"Add first upload to timeline",description:"When you upload the first video, image, or audio file to a project, place it on the timeline at its native duration and match the scene size and frame rate.",children:e.jsx(ce,{checked:s,onCheckedChange:a=>{Ie(a),t(a)}})})}),e.jsx($,{})]})}function We(){const[s,t]=o.useState(null),a=E(),n=S.filter(i=>w(a,i.name,i.command,i.id)),r=a.length===0||n.length===0?S:n;function d(i){navigator.clipboard.writeText(i.command).then(()=>{t(i.id),window.setTimeout(()=>{t(u=>u===i.id?null:u)},1400)},u=>{A("Copy failed",u instanceof Error?u.message:String(u))})}return e.jsxs(v,{children:[e.jsx(z,{title:"Connect your own agent",action:e.jsxs("a",{href:J,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[12px] text-[var(--k2-muted)] hover:text-[var(--k2-fg)]",children:["Setup steps",e.jsx(N,{className:"size-3"})]})}),e.jsx("p",{className:"px-4 pt-3 text-[12px] text-[var(--k2-muted)]",children:"Copy a command to point your agent at Vidova MCP."}),e.jsx("ul",{className:"grid grid-cols-1 gap-2 p-4 sm:grid-cols-2",children:r.map(i=>{const u=s===i.id;return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{d(i)},className:"flex w-full items-center gap-3 rounded-[var(--k2-radius)] border border-[var(--k2-line)] bg-[var(--k2-sunken)] px-3 py-2.5 text-left transition-colors duration-[var(--k2-speed)] hover:border-[var(--k2-accent-line)] hover:bg-[var(--k2-accent-soft)]",children:[e.jsx("span",{className:"size-7 shrink-0 overflow-hidden rounded-[var(--k2-radius-sm)] border border-[var(--k2-line-strong)] bg-[var(--k2-well)]",children:e.jsx("img",{alt:"",src:X(i.$$lb),className:"size-full object-cover"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[13px] font-medium text-[var(--k2-fg)]",children:i.name}),e.jsx("span",{className:"block truncate font-mono text-[10px] text-[var(--k2-faint)]",children:i.command})]}),u?e.jsx(R,{className:"size-3.5 shrink-0 text-[var(--k2-ok)]"}):e.jsx(_,{className:"size-3.5 shrink-0 text-[var(--k2-faint)]"})]})},i.id)})})]})}function Ke({userId:s}
1){const[t,a]=o.useState(!1),[n,r]=o.useState(!1),[d,i]=o.useState(null);return e.jsxs(g,{id:"local-data",title:"Local data",description:"Projects, media, chat, and layout stored in this browser. This does not change your Vidova account.",children:[e.jsxs(v,{className:"border-[var(--k2-danger)]/35",children:[e.jsx(f,{label:"Delete local projects",description:"Removes every project, upload, chat, and layout stored in this browser, then reloads.",children:e.jsxs(m,{variant:"danger",onClick:()=>{i(null),a(!0)},children:[e.jsx(Pe,{className:"size-3.5"}),"Delete local data"]})}),d!==null?e.jsx("p",{className:"border-t border-[var(--k2-line)] px-4 py-2.5 text-[13px] text-[var(--k2-danger)]",children:d}):null]}),e.jsxs(Z,{open:t,onClose:()=>{n||a(!1)},title:"Delete local data",children:[e.jsx(Q,{children:e.jsx("p",{className:"text-[13px] text-[var(--k2-muted)]",children:"This removes every local project and file for this account on this browser. It cannot be undone."})}),e.jsxs(ee,{children:[e.jsx(m,{variant:"ghost",shortcut:"Escape",$$Y:!1,disabled:n,onClick:()=>{a(!1)},children:"Cancel"}),e.jsx(m,{variant:"danger",disabled:n,onClick:()=>{r(!0),i(null),ze(s).then(()=>{window.location.assign("/")}).catch(u=>{const c=u instanceof Error?u.message:"Wipe failed";i(c),k("Wipe local web data failed",u),r(!1)})},children:n?"Deleting":"Delete everything"})]})]})]})}function Ve(){const s=o.useSyncExternalStore(ie,re,()=>"unavailable"),[t,a]=o.useState(!1);return s==="unavailable"||s==="installed"?null:s==="manual"?e.jsx(f,{label:"Install app",description:"Open the browser share menu and choose Add to Home Screen."}):e.jsx(f,{label:"Install app",description:"Run Vidova in its own window, and open it without a connection.",children:e.jsx(m,{variant:"secondary",disabled:t,onClick:()=>{a(!0),oe().then(()=>{a(!1)},n=>{a(!1),A("Install failed",n)})},children:"Install"})})}function Ge(){const s=fe(),[t,a]=o.useState(null),[n,r]=o.useState(!1);return o.useEffect(()=>{let d=!1;return fetch("/api/version",{cache:"no-store"}).then(async i=>{if(!i.ok)throw new Error(`Version request failed with HTTP ${String(i.status)}`);return ge(await i.json())}).then(i=>{d||a(ve(s,i.code))}).catch(i=>{d||k("Web version request failed",i)}),()=>{d=!0}},[s]),e.jsx(g,{id:"about",title:"About",description:"Share the build code if something looks wrong.",children:e.jsxs(v,{children:[e.jsx(Ve,{}),e.jsx(f,{label:"What's new",description:"Release notes for the latest changes.",children:e.jsx(m,{variant:"secondary",onClick:()=>{be()},children:"Show release notes"})}),e.jsx(f,{label:"Build code",description:t===!1?e.jsx("span",{className:"text-[var(--k2-warn)]",children:"This tab is running an older build. Reload to get the latest."}):t===!0?"Up to date":"Checking for updates",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-[var(--k2-radius-sm)] border border-[var(--k2-line)] bg-[var(--k2-sunken)] px-2 py-1 font-mono text-[12px] tabular-nums text-[var(--k2-fg)]",children:s}),e.jsx(m,{variant:"secondary",size:"icon","aria-label":n?"Copied":"Copy build code",onClick:()=>{navigator.clipboard.writeText(s).then(()=>{r(!0),window.setTimeout(()=>{r(!1)},1400)},d=>{A("Copy failed",d instanceof Error?d.message:String(d))})},children:n?e.jsx(R,{className:"size-3.5 text-[var(--k2-ok)]"}):e.jsx(_,{className:"size-3.5"})})]})}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-2 border-t border-[var(--k2-line)] px-4 py-2.5 text-[12px] text-[var(--k2-muted)]",children:[e.jsxs("a",{className:"inline-flex items-center gap-1 hover:text-[var(--k2-fg)]",href:te,target:"_blank",rel:"noreferrer",children:["Privacy policy",e.
1jsx(N,{className:"size-3"})]}),e.jsxs("a",{className:"inline-flex items-center gap-1 hover:text-[var(--k2-fg)]",href:se,target:"_blank",rel:"noreferrer",children:["Terms of service",e.jsx(N,{className:"size-3"})]})]})]})})}export{nt as SettingsPage};
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.