fluxy-bot 0.10.9 → 0.10.10
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/dist-fluxy/assets/{fluxy-BQglfuAs.js → fluxy-Du5MLqr3.js} +1 -1
- package/dist-fluxy/assets/{globals-CHcH_-Mz.js → globals-3yce7Lzq.js} +1 -1
- package/dist-fluxy/assets/{onboard-Bntnh-9j.js → onboard-CHU-Pzvd.js} +1 -1
- package/dist-fluxy/fluxy.html +2 -2
- package/dist-fluxy/onboard.html +2 -2
- package/package.json +1 -1
- package/supervisor/chat/OnboardWizard.tsx +6 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as fe,r as v,j as h,A as Ht,m as et,L as hl,a as El,S as Yc,C as yu,b as Su,g as wu,R as Be,d as Kc,M as yl,e as Xc,O as Zc}from"./globals-CHcH_-Mz.js";const Qc=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],Jc=fe("bell-off",Qc);const ed=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]],td=fe("bell-ring",ed);const nd=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],rd=fe("bell",nd);const ad=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],id=fe("camera",ad);const od=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],sd=fe("chevron-left",od);const ld=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ud=fe("chevron-right",ld);const cd=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],dd=fe("download",cd);const pd=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],gd=fe("ellipsis-vertical",pd);const fd=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],md=fe("lock",fd);const bd=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],On=fe("paperclip",bd);const hd=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ed=fe("pause",hd);const yd=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Sd=fe("play",yd);const wd=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],kd=fe("send-horizontal",wd);const Td=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],Ad=fe("share",Td);const _d=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Id=fe("square",_d);const Nd=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Rd=fe("trash-2",Nd);const xd=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],vd=fe("wand-sparkles",xd);const Cd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kn=fe("x",Cd);class Xn{ws=null;handlers=new Map;statusHandlers=new Set;reconnectTimer=null;heartbeatTimer=null;url;queue=[];intentionalClose=!1;reconnectDelay=1e3;static MAX_RECONNECT_DELAY=8e3;tokenGetter=null;constructor(t,n){const r=location.protocol==="https:"?"wss:":"ws:",a=location.host;this.url=t??`${r}//${a}/ws`,this.tokenGetter=n??null}connect(){this.intentionalClose=!1;let t=this.url;if(this.tokenGetter){const n=this.tokenGetter();if(n){const r=t.includes("?")?"&":"?";t=`${t}${r}token=${n}`}}this.ws=new WebSocket(t),this.ws.onopen=()=>{this.reconnectDelay=1e3,this.notifyStatus(!0),this.flushQueue(),this.startHeartbeat()},this.ws.onmessage=n=>{if(n.data==="pong")return;const r=JSON.parse(n.data);this.handlers.get(r.type)?.forEach(i=>i(r.data))},this.ws.onclose=()=>{this.stopHeartbeat(),this.notifyStatus(!1),this.intentionalClose||(this.reconnectTimer=setTimeout(()=>{this.reconnectDelay=Math.min(this.reconnectDelay*2,Xn.MAX_RECONNECT_DELAY),this.connect()},this.reconnectDelay))},this.ws.onerror=()=>this.ws?.close()}disconnect(){this.intentionalClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.ws?.close(),this.ws=null}on(t,n){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n),()=>this.handlers.get(t)?.delete(n)}onStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}send(t,n){const r={type:t,data:n};this.ws?.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(r)):this.queue.push(r)}get connected(){return this.ws?.readyState===WebSocket.OPEN}flushQueue(){for(;this.queue.length>0&&this.ws?.readyState===WebSocket.OPEN;){const t=this.queue.shift();this.ws.send(JSON.stringify(t))}}notifyStatus(t){this.statusHandlers.forEach(n=>n(t))}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},25e3)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}}const Zn="fluxy_token";let ku=null;function Ln(){return localStorage.getItem(Zn)}function Od(e){localStorage.setItem(Zn,e)}function Tu(){localStorage.removeItem(Zn)}function Ld(e){ku=e}async function ze(e,t={}){const n=Ln(),r=new Headers(t.headers);n&&r.set("Authorization",`Bearer ${n}`);const a=await fetch(e,{...t,headers:r});return a.status===401&&n&&(Tu(),ku?.()),a}function Dd(e,t,n=!0){const[r,a]=v.useState([]),[i,o]=v.useState(null),[s,l]=v.useState(!1),[u,d]=v.useState(""),[c,p]=v.useState([]),[g,m]=v.useState(!1),k=v.useRef(!1),w=v.useRef(null),b=v.useRef(!1),T=v.useRef(!1);v.useEffect(()=>{w.current=i},[i]),v.useEffect(()=>{b.current=s},[s]);const _=v.useCallback(O=>{let E;O.audio_data&&(O.audio_data.startsWith("data:")?E=O.audio_data:O.audio_data.includes("/")?E=`/api/files/${O.audio_data}`:E=`data:audio/webm;base64,${O.audio_data}`);let I;if(O.attachments)try{I=JSON.parse(O.attachments)}catch{}return{id:O.id,role:O.role,content:O.content,timestamp:O.created_at,audioData:E,hasAttachments:!!(I&&I.length>0),attachments:I}},[]),N=v.useCallback(async()=>{try{const O=await ze("/api/context/current").then(M=>M.json());if(!O.conversationId)return;o(O.conversationId);const E=20,I=await ze(`/api/conversations/${O.conversationId}/messages?limit=${E}`);if(!I.ok)return;const x=await I.json();if(!x?.length)return;const D=x.filter(M=>M.role==="user"||M.role==="assistant");a(D.map(_)),m(x.length>=E)}catch{}},[_]),C=v.useCallback(async()=>{if(!(T.current||!w.current)){T.current=!0;try{const O=r[0]?.id;if(!O)return;const E=20,I=await ze(`/api/conversations/${w.current}/messages?before=${O}&limit=${E}`);if(!I.ok)return;const x=await I.json();if(!x?.length){m(!1);return}const D=x.filter(M=>M.role==="user"||M.role==="assistant").map(_);a(M=>[...D,...M]),x.length<E&&m(!1)}catch{}finally{T.current=!1}}},[r,_]);v.useEffect(()=>{!n||k.current||(k.current=!0,N())},[n,N]),v.useEffect(()=>{n&&t&&t>0&&N()},[n,t,N]),v.useEffect(()=>{if(!n||!t||t===0||!s)return;const O=setInterval(()=>{if(!b.current){clearInterval(O);return}N()},3e3);return()=>clearInterval(O)},[n,t,s,N]),v.useEffect(()=>{if(!e)return;const O=[e.on("bot:typing",()=>{l(!0),p([])}),e.on("bot:token",E=>{d(I=>I+E.token)}),e.on("bot:tool",E=>{p(I=>I.find(D=>D.name===E.name&&D.status==="running")?I:[...I,{name:E.name,status:"running"}])}),e.on("bot:response",E=>{o(E.conversationId),a(I=>[...I,{id:E.messageId||Date.now().toString(),role:"assistant",content:E.content,timestamp:new Date().toISOString()}]),d(""),l(!1),p([])}),e.on("bot:error",E=>{d(""),l(!1),p([]),a(I=>[...I,{id:Date.now().toString(),role:"assistant",content:`Error: ${E.error}`,timestamp:new Date().toISOString()}])}),e.on("chat:sync",E=>{w.current&&E.conversationId!==w.current||a(I=>[...I,{id:Date.now().toString(),role:E.message.role,content:E.message.content,timestamp:E.message.timestamp}])}),e.on("chat:conversation-created",E=>{o(E.conversationId)}),e.on("chat:state",E=>{E.streaming&&(l(!0),E.conversationId&&o(E.conversationId),E.buffer&&d(E.buffer))}),e.on("chat:cleared",()=>{a([]),o(null),d(""),l(!1),p([]),k.current=!1})];return()=>O.forEach(E=>E())},[e]);const A=v.useCallback((O,E,I)=>{if(!e||!O.trim()&&(!E||E.length===0))return;const x={id:Date.now().toString(),role:"user",content:O,timestamp:new Date().toISOString(),hasAttachments:!!(E&&E.length>0),audioData:I?I.startsWith("data:")?I:`data:audio/webm;base64,${I}`:void 0};a(M=>[...M,x]);const D={conversationId:i,content:O};I&&(D.audioData=I.includes(",")?I.split(",")[1]:I),E?.length&&(D.attachments=E.map(M=>{const L=M.preview.match(/^data:([^;]+);base64,(.+)$/);return{type:M.type,name:M.name,mediaType:L?.[1]||"application/octet-stream",data:L?.[2]||""}})),e.send("user:message",D)},[e,i]),U=v.useCallback(()=>{e&&(e.send("user:stop",{conversationId:i}),l(!1),d(""),p([]))},[e,i]),P=v.useCallback(()=>{e&&e.send("user:clear-context",{}),a([]),o(null),d(""),l(!1),p([]),k.current=!1},[e]);return{messages:r,streaming:s,streamBuffer:u,conversationId:i,tools:c,hasMore:g,loadOlder:C,sendMessage:A,stopStreaming:U,clearContext:P}}const Mt="fluxy_login_totp";function Md({onLogin:e,totpEnabled:t}){const[n,r]=v.useState(""),[a,i]=v.useState(""),[o,s]=v.useState(!1),[l,u]=v.useState("password"),[d,c]=v.useState(""),[p,g]=v.useState(""),[m,k]=v.useState(!0),[w,b]=v.useState(!1),T=v.useRef(null);v.useEffect(()=>{try{const E=sessionStorage.getItem(Mt);if(!E)return;const I=JSON.parse(E);I.pendingToken&&I.expiresAt>Date.now()?(g(I.pendingToken),u("totp")):sessionStorage.removeItem(Mt)}catch{}},[]),v.useEffect(()=>{l==="totp"&&setTimeout(()=>T.current?.focus(),100)},[l]);function _(E){try{sessionStorage.setItem(Mt,JSON.stringify({pendingToken:E,expiresAt:Date.now()+4.5*60*1e3}))}catch{}}function N(){try{sessionStorage.removeItem(Mt)}catch{}}const C=async()=>{if(!(!n.trim()||o)){s(!0),i("");try{const E=btoa(`admin:${n}`),I=await fetch("/api/portal/login",{headers:{Authorization:`Basic ${E}`},credentials:"include"}),x=await I.json();I.ok&&x.token?(N(),e(x.token)):I.ok&&x.requiresTOTP?(g(x.pendingToken),_(x.pendingToken),u("totp"),i("")):i(x.error||"Invalid password")}catch{i("Could not reach server")}finally{s(!1)}}},A=async()=>{if(!(!d.trim()||o)){s(!0),i("");try{const E=await fetch(`/api/portal/login/totp?pending=${encodeURIComponent(p)}&code=${encodeURIComponent(d)}&trust=${m?"1":"0"}`,{credentials:"include"}),I=await E.json();E.ok&&I.token?(N(),e(I.token)):i(I.error||"Invalid code")}catch{i("Could not reach server")}finally{s(!1)}}},U=E=>{E.key==="Enter"&&(l==="password"?C():A())},P=()=>{u("password"),i(""),c(""),b(!1),N()},O="w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all";return h.jsx("div",{className:"flex flex-col items-center justify-center h-dvh px-6",children:h.jsx("div",{className:"w-full max-w-[320px] flex flex-col items-center",children:h.jsx(Ht,{mode:"wait",children:l==="password"?h.jsxs(et.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},className:"w-full flex flex-col items-center",children:[h.jsx("div",{className:"w-14 h-14 rounded-2xl bg-white/[0.04] border border-white/[0.08] flex items-center justify-center mb-5",children:h.jsx(md,{className:"h-6 w-6 text-white/40"})}),h.jsx("h1",{className:"text-xl font-bold text-white tracking-tight mb-1",children:"Welcome back"}),h.jsx("p",{className:"text-white/40 text-[13px] mb-6",children:"Enter your password to continue."}),a&&h.jsx("div",{className:"w-full bg-red-500/8 border border-red-500/15 rounded-xl px-4 py-2.5 mb-4",children:h.jsx("p",{className:"text-red-400/90 text-[12px]",children:a})}),h.jsx("input",{type:"password",value:n,onChange:E=>r(E.target.value),onKeyDown:U,placeholder:"Password",autoFocus:!0,autoComplete:"current-password",className:O}),h.jsx("button",{onClick:C,disabled:!n.trim()||o,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:o?h.jsxs(h.Fragment,{children:[h.jsx(hl,{className:"h-4 w-4 animate-spin"}),"Signing in..."]}):h.jsxs(h.Fragment,{children:["Sign In",h.jsx(El,{className:"h-4 w-4"})]})})]},"password"):h.jsxs(et.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.2},className:"w-full flex flex-col items-center",children:[h.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#AF27E3]/10 border border-[#AF27E3]/20 flex items-center justify-center mb-5",children:h.jsx(Yc,{className:"h-6 w-6 text-[#AF27E3]"})}),h.jsx("h1",{className:"text-xl font-bold text-white tracking-tight mb-1",children:w?"Recovery code":"Enter your 2FA code"}),h.jsx("p",{className:"text-white/40 text-[13px] mb-6",children:w?"Enter one of your recovery codes.":"Open your authenticator app and enter the 6-digit code."}),a&&h.jsx("div",{className:"w-full bg-red-500/8 border border-red-500/15 rounded-xl px-4 py-2.5 mb-4",children:h.jsx("p",{className:"text-red-400/90 text-[12px]",children:a})}),h.jsx("input",{ref:T,type:"text",inputMode:w?"text":"numeric",autoComplete:"one-time-code",maxLength:w?20:6,value:d,onChange:E=>{c(w?E.target.value:E.target.value.replace(/\D/g,"")),i("")},onKeyDown:U,placeholder:w?"Recovery code":"000000",autoFocus:!0,className:O+(w?"":" tracking-[0.3em] text-center font-mono")}),h.jsxs("label",{className:"flex items-center gap-2.5 mt-4 w-full cursor-pointer",children:[h.jsx("div",{onClick:()=>k(E=>!E),className:`w-5 h-5 rounded-md border flex items-center justify-center transition-all ${m?"bg-[#AF27E3] border-[#AF27E3]":"bg-white/[0.04] border-white/[0.12]"}`,children:m&&h.jsx(yu,{className:"h-3.5 w-3.5 text-white"})}),h.jsx("span",{className:"text-[13px] text-white/50",children:"Trust this device for 90 days"})]}),h.jsx("button",{onClick:A,disabled:!d.trim()||o,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:o?h.jsxs(h.Fragment,{children:[h.jsx(hl,{className:"h-4 w-4 animate-spin"}),"Verifying..."]}):h.jsxs(h.Fragment,{children:["Verify",h.jsx(El,{className:"h-4 w-4"})]})}),h.jsxs("div",{className:"flex items-center gap-4 mt-4",children:[h.jsxs("button",{onClick:P,className:"text-[12px] text-white/30 hover:text-white/50 flex items-center gap-1 transition-colors",children:[h.jsx(Su,{className:"h-3 w-3"}),"Back"]}),h.jsx("button",{onClick:()=>{b(E=>!E),c(""),i("")},className:"text-[12px] text-white/30 hover:text-white/50 transition-colors",children:w?"Use authenticator code":"Use a recovery code"})]})]},"totp")})})})}function Sl(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function Fd(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Ud=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pd={};function wl(e,t){return(Pd.jsx?Bd:Ud).test(e)}const $d=/[ \t\n\f\r]/g;function zd(e){return typeof e=="object"?e.type==="text"?kl(e.value):!1:kl(e)}function kl(e){return e.replace($d,"")===""}class It{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}It.prototype.normal={};It.prototype.property={};It.prototype.space=void 0;function Au(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new It(n,r,t)}function wt(e){return e.toLowerCase()}class Ae{constructor(t,n){this.attribute=n,this.property=t}}Ae.prototype.attribute="";Ae.prototype.booleanish=!1;Ae.prototype.boolean=!1;Ae.prototype.commaOrSpaceSeparated=!1;Ae.prototype.commaSeparated=!1;Ae.prototype.defined=!1;Ae.prototype.mustUseProperty=!1;Ae.prototype.number=!1;Ae.prototype.overloadedBoolean=!1;Ae.prototype.property="";Ae.prototype.spaceSeparated=!1;Ae.prototype.space=void 0;let Gd=0;const K=qe(),de=qe(),Dn=qe(),F=qe(),le=qe(),tt=qe(),Ie=qe();function qe(){return 2**++Gd}const Mn=Object.freeze(Object.defineProperty({__proto__:null,boolean:K,booleanish:de,commaOrSpaceSeparated:Ie,commaSeparated:tt,number:F,overloadedBoolean:Dn,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),pn=Object.keys(Mn);class Qn extends Ae{constructor(t,n,r,a){let i=-1;if(super(t,n),Tl(this,"space",a),typeof r=="number")for(;++i<pn.length;){const o=pn[i];Tl(this,pn[i],(r&Mn[o])===Mn[o])}}}Qn.prototype.defined=!0;function Tl(e,t,n){n&&(e[t]=n)}function rt(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new Qn(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[wt(r)]=r,n[wt(i.attribute)]=r}return new It(t,n,e.space)}const _u=rt({properties:{ariaActiveDescendant:null,ariaAtomic:de,ariaAutoComplete:null,ariaBusy:de,ariaChecked:de,ariaColCount:F,ariaColIndex:F,ariaColSpan:F,ariaControls:le,ariaCurrent:null,ariaDescribedBy:le,ariaDetails:null,ariaDisabled:de,ariaDropEffect:le,ariaErrorMessage:null,ariaExpanded:de,ariaFlowTo:le,ariaGrabbed:de,ariaHasPopup:null,ariaHidden:de,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:le,ariaLevel:F,ariaLive:null,ariaModal:de,ariaMultiLine:de,ariaMultiSelectable:de,ariaOrientation:null,ariaOwns:le,ariaPlaceholder:null,ariaPosInSet:F,ariaPressed:de,ariaReadOnly:de,ariaRelevant:null,ariaRequired:de,ariaRoleDescription:le,ariaRowCount:F,ariaRowIndex:F,ariaRowSpan:F,ariaSelected:de,ariaSetSize:F,ariaSort:null,ariaValueMax:F,ariaValueMin:F,ariaValueNow:F,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Iu(e,t){return t in e?e[t]:t}function Nu(e,t){return Iu(e,t.toLowerCase())}const jd=rt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tt,acceptCharset:le,accessKey:le,action:null,allow:null,allowFullScreen:K,allowPaymentRequest:K,allowUserMedia:K,alt:null,as:null,async:K,autoCapitalize:null,autoComplete:le,autoFocus:K,autoPlay:K,blocking:le,capture:null,charSet:null,checked:K,cite:null,className:le,cols:F,colSpan:null,content:null,contentEditable:de,controls:K,controlsList:le,coords:F|tt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:K,defer:K,dir:null,dirName:null,disabled:K,download:Dn,draggable:de,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:K,formTarget:null,headers:le,height:F,hidden:Dn,high:F,href:null,hrefLang:null,htmlFor:le,httpEquiv:le,id:null,imageSizes:null,imageSrcSet:null,inert:K,inputMode:null,integrity:null,is:null,isMap:K,itemId:null,itemProp:le,itemRef:le,itemScope:K,itemType:le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:K,low:F,manifest:null,max:null,maxLength:F,media:null,method:null,min:null,minLength:F,multiple:K,muted:K,name:null,nonce:null,noModule:K,noValidate:K,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:K,optimum:F,pattern:null,ping:le,placeholder:null,playsInline:K,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:K,referrerPolicy:null,rel:le,required:K,reversed:K,rows:F,rowSpan:F,sandbox:le,scope:null,scoped:K,seamless:K,selected:K,shadowRootClonable:K,shadowRootDelegatesFocus:K,shadowRootMode:null,shape:null,size:F,sizes:null,slot:null,span:F,spellCheck:de,src:null,srcDoc:null,srcLang:null,srcSet:null,start:F,step:null,style:null,tabIndex:F,target:null,title:null,translate:null,type:null,typeMustMatch:K,useMap:null,value:de,width:F,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:le,axis:null,background:null,bgColor:null,border:F,borderColor:null,bottomMargin:F,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:K,declare:K,event:null,face:null,frame:null,frameBorder:null,hSpace:F,leftMargin:F,link:null,longDesc:null,lowSrc:null,marginHeight:F,marginWidth:F,noResize:K,noHref:K,noShade:K,noWrap:K,object:null,profile:null,prompt:null,rev:null,rightMargin:F,rules:null,scheme:null,scrolling:de,standby:null,summary:null,text:null,topMargin:F,valueType:null,version:null,vAlign:null,vLink:null,vSpace:F,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:K,disableRemotePlayback:K,prefix:null,property:null,results:F,security:null,unselectable:null},space:"html",transform:Nu}),Hd=rt({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",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:Ie,accentHeight:F,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:F,amplitude:F,arabicForm:null,ascent:F,attributeName:null,attributeType:null,azimuth:F,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:F,by:null,calcMode:null,capHeight:F,className:le,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:F,diffuseConstant:F,direction:null,display:null,dur:null,divisor:F,dominantBaseline:null,download:K,dx:null,dy:null,edgeMode:null,editable:null,elevation:F,enableBackground:null,end:null,event:null,exponent:F,externalResourcesRequired:null,fill:null,fillOpacity:F,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:tt,g2:tt,glyphName:tt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:F,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:F,horizOriginX:F,horizOriginY:F,id:null,ideographic:F,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:F,k:F,k1:F,k2:F,k3:F,k4:F,kernelMatrix:Ie,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:F,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:F,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:F,overlineThickness:F,paintOrder:null,panose1:null,path:null,pathLength:F,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:F,pointsAtY:F,pointsAtZ:F,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ie,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ie,rev:Ie,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ie,requiredFeatures:Ie,requiredFonts:Ie,requiredFormats:Ie,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:F,specularExponent:F,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:F,strikethroughThickness:F,string:null,stroke:null,strokeDashArray:Ie,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:F,strokeOpacity:F,strokeWidth:null,style:null,surfaceScale:F,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ie,tabIndex:F,tableValues:null,target:null,targetX:F,targetY:F,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ie,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:F,underlineThickness:F,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:F,values:null,vAlphabetic:F,vMathematical:F,vectorEffect:null,vHanging:F,vIdeographic:F,version:null,vertAdvY:F,vertOriginX:F,vertOriginY:F,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:F,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Iu}),Ru=rt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),xu=rt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Nu}),vu=rt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Vd={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"},Wd=/[A-Z]/g,Al=/-[a-z]/g,qd=/^data[-\w.:]+$/i;function Cu(e,t){const n=wt(t);let r=t,a=Ae;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&qd.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Al,Kd);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Al.test(i)){let o=i.replace(Wd,Yd);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=Qn}return new a(r,t)}function Yd(e){return"-"+e.toLowerCase()}function Kd(e){return e.charAt(1).toUpperCase()}const Ou=Au([_u,jd,Ru,xu,vu],"html"),Kt=Au([_u,Hd,Ru,xu,vu],"svg");function _l(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Xd(e){return e.join(" ").trim()}var Xe={},gn,Il;function Zd(){if(Il)return gn;Il=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
1
|
+
import{c as fe,r as v,j as h,A as Ht,m as et,L as hl,a as El,S as Yc,C as yu,b as Su,g as wu,R as Be,d as Kc,M as yl,e as Xc,O as Zc}from"./globals-3yce7Lzq.js";const Qc=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],Jc=fe("bell-off",Qc);const ed=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]],td=fe("bell-ring",ed);const nd=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],rd=fe("bell",nd);const ad=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],id=fe("camera",ad);const od=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],sd=fe("chevron-left",od);const ld=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ud=fe("chevron-right",ld);const cd=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],dd=fe("download",cd);const pd=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],gd=fe("ellipsis-vertical",pd);const fd=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],md=fe("lock",fd);const bd=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],On=fe("paperclip",bd);const hd=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ed=fe("pause",hd);const yd=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Sd=fe("play",yd);const wd=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],kd=fe("send-horizontal",wd);const Td=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],Ad=fe("share",Td);const _d=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Id=fe("square",_d);const Nd=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Rd=fe("trash-2",Nd);const xd=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],vd=fe("wand-sparkles",xd);const Cd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kn=fe("x",Cd);class Xn{ws=null;handlers=new Map;statusHandlers=new Set;reconnectTimer=null;heartbeatTimer=null;url;queue=[];intentionalClose=!1;reconnectDelay=1e3;static MAX_RECONNECT_DELAY=8e3;tokenGetter=null;constructor(t,n){const r=location.protocol==="https:"?"wss:":"ws:",a=location.host;this.url=t??`${r}//${a}/ws`,this.tokenGetter=n??null}connect(){this.intentionalClose=!1;let t=this.url;if(this.tokenGetter){const n=this.tokenGetter();if(n){const r=t.includes("?")?"&":"?";t=`${t}${r}token=${n}`}}this.ws=new WebSocket(t),this.ws.onopen=()=>{this.reconnectDelay=1e3,this.notifyStatus(!0),this.flushQueue(),this.startHeartbeat()},this.ws.onmessage=n=>{if(n.data==="pong")return;const r=JSON.parse(n.data);this.handlers.get(r.type)?.forEach(i=>i(r.data))},this.ws.onclose=()=>{this.stopHeartbeat(),this.notifyStatus(!1),this.intentionalClose||(this.reconnectTimer=setTimeout(()=>{this.reconnectDelay=Math.min(this.reconnectDelay*2,Xn.MAX_RECONNECT_DELAY),this.connect()},this.reconnectDelay))},this.ws.onerror=()=>this.ws?.close()}disconnect(){this.intentionalClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.ws?.close(),this.ws=null}on(t,n){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n),()=>this.handlers.get(t)?.delete(n)}onStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}send(t,n){const r={type:t,data:n};this.ws?.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(r)):this.queue.push(r)}get connected(){return this.ws?.readyState===WebSocket.OPEN}flushQueue(){for(;this.queue.length>0&&this.ws?.readyState===WebSocket.OPEN;){const t=this.queue.shift();this.ws.send(JSON.stringify(t))}}notifyStatus(t){this.statusHandlers.forEach(n=>n(t))}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},25e3)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}}const Zn="fluxy_token";let ku=null;function Ln(){return localStorage.getItem(Zn)}function Od(e){localStorage.setItem(Zn,e)}function Tu(){localStorage.removeItem(Zn)}function Ld(e){ku=e}async function ze(e,t={}){const n=Ln(),r=new Headers(t.headers);n&&r.set("Authorization",`Bearer ${n}`);const a=await fetch(e,{...t,headers:r});return a.status===401&&n&&(Tu(),ku?.()),a}function Dd(e,t,n=!0){const[r,a]=v.useState([]),[i,o]=v.useState(null),[s,l]=v.useState(!1),[u,d]=v.useState(""),[c,p]=v.useState([]),[g,m]=v.useState(!1),k=v.useRef(!1),w=v.useRef(null),b=v.useRef(!1),T=v.useRef(!1);v.useEffect(()=>{w.current=i},[i]),v.useEffect(()=>{b.current=s},[s]);const _=v.useCallback(O=>{let E;O.audio_data&&(O.audio_data.startsWith("data:")?E=O.audio_data:O.audio_data.includes("/")?E=`/api/files/${O.audio_data}`:E=`data:audio/webm;base64,${O.audio_data}`);let I;if(O.attachments)try{I=JSON.parse(O.attachments)}catch{}return{id:O.id,role:O.role,content:O.content,timestamp:O.created_at,audioData:E,hasAttachments:!!(I&&I.length>0),attachments:I}},[]),N=v.useCallback(async()=>{try{const O=await ze("/api/context/current").then(M=>M.json());if(!O.conversationId)return;o(O.conversationId);const E=20,I=await ze(`/api/conversations/${O.conversationId}/messages?limit=${E}`);if(!I.ok)return;const x=await I.json();if(!x?.length)return;const D=x.filter(M=>M.role==="user"||M.role==="assistant");a(D.map(_)),m(x.length>=E)}catch{}},[_]),C=v.useCallback(async()=>{if(!(T.current||!w.current)){T.current=!0;try{const O=r[0]?.id;if(!O)return;const E=20,I=await ze(`/api/conversations/${w.current}/messages?before=${O}&limit=${E}`);if(!I.ok)return;const x=await I.json();if(!x?.length){m(!1);return}const D=x.filter(M=>M.role==="user"||M.role==="assistant").map(_);a(M=>[...D,...M]),x.length<E&&m(!1)}catch{}finally{T.current=!1}}},[r,_]);v.useEffect(()=>{!n||k.current||(k.current=!0,N())},[n,N]),v.useEffect(()=>{n&&t&&t>0&&N()},[n,t,N]),v.useEffect(()=>{if(!n||!t||t===0||!s)return;const O=setInterval(()=>{if(!b.current){clearInterval(O);return}N()},3e3);return()=>clearInterval(O)},[n,t,s,N]),v.useEffect(()=>{if(!e)return;const O=[e.on("bot:typing",()=>{l(!0),p([])}),e.on("bot:token",E=>{d(I=>I+E.token)}),e.on("bot:tool",E=>{p(I=>I.find(D=>D.name===E.name&&D.status==="running")?I:[...I,{name:E.name,status:"running"}])}),e.on("bot:response",E=>{o(E.conversationId),a(I=>[...I,{id:E.messageId||Date.now().toString(),role:"assistant",content:E.content,timestamp:new Date().toISOString()}]),d(""),l(!1),p([])}),e.on("bot:error",E=>{d(""),l(!1),p([]),a(I=>[...I,{id:Date.now().toString(),role:"assistant",content:`Error: ${E.error}`,timestamp:new Date().toISOString()}])}),e.on("chat:sync",E=>{w.current&&E.conversationId!==w.current||a(I=>[...I,{id:Date.now().toString(),role:E.message.role,content:E.message.content,timestamp:E.message.timestamp}])}),e.on("chat:conversation-created",E=>{o(E.conversationId)}),e.on("chat:state",E=>{E.streaming&&(l(!0),E.conversationId&&o(E.conversationId),E.buffer&&d(E.buffer))}),e.on("chat:cleared",()=>{a([]),o(null),d(""),l(!1),p([]),k.current=!1})];return()=>O.forEach(E=>E())},[e]);const A=v.useCallback((O,E,I)=>{if(!e||!O.trim()&&(!E||E.length===0))return;const x={id:Date.now().toString(),role:"user",content:O,timestamp:new Date().toISOString(),hasAttachments:!!(E&&E.length>0),audioData:I?I.startsWith("data:")?I:`data:audio/webm;base64,${I}`:void 0};a(M=>[...M,x]);const D={conversationId:i,content:O};I&&(D.audioData=I.includes(",")?I.split(",")[1]:I),E?.length&&(D.attachments=E.map(M=>{const L=M.preview.match(/^data:([^;]+);base64,(.+)$/);return{type:M.type,name:M.name,mediaType:L?.[1]||"application/octet-stream",data:L?.[2]||""}})),e.send("user:message",D)},[e,i]),U=v.useCallback(()=>{e&&(e.send("user:stop",{conversationId:i}),l(!1),d(""),p([]))},[e,i]),P=v.useCallback(()=>{e&&e.send("user:clear-context",{}),a([]),o(null),d(""),l(!1),p([]),k.current=!1},[e]);return{messages:r,streaming:s,streamBuffer:u,conversationId:i,tools:c,hasMore:g,loadOlder:C,sendMessage:A,stopStreaming:U,clearContext:P}}const Mt="fluxy_login_totp";function Md({onLogin:e,totpEnabled:t}){const[n,r]=v.useState(""),[a,i]=v.useState(""),[o,s]=v.useState(!1),[l,u]=v.useState("password"),[d,c]=v.useState(""),[p,g]=v.useState(""),[m,k]=v.useState(!0),[w,b]=v.useState(!1),T=v.useRef(null);v.useEffect(()=>{try{const E=sessionStorage.getItem(Mt);if(!E)return;const I=JSON.parse(E);I.pendingToken&&I.expiresAt>Date.now()?(g(I.pendingToken),u("totp")):sessionStorage.removeItem(Mt)}catch{}},[]),v.useEffect(()=>{l==="totp"&&setTimeout(()=>T.current?.focus(),100)},[l]);function _(E){try{sessionStorage.setItem(Mt,JSON.stringify({pendingToken:E,expiresAt:Date.now()+4.5*60*1e3}))}catch{}}function N(){try{sessionStorage.removeItem(Mt)}catch{}}const C=async()=>{if(!(!n.trim()||o)){s(!0),i("");try{const E=btoa(`admin:${n}`),I=await fetch("/api/portal/login",{headers:{Authorization:`Basic ${E}`},credentials:"include"}),x=await I.json();I.ok&&x.token?(N(),e(x.token)):I.ok&&x.requiresTOTP?(g(x.pendingToken),_(x.pendingToken),u("totp"),i("")):i(x.error||"Invalid password")}catch{i("Could not reach server")}finally{s(!1)}}},A=async()=>{if(!(!d.trim()||o)){s(!0),i("");try{const E=await fetch(`/api/portal/login/totp?pending=${encodeURIComponent(p)}&code=${encodeURIComponent(d)}&trust=${m?"1":"0"}`,{credentials:"include"}),I=await E.json();E.ok&&I.token?(N(),e(I.token)):i(I.error||"Invalid code")}catch{i("Could not reach server")}finally{s(!1)}}},U=E=>{E.key==="Enter"&&(l==="password"?C():A())},P=()=>{u("password"),i(""),c(""),b(!1),N()},O="w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all";return h.jsx("div",{className:"flex flex-col items-center justify-center h-dvh px-6",children:h.jsx("div",{className:"w-full max-w-[320px] flex flex-col items-center",children:h.jsx(Ht,{mode:"wait",children:l==="password"?h.jsxs(et.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},className:"w-full flex flex-col items-center",children:[h.jsx("div",{className:"w-14 h-14 rounded-2xl bg-white/[0.04] border border-white/[0.08] flex items-center justify-center mb-5",children:h.jsx(md,{className:"h-6 w-6 text-white/40"})}),h.jsx("h1",{className:"text-xl font-bold text-white tracking-tight mb-1",children:"Welcome back"}),h.jsx("p",{className:"text-white/40 text-[13px] mb-6",children:"Enter your password to continue."}),a&&h.jsx("div",{className:"w-full bg-red-500/8 border border-red-500/15 rounded-xl px-4 py-2.5 mb-4",children:h.jsx("p",{className:"text-red-400/90 text-[12px]",children:a})}),h.jsx("input",{type:"password",value:n,onChange:E=>r(E.target.value),onKeyDown:U,placeholder:"Password",autoFocus:!0,autoComplete:"current-password",className:O}),h.jsx("button",{onClick:C,disabled:!n.trim()||o,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:o?h.jsxs(h.Fragment,{children:[h.jsx(hl,{className:"h-4 w-4 animate-spin"}),"Signing in..."]}):h.jsxs(h.Fragment,{children:["Sign In",h.jsx(El,{className:"h-4 w-4"})]})})]},"password"):h.jsxs(et.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.2},className:"w-full flex flex-col items-center",children:[h.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#AF27E3]/10 border border-[#AF27E3]/20 flex items-center justify-center mb-5",children:h.jsx(Yc,{className:"h-6 w-6 text-[#AF27E3]"})}),h.jsx("h1",{className:"text-xl font-bold text-white tracking-tight mb-1",children:w?"Recovery code":"Enter your 2FA code"}),h.jsx("p",{className:"text-white/40 text-[13px] mb-6",children:w?"Enter one of your recovery codes.":"Open your authenticator app and enter the 6-digit code."}),a&&h.jsx("div",{className:"w-full bg-red-500/8 border border-red-500/15 rounded-xl px-4 py-2.5 mb-4",children:h.jsx("p",{className:"text-red-400/90 text-[12px]",children:a})}),h.jsx("input",{ref:T,type:"text",inputMode:w?"text":"numeric",autoComplete:"one-time-code",maxLength:w?20:6,value:d,onChange:E=>{c(w?E.target.value:E.target.value.replace(/\D/g,"")),i("")},onKeyDown:U,placeholder:w?"Recovery code":"000000",autoFocus:!0,className:O+(w?"":" tracking-[0.3em] text-center font-mono")}),h.jsxs("label",{className:"flex items-center gap-2.5 mt-4 w-full cursor-pointer",children:[h.jsx("div",{onClick:()=>k(E=>!E),className:`w-5 h-5 rounded-md border flex items-center justify-center transition-all ${m?"bg-[#AF27E3] border-[#AF27E3]":"bg-white/[0.04] border-white/[0.12]"}`,children:m&&h.jsx(yu,{className:"h-3.5 w-3.5 text-white"})}),h.jsx("span",{className:"text-[13px] text-white/50",children:"Trust this device for 90 days"})]}),h.jsx("button",{onClick:A,disabled:!d.trim()||o,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:o?h.jsxs(h.Fragment,{children:[h.jsx(hl,{className:"h-4 w-4 animate-spin"}),"Verifying..."]}):h.jsxs(h.Fragment,{children:["Verify",h.jsx(El,{className:"h-4 w-4"})]})}),h.jsxs("div",{className:"flex items-center gap-4 mt-4",children:[h.jsxs("button",{onClick:P,className:"text-[12px] text-white/30 hover:text-white/50 flex items-center gap-1 transition-colors",children:[h.jsx(Su,{className:"h-3 w-3"}),"Back"]}),h.jsx("button",{onClick:()=>{b(E=>!E),c(""),i("")},className:"text-[12px] text-white/30 hover:text-white/50 transition-colors",children:w?"Use authenticator code":"Use a recovery code"})]})]},"totp")})})})}function Sl(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function Fd(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Ud=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pd={};function wl(e,t){return(Pd.jsx?Bd:Ud).test(e)}const $d=/[ \t\n\f\r]/g;function zd(e){return typeof e=="object"?e.type==="text"?kl(e.value):!1:kl(e)}function kl(e){return e.replace($d,"")===""}class It{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}It.prototype.normal={};It.prototype.property={};It.prototype.space=void 0;function Au(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new It(n,r,t)}function wt(e){return e.toLowerCase()}class Ae{constructor(t,n){this.attribute=n,this.property=t}}Ae.prototype.attribute="";Ae.prototype.booleanish=!1;Ae.prototype.boolean=!1;Ae.prototype.commaOrSpaceSeparated=!1;Ae.prototype.commaSeparated=!1;Ae.prototype.defined=!1;Ae.prototype.mustUseProperty=!1;Ae.prototype.number=!1;Ae.prototype.overloadedBoolean=!1;Ae.prototype.property="";Ae.prototype.spaceSeparated=!1;Ae.prototype.space=void 0;let Gd=0;const K=qe(),de=qe(),Dn=qe(),F=qe(),le=qe(),tt=qe(),Ie=qe();function qe(){return 2**++Gd}const Mn=Object.freeze(Object.defineProperty({__proto__:null,boolean:K,booleanish:de,commaOrSpaceSeparated:Ie,commaSeparated:tt,number:F,overloadedBoolean:Dn,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),pn=Object.keys(Mn);class Qn extends Ae{constructor(t,n,r,a){let i=-1;if(super(t,n),Tl(this,"space",a),typeof r=="number")for(;++i<pn.length;){const o=pn[i];Tl(this,pn[i],(r&Mn[o])===Mn[o])}}}Qn.prototype.defined=!0;function Tl(e,t,n){n&&(e[t]=n)}function rt(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new Qn(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[wt(r)]=r,n[wt(i.attribute)]=r}return new It(t,n,e.space)}const _u=rt({properties:{ariaActiveDescendant:null,ariaAtomic:de,ariaAutoComplete:null,ariaBusy:de,ariaChecked:de,ariaColCount:F,ariaColIndex:F,ariaColSpan:F,ariaControls:le,ariaCurrent:null,ariaDescribedBy:le,ariaDetails:null,ariaDisabled:de,ariaDropEffect:le,ariaErrorMessage:null,ariaExpanded:de,ariaFlowTo:le,ariaGrabbed:de,ariaHasPopup:null,ariaHidden:de,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:le,ariaLevel:F,ariaLive:null,ariaModal:de,ariaMultiLine:de,ariaMultiSelectable:de,ariaOrientation:null,ariaOwns:le,ariaPlaceholder:null,ariaPosInSet:F,ariaPressed:de,ariaReadOnly:de,ariaRelevant:null,ariaRequired:de,ariaRoleDescription:le,ariaRowCount:F,ariaRowIndex:F,ariaRowSpan:F,ariaSelected:de,ariaSetSize:F,ariaSort:null,ariaValueMax:F,ariaValueMin:F,ariaValueNow:F,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Iu(e,t){return t in e?e[t]:t}function Nu(e,t){return Iu(e,t.toLowerCase())}const jd=rt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tt,acceptCharset:le,accessKey:le,action:null,allow:null,allowFullScreen:K,allowPaymentRequest:K,allowUserMedia:K,alt:null,as:null,async:K,autoCapitalize:null,autoComplete:le,autoFocus:K,autoPlay:K,blocking:le,capture:null,charSet:null,checked:K,cite:null,className:le,cols:F,colSpan:null,content:null,contentEditable:de,controls:K,controlsList:le,coords:F|tt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:K,defer:K,dir:null,dirName:null,disabled:K,download:Dn,draggable:de,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:K,formTarget:null,headers:le,height:F,hidden:Dn,high:F,href:null,hrefLang:null,htmlFor:le,httpEquiv:le,id:null,imageSizes:null,imageSrcSet:null,inert:K,inputMode:null,integrity:null,is:null,isMap:K,itemId:null,itemProp:le,itemRef:le,itemScope:K,itemType:le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:K,low:F,manifest:null,max:null,maxLength:F,media:null,method:null,min:null,minLength:F,multiple:K,muted:K,name:null,nonce:null,noModule:K,noValidate:K,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:K,optimum:F,pattern:null,ping:le,placeholder:null,playsInline:K,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:K,referrerPolicy:null,rel:le,required:K,reversed:K,rows:F,rowSpan:F,sandbox:le,scope:null,scoped:K,seamless:K,selected:K,shadowRootClonable:K,shadowRootDelegatesFocus:K,shadowRootMode:null,shape:null,size:F,sizes:null,slot:null,span:F,spellCheck:de,src:null,srcDoc:null,srcLang:null,srcSet:null,start:F,step:null,style:null,tabIndex:F,target:null,title:null,translate:null,type:null,typeMustMatch:K,useMap:null,value:de,width:F,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:le,axis:null,background:null,bgColor:null,border:F,borderColor:null,bottomMargin:F,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:K,declare:K,event:null,face:null,frame:null,frameBorder:null,hSpace:F,leftMargin:F,link:null,longDesc:null,lowSrc:null,marginHeight:F,marginWidth:F,noResize:K,noHref:K,noShade:K,noWrap:K,object:null,profile:null,prompt:null,rev:null,rightMargin:F,rules:null,scheme:null,scrolling:de,standby:null,summary:null,text:null,topMargin:F,valueType:null,version:null,vAlign:null,vLink:null,vSpace:F,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:K,disableRemotePlayback:K,prefix:null,property:null,results:F,security:null,unselectable:null},space:"html",transform:Nu}),Hd=rt({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",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:Ie,accentHeight:F,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:F,amplitude:F,arabicForm:null,ascent:F,attributeName:null,attributeType:null,azimuth:F,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:F,by:null,calcMode:null,capHeight:F,className:le,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:F,diffuseConstant:F,direction:null,display:null,dur:null,divisor:F,dominantBaseline:null,download:K,dx:null,dy:null,edgeMode:null,editable:null,elevation:F,enableBackground:null,end:null,event:null,exponent:F,externalResourcesRequired:null,fill:null,fillOpacity:F,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:tt,g2:tt,glyphName:tt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:F,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:F,horizOriginX:F,horizOriginY:F,id:null,ideographic:F,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:F,k:F,k1:F,k2:F,k3:F,k4:F,kernelMatrix:Ie,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:F,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:F,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:F,overlineThickness:F,paintOrder:null,panose1:null,path:null,pathLength:F,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:F,pointsAtY:F,pointsAtZ:F,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ie,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ie,rev:Ie,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ie,requiredFeatures:Ie,requiredFonts:Ie,requiredFormats:Ie,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:F,specularExponent:F,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:F,strikethroughThickness:F,string:null,stroke:null,strokeDashArray:Ie,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:F,strokeOpacity:F,strokeWidth:null,style:null,surfaceScale:F,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ie,tabIndex:F,tableValues:null,target:null,targetX:F,targetY:F,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ie,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:F,underlineThickness:F,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:F,values:null,vAlphabetic:F,vMathematical:F,vectorEffect:null,vHanging:F,vIdeographic:F,version:null,vertAdvY:F,vertOriginX:F,vertOriginY:F,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:F,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Iu}),Ru=rt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),xu=rt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Nu}),vu=rt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Vd={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"},Wd=/[A-Z]/g,Al=/-[a-z]/g,qd=/^data[-\w.:]+$/i;function Cu(e,t){const n=wt(t);let r=t,a=Ae;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&qd.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Al,Kd);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Al.test(i)){let o=i.replace(Wd,Yd);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=Qn}return new a(r,t)}function Yd(e){return"-"+e.toLowerCase()}function Kd(e){return e.charAt(1).toUpperCase()}const Ou=Au([_u,jd,Ru,xu,vu],"html"),Kt=Au([_u,Hd,Ru,xu,vu],"svg");function _l(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Xd(e){return e.join(" ").trim()}var Xe={},gn,Il;function Zd(){if(Il)return gn;Il=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
2
2
|
`,u="/",d="*",c="",p="comment",g="declaration";function m(w,b){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];b=b||{};var T=1,_=1;function N(M){var L=M.match(t);L&&(T+=L.length);var G=M.lastIndexOf(l);_=~G?M.length-G:_+M.length}function C(){var M={line:T,column:_};return function(L){return L.position=new A(M),O(),L}}function A(M){this.start=M,this.end={line:T,column:_},this.source=b.source}A.prototype.content=w;function U(M){var L=new Error(b.source+":"+T+":"+_+": "+M);if(L.reason=M,L.filename=b.source,L.line=T,L.column=_,L.source=w,!b.silent)throw L}function P(M){var L=M.exec(w);if(L){var G=L[0];return N(G),w=w.slice(G.length),L}}function O(){P(n)}function E(M){var L;for(M=M||[];L=I();)L!==!1&&M.push(L);return M}function I(){var M=C();if(!(u!=w.charAt(0)||d!=w.charAt(1))){for(var L=2;c!=w.charAt(L)&&(d!=w.charAt(L)||u!=w.charAt(L+1));)++L;if(L+=2,c===w.charAt(L-1))return U("End of comment missing");var G=w.slice(2,L-2);return _+=2,N(G),w=w.slice(L),_+=2,M({type:p,comment:G})}}function x(){var M=C(),L=P(r);if(L){if(I(),!P(a))return U("property missing ':'");var G=P(i),V=M({type:g,property:k(L[0].replace(e,c)),value:G?k(G[0].replace(e,c)):c});return P(o),V}}function D(){var M=[];E(M);for(var L;L=x();)L!==!1&&(M.push(L),E(M));return M}return O(),D()}function k(w){return w?w.replace(s,c):c}return gn=m,gn}var Nl;function Qd(){if(Nl)return Xe;Nl=1;var e=Xe&&Xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.default=n;const t=e(Zd());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const o=(0,t.default)(r),s=typeof a=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:d}=l;s?a(u,d,l):d&&(i=i||{},i[u]=d)}),i}return Xe}var gt={},Rl;function Jd(){if(Rl)return gt;Rl=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},o=function(u,d){return d.toUpperCase()},s=function(u,d){return"".concat(d,"-")},l=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(a,s):u=u.replace(r,s),u.replace(t,o))};return gt.camelCase=l,gt}var ft,xl;function ep(){if(xl)return ft;xl=1;var e=ft&&ft.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(Qd()),n=Jd();function r(a,i){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(s,l){s&&l&&(o[(0,n.camelCase)(s,i)]=l)}),o}return r.default=r,ft=r,ft}var tp=ep();const np=wu(tp),Lu=Du("end"),Jn=Du("start");function Du(e){return t;function t(n){const r=n&&n.position&&n.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 rp(e){const t=Jn(e),n=Lu(e);if(t&&n)return{start:t,end:n}}function ht(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vl(e.position):"start"in e||"end"in e?vl(e):"line"in e||"column"in e?Fn(e):""}function Fn(e){return Cl(e&&e.line)+":"+Cl(e&&e.column)}function vl(e){return Fn(e&&e.start)+"-"+Fn(e&&e.end)}function Cl(e){return e&&typeof e=="number"?e:1}class Ee extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=s?s.line:void 0,this.name=ht(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ee.prototype.file="";Ee.prototype.name="";Ee.prototype.reason="";Ee.prototype.message="";Ee.prototype.stack="";Ee.prototype.column=void 0;Ee.prototype.line=void 0;Ee.prototype.ancestors=void 0;Ee.prototype.cause=void 0;Ee.prototype.fatal=void 0;Ee.prototype.place=void 0;Ee.prototype.ruleId=void 0;Ee.prototype.source=void 0;const er={}.hasOwnProperty,ap=new Map,ip=/[A-Z]/g,op=new Set(["table","tbody","thead","tfoot","tr"]),sp=new Set(["td","th"]),Mu="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lp(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=bp(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=mp(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Kt:Ou,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Fu(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Fu(e,t,n){if(t.type==="element")return up(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return cp(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return pp(e,t,n);if(t.type==="mdxjsEsm")return dp(e,t);if(t.type==="root")return gp(e,t,n);if(t.type==="text")return fp(e,t)}function up(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Kt,e.schema=a),e.ancestors.push(t);const i=Bu(e,t.tagName,!1),o=hp(e,t);let s=nr(e,t);return op.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!zd(l):!0})),Uu(e,o,i,t),tr(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function cp(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}kt(e,t.position)}function dp(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);kt(e,t.position)}function pp(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Kt,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:Bu(e,t.name,!0),o=Ep(e,t),s=nr(e,t);return Uu(e,o,i,t),tr(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function gp(e,t,n){const r={};return tr(r,nr(e,t)),e.create(t,e.Fragment,r,n)}function fp(e,t){return t.value}function Uu(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function tr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function mp(e,t,n){return r;function r(a,i,o,s){const u=Array.isArray(o.children)?n:t;return s?u(i,o,s):u(i,o)}}function bp(e,t){return n;function n(r,a,i,o){const s=Array.isArray(i.children),l=Jn(r);return t(a,i,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function hp(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&er.call(t.properties,a)){const i=yp(e,a,t.properties[a]);if(i){const[o,s]=i;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&sp.has(t.tagName)?r=s:n[o]=s}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Ep(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else kt(e,t.position);else{const a=r.name;let i;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,i=e.evaluater.evaluateExpression(s.expression)}else kt(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function nr(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:ap;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=a.get(l)||0;o=l+"-"+u,a.set(l,u+1)}}const s=Fu(e,i,o);s!==void 0&&n.push(s)}return n}function yp(e,t,n){const r=Cu(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Fd(n):Xd(n)),r.property==="style"){let a=typeof n=="object"?n:Sp(e,String(n));return e.stylePropertyNameCase==="css"&&(a=wp(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?Vd[r.property]||r.property:r.attribute,n]}}function Sp(e,t){try{return np(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Ee("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Mu+"#cannot-parse-style-attribute",a}}function Bu(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const s=wl(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(i&&s.type==="Literal"),optional:!1}:s}r=o}else r=wl(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return er.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);kt(e)}function kt(e,t){const n=new Ee("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Mu+"#cannot-handle-mdx-estrees-without-createevaluater",n}function wp(e){const t={};let n;for(n in e)er.call(e,n)&&(t[kp(n)]=e[n]);return t}function kp(e){let t=e.replace(ip,Tp);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Tp(e){return"-"+e.toLowerCase()}const fn={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"]},Ap={};function rr(e,t){const n=Ap,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Pu(e,r,a)}function Pu(e,t,n){if(_p(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Ol(e.children,t,n)}return Array.isArray(e)?Ol(e,t,n):""}function Ol(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Pu(e[a],t,n);return r.join("")}function _p(e){return!!(e&&typeof e=="object")}const Ll=document.createElement("i");function Tt(e){const t="&"+e+";";Ll.innerHTML=t;const n=Ll.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ne(e,t,n,r){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function xe(e,t){return e.length>0?(Ne(e,e.length,0,t),e):t}const Dl={}.hasOwnProperty;function $u(e){const t={};let n=-1;for(;++n<e.length;)Ip(t,e[n]);return t}function Ip(e,t){let n;for(n in t){const a=(Dl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Dl.call(a,o)||(a[o]=[]);const s=i[o];Np(a[o],Array.isArray(s)?s:s?[s]:[])}}}function Np(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ne(e,0,0,r)}function zu(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ce(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ke=je(/[A-Za-z]/),he=je(/[\dA-Za-z]/),Rp=je(/[#-'*+\--9=?A-Z^-~]/);function Vt(e){return e!==null&&(e<32||e===127)}const Un=je(/\d/),xp=je(/[\dA-Fa-f]/),vp=je(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function se(e){return e!==null&&(e<0||e===32)}function X(e){return e===-2||e===-1||e===32}const Xt=je(new RegExp("\\p{P}|\\p{S}","u")),We=je(/\s/);function je(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function at(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&he(e.charCodeAt(n+1))&&he(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const s=e.charCodeAt(n+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function ee(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return X(l)?(e.enter(n),s(l)):t(l)}function s(l){return X(l)&&i++<a?(e.consume(l),s):(e.exit(n),t(l))}}const Cp={tokenize:Op};function Op(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ee(e,t,"linePrefix")}function a(s){return e.enter("paragraph"),i(s)}function i(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return H(s)?(e.consume(s),e.exit("chunkText"),i):(e.consume(s),o)}}const Lp={tokenize:Dp},Ml={tokenize:Mp};function Dp(e){const t=this,n=[];let r=0,a,i,o;return s;function s(_){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,l,u)(_)}return u(_)}function l(_){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&T();const N=t.events.length;let C=N,A;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){A=t.events[C][1].end;break}b(r);let U=N;for(;U<t.events.length;)t.events[U][1].end={...A},U++;return Ne(t.events,C+1,0,t.events.slice(N)),t.events.length=U,u(_)}return s(_)}function u(_){if(r===n.length){if(!a)return p(_);if(a.currentConstruct&&a.currentConstruct.concrete)return m(_);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ml,d,c)(_)}function d(_){return a&&T(),b(r),p(_)}function c(_){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(_)}function p(_){return t.containerState={},e.attempt(Ml,g,m)(_)}function g(_){return r++,n.push([t.currentConstruct,t.containerState]),p(_)}function m(_){if(_===null){a&&T(),b(0),e.consume(_);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),k(_)}function k(_){if(_===null){w(e.exit("chunkFlow"),!0),b(0),e.consume(_);return}return H(_)?(e.consume(_),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(_),k)}function w(_,N){const C=t.sliceStream(_);if(N&&C.push(null),_.previous=i,i&&(i.next=_),i=_,a.defineSkip(_.start),a.write(C),t.parser.lazy[_.start.line]){let A=a.events.length;for(;A--;)if(a.events[A][1].start.offset<o&&(!a.events[A][1].end||a.events[A][1].end.offset>o))return;const U=t.events.length;let P=U,O,E;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(O){E=t.events[P][1].end;break}O=!0}for(b(r),A=U;A<t.events.length;)t.events[A][1].end={...E},A++;Ne(t.events,P+1,0,t.events.slice(U)),t.events.length=A}}function b(_){let N=n.length;for(;N-- >_;){const C=n[N];t.containerState=C[1],C[0].exit.call(t,e)}n.length=_}function T(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Mp(e,t,n){return ee(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nt(e){if(e===null||se(e)||We(e))return 1;if(Xt(e))return 2}function Zt(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Bn={name:"attention",resolveAll:Fp,tokenize:Up};function Fp(e,t){let n=-1,r,a,i,o,s,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};Fl(c,-l),Fl(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=xe(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xe(u,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=xe(u,Zt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xe(u,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=xe(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ne(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Up(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=nt(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===i)return e.consume(l),s;const u=e.exit("attentionSequence"),d=nt(l),c=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?c:c&&(a||!p)),u._close=!!(i===42?p:p&&(d||!c)),t(l)}}function Fl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Bp={name:"autolink",tokenize:Pp};function Pp(e,t,n){let r=0;return a;function a(g){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(g){return ke(g)?(e.consume(g),o):g===64?n(g):u(g)}function o(g){return g===43||g===45||g===46||he(g)?(r=1,s(g)):u(g)}function s(g){return g===58?(e.consume(g),r=0,l):(g===43||g===45||g===46||he(g))&&r++<32?(e.consume(g),s):(r=0,u(g))}function l(g){return g===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):g===null||g===32||g===60||Vt(g)?n(g):(e.consume(g),l)}function u(g){return g===64?(e.consume(g),d):Rp(g)?(e.consume(g),u):n(g)}function d(g){return he(g)?c(g):n(g)}function c(g){return g===46?(e.consume(g),r=0,d):g===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):p(g)}function p(g){if((g===45||he(g))&&r++<63){const m=g===45?p:c;return e.consume(g),m}return n(g)}}const Nt={partial:!0,tokenize:$p};function $p(e,t,n){return r;function r(i){return X(i)?ee(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||H(i)?t(i):n(i)}}const Gu={continuation:{tokenize:Gp},exit:jp,name:"blockQuote",tokenize:zp};function zp(e,t,n){const r=this;return a;function a(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return X(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Gp(e,t,n){const r=this;return a;function a(o){return X(o)?ee(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Gu,t,n)(o)}}function jp(e){e.exit("blockQuote")}const ju={name:"characterEscape",tokenize:Hp};function Hp(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return vp(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Hu={name:"characterReference",tokenize:Vp};function Vp(e,t,n){const r=this;let a=0,i,o;return s;function s(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=he,d(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=xp,d):(e.enter("characterReferenceValue"),i=7,o=Un,d(c))}function d(c){if(c===59&&a){const p=e.exit("characterReferenceValue");return o===he&&!Tt(r.sliceSerialize(p))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&a++<i?(e.consume(c),d):n(c)}}const Ul={partial:!0,tokenize:qp},Bl={concrete:!0,name:"codeFenced",tokenize:Wp};function Wp(e,t,n){const r=this,a={partial:!0,tokenize:C};let i=0,o=0,s;return l;function l(A){return u(A)}function u(A){const U=r.events[r.events.length-1];return i=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,s=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(A)}function d(A){return A===s?(o++,e.consume(A),d):o<3?n(A):(e.exit("codeFencedFenceSequence"),X(A)?ee(e,c,"whitespace")(A):c(A))}function c(A){return A===null||H(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(Ul,k,N)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(A))}function p(A){return A===null||H(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(A)):X(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ee(e,g,"whitespace")(A)):A===96&&A===s?n(A):(e.consume(A),p)}function g(A){return A===null||H(A)?c(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===null||H(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(A)):A===96&&A===s?n(A):(e.consume(A),m)}function k(A){return e.attempt(a,N,w)(A)}function w(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),b}function b(A){return i>0&&X(A)?ee(e,T,"linePrefix",i+1)(A):T(A)}function T(A){return A===null||H(A)?e.check(Ul,k,N)(A):(e.enter("codeFlowValue"),_(A))}function _(A){return A===null||H(A)?(e.exit("codeFlowValue"),T(A)):(e.consume(A),_)}function N(A){return e.exit("codeFenced"),t(A)}function C(A,U,P){let O=0;return E;function E(L){return A.enter("lineEnding"),A.consume(L),A.exit("lineEnding"),I}function I(L){return A.enter("codeFencedFence"),X(L)?ee(A,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):x(L)}function x(L){return L===s?(A.enter("codeFencedFenceSequence"),D(L)):P(L)}function D(L){return L===s?(O++,A.consume(L),D):O>=o?(A.exit("codeFencedFenceSequence"),X(L)?ee(A,M,"whitespace")(L):M(L)):P(L)}function M(L){return L===null||H(L)?(A.exit("codeFencedFence"),U(L)):P(L)}}}function qp(e,t,n){const r=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const mn={name:"codeIndented",tokenize:Kp},Yp={partial:!0,tokenize:Xp};function Kp(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ee(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):H(u)?e.attempt(Yp,o,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||H(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function Xp(e,t,n){const r=this;return a;function a(o){return r.parser.lazy[r.now().line]?n(o):H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):ee(e,i,"linePrefix",5)(o)}function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):H(o)?a(o):n(o)}}const Zp={name:"codeText",previous:Jp,resolve:Qp,tokenize:eg};function Qp(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function Jp(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function eg(e,t,n){let r=0,a,i;return o;function o(c){return e.enter("codeText"),e.enter("codeTextSequence"),s(c)}function s(c){return c===96?(e.consume(c),r++,s):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(i=e.enter("codeTextSequence"),a=0,d(c)):H(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||H(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function d(c){return c===96?(e.consume(c),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(i.type="codeTextData",u(c))}}class tg{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&mt(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),mt(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),mt(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);mt(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);mt(this.left,n.reverse())}}}function mt(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Vu(e){const t={};let n=-1,r,a,i,o,s,l,u;const d=new tg(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,ng(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},s=d.slice(a,n),s.unshift(r),d.splice(a,n-a+1,s))}}return Ne(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function ng(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],u={};let d,c,p=-1,g=n,m=0,k=0;const w=[k];for(;g;){for(;e.get(++a)[1]!==g;);i.push(a),g._tokenizer||(d=r.sliceStream(g),g.next||d.push(null),c&&o.defineSkip(g.start),g._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),g._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=g,g=g.next}for(g=n;++p<s.length;)s[p][0]==="exit"&&s[p-1][0]==="enter"&&s[p][1].type===s[p-1][1].type&&s[p][1].start.line!==s[p][1].end.line&&(k=p+1,w.push(k),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(o.events=[],g?(g._tokenizer=void 0,g.previous=void 0):w.pop(),p=w.length;p--;){const b=s.slice(w[p],w[p+1]),T=i.pop();l.push([T,T+b.length-1]),e.splice(T,2,b)}for(l.reverse(),p=-1;++p<l.length;)u[m+l[p][0]]=m+l[p][1],m+=l[p][1]-l[p][0]-1;return u}const rg={resolve:ig,tokenize:og},ag={partial:!0,tokenize:sg};function ig(e){return Vu(e),e}function og(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(s)}function a(s){return s===null?i(s):H(s)?e.check(ag,o,i)(s):(e.consume(s),a)}function i(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function sg(e,t,n){const r=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ee(e,i,"linePrefix")}function i(o){if(o===null||H(o))return n(o);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?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Wu(e,t,n,r,a,i,o,s,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return c;function c(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),p):b===null||b===32||b===41||Vt(b)?n(b):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),k(b))}function p(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===62?(e.exit("chunkString"),e.exit(s),p(b)):b===null||b===60||H(b)?n(b):(e.consume(b),b===92?m:g)}function m(b){return b===60||b===62||b===92?(e.consume(b),g):g(b)}function k(b){return!d&&(b===null||b===41||se(b))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,k):b===41?(e.consume(b),d--,k):b===null||b===32||b===40||Vt(b)?n(b):(e.consume(b),b===92?w:k)}function w(b){return b===40||b===41||b===92?(e.consume(b),k):k(b)}}function qu(e,t,n,r,a,i){const o=this;let s=0,l;return u;function u(g){return e.enter(r),e.enter(a),e.consume(g),e.exit(a),e.enter(i),d}function d(g){return s>999||g===null||g===91||g===93&&!l||g===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(g):g===93?(e.exit(i),e.enter(a),e.consume(g),e.exit(a),e.exit(r),t):H(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),c(g))}function c(g){return g===null||g===91||g===93||H(g)||s++>999?(e.exit("chunkString"),d(g)):(e.consume(g),l||(l=!X(g)),g===92?p:c)}function p(g){return g===91||g===92||g===93?(e.consume(g),s++,c):c(g)}}function Yu(e,t,n,r,a,i){let o;return s;function s(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),o=p===40?41:p,l):n(p)}function l(p){return p===o?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),l(o)):p===null?n(p):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ee(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===o||p===null||H(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?c:d)}function c(p){return p===o||p===92?(e.consume(p),d):d(p)}}function Et(e,t){let n;return r;function r(a){return H(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):X(a)?ee(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const lg={name:"definition",tokenize:cg},ug={partial:!0,tokenize:dg};function cg(e,t,n){const r=this;let a;return i;function i(g){return e.enter("definition"),o(g)}function o(g){return qu.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function s(g){return a=Ce(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),l):n(g)}function l(g){return se(g)?Et(e,u)(g):u(g)}function u(g){return Wu(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function d(g){return e.attempt(ug,c,c)(g)}function c(g){return X(g)?ee(e,p,"whitespace")(g):p(g)}function p(g){return g===null||H(g)?(e.exit("definition"),r.parser.defined.push(a),t(g)):n(g)}}function dg(e,t,n){return r;function r(s){return se(s)?Et(e,a)(s):n(s)}function a(s){return Yu(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return X(s)?ee(e,o,"whitespace")(s):o(s)}function o(s){return s===null||H(s)?t(s):n(s)}}const pg={name:"hardBreakEscape",tokenize:gg};function gg(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return H(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const fg={name:"headingAtx",resolve:mg,tokenize:bg};function mg(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ne(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function bg(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||se(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||H(d)?(e.exit("atxHeading"),t(d)):X(d)?ee(e,s,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),s(d))}function u(d){return d===null||d===35||se(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),u)}}const hg=["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"],Pl=["pre","script","style","textarea"],Eg={concrete:!0,name:"htmlFlow",resolveTo:wg,tokenize:kg},yg={partial:!0,tokenize:Ag},Sg={partial:!0,tokenize:Tg};function wg(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function kg(e,t,n){const r=this;let a,i,o,s,l;return u;function u(S){return d(S)}function d(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),c}function c(S){return S===33?(e.consume(S),p):S===47?(e.consume(S),i=!0,k):S===63?(e.consume(S),a=3,r.interrupt?t:y):ke(S)?(e.consume(S),o=String.fromCharCode(S),w):n(S)}function p(S){return S===45?(e.consume(S),a=2,g):S===91?(e.consume(S),a=5,s=0,m):ke(S)?(e.consume(S),a=4,r.interrupt?t:y):n(S)}function g(S){return S===45?(e.consume(S),r.interrupt?t:y):n(S)}function m(S){const pe="CDATA[";return S===pe.charCodeAt(s++)?(e.consume(S),s===pe.length?r.interrupt?t:x:m):n(S)}function k(S){return ke(S)?(e.consume(S),o=String.fromCharCode(S),w):n(S)}function w(S){if(S===null||S===47||S===62||se(S)){const pe=S===47,we=o.toLowerCase();return!pe&&!i&&Pl.includes(we)?(a=1,r.interrupt?t(S):x(S)):hg.includes(o.toLowerCase())?(a=6,pe?(e.consume(S),b):r.interrupt?t(S):x(S)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):i?T(S):_(S))}return S===45||he(S)?(e.consume(S),o+=String.fromCharCode(S),w):n(S)}function b(S){return S===62?(e.consume(S),r.interrupt?t:x):n(S)}function T(S){return X(S)?(e.consume(S),T):E(S)}function _(S){return S===47?(e.consume(S),E):S===58||S===95||ke(S)?(e.consume(S),N):X(S)?(e.consume(S),_):E(S)}function N(S){return S===45||S===46||S===58||S===95||he(S)?(e.consume(S),N):C(S)}function C(S){return S===61?(e.consume(S),A):X(S)?(e.consume(S),C):_(S)}function A(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,U):X(S)?(e.consume(S),A):P(S)}function U(S){return S===l?(e.consume(S),l=null,O):S===null||H(S)?n(S):(e.consume(S),U)}function P(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||se(S)?C(S):(e.consume(S),P)}function O(S){return S===47||S===62||X(S)?_(S):n(S)}function E(S){return S===62?(e.consume(S),I):n(S)}function I(S){return S===null||H(S)?x(S):X(S)?(e.consume(S),I):n(S)}function x(S){return S===45&&a===2?(e.consume(S),G):S===60&&a===1?(e.consume(S),V):S===62&&a===4?(e.consume(S),ne):S===63&&a===3?(e.consume(S),y):S===93&&a===5?(e.consume(S),re):H(S)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(yg,ae,D)(S)):S===null||H(S)?(e.exit("htmlFlowData"),D(S)):(e.consume(S),x)}function D(S){return e.check(Sg,M,ae)(S)}function M(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),L}function L(S){return S===null||H(S)?D(S):(e.enter("htmlFlowData"),x(S))}function G(S){return S===45?(e.consume(S),y):x(S)}function V(S){return S===47?(e.consume(S),o="",te):x(S)}function te(S){if(S===62){const pe=o.toLowerCase();return Pl.includes(pe)?(e.consume(S),ne):x(S)}return ke(S)&&o.length<8?(e.consume(S),o+=String.fromCharCode(S),te):x(S)}function re(S){return S===93?(e.consume(S),y):x(S)}function y(S){return S===62?(e.consume(S),ne):S===45&&a===2?(e.consume(S),y):x(S)}function ne(S){return S===null||H(S)?(e.exit("htmlFlowData"),ae(S)):(e.consume(S),ne)}function ae(S){return e.exit("htmlFlow"),t(S)}}function Tg(e,t,n){const r=this;return a;function a(o){return H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Ag(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Nt,t,n)}}const _g={name:"htmlText",tokenize:Ig};function Ig(e,t,n){const r=this;let a,i,o;return s;function s(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),l}function l(y){return y===33?(e.consume(y),u):y===47?(e.consume(y),C):y===63?(e.consume(y),_):ke(y)?(e.consume(y),P):n(y)}function u(y){return y===45?(e.consume(y),d):y===91?(e.consume(y),i=0,m):ke(y)?(e.consume(y),T):n(y)}function d(y){return y===45?(e.consume(y),g):n(y)}function c(y){return y===null?n(y):y===45?(e.consume(y),p):H(y)?(o=c,V(y)):(e.consume(y),c)}function p(y){return y===45?(e.consume(y),g):c(y)}function g(y){return y===62?G(y):y===45?p(y):c(y)}function m(y){const ne="CDATA[";return y===ne.charCodeAt(i++)?(e.consume(y),i===ne.length?k:m):n(y)}function k(y){return y===null?n(y):y===93?(e.consume(y),w):H(y)?(o=k,V(y)):(e.consume(y),k)}function w(y){return y===93?(e.consume(y),b):k(y)}function b(y){return y===62?G(y):y===93?(e.consume(y),b):k(y)}function T(y){return y===null||y===62?G(y):H(y)?(o=T,V(y)):(e.consume(y),T)}function _(y){return y===null?n(y):y===63?(e.consume(y),N):H(y)?(o=_,V(y)):(e.consume(y),_)}function N(y){return y===62?G(y):_(y)}function C(y){return ke(y)?(e.consume(y),A):n(y)}function A(y){return y===45||he(y)?(e.consume(y),A):U(y)}function U(y){return H(y)?(o=U,V(y)):X(y)?(e.consume(y),U):G(y)}function P(y){return y===45||he(y)?(e.consume(y),P):y===47||y===62||se(y)?O(y):n(y)}function O(y){return y===47?(e.consume(y),G):y===58||y===95||ke(y)?(e.consume(y),E):H(y)?(o=O,V(y)):X(y)?(e.consume(y),O):G(y)}function E(y){return y===45||y===46||y===58||y===95||he(y)?(e.consume(y),E):I(y)}function I(y){return y===61?(e.consume(y),x):H(y)?(o=I,V(y)):X(y)?(e.consume(y),I):O(y)}function x(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),a=y,D):H(y)?(o=x,V(y)):X(y)?(e.consume(y),x):(e.consume(y),M)}function D(y){return y===a?(e.consume(y),a=void 0,L):y===null?n(y):H(y)?(o=D,V(y)):(e.consume(y),D)}function M(y){return y===null||y===34||y===39||y===60||y===61||y===96?n(y):y===47||y===62||se(y)?O(y):(e.consume(y),M)}function L(y){return y===47||y===62||se(y)?O(y):n(y)}function G(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):n(y)}function V(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),te}function te(y){return X(y)?ee(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):re(y)}function re(y){return e.enter("htmlTextData"),o(y)}}const ar={name:"labelEnd",resolveAll:vg,resolveTo:Cg,tokenize:Og},Ng={tokenize:Lg},Rg={tokenize:Dg},xg={tokenize:Mg};function vg(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Ne(e,0,e.length,n),e}function Cg(e,t){let n=e.length,r=0,a,i,o,s;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",l,t],["enter",u,t]],s=xe(s,e.slice(i+1,i+r+3)),s=xe(s,[["enter",d,t]]),s=xe(s,Zt(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),s=xe(s,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),s=xe(s,e.slice(o+1)),s=xe(s,[["exit",l,t]]),Ne(e,i,e.length,s),e}function Og(e,t,n){const r=this;let a=r.events.length,i,o;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return s;function s(p){return i?i._inactive?c(p):(o=r.parser.defined.includes(Ce(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(Ng,d,o?d:c)(p):p===91?e.attempt(Rg,d,o?u:c)(p):o?d(p):c(p)}function u(p){return e.attempt(xg,d,c)(p)}function d(p){return t(p)}function c(p){return i._balanced=!0,n(p)}}function Lg(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),a}function a(c){return se(c)?Et(e,i)(c):i(c)}function i(c){return c===41?d(c):Wu(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return se(c)?Et(e,l)(c):d(c)}function s(c){return n(c)}function l(c){return c===34||c===39||c===40?Yu(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):d(c)}function u(c){return se(c)?Et(e,d)(c):d(c)}function d(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Dg(e,t,n){const r=this;return a;function a(s){return qu.call(r,e,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return r.parser.defined.includes(Ce(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function Mg(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Fg={name:"labelStartImage",resolveAll:ar.resolveAll,tokenize:Ug};function Ug(e,t,n){const r=this;return a;function a(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),i}function i(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Bg={name:"labelStartLink",resolveAll:ar.resolveAll,tokenize:Pg};function Pg(e,t,n){const r=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const bn={name:"lineEnding",tokenize:$g};function $g(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ee(e,t,"linePrefix")}}const zt={name:"thematicBreak",tokenize:zg};function zg(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return a=u,s(u)}function s(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||H(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),X(u)?ee(e,s,"whitespace")(u):s(u))}}const Te={continuation:{tokenize:Vg},exit:qg,name:"list",tokenize:Hg},Gg={partial:!0,tokenize:Yg},jg={partial:!0,tokenize:Wg};function Hg(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return s;function s(g){const m=r.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||g===r.containerState.marker:Un(g)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),g===42||g===45?e.check(zt,n,u)(g):u(g);if(!r.interrupt||g===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(g)}return n(g)}function l(g){return Un(g)&&++o<10?(e.consume(g),l):(!r.interrupt||o<2)&&(r.containerState.marker?g===r.containerState.marker:g===41||g===46)?(e.exit("listItemValue"),u(g)):n(g)}function u(g){return e.enter("listItemMarker"),e.consume(g),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||g,e.check(Nt,r.interrupt?n:d,e.attempt(Gg,p,c))}function d(g){return r.containerState.initialBlankLine=!0,i++,p(g)}function c(g){return X(g)?(e.enter("listItemPrefixWhitespace"),e.consume(g),e.exit("listItemPrefixWhitespace"),p):n(g)}function p(g){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(g)}}function Vg(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Nt,a,i);function a(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ee(e,t,"listItemIndent",r.containerState.size+1)(s)}function i(s){return r.containerState.furtherBlankLines||!X(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(jg,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,ee(e,e.attempt(Te,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Wg(e,t,n){const r=this;return ee(e,a,"listItemIndent",r.containerState.size+1);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function qg(e){e.exit(this.containerState.type)}function Yg(e,t,n){const r=this;return ee(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=r.events[r.events.length-1];return!X(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const $l={name:"setextUnderline",resolveTo:Kg,tokenize:Xg};function Kg(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Xg(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,c;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){c=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),a=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===a?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),X(u)?ee(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||H(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Zg={tokenize:Qg};function Qg(e){const t=this,n=e.attempt(Nt,r,e.attempt(this.parser.constructs.flowInitial,a,ee(e,e.attempt(this.parser.constructs.flow,a,e.attempt(rg,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Jg={resolveAll:Xu()},ef=Ku("string"),tf=Ku("text");function Ku(e){return{resolveAll:Xu(e==="text"?nf:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,o,s);return o;function o(d){return u(d)?i(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const c=a[d];let p=-1;if(c)for(;++p<c.length;){const g=c[p];if(!g.previous||g.previous.call(r,r.previous))return!0}return!1}}}function Xu(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function nf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,o=-1,s=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)l=!0,s++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const rf={42:Te,43:Te,45:Te,48:Te,49:Te,50:Te,51:Te,52:Te,53:Te,54:Te,55:Te,56:Te,57:Te,62:Gu},af={91:lg},of={[-2]:mn,[-1]:mn,32:mn},sf={35:fg,42:zt,45:[$l,zt],60:Eg,61:$l,95:zt,96:Bl,126:Bl},lf={38:Hu,92:ju},uf={[-5]:bn,[-4]:bn,[-3]:bn,33:Fg,38:Hu,42:Bn,60:[Bp,_g],91:Bg,92:[pg,ju],93:ar,95:Bn,96:Zp},cf={null:[Bn,Jg]},df={null:[42,95]},pf={null:[]},gf=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:df,contentInitial:af,disable:pf,document:rf,flow:sf,flowInitial:of,insideSpan:cf,string:lf,text:uf},Symbol.toStringTag,{value:"Module"}));function ff(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],s=[];const l={attempt:U(C),check:U(A),consume:T,enter:_,exit:N,interrupt:U(A,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:g,write:c};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function c(I){return o=xe(o,I),w(),o[o.length-1]!==null?[]:(P(t,0),u.events=Zt(i,u.events,u),u.events)}function p(I,x){return bf(g(I),x)}function g(I){return mf(o,I)}function m(){const{_bufferIndex:I,_index:x,line:D,column:M,offset:L}=r;return{_bufferIndex:I,_index:x,line:D,column:M,offset:L}}function k(I){a[I.line]=I.column,E()}function w(){let I;for(;r._index<o.length;){const x=o[r._index];if(typeof x=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<x.length;)b(x.charCodeAt(r._bufferIndex));else b(x)}}function b(I){d=d(I)}function T(I){H(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,E()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=I}function _(I,x){const D=x||{};return D.type=I,D.start=m(),u.events.push(["enter",D,u]),s.push(D),D}function N(I){const x=s.pop();return x.end=m(),u.events.push(["exit",x,u]),x}function C(I,x){P(I,x.from)}function A(I,x){x.restore()}function U(I,x){return D;function D(M,L,G){let V,te,re,y;return Array.isArray(M)?ae(M):"tokenize"in M?ae([M]):ne(M);function ne(ue){return j;function j(q){const $=q!==null&&ue[q],z=q!==null&&ue.null,W=[...Array.isArray($)?$:$?[$]:[],...Array.isArray(z)?z:z?[z]:[]];return ae(W)(q)}}function ae(ue){return V=ue,te=0,ue.length===0?G:S(ue[te])}function S(ue){return j;function j(q){return y=O(),re=ue,ue.partial||(u.currentConstruct=ue),ue.name&&u.parser.constructs.disable.null.includes(ue.name)?we():ue.tokenize.call(x?Object.assign(Object.create(u),x):u,l,pe,we)(q)}}function pe(ue){return I(re,y),L}function we(ue){return y.restore(),++te<V.length?S(V[te]):G}}}function P(I,x){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&Ne(u.events,x,u.events.length-x,I.resolve(u.events.slice(x),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function O(){const I=m(),x=u.previous,D=u.currentConstruct,M=u.events.length,L=Array.from(s);return{from:M,restore:G};function G(){r=I,u.previous=x,u.currentConstruct=D,u.events.length=M,s=L,E()}}function E(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function mf(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,i)];else{if(o=e.slice(n,a),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function bf(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
3
3
|
`;break}case-3:{o=`\r
|
|
4
4
|
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,r.push(o)}return r.join("")}function hf(e){const r={constructs:$u([gf,...(e||{}).extensions||[]]),content:a(Cp),defined:[],document:a(Lp),flow:a(Zg),lazy:{},string:a(ef),text:a(tf)};return r;function a(i){return o;function o(s){return ff(r,i,s)}}}function Ef(e){for(;!Vu(e););return e}const zl=/[\0\t\n\r]/g;function yf(){let e=1,t="",n=!0,r;return a;function a(i,o,s){const l=[];let u,d,c,p,g;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),c=0,t="",n&&(i.charCodeAt(0)===65279&&c++,n=void 0);c<i.length;){if(zl.lastIndex=c,u=zl.exec(i),p=u&&u.index!==void 0?u.index:i.length,g=i.charCodeAt(p),!u){t=i.slice(c);break}if(g===10&&c===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<p&&(l.push(i.slice(c,p)),e+=p-c),g){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=p+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Sf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function wf(e){return e.replace(Sf,kf)}function kf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return zu(n.slice(i?2:1),i?16:10)}return Tt(n)||e}const Zu={}.hasOwnProperty;function Tf(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Af(n)(Ef(hf(n).document().write(yf()(e,t,!0))))}function Af(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ml),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(be),blockQuote:i(z),characterEscape:O,characterReference:O,codeFenced:i(W),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(W,o),codeText:i(Q,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(ie),hardBreakEscape:i(Re),hardBreakTrailing:i(Re),htmlFlow:i(Me,o),htmlFlowData:O,htmlText:i(Me,o),htmlTextData:O,image:i(dn),label:o,link:i(ml),listItem:i(jc),listItemValue:p,listOrdered:i(bl,c),listUnordered:i(bl),paragraph:i(Hc),reference:S,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(be),strong:i(Vc),thematicBreak:i(qc)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:$,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:we,characterReferenceMarkerNumeric:we,characterReferenceValue:ue,characterReference:j,codeFenced:l(w),codeFencedFence:k,codeFencedFenceInfo:g,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:l(b),codeText:l(L),codeTextData:E,data:E,definition:l(),definitionDestinationString:N,definitionLabelString:T,definitionTitleString:_,emphasis:l(),hardBreakEscape:l(x),hardBreakTrailing:l(x),htmlFlow:l(D),htmlFlowData:E,htmlText:l(M),htmlTextData:E,image:l(V),label:re,labelText:te,lineEnding:I,link:l(G),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:pe,resourceDestinationString:y,resourceTitleString:ne,resource:ae,setextHeading:l(P),setextHeadingLineSequence:U,setextHeadingText:A,strong:l(),thematicBreak:l()}};Qu(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(R){let B={type:"root",children:[]};const Y={stack:[B],tokenStack:[],config:t,enter:s,exit:u,buffer:o,resume:d,data:n},J=[];let oe=-1;for(;++oe<R.length;)if(R[oe][1].type==="listOrdered"||R[oe][1].type==="listUnordered")if(R[oe][0]==="enter")J.push(oe);else{const ve=J.pop();oe=a(R,ve,oe)}for(oe=-1;++oe<R.length;){const ve=t[R[oe][0]];Zu.call(ve,R[oe][1].type)&&ve[R[oe][1].type].call(Object.assign({sliceSerialize:R[oe][2].sliceSerialize},Y),R[oe][1])}if(Y.tokenStack.length>0){const ve=Y.tokenStack[Y.tokenStack.length-1];(ve[1]||Gl).call(Y,void 0,ve[0])}for(B.position={start:$e(R.length>0?R[0][1].start:{line:1,column:1,offset:0}),end:$e(R.length>0?R[R.length-2][1].end:{line:1,column:1,offset:0})},oe=-1;++oe<t.transforms.length;)B=t.transforms[oe](B)||B;return B}function a(R,B,Y){let J=B-1,oe=-1,ve=!1,He,Fe,dt,pt;for(;++J<=Y;){const _e=R[J];switch(_e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{_e[0]==="enter"?oe++:oe--,pt=void 0;break}case"lineEndingBlank":{_e[0]==="enter"&&(He&&!pt&&!oe&&!dt&&(dt=J),pt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pt=void 0}if(!oe&&_e[0]==="enter"&&_e[1].type==="listItemPrefix"||oe===-1&&_e[0]==="exit"&&(_e[1].type==="listUnordered"||_e[1].type==="listOrdered")){if(He){let Ke=J;for(Fe=void 0;Ke--;){const Ue=R[Ke];if(Ue[1].type==="lineEnding"||Ue[1].type==="lineEndingBlank"){if(Ue[0]==="exit")continue;Fe&&(R[Fe][1].type="lineEndingBlank",ve=!0),Ue[1].type="lineEnding",Fe=Ke}else if(!(Ue[1].type==="linePrefix"||Ue[1].type==="blockQuotePrefix"||Ue[1].type==="blockQuotePrefixWhitespace"||Ue[1].type==="blockQuoteMarker"||Ue[1].type==="listItemIndent"))break}dt&&(!Fe||dt<Fe)&&(He._spread=!0),He.end=Object.assign({},Fe?R[Fe][1].start:_e[1].end),R.splice(Fe||J,0,["exit",He,_e[2]]),J++,Y++}if(_e[1].type==="listItemPrefix"){const Ke={type:"listItem",_spread:!1,start:Object.assign({},_e[1].start),end:void 0};He=Ke,R.splice(J,0,["enter",Ke,_e[2]]),J++,Y++,dt=void 0,pt=!0}}}return R[B][1]._spread=ve,Y}function i(R,B){return Y;function Y(J){s.call(this,R(J),J),B&&B.call(this,J)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(R,B,Y){this.stack[this.stack.length-1].children.push(R),this.stack.push(R),this.tokenStack.push([B,Y||void 0]),R.position={start:$e(B.start),end:void 0}}function l(R){return B;function B(Y){R&&R.call(this,Y),u.call(this,Y)}}function u(R,B){const Y=this.stack.pop(),J=this.tokenStack.pop();if(J)J[0].type!==R.type&&(B?B.call(this,R,J[0]):(J[1]||Gl).call(this,R,J[0]));else throw new Error("Cannot close `"+R.type+"` ("+ht({start:R.start,end:R.end})+"): it’s not open");Y.position.end=$e(R.end)}function d(){return rr(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function p(R){if(this.data.expectingFirstListItemValue){const B=this.stack[this.stack.length-2];B.start=Number.parseInt(this.sliceSerialize(R),10),this.data.expectingFirstListItemValue=void 0}}function g(){const R=this.resume(),B=this.stack[this.stack.length-1];B.lang=R}function m(){const R=this.resume(),B=this.stack[this.stack.length-1];B.meta=R}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R.replace(/(\r?\n|\r)$/g,"")}function T(R){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.label=B,Y.identifier=Ce(this.sliceSerialize(R)).toLowerCase()}function _(){const R=this.resume(),B=this.stack[this.stack.length-1];B.title=R}function N(){const R=this.resume(),B=this.stack[this.stack.length-1];B.url=R}function C(R){const B=this.stack[this.stack.length-1];if(!B.depth){const Y=this.sliceSerialize(R).length;B.depth=Y}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function U(R){const B=this.stack[this.stack.length-1];B.depth=this.sliceSerialize(R).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function O(R){const Y=this.stack[this.stack.length-1].children;let J=Y[Y.length-1];(!J||J.type!=="text")&&(J=Wc(),J.position={start:$e(R.start),end:void 0},Y.push(J)),this.stack.push(J)}function E(R){const B=this.stack.pop();B.value+=this.sliceSerialize(R),B.position.end=$e(R.end)}function I(R){const B=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Y=B.children[B.children.length-1];Y.position.end=$e(R.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(B.type)&&(O.call(this,R),E.call(this,R))}function x(){this.data.atHardBreak=!0}function D(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R}function M(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R}function L(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R}function G(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const B=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=B,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function V(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const B=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=B,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function te(R){const B=this.sliceSerialize(R),Y=this.stack[this.stack.length-2];Y.label=wf(B),Y.identifier=Ce(B).toLowerCase()}function re(){const R=this.stack[this.stack.length-1],B=this.resume(),Y=this.stack[this.stack.length-1];if(this.data.inReference=!0,Y.type==="link"){const J=R.children;Y.children=J}else Y.alt=B}function y(){const R=this.resume(),B=this.stack[this.stack.length-1];B.url=R}function ne(){const R=this.resume(),B=this.stack[this.stack.length-1];B.title=R}function ae(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function pe(R){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.label=B,Y.identifier=Ce(this.sliceSerialize(R)).toLowerCase(),this.data.referenceType="full"}function we(R){this.data.characterReferenceType=R.type}function ue(R){const B=this.sliceSerialize(R),Y=this.data.characterReferenceType;let J;Y?(J=zu(B,Y==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):J=Tt(B);const oe=this.stack[this.stack.length-1];oe.value+=J}function j(R){const B=this.stack.pop();B.position.end=$e(R.end)}function q(R){E.call(this,R);const B=this.stack[this.stack.length-1];B.url=this.sliceSerialize(R)}function $(R){E.call(this,R);const B=this.stack[this.stack.length-1];B.url="mailto:"+this.sliceSerialize(R)}function z(){return{type:"blockquote",children:[]}}function W(){return{type:"code",lang:null,meta:null,value:""}}function Q(){return{type:"inlineCode",value:""}}function ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ie(){return{type:"emphasis",children:[]}}function be(){return{type:"heading",depth:0,children:[]}}function Re(){return{type:"break"}}function Me(){return{type:"html",value:""}}function dn(){return{type:"image",title:null,url:"",alt:null}}function ml(){return{type:"link",title:null,url:"",children:[]}}function bl(R){return{type:"list",ordered:R.type==="listOrdered",start:null,spread:R._spread,children:[]}}function jc(R){return{type:"listItem",spread:R._spread,checked:null,children:[]}}function Hc(){return{type:"paragraph",children:[]}}function Vc(){return{type:"strong",children:[]}}function Wc(){return{type:"text",value:""}}function qc(){return{type:"thematicBreak"}}}function $e(e){return{line:e.line,column:e.column,offset:e.offset}}function Qu(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Qu(e,r):_f(e,r)}}function _f(e,t){let n;for(n in t)if(Zu.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Gl(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ht({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ht({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ht({start:t.start,end:t.end})+") is still open")}function If(e){const t=this;t.parser=n;function n(r){return Tf(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Nf(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Rf(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -14,5 +14,5 @@ Error generating stack: `+i.message+`
|
|
|
14
14
|
${Z}px !important;
|
|
15
15
|
${Y}px !important;
|
|
16
16
|
}
|
|
17
|
-
`),()=>{P.contains(Q)&&P.removeChild(Q)}},[l]),m.jsx(CT,{isPresent:l,childRef:y,sizeRef:v,pop:h,children:h===!1?a:M.cloneElement(a,{ref:b})})}const NT=({children:a,initial:l,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:h,mode:d,anchorX:y,anchorY:v,root:p})=>{const x=Uf(MT),b=M.useId();let T=!0,z=M.useMemo(()=>(T=!1,{id:b,initial:l,isPresent:o,custom:c,onExitComplete:R=>{x.set(R,!0);for(const H of x.values())if(!H)return;r&&r()},register:R=>(x.set(R,!1),()=>x.delete(R))}),[o,x,r]);return h&&T&&(z={...z}),M.useMemo(()=>{x.forEach((R,H)=>x.set(H,!1))},[o]),M.useEffect(()=>{!o&&!x.size&&r&&r()},[o]),a=m.jsx(jT,{pop:d==="popLayout",isPresent:o,anchorX:y,anchorY:v,root:p,children:a}),m.jsx(Vr.Provider,{value:z,children:a})};function MT(){return new Map}function Jg(a=!0){const l=M.useContext(Vr);if(l===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=l,h=M.useId();M.useEffect(()=>{if(a)return c(h)},[a]);const d=M.useCallback(()=>a&&r&&r(h),[h,r,a]);return!o&&r?[!1,d]:[!0]}const gr=a=>a.key||"";function iy(a){const l=[];return M.Children.forEach(a,o=>{M.isValidElement(o)&&l.push(o)}),l}const ly=({children:a,custom:l,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:h="sync",propagate:d=!1,anchorX:y="left",anchorY:v="top",root:p})=>{const[x,b]=Jg(d),T=M.useMemo(()=>iy(a),[a]),z=d&&!x?[]:T.map(gr),R=M.useRef(!0),H=M.useRef(T),q=Uf(()=>new Map),K=M.useRef(new Set),[Z,Y]=M.useState(T),[Q,P]=M.useState(T);Ty(()=>{R.current=!1,H.current=T;for(let F=0;F<Q.length;F++){const lt=gr(Q[F]);z.includes(lt)?(q.delete(lt),K.current.delete(lt)):q.get(lt)!==!0&&q.set(lt,!1)}},[Q,z.length,z.join("-")]);const it=[];if(T!==Z){let F=[...T];for(let lt=0;lt<Q.length;lt++){const Et=Q[lt],Ut=gr(Et);z.includes(Ut)||(F.splice(lt,0,Et),it.push(Et))}return h==="wait"&&it.length&&(F=it),P(iy(F)),Y(T),null}const{forceRender:tt}=M.useContext(_f);return m.jsx(m.Fragment,{children:Q.map(F=>{const lt=gr(F),Et=d&&!x?!1:T===Q||z.includes(lt),Ut=()=>{if(K.current.has(lt))return;if(K.current.add(lt),q.has(lt))q.set(lt,!0);else return;let wt=!0;q.forEach(xe=>{xe||(wt=!1)}),wt&&(tt?.(),P(H.current),d&&b?.(),r&&r())};return m.jsx(NT,{isPresent:Et,initial:!R.current||o?void 0:!1,custom:l,presenceAffectsLayout:c,mode:h,root:p,onExitComplete:Et?void 0:Ut,anchorX:y,anchorY:v,children:F},lt)})})},Fg=M.createContext({strict:!1}),sy={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let oy=!1;function DT(){if(oy)return;const a={};for(const l in sy)a[l]={isEnabled:o=>sy[l].some(r=>!!o[r])};Ag(a),oy=!0}function Pg(){return DT(),y2()}function OT(a){const l=Pg();for(const o in a)l[o]={...l[o],...a[o]};Ag(l)}const zT=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Rr(a){return a.startsWith("while")||a.startsWith("drag")&&a!=="draggable"||a.startsWith("layout")||a.startsWith("onTap")||a.startsWith("onPan")||a.startsWith("onLayout")||zT.has(a)}let Wg=a=>!Rr(a);function RT(a){typeof a=="function"&&(Wg=l=>l.startsWith("on")?!Rr(l):a(l))}try{RT(require("@emotion/is-prop-valid").default)}catch{}function VT(a,l,o){const r={};for(const c in a)c==="values"&&typeof a.values=="object"||(Wg(c)||o===!0&&Rr(c)||!l&&!Rr(c)||a.draggable&&c.startsWith("onDrag"))&&(r[c]=a[c]);return r}const Br=M.createContext({});function _T(a,l){if(Ur(a)){const{initial:o,animate:r}=a;return{initial:o===!1||Fs(o)?o:void 0,animate:Fs(r)?r:void 0}}return a.inherit!==!1?l:{}}function UT(a){const{initial:l,animate:o}=_T(a,M.useContext(Br));return M.useMemo(()=>({initial:l,animate:o}),[ry(l),ry(o)])}function ry(a){return Array.isArray(a)?a.join(" "):a}const cd=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function $g(a,l,o){for(const r in l)!ve(l[r])&&!Og(r,o)&&(a[r]=l[r])}function BT({transformTemplate:a},l){return M.useMemo(()=>{const o=cd();return od(o,l,a),Object.assign({},o.vars,o.style)},[l])}function LT(a,l){const o=a.style||{},r={};return $g(r,o,a),Object.assign(r,BT(a,l)),r}function HT(a,l){const o={},r=LT(a,l);return a.drag&&a.dragListener!==!1&&(o.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=a.drag===!0?"none":`pan-${a.drag==="x"?"y":"x"}`),a.tabIndex===void 0&&(a.onTap||a.onTapStart||a.whileTap)&&(o.tabIndex=0),o.style=r,o}const Ig=()=>({...cd(),attrs:{}});function YT(a,l,o,r){const c=M.useMemo(()=>{const h=Ig();return zg(h,l,Vg(r),a.transformTemplate,a.style),{...h.attrs,style:{...h.style}}},[l]);if(a.style){const h={};$g(h,a.style,a),c.style={...h,...c.style}}return c}const qT=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fd(a){return typeof a!="string"||a.includes("-")?!1:!!(qT.indexOf(a)>-1||/[A-Z]/u.test(a))}function GT(a,l,o,{latestValues:r},c,h=!1,d){const v=(d??fd(a)?YT:HT)(l,r,c,a),p=VT(l,typeof a=="string",h),x=a!==M.Fragment?{...p,...v,ref:o}:{},{children:b}=l,T=M.useMemo(()=>ve(b)?b.get():b,[b]);return M.createElement(a,{...x,children:T})}function kT({scrapeMotionValuesFromProps:a,createRenderState:l},o,r,c){return{latestValues:XT(o,r,c,a),renderState:l()}}function XT(a,l,o,r){const c={},h=r(a,{});for(const T in h)c[T]=Ar(h[T]);let{initial:d,animate:y}=a;const v=Ur(a),p=Tg(a);l&&p&&!v&&a.inherit!==!1&&(d===void 0&&(d=l.initial),y===void 0&&(y=l.animate));let x=o?o.initial===!1:!1;x=x||d===!1;const b=x?y:d;if(b&&typeof b!="boolean"&&!_r(b)){const T=Array.isArray(b)?b:[b];for(let z=0;z<T.length;z++){const R=If(a,T[z]);if(R){const{transitionEnd:H,transition:q,...K}=R;for(const Z in K){let Y=K[Z];if(Array.isArray(Y)){const Q=x?Y.length-1:0;Y=Y[Q]}Y!==null&&(c[Z]=Y)}for(const Z in H)c[Z]=H[Z]}}}return c}const tv=a=>(l,o)=>{const r=M.useContext(Br),c=M.useContext(Vr),h=()=>kT(a,l,r,c);return o?h():Uf(h)},KT=tv({scrapeMotionValuesFromProps:rd,createRenderState:cd}),QT=tv({scrapeMotionValuesFromProps:_g,createRenderState:Ig}),ZT=Symbol.for("motionComponentSymbol");function JT(a,l,o){const r=M.useRef(o);M.useInsertionEffect(()=>{r.current=o});const c=M.useRef(null);return M.useCallback(h=>{h&&a.onMount?.(h),l&&(h?l.mount(h):l.unmount());const d=r.current;if(typeof d=="function")if(h){const y=d(h);typeof y=="function"&&(c.current=y)}else c.current?(c.current(),c.current=null):d(h);else d&&(d.current=h)},[l])}const ev=M.createContext({});function Cl(a){return a&&typeof a=="object"&&Object.prototype.hasOwnProperty.call(a,"current")}function FT(a,l,o,r,c,h){const{visualElement:d}=M.useContext(Br),y=M.useContext(Fg),v=M.useContext(Vr),p=M.useContext(ud),x=p.reducedMotion,b=p.skipAnimations,T=M.useRef(null),z=M.useRef(!1);r=r||y.renderer,!T.current&&r&&(T.current=r(a,{visualState:l,parent:d,props:o,presenceContext:v,blockInitialAnimation:v?v.initial===!1:!1,reducedMotionConfig:x,skipAnimations:b,isSVG:h}),z.current&&T.current&&(T.current.manuallyAnimateOnMount=!0));const R=T.current,H=M.useContext(ev);R&&!R.projection&&c&&(R.type==="html"||R.type==="svg")&&PT(T.current,o,c,H);const q=M.useRef(!1);M.useInsertionEffect(()=>{R&&q.current&&R.update(o,v)});const K=o[ug],Z=M.useRef(!!K&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(K)&&window.MotionHasOptimisedAnimation?.(K));return Ty(()=>{z.current=!0,R&&(q.current=!0,window.MotionIsMounted=!0,R.updateFeatures(),R.scheduleRenderMicrotask(),Z.current&&R.animationState&&R.animationState.animateChanges())}),M.useEffect(()=>{R&&(!Z.current&&R.animationState&&R.animationState.animateChanges(),Z.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(K)}),Z.current=!1),R.enteringChildren=void 0)}),R}function PT(a,l,o,r){const{layoutId:c,layout:h,drag:d,dragConstraints:y,layoutScroll:v,layoutRoot:p,layoutCrossfade:x}=l;a.projection=new o(a.latestValues,l["data-framer-portal-id"]?void 0:nv(a.parent)),a.projection.setOptions({layoutId:c,layout:h,alwaysMeasureLayout:!!d||y&&Cl(y),visualElement:a,animationType:typeof h=="string"?h:"both",initialPromotionConfig:r,crossfade:x,layoutScroll:v,layoutRoot:p})}function nv(a){if(a)return a.options.allowProjection!==!1?a.projection:nv(a.parent)}function af(a,{forwardMotionProps:l=!1,type:o}={},r,c){r&&OT(r);const h=o?o==="svg":fd(a),d=h?QT:KT;function y(p,x){let b;const T={...M.useContext(ud),...p,layoutId:WT(p)},{isStatic:z}=T,R=UT(p),H=d(p,z);if(!z&&typeof window<"u"){$T();const q=IT(T);b=q.MeasureLayout,R.visualElement=FT(a,H,T,c,q.ProjectionNode,h)}return m.jsxs(Br.Provider,{value:R,children:[b&&R.visualElement?m.jsx(b,{visualElement:R.visualElement,...T}):null,GT(a,p,JT(H,R.visualElement,x),H,z,l,h)]})}y.displayName=`motion.${typeof a=="string"?a:`create(${a.displayName??a.name??""})`}`;const v=M.forwardRef(y);return v[ZT]=a,v}function WT({layoutId:a}){const l=M.useContext(_f).id;return l&&a!==void 0?l+"-"+a:a}function $T(a,l){M.useContext(Fg).strict}function IT(a){const l=Pg(),{drag:o,layout:r}=l;if(!o&&!r)return{};const c={...o,...r};return{MeasureLayout:o?.isEnabled(a)||r?.isEnabled(a)?c.MeasureLayout:void 0,ProjectionNode:c.ProjectionNode}}function tw(a,l){if(typeof Proxy>"u")return af;const o=new Map,r=(h,d)=>af(h,d,a,l),c=(h,d)=>r(h,d);return new Proxy(c,{get:(h,d)=>d==="create"?r:(o.has(d)||o.set(d,af(d,void 0,a,l)),o.get(d))})}const ew=(a,l)=>l.isSVG??fd(a)?new R2(l):new j2(l,{allowProjection:a!==M.Fragment});class nw extends Qa{constructor(l){super(l),l.animationState||(l.animationState=L2(l))}updateAnimationControlsSubscription(){const{animate:l}=this.node.getProps();_r(l)&&(this.unmountControls=l.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:l}=this.node.getProps(),{animate:o}=this.node.prevProps||{};l!==o&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let aw=0;class iw extends Qa{constructor(){super(...arguments),this.id=aw++}update(){if(!this.node.presenceContext)return;const{isPresent:l,onExitComplete:o}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||l===r)return;const c=this.node.animationState.setActive("exit",!l);o&&!l&&c.then(()=>{o(this.id)})}mount(){const{register:l,onExitComplete:o}=this.node.presenceContext||{};o&&o(this.id),l&&(this.unmount=l(this.id))}unmount(){}}const lw={animation:{Feature:nw},exit:{Feature:iw}};function to(a){return{point:{x:a.pageX,y:a.pageY}}}const sw=a=>l=>ad(l)&&a(l,to(l));function Ks(a,l,o,r){return Ps(a,l,sw(o),r)}const av=({current:a})=>a?a.ownerDocument.defaultView:null,uy=(a,l)=>Math.abs(a-l);function ow(a,l){const o=uy(a.x,l.x),r=uy(a.y,l.y);return Math.sqrt(o**2+r**2)}const cy=new Set(["auto","scroll"]);class iv{constructor(l,o,{transformPagePoint:r,contextWindow:c=window,dragSnapToOrigin:h=!1,distanceThreshold:d=3,element:y}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=z=>{this.handleScroll(z.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const z=sf(this.lastMoveEventInfo,this.history),R=this.startEvent!==null,H=ow(z.offset,{x:0,y:0})>=this.distanceThreshold;if(!R&&!H)return;const{point:q}=z,{timestamp:K}=de;this.history.push({...q,timestamp:K});const{onStart:Z,onMove:Y}=this.handlers;R||(Z&&Z(this.lastMoveEvent,z),this.startEvent=this.lastMoveEvent),Y&&Y(this.lastMoveEvent,z)},this.handlePointerMove=(z,R)=>{this.lastMoveEvent=z,this.lastMoveEventInfo=lf(R,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(z,R)=>{this.end();const{onEnd:H,onSessionEnd:q,resumeAnimation:K}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&K&&K(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const Z=sf(z.type==="pointercancel"?this.lastMoveEventInfo:lf(R,this.transformPagePoint),this.history);this.startEvent&&H&&H(z,Z),q&&q(z,Z)},!ad(l))return;this.dragSnapToOrigin=h,this.handlers=o,this.transformPagePoint=r,this.distanceThreshold=d,this.contextWindow=c||window;const v=to(l),p=lf(v,this.transformPagePoint),{point:x}=p,{timestamp:b}=de;this.history=[{...x,timestamp:b}];const{onSessionStart:T}=o;T&&T(l,sf(p,this.history)),this.removeListeners=Ws(Ks(this.contextWindow,"pointermove",this.handlePointerMove),Ks(this.contextWindow,"pointerup",this.handlePointerUp),Ks(this.contextWindow,"pointercancel",this.handlePointerUp)),y&&this.startScrollTracking(y)}startScrollTracking(l){let o=l.parentElement;for(;o;){const r=getComputedStyle(o);(cy.has(r.overflowX)||cy.has(r.overflowY))&&this.scrollPositions.set(o,{x:o.scrollLeft,y:o.scrollTop}),o=o.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(l){const o=this.scrollPositions.get(l);if(!o)return;const r=l===window,c=r?{x:window.scrollX,y:window.scrollY}:{x:l.scrollLeft,y:l.scrollTop},h={x:c.x-o.x,y:c.y-o.y};h.x===0&&h.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=h.x,this.lastMoveEventInfo.point.y+=h.y):this.history.length>0&&(this.history[0].x-=h.x,this.history[0].y-=h.y),this.scrollPositions.set(l,c),_t.update(this.updatePoint,!0))}updateHandlers(l){this.handlers=l}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ka(this.updatePoint)}}function lf(a,l){return l?{point:l(a.point)}:a}function fy(a,l){return{x:a.x-l.x,y:a.y-l.y}}function sf({point:a},l){return{point:a,delta:fy(a,lv(l)),offset:fy(a,rw(l)),velocity:uw(l,.1)}}function rw(a){return a[0]}function lv(a){return a[a.length-1]}function uw(a,l){if(a.length<2)return{x:0,y:0};let o=a.length-1,r=null;const c=lv(a);for(;o>=0&&(r=a[o],!(c.timestamp-r.timestamp>gn(l)));)o--;if(!r)return{x:0,y:0};r===a[0]&&a.length>2&&c.timestamp-r.timestamp>gn(l)*2&&(r=a[1]);const h=en(c.timestamp-r.timestamp);if(h===0)return{x:0,y:0};const d={x:(c.x-r.x)/h,y:(c.y-r.y)/h};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}function cw(a,{min:l,max:o},r){return l!==void 0&&a<l?a=r?Gt(l,a,r.min):Math.max(a,l):o!==void 0&&a>o&&(a=r?Gt(o,a,r.max):Math.min(a,o)),a}function dy(a,l,o){return{min:l!==void 0?a.min+l:void 0,max:o!==void 0?a.max+o-(a.max-a.min):void 0}}function fw(a,{top:l,left:o,bottom:r,right:c}){return{x:dy(a.x,o,c),y:dy(a.y,l,r)}}function hy(a,l){let o=l.min-a.min,r=l.max-a.max;return l.max-l.min<a.max-a.min&&([o,r]=[r,o]),{min:o,max:r}}function dw(a,l){return{x:hy(a.x,l.x),y:hy(a.y,l.y)}}function hw(a,l){let o=.5;const r=Ee(a),c=Ee(l);return c>r?o=Qs(l.min,l.max-r,a.min):r>c&&(o=Qs(a.min,a.max-c,l.min)),Ln(0,1,o)}function mw(a,l){const o={};return l.min!==void 0&&(o.min=l.min-a.min),l.max!==void 0&&(o.max=l.max-a.min),o}const zf=.35;function pw(a=zf){return a===!1?a=0:a===!0&&(a=zf),{x:my(a,"left","right"),y:my(a,"top","bottom")}}function my(a,l,o){return{min:py(a,l),max:py(a,o)}}function py(a,l){return typeof a=="number"?a:a[l]||0}const yw=new WeakMap;class gw{constructor(l){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ne(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=l}start(l,{snapToCursor:o=!1,distanceThreshold:r}={}){const{presenceContext:c}=this.visualElement;if(c&&c.isPresent===!1)return;const h=b=>{o&&this.snapToCursor(to(b).point),this.stopAnimation()},d=(b,T)=>{const{drag:z,dragPropagation:R,onDragStart:H}=this.getProps();if(z&&!R&&(this.openDragLock&&this.openDragLock(),this.openDragLock=QS(z),!this.openDragLock))return;this.latestPointerEvent=b,this.latestPanInfo=T,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Un(K=>{let Z=this.getAxisMotionValue(K).get()||0;if(Bn.test(Z)){const{projection:Y}=this.visualElement;if(Y&&Y.layout){const Q=Y.layout.layoutBox[K];Q&&(Z=Ee(Q)*(parseFloat(Z)/100))}}this.originPoint[K]=Z}),H&&_t.update(()=>H(b,T),!1,!0),wf(this.visualElement,"transform");const{animationState:q}=this.visualElement;q&&q.setActive("whileDrag",!0)},y=(b,T)=>{this.latestPointerEvent=b,this.latestPanInfo=T;const{dragPropagation:z,dragDirectionLock:R,onDirectionLock:H,onDrag:q}=this.getProps();if(!z&&!this.openDragLock)return;const{offset:K}=T;if(R&&this.currentDirection===null){this.currentDirection=xw(K),this.currentDirection!==null&&H&&H(this.currentDirection);return}this.updateAxis("x",T.point,K),this.updateAxis("y",T.point,K),this.visualElement.render(),q&&_t.update(()=>q(b,T),!1,!0)},v=(b,T)=>{this.latestPointerEvent=b,this.latestPanInfo=T,this.stop(b,T),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>{const{dragSnapToOrigin:b}=this.getProps();(b||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:x}=this.getProps();this.panSession=new iv(l,{onSessionStart:h,onStart:d,onMove:y,onSessionEnd:v,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:x,distanceThreshold:r,contextWindow:av(this.visualElement),element:this.visualElement.current})}stop(l,o){const r=l||this.latestPointerEvent,c=o||this.latestPanInfo,h=this.isDragging;if(this.cancel(),!h||!c||!r)return;const{velocity:d}=c;this.startAnimation(d);const{onDragEnd:y}=this.getProps();y&&_t.postRender(()=>y(r,c))}cancel(){this.isDragging=!1;const{projection:l,animationState:o}=this.visualElement;l&&(l.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(l,o,r){const{drag:c}=this.getProps();if(!r||!vr(l,c,this.currentDirection))return;const h=this.getAxisMotionValue(l);let d=this.originPoint[l]+r[l];this.constraints&&this.constraints[l]&&(d=cw(d,this.constraints[l],this.elastic[l])),h.set(d)}resolveConstraints(){const{dragConstraints:l,dragElastic:o}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,c=this.constraints;l&&Cl(l)?this.constraints||(this.constraints=this.resolveRefConstraints()):l&&r?this.constraints=fw(r.layoutBox,l):this.constraints=!1,this.elastic=pw(o),c!==this.constraints&&!Cl(l)&&r&&this.constraints&&!this.hasMutatedConstraints&&Un(h=>{this.constraints!==!1&&this.getAxisMotionValue(h)&&(this.constraints[h]=mw(r.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:l,onMeasureDragConstraints:o}=this.getProps();if(!l||!Cl(l))return!1;const r=l.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const h=S2(r,c.root,this.visualElement.getTransformPagePoint());let d=dw(c.layout.layoutBox,h);if(o){const y=o(v2(d));this.hasMutatedConstraints=!!y,y&&(d=Cg(y))}return d}startAnimation(l){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:h,dragSnapToOrigin:d,onDragTransitionEnd:y}=this.getProps(),v=this.constraints||{},p=Un(x=>{if(!vr(x,o,this.currentDirection))return;let b=v&&v[x]||{};d&&(b={min:0,max:0});const T=c?200:1e6,z=c?40:1e7,R={type:"inertia",velocity:r?l[x]:0,bounceStiffness:T,bounceDamping:z,timeConstant:750,restDelta:1,restSpeed:10,...h,...b};return this.startAxisValueAnimation(x,R)});return Promise.all(p).then(y)}startAxisValueAnimation(l,o){const r=this.getAxisMotionValue(l);return wf(this.visualElement,l),r.start($f(l,r,0,o,this.visualElement,!1))}stopAnimation(){Un(l=>this.getAxisMotionValue(l).stop())}getAxisMotionValue(l){const o=`_drag${l.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(l,(r.initial?r.initial[l]:void 0)||0)}snapToCursor(l){Un(o=>{const{drag:r}=this.getProps();if(!vr(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,h=this.getAxisMotionValue(o);if(c&&c.layout){const{min:d,max:y}=c.layout.layoutBox[o],v=h.get()||0;h.set(l[o]-Gt(d,y,.5)+v)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:l,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Cl(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Un(d=>{const y=this.getAxisMotionValue(d);if(y&&this.constraints!==!1){const v=y.get();c[d]=hw({min:v,max:v},this.constraints[d])}});const{transformTemplate:h}=this.visualElement.getProps();this.visualElement.current.style.transform=h?h({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Un(d=>{if(!vr(d,l,null))return;const y=this.getAxisMotionValue(d),{min:v,max:p}=this.constraints[d];y.set(Gt(v,p,c[d]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;yw.set(this.visualElement,this);const l=this.visualElement.current,o=Ks(l,"pointerdown",p=>{const{drag:x,dragListener:b=!0}=this.getProps(),T=p.target,z=T!==l&&$S(T);x&&b&&!z&&this.start(p)});let r;const c=()=>{const{dragConstraints:p}=this.getProps();Cl(p)&&p.current&&(this.constraints=this.resolveRefConstraints(),r||(r=vw(l,p.current,()=>this.scalePositionWithinConstraints())))},{projection:h}=this.visualElement,d=h.addEventListener("measure",c);h&&!h.layout&&(h.root&&h.root.updateScroll(),h.updateLayout()),_t.read(c);const y=Ps(window,"resize",()=>this.scalePositionWithinConstraints()),v=h.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:x})=>{this.isDragging&&x&&(Un(b=>{const T=this.getAxisMotionValue(b);T&&(this.originPoint[b]+=p[b].translate,T.set(T.get()+p[b].translate))}),this.visualElement.render())}));return()=>{y(),o(),d(),v&&v(),r&&r()}}getProps(){const l=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:h=!1,dragElastic:d=zf,dragMomentum:y=!0}=l;return{...l,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:h,dragElastic:d,dragMomentum:y}}}function yy(a){let l=!0;return()=>{if(l){l=!1;return}a()}}function vw(a,l,o){const r=T0(a,yy(o)),c=T0(l,yy(o));return()=>{r(),c()}}function vr(a,l,o){return(l===!0||l===a)&&(o===null||o===a)}function xw(a,l=10){let o=null;return Math.abs(a.y)>l?o="y":Math.abs(a.x)>l&&(o="x"),o}class bw extends Qa{constructor(l){super(l),this.removeGroupControls=nn,this.removeListeners=nn,this.controls=new gw(l)}mount(){const{dragControls:l}=this.node.getProps();l&&(this.removeGroupControls=l.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||nn}update(){const{dragControls:l}=this.node.getProps(),{dragControls:o}=this.node.prevProps||{};l!==o&&(this.removeGroupControls(),l&&(this.removeGroupControls=l.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const of=a=>(l,o)=>{a&&_t.update(()=>a(l,o),!1,!0)};class Sw extends Qa{constructor(){super(...arguments),this.removePointerDownListener=nn}onPointerDown(l){this.session=new iv(l,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:av(this.node)})}createPanHandlers(){const{onPanSessionStart:l,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:of(l),onStart:of(o),onMove:of(r),onEnd:(h,d)=>{delete this.session,c&&_t.postRender(()=>c(h,d))}}}mount(){this.removePointerDownListener=Ks(this.node.current,"pointerdown",l=>this.onPointerDown(l))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let rf=!1;class Tw extends M.Component{componentDidMount(){const{visualElement:l,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:h}=l;h&&(o.group&&o.group.add(h),r&&r.register&&c&&r.register(h),rf&&h.root.didUpdate(),h.addEventListener("animationComplete",()=>{this.safeToRemove()}),h.setOptions({...h.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Er.hasEverUpdated=!0}getSnapshotBeforeUpdate(l){const{layoutDependency:o,visualElement:r,drag:c,isPresent:h}=this.props,{projection:d}=r;return d&&(d.isPresent=h,l.layoutDependency!==o&&d.setOptions({...d.options,layoutDependency:o}),rf=!0,c||l.layoutDependency!==o||o===void 0||l.isPresent!==h?d.willUpdate():this.safeToRemove(),l.isPresent!==h&&(h?d.promote():d.relegate()||_t.postRender(()=>{const y=d.getStack();(!y||!y.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:l}=this.props.visualElement;l&&(l.root.didUpdate(),nd.postRender(()=>{!l.currentAnimation&&l.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:l,layoutGroup:o,switchLayoutGroup:r}=this.props,{projection:c}=l;rf=!0,c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:l}=this.props;l&&l()}render(){return null}}function sv(a){const[l,o]=Jg(),r=M.useContext(_f);return m.jsx(Tw,{...a,layoutGroup:r,switchLayoutGroup:M.useContext(ev),isPresent:l,safeToRemove:o})}const ww={pan:{Feature:Sw},drag:{Feature:bw,ProjectionNode:Zg,MeasureLayout:sv}};function gy(a,l,o){const{props:r}=a;a.animationState&&r.whileHover&&a.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,h=r[c];h&&_t.postRender(()=>h(l,to(l)))}class Aw extends Qa{mount(){const{current:l}=this.node;l&&(this.unmount=JS(l,(o,r)=>(gy(this.node,r,"Start"),c=>gy(this.node,c,"End"))))}unmount(){}}class Ew extends Qa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let l=!1;try{l=this.node.current.matches(":focus-visible")}catch{l=!0}!l||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ws(Ps(this.node.current,"focus",()=>this.onFocus()),Ps(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function vy(a,l,o){const{props:r}=a;if(a.current instanceof HTMLButtonElement&&a.current.disabled)return;a.animationState&&r.whileTap&&a.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),h=r[c];h&&_t.postRender(()=>h(l,to(l)))}class Cw extends Qa{mount(){const{current:l}=this.node;if(!l)return;const{globalTapTarget:o,propagate:r}=this.node.props;this.unmount=t2(l,(c,h)=>(vy(this.node,h,"Start"),(d,{success:y})=>vy(this.node,d,y?"End":"Cancel")),{useGlobalTarget:o,stopPropagation:r?.tap===!1})}unmount(){}}const Rf=new WeakMap,uf=new WeakMap,jw=a=>{const l=Rf.get(a.target);l&&l(a)},Nw=a=>{a.forEach(jw)};function Mw({root:a,...l}){const o=a||document;uf.has(o)||uf.set(o,{});const r=uf.get(o),c=JSON.stringify(l);return r[c]||(r[c]=new IntersectionObserver(Nw,{root:a,...l})),r[c]}function Dw(a,l,o){const r=Mw(l);return Rf.set(a,o),r.observe(a),()=>{Rf.delete(a),r.unobserve(a)}}const Ow={some:0,all:1};class zw extends Qa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:l={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:h}=l,d={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:Ow[c]},y=v=>{const{isIntersecting:p}=v;if(this.isInView===p||(this.isInView=p,h&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:x,onViewportLeave:b}=this.node.getProps(),T=p?x:b;T&&T(v)};return Dw(this.node.current,d,y)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:l,prevProps:o}=this.node;["amount","margin","root"].some(Rw(l,o))&&this.startObserver()}unmount(){}}function Rw({viewport:a={}},{viewport:l={}}={}){return o=>a[o]!==l[o]}const Vw={inView:{Feature:zw},tap:{Feature:Cw},focus:{Feature:Ew},hover:{Feature:Aw}},_w={layout:{ProjectionNode:Zg,MeasureLayout:sv}},Uw={...lw,...Vw,...ww,..._w},Ys=tw(Uw,ew);function Bw(a){const l=a.match(/^100\.(\d+)\./);if(l&&+l[1]>=64&&+l[1]<=127)return"tailscale";if(/^192\.168\./.test(a)||/^10\./.test(a))return"lan";const o=a.match(/^172\.(\d+)\./);return o&&+o[1]>=16&&+o[1]<=31?"lan":a==="localhost"||a==="127.0.0.1"?"localhost":a.endsWith(".trycloudflare.com")?"tunnel":a.endsWith(".fluxy.bot")?"relay":"custom-domain"}function Ga(a){return a==="tailscale"||a==="lan"||a==="localhost"}const xy={tailscale:"Tailscale",lan:"Local network",localhost:"Localhost",tunnel:"Cloudflare tunnel",relay:"Relay","custom-domain":"Custom domain"},Lw=[{id:"anthropic",name:"Claude",subtitle:"by Anthropic",icon:"/icons/claude.png"},{id:"openai",name:"OpenAI Codex",subtitle:"ChatGPT Plus / Pro",icon:"/icons/codex.png"}],Hw={anthropic:[{id:"claude-opus-4-6",label:"Opus 4.6"},{id:"claude-sonnet-4-6",label:"Sonnet 4.6"},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5"}],openai:[{id:"gpt-5.2-codex:medium",label:"GPT-5.2 Codex Medium"},{id:"gpt-5.2-codex:high",label:"GPT-5.2 Codex High"},{id:"gpt-5.2-codex:xhigh",label:"GPT-5.2 Codex Extra High"},{id:"gpt-5.3-codex:medium",label:"GPT-5.3 Codex Medium (Pro)"},{id:"gpt-5.3-codex:high",label:"GPT-5.3 Codex High (Pro)"},{id:"gpt-5.3-codex:xhigh",label:"GPT-5.3 Codex Extra High (Pro)"}]};function Yw({models:a,value:l,onChange:o}){const[r,c]=M.useState(!1),h=M.useRef(null);M.useEffect(()=>{if(!r)return;const y=v=>{h.current&&!h.current.contains(v.target)&&c(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]);const d=a.find(y=>y.id===l);return m.jsxs("div",{className:"relative",ref:h,children:[m.jsxs("button",{type:"button",onClick:()=>c(y=>!y),className:"w-full flex items-center justify-between bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none hover:border-white/15 focus:border-[#AF27E3]/30 transition-colors",children:[m.jsx("span",{className:d?"text-white":"text-white/20",children:d?d.label:"Choose a model..."}),m.jsx(T1,{className:`h-4 w-4 text-white/30 transition-transform ${r?"rotate-180":""}`})]}),r&&m.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#222] border border-white/[0.08] rounded-xl shadow-xl py-1 z-10 max-h-48 overflow-y-auto",children:a.map(y=>m.jsx("button",{onClick:()=>{o(y.id),c(!1)},className:`w-full text-left px-4 py-2 text-[13px] transition-colors ${l===y.id?"text-[#AF27E3] bg-[#AF27E3]/10":"text-white/70 hover:bg-white/[0.04] hover:text-white"}`,children:y.label},y.id))})]})}function Xw({onComplete:a,isInitialSetup:l=!1,onSave:o,onTunnelSwitch:r}){const c=l?7:6,[h,d]=M.useState(0),[y,v]=M.useState(""),[p,x]=M.useState("anthropic"),[b,T]=M.useState(""),[z,R]=M.useState(!1),[H,q]=M.useState({anthropic:"idle",openai:"idle"}),[K,Z]=M.useState(!1),[Y,Q]=M.useState(""),[P,it]=M.useState(!1),[tt,F]=M.useState(),[lt,Et]=M.useState(!1),[Ut,wt]=M.useState(!1),[xe,le]=M.useState(),[dt,V]=M.useState(""),[k,J]=M.useState(null),[rt,ct]=M.useState(""),[w,B]=M.useState({}),[G,W]=M.useState(""),[st,mt]=M.useState(!1),[ot,qt]=M.useState(!1),[Ot,Ge]=M.useState(""),xn=M.useRef(null),[he,Mi]=M.useState("quick"),[an,Bl]=M.useState(""),[Ll,Lr]=M.useState(""),[Hn,bn]=M.useState("relay"),[be,Di]=M.useState(null),[Sn,Hl]=M.useState(!1),[me,eo]=M.useState(!1),[no,Oi]=M.useState({}),[zi,Ri]=M.useState(!1),[Za,Ja]=M.useState(""),[ao,ke]=M.useState(""),[pe,ln]=M.useState(!1),[Ht,Hr]=M.useState("tunnel"),[Yl,ql]=M.useState(!1),[ra,ua]=M.useState(""),[ca,Tn]=M.useState(!1),[Fa,wn]=M.useState(""),[Gl,Vi]=M.useState(!1),[Pa,fa]=M.useState(!1),[io,Wa]=M.useState(""),[lo,so]=M.useState("admin"),[se,_i]=M.useState(""),[$a,kl]=M.useState(""),[sn,kt]=M.useState(!1),[Vt,da]=M.useState(!1),[Ui,Yr]=M.useState(!1),[ha,oo]=M.useState(""),[ma,pa]=M.useState(""),[on,Yn]=M.useState(!1),[ya,qn]=M.useState(!1),[zt,Xl]=M.useState(!1),[Xe,An]=M.useState(""),[Se,En]=M.useState(!1),[Bi,ga]=M.useState(""),[Li,Cn]=M.useState(""),[Ia,Te]=M.useState(""),[oe,Hi]=M.useState(""),[ti,ei]=M.useState(!1),[Kl,ni]=M.useState(!1),[Yi,Zt]=M.useState(""),[qi,Gi]=M.useState([]),[ai,Gn]=M.useState(!1),[ro,ki]=M.useState(!1),[rn,Ql]=M.useState(""),[Zl,ii]=M.useState(""),[Jl,qr]=M.useState(!1),[va,un]=M.useState("password"),[Ke,Xi]=M.useState(!1),li=M.useRef(!1),Ce=H[p]==="connected",jn="fluxy_totp_setup";function uo(){try{sessionStorage.setItem(jn,JSON.stringify({secret:Bi,qrUri:Li,otpauthUri:Ia,phase:va,portalPass:se,portalPassConfirm:$a}))}catch{}}function Fl(){try{const j=sessionStorage.getItem(jn);if(!j)return!1;const X=JSON.parse(j);if(X.secret&&X.phase==="totp-setup")return ga(X.secret),Cn(X.qrUri||""),Te(X.otpauthUri||""),En(!0),un("totp-setup"),d(3),X.portalPass&&(_i(X.portalPass),kl(X.portalPassConfirm||"")),!0}catch{}return!1}function Ki(){try{sessionStorage.removeItem(jn)}catch{}}M.useEffect(()=>{fetch("/api/onboard/status").then(j=>j.json()).then(j=>{j.userName&&v(j.userName),j.handle&&(V(j.handle.username),W(j.handle.tier||"at"),Di({username:j.handle.username,tier:j.handle.tier,url:j.handle.url}),qt(!0),Ge(j.handle.url)),j.portalUser&&so(j.portalUser),j.portalConfigured&&da(!0),j.provider&&x(j.provider),j.model&&T(j.model),j.whisperEnabled&&(Xl(!0),An(j.whisperKey||"")),j.totpEnabled&&(En(!0),ei(!0)),j.tunnelMode&&Mi(j.tunnelMode),j.tunnelDomain&&Bl(j.tunnelDomain),j.tunnelUrl&&Lr(j.tunnelUrl),j.handle||bn("tunnel"),li.current=!0,j.totpEnabled||Fl()}).catch(()=>{li.current=!0})},[]),M.useEffect(()=>{Hr(Bw(window.location.hostname))},[]),M.useEffect(()=>{qr(window.matchMedia("(max-width: 768px)").matches||"ontouchstart"in window)},[]),M.useEffect(()=>{p!=="anthropic"||H.anthropic==="connected"||fetch("/api/auth/claude/status").then(j=>j.json()).then(j=>{j.authenticated&&q(X=>({...X,anthropic:"connected"}))}).catch(()=>{})},[p]),M.useEffect(()=>{p!=="openai"||H.openai==="connected"||fetch("/api/auth/codex/status").then(j=>j.json()).then(j=>{j.authenticated&&q(X=>({...X,openai:"connected"}))}).catch(()=>{})},[p]),M.useEffect(()=>{if(!Ut)return;const j=setInterval(async()=>{try{(await(await fetch("/api/auth/codex/status")).json()).authenticated&&(wt(!1),q(Re=>({...Re,openai:"connected"})))}catch{}},2e3);return()=>clearInterval(j)},[Ut]),M.useEffect(()=>{if(xn.current&&clearTimeout(xn.current),!li.current||he==="off"||be&&ot&&dt===be.username)return;J(null),ct(""),B({}),Oi({}),Ri(!1),Ja(""),ke(""),qt(!1),Ge("");const j=dt.trim();if(j){if(j.length<3){J("invalid"),ct("At least 3 characters");return}return J("checking"),xn.current=setTimeout(async()=>{try{const bt=await(await fetch(`/api/handle/check/${encodeURIComponent(j)}`)).json();if(!bt.valid)J("invalid"),ct(bt.error);else{const Re={},Kn={};for(const fn of bt.handles)Re[fn.tier]=fn.available,fn.reserved&&(Kn[fn.tier]=!0);B(Re),Oi(Kn),J("ready"),W("")}}catch{J(null)}},400),()=>{xn.current&&clearTimeout(xn.current)}}},[dt]),M.useEffect(()=>{if(!dt||dt.length<3||k!=="ready")return;const j=async()=>{try{const bt=await(await fetch(`/api/handle/check/${encodeURIComponent(dt.trim())}`)).json();if(bt.valid){const Re={},Kn={};for(const fn of bt.handles)Re[fn.tier]=fn.available,fn.reserved&&(Kn[fn.tier]=!0);B(Re),Oi(Kn)}}catch{}};return window.addEventListener("focus",j),()=>window.removeEventListener("focus",j)},[dt,k]);const kn=j=>{V(j.toLowerCase().replace(/[^a-z0-9-]/g,""))},cn=async()=>{if(!(!dt||k!=="ready"||!w[G])){mt(!0);try{const X=await(await fetch("/api/handle/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:dt,tier:G})})).json();X.ok?(qt(!0),Ge(X.url)):(ct(X.error||"Registration failed"),J("invalid"))}catch{ct("Could not reach server"),J("invalid")}finally{mt(!1)}}},Pl=async()=>{if(!(!dt||k!=="ready"||!w[G])){eo(!0);try{const X=await(await fetch("/api/handle/change",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:dt,tier:G})})).json();X.ok?(qt(!0),Ge(X.url),Di({username:dt,tier:G,url:X.url}),Hl(!1)):(ct(X.error||"Handle change failed"),J("invalid"))}catch{ct("Could not reach server"),J("invalid")}finally{eo(!1)}}},si=async()=>{if(!(!dt||!Za)){ln(!0),ke("");try{const X=await(await fetch("/api/handle/claim-reserved",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:dt,hash:Za})})).json();X.ok?(qt(!0),Ge(X.url),Ri(!1),Ja(""),W("premium"),bn("relay")):ke(X.error||"Invalid activation code")}catch{ke("Could not reach server")}finally{ln(!1)}}},Nn=j=>{p==="openai"&&j!=="openai"&&Ut&&(fetch("/api/auth/codex/cancel",{method:"POST"}),wt(!1)),x(j),T(""),Z(!1),Q(""),F(void 0),wt(!1),le(void 0)},Qi=j=>{if(window.matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0){const bt=document.createElement("a");bt.href=j,bt.target="_blank",bt.rel="noopener noreferrer",document.body.appendChild(bt),bt.click(),document.body.removeChild(bt)}else window.open(j,"_blank","noopener,noreferrer")},Zi=async()=>{F(void 0);try{const X=await(await fetch("/api/auth/claude/start",{method:"POST"})).json();X.success&&X.authUrl?(Qi(X.authUrl),Z(!0)):F(X.error||"Failed to start authentication")}catch(j){F(j.message)}},Wl=async()=>{if(Y.trim()){it(!0),F(void 0);try{const X=await(await fetch("/api/auth/claude/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:Y.trim()})})).json();X.success?q(bt=>({...bt,anthropic:"connected"})):F(X.error||"Code exchange failed")}catch(j){F(j.message)}finally{it(!1)}}},Ji=async()=>{try{const j=await navigator.clipboard.readText();j&&Q(j.trim())}catch{}},Fi=async()=>{Et(!0),F(void 0);try{(await(await fetch("/api/auth/claude/status")).json()).authenticated?q(bt=>({...bt,anthropic:"connected"})):F("No active session found. Please authenticate first.")}catch{}finally{Et(!1)}},co=async()=>{wt(!0),le(void 0);try{const X=await(await fetch("/api/auth/codex/start",{method:"POST"})).json();X.success&&X.authUrl?Qi(X.authUrl):(wt(!1),le(X.error||"Failed to start authentication"))}catch(j){wt(!1),le(j.message)}},ye=()=>{wt(!1),fetch("/api/auth/codex/cancel",{method:"POST"})},Mn=se===$a,oi=se.length>=6&&Mn,ri=Vt?se.length===0||on&&oi:oi,xa=(()=>{switch(h){case 0:return!0;case 1:return y.trim().length>0;case 2:return Yl||Gl?!1:he==="off"||he==="named"||Hn==="tunnel"?dt.trim().length>=3:ot;case 3:return!(va!=="password"||!ri||Se&&!ti);case 4:return!!(p&&b&&Ce);case 5:return!0;default:return!1}})(),ze=()=>{xa&&h<c-1&&d(j=>j+1)},$l=()=>{h>0&&d(j=>j-1)},Xn=j=>{j.key==="Enter"&&xa&&ze()},Pi=async()=>{R(!0);const j={userName:y.trim(),agentName:dt.trim()||"Fluxy",provider:p,model:b,apiKey:"",whisperEnabled:zt,whisperKey:zt?Xe:"",portalUser:lo.trim(),portalPass:se};try{o?await o(j):await fetch("/api/onboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)}),l?(R(!1),d(6)):a()}catch(X){console.error("[OnboardWizard] Onboard failed:",X),R(!1)}},Qe="w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all",Il="w-full bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none input-glow placeholder:text-white/20 transition-all";return m.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4",children:[m.jsx("div",{className:"absolute inset-0 bg-black/85 backdrop-blur-md"}),m.jsxs(Ys.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.3},className:"relative w-full max-w-[480px] bg-[#181818] border border-white/[0.06] rounded-[24px] shadow-2xl overflow-hidden",children:[m.jsx("div",{className:"flex justify-center gap-2 pt-6",children:Array.from({length:c},(j,X)=>m.jsx("div",{className:`h-1.5 rounded-full transition-all duration-300 ${X===h?"w-7 bg-gradient-brand":X<h?"w-1.5 bg-gradient-brand opacity-60":"w-1.5 bg-white/10"}`},X))}),m.jsx(ly,{mode:"wait",children:m.jsxs(Ys.div,{initial:{opacity:0,x:30},animate:{opacity:1,x:0},exit:{opacity:0,x:-30},transition:{duration:.2,ease:"easeOut"},className:"px-8 pt-6 pb-8",children:[h===0&&m.jsxs("div",{className:"flex flex-col items-center text-center",children:[m.jsxs("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"h-[180px] mb-4",children:[m.jsx("source",{src:"/fluxy_say_hi.mov",type:'video/mp4; codecs="hvc1"'}),m.jsx("source",{src:"/fluxy_say_hi.webm",type:"video/webm"})]}),m.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Welcome to Fluxy"}),m.jsx("p",{className:"text-white/40 text-[14px] mt-2 leading-relaxed max-w-[320px]",children:"Let's set up your AI assistant in just a few steps."}),m.jsxs("button",{onClick:ze,className:"mt-6 px-7 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center gap-2",children:["Get Started",m.jsx(qe,{className:"h-4 w-4"})]})]}),h===1&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"What's your name?"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is how your agent will address you."}),m.jsxs("div",{className:"mt-5 flex items-center gap-3",children:[m.jsx("input",{type:"text",value:y,onChange:j=>v(j.target.value),onKeyDown:Xn,placeholder:"Enter your name",autoFocus:!0,autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",className:Qe+" flex-1"}),m.jsx("button",{onClick:ze,disabled:!xa,className:"shrink-0 h-12 w-12 flex items-center justify-center rounded-full bg-gradient-brand hover:opacity-90 text-white transition-colors disabled:opacity-30",children:m.jsx(qe,{className:"h-5 w-5"})})]})]}),h===2&&he==="off"&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Bot Name & Access"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"Give your bot a name. This is used throughout the app as your bot's identity."}),m.jsx("div",{className:"relative mt-5",children:m.jsx("input",{type:"text",value:dt,onChange:j=>kn(j.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",autoFocus:!0,className:Qe+" pr-10 font-mono"})}),m.jsx("div",{className:"mt-4 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:m.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:"Private network mode — your bot is only accessible via your local network or VPN. No public URL will be created."})}),!l&&m.jsx("div",{className:"mt-3 flex items-center gap-2",children:m.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-medium border ${Ga(Ht)?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:[Ga(Ht)?m.jsx(e0,{className:"h-3 w-3"}):m.jsx(Xc,{className:"h-3 w-3"}),"Accessing via ",xy[Ht]]})}),!l&&!Gl&&m.jsxs("button",{onClick:()=>{Vi(!0),Wa("")},className:"w-full mt-4 flex items-center justify-between px-4 py-3 rounded-xl border border-white/[0.06] bg-white/[0.02] hover:border-white/10 hover:bg-white/[0.04] transition-all text-left",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-[13px] text-white/70 font-medium",children:"Re-enable public tunnel access"}),m.jsx("p",{className:"text-[11px] text-white/30 mt-0.5",children:"Start a Cloudflare tunnel to make your bot accessible from anywhere"})]}),m.jsx(Xc,{className:"h-4 w-4 text-white/30 shrink-0 ml-3"})]}),Gl&&m.jsxs("div",{className:"mt-4 space-y-3",children:[m.jsx("div",{className:"bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(t0,{className:"h-4 w-4 text-amber-400 shrink-0 mt-0.5"}),m.jsxs("div",{children:[m.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Enable public access?"}),m.jsxs("p",{className:"text-amber-400/60 text-[12px] mt-1 leading-relaxed",children:["This will start a Cloudflare tunnel, making your bot reachable from the internet.",be&&" Your handle will reconnect automatically."]})]})]})}),io&&m.jsx("p",{className:"text-red-400/70 text-[12px]",children:io}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("button",{onClick:async()=>{if(r){fa(!0),Wa("");try{await r("quick"),Mi("quick"),Vi(!1)}catch(j){Wa(j.message||"Failed to start tunnel")}finally{fa(!1)}}},disabled:Pa||!r,className:"flex-1 py-2.5 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:Pa?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-4 w-4 animate-spin"}),"Starting tunnel..."]}):"Enable Tunnel"}),m.jsx("button",{onClick:()=>{Vi(!1),Wa("")},disabled:Pa,className:"px-5 py-2.5 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Cancel"})]})]}),m.jsxs("button",{onClick:ze,disabled:!xa,className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]})]}),h===2&&he==="named"&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Bot Name & Access"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is your bot's identity. Your named tunnel domain is already configured."}),m.jsx("div",{className:"relative mt-5",children:m.jsx("input",{type:"text",value:dt,onChange:j=>kn(j.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",autoFocus:!0,className:Qe+" pr-10 font-mono"})}),m.jsxs("div",{className:"mt-4 flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[m.jsxs("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:["https://",an]}),m.jsx("button",{onClick:()=>{navigator.clipboard.writeText(`https://${an}`),kt(!0),setTimeout(()=>kt(!1),2e3)},className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:sn?m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"}):m.jsx(Pp,{className:"h-4 w-4"})})]})]}),h===2&&he==="quick"&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Bot Name & Access"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is your bot's name and permanent handle — access it from anywhere."}),be&&ot&&!Sn&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"}),m.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Current handle"})]}),m.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Ot})]}),m.jsxs("div",{className:"flex gap-2 mt-4",children:[m.jsxs("button",{onClick:ze,className:"flex-1 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]}),m.jsx("button",{onClick:()=>{Hl(!0),qt(!1),V(""),J(null),B({}),bn("relay")},className:"px-5 py-3 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Change"})]})]}),Sn&&!ot&&m.jsxs("div",{className:"mt-4 bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:[m.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Changing your handle"}),m.jsxs("p",{className:"text-amber-400/60 text-[12px] mt-1",children:["Your current handle ",m.jsx("span",{className:"font-mono",children:be?.url})," will be released and become available for others."]})]}),(!be||Sn||!ot)&&!(be&&ot&&!Sn)&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative mt-5",children:[m.jsx("input",{type:"text",value:dt,onChange:j=>kn(j.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",autoFocus:!0,disabled:ot,className:Qe+" pr-10 font-mono"+(ot?" opacity-50":"")}),k&&dt.length>0&&!ot&&m.jsxs("div",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:[k==="checking"&&m.jsx("div",{className:"w-5 h-5 border-2 border-white/10 border-t-[#04D1FE] rounded-full animate-spin"}),k==="invalid"&&m.jsx("div",{className:"w-6 h-6 rounded-full bg-amber-500/15 flex items-center justify-center",children:m.jsx("svg",{className:"w-3.5 h-3.5 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 4h.01"})})})]})]}),k==="invalid"&&rt&&m.jsx("p",{className:"text-amber-400 text-[12px] mt-2",children:rt}),k==="ready"&&dt.length>0&&!ot&&m.jsxs("div",{className:"space-y-3 mt-4",children:[(()=>{const X=w.at===!1,bt=Hn==="relay"&&G==="at";return m.jsxs("button",{onClick:()=>{X||(W("at"),bn("relay"))},disabled:X,className:`w-full rounded-xl border transition-all duration-200 text-left px-4 py-3 ${X?"border-white/[0.04] opacity-50 cursor-not-allowed":bt?"border-[#AF27E3]/30 bg-white/[0.04]":"border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold text-white/60 uppercase tracking-wider",children:"Free"}),m.jsx("span",{className:`text-[11px] font-medium px-2.5 py-0.5 rounded-full border ${X?"bg-red-500/10 text-red-400 border-red-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"}`,children:X?"Taken":"Available"})]}),m.jsxs("p",{className:`font-mono text-[13px] mt-1.5 ${bt?"text-white/80":"text-white/40"}`,children:["my.fluxy.bot/",dt]})]})})(),(()=>{const j=w.premium,X=j===!1,bt=X&&no.premium;return m.jsxs("div",{className:`rounded-xl border transition-all duration-200 text-left px-4 py-3 ${bt?"border-[#AF27E3]/20":"border-white/[0.06]"}`,children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[12px] font-semibold text-white/60 uppercase tracking-wider",children:"Premium"}),m.jsx("span",{className:"text-[11px] font-medium px-2.5 py-0.5 rounded-full border bg-[#AF27E3]/15 text-[#AF27E3] border-[#AF27E3]/20",children:"$5"})]}),m.jsx("span",{className:`text-[11px] font-medium px-2.5 py-0.5 rounded-full border ${X&&!bt?"bg-red-500/10 text-red-400 border-red-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"}`,children:X&&!bt?"Taken":"Available"})]}),m.jsxs("p",{className:"font-mono text-[13px] mt-1.5 text-white/40",children:["fluxy.bot/",dt]}),j&&m.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06] flex items-center justify-between",children:[m.jsx("p",{className:"text-[12px] text-white/40",children:"Purchase on fluxy.bot"}),m.jsx("a",{href:"https://www.fluxy.bot/#reserve",target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-medium text-[#AF27E3] hover:text-[#c44df7] transition-colors",children:"Purchase"})]}),bt&&m.jsx("div",{className:"mt-3 pt-3 border-t border-[#AF27E3]/10",children:zi?m.jsxs("div",{className:"space-y-2.5",children:[m.jsxs("p",{className:"text-[12px] text-white/40",children:["Enter the 5-character code from your ",m.jsx("span",{className:"text-white/60 font-medium",children:"fluxy.bot"})," account"]}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("input",{type:"text",value:Za,onChange:Re=>Ja(Re.target.value.trim()),maxLength:5,placeholder:"e.g. a3Kx9",spellCheck:!1,autoComplete:"off",autoFocus:!0,className:"flex-1 bg-white/[0.05] border border-white/[0.08] text-white rounded-lg px-3 py-2 text-[13px] font-mono outline-none focus:border-[#AF27E3]/30 transition-colors placeholder:text-white/20 tracking-widest text-center"}),m.jsx("button",{onClick:si,disabled:pe||Za.length<5,className:"px-4 py-2 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-semibold rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-40",children:pe?m.jsx(_n,{className:"h-3.5 w-3.5 animate-spin"}):"Activate"})]}),ao&&m.jsx("p",{className:"text-red-400 text-[12px]",children:ao}),m.jsx("button",{onClick:()=>{Ri(!1),Ja(""),ke("")},className:"text-[11px] text-white/25 hover:text-white/40 transition-colors",children:"Cancel"})]}):m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("p",{className:"text-[12px] text-white/40",children:"Is that yours?"}),m.jsx("button",{onClick:()=>{Ri(!0),Ja(""),ke("")},className:"text-[12px] font-medium text-[#AF27E3] hover:text-[#c44df7] transition-colors",children:"Activate"})]})})]})})(),m.jsxs("button",{onClick:()=>{bn("tunnel"),W("skip")},className:`w-full rounded-xl border transition-all duration-200 text-left px-4 py-3 ${G==="skip"?"border-[#AF27E3]/30 bg-white/[0.04]":"border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:[m.jsx("span",{className:"text-[12px] font-semibold text-white/60 uppercase tracking-wider",children:"No handle"}),m.jsx("p",{className:`text-[13px] mt-1.5 ${G==="skip"?"text-white/60":"text-white/30"}`,children:"I'll use the random tunnel URL"})]})]}),ot&&m.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"}),m.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Handle claimed!"})]}),m.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Ot})]}),k==="ready"&&dt.length>0&&!ot&&m.jsx("button",{onClick:G==="skip"?ze:Hn==="relay"&&G==="at"?Sn?Pl:cn:void 0,disabled:!G||st||me||G==="at"&&!w.at,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed",children:st||me?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-4 w-4 animate-spin"}),Sn?"Changing...":"Claiming..."]}):G?G==="skip"?m.jsxs(m.Fragment,{children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]}):m.jsxs(m.Fragment,{children:[Sn?"Change Handle":"Claim & Continue",m.jsx(qe,{className:"h-4 w-4"})]}):m.jsx(m.Fragment,{children:"Select an option to continue"})}),ot&&m.jsxs("button",{onClick:ze,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]}),Sn&&!ot&&m.jsx("button",{onClick:()=>{Hl(!1),V(be.username),qt(!0),Ge(be.url),W(be.tier),bn("relay"),J(null)},className:"w-full mt-2 py-2 text-white/25 hover:text-white/40 text-[12px] transition-colors",children:"Cancel — keep current handle"})]}),!l&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-5 flex items-center gap-2",children:m.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-medium border ${Ga(Ht)?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:[Ga(Ht)?m.jsx(G1,{className:"h-3 w-3"}):m.jsx(Xc,{className:"h-3 w-3"}),"Accessing via ",xy[Ht]]})}),!Yl&&m.jsxs("button",{onClick:()=>{Ga(Ht)&&(ql(!0),ua(""),wn(""))},disabled:!Ga(Ht),className:`w-full mt-3 flex items-center justify-between px-4 py-3 rounded-xl border transition-all text-left ${Ga(Ht)?"border-white/[0.06] bg-white/[0.02] hover:border-white/10 hover:bg-white/[0.04] cursor-pointer":"border-white/[0.04] bg-transparent opacity-50 cursor-not-allowed"}`,children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-[13px] text-white/70 font-medium",children:"Switch to private network only"}),m.jsx("p",{className:"text-[11px] text-white/30 mt-0.5",children:Ga(Ht)?"Stop the tunnel and relay — access only via Tailscale or LAN":"Connect via Tailscale or private network to unlock"})]}),m.jsx(e0,{className:"h-4 w-4 text-white/30 shrink-0 ml-3"})]}),Yl&&m.jsxs("div",{className:"mt-3 space-y-3",children:[m.jsx("div",{className:"bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(t0,{className:"h-4 w-4 text-amber-400 shrink-0 mt-0.5"}),m.jsxs("div",{children:[m.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Switch to private network only?"}),m.jsx("p",{className:"text-amber-400/60 text-[12px] mt-1 leading-relaxed",children:"This will stop the Cloudflare tunnel and relay connection. Your bot will only be accessible via your private network."}),be&&m.jsx("p",{className:"text-amber-400/50 text-[12px] mt-1.5",children:"Your handle will be preserved and can be re-activated later."})]})]})}),m.jsxs("div",{children:[m.jsxs("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:["Type ",m.jsx("span",{className:"font-mono text-white/60",children:"I confirm"})," to proceed"]}),m.jsx("input",{type:"text",value:ra,onChange:j=>ua(j.target.value),placeholder:"I confirm",spellCheck:!1,autoFocus:!0,className:Il})]}),Fa&&m.jsx("p",{className:"text-red-400/70 text-[12px]",children:Fa}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("button",{onClick:async()=>{if(!(!r||ra.trim().toLowerCase()!=="i confirm")){Tn(!0),wn("");try{await r("off"),Mi("off"),ql(!1)}catch(j){wn(j.message||"Failed to switch")}finally{Tn(!1)}}},disabled:ca||ra.trim().toLowerCase()!=="i confirm"||!r,className:"flex-1 py-2.5 bg-amber-600 hover:bg-amber-500 text-white text-[13px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:ca?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-4 w-4 animate-spin"}),"Switching..."]}):"Confirm Switch"}),m.jsx("button",{onClick:()=>{ql(!1),ua(""),wn("")},disabled:ca,className:"px-5 py-2.5 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Cancel"})]})]})]})]}),h===3&&m.jsx("div",{children:m.jsxs(ly,{mode:"wait",children:[va==="password"&&m.jsxs(Ys.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.15},children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Set a password"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"You'll need this password to access your agent's chat. Keep it safe — anyone with your URL will need it to log in."}),Vt&&m.jsx("div",{className:"mt-4 bg-white/[0.02] border border-white/[0.06] rounded-xl px-4 py-2.5",children:m.jsx("p",{className:"text-white/40 text-[12px]",children:"Password already set. Leave fields empty to keep your current password, or enter your current password to change it."})}),Vt&&m.jsxs("div",{className:"mt-5",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Current password"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"password",value:ha,onChange:j=>{oo(j.target.value),pa(""),Yn(!1)},placeholder:"Enter current password to change it",autoComplete:"current-password",autoFocus:!0,className:Qe+" flex-1"}),ha.length>0&&!on&&m.jsx("button",{onClick:async()=>{qn(!0),pa("");try{(await(await fetch("/api/portal/verify-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:ha})})).json()).valid?Yn(!0):pa("Incorrect password")}catch{pa("Could not verify")}finally{qn(!1)}},disabled:ya,className:"shrink-0 px-4 py-3 bg-white/[0.06] hover:bg-white/[0.1] text-white/60 text-[13px] font-medium rounded-xl transition-colors disabled:opacity-40",children:ya?m.jsx(_n,{className:"h-4 w-4 animate-spin"}):"Verify"}),on&&m.jsx("div",{className:"shrink-0 w-10 h-10 flex items-center justify-center",children:m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"})})]}),ma&&m.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:ma})]}),(!Vt||on)&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:Vt?"mt-3":"mt-5",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:Vt?"New password":"Password"}),m.jsx("input",{type:"password",value:se,onChange:j=>_i(j.target.value),placeholder:"••••••••",autoComplete:"new-password",autoFocus:!Vt,onKeyDown:Xn,className:Qe}),se.length>0&&se.length<6&&m.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"At least 6 characters"})]}),m.jsxs("div",{className:"mt-3",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:Vt?"Confirm new password":"Confirm password"}),m.jsx("input",{type:"password",value:$a,onChange:j=>kl(j.target.value),placeholder:"••••••••",autoComplete:"new-password",onKeyDown:Xn,className:Qe}),$a.length>0&&!Mn&&m.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:"Passwords don't match"})]})]}),m.jsxs("div",{className:"mt-5 border border-white/[0.06] rounded-xl overflow-hidden",children:[m.jsxs("button",{onClick:async()=>{if(Se&&ti){ki(!0);return}if(Se)En(!1),Cn(""),ga(""),Te("");else if(En(!0),Zt(""),Hi(""),Li)un("totp-setup");else try{const j=await fetch("/api/portal/totp/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Vt?ha:se})}),X=await j.json();j.ok?(ga(X.secret),Cn(X.qrDataUri),Te(X.otpauthUri),un("totp-setup")):(Zt(X.error||"Setup failed"),En(!1))}catch{Zt("Could not reach server"),En(!1)}},type:"button",className:"w-full flex items-center gap-3 px-4 py-3 text-left",children:[m.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${Se&&ti?"bg-emerald-500/10":"bg-white/[0.04]"}`,children:Se&&ti?m.jsx(Ip,{className:"h-[18px] w-[18px] text-emerald-400"}):m.jsx(U1,{className:"h-[18px] w-[18px] text-white/30"})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"text-[13px] font-medium text-white block",children:"Two-Factor Auth"}),m.jsx("p",{className:"text-[11px] text-white/30 mt-0.5",children:Se&&ti?m.jsx("span",{className:"text-emerald-400/70",children:"Active — authenticator app required"}):he==="quick"||he==="named"?m.jsx("span",{children:"Recommended for public bots"}):m.jsx("span",{children:"Extra security with an authenticator app"})})]}),m.jsx("div",{className:`w-10 h-6 rounded-full transition-colors relative shrink-0 ${Se?"bg-emerald-500":"bg-white/10"}`,children:m.jsx("div",{className:`absolute top-1 w-4 h-4 rounded-full bg-white shadow transition-transform ${Se?"translate-x-5":"translate-x-1"}`})})]}),ro&&m.jsxs("div",{className:"px-4 pb-3 border-t border-white/[0.06]",children:[m.jsx("p",{className:"text-[12px] text-white/40 mt-3 mb-2",children:"Enter your current TOTP code to disable 2FA:"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:rn,onChange:j=>{Ql(j.target.value.replace(/\D/g,"")),ii("")},placeholder:"000000",className:Il+" flex-1 tracking-[0.3em] text-center font-mono"}),m.jsx("button",{onClick:async()=>{if(rn.length===6)try{const j=await fetch("/api/portal/totp/disable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Vt?ha:se,code:rn})}),X=await j.json();j.ok?(En(!1),ei(!1),ga(""),Cn(""),Te(""),ki(!1),Ql(""),Gi([]),Gn(!1)):ii(X.error||"Failed to disable")}catch{ii("Could not reach server")}},disabled:rn.length!==6,className:"shrink-0 px-4 py-2.5 bg-red-500/10 hover:bg-red-500/20 text-red-400 text-[13px] font-medium rounded-xl transition-colors disabled:opacity-40",children:"Disable"})]}),Zl&&m.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:Zl}),m.jsx("button",{onClick:()=>{ki(!1),Ql(""),ii("")},className:"text-[11px] text-white/30 hover:text-white/50 mt-2",children:"Cancel"})]}),Yi&&va==="password"&&m.jsx("div",{className:"mx-4 mb-3 bg-red-500/8 border border-red-500/15 rounded-xl px-3 py-2",children:m.jsx("p",{className:"text-red-400/90 text-[11px]",children:Yi})})]}),m.jsxs("button",{onClick:ze,disabled:!xa,className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]})]},"password"),va==="totp-setup"&&m.jsxs(Ys.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.15},children:[m.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[m.jsx("button",{onClick:()=>{En(!1),Cn(""),ga(""),Te(""),Hi(""),Zt(""),un("password"),Ki()},className:"w-7 h-7 rounded-full bg-white/[0.04] flex items-center justify-center text-white/40 hover:text-white/70 transition-colors shrink-0",children:m.jsx(v1,{className:"h-4 w-4"})}),m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Set up 2FA"})]}),Yi&&m.jsx("div",{className:"mt-3 bg-red-500/8 border border-red-500/15 rounded-xl px-3 py-2",children:m.jsx("p",{className:"text-red-400/90 text-[11px]",children:Yi})}),Li&&m.jsxs(m.Fragment,{children:[Jl?m.jsxs("div",{className:"mt-4",children:[m.jsx("p",{className:"text-white/40 text-[13px] leading-relaxed mb-4",children:"Add Fluxy to your authenticator app, then enter the 6-digit code below to confirm."}),m.jsx("button",{onClick:()=>{navigator.clipboard.writeText(Bi),Xi(!0),setTimeout(()=>Xi(!1),3e3)},className:`w-full py-3 text-[14px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 ${Ke?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-white/[0.05] text-white/70 hover:bg-white/[0.08] border border-white/[0.08]"}`,children:Ke?m.jsxs(m.Fragment,{children:[m.jsx(Vn,{className:"h-4 w-4"}),"Secret key copied"]}):m.jsxs(m.Fragment,{children:[m.jsx(kc,{className:"h-4 w-4"}),"Copy secret key"]})}),m.jsx("p",{className:"text-[11px] text-white/20 text-center mt-2",children:"Paste it in your authenticator app → Add account → Enter key"}),m.jsxs("a",{href:Ia,onClick:()=>uo(),className:"w-full mt-3 py-2.5 text-[13px] text-white/30 hover:text-white/50 flex items-center justify-center gap-1.5 transition-colors",children:[m.jsx(L1,{className:"h-3.5 w-3.5"}),"Or open directly in authenticator"]})]}):m.jsxs("div",{className:"mt-4 flex gap-4 items-start",children:[m.jsx("div",{className:"shrink-0",children:m.jsx("div",{className:"bg-white rounded-xl p-1.5",children:m.jsx("img",{src:Li,alt:"TOTP QR Code",className:"w-[140px] h-[140px]"})})}),m.jsxs("div",{className:"flex-1 min-w-0 pt-1",children:[m.jsx("p",{className:"text-white/40 text-[13px] leading-relaxed",children:"Scan this QR code with your authenticator app."}),m.jsx("p",{className:"text-white/25 text-[11px] mt-2 leading-relaxed",children:"Google Authenticator, Authy, 1Password, or any TOTP app."}),m.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(Bi)},className:"mt-3 text-[11px] text-white/25 hover:text-white/40 flex items-center gap-1 transition-colors",children:[m.jsx(kc,{className:"h-3 w-3"}),"Copy secret key"]})]})]}),m.jsxs("div",{className:"mt-5",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Enter the 6-digit code from your app"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:oe,onChange:j=>{Hi(j.target.value.replace(/\D/g,"")),Zt("")},placeholder:"000000",autoFocus:!0,className:Qe+" tracking-[0.3em] text-center font-mono flex-1"}),m.jsx("button",{onClick:async()=>{if(oe.length===6){ni(!0),Zt("");try{const j=await fetch("/api/portal/totp/verify-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:oe,password:Vt?ha:se})}),X=await j.json();j.ok&&X.success?(ei(!0),Gi(X.recoveryCodes||[]),un("recovery"),Ki()):Zt(X.error||"Verification failed")}catch{Zt("Could not reach server")}finally{ni(!1)}}},disabled:oe.length!==6||Kl,className:"shrink-0 px-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-xl transition-colors flex items-center gap-2 disabled:opacity-40",children:Kl?m.jsx(_n,{className:"h-4 w-4 animate-spin"}):"Verify"})]})]})]})]},"totp-setup"),va==="recovery"&&m.jsxs(Ys.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.15},children:[m.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[m.jsx("div",{className:"w-9 h-9 rounded-xl bg-emerald-500/10 flex items-center justify-center shrink-0",children:m.jsx(Ip,{className:"h-[18px] w-[18px] text-emerald-400"})}),m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"2FA enabled"}),m.jsx("p",{className:"text-emerald-400/70 text-[12px]",children:"Save your recovery codes"})]})]}),m.jsx("p",{className:"text-white/35 text-[13px] mt-3 leading-relaxed",children:"If you lose your authenticator app, you can use one of these codes to sign in. Each code works once. Store them somewhere safe."}),m.jsx("div",{className:"mt-4 grid grid-cols-2 gap-1.5",children:qi.map((j,X)=>m.jsx("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-2 text-center",children:m.jsx("code",{className:"text-[13px] text-white/60 font-mono tracking-wider",children:j})},X))}),m.jsx("button",{onClick:()=>{navigator.clipboard.writeText(qi.join(`
|
|
17
|
+
`),()=>{P.contains(Q)&&P.removeChild(Q)}},[l]),m.jsx(CT,{isPresent:l,childRef:y,sizeRef:v,pop:h,children:h===!1?a:M.cloneElement(a,{ref:b})})}const NT=({children:a,initial:l,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:h,mode:d,anchorX:y,anchorY:v,root:p})=>{const x=Uf(MT),b=M.useId();let T=!0,z=M.useMemo(()=>(T=!1,{id:b,initial:l,isPresent:o,custom:c,onExitComplete:R=>{x.set(R,!0);for(const H of x.values())if(!H)return;r&&r()},register:R=>(x.set(R,!1),()=>x.delete(R))}),[o,x,r]);return h&&T&&(z={...z}),M.useMemo(()=>{x.forEach((R,H)=>x.set(H,!1))},[o]),M.useEffect(()=>{!o&&!x.size&&r&&r()},[o]),a=m.jsx(jT,{pop:d==="popLayout",isPresent:o,anchorX:y,anchorY:v,root:p,children:a}),m.jsx(Vr.Provider,{value:z,children:a})};function MT(){return new Map}function Jg(a=!0){const l=M.useContext(Vr);if(l===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=l,h=M.useId();M.useEffect(()=>{if(a)return c(h)},[a]);const d=M.useCallback(()=>a&&r&&r(h),[h,r,a]);return!o&&r?[!1,d]:[!0]}const gr=a=>a.key||"";function iy(a){const l=[];return M.Children.forEach(a,o=>{M.isValidElement(o)&&l.push(o)}),l}const ly=({children:a,custom:l,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:h="sync",propagate:d=!1,anchorX:y="left",anchorY:v="top",root:p})=>{const[x,b]=Jg(d),T=M.useMemo(()=>iy(a),[a]),z=d&&!x?[]:T.map(gr),R=M.useRef(!0),H=M.useRef(T),q=Uf(()=>new Map),K=M.useRef(new Set),[Z,Y]=M.useState(T),[Q,P]=M.useState(T);Ty(()=>{R.current=!1,H.current=T;for(let F=0;F<Q.length;F++){const lt=gr(Q[F]);z.includes(lt)?(q.delete(lt),K.current.delete(lt)):q.get(lt)!==!0&&q.set(lt,!1)}},[Q,z.length,z.join("-")]);const it=[];if(T!==Z){let F=[...T];for(let lt=0;lt<Q.length;lt++){const Et=Q[lt],Ut=gr(Et);z.includes(Ut)||(F.splice(lt,0,Et),it.push(Et))}return h==="wait"&&it.length&&(F=it),P(iy(F)),Y(T),null}const{forceRender:tt}=M.useContext(_f);return m.jsx(m.Fragment,{children:Q.map(F=>{const lt=gr(F),Et=d&&!x?!1:T===Q||z.includes(lt),Ut=()=>{if(K.current.has(lt))return;if(K.current.add(lt),q.has(lt))q.set(lt,!0);else return;let wt=!0;q.forEach(xe=>{xe||(wt=!1)}),wt&&(tt?.(),P(H.current),d&&b?.(),r&&r())};return m.jsx(NT,{isPresent:Et,initial:!R.current||o?void 0:!1,custom:l,presenceAffectsLayout:c,mode:h,root:p,onExitComplete:Et?void 0:Ut,anchorX:y,anchorY:v,children:F},lt)})})},Fg=M.createContext({strict:!1}),sy={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let oy=!1;function DT(){if(oy)return;const a={};for(const l in sy)a[l]={isEnabled:o=>sy[l].some(r=>!!o[r])};Ag(a),oy=!0}function Pg(){return DT(),y2()}function OT(a){const l=Pg();for(const o in a)l[o]={...l[o],...a[o]};Ag(l)}const zT=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Rr(a){return a.startsWith("while")||a.startsWith("drag")&&a!=="draggable"||a.startsWith("layout")||a.startsWith("onTap")||a.startsWith("onPan")||a.startsWith("onLayout")||zT.has(a)}let Wg=a=>!Rr(a);function RT(a){typeof a=="function"&&(Wg=l=>l.startsWith("on")?!Rr(l):a(l))}try{RT(require("@emotion/is-prop-valid").default)}catch{}function VT(a,l,o){const r={};for(const c in a)c==="values"&&typeof a.values=="object"||(Wg(c)||o===!0&&Rr(c)||!l&&!Rr(c)||a.draggable&&c.startsWith("onDrag"))&&(r[c]=a[c]);return r}const Br=M.createContext({});function _T(a,l){if(Ur(a)){const{initial:o,animate:r}=a;return{initial:o===!1||Fs(o)?o:void 0,animate:Fs(r)?r:void 0}}return a.inherit!==!1?l:{}}function UT(a){const{initial:l,animate:o}=_T(a,M.useContext(Br));return M.useMemo(()=>({initial:l,animate:o}),[ry(l),ry(o)])}function ry(a){return Array.isArray(a)?a.join(" "):a}const cd=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function $g(a,l,o){for(const r in l)!ve(l[r])&&!Og(r,o)&&(a[r]=l[r])}function BT({transformTemplate:a},l){return M.useMemo(()=>{const o=cd();return od(o,l,a),Object.assign({},o.vars,o.style)},[l])}function LT(a,l){const o=a.style||{},r={};return $g(r,o,a),Object.assign(r,BT(a,l)),r}function HT(a,l){const o={},r=LT(a,l);return a.drag&&a.dragListener!==!1&&(o.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=a.drag===!0?"none":`pan-${a.drag==="x"?"y":"x"}`),a.tabIndex===void 0&&(a.onTap||a.onTapStart||a.whileTap)&&(o.tabIndex=0),o.style=r,o}const Ig=()=>({...cd(),attrs:{}});function YT(a,l,o,r){const c=M.useMemo(()=>{const h=Ig();return zg(h,l,Vg(r),a.transformTemplate,a.style),{...h.attrs,style:{...h.style}}},[l]);if(a.style){const h={};$g(h,a.style,a),c.style={...h,...c.style}}return c}const qT=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fd(a){return typeof a!="string"||a.includes("-")?!1:!!(qT.indexOf(a)>-1||/[A-Z]/u.test(a))}function GT(a,l,o,{latestValues:r},c,h=!1,d){const v=(d??fd(a)?YT:HT)(l,r,c,a),p=VT(l,typeof a=="string",h),x=a!==M.Fragment?{...p,...v,ref:o}:{},{children:b}=l,T=M.useMemo(()=>ve(b)?b.get():b,[b]);return M.createElement(a,{...x,children:T})}function kT({scrapeMotionValuesFromProps:a,createRenderState:l},o,r,c){return{latestValues:XT(o,r,c,a),renderState:l()}}function XT(a,l,o,r){const c={},h=r(a,{});for(const T in h)c[T]=Ar(h[T]);let{initial:d,animate:y}=a;const v=Ur(a),p=Tg(a);l&&p&&!v&&a.inherit!==!1&&(d===void 0&&(d=l.initial),y===void 0&&(y=l.animate));let x=o?o.initial===!1:!1;x=x||d===!1;const b=x?y:d;if(b&&typeof b!="boolean"&&!_r(b)){const T=Array.isArray(b)?b:[b];for(let z=0;z<T.length;z++){const R=If(a,T[z]);if(R){const{transitionEnd:H,transition:q,...K}=R;for(const Z in K){let Y=K[Z];if(Array.isArray(Y)){const Q=x?Y.length-1:0;Y=Y[Q]}Y!==null&&(c[Z]=Y)}for(const Z in H)c[Z]=H[Z]}}}return c}const tv=a=>(l,o)=>{const r=M.useContext(Br),c=M.useContext(Vr),h=()=>kT(a,l,r,c);return o?h():Uf(h)},KT=tv({scrapeMotionValuesFromProps:rd,createRenderState:cd}),QT=tv({scrapeMotionValuesFromProps:_g,createRenderState:Ig}),ZT=Symbol.for("motionComponentSymbol");function JT(a,l,o){const r=M.useRef(o);M.useInsertionEffect(()=>{r.current=o});const c=M.useRef(null);return M.useCallback(h=>{h&&a.onMount?.(h),l&&(h?l.mount(h):l.unmount());const d=r.current;if(typeof d=="function")if(h){const y=d(h);typeof y=="function"&&(c.current=y)}else c.current?(c.current(),c.current=null):d(h);else d&&(d.current=h)},[l])}const ev=M.createContext({});function Cl(a){return a&&typeof a=="object"&&Object.prototype.hasOwnProperty.call(a,"current")}function FT(a,l,o,r,c,h){const{visualElement:d}=M.useContext(Br),y=M.useContext(Fg),v=M.useContext(Vr),p=M.useContext(ud),x=p.reducedMotion,b=p.skipAnimations,T=M.useRef(null),z=M.useRef(!1);r=r||y.renderer,!T.current&&r&&(T.current=r(a,{visualState:l,parent:d,props:o,presenceContext:v,blockInitialAnimation:v?v.initial===!1:!1,reducedMotionConfig:x,skipAnimations:b,isSVG:h}),z.current&&T.current&&(T.current.manuallyAnimateOnMount=!0));const R=T.current,H=M.useContext(ev);R&&!R.projection&&c&&(R.type==="html"||R.type==="svg")&&PT(T.current,o,c,H);const q=M.useRef(!1);M.useInsertionEffect(()=>{R&&q.current&&R.update(o,v)});const K=o[ug],Z=M.useRef(!!K&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(K)&&window.MotionHasOptimisedAnimation?.(K));return Ty(()=>{z.current=!0,R&&(q.current=!0,window.MotionIsMounted=!0,R.updateFeatures(),R.scheduleRenderMicrotask(),Z.current&&R.animationState&&R.animationState.animateChanges())}),M.useEffect(()=>{R&&(!Z.current&&R.animationState&&R.animationState.animateChanges(),Z.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(K)}),Z.current=!1),R.enteringChildren=void 0)}),R}function PT(a,l,o,r){const{layoutId:c,layout:h,drag:d,dragConstraints:y,layoutScroll:v,layoutRoot:p,layoutCrossfade:x}=l;a.projection=new o(a.latestValues,l["data-framer-portal-id"]?void 0:nv(a.parent)),a.projection.setOptions({layoutId:c,layout:h,alwaysMeasureLayout:!!d||y&&Cl(y),visualElement:a,animationType:typeof h=="string"?h:"both",initialPromotionConfig:r,crossfade:x,layoutScroll:v,layoutRoot:p})}function nv(a){if(a)return a.options.allowProjection!==!1?a.projection:nv(a.parent)}function af(a,{forwardMotionProps:l=!1,type:o}={},r,c){r&&OT(r);const h=o?o==="svg":fd(a),d=h?QT:KT;function y(p,x){let b;const T={...M.useContext(ud),...p,layoutId:WT(p)},{isStatic:z}=T,R=UT(p),H=d(p,z);if(!z&&typeof window<"u"){$T();const q=IT(T);b=q.MeasureLayout,R.visualElement=FT(a,H,T,c,q.ProjectionNode,h)}return m.jsxs(Br.Provider,{value:R,children:[b&&R.visualElement?m.jsx(b,{visualElement:R.visualElement,...T}):null,GT(a,p,JT(H,R.visualElement,x),H,z,l,h)]})}y.displayName=`motion.${typeof a=="string"?a:`create(${a.displayName??a.name??""})`}`;const v=M.forwardRef(y);return v[ZT]=a,v}function WT({layoutId:a}){const l=M.useContext(_f).id;return l&&a!==void 0?l+"-"+a:a}function $T(a,l){M.useContext(Fg).strict}function IT(a){const l=Pg(),{drag:o,layout:r}=l;if(!o&&!r)return{};const c={...o,...r};return{MeasureLayout:o?.isEnabled(a)||r?.isEnabled(a)?c.MeasureLayout:void 0,ProjectionNode:c.ProjectionNode}}function tw(a,l){if(typeof Proxy>"u")return af;const o=new Map,r=(h,d)=>af(h,d,a,l),c=(h,d)=>r(h,d);return new Proxy(c,{get:(h,d)=>d==="create"?r:(o.has(d)||o.set(d,af(d,void 0,a,l)),o.get(d))})}const ew=(a,l)=>l.isSVG??fd(a)?new R2(l):new j2(l,{allowProjection:a!==M.Fragment});class nw extends Qa{constructor(l){super(l),l.animationState||(l.animationState=L2(l))}updateAnimationControlsSubscription(){const{animate:l}=this.node.getProps();_r(l)&&(this.unmountControls=l.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:l}=this.node.getProps(),{animate:o}=this.node.prevProps||{};l!==o&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let aw=0;class iw extends Qa{constructor(){super(...arguments),this.id=aw++}update(){if(!this.node.presenceContext)return;const{isPresent:l,onExitComplete:o}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||l===r)return;const c=this.node.animationState.setActive("exit",!l);o&&!l&&c.then(()=>{o(this.id)})}mount(){const{register:l,onExitComplete:o}=this.node.presenceContext||{};o&&o(this.id),l&&(this.unmount=l(this.id))}unmount(){}}const lw={animation:{Feature:nw},exit:{Feature:iw}};function to(a){return{point:{x:a.pageX,y:a.pageY}}}const sw=a=>l=>ad(l)&&a(l,to(l));function Ks(a,l,o,r){return Ps(a,l,sw(o),r)}const av=({current:a})=>a?a.ownerDocument.defaultView:null,uy=(a,l)=>Math.abs(a-l);function ow(a,l){const o=uy(a.x,l.x),r=uy(a.y,l.y);return Math.sqrt(o**2+r**2)}const cy=new Set(["auto","scroll"]);class iv{constructor(l,o,{transformPagePoint:r,contextWindow:c=window,dragSnapToOrigin:h=!1,distanceThreshold:d=3,element:y}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=z=>{this.handleScroll(z.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const z=sf(this.lastMoveEventInfo,this.history),R=this.startEvent!==null,H=ow(z.offset,{x:0,y:0})>=this.distanceThreshold;if(!R&&!H)return;const{point:q}=z,{timestamp:K}=de;this.history.push({...q,timestamp:K});const{onStart:Z,onMove:Y}=this.handlers;R||(Z&&Z(this.lastMoveEvent,z),this.startEvent=this.lastMoveEvent),Y&&Y(this.lastMoveEvent,z)},this.handlePointerMove=(z,R)=>{this.lastMoveEvent=z,this.lastMoveEventInfo=lf(R,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(z,R)=>{this.end();const{onEnd:H,onSessionEnd:q,resumeAnimation:K}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&K&&K(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const Z=sf(z.type==="pointercancel"?this.lastMoveEventInfo:lf(R,this.transformPagePoint),this.history);this.startEvent&&H&&H(z,Z),q&&q(z,Z)},!ad(l))return;this.dragSnapToOrigin=h,this.handlers=o,this.transformPagePoint=r,this.distanceThreshold=d,this.contextWindow=c||window;const v=to(l),p=lf(v,this.transformPagePoint),{point:x}=p,{timestamp:b}=de;this.history=[{...x,timestamp:b}];const{onSessionStart:T}=o;T&&T(l,sf(p,this.history)),this.removeListeners=Ws(Ks(this.contextWindow,"pointermove",this.handlePointerMove),Ks(this.contextWindow,"pointerup",this.handlePointerUp),Ks(this.contextWindow,"pointercancel",this.handlePointerUp)),y&&this.startScrollTracking(y)}startScrollTracking(l){let o=l.parentElement;for(;o;){const r=getComputedStyle(o);(cy.has(r.overflowX)||cy.has(r.overflowY))&&this.scrollPositions.set(o,{x:o.scrollLeft,y:o.scrollTop}),o=o.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(l){const o=this.scrollPositions.get(l);if(!o)return;const r=l===window,c=r?{x:window.scrollX,y:window.scrollY}:{x:l.scrollLeft,y:l.scrollTop},h={x:c.x-o.x,y:c.y-o.y};h.x===0&&h.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=h.x,this.lastMoveEventInfo.point.y+=h.y):this.history.length>0&&(this.history[0].x-=h.x,this.history[0].y-=h.y),this.scrollPositions.set(l,c),_t.update(this.updatePoint,!0))}updateHandlers(l){this.handlers=l}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ka(this.updatePoint)}}function lf(a,l){return l?{point:l(a.point)}:a}function fy(a,l){return{x:a.x-l.x,y:a.y-l.y}}function sf({point:a},l){return{point:a,delta:fy(a,lv(l)),offset:fy(a,rw(l)),velocity:uw(l,.1)}}function rw(a){return a[0]}function lv(a){return a[a.length-1]}function uw(a,l){if(a.length<2)return{x:0,y:0};let o=a.length-1,r=null;const c=lv(a);for(;o>=0&&(r=a[o],!(c.timestamp-r.timestamp>gn(l)));)o--;if(!r)return{x:0,y:0};r===a[0]&&a.length>2&&c.timestamp-r.timestamp>gn(l)*2&&(r=a[1]);const h=en(c.timestamp-r.timestamp);if(h===0)return{x:0,y:0};const d={x:(c.x-r.x)/h,y:(c.y-r.y)/h};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}function cw(a,{min:l,max:o},r){return l!==void 0&&a<l?a=r?Gt(l,a,r.min):Math.max(a,l):o!==void 0&&a>o&&(a=r?Gt(o,a,r.max):Math.min(a,o)),a}function dy(a,l,o){return{min:l!==void 0?a.min+l:void 0,max:o!==void 0?a.max+o-(a.max-a.min):void 0}}function fw(a,{top:l,left:o,bottom:r,right:c}){return{x:dy(a.x,o,c),y:dy(a.y,l,r)}}function hy(a,l){let o=l.min-a.min,r=l.max-a.max;return l.max-l.min<a.max-a.min&&([o,r]=[r,o]),{min:o,max:r}}function dw(a,l){return{x:hy(a.x,l.x),y:hy(a.y,l.y)}}function hw(a,l){let o=.5;const r=Ee(a),c=Ee(l);return c>r?o=Qs(l.min,l.max-r,a.min):r>c&&(o=Qs(a.min,a.max-c,l.min)),Ln(0,1,o)}function mw(a,l){const o={};return l.min!==void 0&&(o.min=l.min-a.min),l.max!==void 0&&(o.max=l.max-a.min),o}const zf=.35;function pw(a=zf){return a===!1?a=0:a===!0&&(a=zf),{x:my(a,"left","right"),y:my(a,"top","bottom")}}function my(a,l,o){return{min:py(a,l),max:py(a,o)}}function py(a,l){return typeof a=="number"?a:a[l]||0}const yw=new WeakMap;class gw{constructor(l){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ne(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=l}start(l,{snapToCursor:o=!1,distanceThreshold:r}={}){const{presenceContext:c}=this.visualElement;if(c&&c.isPresent===!1)return;const h=b=>{o&&this.snapToCursor(to(b).point),this.stopAnimation()},d=(b,T)=>{const{drag:z,dragPropagation:R,onDragStart:H}=this.getProps();if(z&&!R&&(this.openDragLock&&this.openDragLock(),this.openDragLock=QS(z),!this.openDragLock))return;this.latestPointerEvent=b,this.latestPanInfo=T,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Un(K=>{let Z=this.getAxisMotionValue(K).get()||0;if(Bn.test(Z)){const{projection:Y}=this.visualElement;if(Y&&Y.layout){const Q=Y.layout.layoutBox[K];Q&&(Z=Ee(Q)*(parseFloat(Z)/100))}}this.originPoint[K]=Z}),H&&_t.update(()=>H(b,T),!1,!0),wf(this.visualElement,"transform");const{animationState:q}=this.visualElement;q&&q.setActive("whileDrag",!0)},y=(b,T)=>{this.latestPointerEvent=b,this.latestPanInfo=T;const{dragPropagation:z,dragDirectionLock:R,onDirectionLock:H,onDrag:q}=this.getProps();if(!z&&!this.openDragLock)return;const{offset:K}=T;if(R&&this.currentDirection===null){this.currentDirection=xw(K),this.currentDirection!==null&&H&&H(this.currentDirection);return}this.updateAxis("x",T.point,K),this.updateAxis("y",T.point,K),this.visualElement.render(),q&&_t.update(()=>q(b,T),!1,!0)},v=(b,T)=>{this.latestPointerEvent=b,this.latestPanInfo=T,this.stop(b,T),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>{const{dragSnapToOrigin:b}=this.getProps();(b||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:x}=this.getProps();this.panSession=new iv(l,{onSessionStart:h,onStart:d,onMove:y,onSessionEnd:v,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:x,distanceThreshold:r,contextWindow:av(this.visualElement),element:this.visualElement.current})}stop(l,o){const r=l||this.latestPointerEvent,c=o||this.latestPanInfo,h=this.isDragging;if(this.cancel(),!h||!c||!r)return;const{velocity:d}=c;this.startAnimation(d);const{onDragEnd:y}=this.getProps();y&&_t.postRender(()=>y(r,c))}cancel(){this.isDragging=!1;const{projection:l,animationState:o}=this.visualElement;l&&(l.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(l,o,r){const{drag:c}=this.getProps();if(!r||!vr(l,c,this.currentDirection))return;const h=this.getAxisMotionValue(l);let d=this.originPoint[l]+r[l];this.constraints&&this.constraints[l]&&(d=cw(d,this.constraints[l],this.elastic[l])),h.set(d)}resolveConstraints(){const{dragConstraints:l,dragElastic:o}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,c=this.constraints;l&&Cl(l)?this.constraints||(this.constraints=this.resolveRefConstraints()):l&&r?this.constraints=fw(r.layoutBox,l):this.constraints=!1,this.elastic=pw(o),c!==this.constraints&&!Cl(l)&&r&&this.constraints&&!this.hasMutatedConstraints&&Un(h=>{this.constraints!==!1&&this.getAxisMotionValue(h)&&(this.constraints[h]=mw(r.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:l,onMeasureDragConstraints:o}=this.getProps();if(!l||!Cl(l))return!1;const r=l.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const h=S2(r,c.root,this.visualElement.getTransformPagePoint());let d=dw(c.layout.layoutBox,h);if(o){const y=o(v2(d));this.hasMutatedConstraints=!!y,y&&(d=Cg(y))}return d}startAnimation(l){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:h,dragSnapToOrigin:d,onDragTransitionEnd:y}=this.getProps(),v=this.constraints||{},p=Un(x=>{if(!vr(x,o,this.currentDirection))return;let b=v&&v[x]||{};d&&(b={min:0,max:0});const T=c?200:1e6,z=c?40:1e7,R={type:"inertia",velocity:r?l[x]:0,bounceStiffness:T,bounceDamping:z,timeConstant:750,restDelta:1,restSpeed:10,...h,...b};return this.startAxisValueAnimation(x,R)});return Promise.all(p).then(y)}startAxisValueAnimation(l,o){const r=this.getAxisMotionValue(l);return wf(this.visualElement,l),r.start($f(l,r,0,o,this.visualElement,!1))}stopAnimation(){Un(l=>this.getAxisMotionValue(l).stop())}getAxisMotionValue(l){const o=`_drag${l.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(l,(r.initial?r.initial[l]:void 0)||0)}snapToCursor(l){Un(o=>{const{drag:r}=this.getProps();if(!vr(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,h=this.getAxisMotionValue(o);if(c&&c.layout){const{min:d,max:y}=c.layout.layoutBox[o],v=h.get()||0;h.set(l[o]-Gt(d,y,.5)+v)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:l,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Cl(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Un(d=>{const y=this.getAxisMotionValue(d);if(y&&this.constraints!==!1){const v=y.get();c[d]=hw({min:v,max:v},this.constraints[d])}});const{transformTemplate:h}=this.visualElement.getProps();this.visualElement.current.style.transform=h?h({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Un(d=>{if(!vr(d,l,null))return;const y=this.getAxisMotionValue(d),{min:v,max:p}=this.constraints[d];y.set(Gt(v,p,c[d]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;yw.set(this.visualElement,this);const l=this.visualElement.current,o=Ks(l,"pointerdown",p=>{const{drag:x,dragListener:b=!0}=this.getProps(),T=p.target,z=T!==l&&$S(T);x&&b&&!z&&this.start(p)});let r;const c=()=>{const{dragConstraints:p}=this.getProps();Cl(p)&&p.current&&(this.constraints=this.resolveRefConstraints(),r||(r=vw(l,p.current,()=>this.scalePositionWithinConstraints())))},{projection:h}=this.visualElement,d=h.addEventListener("measure",c);h&&!h.layout&&(h.root&&h.root.updateScroll(),h.updateLayout()),_t.read(c);const y=Ps(window,"resize",()=>this.scalePositionWithinConstraints()),v=h.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:x})=>{this.isDragging&&x&&(Un(b=>{const T=this.getAxisMotionValue(b);T&&(this.originPoint[b]+=p[b].translate,T.set(T.get()+p[b].translate))}),this.visualElement.render())}));return()=>{y(),o(),d(),v&&v(),r&&r()}}getProps(){const l=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:h=!1,dragElastic:d=zf,dragMomentum:y=!0}=l;return{...l,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:h,dragElastic:d,dragMomentum:y}}}function yy(a){let l=!0;return()=>{if(l){l=!1;return}a()}}function vw(a,l,o){const r=T0(a,yy(o)),c=T0(l,yy(o));return()=>{r(),c()}}function vr(a,l,o){return(l===!0||l===a)&&(o===null||o===a)}function xw(a,l=10){let o=null;return Math.abs(a.y)>l?o="y":Math.abs(a.x)>l&&(o="x"),o}class bw extends Qa{constructor(l){super(l),this.removeGroupControls=nn,this.removeListeners=nn,this.controls=new gw(l)}mount(){const{dragControls:l}=this.node.getProps();l&&(this.removeGroupControls=l.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||nn}update(){const{dragControls:l}=this.node.getProps(),{dragControls:o}=this.node.prevProps||{};l!==o&&(this.removeGroupControls(),l&&(this.removeGroupControls=l.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const of=a=>(l,o)=>{a&&_t.update(()=>a(l,o),!1,!0)};class Sw extends Qa{constructor(){super(...arguments),this.removePointerDownListener=nn}onPointerDown(l){this.session=new iv(l,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:av(this.node)})}createPanHandlers(){const{onPanSessionStart:l,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:of(l),onStart:of(o),onMove:of(r),onEnd:(h,d)=>{delete this.session,c&&_t.postRender(()=>c(h,d))}}}mount(){this.removePointerDownListener=Ks(this.node.current,"pointerdown",l=>this.onPointerDown(l))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let rf=!1;class Tw extends M.Component{componentDidMount(){const{visualElement:l,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:h}=l;h&&(o.group&&o.group.add(h),r&&r.register&&c&&r.register(h),rf&&h.root.didUpdate(),h.addEventListener("animationComplete",()=>{this.safeToRemove()}),h.setOptions({...h.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Er.hasEverUpdated=!0}getSnapshotBeforeUpdate(l){const{layoutDependency:o,visualElement:r,drag:c,isPresent:h}=this.props,{projection:d}=r;return d&&(d.isPresent=h,l.layoutDependency!==o&&d.setOptions({...d.options,layoutDependency:o}),rf=!0,c||l.layoutDependency!==o||o===void 0||l.isPresent!==h?d.willUpdate():this.safeToRemove(),l.isPresent!==h&&(h?d.promote():d.relegate()||_t.postRender(()=>{const y=d.getStack();(!y||!y.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:l}=this.props.visualElement;l&&(l.root.didUpdate(),nd.postRender(()=>{!l.currentAnimation&&l.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:l,layoutGroup:o,switchLayoutGroup:r}=this.props,{projection:c}=l;rf=!0,c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:l}=this.props;l&&l()}render(){return null}}function sv(a){const[l,o]=Jg(),r=M.useContext(_f);return m.jsx(Tw,{...a,layoutGroup:r,switchLayoutGroup:M.useContext(ev),isPresent:l,safeToRemove:o})}const ww={pan:{Feature:Sw},drag:{Feature:bw,ProjectionNode:Zg,MeasureLayout:sv}};function gy(a,l,o){const{props:r}=a;a.animationState&&r.whileHover&&a.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,h=r[c];h&&_t.postRender(()=>h(l,to(l)))}class Aw extends Qa{mount(){const{current:l}=this.node;l&&(this.unmount=JS(l,(o,r)=>(gy(this.node,r,"Start"),c=>gy(this.node,c,"End"))))}unmount(){}}class Ew extends Qa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let l=!1;try{l=this.node.current.matches(":focus-visible")}catch{l=!0}!l||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ws(Ps(this.node.current,"focus",()=>this.onFocus()),Ps(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function vy(a,l,o){const{props:r}=a;if(a.current instanceof HTMLButtonElement&&a.current.disabled)return;a.animationState&&r.whileTap&&a.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),h=r[c];h&&_t.postRender(()=>h(l,to(l)))}class Cw extends Qa{mount(){const{current:l}=this.node;if(!l)return;const{globalTapTarget:o,propagate:r}=this.node.props;this.unmount=t2(l,(c,h)=>(vy(this.node,h,"Start"),(d,{success:y})=>vy(this.node,d,y?"End":"Cancel")),{useGlobalTarget:o,stopPropagation:r?.tap===!1})}unmount(){}}const Rf=new WeakMap,uf=new WeakMap,jw=a=>{const l=Rf.get(a.target);l&&l(a)},Nw=a=>{a.forEach(jw)};function Mw({root:a,...l}){const o=a||document;uf.has(o)||uf.set(o,{});const r=uf.get(o),c=JSON.stringify(l);return r[c]||(r[c]=new IntersectionObserver(Nw,{root:a,...l})),r[c]}function Dw(a,l,o){const r=Mw(l);return Rf.set(a,o),r.observe(a),()=>{Rf.delete(a),r.unobserve(a)}}const Ow={some:0,all:1};class zw extends Qa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:l={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:h}=l,d={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:Ow[c]},y=v=>{const{isIntersecting:p}=v;if(this.isInView===p||(this.isInView=p,h&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:x,onViewportLeave:b}=this.node.getProps(),T=p?x:b;T&&T(v)};return Dw(this.node.current,d,y)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:l,prevProps:o}=this.node;["amount","margin","root"].some(Rw(l,o))&&this.startObserver()}unmount(){}}function Rw({viewport:a={}},{viewport:l={}}={}){return o=>a[o]!==l[o]}const Vw={inView:{Feature:zw},tap:{Feature:Cw},focus:{Feature:Ew},hover:{Feature:Aw}},_w={layout:{ProjectionNode:Zg,MeasureLayout:sv}},Uw={...lw,...Vw,...ww,..._w},Ys=tw(Uw,ew);function Bw(a){const l=a.match(/^100\.(\d+)\./);if(l&&+l[1]>=64&&+l[1]<=127)return"tailscale";if(/^192\.168\./.test(a)||/^10\./.test(a))return"lan";const o=a.match(/^172\.(\d+)\./);return o&&+o[1]>=16&&+o[1]<=31?"lan":a==="localhost"||a==="127.0.0.1"?"localhost":a.endsWith(".trycloudflare.com")?"tunnel":a.endsWith(".fluxy.bot")?"relay":"custom-domain"}function Ga(a){return a==="tailscale"||a==="lan"||a==="localhost"}const xy={tailscale:"Tailscale",lan:"Local network",localhost:"Localhost",tunnel:"Cloudflare tunnel",relay:"Relay","custom-domain":"Custom domain"},Lw=[{id:"anthropic",name:"Claude",subtitle:"by Anthropic",icon:"/icons/claude.png"},{id:"openai",name:"OpenAI Codex",subtitle:"ChatGPT Plus / Pro",icon:"/icons/codex.png"}],Hw={anthropic:[{id:"claude-opus-4-6",label:"Opus 4.6"},{id:"claude-sonnet-4-6",label:"Sonnet 4.6"},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5"}],openai:[{id:"gpt-5.2-codex:medium",label:"GPT-5.2 Codex Medium"},{id:"gpt-5.2-codex:high",label:"GPT-5.2 Codex High"},{id:"gpt-5.2-codex:xhigh",label:"GPT-5.2 Codex Extra High"},{id:"gpt-5.3-codex:medium",label:"GPT-5.3 Codex Medium (Pro)"},{id:"gpt-5.3-codex:high",label:"GPT-5.3 Codex High (Pro)"},{id:"gpt-5.3-codex:xhigh",label:"GPT-5.3 Codex Extra High (Pro)"}]};function Yw({models:a,value:l,onChange:o}){const[r,c]=M.useState(!1),h=M.useRef(null);M.useEffect(()=>{if(!r)return;const y=v=>{h.current&&!h.current.contains(v.target)&&c(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]);const d=a.find(y=>y.id===l);return m.jsxs("div",{className:"relative",ref:h,children:[m.jsxs("button",{type:"button",onClick:()=>c(y=>!y),className:"w-full flex items-center justify-between bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none hover:border-white/15 focus:border-[#AF27E3]/30 transition-colors",children:[m.jsx("span",{className:d?"text-white":"text-white/20",children:d?d.label:"Choose a model..."}),m.jsx(T1,{className:`h-4 w-4 text-white/30 transition-transform ${r?"rotate-180":""}`})]}),r&&m.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#222] border border-white/[0.08] rounded-xl shadow-xl py-1 z-10 max-h-48 overflow-y-auto",children:a.map(y=>m.jsx("button",{onClick:()=>{o(y.id),c(!1)},className:`w-full text-left px-4 py-2 text-[13px] transition-colors ${l===y.id?"text-[#AF27E3] bg-[#AF27E3]/10":"text-white/70 hover:bg-white/[0.04] hover:text-white"}`,children:y.label},y.id))})]})}function Xw({onComplete:a,isInitialSetup:l=!1,onSave:o,onTunnelSwitch:r}){const c=l?7:6,[h,d]=M.useState(0),[y,v]=M.useState(""),[p,x]=M.useState("anthropic"),[b,T]=M.useState(""),[z,R]=M.useState(!1),[H,q]=M.useState({anthropic:"idle",openai:"idle"}),[K,Z]=M.useState(!1),[Y,Q]=M.useState(""),[P,it]=M.useState(!1),[tt,F]=M.useState(),[lt,Et]=M.useState(!1),[Ut,wt]=M.useState(!1),[xe,le]=M.useState(),[dt,V]=M.useState(""),[k,J]=M.useState(null),[rt,ct]=M.useState(""),[w,B]=M.useState({}),[G,W]=M.useState(""),[st,mt]=M.useState(!1),[ot,qt]=M.useState(!1),[Ot,Ge]=M.useState(""),xn=M.useRef(null),[he,Mi]=M.useState("quick"),[an,Bl]=M.useState(""),[Ll,Lr]=M.useState(""),[Hn,bn]=M.useState("relay"),[be,Di]=M.useState(null),[Sn,Hl]=M.useState(!1),[me,eo]=M.useState(!1),[no,Oi]=M.useState({}),[zi,Ri]=M.useState(!1),[Za,Ja]=M.useState(""),[ao,ke]=M.useState(""),[pe,ln]=M.useState(!1),[Ht,Hr]=M.useState("tunnel"),[Yl,ql]=M.useState(!1),[ra,ua]=M.useState(""),[ca,Tn]=M.useState(!1),[Fa,wn]=M.useState(""),[Gl,Vi]=M.useState(!1),[Pa,fa]=M.useState(!1),[io,Wa]=M.useState(""),[lo,so]=M.useState("admin"),[se,_i]=M.useState(""),[$a,kl]=M.useState(""),[sn,kt]=M.useState(!1),[Vt,da]=M.useState(!1),[Ui,Yr]=M.useState(!1),[ha,oo]=M.useState(""),[ma,pa]=M.useState(""),[on,Yn]=M.useState(!1),[ya,qn]=M.useState(!1),[zt,Xl]=M.useState(!1),[Xe,An]=M.useState(""),[Se,En]=M.useState(!1),[Bi,ga]=M.useState(""),[Li,Cn]=M.useState(""),[Ia,Te]=M.useState(""),[oe,Hi]=M.useState(""),[ti,ei]=M.useState(!1),[Kl,ni]=M.useState(!1),[Yi,Zt]=M.useState(""),[qi,Gi]=M.useState([]),[ai,Gn]=M.useState(!1),[ro,ki]=M.useState(!1),[rn,Ql]=M.useState(""),[Zl,ii]=M.useState(""),[Jl,qr]=M.useState(!1),[va,un]=M.useState("password"),[Ke,Xi]=M.useState(!1),li=M.useRef(!1),Ce=H[p]==="connected",jn="fluxy_totp_setup";function uo(){try{sessionStorage.setItem(jn,JSON.stringify({secret:Bi,qrUri:Li,otpauthUri:Ia,phase:va,portalPass:se,portalPassConfirm:$a}))}catch{}}function Fl(){try{const j=sessionStorage.getItem(jn);if(!j)return!1;const X=JSON.parse(j);if(X.secret&&X.phase==="totp-setup")return ga(X.secret),Cn(X.qrUri||""),Te(X.otpauthUri||""),En(!0),un("totp-setup"),d(3),X.portalPass&&(_i(X.portalPass),kl(X.portalPassConfirm||"")),!0}catch{}return!1}function Ki(){try{sessionStorage.removeItem(jn)}catch{}}M.useEffect(()=>{fetch("/api/onboard/status").then(j=>j.json()).then(j=>{j.userName&&v(j.userName),j.handle&&(V(j.handle.username),W(j.handle.tier||"at"),Di({username:j.handle.username,tier:j.handle.tier,url:j.handle.url}),qt(!0),Ge(j.handle.url)),j.portalUser&&so(j.portalUser),j.portalConfigured&&da(!0),j.provider&&x(j.provider),j.model&&T(j.model),j.whisperEnabled&&(Xl(!0),An(j.whisperKey||"")),j.totpEnabled&&(En(!0),ei(!0)),j.tunnelMode&&Mi(j.tunnelMode),j.tunnelDomain&&Bl(j.tunnelDomain),j.tunnelUrl&&Lr(j.tunnelUrl),j.handle||bn("tunnel"),li.current=!0,j.totpEnabled||Fl()}).catch(()=>{li.current=!0})},[]),M.useEffect(()=>{Hr(Bw(window.location.hostname))},[]),M.useEffect(()=>{qr(window.matchMedia("(max-width: 768px)").matches||"ontouchstart"in window)},[]),M.useEffect(()=>{p!=="anthropic"||H.anthropic==="connected"||fetch("/api/auth/claude/status").then(j=>j.json()).then(j=>{j.authenticated&&q(X=>({...X,anthropic:"connected"}))}).catch(()=>{})},[p]),M.useEffect(()=>{p!=="openai"||H.openai==="connected"||fetch("/api/auth/codex/status").then(j=>j.json()).then(j=>{j.authenticated&&q(X=>({...X,openai:"connected"}))}).catch(()=>{})},[p]),M.useEffect(()=>{if(!Ut)return;const j=setInterval(async()=>{try{(await(await fetch("/api/auth/codex/status")).json()).authenticated&&(wt(!1),q(Re=>({...Re,openai:"connected"})))}catch{}},2e3);return()=>clearInterval(j)},[Ut]),M.useEffect(()=>{if(xn.current&&clearTimeout(xn.current),!li.current||he==="off"||be&&ot&&dt===be.username)return;J(null),ct(""),B({}),Oi({}),Ri(!1),Ja(""),ke(""),qt(!1),Ge("");const j=dt.trim();if(j){if(j.length<3){J("invalid"),ct("At least 3 characters");return}return J("checking"),xn.current=setTimeout(async()=>{try{const bt=await(await fetch(`/api/handle/check/${encodeURIComponent(j)}`)).json();if(!bt.valid)J("invalid"),ct(bt.error);else{const Re={},Kn={};for(const fn of bt.handles)Re[fn.tier]=fn.available,fn.reserved&&(Kn[fn.tier]=!0);B(Re),Oi(Kn),J("ready"),W("")}}catch{J(null)}},400),()=>{xn.current&&clearTimeout(xn.current)}}},[dt]),M.useEffect(()=>{if(!dt||dt.length<3||k!=="ready")return;const j=async()=>{try{const bt=await(await fetch(`/api/handle/check/${encodeURIComponent(dt.trim())}`)).json();if(bt.valid){const Re={},Kn={};for(const fn of bt.handles)Re[fn.tier]=fn.available,fn.reserved&&(Kn[fn.tier]=!0);B(Re),Oi(Kn)}}catch{}};return window.addEventListener("focus",j),()=>window.removeEventListener("focus",j)},[dt,k]);const kn=j=>{V(j.toLowerCase().replace(/[^a-z0-9-]/g,""))},cn=async()=>{if(!(!dt||k!=="ready"||!w[G])){mt(!0);try{const X=await(await fetch("/api/handle/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:dt,tier:G})})).json();X.ok?(qt(!0),Ge(X.url)):(ct(X.error||"Registration failed"),J("invalid"))}catch{ct("Could not reach server"),J("invalid")}finally{mt(!1)}}},Pl=async()=>{if(!(!dt||k!=="ready"||!w[G])){eo(!0);try{const X=await(await fetch("/api/handle/change",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:dt,tier:G})})).json();X.ok?(qt(!0),Ge(X.url),Di({username:dt,tier:G,url:X.url}),Hl(!1)):(ct(X.error||"Handle change failed"),J("invalid"))}catch{ct("Could not reach server"),J("invalid")}finally{eo(!1)}}},si=async()=>{if(!(!dt||!Za)){ln(!0),ke("");try{const X=await(await fetch("/api/handle/claim-reserved",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:dt,hash:Za})})).json();X.ok?(qt(!0),Ge(X.url),Ri(!1),Ja(""),W("premium"),bn("relay")):ke(X.error||"Invalid activation code")}catch{ke("Could not reach server")}finally{ln(!1)}}},Nn=j=>{p==="openai"&&j!=="openai"&&Ut&&(fetch("/api/auth/codex/cancel",{method:"POST"}),wt(!1)),x(j),T(""),Z(!1),Q(""),F(void 0),wt(!1),le(void 0)},Qi=j=>{if(window.matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0){const bt=document.createElement("a");bt.href=j,bt.target="_blank",bt.rel="noopener noreferrer",document.body.appendChild(bt),bt.click(),document.body.removeChild(bt)}else window.open(j,"_blank","noopener,noreferrer")},Zi=async()=>{F(void 0);try{const X=await(await fetch("/api/auth/claude/start",{method:"POST"})).json();X.success&&X.authUrl?(Qi(X.authUrl),Z(!0)):F(X.error||"Failed to start authentication")}catch(j){F(j.message)}},Wl=async()=>{if(Y.trim()){it(!0),F(void 0);try{const X=await(await fetch("/api/auth/claude/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:Y.trim()})})).json();X.success?q(bt=>({...bt,anthropic:"connected"})):F(X.error||"Code exchange failed")}catch(j){F(j.message)}finally{it(!1)}}},Ji=async()=>{try{const j=await navigator.clipboard.readText();j&&Q(j.trim())}catch{}},Fi=async()=>{Et(!0),F(void 0);try{(await(await fetch("/api/auth/claude/status")).json()).authenticated?q(bt=>({...bt,anthropic:"connected"})):F("No active session found. Please authenticate first.")}catch{}finally{Et(!1)}},co=async()=>{wt(!0),le(void 0);try{const X=await(await fetch("/api/auth/codex/start",{method:"POST"})).json();X.success&&X.authUrl?Qi(X.authUrl):(wt(!1),le(X.error||"Failed to start authentication"))}catch(j){wt(!1),le(j.message)}},ye=()=>{wt(!1),fetch("/api/auth/codex/cancel",{method:"POST"})},Mn=se===$a,oi=se.length>=6&&Mn,ri=Vt?se.length===0||on&&oi:oi,xa=(()=>{switch(h){case 0:return!0;case 1:return y.trim().length>0;case 2:return Yl||Gl?!1:he==="off"||he==="named"||Hn==="tunnel"?dt.trim().length>=3:ot;case 3:return!(va!=="password"||!ri||Se&&!ti);case 4:return!!(p&&b&&Ce);case 5:return!0;default:return!1}})(),ze=()=>{xa&&h<c-1&&d(j=>j+1)},$l=()=>{h>0&&d(j=>j-1)},Xn=j=>{j.key==="Enter"&&xa&&ze()},Pi=async()=>{R(!0);const j={userName:y.trim(),agentName:dt.trim()||"Fluxy",provider:p,model:b,apiKey:"",whisperEnabled:zt,whisperKey:zt?Xe:"",portalUser:lo.trim(),portalPass:se};try{o?await o(j):await fetch("/api/onboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)}),l?(R(!1),d(6)):a()}catch(X){console.error("[OnboardWizard] Onboard failed:",X),R(!1)}},Qe="w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all",Il="w-full bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none input-glow placeholder:text-white/20 transition-all";return m.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4",children:[m.jsx("div",{className:"absolute inset-0 bg-black/85 backdrop-blur-md"}),m.jsxs(Ys.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.3},className:"relative w-full max-w-[480px] bg-[#181818] border border-white/[0.06] rounded-[24px] shadow-2xl overflow-hidden",children:[m.jsx("div",{className:"flex justify-center gap-2 pt-6",children:Array.from({length:c},(j,X)=>m.jsx("div",{className:`h-1.5 rounded-full transition-all duration-300 ${X===h?"w-7 bg-gradient-brand":X<h?"w-1.5 bg-gradient-brand opacity-60":"w-1.5 bg-white/10"}`},X))}),m.jsx(ly,{mode:"wait",children:m.jsxs(Ys.div,{initial:{opacity:0,x:30},animate:{opacity:1,x:0},exit:{opacity:0,x:-30},transition:{duration:.2,ease:"easeOut"},className:"px-8 pt-6 pb-8",children:[h===0&&m.jsxs("div",{className:"flex flex-col items-center text-center",children:[m.jsxs("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"h-[180px] mb-4",children:[m.jsx("source",{src:"/fluxy_say_hi.mov",type:'video/mp4; codecs="hvc1"'}),m.jsx("source",{src:"/fluxy_say_hi.webm",type:"video/webm"})]}),m.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Welcome to Fluxy"}),m.jsx("p",{className:"text-white/40 text-[14px] mt-2 leading-relaxed max-w-[320px]",children:"Let's set up your AI assistant in just a few steps."}),m.jsxs("button",{onClick:ze,className:"mt-6 px-7 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center gap-2",children:["Get Started",m.jsx(qe,{className:"h-4 w-4"})]})]}),h===1&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"What's your name?"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is how your agent will address you."}),m.jsxs("div",{className:"mt-5 flex items-center gap-3",children:[m.jsx("input",{type:"text",value:y,onChange:j=>v(j.target.value),onKeyDown:Xn,placeholder:"Enter your name",autoFocus:!0,autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",className:Qe+" flex-1"}),m.jsx("button",{onClick:ze,disabled:!xa,className:"shrink-0 h-12 w-12 flex items-center justify-center rounded-full bg-gradient-brand hover:opacity-90 text-white transition-colors disabled:opacity-30",children:m.jsx(qe,{className:"h-5 w-5"})})]})]}),h===2&&he==="off"&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Bot Name & Access"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"Give your bot a name. This is used throughout the app as your bot's identity."}),m.jsx("div",{className:"relative mt-5",children:m.jsx("input",{type:"text",value:dt,onChange:j=>kn(j.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",autoFocus:!0,className:Qe+" pr-10 font-mono"})}),m.jsx("div",{className:"mt-4 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:m.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:"Private network mode — your bot is only accessible via your local network or VPN. No public URL will be created."})}),!l&&m.jsx("div",{className:"mt-3 flex items-center gap-2",children:m.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-medium border ${Ga(Ht)?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:[Ga(Ht)?m.jsx(e0,{className:"h-3 w-3"}):m.jsx(Xc,{className:"h-3 w-3"}),"Accessing via ",xy[Ht]]})}),!l&&!Gl&&m.jsxs("button",{onClick:()=>{Vi(!0),Wa("")},className:"w-full mt-4 flex items-center justify-between px-4 py-3 rounded-xl border border-white/[0.06] bg-white/[0.02] hover:border-white/10 hover:bg-white/[0.04] transition-all text-left",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-[13px] text-white/70 font-medium",children:"Re-enable public tunnel access"}),m.jsx("p",{className:"text-[11px] text-white/30 mt-0.5",children:"Start a Cloudflare tunnel to make your bot accessible from anywhere"})]}),m.jsx(Xc,{className:"h-4 w-4 text-white/30 shrink-0 ml-3"})]}),Gl&&m.jsxs("div",{className:"mt-4 space-y-3",children:[m.jsx("div",{className:"bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(t0,{className:"h-4 w-4 text-amber-400 shrink-0 mt-0.5"}),m.jsxs("div",{children:[m.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Enable public access?"}),m.jsxs("p",{className:"text-amber-400/60 text-[12px] mt-1 leading-relaxed",children:["This will start a Cloudflare tunnel, making your bot reachable from the internet.",be&&" Your handle will reconnect automatically."]})]})]})}),io&&m.jsx("p",{className:"text-red-400/70 text-[12px]",children:io}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("button",{onClick:async()=>{if(r){fa(!0),Wa("");try{await r("quick"),Mi("quick"),Vi(!1)}catch(j){Wa(j.message||"Failed to start tunnel")}finally{fa(!1)}}},disabled:Pa||!r,className:"flex-1 py-2.5 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:Pa?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-4 w-4 animate-spin"}),"Starting tunnel..."]}):"Enable Tunnel"}),m.jsx("button",{onClick:()=>{Vi(!1),Wa("")},disabled:Pa,className:"px-5 py-2.5 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Cancel"})]})]}),m.jsxs("button",{onClick:ze,disabled:!xa,className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]})]}),h===2&&he==="named"&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Bot Name & Access"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is your bot's identity. Your named tunnel domain is already configured."}),m.jsx("div",{className:"relative mt-5",children:m.jsx("input",{type:"text",value:dt,onChange:j=>kn(j.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",autoFocus:!0,className:Qe+" pr-10 font-mono"})}),m.jsxs("div",{className:"mt-4 flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[m.jsxs("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:["https://",an]}),m.jsx("button",{onClick:()=>{navigator.clipboard.writeText(`https://${an}`),kt(!0),setTimeout(()=>kt(!1),2e3)},className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:sn?m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"}):m.jsx(Pp,{className:"h-4 w-4"})})]})]}),h===2&&he==="quick"&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Bot Name & Access"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is your bot's name and permanent handle — access it from anywhere."}),be&&ot&&!Sn&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"}),m.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Current handle"})]}),m.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Ot})]}),m.jsxs("div",{className:"flex gap-2 mt-4",children:[m.jsxs("button",{onClick:ze,className:"flex-1 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]}),m.jsx("button",{onClick:()=>{Hl(!0),qt(!1),V(""),J(null),B({}),bn("relay")},className:"px-5 py-3 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Change"})]})]}),Sn&&!ot&&m.jsxs("div",{className:"mt-4 bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:[m.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Changing your handle"}),m.jsxs("p",{className:"text-amber-400/60 text-[12px] mt-1",children:["Your current handle ",m.jsx("span",{className:"font-mono",children:be?.url})," will be released and become available for others."]})]}),(!be||Sn||!ot)&&!(be&&ot&&!Sn)&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative mt-5",children:[m.jsx("input",{type:"text",value:dt,onChange:j=>kn(j.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true",autoFocus:!0,disabled:ot,className:Qe+" pr-10 font-mono"+(ot?" opacity-50":"")}),k&&dt.length>0&&!ot&&m.jsxs("div",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:[k==="checking"&&m.jsx("div",{className:"w-5 h-5 border-2 border-white/10 border-t-[#04D1FE] rounded-full animate-spin"}),k==="invalid"&&m.jsx("div",{className:"w-6 h-6 rounded-full bg-amber-500/15 flex items-center justify-center",children:m.jsx("svg",{className:"w-3.5 h-3.5 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 4h.01"})})})]})]}),k==="invalid"&&rt&&m.jsx("p",{className:"text-amber-400 text-[12px] mt-2",children:rt}),k==="ready"&&dt.length>0&&!ot&&m.jsxs("div",{className:"space-y-3 mt-4",children:[(()=>{const X=w.at===!1,bt=Hn==="relay"&&G==="at";return m.jsxs("button",{onClick:()=>{X||(W("at"),bn("relay"))},disabled:X,className:`w-full rounded-xl border transition-all duration-200 text-left px-4 py-3 ${X?"border-white/[0.04] opacity-50 cursor-not-allowed":bt?"border-[#AF27E3]/30 bg-white/[0.04]":"border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold text-white/60 uppercase tracking-wider",children:"Free"}),m.jsx("span",{className:`text-[11px] font-medium px-2.5 py-0.5 rounded-full border ${X?"bg-red-500/10 text-red-400 border-red-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"}`,children:X?"Taken":"Available"})]}),m.jsxs("p",{className:`font-mono text-[13px] mt-1.5 ${bt?"text-white/80":"text-white/40"}`,children:["my.fluxy.bot/",dt]})]})})(),(()=>{const j=w.premium,X=j===!1,bt=X&&no.premium;return m.jsxs("div",{className:`rounded-xl border transition-all duration-200 text-left px-4 py-3 ${bt?"border-[#AF27E3]/20":"border-white/[0.06]"}`,children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[12px] font-semibold text-white/60 uppercase tracking-wider",children:"Premium"}),m.jsx("span",{className:"text-[11px] font-medium px-2.5 py-0.5 rounded-full border bg-[#AF27E3]/15 text-[#AF27E3] border-[#AF27E3]/20",children:"$5"})]}),m.jsx("span",{className:`text-[11px] font-medium px-2.5 py-0.5 rounded-full border ${bt?"bg-[#AF27E3]/10 text-[#AF27E3] border-[#AF27E3]/20":X?"bg-red-500/10 text-red-400 border-red-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"}`,children:bt?"Reserved":X?"Taken":"Available"})]}),m.jsxs("p",{className:"font-mono text-[13px] mt-1.5 text-white/40",children:["fluxy.bot/",dt]}),j&&m.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06] flex items-center justify-between",children:[m.jsx("p",{className:"text-[12px] text-white/40",children:"Purchase on fluxy.bot"}),m.jsx("a",{href:"https://www.fluxy.bot/#reserve",target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-medium text-[#AF27E3] hover:text-[#c44df7] transition-colors",children:"Purchase"})]}),bt&&m.jsx("div",{className:"mt-3 pt-3 border-t border-[#AF27E3]/10",children:zi?m.jsxs("div",{className:"space-y-2.5",children:[m.jsxs("p",{className:"text-[12px] text-white/40",children:["Enter the 5-character code from your ",m.jsx("span",{className:"text-white/60 font-medium",children:"fluxy.bot"})," account"]}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("input",{type:"text",value:Za,onChange:Re=>Ja(Re.target.value.trim()),maxLength:5,placeholder:"e.g. a3Kx9",spellCheck:!1,autoComplete:"off",autoFocus:!0,className:"flex-1 bg-white/[0.05] border border-white/[0.08] text-white rounded-lg px-3 py-2 text-[13px] font-mono outline-none focus:border-[#AF27E3]/30 transition-colors placeholder:text-white/20 tracking-widest text-center"}),m.jsx("button",{onClick:si,disabled:pe||Za.length<5,className:"px-4 py-2 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-semibold rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-40",children:pe?m.jsx(_n,{className:"h-3.5 w-3.5 animate-spin"}):"Activate"})]}),ao&&m.jsx("p",{className:"text-red-400 text-[12px]",children:ao}),m.jsx("button",{onClick:()=>{Ri(!1),Ja(""),ke("")},className:"text-[11px] text-white/25 hover:text-white/40 transition-colors",children:"Cancel"})]}):m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("p",{className:"text-[12px] text-white/40",children:"Is that yours?"}),m.jsx("button",{onClick:()=>{Ri(!0),Ja(""),ke("")},className:"text-[12px] font-medium text-[#AF27E3] hover:text-[#c44df7] transition-colors",children:"Activate"})]})})]})})(),m.jsxs("button",{onClick:()=>{bn("tunnel"),W("skip")},className:`w-full rounded-xl border transition-all duration-200 text-left px-4 py-3 ${G==="skip"?"border-[#AF27E3]/30 bg-white/[0.04]":"border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:[m.jsx("span",{className:"text-[12px] font-semibold text-white/60 uppercase tracking-wider",children:"No handle"}),m.jsx("p",{className:`text-[13px] mt-1.5 ${G==="skip"?"text-white/60":"text-white/30"}`,children:"I'll use the random tunnel URL"})]})]}),ot&&m.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"}),m.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Handle claimed!"})]}),m.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Ot})]}),k==="ready"&&dt.length>0&&!ot&&m.jsx("button",{onClick:G==="skip"?ze:Hn==="relay"&&G==="at"?Sn?Pl:cn:void 0,disabled:!G||st||me||G==="at"&&!w.at,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed",children:st||me?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-4 w-4 animate-spin"}),Sn?"Changing...":"Claiming..."]}):G?G==="skip"?m.jsxs(m.Fragment,{children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]}):m.jsxs(m.Fragment,{children:[Sn?"Change Handle":"Claim & Continue",m.jsx(qe,{className:"h-4 w-4"})]}):m.jsx(m.Fragment,{children:"Select an option to continue"})}),ot&&m.jsxs("button",{onClick:ze,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]}),Sn&&!ot&&m.jsx("button",{onClick:()=>{Hl(!1),V(be.username),qt(!0),Ge(be.url),W(be.tier),bn("relay"),J(null)},className:"w-full mt-2 py-2 text-white/25 hover:text-white/40 text-[12px] transition-colors",children:"Cancel — keep current handle"})]}),!l&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-5 flex items-center gap-2",children:m.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-medium border ${Ga(Ht)?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:[Ga(Ht)?m.jsx(G1,{className:"h-3 w-3"}):m.jsx(Xc,{className:"h-3 w-3"}),"Accessing via ",xy[Ht]]})}),!Yl&&m.jsxs("button",{onClick:()=>{Ga(Ht)&&(ql(!0),ua(""),wn(""))},disabled:!Ga(Ht),className:`w-full mt-3 flex items-center justify-between px-4 py-3 rounded-xl border transition-all text-left ${Ga(Ht)?"border-white/[0.06] bg-white/[0.02] hover:border-white/10 hover:bg-white/[0.04] cursor-pointer":"border-white/[0.04] bg-transparent opacity-50 cursor-not-allowed"}`,children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-[13px] text-white/70 font-medium",children:"Switch to private network only"}),m.jsx("p",{className:"text-[11px] text-white/30 mt-0.5",children:Ga(Ht)?"Stop the tunnel and relay — access only via Tailscale or LAN":"Connect via Tailscale or private network to unlock"})]}),m.jsx(e0,{className:"h-4 w-4 text-white/30 shrink-0 ml-3"})]}),Yl&&m.jsxs("div",{className:"mt-3 space-y-3",children:[m.jsx("div",{className:"bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(t0,{className:"h-4 w-4 text-amber-400 shrink-0 mt-0.5"}),m.jsxs("div",{children:[m.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Switch to private network only?"}),m.jsx("p",{className:"text-amber-400/60 text-[12px] mt-1 leading-relaxed",children:"This will stop the Cloudflare tunnel and relay connection. Your bot will only be accessible via your private network."}),be&&m.jsx("p",{className:"text-amber-400/50 text-[12px] mt-1.5",children:"Your handle will be preserved and can be re-activated later."})]})]})}),m.jsxs("div",{children:[m.jsxs("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:["Type ",m.jsx("span",{className:"font-mono text-white/60",children:"I confirm"})," to proceed"]}),m.jsx("input",{type:"text",value:ra,onChange:j=>ua(j.target.value),placeholder:"I confirm",spellCheck:!1,autoFocus:!0,className:Il})]}),Fa&&m.jsx("p",{className:"text-red-400/70 text-[12px]",children:Fa}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("button",{onClick:async()=>{if(!(!r||ra.trim().toLowerCase()!=="i confirm")){Tn(!0),wn("");try{await r("off"),Mi("off"),ql(!1)}catch(j){wn(j.message||"Failed to switch")}finally{Tn(!1)}}},disabled:ca||ra.trim().toLowerCase()!=="i confirm"||!r,className:"flex-1 py-2.5 bg-amber-600 hover:bg-amber-500 text-white text-[13px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:ca?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-4 w-4 animate-spin"}),"Switching..."]}):"Confirm Switch"}),m.jsx("button",{onClick:()=>{ql(!1),ua(""),wn("")},disabled:ca,className:"px-5 py-2.5 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Cancel"})]})]})]})]}),h===3&&m.jsx("div",{children:m.jsxs(ly,{mode:"wait",children:[va==="password"&&m.jsxs(Ys.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.15},children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Set a password"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"You'll need this password to access your agent's chat. Keep it safe — anyone with your URL will need it to log in."}),Vt&&m.jsx("div",{className:"mt-4 bg-white/[0.02] border border-white/[0.06] rounded-xl px-4 py-2.5",children:m.jsx("p",{className:"text-white/40 text-[12px]",children:"Password already set. Leave fields empty to keep your current password, or enter your current password to change it."})}),Vt&&m.jsxs("div",{className:"mt-5",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Current password"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"password",value:ha,onChange:j=>{oo(j.target.value),pa(""),Yn(!1)},placeholder:"Enter current password to change it",autoComplete:"current-password",autoFocus:!0,className:Qe+" flex-1"}),ha.length>0&&!on&&m.jsx("button",{onClick:async()=>{qn(!0),pa("");try{(await(await fetch("/api/portal/verify-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:ha})})).json()).valid?Yn(!0):pa("Incorrect password")}catch{pa("Could not verify")}finally{qn(!1)}},disabled:ya,className:"shrink-0 px-4 py-3 bg-white/[0.06] hover:bg-white/[0.1] text-white/60 text-[13px] font-medium rounded-xl transition-colors disabled:opacity-40",children:ya?m.jsx(_n,{className:"h-4 w-4 animate-spin"}):"Verify"}),on&&m.jsx("div",{className:"shrink-0 w-10 h-10 flex items-center justify-center",children:m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"})})]}),ma&&m.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:ma})]}),(!Vt||on)&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:Vt?"mt-3":"mt-5",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:Vt?"New password":"Password"}),m.jsx("input",{type:"password",value:se,onChange:j=>_i(j.target.value),placeholder:"••••••••",autoComplete:"new-password",autoFocus:!Vt,onKeyDown:Xn,className:Qe}),se.length>0&&se.length<6&&m.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"At least 6 characters"})]}),m.jsxs("div",{className:"mt-3",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:Vt?"Confirm new password":"Confirm password"}),m.jsx("input",{type:"password",value:$a,onChange:j=>kl(j.target.value),placeholder:"••••••••",autoComplete:"new-password",onKeyDown:Xn,className:Qe}),$a.length>0&&!Mn&&m.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:"Passwords don't match"})]})]}),m.jsxs("div",{className:"mt-5 border border-white/[0.06] rounded-xl overflow-hidden",children:[m.jsxs("button",{onClick:async()=>{if(Se&&ti){ki(!0);return}if(Se)En(!1),Cn(""),ga(""),Te("");else if(En(!0),Zt(""),Hi(""),Li)un("totp-setup");else try{const j=await fetch("/api/portal/totp/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Vt?ha:se})}),X=await j.json();j.ok?(ga(X.secret),Cn(X.qrDataUri),Te(X.otpauthUri),un("totp-setup")):(Zt(X.error||"Setup failed"),En(!1))}catch{Zt("Could not reach server"),En(!1)}},type:"button",className:"w-full flex items-center gap-3 px-4 py-3 text-left",children:[m.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${Se&&ti?"bg-emerald-500/10":"bg-white/[0.04]"}`,children:Se&&ti?m.jsx(Ip,{className:"h-[18px] w-[18px] text-emerald-400"}):m.jsx(U1,{className:"h-[18px] w-[18px] text-white/30"})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"text-[13px] font-medium text-white block",children:"Two-Factor Auth"}),m.jsx("p",{className:"text-[11px] text-white/30 mt-0.5",children:Se&&ti?m.jsx("span",{className:"text-emerald-400/70",children:"Active — authenticator app required"}):he==="quick"||he==="named"?m.jsx("span",{children:"Recommended for public bots"}):m.jsx("span",{children:"Extra security with an authenticator app"})})]}),m.jsx("div",{className:`w-10 h-6 rounded-full transition-colors relative shrink-0 ${Se?"bg-emerald-500":"bg-white/10"}`,children:m.jsx("div",{className:`absolute top-1 w-4 h-4 rounded-full bg-white shadow transition-transform ${Se?"translate-x-5":"translate-x-1"}`})})]}),ro&&m.jsxs("div",{className:"px-4 pb-3 border-t border-white/[0.06]",children:[m.jsx("p",{className:"text-[12px] text-white/40 mt-3 mb-2",children:"Enter your current TOTP code to disable 2FA:"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:rn,onChange:j=>{Ql(j.target.value.replace(/\D/g,"")),ii("")},placeholder:"000000",className:Il+" flex-1 tracking-[0.3em] text-center font-mono"}),m.jsx("button",{onClick:async()=>{if(rn.length===6)try{const j=await fetch("/api/portal/totp/disable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Vt?ha:se,code:rn})}),X=await j.json();j.ok?(En(!1),ei(!1),ga(""),Cn(""),Te(""),ki(!1),Ql(""),Gi([]),Gn(!1)):ii(X.error||"Failed to disable")}catch{ii("Could not reach server")}},disabled:rn.length!==6,className:"shrink-0 px-4 py-2.5 bg-red-500/10 hover:bg-red-500/20 text-red-400 text-[13px] font-medium rounded-xl transition-colors disabled:opacity-40",children:"Disable"})]}),Zl&&m.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:Zl}),m.jsx("button",{onClick:()=>{ki(!1),Ql(""),ii("")},className:"text-[11px] text-white/30 hover:text-white/50 mt-2",children:"Cancel"})]}),Yi&&va==="password"&&m.jsx("div",{className:"mx-4 mb-3 bg-red-500/8 border border-red-500/15 rounded-xl px-3 py-2",children:m.jsx("p",{className:"text-red-400/90 text-[11px]",children:Yi})})]}),m.jsxs("button",{onClick:ze,disabled:!xa,className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]})]},"password"),va==="totp-setup"&&m.jsxs(Ys.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.15},children:[m.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[m.jsx("button",{onClick:()=>{En(!1),Cn(""),ga(""),Te(""),Hi(""),Zt(""),un("password"),Ki()},className:"w-7 h-7 rounded-full bg-white/[0.04] flex items-center justify-center text-white/40 hover:text-white/70 transition-colors shrink-0",children:m.jsx(v1,{className:"h-4 w-4"})}),m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Set up 2FA"})]}),Yi&&m.jsx("div",{className:"mt-3 bg-red-500/8 border border-red-500/15 rounded-xl px-3 py-2",children:m.jsx("p",{className:"text-red-400/90 text-[11px]",children:Yi})}),Li&&m.jsxs(m.Fragment,{children:[Jl?m.jsxs("div",{className:"mt-4",children:[m.jsx("p",{className:"text-white/40 text-[13px] leading-relaxed mb-4",children:"Add Fluxy to your authenticator app, then enter the 6-digit code below to confirm."}),m.jsx("button",{onClick:()=>{navigator.clipboard.writeText(Bi),Xi(!0),setTimeout(()=>Xi(!1),3e3)},className:`w-full py-3 text-[14px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 ${Ke?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-white/[0.05] text-white/70 hover:bg-white/[0.08] border border-white/[0.08]"}`,children:Ke?m.jsxs(m.Fragment,{children:[m.jsx(Vn,{className:"h-4 w-4"}),"Secret key copied"]}):m.jsxs(m.Fragment,{children:[m.jsx(kc,{className:"h-4 w-4"}),"Copy secret key"]})}),m.jsx("p",{className:"text-[11px] text-white/20 text-center mt-2",children:"Paste it in your authenticator app → Add account → Enter key"}),m.jsxs("a",{href:Ia,onClick:()=>uo(),className:"w-full mt-3 py-2.5 text-[13px] text-white/30 hover:text-white/50 flex items-center justify-center gap-1.5 transition-colors",children:[m.jsx(L1,{className:"h-3.5 w-3.5"}),"Or open directly in authenticator"]})]}):m.jsxs("div",{className:"mt-4 flex gap-4 items-start",children:[m.jsx("div",{className:"shrink-0",children:m.jsx("div",{className:"bg-white rounded-xl p-1.5",children:m.jsx("img",{src:Li,alt:"TOTP QR Code",className:"w-[140px] h-[140px]"})})}),m.jsxs("div",{className:"flex-1 min-w-0 pt-1",children:[m.jsx("p",{className:"text-white/40 text-[13px] leading-relaxed",children:"Scan this QR code with your authenticator app."}),m.jsx("p",{className:"text-white/25 text-[11px] mt-2 leading-relaxed",children:"Google Authenticator, Authy, 1Password, or any TOTP app."}),m.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(Bi)},className:"mt-3 text-[11px] text-white/25 hover:text-white/40 flex items-center gap-1 transition-colors",children:[m.jsx(kc,{className:"h-3 w-3"}),"Copy secret key"]})]})]}),m.jsxs("div",{className:"mt-5",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Enter the 6-digit code from your app"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:oe,onChange:j=>{Hi(j.target.value.replace(/\D/g,"")),Zt("")},placeholder:"000000",autoFocus:!0,className:Qe+" tracking-[0.3em] text-center font-mono flex-1"}),m.jsx("button",{onClick:async()=>{if(oe.length===6){ni(!0),Zt("");try{const j=await fetch("/api/portal/totp/verify-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:oe,password:Vt?ha:se})}),X=await j.json();j.ok&&X.success?(ei(!0),Gi(X.recoveryCodes||[]),un("recovery"),Ki()):Zt(X.error||"Verification failed")}catch{Zt("Could not reach server")}finally{ni(!1)}}},disabled:oe.length!==6||Kl,className:"shrink-0 px-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-xl transition-colors flex items-center gap-2 disabled:opacity-40",children:Kl?m.jsx(_n,{className:"h-4 w-4 animate-spin"}):"Verify"})]})]})]})]},"totp-setup"),va==="recovery"&&m.jsxs(Ys.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.15},children:[m.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[m.jsx("div",{className:"w-9 h-9 rounded-xl bg-emerald-500/10 flex items-center justify-center shrink-0",children:m.jsx(Ip,{className:"h-[18px] w-[18px] text-emerald-400"})}),m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"2FA enabled"}),m.jsx("p",{className:"text-emerald-400/70 text-[12px]",children:"Save your recovery codes"})]})]}),m.jsx("p",{className:"text-white/35 text-[13px] mt-3 leading-relaxed",children:"If you lose your authenticator app, you can use one of these codes to sign in. Each code works once. Store them somewhere safe."}),m.jsx("div",{className:"mt-4 grid grid-cols-2 gap-1.5",children:qi.map((j,X)=>m.jsx("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-2 text-center",children:m.jsx("code",{className:"text-[13px] text-white/60 font-mono tracking-wider",children:j})},X))}),m.jsx("button",{onClick:()=>{navigator.clipboard.writeText(qi.join(`
|
|
18
18
|
`)),Gn(!0)},className:`w-full mt-4 py-3 text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 ${ai?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-white/[0.05] text-white/60 hover:bg-white/[0.08] border border-white/[0.08]"}`,children:ai?m.jsxs(m.Fragment,{children:[m.jsx(Vn,{className:"h-4 w-4"}),"Copied"]}):m.jsxs(m.Fragment,{children:[m.jsx(kc,{className:"h-4 w-4"}),"Copy recovery codes"]})}),m.jsxs("button",{onClick:()=>{Gi([]),un("password"),Ki()},disabled:!ai,className:"w-full mt-3 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Done",m.jsx(qe,{className:"h-4 w-4"})]})]},"recovery")]})}),h===4&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Choose your AI provider"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"Pick one provider to power your bot, authenticate, and select a model."}),m.jsx("div",{className:"flex gap-2.5 mt-4",children:Lw.map(j=>m.jsxs("button",{onClick:()=>Nn(j.id),className:`flex-1 relative rounded-xl border transition-all duration-200 p-3 text-left ${p===j.id?"bg-white/[0.04] border-[#AF27E3]/40":"bg-transparent border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:[m.jsxs("div",{className:"flex flex-col items-center gap-1.5 py-0.5",children:[j.icon?m.jsx("img",{src:j.icon,alt:j.name,className:"w-8 h-8 rounded-lg"}):m.jsx("div",{className:"w-8 h-8 rounded-lg bg-white/[0.06] flex items-center justify-center text-white/50 text-sm font-bold",children:"O"}),m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:"text-[13px] font-medium text-white",children:j.name}),m.jsx("div",{className:"text-[10px] text-white/30",children:j.subtitle})]})]}),H[j.id]==="connected"?m.jsx("div",{className:"absolute top-2 right-2 w-4 h-4 rounded-full bg-emerald-500/15 flex items-center justify-center",children:m.jsx(Vn,{className:"h-2.5 w-2.5 text-emerald-400"})}):p===j.id?m.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 rounded-full bg-gradient-brand"}):null]},j.id))}),m.jsx("div",{className:"border-t border-white/[0.06] mt-4 mb-3"}),p==="anthropic"&&m.jsxs("div",{className:"space-y-2.5",children:[Ce&&m.jsxs("div",{className:"space-y-2.5",children:[m.jsx("div",{className:"bg-emerald-500/8 border border-emerald-500/15 rounded-lg px-3.5 py-2.5",children:m.jsx("p",{className:"text-emerald-400/90 text-[12px]",children:"Connected — Anthropic subscription is active."})}),m.jsxs("button",{onClick:()=>{q(j=>({...j,anthropic:"idle"})),Z(!1),Q(""),F("")},className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors flex items-center justify-center gap-1.5",children:[m.jsx(Kc,{className:"h-3 w-3"}),"Re-authenticate"]})]}),!Ce&&m.jsxs(m.Fragment,{children:[tt&&m.jsx("div",{className:"bg-red-500/8 border border-red-500/15 rounded-lg px-3.5 py-2.5",children:m.jsx("p",{className:"text-red-400/90 text-[12px]",children:tt})}),m.jsx("div",{className:"space-y-1.5",children:["Click the button below to open Anthropic's login page","Sign in with your Anthropic account — a code will be generated","Copy the code and paste it in the field below"].map((j,X)=>m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("span",{className:"flex-shrink-0 w-[18px] h-[18px] rounded-full bg-white/[0.06] text-white/30 text-[10px] font-medium flex items-center justify-center mt-px",children:X+1}),m.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:j})]},X))}),m.jsx("button",{onClick:Zi,className:"w-full py-2.5 px-4 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2",children:K?m.jsxs(m.Fragment,{children:[m.jsx(Wp,{className:"h-3.5 w-3.5 opacity-60"}),"Open authentication page again"]}):m.jsxs(m.Fragment,{children:["Authenticate with Anthropic",m.jsx(qe,{className:"h-3.5 w-3.5 opacity-60"})]})}),m.jsxs("div",{className:"relative",children:[m.jsx("input",{type:"text",value:Y,onChange:j=>Q(j.target.value),onKeyDown:j=>j.key==="Enter"&&Wl(),placeholder:"Paste your code here...",className:Il+" pr-10 font-mono"}),m.jsx("button",{onClick:Ji,className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/20 hover:text-white/50 transition-colors",children:m.jsx(Pp,{className:"h-3.5 w-3.5"})})]}),m.jsx("button",{onClick:Wl,disabled:!Y.trim()||P,className:"w-full py-2.5 px-4 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:P?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-3.5 w-3.5 animate-spin"}),"Verifying..."]}):"Connect"}),m.jsxs("button",{onClick:Fi,disabled:lt,className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors flex items-center justify-center gap-1.5 disabled:opacity-50",children:[lt?m.jsx(_n,{className:"h-3 w-3 animate-spin"}):m.jsx(Kc,{className:"h-3 w-3"}),lt?"Checking...":"I'm already authenticated"]})]})]}),p==="openai"&&m.jsxs("div",{className:"space-y-2.5",children:[Ce&&m.jsxs("div",{className:"space-y-2.5",children:[m.jsx("div",{className:"bg-emerald-500/8 border border-emerald-500/15 rounded-lg px-3.5 py-2.5",children:m.jsx("p",{className:"text-emerald-400/90 text-[12px]",children:"Connected — ChatGPT subscription is active."})}),m.jsxs("button",{onClick:()=>{q(j=>({...j,openai:"idle"})),le("")},className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors flex items-center justify-center gap-1.5",children:[m.jsx(Kc,{className:"h-3 w-3"}),"Re-authenticate"]})]}),!Ce&&m.jsxs(m.Fragment,{children:[xe&&m.jsx("div",{className:"bg-red-500/8 border border-red-500/15 rounded-lg px-3.5 py-2.5",children:m.jsx("p",{className:"text-red-400/90 text-[12px]",children:xe})}),m.jsx("div",{className:"space-y-1.5",children:["Click the button below — your browser will open for ChatGPT sign-in","Sign in with your ChatGPT Plus or Pro account","Authentication completes automatically — no code to copy"].map((j,X)=>m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("span",{className:"flex-shrink-0 w-[18px] h-[18px] rounded-full bg-white/[0.06] text-white/30 text-[10px] font-medium flex items-center justify-center mt-px",children:X+1}),m.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:j})]},X))}),m.jsx("button",{onClick:co,disabled:Ut,className:"w-full py-2.5 px-4 bg-white/[0.06] hover:bg-white/[0.09] text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 disabled:opacity-60",children:Ut?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-3.5 w-3.5 animate-spin opacity-60"}),"Waiting for sign-in..."]}):m.jsxs(m.Fragment,{children:["Authenticate with ChatGPT",m.jsx(qe,{className:"h-3.5 w-3.5 opacity-60"})]})}),Ut&&m.jsx("button",{onClick:ye,className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors",children:"Cancel"})]})]}),Ce&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"border-t border-white/[0.06] mt-4 mb-3"}),m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Select a model"}),m.jsx(Yw,{models:Hw[p]||[],value:b,onChange:T})]}),Ce&&m.jsxs("button",{onClick:ze,disabled:!xa,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",m.jsx(qe,{className:"h-4 w-4"})]})]}),h===5&&m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-bold text-white tracking-tight mb-1",children:"Voice Messages"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-1 leading-relaxed",children:"Voice input works out of the box using your browser's built-in speech recognition. For better accuracy, you can optionally enable OpenAI Whisper."}),m.jsx("div",{className:"w-full mt-5 rounded-xl border border-emerald-500/20 bg-emerald-500/[0.04] p-4",children:m.jsxs("div",{className:"flex items-center gap-3.5",children:[m.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/10 flex items-center justify-center shrink-0",children:m.jsx($p,{className:"h-5 w-5 text-emerald-400"})}),m.jsxs("div",{className:"flex-1",children:[m.jsx("div",{className:"text-[14px] font-medium text-white",children:"Browser Speech Recognition"}),m.jsx("div",{className:"text-[12px] text-white/35 mt-0.5 leading-relaxed",children:"Built-in voice input — no setup needed. Works in Chrome, Edge, and Safari."})]}),m.jsx("div",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-emerald-500/20 shrink-0",children:m.jsx(Vn,{className:"h-3.5 w-3.5 text-emerald-400"})})]})}),m.jsx("button",{onClick:()=>Xl(j=>!j),className:`w-full mt-3 rounded-xl border transition-all duration-200 p-4 text-left ${zt?"bg-white/[0.04] border-[#AF27E3]/40":"bg-transparent border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:m.jsxs("div",{className:"flex items-center gap-3.5",children:[m.jsx("img",{src:"/icons/openai.svg",alt:"OpenAI",className:"w-10 h-10 rounded-xl bg-white/[0.04] p-1.5"}),m.jsxs("div",{className:"flex-1",children:[m.jsx("div",{className:"text-[14px] font-medium text-white",children:"OpenAI Whisper"}),m.jsx("div",{className:"text-[12px] text-white/35 mt-0.5 leading-relaxed",children:"Upgrade to more accurate transcription that works in all browsers including Firefox."})]}),m.jsx("div",{className:`w-10 h-[22px] rounded-full transition-colors duration-200 flex items-center px-0.5 shrink-0 ${zt?"bg-gradient-brand":"bg-white/[0.08]"}`,children:m.jsx("div",{className:`w-[18px] h-[18px] rounded-full bg-white shadow-sm transition-transform duration-200 ${zt?"translate-x-[18px]":"translate-x-0"}`})})]})}),zt&&m.jsxs("div",{className:"mt-3",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"OpenAI API Key"}),m.jsx("input",{type:"password",value:Xe,onChange:j=>An(j.target.value.trim()),placeholder:"sk-...",autoComplete:"off",className:Qe+" font-mono text-[13px]"}),Xe.length>0&&!Xe.startsWith("sk-")&&m.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"Key should start with sk-"}),Xe.length>0&&Xe.startsWith("sk-")&&Xe.length<20&&m.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"Key looks too short"}),m.jsxs("div",{className:"flex items-start gap-2.5 mt-3 bg-white/[0.02] border border-white/[0.06] rounded-xl px-4 py-3",children:[m.jsx($p,{className:"h-4 w-4 text-[#AF27E3]/60 mt-0.5 shrink-0"}),m.jsx("p",{className:"text-white/35 text-[12px] leading-relaxed",children:"Whisper provides more accurate transcription and works in all browsers including Firefox."})]})]}),m.jsx("button",{onClick:Pi,disabled:z||zt&&(!Xe.startsWith("sk-")||Xe.length<20),className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:z?m.jsxs(m.Fragment,{children:[m.jsx(_n,{className:"h-4 w-4 animate-spin"}),"Setting up..."]}):m.jsxs(m.Fragment,{children:["Complete Setup",m.jsx(qe,{className:"h-4 w-4"})]})}),!zt&&m.jsx("p",{className:"text-center text-white/20 text-[11px] mt-2.5",children:"Voice input is active using your browser's built-in speech recognition."})]}),h===6&&l&&(()=>{const j=he==="off",X=j?window.location.origin:he==="named"?`https://${an}`:Hn==="relay"&&Ot?Ot:Ll||"http://localhost:3000",bt=X.startsWith("http")?X:`https://${X}`,Re=j?"Your agent is running on your private network. Access it from any device on your local network or VPN.":he==="named"?"Access your agent at your custom domain.":Hn==="relay"&&Ot?"Your agent is live and ready. From now on, access it using your custom URL below.":"Your agent is live and ready. Your tunnel URL is shown below. Note: this URL changes on restart.";return m.jsxs("div",{className:"flex flex-col items-center text-center",children:[m.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center mb-5",children:m.jsx(Vn,{className:"h-8 w-8 text-emerald-400"})}),m.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"All Set!"}),m.jsx("p",{className:"text-white/40 text-[13px] mt-2 leading-relaxed max-w-[340px]",children:Re}),m.jsxs("div",{className:"w-full mt-6 flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[m.jsx("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:X}),m.jsx("button",{onClick:()=>{navigator.clipboard.writeText(bt),kt(!0),setTimeout(()=>kt(!1),2e3)},className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:sn?m.jsx(Vn,{className:"h-4 w-4 text-emerald-400"}):m.jsxs("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[m.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),m.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),m.jsxs("div",{className:"w-full mt-3",children:[m.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block text-left",children:"Your password"}),m.jsxs("div",{className:"flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[m.jsx("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:Ui?se:"•".repeat(Math.max(se.length,8))}),m.jsx("button",{onClick:()=>Yr(Kn=>!Kn),className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:Ui?m.jsx(j1,{className:"h-4 w-4"}):m.jsx(M1,{className:"h-4 w-4"})})]})]}),m.jsxs("button",{onClick:()=>{j?(window.top||window).location.href="/":(window.top||window).location.href=bt},className:"w-full mt-6 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:[j?"Go to dashboard":"Go to your agent",m.jsx(Wp,{className:"h-4 w-4"})]}),m.jsx("p",{className:"text-white/20 text-[11px] mt-3 leading-relaxed",children:j?"Access from any device on your network using the URL above.":`You'll be redirected to your ${he==="named"?"custom domain":Hn==="relay"?"custom URL":"tunnel URL"}.`})]})})()]},h)}),h>0&&h<c-1&&!(h===6&&l)&&m.jsx("div",{className:"px-8 pb-5 -mt-3",children:m.jsx("button",{onClick:$l,className:"text-white/25 hover:text-white/50 text-[12px] transition-colors",children:"← Back"})})]})]})}export{ly as A,Vn as C,_n as L,$p as M,Xw as O,qw as R,U1 as S,qe as a,v1 as b,ae as c,kc as d,Gw as e,by as g,m as j,Ys as m,M as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as o,j as e,R as n,O as r}from"./globals-
|
|
1
|
+
import{e as o,j as e,R as n,O as r}from"./globals-3yce7Lzq.js";function a(){const t=()=>{window.parent?.postMessage({type:"fluxy:onboard-complete"},"*")};return e.jsx(r,{onComplete:t,isInitialSetup:!0})}o.createRoot(document.getElementById("root")).render(e.jsx(n.StrictMode,{children:e.jsx(a,{})}));
|
package/dist-fluxy/fluxy.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, interactive-widget=resizes-content" />
|
|
6
6
|
<title>Fluxy Chat</title>
|
|
7
|
-
<script type="module" crossorigin src="/fluxy/assets/fluxy-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/fluxy/assets/globals-
|
|
7
|
+
<script type="module" crossorigin src="/fluxy/assets/fluxy-Du5MLqr3.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/fluxy/assets/globals-3yce7Lzq.js">
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/fluxy/assets/globals-QZ3hgRn2.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-background text-foreground">
|
package/dist-fluxy/onboard.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, interactive-widget=resizes-content" />
|
|
6
6
|
<title>Fluxy Setup</title>
|
|
7
|
-
<script type="module" crossorigin src="/fluxy/assets/onboard-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/fluxy/assets/globals-
|
|
7
|
+
<script type="module" crossorigin src="/fluxy/assets/onboard-CHU-Pzvd.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/fluxy/assets/globals-3yce7Lzq.js">
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/fluxy/assets/globals-QZ3hgRn2.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-background text-foreground">
|
package/package.json
CHANGED
|
@@ -1140,9 +1140,13 @@ export default function OnboardWizard({ onComplete, isInitialSetup = false, onSa
|
|
|
1140
1140
|
<span className="text-[11px] font-medium px-2.5 py-0.5 rounded-full border bg-[#AF27E3]/15 text-[#AF27E3] border-[#AF27E3]/20">$5</span>
|
|
1141
1141
|
</div>
|
|
1142
1142
|
<span className={`text-[11px] font-medium px-2.5 py-0.5 rounded-full border ${
|
|
1143
|
-
|
|
1143
|
+
premReserved
|
|
1144
|
+
? 'bg-[#AF27E3]/10 text-[#AF27E3] border-[#AF27E3]/20'
|
|
1145
|
+
: premTaken
|
|
1146
|
+
? 'bg-red-500/10 text-red-400 border-red-500/20'
|
|
1147
|
+
: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20'
|
|
1144
1148
|
}`}>
|
|
1145
|
-
{
|
|
1149
|
+
{premReserved ? 'Reserved' : premTaken ? 'Taken' : 'Available'}
|
|
1146
1150
|
</span>
|
|
1147
1151
|
</div>
|
|
1148
1152
|
<p className="font-mono text-[13px] mt-1.5 text-white/40">
|