class-studys 8.0.0 → 9.0.0

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.
@@ -1 +1 @@
1
- import{r,j as s}from"./react-BNEptbwn-8068ec8f.js";import{$ as j,V as h,a0 as v}from"./index-COUSXtyQ-8068ec8f.js";/* empty css *//* empty css */import"./motion-B1hdS1Lc-8068ec8f.js";function m(i){if(!i)return"—";const a=new Date(i);return Number.isNaN(a.getTime())?"—":a.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})}function k({account:i}){var o;const[a,d]=r.useState(""),[x,c]=r.useState(!1);if(r.useEffect(()=>{var l;d(((l=i.user)==null?void 0:l.discordHandle)??""),c(!1)},[(o=i.user)==null?void 0:o.discordHandle]),i.status==="loading")return null;if(i.status!=="signed-in")return s.jsx("div",{className:"account-auth-auth-shell",children:s.jsx("div",{className:"account-auth-panel",children:s.jsx(j,{account:i,loginTagline:"Backs up your bookmarks, settings, and theme across devices.",brand:s.jsxs("div",{className:"account-auth-auth-brand",children:[s.jsx(h,{size:18}),s.jsx("span",{children:"IGNITE OS BROWSER Account"})]})})})});const{user:e,billing:n,isPlus:t}=i,g=n!=null&&n.cancelAtPeriodEnd?"Cancels on":"Renews on",u=async()=>{c(!1),await i.setDiscord(a.trim()||null)&&c(!0)};return s.jsx("div",{className:"settings-page account-settings",children:s.jsxs("div",{className:"settings-page-inner",children:[s.jsxs("div",{className:"settings-page-head",children:[s.jsx("h1",{children:"Account"}),s.jsx("p",{children:e==null?void 0:e.email})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Profile"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Email"}),s.jsx("div",{className:"settings-row-hint",children:e==null?void 0:e.email})]}),s.jsx("span",{className:`account-pill ${e!=null&&e.emailVerified?"ok":""}`,children:e!=null&&e.emailVerified?"Verified":"Unverified"})]}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Member since"}),s.jsx("div",{className:"settings-row-hint",children:"When you created this IGNITE OS BROWSER account"})]}),s.jsx("div",{className:"account-value",children:m(e==null?void 0:e.createdAt)})]}),s.jsx("div",{className:"settings-field-grid",children:s.jsxs("label",{className:"settings-field",children:[s.jsx("span",{className:"settings-field-label",children:"Discord username or user ID"}),s.jsxs("div",{className:"settings-row",style:{gap:8},children:[s.jsx("input",{className:"settings-input",style:{flex:1},value:a,placeholder:"username or 17–20 digit ID",onChange:l=>{d(l.target.value),c(!1)}}),s.jsx("button",{type:"button",className:"account-btn ghost",disabled:i.busy,onClick:()=>void u(),children:"Save"})]}),s.jsx("span",{className:"settings-field-label",children:x?"Saved — used for the Plus role in the IGNITE OS BROWSER Discord.":"Optional. Used for the Plus role in the IGNITE OS BROWSER Discord. You can also enter this at checkout."})]})})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"IGNITE OS BROWSER Plus"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Status"}),s.jsx("div",{className:"settings-row-hint",children:t?"3M AI tokens/day, exclusive links, and an ad-free experience are unlocked.":"Upgrade for 3M AI tokens/day, exclusive links, and an ad-free experience."})]}),s.jsx("span",{className:`account-pill ${t?"plus":""}`,children:t?"Active":"Free"})]}),t&&(n==null?void 0:n.currentPeriodEnd)&&s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:g}),s.jsx("div",{className:"settings-row-hint",children:"Manage or cancel anytime in the billing portal"})]}),s.jsx("div",{className:"account-value",children:m(n.currentPeriodEnd)})]}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:t?"Billing":"Upgrade"}),s.jsx("div",{className:"settings-row-hint",children:t?"Update payment, invoices, or cancel.":"Subscribe to IGNITE OS BROWSER Plus."})]}),t?s.jsx("button",{type:"button",className:"account-btn ghost",onClick:()=>void i.manageBilling(),children:"Manage billing"}):s.jsx("button",{type:"button",className:"account-btn primary",onClick:()=>void i.checkout((e==null?void 0:e.email)??void 0),children:"Upgrade to Plus"})]}),!t&&s.jsx(v,{}),i.authError&&s.jsx("div",{className:"account-error",children:i.authError})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Cloud sync"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Backup & device sync"}),s.jsx("div",{className:"settings-row-hint",children:"Bookmarks, settings, theme, and proxied-site logins (cookies) sync to this account automatically."})]}),s.jsx("span",{className:"account-pill ok",children:"On"})]})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Session"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Sign out"}),s.jsx("div",{className:"settings-row-hint",children:"Signs out on this device only."})]}),s.jsx("button",{type:"button",className:"account-btn ghost",onClick:()=>void i.logout(),children:"Sign out"})]})]}),s.jsxs("div",{className:"settings-page-foot",children:[s.jsx(h,{size:14}),s.jsx("span",{children:"IGNITE OS BROWSER"})]})]})})}export{k as AccountPage};
1
+ import{r,j as s}from"./react-BNEptbwn-8068ec8f.js";import{$ as j,V as h,a0 as v}from"./index-COUSXtyQ-8068ec8f.js";/* empty css *//* empty css */import"./motion-B1hdS1Lc-8068ec8f.js";function m(i){if(!i)return"—";const a=new Date(i);return Number.isNaN(a.getTime())?"—":a.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})}function k({account:i}){var o;const[a,d]=r.useState(""),[x,c]=r.useState(!1);if(r.useEffect(()=>{var l;d(((l=i.user)==null?void 0:l.discordHandle)??""),c(!1)},[(o=i.user)==null?void 0:o.discordHandle]),i.status==="loading")return null;if(i.status!=="signed-in")return s.jsx("div",{className:"account-auth-auth-shell",children:s.jsx("div",{className:"account-auth-panel",children:s.jsx(j,{account:i,loginTagline:"Backs up your bookmarks, settings, and theme across devices.",brand:s.jsxs("div",{className:"account-auth-auth-brand",children:[s.jsx(h,{size:18}),s.jsx("span",{children:"Ignite OS Account"})]})})})});const{user:e,billing:n,isPlus:t}=i,g=n!=null&&n.cancelAtPeriodEnd?"Cancels on":"Renews on",u=async()=>{c(!1),await i.setDiscord(a.trim()||null)&&c(!0)};return s.jsx("div",{className:"settings-page account-settings",children:s.jsxs("div",{className:"settings-page-inner",children:[s.jsxs("div",{className:"settings-page-head",children:[s.jsx("h1",{children:"Account"}),s.jsx("p",{children:e==null?void 0:e.email})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Profile"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Email"}),s.jsx("div",{className:"settings-row-hint",children:e==null?void 0:e.email})]}),s.jsx("span",{className:`account-pill ${e!=null&&e.emailVerified?"ok":""}`,children:e!=null&&e.emailVerified?"Verified":"Unverified"})]}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Member since"}),s.jsx("div",{className:"settings-row-hint",children:"When you created this Ignite OS account"})]}),s.jsx("div",{className:"account-value",children:m(e==null?void 0:e.createdAt)})]}),s.jsx("div",{className:"settings-field-grid",children:s.jsxs("label",{className:"settings-field",children:[s.jsx("span",{className:"settings-field-label",children:"Discord username or user ID"}),s.jsxs("div",{className:"settings-row",style:{gap:8},children:[s.jsx("input",{className:"settings-input",style:{flex:1},value:a,placeholder:"username or 17–20 digit ID",onChange:l=>{d(l.target.value),c(!1)}}),s.jsx("button",{type:"button",className:"account-btn ghost",disabled:i.busy,onClick:()=>void u(),children:"Save"})]}),s.jsx("span",{className:"settings-field-label",children:x?"Saved — used for the Plus role in the Ignite OS Discord.":"Optional. Used for the Plus role in the Ignite OS Discord. You can also enter this at checkout."})]})})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Ignite OS Plus"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Status"}),s.jsx("div",{className:"settings-row-hint",children:t?"3M AI tokens/day, exclusive links, and an ad-free experience are unlocked.":"Upgrade for 3M AI tokens/day, exclusive links, and an ad-free experience."})]}),s.jsx("span",{className:`account-pill ${t?"plus":""}`,children:t?"Active":"Free"})]}),t&&(n==null?void 0:n.currentPeriodEnd)&&s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:g}),s.jsx("div",{className:"settings-row-hint",children:"Manage or cancel anytime in the billing portal"})]}),s.jsx("div",{className:"account-value",children:m(n.currentPeriodEnd)})]}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:t?"Billing":"Upgrade"}),s.jsx("div",{className:"settings-row-hint",children:t?"Update payment, invoices, or cancel.":"Subscribe to Ignite OS Plus."})]}),t?s.jsx("button",{type:"button",className:"account-btn ghost",onClick:()=>void i.manageBilling(),children:"Manage billing"}):s.jsx("button",{type:"button",className:"account-btn primary",onClick:()=>void i.checkout((e==null?void 0:e.email)??void 0),children:"Upgrade to Plus"})]}),!t&&s.jsx(v,{}),i.authError&&s.jsx("div",{className:"account-error",children:i.authError})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Cloud sync"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Backup & device sync"}),s.jsx("div",{className:"settings-row-hint",children:"Bookmarks, settings, theme, and proxied-site logins (cookies) sync to this account automatically."})]}),s.jsx("span",{className:"account-pill ok",children:"On"})]})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Session"}),s.jsxs("div",{className:"settings-row",children:[s.jsxs("div",{className:"settings-row-text",children:[s.jsx("div",{className:"settings-row-label",children:"Sign out"}),s.jsx("div",{className:"settings-row-hint",children:"Signs out on this device only."})]}),s.jsx("button",{type:"button",className:"account-btn ghost",onClick:()=>void i.logout(),children:"Sign out"})]})]}),s.jsxs("div",{className:"settings-page-foot",children:[s.jsx(h,{size:14}),s.jsx("span",{children:"Ignite OS"})]})]})})}export{k as AccountPage};
@@ -5,7 +5,7 @@ ${s.content}`)].filter(Boolean).join(`
5
5
 
6
6
  `):t[t.length-1]=l;continue}t.push(l)}return t}function Yt(e,t,s,r,a){var N;const l=e==null?void 0:e.settings,h=qe((l==null?void 0:l.model)??(e==null?void 0:e.model)??t),g={model:h,messages:Jt(r),web_search:a};e!=null&&e.id&&(g.session_id=e.id),(N=l==null?void 0:l.systemPrompt)!=null&&N.trim()&&(g.system_prompt=l.systemPrompt.trim()),typeof(l==null?void 0:l.temperature)=="number"&&(g.temperature=l.temperature);const j=Ve(h,(l==null?void 0:l.thinking)??s);return j&&(g.reasoning_effort=j),g}function Qt(e,t,s,r){const[a,l]=o.useState(!1),[h,g]=o.useState(null),j=o.useRef(null),N=o.useCallback(async(y,b,k,T)=>{const p=e.threads.find(L=>L.id===y),c=T??ie();e.update(y,L=>{const R=T?L.messages.find(d=>d.id===T):null,u=R?(()=>{const d=[...R.versions??[{content:R.content,meta:R.meta}],{content:""}];return{...R,versions:d,version:d.length-1,content:"",meta:void 0,sources:void 0,tools:void 0,artifacts:void 0,ask:void 0,fallbacks:void 0,error:void 0,pending:!0}})():{id:c,role:"assistant",content:"",pending:!0};return{...L,messages:[...b,u],updatedAt:Date.now()}});const v=new AbortController;j.current=v,l(!0),g(null);const S=performance.now(),_=L=>e.update(y,R=>({...R,messages:R.messages.map(u=>u.id===c?{...u,...L}:u)})),C=()=>e.update(y,L=>({...L,messages:L.messages.map(R=>{var i,E;if(R.id!==c||!R.versions)return R;const u=R.versions.slice(0,-1),d=u.length-1;return{...R,versions:u,version:d,content:((i=u[d])==null?void 0:i.content)??"",meta:(E=u[d])==null?void 0:E.meta,pending:!1}})}));let m="",A=0;try{await He(Yt(p,t,s,b,k),v.signal,u=>e.update(y,d=>({...d,messages:d.messages.map(i=>i.id!==c?i:(m=i.content+u,{...i,content:m}))})),u=>{A=u},u=>e.update(y,d=>({...d,messages:d.messages.map(i=>i.id===c?{...i,sources:[...i.sources??[],...u]}:i)})),u=>e.update(y,d=>({...d,messages:d.messages.map(i=>{if(i.id!==c)return i;const E=[...i.tools??[]],I=E.findIndex(P=>P.id===u.id);return I>=0?E[I]={...E[I],...u}:E.push(u),{...i,tools:E}})})),u=>e.update(y,d=>({...d,messages:d.messages.map(i=>{if(i.id!==c)return i;const E=[...(i.artifacts??[]).filter(I=>I.id!==u.id),u];return{...i,artifacts:E}})})),u=>_({ask:u}),u=>e.update(y,d=>({...d,messages:d.messages.map(i=>{if(i.id!==c)return i;const E=`${u.from.model}:${u.to.model}:${u.reason}`,I=[...i.fallbacks??[]];return I.some(P=>`${P.from.model}:${P.to.model}:${P.reason}`===E)||I.push(u),{...i,fallbacks:I}})})));const R={tokens:A>0?A:ve(m),ms:Math.round(performance.now()-S),estimated:A===0};e.update(y,u=>({...u,messages:u.messages.map(d=>{var E;if(d.id!==c)return d;const i=(E=d.versions)==null?void 0:E.map((I,P)=>P===(d.version??0)?{content:m,meta:R}:I);return{...d,content:m,pending:!1,meta:R,versions:i}})}))}catch(L){if(v.signal.aborted)e.update(y,R=>({...R,messages:R.messages.map(u=>{var i;if(u.id!==c)return u;const d=(i=u.versions)==null?void 0:i.map((E,I)=>I===(u.version??0)?{content:u.content}:E);return{...u,pending:!1,versions:d}})}));else if(L instanceof oe&&L.code==="rate_limit")T?C():e.update(y,R=>({...R,messages:R.messages.filter(u=>u.id!==c)})),r==null||r({code:L.code,reason:L.reason});else{const R=L instanceof Error?L.message:"Something went wrong.";if(g(R),m.trim()){const d={tokens:A>0?A:ve(m),ms:Math.round(performance.now()-S),estimated:A===0};_({content:m,pending:!1,error:!1,meta:d})}else T?C():_({content:R,pending:!1,error:!0})}}finally{l(!1),j.current=null}},[e,t,s,r]),M=o.useCallback((y,b,k,T)=>{var C,m;const p=y.trim();if(!p&&b.length===0&&k.length===0)return;const c=e.threads.find(A=>A.id===e.activeId),v=c?c.id:e.create(t),S=(c==null?void 0:c.messages)??[],_={id:ie(),role:"user",content:p,images:b.length?b:void 0,files:k.length?k:void 0};if(S.length===0){const A=Ct(p||((C=k[0])==null?void 0:C.name)||"New chat");e.update(v,L=>({...L,title:A})),Vt(p||((m=k[0])==null?void 0:m.content.slice(0,500))||"").then(L=>{L&&e.update(v,R=>R.title===A||R.title==="New chat"?{...R,title:L}:R)})}N(v,[...S,_],T)},[e,t,N]),D=o.useCallback(()=>{var y;return(y=j.current)==null?void 0:y.abort()},[]),f=o.useCallback((y,b)=>{const k=e.activeThread;if(!k)return;const T=b?k.messages.find(v=>v.id===b&&v.role==="assistant"):[...k.messages].reverse().find(v=>v.role==="assistant"&&!v.error);if(!T)return;let c=k.messages.findIndex(v=>v.id===T.id)-1;for(;c>=0&&k.messages[c].role!=="user";)c--;c<0||N(k.id,k.messages.slice(0,c+1),y,T.id)},[e,N]),x=o.useCallback((y,b,k)=>{const T=e.activeThread,p=b.trim();if(!T||!p)return;const c=T.messages.findIndex(S=>S.id===y&&S.role==="user");if(c<0)return;const v={...T.messages[c],content:p};N(T.id,[...T.messages.slice(0,c),v],k)},[e,N]),w=o.useCallback((y,b)=>{const k=e.activeThread;k&&e.update(k.id,T=>({...T,messages:T.messages.map(p=>p.id!==y||!p.versions||b<0||b>=p.versions.length?p:{...p,version:b,content:p.versions[b].content,meta:p.versions[b].meta})}))},[e]);return{isStreaming:a,error:h,send:M,stop:D,regenerate:f,editResend:x,setVersion:w}}function Zt(e){return e.replace(/\r\n?/g,`
7
7
  `).replace(/\\\[([\s\S]*?)\\\]/g,(t,s)=>`$$${s}$$`).replace(/\\\(([\s\S]*?)\\\)/g,(t,s)=>`$${s}$`)}const en=/https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"]/g;function tn(e,t=3){const s=new Set,r=[];for(const a of e.matchAll(en)){const l=a[0];if(!s.has(l)&&(s.add(l),r.push(l),r.length>=t))break}return r}function Ke({content:e}){return n.jsx("div",{className:"md",children:n.jsx(wt,{remarkPlugins:[kt,St],rehypePlugins:[jt],skipHtml:!0,components:{a:({node:t,...s})=>n.jsx("a",{...s,target:"_blank",rel:"noreferrer noopener"})},children:Zt(e)})})}const nn=250,F=new Map;function Ne(e,t){F.delete(e),F.set(e,t),F.size>nn&&F.delete(F.keys().next().value)}function sn(e){const[t,s]=o.useState(()=>F.get(e)??null);return o.useEffect(()=>{if(F.has(e)){s(F.get(e)??null);return}let r=!1;return fetch(K(`/api/ai/embed?url=${encodeURIComponent(e)}`),{credentials:B}).then(a=>a.ok?a.json():null).then(a=>{Ne(e,a),r||s(a)}).catch(()=>{Ne(e,null)}),()=>{r=!0}},[e]),t}function an({url:e}){const t=sn(e);return!t||!t.title&&!t.description?null:n.jsxs("a",{className:"ai-embed",href:t.url,target:"_blank",rel:"noreferrer noopener",children:[t.image&&n.jsx("img",{className:"ai-embed-thumb",src:t.image,alt:"",loading:"lazy"}),n.jsxs("div",{className:"ai-embed-body",children:[t.siteName&&n.jsx("span",{className:"ai-embed-site",children:t.siteName}),t.title&&n.jsx("span",{className:"ai-embed-title",children:t.title}),t.description&&n.jsx("span",{className:"ai-embed-desc",children:t.description})]})]})}function rn({content:e}){const t=tn(e);return t.length===0?null:n.jsx("div",{className:"ai-embeds",children:t.map(s=>n.jsx(an,{url:s},s))})}function on(e){return e==="web_search"?"Searching":e==="fetch_url"?"Reading page":e==="create_artifact"||e==="edit_artifact"?"Building":e==="ask_user"?"Asking":e}function cn({tools:e}){return e.length?n.jsx("div",{className:"ai-tools-trace",children:e.map(t=>n.jsxs("div",{className:`ai-tool-chip ${t.status}`,title:t.detail,children:[n.jsx(fe,{size:11}),n.jsx("span",{children:on(t.name)}),t.detail?n.jsx("em",{children:t.detail}):null]},t.id))}):null}function ln({message:e,canRegenerate:t,onRegenerate:s,onEdit:r,onSetVersion:a,onAskPick:l}){var b,k,T,p,c,v,S,_;const[h,g]=o.useState(!1),[j,N]=o.useState(!1),[M,D]=o.useState(""),f=()=>{navigator.clipboard.writeText(e.content).then(()=>{g(!0),setTimeout(()=>g(!1),1500)}).catch(()=>{})};if(e.role==="user"){const C=()=>{const m=M.trim();N(!1),m&&m!==e.content&&(r==null||r(m))};return n.jsxs("div",{className:"ai-msg user",children:[(b=e.images)!=null&&b.length?n.jsx("div",{className:"ai-msg-images",children:e.images.map((m,A)=>n.jsx("img",{src:m,alt:""},A))}):null,(k=e.files)!=null&&k.length?n.jsx("div",{className:"ai-msg-files",children:e.files.map((m,A)=>n.jsx("span",{className:"ai-file-chip",children:m.name},A))}):null,j?n.jsxs("div",{className:"ai-edit",children:[n.jsx("textarea",{value:M,autoFocus:!0,rows:3,onChange:m=>D(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey?(m.preventDefault(),C()):m.key==="Escape"&&N(!1)}}),n.jsxs("div",{className:"ai-edit-actions",children:[n.jsx("button",{type:"button",className:"ai-edit-cancel",onClick:()=>N(!1),children:"Cancel"}),n.jsx("button",{type:"button",className:"ai-edit-save",onClick:C,disabled:!M.trim(),children:"Save & resend"})]})]}):e.content?n.jsx("div",{className:"ai-bubble",children:e.content}):null,!j&&r&&e.content?n.jsx("div",{className:"ai-actions",children:n.jsx("button",{className:"ai-act",type:"button",title:"Edit & resend","aria-label":"Edit & resend",onClick:()=>{D(e.content),N(!0)},children:n.jsx(Ae,{size:14})})}):null]})}const x=((T=e.versions)==null?void 0:T.length)??0,w=e.version??x-1,y=C=>C.from.model===C.to.model?C.reason==="slow"?`${C.from.provider} is responding slowly. Falling back to ${C.to.provider}.`:`${C.from.provider} failed. Falling back to ${C.to.provider}.`:`${C.from.provider} failed. Switching to ${C.to.label} on ${C.to.provider}.`;return n.jsxs("div",{className:"ai-msg assistant",children:[(p=e.fallbacks)!=null&&p.length?n.jsx("div",{className:"ai-fallback-list",role:"status","aria-label":"AI fallback status",children:e.fallbacks.map((C,m)=>n.jsxs("div",{className:"ai-fallback",children:[n.jsx(nt,{size:13}),n.jsx("span",{children:y(C)})]},`${C.from.model}:${C.to.model}:${C.reason}:${m}`))}):null,(c=e.tools)!=null&&c.length?n.jsx(cn,{tools:e.tools}):null,e.pending&&!e.content&&!((v=e.tools)!=null&&v.length)?n.jsxs("div",{className:"ai-typing","aria-label":"Thinking",children:[n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{})]}):e.error?n.jsx("div",{className:"ai-error",children:e.content}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"ai-bubble ai-bubble-assistant",children:n.jsx(Ke,{content:e.content})}),(S=e.ask)!=null&&S.options.length?n.jsxs("div",{className:"ai-ask",children:[n.jsx("p",{children:e.ask.question}),n.jsx("div",{className:"ai-ask-options",children:e.ask.options.map(C=>n.jsx("button",{type:"button",onClick:()=>l==null?void 0:l(C),disabled:e.pending,children:C},C))})]}):null,!e.pending&&((_=e.sources)!=null&&_.length)?n.jsxs("div",{className:"ai-sources",children:[n.jsxs("span",{className:"ai-sources-label",children:[n.jsx(fe,{size:12})," Sources"]}),n.jsx("ol",{className:"ai-sources-list",children:e.sources.map((C,m)=>n.jsx("li",{children:n.jsx("a",{href:C.url,target:"_blank",rel:"noreferrer noopener",children:C.title||C.url})},m))})]}):null,!e.pending&&n.jsx(rn,{content:e.content}),!e.pending&&n.jsxs("div",{className:"ai-actions",children:[n.jsx("button",{className:"ai-act",type:"button",onClick:f,title:h?"Copied":"Copy","aria-label":"Copy",children:n.jsx(st,{size:14})}),t&&s&&n.jsx("button",{className:"ai-act",type:"button",onClick:s,title:"Regenerate","aria-label":"Regenerate",children:n.jsx(at,{size:14})}),x>1&&a&&n.jsxs("span",{className:"ai-version-nav",children:[n.jsx("button",{className:"ai-act",type:"button","aria-label":"Previous version",disabled:w<=0,onClick:()=>a(w-1),children:n.jsx(rt,{size:14})}),n.jsxs("span",{className:"ai-version-label",children:[w+1,"/",x]}),n.jsx("button",{className:"ai-act",type:"button","aria-label":"Next version",disabled:w>=x-1,onClick:()=>a(w+1),children:n.jsx(it,{size:14})})]}),e.meta&&n.jsxs("span",{className:"ai-meta",children:[e.meta.estimated?"~":"",e.meta.tokens," tokens · ",Et(e.meta.ms)]})]})]})]})}const un=1280,dn=.85;function fn(e){return new Promise((t,s)=>{const r=new FileReader;r.onerror=()=>s(r.error),r.onload=()=>{const a=new Image;a.onerror=()=>s(new Error("Could not load image")),a.onload=()=>{const l=Math.min(1,un/Math.max(a.width,a.height)),h=document.createElement("canvas");h.width=Math.round(a.width*l),h.height=Math.round(a.height*l);const g=h.getContext("2d");if(!g){t(r.result);return}g.drawImage(a,0,0,h.width,h.height),t(h.toDataURL("image/jpeg",dn))},a.src=r.result},r.readAsDataURL(e)})}const te=4,Ee=5e4,Be=[".txt",".md",".markdown",".csv",".json",".js",".ts",".tsx",".jsx",".py",".html",".css",".xml",".yml",".yaml",".log",".java",".c",".cpp",".h",".rs",".go",".rb",".php",".sql",".sh",".toml",".ini",".env"];function pn(e){if(e.type.startsWith("text/")||e.type==="application/json")return!0;const t=e.name.toLowerCase();return Be.some(s=>t.endsWith(s))}async function mn(e){let t=await e.text();return t.length>Ee&&(t=`${t.slice(0,Ee)}
8
- [truncated]`),{name:e.name,content:t}}function hn({disabled:e,isStreaming:t,webSearch:s,searchLocked:r,onToggleWebSearch:a,onSend:l,onStop:h,modelSlot:g}){const[j,N]=o.useState(""),[M,D]=o.useState([]),[f,x]=o.useState([]),[w,y]=o.useState(!1),b=o.useRef(null),k=o.useRef(null),T=M.length+f.length,p=i=>Array.from(i.dataTransfer.types).includes("Files"),c=i=>{p(i)&&(i.preventDefault(),y(!0))},v=i=>{i.currentTarget===i.target&&y(!1)},S=i=>{p(i)&&(i.preventDefault(),y(!1),_(i.dataTransfer.files))},_=async i=>{if(!i)return;const E=te-T;if(E<=0)return;const I=Array.from(i).slice(0,E),P=await Promise.all(I.filter($=>$.type.startsWith("image/")).map(fn)),z=await Promise.all(I.filter($=>!$.type.startsWith("image/")&&pn($)).filter($=>!f.some(O=>O.name===$.name)).map(mn));P.length&&D($=>[...$,...P].slice(0,te)),z.length&&x($=>[...$,...z].slice(0,te))},C=()=>{k.current&&(k.current.style.height="auto")},m=!j.trim()&&M.length===0&&f.length===0,A=()=>{t||e||m||(l(j,M,f),N(""),D([]),x([]),C())},L=i=>{i.preventDefault(),A()},R=i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),A())},u=()=>{const i=k.current;i&&(i.style.height="auto",i.style.height=`${Math.min(i.scrollHeight,160)}px`)},d=i=>{Array.from(i.clipboardData.files).length>0&&(i.preventDefault(),_(i.clipboardData.files))};return n.jsxs("form",{className:`ai-composer ${w?"dragging":""}`,onSubmit:L,onDragOver:c,onDragLeave:v,onDrop:S,children:[w&&n.jsx("div",{className:"ai-drop-overlay",children:"Drop image or text file to attach"}),T>0&&n.jsxs("div",{className:"ai-attachments",children:[M.map((i,E)=>n.jsxs("div",{className:"ai-attachment",children:[n.jsx("img",{src:i,alt:""}),n.jsx("button",{type:"button","aria-label":"Remove",onClick:()=>D(I=>I.filter((P,z)=>z!==E)),children:n.jsx(re,{size:12})})]},`img-${E}`)),f.map((i,E)=>n.jsxs("div",{className:"ai-attachment-file",children:[n.jsx("span",{children:i.name}),n.jsx("button",{type:"button","aria-label":"Remove",onClick:()=>x(I=>I.filter((P,z)=>z!==E)),children:n.jsx(re,{size:12})})]},`file-${E}`))]}),n.jsx("textarea",{ref:k,value:j,rows:1,spellCheck:!0,disabled:e,placeholder:"Message Lucidity AI",onChange:i=>N(i.target.value),onInput:u,onKeyDown:R,onPaste:d}),n.jsxs("div",{className:"ai-composer-actions",children:[n.jsxs("button",{type:"button",className:`ai-tool ${s?"active":""}`,"aria-label":r?"Web search (Plus)":"Web search",title:r?"Web search · Plus":"Web search","aria-pressed":s,onClick:a,children:[n.jsx(fe,{size:15}),r?n.jsx(ot,{size:10}):null]}),n.jsx("button",{type:"button",className:"ai-tool","aria-label":"Attach image or file",title:"Attach",onClick:()=>{var i;return(i=b.current)==null?void 0:i.click()},children:n.jsx(ct,{size:15})}),n.jsx("div",{className:"ai-composer-spacer"}),g,t?n.jsx("button",{type:"button",className:"ai-send","aria-label":"Stop",onClick:h,children:n.jsx(lt,{size:16})}):n.jsx("button",{type:"submit",className:"ai-send","aria-label":"Send",disabled:e||m,children:n.jsx(ut,{size:16})})]}),n.jsx("input",{ref:b,type:"file",accept:`image/*,${Be.join(",")}`,multiple:!0,hidden:!0,onChange:i=>{_(i.target.files),i.target.value=""}})]})}function Ce(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function Te(e){return e>=1e6?`${Ce(e/1e6)}M`:e>=1e3?`${Ce(e/1e3)}k`:String(e)}function gn({streaming:e,isPlus:t,onUpgrade:s}){const[r,a]=o.useState(null),l=o.useCallback(async()=>{try{const N=await $e(),M=await fetch(K("/api/ai/usage"),{headers:{"x-fingerprint":N,...Le("account")},credentials:B});M.ok&&a(await M.json())}catch{}},[]);o.useEffect(()=>{e||l()},[e,l]);const h=!!r&&r.limit>0,g=h?Math.min(100,Math.round(r.used/r.limit*100)):0,j=g>=100?"full":g>=80?"high":"";return n.jsxs("div",{className:"ai-usage",children:[n.jsxs("div",{className:"ai-usage-head",children:[n.jsx("span",{className:"ai-usage-label",children:"Tokens today"}),n.jsx("span",{className:"ai-usage-val",children:h?`${Te(r.used)} / ${Te(r.limit)}`:"—"})]}),n.jsx("div",{className:`ai-usage-bar ${j}`,children:n.jsx("div",{className:"ai-usage-bar-fill",style:{width:`${g}%`}})}),!t&&n.jsxs("button",{type:"button",className:"ai-usage-upgrade",onClick:s,children:[n.jsx(pe,{size:14}),n.jsx("span",{children:"Upgrade for 3M tokens/day"})]})]})}function xn({threads:e,activeId:t,streaming:s,isPlus:r,screenSharing:a,screenError:l,onToggleScreen:h,onOpenSearch:g,onNew:j,onSelect:N,onRemove:M,onRename:D,onUpgrade:f}){const[x,w]=o.useState(null),[y,b]=o.useState(""),k=(p,c)=>{w(p),b(c)},T=()=>{x&&D(x,y),w(null)};return n.jsxs("aside",{className:"ai-rail",children:[n.jsxs("div",{className:"ai-rail-head",children:[n.jsxs("span",{className:"ai-rail-title",children:[n.jsx(pe,{size:15})," Lucidity AI"]}),n.jsxs("div",{className:"ai-rail-head-actions",children:[n.jsx("button",{className:`_1lqv40d ${a?"active":""}`,type:"button","aria-label":a?"Stop screen share":"Share screen with AI",title:a?"Stop screen share":"Share screen with AI",onClick:h,children:n.jsx(dt,{size:15})}),n.jsx("button",{className:"_1lqv40d",type:"button","aria-label":"Search chats",title:"Search chats (⌘K)",onClick:g,children:n.jsx(me,{size:15})}),n.jsx("button",{className:"_1lqv40d",type:"button","aria-label":"New chat",onClick:j,children:n.jsx(ft,{size:15})})]})]}),l&&n.jsx("div",{className:"ai-screen-error",children:l}),n.jsx("ul",{className:"ai-thread-list",children:e.map(p=>n.jsxs("li",{className:`ai-thread ${p.id===t?"active":""}`,onClick:()=>N(p.id),children:[x===p.id?n.jsx("input",{className:"ai-thread-edit",value:y,autoFocus:!0,onClick:c=>c.stopPropagation(),onChange:c=>b(c.target.value),onBlur:T,onKeyDown:c=>{c.key==="Enter"?(c.preventDefault(),T()):c.key==="Escape"&&w(null)}}):n.jsx("span",{className:"ai-thread-title",children:p.title}),n.jsxs("div",{className:"ai-thread-acts",children:[n.jsx("button",{className:"ai-thread-act",type:"button","aria-label":"Rename chat",onClick:c=>{c.stopPropagation(),k(p.id,p.title)},children:n.jsx(Ae,{size:13})}),n.jsx("button",{className:"ai-thread-act",type:"button","aria-label":"Delete chat",onClick:c=>{c.stopPropagation(),M(p.id)},children:n.jsx(pt,{size:13})})]})]},p.id))}),n.jsx(gn,{streaming:s,isPlus:r,onUpgrade:f})]})}const bn=20;function yn(e,t){if(!t)return{thread:e,snippet:null};if(e.title.toLowerCase().includes(t))return{thread:e,snippet:null};const s=e.messages.find(h=>h.content.toLowerCase().includes(t));if(!s)return null;const r=s.content.toLowerCase().indexOf(t),a=Math.max(0,r-40),l=`${a>0?"…":""}${s.content.slice(a,r+t.length+60).replace(/\s+/g," ")}`;return{thread:e,snippet:l}}function vn({threads:e,onSelect:t,onClose:s}){const r=o.useRef(null),a=o.useRef(null),[l,h]=o.useState(""),[g,j]=o.useState(0),N=o.useMemo(()=>{const f=l.trim().toLowerCase();return e.map(x=>yn(x,f)).filter(x=>x!==null).slice(0,bn)},[e,l]);o.useEffect(()=>{var f;(f=r.current)==null||f.focus()},[]),o.useEffect(()=>{j(0)},[l]),o.useEffect(()=>{var x;const f=(x=a.current)==null?void 0:x.children[g];f==null||f.scrollIntoView({block:"nearest"})},[g]);const M=f=>{t(f.thread.id),s()},D=f=>{if(f.key==="Escape")f.preventDefault(),s();else if(f.key==="ArrowDown")f.preventDefault(),j(x=>Math.min(x+1,N.length-1));else if(f.key==="ArrowUp")f.preventDefault(),j(x=>Math.max(x-1,0));else if(f.key==="Enter"){f.preventDefault();const x=N[g];x&&M(x)}};return n.jsx("div",{className:"ai-search-backdrop",onMouseDown:f=>f.target===f.currentTarget&&s(),children:n.jsxs(Ie.div,{className:"ai-search",initial:{opacity:0,scale:.97,y:-8},animate:{opacity:1,scale:1,y:0},transition:{type:"spring",stiffness:480,damping:34},children:[n.jsxs("div",{className:"ai-search-input",children:[n.jsx(me,{size:15}),n.jsx("input",{ref:r,value:l,onChange:f=>h(f.target.value),onKeyDown:D,placeholder:"Search chats"}),n.jsx("kbd",{children:"esc"})]}),n.jsxs("ul",{className:"ai-search-results",ref:a,children:[N.map((f,x)=>n.jsx("li",{children:n.jsxs("button",{type:"button",className:`ai-search-row ${x===g?"active":""}`,onMouseEnter:()=>j(x),onClick:()=>M(f),children:[n.jsx("span",{className:"ai-search-title",children:f.thread.title}),n.jsx("span",{className:"ai-search-sub",children:f.snippet??`${f.thread.messages.length} messages`})]})},f.thread.id)),N.length===0&&n.jsx("li",{className:"ai-search-empty",children:"No matching chats."})]})]})})}const wn={openai:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.4114-.6813zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",anthropic:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2225 2.2914-5.9456 2.2914 5.9456Z",deepseek:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 0 1-.465.137 9.597 9.597 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 0 0 1.545-.475c1.271-.686 1.784-1.815 1.905-3.182.018-.209-.002-.425-.24-.522zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 0 1 .415-.287.302.302 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 0 1-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.196-.019.354-.25.452z",qwen:"M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z"};function ne({provider:e,size:t=16,tinted:s=!0}){return n.jsx("svg",{className:`ai-brand ${s?"tinted":""}`,"data-provider":e,width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:wn[e]})})}function jn({value:e,onChange:t,enabled:s}){return n.jsxs("div",{className:`ai-think ${s?"":"disabled"}`,children:[n.jsxs("div",{className:"ai-think-head",children:[n.jsx(pe,{size:13}),n.jsx("span",{children:"Thinking"}),!s&&n.jsx("span",{className:"ai-think-hint",children:"Unavailable"})]}),n.jsx("div",{className:"ai-think-levels",role:"group","aria-label":"Thinking level",children:Kt.map(r=>n.jsx("button",{type:"button",disabled:!s,"aria-pressed":e===r.id,className:`ai-think-btn ${e===r.id?"active":""}`,onClick:()=>t(r.id),children:r.label},r.id))})]})}function kn(e,t){const s=t.trim().toLowerCase();return s?`${e.label} ${e.blurb} ${e.provider}`.toLowerCase().includes(s):!0}function Sn({value:e,onChange:t,thinking:s,onThinkingChange:r}){const[a,l]=o.useState(!1),[h,g]=o.useState(""),[j,N]=o.useState(0),M=o.useRef(null),D=o.useRef(null),f=o.useRef(null),x=o.useMemo(()=>Se().map(c=>({...c,models:c.models.filter(v=>kn(v,h))})).filter(c=>c.models.length>0),[h]),w=o.useMemo(()=>x.flatMap(c=>c.models),[x]),y=o.useMemo(()=>Se().flatMap(c=>c.models),[]),b=y.find(c=>c.id===e)??y[0],k=b?Ue(b.id):!1;if(o.useEffect(()=>{if(!a)return;const c=_=>{var C;(C=M.current)!=null&&C.contains(_.target)||l(!1)},v=_=>{_.key==="Escape"&&l(!1)},S=gt();return S.addEventListener("mousedown",c),S.addEventListener("keydown",v),()=>{S.removeEventListener("mousedown",c),S.removeEventListener("keydown",v)}},[a]),o.useEffect(()=>{var c;if(!a){g("");return}N(Math.max(0,y.findIndex(v=>v.id===e))),(c=D.current)==null||c.focus()},[a,y,e]),o.useEffect(()=>{j>=w.length&&N(0)},[j,w.length]),o.useEffect(()=>{!k&&s!==ce&&r(ce)},[k,s,r]),o.useEffect(()=>{var c,v;(v=(c=f.current)==null?void 0:c.querySelector(".ai-pick.cursor"))==null||v.scrollIntoView({block:"nearest"})},[j,h]),!b)return null;const T=c=>{t(c.id),l(!1)},p=c=>{if(c.key==="Escape")return l(!1);if(c.key==="ArrowDown")c.preventDefault(),N(v=>w.length?(v+1)%w.length:0);else if(c.key==="ArrowUp")c.preventDefault(),N(v=>w.length?(v-1+w.length)%w.length:0);else if(c.key==="Enter"){c.preventDefault();const v=w[j];v&&T(v)}};return n.jsxs("div",{className:"ai-model",ref:M,children:[n.jsxs("button",{type:"button",className:`ai-model-trigger ${a?"open":""}`,onClick:()=>l(c=>!c),children:[n.jsx("span",{className:"ai-model-tile",children:n.jsx(ne,{provider:b.provider,size:14})}),n.jsx("span",{className:"ai-model-name",children:b.label}),k&&s!=="none"&&n.jsx("span",{className:"ai-model-chip",children:"Thinking"}),n.jsx(mt,{size:14})]}),n.jsx(Nt,{children:a&&n.jsxs(Ie.div,{className:"ai-model-panel",initial:{opacity:0,y:10,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.97},transition:{duration:.16,ease:[.16,1,.3,1]},children:[n.jsxs("div",{className:"ai-model-search",children:[n.jsx(me,{size:14}),n.jsx("input",{ref:D,value:h,placeholder:"Search models",onChange:c=>{g(c.target.value),N(0)},onKeyDown:p})]}),n.jsxs("div",{className:"ai-model-list",ref:f,children:[x.map(c=>n.jsxs("section",{className:"ai-model-group",children:[n.jsxs("header",{className:"ai-model-group-head",children:[n.jsx(ne,{provider:c.provider.id,size:12}),n.jsx("span",{children:c.provider.label})]}),c.models.map(v=>{const S=w.indexOf(v);return n.jsxs("button",{type:"button",className:`ai-pick ${v.id===e?"active":""} ${S===j?"cursor":""}`,onMouseMove:()=>N(S),onClick:()=>T(v),children:[n.jsx("span",{className:"ai-pick-tile",children:n.jsx(ne,{provider:v.provider,size:17})}),n.jsxs("span",{className:"ai-pick-copy",children:[n.jsxs("span",{className:"ai-pick-name",children:[v.label,v.thinking&&n.jsx("span",{className:"ai-pick-tag",children:"Thinks"})]}),n.jsx("span",{className:"ai-pick-blurb",children:v.blurb})]}),n.jsx("span",{className:"ai-pick-end",children:v.id===e?n.jsx(ht,{size:14}):null})]},v.id)})]},c.provider.id)),x.length===0&&n.jsxs("p",{className:"ai-model-empty",children:["No models match “",h.trim(),"”"]})]}),n.jsx(jn,{value:s,onChange:r,enabled:k})]})})]})}const se="Geist Variable, ui-sans-serif, system-ui, sans-serif",Nn="Look at what's on my screen and directly answer or solve the question, problem, or task shown. Give the final answer clearly and concisely, with brief working only if it helps.";function Ge({tokens:e,isSharing:t,isAsking:s,output:r,error:a,onAsk:l,onClose:h,onPopOut:g}){const j=t&&!s,N=!!a||s||r.trim().length>0,M=!N,D={height:"34px",borderRadius:"6px",border:`1px solid ${e.border}`,background:e.surface2,color:e.text,padding:"0 14px",cursor:"pointer",fontFamily:se,fontWeight:600,fontSize:"12px"};return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:M?"8px":"10px",boxSizing:"border-box",padding:M?"10px":"12px",background:e.bg,color:e.text},children:[M?null:n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"999px",background:t?"#22c55e":"#ef4444",boxShadow:t?"0 0 8px rgba(34,197,94,0.55)":"0 0 8px rgba(239,68,68,0.55)"}}),n.jsx("span",{style:{fontSize:"12px",color:e.muted},children:t?"Screen sharing active":"Screen sharing inactive"})]}),n.jsx("textarea",{onKeyDown:f=>{if(f.key==="Enter"&&!f.shiftKey){f.preventDefault();const x=f.currentTarget,w=x.value.trim();if(!j||!w)return;l(w),x.value=""}},placeholder:"Ask about what's on your screen...",rows:1,disabled:s,style:{width:"100%",minHeight:M?"36px":"56px",maxHeight:"120px",resize:"none",boxSizing:"border-box",borderRadius:"6px",border:`1px solid ${e.border}`,background:e.surface2,color:e.text,padding:"10px",outline:"none",fontFamily:se,fontSize:"13px",lineHeight:"1.45",opacity:s?.72:1}}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx("button",{type:"button",onClick:()=>j&&l(Nn),disabled:!j,style:{...D,border:"none",background:e.accent,color:e.bg,fontWeight:700,opacity:j?1:.5,cursor:j?"pointer":"default"},children:s?"Solving…":"Solve question"}),g?n.jsx("button",{type:"button",onClick:g,style:{...D,marginLeft:"auto"},children:"Pop out"}):null,n.jsx("button",{type:"button",onClick:h,style:g?D:{...D,marginLeft:"auto"},children:"Close"})]}),N?n.jsx("div",{style:{overflow:"auto",maxHeight:"560px",borderRadius:"6px",border:`1px solid ${e.border}`,background:e.surface2,padding:"10px",color:e.text,boxSizing:"border-box",fontFamily:se,fontSize:"13px",lineHeight:"1.55",whiteSpace:"normal"},children:a?n.jsx("p",{style:{margin:0,color:"#fca5a5"},children:a}):n.jsx(Ke,{content:r})}):null]})}const En="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css",Cn={video:{cursor:"always"},audio:!1};function ue(){const e=getComputedStyle(document.documentElement),t=(s,r)=>e.getPropertyValue(s).trim()||r;return{bg:t("--bg","#0b0f14"),surface:t("--surface","#111827"),surface2:t("--surface-2","#1f2937"),border:t("--border","#374151"),text:t("--text","#f3f4f6"),muted:t("--muted","#9ca3af"),accent:t("--accent","#ffffff")}}function Tn(){try{if(window.top&&window.top!==window&&window.top.location.origin===window.location.origin)return window.top}catch{return window}return window}function Mn(e){const t="popup=yes,width=430,height=120";return e.open("","sa",t)??window.open("","sa",t)}function Rn(e){const t=e.document;if(t.title="Assistant",t.body.innerHTML="",t.body.style.margin="0",t.documentElement.style.overflow="hidden",t.body.style.overflow="hidden",t.body.style.fontFamily="Manrope Variable, Geist Variable, ui-sans-serif, system-ui, sans-serif",!t.getElementById("_rwcxeuq")){const r=t.createElement("style");r.id="_rwcxeuq",r.textContent=`
8
+ [truncated]`),{name:e.name,content:t}}function hn({disabled:e,isStreaming:t,webSearch:s,searchLocked:r,onToggleWebSearch:a,onSend:l,onStop:h,modelSlot:g}){const[j,N]=o.useState(""),[M,D]=o.useState([]),[f,x]=o.useState([]),[w,y]=o.useState(!1),b=o.useRef(null),k=o.useRef(null),T=M.length+f.length,p=i=>Array.from(i.dataTransfer.types).includes("Files"),c=i=>{p(i)&&(i.preventDefault(),y(!0))},v=i=>{i.currentTarget===i.target&&y(!1)},S=i=>{p(i)&&(i.preventDefault(),y(!1),_(i.dataTransfer.files))},_=async i=>{if(!i)return;const E=te-T;if(E<=0)return;const I=Array.from(i).slice(0,E),P=await Promise.all(I.filter($=>$.type.startsWith("image/")).map(fn)),z=await Promise.all(I.filter($=>!$.type.startsWith("image/")&&pn($)).filter($=>!f.some(O=>O.name===$.name)).map(mn));P.length&&D($=>[...$,...P].slice(0,te)),z.length&&x($=>[...$,...z].slice(0,te))},C=()=>{k.current&&(k.current.style.height="auto")},m=!j.trim()&&M.length===0&&f.length===0,A=()=>{t||e||m||(l(j,M,f),N(""),D([]),x([]),C())},L=i=>{i.preventDefault(),A()},R=i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),A())},u=()=>{const i=k.current;i&&(i.style.height="auto",i.style.height=`${Math.min(i.scrollHeight,160)}px`)},d=i=>{Array.from(i.clipboardData.files).length>0&&(i.preventDefault(),_(i.clipboardData.files))};return n.jsxs("form",{className:`ai-composer ${w?"dragging":""}`,onSubmit:L,onDragOver:c,onDragLeave:v,onDrop:S,children:[w&&n.jsx("div",{className:"ai-drop-overlay",children:"Drop image or text file to attach"}),T>0&&n.jsxs("div",{className:"ai-attachments",children:[M.map((i,E)=>n.jsxs("div",{className:"ai-attachment",children:[n.jsx("img",{src:i,alt:""}),n.jsx("button",{type:"button","aria-label":"Remove",onClick:()=>D(I=>I.filter((P,z)=>z!==E)),children:n.jsx(re,{size:12})})]},`img-${E}`)),f.map((i,E)=>n.jsxs("div",{className:"ai-attachment-file",children:[n.jsx("span",{children:i.name}),n.jsx("button",{type:"button","aria-label":"Remove",onClick:()=>x(I=>I.filter((P,z)=>z!==E)),children:n.jsx(re,{size:12})})]},`file-${E}`))]}),n.jsx("textarea",{ref:k,value:j,rows:1,spellCheck:!0,disabled:e,placeholder:"Message Ignite AI",onChange:i=>N(i.target.value),onInput:u,onKeyDown:R,onPaste:d}),n.jsxs("div",{className:"ai-composer-actions",children:[n.jsxs("button",{type:"button",className:`ai-tool ${s?"active":""}`,"aria-label":r?"Web search (Plus)":"Web search",title:r?"Web search · Plus":"Web search","aria-pressed":s,onClick:a,children:[n.jsx(fe,{size:15}),r?n.jsx(ot,{size:10}):null]}),n.jsx("button",{type:"button",className:"ai-tool","aria-label":"Attach image or file",title:"Attach",onClick:()=>{var i;return(i=b.current)==null?void 0:i.click()},children:n.jsx(ct,{size:15})}),n.jsx("div",{className:"ai-composer-spacer"}),g,t?n.jsx("button",{type:"button",className:"ai-send","aria-label":"Stop",onClick:h,children:n.jsx(lt,{size:16})}):n.jsx("button",{type:"submit",className:"ai-send","aria-label":"Send",disabled:e||m,children:n.jsx(ut,{size:16})})]}),n.jsx("input",{ref:b,type:"file",accept:`image/*,${Be.join(",")}`,multiple:!0,hidden:!0,onChange:i=>{_(i.target.files),i.target.value=""}})]})}function Ce(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function Te(e){return e>=1e6?`${Ce(e/1e6)}M`:e>=1e3?`${Ce(e/1e3)}k`:String(e)}function gn({streaming:e,isPlus:t,onUpgrade:s}){const[r,a]=o.useState(null),l=o.useCallback(async()=>{try{const N=await $e(),M=await fetch(K("/api/ai/usage"),{headers:{"x-fingerprint":N,...Le("account")},credentials:B});M.ok&&a(await M.json())}catch{}},[]);o.useEffect(()=>{e||l()},[e,l]);const h=!!r&&r.limit>0,g=h?Math.min(100,Math.round(r.used/r.limit*100)):0,j=g>=100?"full":g>=80?"high":"";return n.jsxs("div",{className:"ai-usage",children:[n.jsxs("div",{className:"ai-usage-head",children:[n.jsx("span",{className:"ai-usage-label",children:"Tokens today"}),n.jsx("span",{className:"ai-usage-val",children:h?`${Te(r.used)} / ${Te(r.limit)}`:"—"})]}),n.jsx("div",{className:`ai-usage-bar ${j}`,children:n.jsx("div",{className:"ai-usage-bar-fill",style:{width:`${g}%`}})}),!t&&n.jsxs("button",{type:"button",className:"ai-usage-upgrade",onClick:s,children:[n.jsx(pe,{size:14}),n.jsx("span",{children:"Upgrade for 3M tokens/day"})]})]})}function xn({threads:e,activeId:t,streaming:s,isPlus:r,screenSharing:a,screenError:l,onToggleScreen:h,onOpenSearch:g,onNew:j,onSelect:N,onRemove:M,onRename:D,onUpgrade:f}){const[x,w]=o.useState(null),[y,b]=o.useState(""),k=(p,c)=>{w(p),b(c)},T=()=>{x&&D(x,y),w(null)};return n.jsxs("aside",{className:"ai-rail",children:[n.jsxs("div",{className:"ai-rail-head",children:[n.jsxs("span",{className:"ai-rail-title",children:[n.jsx(pe,{size:15})," Ignite AI"]}),n.jsxs("div",{className:"ai-rail-head-actions",children:[n.jsx("button",{className:`_1lqv40d ${a?"active":""}`,type:"button","aria-label":a?"Stop screen share":"Share screen with AI",title:a?"Stop screen share":"Share screen with AI",onClick:h,children:n.jsx(dt,{size:15})}),n.jsx("button",{className:"_1lqv40d",type:"button","aria-label":"Search chats",title:"Search chats (⌘K)",onClick:g,children:n.jsx(me,{size:15})}),n.jsx("button",{className:"_1lqv40d",type:"button","aria-label":"New chat",onClick:j,children:n.jsx(ft,{size:15})})]})]}),l&&n.jsx("div",{className:"ai-screen-error",children:l}),n.jsx("ul",{className:"ai-thread-list",children:e.map(p=>n.jsxs("li",{className:`ai-thread ${p.id===t?"active":""}`,onClick:()=>N(p.id),children:[x===p.id?n.jsx("input",{className:"ai-thread-edit",value:y,autoFocus:!0,onClick:c=>c.stopPropagation(),onChange:c=>b(c.target.value),onBlur:T,onKeyDown:c=>{c.key==="Enter"?(c.preventDefault(),T()):c.key==="Escape"&&w(null)}}):n.jsx("span",{className:"ai-thread-title",children:p.title}),n.jsxs("div",{className:"ai-thread-acts",children:[n.jsx("button",{className:"ai-thread-act",type:"button","aria-label":"Rename chat",onClick:c=>{c.stopPropagation(),k(p.id,p.title)},children:n.jsx(Ae,{size:13})}),n.jsx("button",{className:"ai-thread-act",type:"button","aria-label":"Delete chat",onClick:c=>{c.stopPropagation(),M(p.id)},children:n.jsx(pt,{size:13})})]})]},p.id))}),n.jsx(gn,{streaming:s,isPlus:r,onUpgrade:f})]})}const bn=20;function yn(e,t){if(!t)return{thread:e,snippet:null};if(e.title.toLowerCase().includes(t))return{thread:e,snippet:null};const s=e.messages.find(h=>h.content.toLowerCase().includes(t));if(!s)return null;const r=s.content.toLowerCase().indexOf(t),a=Math.max(0,r-40),l=`${a>0?"…":""}${s.content.slice(a,r+t.length+60).replace(/\s+/g," ")}`;return{thread:e,snippet:l}}function vn({threads:e,onSelect:t,onClose:s}){const r=o.useRef(null),a=o.useRef(null),[l,h]=o.useState(""),[g,j]=o.useState(0),N=o.useMemo(()=>{const f=l.trim().toLowerCase();return e.map(x=>yn(x,f)).filter(x=>x!==null).slice(0,bn)},[e,l]);o.useEffect(()=>{var f;(f=r.current)==null||f.focus()},[]),o.useEffect(()=>{j(0)},[l]),o.useEffect(()=>{var x;const f=(x=a.current)==null?void 0:x.children[g];f==null||f.scrollIntoView({block:"nearest"})},[g]);const M=f=>{t(f.thread.id),s()},D=f=>{if(f.key==="Escape")f.preventDefault(),s();else if(f.key==="ArrowDown")f.preventDefault(),j(x=>Math.min(x+1,N.length-1));else if(f.key==="ArrowUp")f.preventDefault(),j(x=>Math.max(x-1,0));else if(f.key==="Enter"){f.preventDefault();const x=N[g];x&&M(x)}};return n.jsx("div",{className:"ai-search-backdrop",onMouseDown:f=>f.target===f.currentTarget&&s(),children:n.jsxs(Ie.div,{className:"ai-search",initial:{opacity:0,scale:.97,y:-8},animate:{opacity:1,scale:1,y:0},transition:{type:"spring",stiffness:480,damping:34},children:[n.jsxs("div",{className:"ai-search-input",children:[n.jsx(me,{size:15}),n.jsx("input",{ref:r,value:l,onChange:f=>h(f.target.value),onKeyDown:D,placeholder:"Search chats"}),n.jsx("kbd",{children:"esc"})]}),n.jsxs("ul",{className:"ai-search-results",ref:a,children:[N.map((f,x)=>n.jsx("li",{children:n.jsxs("button",{type:"button",className:`ai-search-row ${x===g?"active":""}`,onMouseEnter:()=>j(x),onClick:()=>M(f),children:[n.jsx("span",{className:"ai-search-title",children:f.thread.title}),n.jsx("span",{className:"ai-search-sub",children:f.snippet??`${f.thread.messages.length} messages`})]})},f.thread.id)),N.length===0&&n.jsx("li",{className:"ai-search-empty",children:"No matching chats."})]})]})})}const wn={openai:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.4114-.6813zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",anthropic:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2225 2.2914-5.9456 2.2914 5.9456Z",deepseek:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 0 1-.465.137 9.597 9.597 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 0 0 1.545-.475c1.271-.686 1.784-1.815 1.905-3.182.018-.209-.002-.425-.24-.522zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 0 1 .415-.287.302.302 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 0 1-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.196-.019.354-.25.452z",qwen:"M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z"};function ne({provider:e,size:t=16,tinted:s=!0}){return n.jsx("svg",{className:`ai-brand ${s?"tinted":""}`,"data-provider":e,width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:wn[e]})})}function jn({value:e,onChange:t,enabled:s}){return n.jsxs("div",{className:`ai-think ${s?"":"disabled"}`,children:[n.jsxs("div",{className:"ai-think-head",children:[n.jsx(pe,{size:13}),n.jsx("span",{children:"Thinking"}),!s&&n.jsx("span",{className:"ai-think-hint",children:"Unavailable"})]}),n.jsx("div",{className:"ai-think-levels",role:"group","aria-label":"Thinking level",children:Kt.map(r=>n.jsx("button",{type:"button",disabled:!s,"aria-pressed":e===r.id,className:`ai-think-btn ${e===r.id?"active":""}`,onClick:()=>t(r.id),children:r.label},r.id))})]})}function kn(e,t){const s=t.trim().toLowerCase();return s?`${e.label} ${e.blurb} ${e.provider}`.toLowerCase().includes(s):!0}function Sn({value:e,onChange:t,thinking:s,onThinkingChange:r}){const[a,l]=o.useState(!1),[h,g]=o.useState(""),[j,N]=o.useState(0),M=o.useRef(null),D=o.useRef(null),f=o.useRef(null),x=o.useMemo(()=>Se().map(c=>({...c,models:c.models.filter(v=>kn(v,h))})).filter(c=>c.models.length>0),[h]),w=o.useMemo(()=>x.flatMap(c=>c.models),[x]),y=o.useMemo(()=>Se().flatMap(c=>c.models),[]),b=y.find(c=>c.id===e)??y[0],k=b?Ue(b.id):!1;if(o.useEffect(()=>{if(!a)return;const c=_=>{var C;(C=M.current)!=null&&C.contains(_.target)||l(!1)},v=_=>{_.key==="Escape"&&l(!1)},S=gt();return S.addEventListener("mousedown",c),S.addEventListener("keydown",v),()=>{S.removeEventListener("mousedown",c),S.removeEventListener("keydown",v)}},[a]),o.useEffect(()=>{var c;if(!a){g("");return}N(Math.max(0,y.findIndex(v=>v.id===e))),(c=D.current)==null||c.focus()},[a,y,e]),o.useEffect(()=>{j>=w.length&&N(0)},[j,w.length]),o.useEffect(()=>{!k&&s!==ce&&r(ce)},[k,s,r]),o.useEffect(()=>{var c,v;(v=(c=f.current)==null?void 0:c.querySelector(".ai-pick.cursor"))==null||v.scrollIntoView({block:"nearest"})},[j,h]),!b)return null;const T=c=>{t(c.id),l(!1)},p=c=>{if(c.key==="Escape")return l(!1);if(c.key==="ArrowDown")c.preventDefault(),N(v=>w.length?(v+1)%w.length:0);else if(c.key==="ArrowUp")c.preventDefault(),N(v=>w.length?(v-1+w.length)%w.length:0);else if(c.key==="Enter"){c.preventDefault();const v=w[j];v&&T(v)}};return n.jsxs("div",{className:"ai-model",ref:M,children:[n.jsxs("button",{type:"button",className:`ai-model-trigger ${a?"open":""}`,onClick:()=>l(c=>!c),children:[n.jsx("span",{className:"ai-model-tile",children:n.jsx(ne,{provider:b.provider,size:14})}),n.jsx("span",{className:"ai-model-name",children:b.label}),k&&s!=="none"&&n.jsx("span",{className:"ai-model-chip",children:"Thinking"}),n.jsx(mt,{size:14})]}),n.jsx(Nt,{children:a&&n.jsxs(Ie.div,{className:"ai-model-panel",initial:{opacity:0,y:10,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.97},transition:{duration:.16,ease:[.16,1,.3,1]},children:[n.jsxs("div",{className:"ai-model-search",children:[n.jsx(me,{size:14}),n.jsx("input",{ref:D,value:h,placeholder:"Search models",onChange:c=>{g(c.target.value),N(0)},onKeyDown:p})]}),n.jsxs("div",{className:"ai-model-list",ref:f,children:[x.map(c=>n.jsxs("section",{className:"ai-model-group",children:[n.jsxs("header",{className:"ai-model-group-head",children:[n.jsx(ne,{provider:c.provider.id,size:12}),n.jsx("span",{children:c.provider.label})]}),c.models.map(v=>{const S=w.indexOf(v);return n.jsxs("button",{type:"button",className:`ai-pick ${v.id===e?"active":""} ${S===j?"cursor":""}`,onMouseMove:()=>N(S),onClick:()=>T(v),children:[n.jsx("span",{className:"ai-pick-tile",children:n.jsx(ne,{provider:v.provider,size:17})}),n.jsxs("span",{className:"ai-pick-copy",children:[n.jsxs("span",{className:"ai-pick-name",children:[v.label,v.thinking&&n.jsx("span",{className:"ai-pick-tag",children:"Thinks"})]}),n.jsx("span",{className:"ai-pick-blurb",children:v.blurb})]}),n.jsx("span",{className:"ai-pick-end",children:v.id===e?n.jsx(ht,{size:14}):null})]},v.id)})]},c.provider.id)),x.length===0&&n.jsxs("p",{className:"ai-model-empty",children:["No models match “",h.trim(),"”"]})]}),n.jsx(jn,{value:s,onChange:r,enabled:k})]})})]})}const se="Geist Variable, ui-sans-serif, system-ui, sans-serif",Nn="Look at what's on my screen and directly answer or solve the question, problem, or task shown. Give the final answer clearly and concisely, with brief working only if it helps.";function Ge({tokens:e,isSharing:t,isAsking:s,output:r,error:a,onAsk:l,onClose:h,onPopOut:g}){const j=t&&!s,N=!!a||s||r.trim().length>0,M=!N,D={height:"34px",borderRadius:"6px",border:`1px solid ${e.border}`,background:e.surface2,color:e.text,padding:"0 14px",cursor:"pointer",fontFamily:se,fontWeight:600,fontSize:"12px"};return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:M?"8px":"10px",boxSizing:"border-box",padding:M?"10px":"12px",background:e.bg,color:e.text},children:[M?null:n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"999px",background:t?"#22c55e":"#ef4444",boxShadow:t?"0 0 8px rgba(34,197,94,0.55)":"0 0 8px rgba(239,68,68,0.55)"}}),n.jsx("span",{style:{fontSize:"12px",color:e.muted},children:t?"Screen sharing active":"Screen sharing inactive"})]}),n.jsx("textarea",{onKeyDown:f=>{if(f.key==="Enter"&&!f.shiftKey){f.preventDefault();const x=f.currentTarget,w=x.value.trim();if(!j||!w)return;l(w),x.value=""}},placeholder:"Ask about what's on your screen...",rows:1,disabled:s,style:{width:"100%",minHeight:M?"36px":"56px",maxHeight:"120px",resize:"none",boxSizing:"border-box",borderRadius:"6px",border:`1px solid ${e.border}`,background:e.surface2,color:e.text,padding:"10px",outline:"none",fontFamily:se,fontSize:"13px",lineHeight:"1.45",opacity:s?.72:1}}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx("button",{type:"button",onClick:()=>j&&l(Nn),disabled:!j,style:{...D,border:"none",background:e.accent,color:e.bg,fontWeight:700,opacity:j?1:.5,cursor:j?"pointer":"default"},children:s?"Solving…":"Solve question"}),g?n.jsx("button",{type:"button",onClick:g,style:{...D,marginLeft:"auto"},children:"Pop out"}):null,n.jsx("button",{type:"button",onClick:h,style:g?D:{...D,marginLeft:"auto"},children:"Close"})]}),N?n.jsx("div",{style:{overflow:"auto",maxHeight:"560px",borderRadius:"6px",border:`1px solid ${e.border}`,background:e.surface2,padding:"10px",color:e.text,boxSizing:"border-box",fontFamily:se,fontSize:"13px",lineHeight:"1.55",whiteSpace:"normal"},children:a?n.jsx("p",{style:{margin:0,color:"#fca5a5"},children:a}):n.jsx(Ke,{content:r})}):null]})}const En="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css",Cn={video:{cursor:"always"},audio:!1};function ue(){const e=getComputedStyle(document.documentElement),t=(s,r)=>e.getPropertyValue(s).trim()||r;return{bg:t("--bg","#0b0f14"),surface:t("--surface","#111827"),surface2:t("--surface-2","#1f2937"),border:t("--border","#374151"),text:t("--text","#f3f4f6"),muted:t("--muted","#9ca3af"),accent:t("--accent","#ffffff")}}function Tn(){try{if(window.top&&window.top!==window&&window.top.location.origin===window.location.origin)return window.top}catch{return window}return window}function Mn(e){const t="popup=yes,width=430,height=120";return e.open("","sa",t)??window.open("","sa",t)}function Rn(e){const t=e.document;if(t.title="Assistant",t.body.innerHTML="",t.body.style.margin="0",t.documentElement.style.overflow="hidden",t.body.style.overflow="hidden",t.body.style.fontFamily="Manrope Variable, Geist Variable, ui-sans-serif, system-ui, sans-serif",!t.getElementById("_rwcxeuq")){const r=t.createElement("style");r.id="_rwcxeuq",r.textContent=`
9
9
  .md { overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; }
10
10
  .md p { margin: 0 0 8px; }
11
11
  .md p:last-child { margin-bottom: 0; }
@@ -15,4 +15,4 @@ ${s.content}`)].filter(Boolean).join(`
15
15
  .md pre code { background: transparent; padding: 0; }
16
16
  .md a { color: var(--assistant-accent); text-decoration: underline; }
17
17
  .md blockquote { margin: 8px 0; border-left: 2px solid var(--assistant-border); padding-left: 8px; opacity: 0.9; }
18
- `,t.head.append(r)}if(!t.getElementById("_1u0ijh5")){const r=t.createElement("link");r.id="_1u0ijh5",r.rel="stylesheet",r.href=En,t.head.append(r)}const s=t.createElement("div");return s.style.width="100%",s.style.display="block",t.body.append(s),s}function Ln(){return new Promise(e=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>e())})})}function An({onError:e,onStateChange:t}){const[s,r]=o.useState(!1),a=o.useRef(null),l=o.useRef(null),h=o.useRef(null),g=o.useRef(!1),j=o.useCallback(()=>{if(l.current)return l.current;const f=document.createElement("video");return f.muted=!0,f.autoplay=!0,f.playsInline=!0,l.current=f,f},[]),N=o.useCallback(()=>{const f=a.current;if(f)for(const x of f.getTracks())x.stop();a.current=null,l.current&&(l.current.srcObject=null),h.current=null,g.current=!1,r(!1),t()},[t]),M=o.useCallback(async f=>{if(a.current)return!0;try{const w=await(f??window).navigator.mediaDevices.getDisplayMedia(Cn);w.getVideoTracks()[0].addEventListener("ended",()=>N());const b=j();return b.srcObject=w,await b.play().catch(()=>{}),a.current=w,g.current=!0,r(!0),t(),!0}catch(x){const w=x instanceof Error?x.message:"Could not start screen sharing";return e(w),!1}},[j,e,t,N]),D=o.useCallback(async()=>{if(!a.current)throw new Error("Screen sharing is not active");const f=j();(!f.videoWidth||!f.videoHeight)&&await new Promise((S,_)=>{const C=window.setTimeout(()=>_(new Error("Timed out waiting for screen frame")),1200),m=()=>{window.clearTimeout(C),f.removeEventListener("loadeddata",m),S()};f.addEventListener("loadeddata",m)});const x=Math.max(1,f.videoWidth),w=Math.max(1,f.videoHeight),y=960,b=x>y?y/x:1,k=Math.max(1,Math.round(x*b)),T=Math.max(1,Math.round(w*b)),p=h.current??document.createElement("canvas");h.current=p,p.width=k,p.height=T;const c=p.getContext("2d");if(!c)throw new Error("Canvas context unavailable");c.drawImage(f,0,0,k,T);const v=await new Promise(S=>p.toBlob(S,"image/jpeg",.72));return v?await new Promise((S,_)=>{const C=new FileReader;C.onload=()=>{typeof C.result=="string"?S(C.result):_(new Error("Failed to encode screen capture"))},C.onerror=()=>_(new Error("Failed to encode screen capture")),C.readAsDataURL(v)}):p.toDataURL("image/jpeg",.72)},[j]);return{isSharing:s,isSharingRef:g,streamRef:a,startSharing:M,stopSharing:N,captureFrameDataUrl:D}}const In=380,Dn=240,_n=820,Pn=150;function $n(e){const t=e.document.body.firstElementChild;return t instanceof HTMLElement?Math.ceil(t.getBoundingClientRect().height):0}function de(e){try{if(e.closed)return;const t=$n(e)-e.innerHeight;if(Math.abs(t)<=1)return;const s=Math.min(_n,Math.max(Pn,e.outerHeight+t));s!==e.outerHeight&&e.resizeTo(e.outerWidth,s)}catch{}}function zn(e){try{e.requestAnimationFrame(()=>{de(e),e.setTimeout(()=>e.requestAnimationFrame(()=>de(e)),90)})}catch{}}function On({onAsk:e}){const[t,s]=o.useState("closed"),[r,a]=o.useState(""),[l,h]=o.useState(!1),[g,j]=o.useState(null),[N,M]=o.useState(null),[D,f]=o.useState(le),x=o.useRef(null),w=o.useRef(null),y=o.useRef(!1);y.current=l;const b=o.useCallback(d=>M(d),[]),k=o.useCallback(()=>{},[]),{isSharing:T,isSharingRef:p,streamRef:c,startSharing:v,stopSharing:S,captureFrameDataUrl:_}=An({onError:b,onStateChange:k}),C=o.useCallback(()=>{var i;const d=x.current;if(x.current=null,d){(i=d.resizeObserver)==null||i.disconnect(),window.setTimeout(()=>d.root.unmount(),0);try{d.window.close()}catch{}}},[]),m=o.useCallback(()=>{C(),S(),s("closed"),a(""),j(null)},[C,S]),A=o.useCallback(async d=>{var P,z,$;if(y.current)return;const i=d.trim();if(!i){j("Type a question first.");return}if(!p.current){j("Start screen sharing first.");return}h(!0),j(null),a("Thinking…");const E=x.current,I=(E==null?void 0:E.mountElement)??w.current;try{const q=(($=(z=(P=c.current)==null?void 0:P.getVideoTracks()[0])==null?void 0:z.getSettings())==null?void 0:$.displaySurface)==="monitor"&&I;q&&(I.style.visibility="hidden",await Ln());const Xe=await _();q&&(I.style.visibility="visible",E==null||E.window.focus());let xe=!1,X="";await e(i,Xe,{onDelta:U=>{xe||(X="",xe=!0),X+=U,a(X),j(null)},onError:U=>{a(U),j(U)},onComplete:()=>h(!1)})}catch(O){I&&(I.style.visibility="visible");const q=O instanceof Error?O.message:"Failed to ask about screen";a(q),j(q)}finally{h(!1)}},[_,p,e,c]),L=o.useCallback(()=>{var d;if(p.current){S();return}v(t==="window"?(d=x.current)==null?void 0:d.window:window)},[p,t,v,S]);o.useEffect(()=>{if(t!=="window")return;const d=x.current;if(!d)return;const i=ue(),E=d.window.document;E.documentElement.style.background=i.bg,E.body.style.background=i.bg,E.body.style.margin="0",E.body.style.padding="0",E.documentElement.style.setProperty("--assistant-border",i.border),E.documentElement.style.setProperty("--assistant-code-bg",`color-mix(in srgb, ${i.surface} 78%, black 22%)`),E.documentElement.style.setProperty("--assistant-accent",i.accent),d.root.render(n.jsx(Ge,{tokens:i,isSharing:T,isAsking:l,output:r,error:g,onAsk:I=>void A(I),onClose:m})),zn(d.window)},[t,T,l,r,g,A,m]);const R=o.useCallback(async()=>{const d=Tn(),i=d.documentPictureInPicture;let E=null;if(i!=null&&i.requestWindow)try{E=await i.requestWindow({width:In,height:Dn,disallowReturnToOpener:!0,preferInitialWindowPlacement:!0})}catch{E=null}if(!E)try{E=Mn(d)}catch{E=null}if(!E){s("inpage");return}const I=Rn(E),P=Qe.createRoot(I),z=E.ResizeObserver,$=z?new z(()=>de(E)):null;$==null||$.observe(I),x.current={window:E,root:P,mountElement:I,resizeObserver:$},E.addEventListener("pagehide",()=>{var O;((O=x.current)==null?void 0:O.window)===E&&m()},{once:!0}),s("window")},[m]),u=o.useCallback(async()=>{if(!p.current){if(!await v(window))return;M(null)}await R()},[p,v,R]);return o.useEffect(()=>()=>{C(),S()},[C,S]),{isSharing:T,mode:t,error:N,output:r,isAsking:l,askError:g,selectedModel:D,panelRef:w,start:u,popOut:R,stop:S,close:m,ask:A,toggleSharing:L,setSelectedModel:f,tokens:ue}}const Fn=""+new URL("verity-mini-DjLHPujK.png",import.meta.url).href,Me=16,Re=.14;function Hn(){const e=o.useRef(null);return o.useEffect(()=>{const t=e.current;if(!t)return;let s=0,r=0,a=0,l=0,h=0,g=!1;const j=()=>{l+=(r-l)*Re,h+=(a-h)*Re,t.style.transform=`translate3d(${l}px, ${h}px, 0)`,s=requestAnimationFrame(j)},N=D=>{r=D.clientX+Me,a=D.clientY+Me,g||(l=r,h=a,g=!0,t.dataset.visible="true")},M=()=>{g=!1,t.dataset.visible="false"};return window.addEventListener("mousemove",N,{passive:!0}),document.documentElement.addEventListener("mouseleave",M),s=requestAnimationFrame(j),()=>{window.removeEventListener("mousemove",N),document.documentElement.removeEventListener("mouseleave",M),cancelAnimationFrame(s)}},[]),Ze.createPortal(n.jsx("div",{className:"ai-verity-layer",children:n.jsx("img",{ref:e,className:"ai-verity-cursor",src:Fn,alt:"","aria-hidden":"true"})}),xt())}function qn({artifacts:e,onClose:t}){var h;const[s,r]=o.useState(((h=e[e.length-1])==null?void 0:h.id)??""),a=e.find(g=>g.id===s)??e[e.length-1],l=o.useMemo(()=>URL.createObjectURL(new Blob([(a==null?void 0:a.html)||"<!doctype html><title></title>"],{type:"text/html"})),[a==null?void 0:a.id,a==null?void 0:a.html]);return o.useEffect(()=>()=>URL.revokeObjectURL(l),[l]),a?n.jsxs("aside",{className:"ai-artifact",children:[n.jsxs("header",{className:"ai-artifact-head",children:[n.jsx(bt,{size:14}),n.jsx("nav",{className:"ai-artifact-tabs",children:e.map(g=>n.jsx("button",{type:"button",className:g.id===a.id?"on":"",onClick:()=>r(g.id),children:g.title||"Preview"},g.id))}),n.jsx("a",{className:"ai-act",href:l,target:"_blank",rel:"noreferrer",children:"Open"}),n.jsx("button",{type:"button",className:"ai-act","aria-label":"Close preview",onClick:t,children:n.jsx(re,{size:14})})]}),n.jsx("iframe",{className:"ai-artifact-frame",title:a.title||"Artifact",sandbox:"allow-scripts",src:l})]}):null}const ae=["What is the capital of france","What does a cow say","How do i become exit liquidity?","Plan a 3-day trip to Tokyo","Summarize the plot of Hamlet","Give me a 20-minute HIIT workout","Explain how HTTPS works","Suggest a name for my startup","What's the difference between TCP and UDP?","Recommend three sci-fi books","Turn this idea into a to-do list","Explain Docker like I'm five"];function Xn({account:e,onOpenAccount:t}){const s=_t(),[r,a]=o.useState(null),[l,h]=o.useState(!1),[g,j]=o.useState(()=>qe(be("ai.model")??V)),[N,M]=o.useState(()=>{const u=be("ai.thinking");return We(u)?u:ce}),[D,f]=o.useState(!1),[x,w]=o.useState(!1),[y,b]=o.useState(!0),k=Qt(s,g,N,a),T=o.useRef(null),p=On({onAsk:async(u,d,i)=>{const E=new AbortController,I=[{role:"user",content:[{type:"text",text:u},{type:"image_url",image_url:{url:d}}]}],P=Ve(le,N);try{await He({model:le,web_search:!1,screen:!0,messages:I,...P?{reasoning_effort:P}:{}},E.signal,i.onDelta),i.onComplete()}catch(z){i.onError(z instanceof Error?z.message:"Could not ask about your screen.")}}}),c=()=>{if(p.mode!=="closed"){p.close();return}p.start()};o.useEffect(()=>{ye("ai.model",g)},[g]),o.useEffect(()=>{ye("ai.thinking",N)},[N]),o.useEffect(()=>{const u=d=>{(d.metaKey||d.ctrlKey)&&d.key.toLowerCase()==="k"&&(d.preventDefault(),h(i=>!i))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[]);const v=s.activeThread,S=(v==null?void 0:v.messages)??[],[_]=o.useState(()=>Math.floor(Math.random()*ae.length)),C=Array.from({length:4},(u,d)=>ae[(_+d)%ae.length]);o.useEffect(()=>{const u=T.current;u&&(u.scrollTop=u.scrollHeight)},[S]);const m=D&&e.isPlus,A=(u,d,i)=>{k.send(u,d,i,m)},L=S[S.length-1],R=!k.isStreaming&&(L==null?void 0:L.role)==="assistant"&&!L.error;return n.jsxs("div",{className:"ai",children:[n.jsx(Hn,{}),n.jsx(xn,{threads:s.threads,activeId:s.activeId,streaming:k.isStreaming,isPlus:e.isPlus,screenSharing:p.isSharing,screenError:p.error,onToggleScreen:()=>void c(),onOpenSearch:()=>h(!0),onNew:s.startNew,onSelect:s.select,onRemove:s.remove,onRename:s.rename,onUpgrade:()=>a({code:"manual",reason:null})}),n.jsxs("div",{className:"ai-main",children:[n.jsx("div",{className:"ai-scroll",ref:T,children:S.length===0?n.jsxs("div",{className:"ai-empty",children:[n.jsx("h1",{className:"ai-empty-title",children:"How can Verity help?"}),n.jsx("p",{className:"ai-empty-sub",children:"Use the globe for live web search with Plus."}),n.jsx("div",{className:"ai-suggestions",children:C.map(u=>n.jsx("button",{type:"button",className:"ai-suggestion",onClick:()=>A(u,[],[]),children:u},u))},_)]}):n.jsx("div",{className:"ai-messages",children:S.map((u,d)=>n.jsx(ln,{message:u,canRegenerate:R&&d===S.length-1,onRegenerate:()=>k.regenerate(m,u.id),onEdit:u.role==="user"&&!k.isStreaming?i=>k.editResend(u.id,i,m):void 0,onSetVersion:i=>k.setVersion(u.id,i),onAskPick:i=>A(i,[],[])},u.id))})}),k.error&&n.jsx("div",{className:"ai-banner",children:k.error}),n.jsx(hn,{disabled:!s.loaded,isStreaming:k.isStreaming,webSearch:m,searchLocked:!e.isPlus,onToggleWebSearch:()=>{if(!e.isPlus){w(!0);return}f(u=>!u)},onSend:A,onStop:k.stop,modelSlot:n.jsx(Sn,{value:g,onChange:j,thinking:N,onThinkingChange:M})})]}),l&&n.jsx(vn,{threads:s.threads,onSelect:s.select,onClose:()=>h(!1)}),p.mode==="inpage"&&n.jsx("div",{className:"ai-screen-panel",ref:p.panelRef,children:n.jsx(Ge,{tokens:ue(),isSharing:p.isSharing,isAsking:p.isAsking,output:p.output,error:p.askError??p.error,onAsk:u=>void p.ask(u),onClose:p.close,onPopOut:()=>void p.popOut()})}),y&&S.some(u=>{var d;return(d=u.artifacts)==null?void 0:d.length})&&n.jsx(qn,{artifacts:S.flatMap(u=>u.artifacts??[]),onClose:()=>b(!1)}),n.jsx(yt,{open:!!r||x,onClose:()=>{a(null),w(!1)},account:e,heading:x?"Web search needs IGNITE OS BROWSER Plus":(r==null?void 0:r.code)==="rate_limit"?r.reason==="minute"?"Slow down a moment":"You've hit your daily AI limit":void 0,blurb:x?"Live web search is a Plus perk. Plus also includes 3M tokens/day and 50 messages a minute.":(r==null?void 0:r.code)==="rate_limit"?r.reason==="minute"?"Free accounts get 5 messages a minute. IGNITE OS BROWSER Plus raises that to 50/min — plus a 3M token/day budget.":"Free accounts get 60k AI tokens a day. IGNITE OS BROWSER Plus gives 3M tokens/day and 50/min.":void 0,onSignUp:()=>{a(null),w(!1),t==null||t()}})]})}export{Xn as AiPage};
18
+ `,t.head.append(r)}if(!t.getElementById("_1u0ijh5")){const r=t.createElement("link");r.id="_1u0ijh5",r.rel="stylesheet",r.href=En,t.head.append(r)}const s=t.createElement("div");return s.style.width="100%",s.style.display="block",t.body.append(s),s}function Ln(){return new Promise(e=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>e())})})}function An({onError:e,onStateChange:t}){const[s,r]=o.useState(!1),a=o.useRef(null),l=o.useRef(null),h=o.useRef(null),g=o.useRef(!1),j=o.useCallback(()=>{if(l.current)return l.current;const f=document.createElement("video");return f.muted=!0,f.autoplay=!0,f.playsInline=!0,l.current=f,f},[]),N=o.useCallback(()=>{const f=a.current;if(f)for(const x of f.getTracks())x.stop();a.current=null,l.current&&(l.current.srcObject=null),h.current=null,g.current=!1,r(!1),t()},[t]),M=o.useCallback(async f=>{if(a.current)return!0;try{const w=await(f??window).navigator.mediaDevices.getDisplayMedia(Cn);w.getVideoTracks()[0].addEventListener("ended",()=>N());const b=j();return b.srcObject=w,await b.play().catch(()=>{}),a.current=w,g.current=!0,r(!0),t(),!0}catch(x){const w=x instanceof Error?x.message:"Could not start screen sharing";return e(w),!1}},[j,e,t,N]),D=o.useCallback(async()=>{if(!a.current)throw new Error("Screen sharing is not active");const f=j();(!f.videoWidth||!f.videoHeight)&&await new Promise((S,_)=>{const C=window.setTimeout(()=>_(new Error("Timed out waiting for screen frame")),1200),m=()=>{window.clearTimeout(C),f.removeEventListener("loadeddata",m),S()};f.addEventListener("loadeddata",m)});const x=Math.max(1,f.videoWidth),w=Math.max(1,f.videoHeight),y=960,b=x>y?y/x:1,k=Math.max(1,Math.round(x*b)),T=Math.max(1,Math.round(w*b)),p=h.current??document.createElement("canvas");h.current=p,p.width=k,p.height=T;const c=p.getContext("2d");if(!c)throw new Error("Canvas context unavailable");c.drawImage(f,0,0,k,T);const v=await new Promise(S=>p.toBlob(S,"image/jpeg",.72));return v?await new Promise((S,_)=>{const C=new FileReader;C.onload=()=>{typeof C.result=="string"?S(C.result):_(new Error("Failed to encode screen capture"))},C.onerror=()=>_(new Error("Failed to encode screen capture")),C.readAsDataURL(v)}):p.toDataURL("image/jpeg",.72)},[j]);return{isSharing:s,isSharingRef:g,streamRef:a,startSharing:M,stopSharing:N,captureFrameDataUrl:D}}const In=380,Dn=240,_n=820,Pn=150;function $n(e){const t=e.document.body.firstElementChild;return t instanceof HTMLElement?Math.ceil(t.getBoundingClientRect().height):0}function de(e){try{if(e.closed)return;const t=$n(e)-e.innerHeight;if(Math.abs(t)<=1)return;const s=Math.min(_n,Math.max(Pn,e.outerHeight+t));s!==e.outerHeight&&e.resizeTo(e.outerWidth,s)}catch{}}function zn(e){try{e.requestAnimationFrame(()=>{de(e),e.setTimeout(()=>e.requestAnimationFrame(()=>de(e)),90)})}catch{}}function On({onAsk:e}){const[t,s]=o.useState("closed"),[r,a]=o.useState(""),[l,h]=o.useState(!1),[g,j]=o.useState(null),[N,M]=o.useState(null),[D,f]=o.useState(le),x=o.useRef(null),w=o.useRef(null),y=o.useRef(!1);y.current=l;const b=o.useCallback(d=>M(d),[]),k=o.useCallback(()=>{},[]),{isSharing:T,isSharingRef:p,streamRef:c,startSharing:v,stopSharing:S,captureFrameDataUrl:_}=An({onError:b,onStateChange:k}),C=o.useCallback(()=>{var i;const d=x.current;if(x.current=null,d){(i=d.resizeObserver)==null||i.disconnect(),window.setTimeout(()=>d.root.unmount(),0);try{d.window.close()}catch{}}},[]),m=o.useCallback(()=>{C(),S(),s("closed"),a(""),j(null)},[C,S]),A=o.useCallback(async d=>{var P,z,$;if(y.current)return;const i=d.trim();if(!i){j("Type a question first.");return}if(!p.current){j("Start screen sharing first.");return}h(!0),j(null),a("Thinking…");const E=x.current,I=(E==null?void 0:E.mountElement)??w.current;try{const q=(($=(z=(P=c.current)==null?void 0:P.getVideoTracks()[0])==null?void 0:z.getSettings())==null?void 0:$.displaySurface)==="monitor"&&I;q&&(I.style.visibility="hidden",await Ln());const Xe=await _();q&&(I.style.visibility="visible",E==null||E.window.focus());let xe=!1,X="";await e(i,Xe,{onDelta:U=>{xe||(X="",xe=!0),X+=U,a(X),j(null)},onError:U=>{a(U),j(U)},onComplete:()=>h(!1)})}catch(O){I&&(I.style.visibility="visible");const q=O instanceof Error?O.message:"Failed to ask about screen";a(q),j(q)}finally{h(!1)}},[_,p,e,c]),L=o.useCallback(()=>{var d;if(p.current){S();return}v(t==="window"?(d=x.current)==null?void 0:d.window:window)},[p,t,v,S]);o.useEffect(()=>{if(t!=="window")return;const d=x.current;if(!d)return;const i=ue(),E=d.window.document;E.documentElement.style.background=i.bg,E.body.style.background=i.bg,E.body.style.margin="0",E.body.style.padding="0",E.documentElement.style.setProperty("--assistant-border",i.border),E.documentElement.style.setProperty("--assistant-code-bg",`color-mix(in srgb, ${i.surface} 78%, black 22%)`),E.documentElement.style.setProperty("--assistant-accent",i.accent),d.root.render(n.jsx(Ge,{tokens:i,isSharing:T,isAsking:l,output:r,error:g,onAsk:I=>void A(I),onClose:m})),zn(d.window)},[t,T,l,r,g,A,m]);const R=o.useCallback(async()=>{const d=Tn(),i=d.documentPictureInPicture;let E=null;if(i!=null&&i.requestWindow)try{E=await i.requestWindow({width:In,height:Dn,disallowReturnToOpener:!0,preferInitialWindowPlacement:!0})}catch{E=null}if(!E)try{E=Mn(d)}catch{E=null}if(!E){s("inpage");return}const I=Rn(E),P=Qe.createRoot(I),z=E.ResizeObserver,$=z?new z(()=>de(E)):null;$==null||$.observe(I),x.current={window:E,root:P,mountElement:I,resizeObserver:$},E.addEventListener("pagehide",()=>{var O;((O=x.current)==null?void 0:O.window)===E&&m()},{once:!0}),s("window")},[m]),u=o.useCallback(async()=>{if(!p.current){if(!await v(window))return;M(null)}await R()},[p,v,R]);return o.useEffect(()=>()=>{C(),S()},[C,S]),{isSharing:T,mode:t,error:N,output:r,isAsking:l,askError:g,selectedModel:D,panelRef:w,start:u,popOut:R,stop:S,close:m,ask:A,toggleSharing:L,setSelectedModel:f,tokens:ue}}const Fn=""+new URL("verity-mini-DjLHPujK.png",import.meta.url).href,Me=16,Re=.14;function Hn(){const e=o.useRef(null);return o.useEffect(()=>{const t=e.current;if(!t)return;let s=0,r=0,a=0,l=0,h=0,g=!1;const j=()=>{l+=(r-l)*Re,h+=(a-h)*Re,t.style.transform=`translate3d(${l}px, ${h}px, 0)`,s=requestAnimationFrame(j)},N=D=>{r=D.clientX+Me,a=D.clientY+Me,g||(l=r,h=a,g=!0,t.dataset.visible="true")},M=()=>{g=!1,t.dataset.visible="false"};return window.addEventListener("mousemove",N,{passive:!0}),document.documentElement.addEventListener("mouseleave",M),s=requestAnimationFrame(j),()=>{window.removeEventListener("mousemove",N),document.documentElement.removeEventListener("mouseleave",M),cancelAnimationFrame(s)}},[]),Ze.createPortal(n.jsx("div",{className:"ai-verity-layer",children:n.jsx("img",{ref:e,className:"ai-verity-cursor",src:Fn,alt:"","aria-hidden":"true"})}),xt())}function qn({artifacts:e,onClose:t}){var h;const[s,r]=o.useState(((h=e[e.length-1])==null?void 0:h.id)??""),a=e.find(g=>g.id===s)??e[e.length-1],l=o.useMemo(()=>URL.createObjectURL(new Blob([(a==null?void 0:a.html)||"<!doctype html><title></title>"],{type:"text/html"})),[a==null?void 0:a.id,a==null?void 0:a.html]);return o.useEffect(()=>()=>URL.revokeObjectURL(l),[l]),a?n.jsxs("aside",{className:"ai-artifact",children:[n.jsxs("header",{className:"ai-artifact-head",children:[n.jsx(bt,{size:14}),n.jsx("nav",{className:"ai-artifact-tabs",children:e.map(g=>n.jsx("button",{type:"button",className:g.id===a.id?"on":"",onClick:()=>r(g.id),children:g.title||"Preview"},g.id))}),n.jsx("a",{className:"ai-act",href:l,target:"_blank",rel:"noreferrer",children:"Open"}),n.jsx("button",{type:"button",className:"ai-act","aria-label":"Close preview",onClick:t,children:n.jsx(re,{size:14})})]}),n.jsx("iframe",{className:"ai-artifact-frame",title:a.title||"Artifact",sandbox:"allow-scripts",src:l})]}):null}const ae=["What is the capital of france","What does a cow say","How do i become exit liquidity?","Plan a 3-day trip to Tokyo","Summarize the plot of Hamlet","Give me a 20-minute HIIT workout","Explain how HTTPS works","Suggest a name for my startup","What's the difference between TCP and UDP?","Recommend three sci-fi books","Turn this idea into a to-do list","Explain Docker like I'm five"];function Xn({account:e,onOpenAccount:t}){const s=_t(),[r,a]=o.useState(null),[l,h]=o.useState(!1),[g,j]=o.useState(()=>qe(be("ai.model")??V)),[N,M]=o.useState(()=>{const u=be("ai.thinking");return We(u)?u:ce}),[D,f]=o.useState(!1),[x,w]=o.useState(!1),[y,b]=o.useState(!0),k=Qt(s,g,N,a),T=o.useRef(null),p=On({onAsk:async(u,d,i)=>{const E=new AbortController,I=[{role:"user",content:[{type:"text",text:u},{type:"image_url",image_url:{url:d}}]}],P=Ve(le,N);try{await He({model:le,web_search:!1,screen:!0,messages:I,...P?{reasoning_effort:P}:{}},E.signal,i.onDelta),i.onComplete()}catch(z){i.onError(z instanceof Error?z.message:"Could not ask about your screen.")}}}),c=()=>{if(p.mode!=="closed"){p.close();return}p.start()};o.useEffect(()=>{ye("ai.model",g)},[g]),o.useEffect(()=>{ye("ai.thinking",N)},[N]),o.useEffect(()=>{const u=d=>{(d.metaKey||d.ctrlKey)&&d.key.toLowerCase()==="k"&&(d.preventDefault(),h(i=>!i))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[]);const v=s.activeThread,S=(v==null?void 0:v.messages)??[],[_]=o.useState(()=>Math.floor(Math.random()*ae.length)),C=Array.from({length:4},(u,d)=>ae[(_+d)%ae.length]);o.useEffect(()=>{const u=T.current;u&&(u.scrollTop=u.scrollHeight)},[S]);const m=D&&e.isPlus,A=(u,d,i)=>{k.send(u,d,i,m)},L=S[S.length-1],R=!k.isStreaming&&(L==null?void 0:L.role)==="assistant"&&!L.error;return n.jsxs("div",{className:"ai",children:[n.jsx(Hn,{}),n.jsx(xn,{threads:s.threads,activeId:s.activeId,streaming:k.isStreaming,isPlus:e.isPlus,screenSharing:p.isSharing,screenError:p.error,onToggleScreen:()=>void c(),onOpenSearch:()=>h(!0),onNew:s.startNew,onSelect:s.select,onRemove:s.remove,onRename:s.rename,onUpgrade:()=>a({code:"manual",reason:null})}),n.jsxs("div",{className:"ai-main",children:[n.jsx("div",{className:"ai-scroll",ref:T,children:S.length===0?n.jsxs("div",{className:"ai-empty",children:[n.jsx("h1",{className:"ai-empty-title",children:"How can Ignite help?"}),n.jsx("p",{className:"ai-empty-sub",children:"Use the globe for live web search with Plus."}),n.jsx("div",{className:"ai-suggestions",children:C.map(u=>n.jsx("button",{type:"button",className:"ai-suggestion",onClick:()=>A(u,[],[]),children:u},u))},_)]}):n.jsx("div",{className:"ai-messages",children:S.map((u,d)=>n.jsx(ln,{message:u,canRegenerate:R&&d===S.length-1,onRegenerate:()=>k.regenerate(m,u.id),onEdit:u.role==="user"&&!k.isStreaming?i=>k.editResend(u.id,i,m):void 0,onSetVersion:i=>k.setVersion(u.id,i),onAskPick:i=>A(i,[],[])},u.id))})}),k.error&&n.jsx("div",{className:"ai-banner",children:k.error}),n.jsx(hn,{disabled:!s.loaded,isStreaming:k.isStreaming,webSearch:m,searchLocked:!e.isPlus,onToggleWebSearch:()=>{if(!e.isPlus){w(!0);return}f(u=>!u)},onSend:A,onStop:k.stop,modelSlot:n.jsx(Sn,{value:g,onChange:j,thinking:N,onThinkingChange:M})})]}),l&&n.jsx(vn,{threads:s.threads,onSelect:s.select,onClose:()=>h(!1)}),p.mode==="inpage"&&n.jsx("div",{className:"ai-screen-panel",ref:p.panelRef,children:n.jsx(Ge,{tokens:ue(),isSharing:p.isSharing,isAsking:p.isAsking,output:p.output,error:p.askError??p.error,onAsk:u=>void p.ask(u),onClose:p.close,onPopOut:()=>void p.popOut()})}),y&&S.some(u=>{var d;return(d=u.artifacts)==null?void 0:d.length})&&n.jsx(qn,{artifacts:S.flatMap(u=>u.artifacts??[]),onClose:()=>b(!1)}),n.jsx(yt,{open:!!r||x,onClose:()=>{a(null),w(!1)},account:e,heading:x?"Web search needs Ignite OS Plus":(r==null?void 0:r.code)==="rate_limit"?r.reason==="minute"?"Slow down a moment":"You've hit your daily AI limit":void 0,blurb:x?"Live web search is a Plus perk. Plus also includes 3M tokens/day and 50 messages a minute.":(r==null?void 0:r.code)==="rate_limit"?r.reason==="minute"?"Free accounts get 5 messages a minute. Ignite OS Plus raises that to 50/min — plus a 3M token/day budget.":"Free accounts get 60k AI tokens a day. Ignite OS Plus gives 3M tokens/day and 50/min.":void 0,onSignUp:()=>{a(null),w(!1),t==null||t()}})]})}export{Xn as AiPage};
@@ -1 +1 @@
1
- import{r as i,j as r}from"./react-BNEptbwn-8068ec8f.js";import{b as F,s as M,C as T,t as I,u as q,v as P,x as _,g as z,n as $,k as D,y as L,S as O,r as U,z as B}from"./index-COUSXtyQ-8068ec8f.js";import"./motion-B1hdS1Lc-8068ec8f.js";const IGNITE_GAMES=[{"id":"local-drift-city","name":"Drift City","type":"embed","thumb":"https://www.onlinegames.io/media/posts/837/Drift-City.jpg","url":"https://cloud.onlinegames.io/games/2024/gm/games2/drift-city/index.html"},{"id":"local-gt-traffic-racer","name":"GT Traffic Racer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1292/gt-traffic-racer.webp","url":"https://html5.gamedistribution.com/cecfade6d8ef4fb7a4b1924452da4204/?gd_sdk_referrer_url=https://www.onlinegames.io/gt-traffic-racer/"},{"id":"local-ultimate-flying-car-2","name":"Ultimate Flying Car 2","type":"embed","thumb":"https://www.onlinegames.io/media/posts/880/ultimate-flying-car-2.jpg","url":"https://html5.gamedistribution.com/33ac31671df249cb964b7b0fd44ec464/?gd_sdk_referrer_url=https://www.onlinegames.io/ultimate-flying-car-2/"},{"id":"local-burnout-city","name":"Burnout City","type":"embed","thumb":"https://www.onlinegames.io/media/posts/861/burnoutcity.jpg","url":"https://cloud.onlinegames.io/games/2024/unity/burnout-city/index-og.html"},{"id":"local-american-truck-car-driving","name":"American Truck Car Driving","type":"embed","thumb":"https://www.onlinegames.io/media/posts/355/American-Truck-Car-Driving-Game.jpg","url":"https://html5.gamedistribution.com/d3e870c05a48468c8e03062b75698b8a/?gd_sdk_referrer_url=https://www.onlinegames.io/american-truck-car-driving/"},{"id":"local-city-car-simulator","name":"City Car Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/35/City-Car-Simulator.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/city-car-simulator/index.html"},{"id":"local-super-car-driving","name":"Super Car Driving","type":"embed","thumb":"https://www.onlinegames.io/media/posts/854/supercardriving-2.jpg","url":"https://cloud.onlinegames.io/games/2024/unity2/super-car-driving/index-og.html"},{"id":"local-racing-horizon","name":"Racing Horizon","type":"embed","thumb":"https://www.onlinegames.io/media/posts/335/Racing-Horizon-2.jpg","url":"https://html5.gamedistribution.com/4aae27f8b4cf45d69291815ba95de748/?gd_sdk_referrer_url=https://www.onlinegames.io/racing-horizon/"},{"id":"local-car-football","name":"Car Football","type":"embed","thumb":"https://www.onlinegames.io/media/posts/405/Car-Football.jpg","url":"https://www.onlinegames.io/games/2023/construct/198/car-football/index.html"},{"id":"local-traffic-racing","name":"Traffic Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1308/traffic-racing.webp","url":"https://html5.gamedistribution.com/f3ee6674b4ea4579aeefd54d7bf388f0/?gd_sdk_referrer_url=https://www.onlinegames.io/traffic-racing-1/"},{"id":"local-tow-n-go","name":"Tow N Go","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1085/Tow-N-Go.webp","url":"https://html5.gamedistribution.com/56e2d741d80d4873905aff16d8cfee0f/?gd_sdk_referrer_url=https://www.onlinegames.io/tow-n-go/"},{"id":"local-street-traffic-racer","name":"Street Traffic Racer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1071/Street-Traffic-Racer.webp","url":"https://html5.gamedistribution.com/b4d7df30b6354d92aad8ac6b6162dc74/?gd_sdk_referrer_url=https://www.onlinegames.io/street-traffic-racer/"},{"id":"local-mini-cars-racing","name":"Mini Cars Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1010/Mini-Cars-Racing.jpg","url":"https://cloud.onlinegames.io/games/2021/unity/mini-cars-racing/index-og.html"},{"id":"local-drift-rider","name":"Drift Rider","type":"embed","thumb":"https://www.onlinegames.io/media/posts/553/Drift-Rider.jpg","url":"https://www.onlinegames.io/games/2023/unity3/drift-rider/index.html"},{"id":"local-slow-roads","name":"Slow Roads","type":"embed","thumb":"https://www.onlinegames.io/media/posts/725/Slow-Roads-io-Play.jpg","url":"https://www.onlinegames.io/games/2024/more/slow-roads/index.html"},{"id":"local-taxi-simulator","name":"Taxi Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/465/Taxi-Simulator.jpg","url":"https://www.onlinegames.io/games/2022/unity/taxi-simulator/index.html"},{"id":"local-crazy-parking-fury","name":"Crazy Parking Fury","type":"embed","thumb":"https://www.onlinegames.io/media/posts/643/Crazy-Parking-Fury.jpg","url":"https://www.onlinegames.io/games/2022/unity3/crazy-parking-fury/index.html"},{"id":"local-eggy-car","name":"Eggy Car","type":"embed","thumb":"https://www.onlinegames.io/media/posts/390/Eggy-Car.jpg","url":"https://html5.gamedistribution.com/59a98bf799ef499d9d7b9285bccaa196/?gd_sdk_referrer_url=https://www.onlinegames.io/eggy-car"},{"id":"local-jelly-car-simulator","name":"Jelly Car Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/917/jelly-car.jpg","url":"https://playhop.com/app/383730?utm_source=distrib&is-united-page=1&skip-guard=1&header=no&utm_medium=cristian-ovidiu&clid=8531463"},{"id":"local-cars-simulator","name":"Cars Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/15/Cars-Simulator-3.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/cars-simulator/index2.html"},{"id":"local-car-parking","name":"Car Parking","type":"embed","thumb":"https://www.onlinegames.io/media/posts/334/Car-Parking.webp","url":"https://cloud.freezenova.com/games/monoa-city-parking/unblocked.html"},{"id":"local-max-speed","name":"Max Speed","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1309/max-speed.webp","url":"https://html5.gamedistribution.com/48f3d14ced3646b781e256ca7f9bfa30/?gd_sdk_referrer_url=https://www.onlinegames.io/max-speed/"},{"id":"local-formula-traffic-racer","name":"Formula Traffic Racer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1119/formula-traffic-racer.webp","url":"https://html5.gamedistribution.com/940c7c7f620b46f0ba61998e9a98b8fb/?gd_sdk_referrer_url=https://www.onlinegames.io/formula-traffic-racer/"},{"id":"local-stunt-simulator-multiplayer","name":"Stunt Simulator Multiplayer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/682/Stunt-Simulator-Multiplayer-Play.jpg","url":"https://www.onlinegames.io/games/2021/unity/stunt-simulator-multiplayer/index.html"},{"id":"local-vehicles-simulator-2","name":"Vehicles Simulator 2","type":"embed","thumb":"https://www.onlinegames.io/media/posts/695/Vehicles-Simulator-2.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/vehicles-simulator-2/index2.html"},{"id":"local-elite-racing","name":"Elite Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/666/Elite-Racing.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/elite-racing/index.html"},{"id":"local-stunt-simulator","name":"Stunt Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/18/Stunt-Simulator-Game.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/stunt-simulator/index2.html"},{"id":"local-poly-racing-cars","name":"Poly Racing Cars","type":"embed","thumb":"https://www.onlinegames.io/media/posts/835/Poly-racing-cars-image.jpg","url":"https://cloud.onlinegames.io/games/2022/unity3/poly-racing-cars/index-og.html"},{"id":"local-super-mini-racing","name":"Super Mini Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/819/Super-Mini-Racing.jpg","url":"https://www.onlinegames.io/games/2022/unity4/super-mini-racing/index.html"},{"id":"local-city-stunts","name":"City Stunts","type":"embed","thumb":"https://www.onlinegames.io/media/posts/629/City-Stunts-Game.jpg","url":"https://www.onlinegames.io/games/2023/unity3/city-stunts/index.html"},{"id":"local-traffic-jam-3d","name":"Traffic Jam 3D","type":"embed","thumb":"https://www.onlinegames.io/media/posts/784/Traffic-Jam.jpg","url":"https://html5.gamedistribution.com/337302b23b5943d8bcfc501d81d50cdb/?gd_sdk_referrer_url=https://www.onlinegames.io/traffic-jam-3d/"},{"id":"local-monster-truck-mountain-climb","name":"Monster Truck Mountain Climb","type":"embed","thumb":"https://www.onlinegames.io/media/posts/924/monster-truck-mountain-climb.jpg","url":"https://cloud.onlinegames.io/games/2021/2/monster-truck-mountain-climb/index-og.html"},{"id":"local-golfdash","name":"Golfdash","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1409/golfdash.webp","url":"https://html5.gamedistribution.com/96e8930b69c044c687e3dc617bdb4a43/?gd_sdk_referrer_url=https://www.onlinegames.io/golfdash"},{"id":"local-bloxorz","name":"Bloxorz","type":"embed","thumb":"https://www.onlinegames.io/media/posts/849/bloxorz.jpg","url":"https://cloud.onlinegames.io/games/2024/gm/games4/bloxorz/index.html"},{"id":"local-pixel-path","name":"Pixel Path","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1050/pixel_path_game.webp","url":"https://html5.gamedistribution.com/3ffc5c0944f54f06afb212ca7d80bb00/?gd_sdk_referrer_url=https://www.onlinegames.io/pixel-path/"},{"id":"local-definitely-not-a-platformer","name":"Definitely Not a Platformer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1410/definitely-not-a-platformer.webp","url":"https://html5.gamedistribution.com/68ea3a38ad79429ebc7a73aa35c4114b/?gd_sdk_referrer_url=https://www.onlinegames.io/definitely-not-a-platformer"},{"id":"local-mahjong","name":"Mahjong","type":"embed","thumb":"https://www.onlinegames.io/media/posts/966/Mahjong.jpg","url":"https://cloud.onlinegames.io/games/2025/unity/mahjong/index-og.html"},{"id":"local-jelly-run-2048","name":"Jelly Run 2048","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1335/jelly-run-2048.webp","url":"https://html5.gamedistribution.com/95447102992c46629b7addf13099f990/?gd_sdk_referrer_url=https://www.onlinegames.io/jelly-run-2048/"},{"id":"local-mergest-kingdom","name":"Mergest Kingdom","type":"embed","thumb":"https://www.onlinegames.io/media/posts/412/Mergest-Kingdom-Online.jpg","url":"https://html5.gamedistribution.com/b5203bfef51242c39690c761321d769f/?gd_sdk_referrer_url=https://www.onlinegames.io/the-mergest-kingdom"},{"id":"local-unpacking","name":"Unpacking","type":"embed","thumb":"https://www.onlinegames.io/media/posts/481/Unpacking.jpg","url":"https://html5.gamedistribution.com/d445590892294eebb41d983e1c598ab1/?gd_sdk_referrer_url=https://www.onlinegames.io/unpacking"},{"id":"local-hidden-objects","name":"Hidden Objects","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1120/hidden-objects.webp","url":"https://html5.gamedistribution.com/87bdc78edaac4365aa21f3acdfe7791d/?gd_sdk_referrer_url=https://www.onlinegames.io/hidden-objects/"},{"id":"local-tic-tac-toe","name":"Tic Tac Toe","type":"embed","thumb":"https://www.onlinegames.io/media/posts/529/Tic-Tac-Toe.jpg","url":"https://www.onlinegames.io/games/2021/unity2/tic-tac-toe/index.html"},{"id":"local-bookworm","name":"Bookworm","type":"embed","thumb":"https://www.onlinegames.io/media/posts/866/bookworm.jpg","url":"https://cloud.onlinegames.io/games/2024/flash/bookworm/index-og.html"},{"id":"local-juice-merge","name":"Juice Merge","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1367/juice-merge.webp","url":"https://html5.gamedistribution.com/d4c11a64ed754d71b4671d699c66a9c7/?gd_sdk_referrer_url=https://www.onlinegames.io/juice-merge/"},{"id":"local-rummikub","name":"Rummikub","type":"embed","thumb":"https://www.onlinegames.io/media/posts/387/Rummikub-Online.jpg","url":"https://html5.gamedistribution.com/6bf29e0982a64f898a81c3f3612aba26/?gd_sdk_referrer_url=https://www.onlinegames.io/rummikub"},{"id":"local-tile-match","name":"Tile Match","type":"embed","thumb":"https://www.onlinegames.io/media/posts/939/tile-match.jpg","url":"https://cloud.onlinegames.io/games/2025/unity/tile-match/index-og.html"},{"id":"local-home-design","name":"Home Design","type":"embed","thumb":"https://www.onlinegames.io/media/posts/763/home-design.jpg","url":"https://html5.gamedistribution.com/2752a06ef4f9406cbbe85d3f78096d25/?gd_sdk_referrer_url=https://www.onlinegames.io/home-design/"},{"id":"local-cake-match-puzzle","name":"Cake Match Puzzle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/908/55.jpg","url":"https://cloud.onlinegames.io/games/2024/unity3/cake-match-puzzle/index-og.html"},{"id":"local-2048","name":"2048","type":"embed","thumb":"https://www.onlinegames.io/media/posts/916/2048.jpg","url":"https://cloud.onlinegames.io/games/2025/html/2048/index.html"},{"id":"local-block-blast","name":"Block Blast","type":"embed","thumb":"https://www.onlinegames.io/media/posts/876/block-blast.jpg","url":"https://cloud.onlinegames.io/games/2024/unity3/block-blast/index-og.html"},{"id":"local-labuba-merge","name":"Labuba Merge","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1386/labuba-merge.webp","url":"https://html5.gamedistribution.com/3bd8d990c6294379a7755f938a4944b4/?gd_sdk_referrer_url=https://www.onlinegames.io/labuba-merge/"},{"id":"local-world-guesser","name":"World Guesser","type":"embed","thumb":"https://www.onlinegames.io/media/posts/888/world-guesser.jpg","url":"https://www.worldguessr.com/"},{"id":"local-watermelon-game","name":"Watermelon Game","type":"embed","thumb":"https://www.onlinegames.io/media/posts/928/Watermelon-Game-Online.jpg","url":"https://cloud.onlinegames.io/games/2025/construct/321/watermelon-game/index-og.html"},{"id":"local-solitaire-adventure","name":"Solitaire Adventure","type":"embed","thumb":"https://www.onlinegames.io/media/posts/519/Solitaire-Adventure-Tripeaks.jpg","url":"https://www.onlinegames.io/games/2022/unity4/solitaire-adventure/index.html"},{"id":"local-nuts-and-bolts-puzzle","name":"Nuts and Bolts Puzzle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/965/nuts-and-bolts-puzzle.jpg","url":"https://cloud.onlinegames.io/games/2025/unity/nuts-and-bolts-puzzle/index-og.html"},{"id":"local-wordle","name":"Wordle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/938/wordle.jpg","url":"https://cloud.onlinegames.io/games/2025/html/wordle/index-og.html"},{"id":"local-words-from-words","name":"Words from Words","type":"embed","thumb":"https://www.onlinegames.io/media/posts/983/words-from-words.jpg","url":"https://html5.gamedistribution.com/607f9f304899446aaf075339ba3dff81/?gd_sdk_referrer_url=https://www.onlinegames.io/words-from-words/"},{"id":"local-tetris","name":"Tetris","type":"embed","thumb":"https://www.onlinegames.io/media/posts/758/Tetris-Online.jpg","url":"https://www.onlinegames.io/games/2024/more/tetris/index.html"},{"id":"local-merge-cakes","name":"Merge Cakes","type":"embed","thumb":"https://www.onlinegames.io/media/posts/743/Merge-Cakes.jpg","url":"https://www.onlinegames.io/games/2024/more/merge-cakes/index.html"},{"id":"local-coffee-color-blocks","name":"Coffee Color Blocks","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1240/coffee-color-blocks.webp","url":"https://html5.gamedistribution.com/0904d5fb5d0044fe9fddf1cd5834cff2/?gd_sdk_referrer_url=https://www.onlinegames.io/coffee-color-blocks/"},{"id":"local-tiny-golf-king","name":"Tiny Golf King","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1349/tiny-golf-king.webp","url":"https://html5.gamedistribution.com/4b94472f98f442339ca0eb5312950482/?gd_sdk_referrer_url=https://www.onlinegames.io/tiny-golf-king/"},{"id":"local-find-hidden-cats","name":"Find Hidden Cats","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1290/find-hidden-cats.webp","url":"https://html5.gamedistribution.com/892fa29a7d4145958b37ea309752bf1b/?gd_sdk_referrer_url=https://www.onlinegames.io/find-hidden-cats/"},{"id":"local-google-feud","name":"Google Feud","type":"embed","thumb":"https://www.onlinegames.io/media/posts/384/Google-Feud.jpg","url":"https://googlefeud.com/"},{"id":"local-bus-parking-out","name":"Bus Parking Out","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1206/bus-parking-out.webp","url":"https://html5.gamedistribution.com/ee798269399449d0b1acb60f81dff1fc/?gd_sdk_referrer_url=https://www.onlinegames.io/bus-parking-out/"},{"id":"local-block-puzzle-slide-block-jam","name":"Block Puzzle: Slide Block Jam","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1228/block-puzzle-slide-block-jam.webp","url":"https://html5.gamedistribution.com/008e8e99c8d646afa6ee7d5057ee15c0/?gd_sdk_referrer_url=https://www.onlinegames.io/block-puzzle:-slide-block-jam/"},{"id":"local-hidden-objects-brain-teaser","name":"Hidden Objects: Brain Teaser","type":"embed","thumb":"https://www.onlinegames.io/media/posts/677/Hidden-Objects.jpg","url":"https://html5.gamedistribution.com/251c20b086c84cf3a227374e9022606d/?gd_sdk_referrer_url=https://www.onlinegames.io/hidden-objects-brain-teaser"},{"id":"local-unblock-it-3d","name":"Unblock It 3D","type":"embed","thumb":"https://www.onlinegames.io/media/posts/993/Unblocked-It-3D-2.webp","url":"https://html5.gamedistribution.com/bb321f67a2fc481ba31308582f3df0d5/?gd_sdk_referrer_url=https://www.onlinegames.io/unblock-it-3d/"},{"id":"local-draw-bridge-puzzle","name":"Draw Bridge Puzzle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1248/draw-bridge-puzzle.webp","url":"https://html5.gamedistribution.com/516ceca89758466fa613fa96980eef76/?gd_sdk_referrer_url=https://www.onlinegames.io/draw-bridge-puzzle-1/"},{"id":"local-collect-em-all","name":"Collect Em All","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1328/collect-em-all.webp","url":"https://html5.gamedistribution.com/1d46874719574bc5be034bf45e93dbdb/?gd_sdk_referrer_url=https://www.onlinegames.io/collect-em-all-1/"},{"id":"local-grandmaster-chess","name":"Grandmaster Chess","type":"embed","thumb":"https://www.onlinegames.io/media/posts/429/Grandmaster-Chess-Online.jpg","url":"https://www.onlinegames.io/games/2022/unity/grandmaster-chess/index.html"},{"id":"local-arrow-sorting","name":"Arrow Sorting","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1365/arrow-sorting.webp","url":"https://html5.gamedistribution.com/2fb1dc3ebec147eeb9d7875354afcc20/?gd_sdk_referrer_url=https://www.onlinegames.io/arrow-sorting/"},{"id":"local-house-painter","name":"House Painter","type":"embed","thumb":"https://www.onlinegames.io/media/posts/700/House-Painter.jpg","url":"https://www.onlinegames.io/games/2023/construct/238/house-painter/index.html"},{"id":"local-soccer-merge","name":"Soccer Merge","type":"embed","thumb":"https://www.onlinegames.io/media/posts/647/Soccer-Merge.jpg","url":"https://html5.gamedistribution.com/669b650069914123b72bbeef5a95e2d3/?gd_sdk_referrer_url=https://www.onlinegames.io/soccer-merge"},{"id":"local-mini-crossword","name":"Mini Crossword","type":"embed","thumb":"https://www.onlinegames.io/media/posts/439/Mini-Crossword-Game.jpg","url":"https://www.onlinegames.io/games/2023/mjs/mini-crossword/index.html"},{"id":"local-wordmeister","name":"Wordmeister","type":"embed","thumb":"https://www.onlinegames.io/media/posts/513/Wordmeister-Game.jpg","url":"https://html5.gamedistribution.com/b6439239c9ab43bf925defdb54ed0cbe/?gd_sdk_referrer_url=https://www.onlinegames.io/wordmeister"},{"id":"local-bubble-game-3","name":"Bubble Game 3","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1255/bubble-game-3.webp","url":"https://html5.gamedistribution.com/27673bc45d2e4b27b7cd24e422f7c257/?gd_sdk_referrer_url=https://www.onlinegames.io/Bubble-Game-3/"},{"id":"local-gummy-blocks","name":"Gummy Blocks","type":"embed","thumb":"https://www.onlinegames.io/media/posts/568/Gummy-Blocks.jpg","url":"https://www.onlinegames.io/games/2023/code/gummy-blocks/index.html"},{"id":"local-city-tower-builder","name":"City Tower Builder","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1331/city-tower-builder-2.webp","url":"https://html5.gamedistribution.com/9f82549300b14817a917bfca75210fd0/?gd_sdk_referrer_url=https://www.onlinegames.io/city-tower-builder/"},{"id":"local-sudoku-village","name":"Sudoku Village","type":"embed","thumb":"https://www.onlinegames.io/media/posts/571/Sudoku-Village.jpg","url":"https://html5.gamedistribution.com/2625fa22f02b461eb45b4dff282c70b8/?gd_sdk_referrer_url=https://www.onlinegames.io/sudoku-village"},{"id":"local-draw-the-car-path","name":"Draw the Car Path","type":"embed","thumb":"https://www.onlinegames.io/media/posts/936/draw-the-car-path.jpg","url":"https://cloud.onlinegames.io/games/2021/4/draw-the-car-path/index-og.html"},{"id":"local-text-talk","name":"Text Talk","type":"embed","thumb":"https://www.onlinegames.io/media/posts/511/Text-Talk.jpg","url":"https://html5.gamedistribution.com/446ebdc3a4f9449db46859a15d502ae9/?gd_sdk_referrer_url=https://www.onlinegames.io/text-talk"},{"id":"local-marble-zumba-stack","name":"Marble Zumba Stack","type":"embed","thumb":"https://www.onlinegames.io/media/posts/652/Marble-Zumba-Stack.jpg","url":"https://www.onlinegames.io/games/2022/unity/marble-zumba-stack/index.html"},{"id":"local-chess-fill","name":"Chess Fill","type":"embed","thumb":"https://www.onlinegames.io/media/posts/433/Chess-Fill.jpg","url":"https://html5.gamedistribution.com/169fb99eaca444bfb5d8cd329e680d2e/?gd_sdk_referrer_url=https://www.onlinegames.io/chess-fill"},{"id":"local-sweet-sugar-match","name":"Sweet Sugar Match","type":"embed","thumb":"https://www.onlinegames.io/media/posts/576/Sweet-Sugar-Match.jpg","url":"https://www.onlinegames.io/games/2022/unity/sweet-sugar-match/index.html"},{"id":"local-word-connect","name":"Word Connect","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1132/word-connect.webp","url":"https://cloud.onlinegames.io/games/2025/unity2/word-connect/index-og.html"},{"id":"local-fish-out-of-water","name":"Fish Out of Water","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1414/fish-out-of-water-2.webp","url":"https://html5.gamedistribution.com/bece97115f26426491fa08e409e545aa/?gd_sdk_referrer_url=https://www.onlinegames.io/fish-out-of-water"},{"id":"local-football-bros-io","name":"Football Bros IO","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1173/football-bros-io.webp","url":"https://footballbros.io/"},{"id":"local-a-small-world-cup","name":"A Small World Cup","type":"embed","thumb":"https://www.onlinegames.io/media/posts/909/a-small-world-cp.jpg","url":"https://cloud.onlinegames.io/games/2024/more2/a-small-world-cup/index.html"},{"id":"local-backflip-dive-3d","name":"Backflip Dive 3D","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1083/Backflip-Dive-3D-2.webp","url":"https://html5.gamedistribution.com/a9d7229d3be14c0284d5281d125f27f3/?gd_sdk_referrer_url=https://www.onlinegames.io/backflip-dive-3d/"},{"id":"local-football-penalty-2026","name":"Football Penalty 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1406/football-penalty-2026-2.webp","url":"https://html5.gamedistribution.com/9e0857a030cf4c1f821af4b359a870fe/?gd_sdk_referrer_url=https://www.onlinegames.io/football-penalty-2026"},{"id":"local-basketball-stars-2026","name":"Basketball Stars 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1171/basketball-stars-2026.webp","url":"https://html5.gamedistribution.com/516d6908fbc848bdb89e65a58a43a7dc/?gd_sdk_referrer_url=https://www.onlinegames.io/basketball-stars-2026/"},{"id":"local-football-legends-2026","name":"Football Legends 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1307/football-legends-2026.webp","url":"https://html5.gamedistribution.com/13eabea86f7c4cd993a156258420e9ec/?gd_sdk_referrer_url=https://www.onlinegames.io/football-legends-2026/"},{"id":"local-tennis-masters-2026","name":"Tennis Masters 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1391/tennis-masters-2026.webp","url":"https://html5.gamedistribution.com/ab2f156d72894fd8a5dedb85b34a05e4/?gd_sdk_referrer_url=https://www.onlinegames.io/tennis-masters-2026"},{"id":"local-office-golf","name":"Office Golf","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1403/office-golf.webp","url":"https://html5.gamedistribution.com/19c63777ed1e4653b64b2200560907fd/?gd_sdk_referrer_url=https://www.onlinegames.io/office-golf"}];const Q=300;function k(e){return e&&typeof e=="object"?e:{}}function A(e){const t=k(e);return typeof t.id!="string"||typeof t.name!="string"||t.type!=="embed"&&t.type!=="proxy"?null:{id:t.id,name:t.name,type:t.type,thumb:typeof t.thumb=="string"?t.thumb:""}}async function G(e){await M();const t=await fetch(F(e),{credentials:T,cache:"no-store"}),a=await t.json().catch(()=>null),l=k(a);if(!t.ok){const c=typeof l.error=="string"&&l.error?l.error:"Couldn't reach the games service. Try reloading.";throw new Error(c)}return l}function E(e){return e?/^https?:\/\//i.test(e)?e:F(e.startsWith("/")?e:`/${e}`):""}async function Y(e){const t=new URLSearchParams;e.q&&t.set("q",e.q),e.random&&t.set("random","1");let l=[];try{const a=await Promise.race([G(`/api/games?${t}`),new Promise((_,r)=>setTimeout(r,2500))]);l=Array.isArray(a.games)?a.games.map(A).filter(c=>!!c):[]}catch{}const q=(e.q||"").trim().toLowerCase(),o=IGNITE_GAMES.filter(g=>!q||g.name.toLowerCase().includes(q)).map(g=>({id:g.id,name:g.name,type:g.type,thumb:g.thumb})),m=[...o,...l];e.random&&!q&&m.sort(()=>Math.random()-.5);return{games:m,total:m.length,page:1,pages:1}}async function H(e){const L=IGNITE_GAMES.find(g=>g.id===e);if(L)return{url:L.url,thumb:L.thumb,type:"embed",meta:{id:L.id,name:L.name,type:"embed",thumb:L.thumb}};const t=await G(`/api/games/${encodeURIComponent(e)}`),a=A(t.meta),l=typeof t.url=="string"?t.url:"";if(!l||!a)throw new Error("Couldn't launch that game.");return{url:E(l),thumb:typeof t.thumb=="string"?E(t.thumb):"",type:t.type==="proxy"?"proxy":"embed",meta:a}}function K(e,t){const[a,l]=i.useState(e);return i.useEffect(()=>{const c=window.setTimeout(()=>l(e),t);return()=>window.clearTimeout(c)},[e,t]),a}function V(e,t){return e instanceof Error&&e.message?e.message:t}function W(e=!1){const[t,a]=i.useState("loading"),[l,c]=i.useState([]),[m,n]=i.useState({}),[u,f]=i.useState(0),[y,b]=i.useState(!1),[x,d]=i.useState(null),[v,N]=i.useState(""),[g,S]=i.useState(null),p=K(v.trim(),Q),j=!p;i.useEffect(()=>{if(e)return;let o=!0;return b(!0),d(null),Y({q:p||void 0,random:j}).then(h=>{if(!o)return;c(h.games),f(h.total);const w={};for(const C of h.games)w[C.id]=E(C.thumb);n(w),a("ready"),d(null)}).catch(h=>{o&&(a("error"),d(V(h,"Couldn't load games.")))}).finally(()=>{o&&b(!1)}),()=>{o=!1}},[p,e,j]);const s=i.useCallback(async o=>{d(null),S(o.id);try{return await H(o.id)}catch{return null}finally{S(null)}},[]);return{status:t,error:x,games:l,images:m,total:u,pageLoading:y,query:v,setQuery:N,shuffled:j,launching:g,play:s,debouncedQuery:p}}const R="_mih0yj4";function X({controller:e,name:t,src:a,onClose:l}){const c=i.useRef(null),m=i.useRef(I());return i.useEffect(()=>{const n=$(),u=f=>{f.key==="Escape"&&l()};return n.addEventListener("keydown",u),()=>n.removeEventListener("keydown",u)},[l]),i.useEffect(()=>{const n=c.current;return!e||!n?void 0:(q(e,R,n,m.current,{onUrl:()=>{},onTitle:()=>{}}).go(a),()=>P(m.current,R))},[e,a]),r.jsxs("div",{className:"_mih0yj4",children:[!e&&r.jsx("div",{className:"games-stage-loading",children:"Starting game…"}),r.jsx("iframe",{ref:c,className:"_kt8yn17",title:t,allow:_,allowFullScreen:!0,onPointerDown:n=>n.currentTarget.focus()}),r.jsx("button",{type:"button",className:"_k2ow2d7",onClick:l,"aria-label":"Close",children:r.jsx(z,{size:16})})]})}const J={ids:[],entries:{}},Z="games.saved.v2";function ee(e){const[t,a]=i.useState(()=>U(e,J));return i.useEffect(()=>B(e,t),[e,t]),[t,a]}function te({game:e,src:t,favorited:a,launching:l,onPlay:c,onToggleFav:m,onUnavailable:n}){const[u,f]=i.useState(!1),[bd,sb]=i.useState(!1);return i.useEffect(()=>{t||n(e.id)},[t,e.id,n]),!t||u?null:r.jsxs("div",{className:`_p3xhvnp ${l?"launching":""}`,onClick:c,role:"button",tabIndex:0,title:e.name,children:[bd?r.jsx("div",{className:"_45j08ng ignite-thumb-fallback",children:e.name.charAt(0)}):r.jsx("img",{className:"_45j08ng",src:t,alt:e.name,loading:"lazy",onError:()=>{String(e.id).startsWith("local-")?sb(!0):(f(!0),n(e.id))}}),l&&r.jsx("span",{className:"game-tile-spin"}),r.jsx("span",{className:"_43oo6jb",children:e.name}),r.jsx("button",{type:"button",className:`_j427epn ${a?"on":""}`,onClick:y=>{y.stopPropagation(),m()},"aria-label":"Favorite",children:r.jsx(L,{size:15,filled:a})})]})}function re({controller:e,onOpenUrl:t}){const[a,l]=i.useState(!1),[c,m]=ee(Z),n=W(a),[u,f]=i.useState(null),[y,b]=i.useState({}),x=i.useCallback(s=>b(o=>o[s]?o:{...o,[s]:!0}),[]),d=i.useMemo(()=>c.ids.map(s=>c.entries[s]).filter(Boolean),[c]),v=i.useCallback(async s=>{const o=await n.play(s);if(!o){x(s.id);return}o.type==="proxy"?t(o.url):f({url:o.url,name:s.name})},[n.play,t,x]),N=i.useCallback(s=>{m(o=>{if(o.ids.includes(s.id)){const h={...o.entries};return delete h[s.id],{ids:o.ids.filter(w=>w!==s.id),entries:h}}return{ids:[s.id,...o.ids],entries:{...o.entries,[s.id]:s}}})},[m]),g=i.useMemo(()=>(a?d.filter(o=>!n.query.trim()||o.name.toLowerCase().includes(n.query.trim().toLowerCase())):n.games).filter(o=>!y[o.id]),[a,n.games,n.query,d,y]),S=i.useMemo(()=>{if(!a)return n.images;const s={};for(const o of d)s[o.id]=E(o.thumb);return s},[a,n.images,d]),p=a?"No favorites yet.":"No games found.",j=(n.status==="loading"||n.pageLoading)&&g.length===0;return r.jsxs("div",{className:`_j54ff7r${u?" _5cmgbsy":""}`,children:[r.jsxs("div",{className:"_9j181ai",children:[r.jsxs("div",{className:"_f17g5y4",children:[r.jsxs("div",{className:"_2pwuuvh",children:[r.jsx(D,{size:15}),r.jsx("input",{value:n.query,onChange:s=>n.setQuery(s.target.value),placeholder:"Search games"})]}),r.jsxs("button",{type:"button",className:`games-filter ${a?"on":""}`,onClick:()=>l(s=>!s),children:[r.jsx(L,{size:14,filled:a})," Favorites"," ",c.ids.length>0&&r.jsx("span",{className:"games-count",children:c.ids.length})]}),!a&&g.length>0&&r.jsxs("button",{type:"button",className:"games-filter",onClick:()=>void v(g[Math.floor(Math.random()*g.length)]),children:[r.jsx(O,{size:14})," Random"]})]}),n.status==="error"&&!n.error&&r.jsx("div",{className:"games-error",children:"Couldn't reach the games service. Try reloading."}),n.error&&r.jsx("div",{className:"games-error",children:n.error}),r.jsx("section",{className:"games-section",children:j?r.jsx("div",{className:"games-empty",children:"Loading games…"}):g.length===0?r.jsx("div",{className:"games-empty",children:p}):r.jsx("div",{className:"games-grid",children:g.map(s=>r.jsx(te,{game:s,src:S[s.id],favorited:c.ids.includes(s.id),launching:n.launching===s.id,onPlay:()=>void v(s),onToggleFav:()=>N(s),onUnavailable:x},s.id))})})]}),u&&r.jsx(X,{controller:e,name:u.name,src:u.url,onClose:()=>f(null)})]})}export{re as GamesPage};
1
+ import{r as i,j as r}from"./react-BNEptbwn-8068ec8f.js";import{b as F,s as M,C as T,t as I,u as q,v as P,x as _,g as z,n as $,k as D,y as L,S as O,r as U,z as B}from"./index-COUSXtyQ-8068ec8f.js";import"./motion-B1hdS1Lc-8068ec8f.js";const IGNITE_GAMES=[{"id":"local-drift-city","name":"Drift City","type":"embed","thumb":"https://www.onlinegames.io/media/posts/837/Drift-City.jpg","url":"https://cloud.onlinegames.io/games/2024/gm/games2/drift-city/index.html"},{"id":"local-gt-traffic-racer","name":"GT Traffic Racer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1292/gt-traffic-racer.webp","url":"https://html5.gamedistribution.com/cecfade6d8ef4fb7a4b1924452da4204/?gd_sdk_referrer_url=https://www.onlinegames.io/gt-traffic-racer/"},{"id":"local-ultimate-flying-car-2","name":"Ultimate Flying Car 2","type":"embed","thumb":"https://www.onlinegames.io/media/posts/880/ultimate-flying-car-2.jpg","url":"https://html5.gamedistribution.com/33ac31671df249cb964b7b0fd44ec464/?gd_sdk_referrer_url=https://www.onlinegames.io/ultimate-flying-car-2/"},{"id":"local-burnout-city","name":"Burnout City","type":"embed","thumb":"https://www.onlinegames.io/media/posts/861/burnoutcity.jpg","url":"https://cloud.onlinegames.io/games/2024/unity/burnout-city/index-og.html"},{"id":"local-american-truck-car-driving","name":"American Truck Car Driving","type":"embed","thumb":"https://www.onlinegames.io/media/posts/355/American-Truck-Car-Driving-Game.jpg","url":"https://html5.gamedistribution.com/d3e870c05a48468c8e03062b75698b8a/?gd_sdk_referrer_url=https://www.onlinegames.io/american-truck-car-driving/"},{"id":"local-city-car-simulator","name":"City Car Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/35/City-Car-Simulator.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/city-car-simulator/index.html"},{"id":"local-super-car-driving","name":"Super Car Driving","type":"embed","thumb":"https://www.onlinegames.io/media/posts/854/supercardriving-2.jpg","url":"https://cloud.onlinegames.io/games/2024/unity2/super-car-driving/index-og.html"},{"id":"local-racing-horizon","name":"Racing Horizon","type":"embed","thumb":"https://www.onlinegames.io/media/posts/335/Racing-Horizon-2.jpg","url":"https://html5.gamedistribution.com/4aae27f8b4cf45d69291815ba95de748/?gd_sdk_referrer_url=https://www.onlinegames.io/racing-horizon/"},{"id":"local-car-football","name":"Car Football","type":"embed","thumb":"https://www.onlinegames.io/media/posts/405/Car-Football.jpg","url":"https://www.onlinegames.io/games/2023/construct/198/car-football/index.html"},{"id":"local-traffic-racing","name":"Traffic Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1308/traffic-racing.webp","url":"https://html5.gamedistribution.com/f3ee6674b4ea4579aeefd54d7bf388f0/?gd_sdk_referrer_url=https://www.onlinegames.io/traffic-racing-1/"},{"id":"local-tow-n-go","name":"Tow N Go","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1085/Tow-N-Go.webp","url":"https://html5.gamedistribution.com/56e2d741d80d4873905aff16d8cfee0f/?gd_sdk_referrer_url=https://www.onlinegames.io/tow-n-go/"},{"id":"local-street-traffic-racer","name":"Street Traffic Racer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1071/Street-Traffic-Racer.webp","url":"https://html5.gamedistribution.com/b4d7df30b6354d92aad8ac6b6162dc74/?gd_sdk_referrer_url=https://www.onlinegames.io/street-traffic-racer/"},{"id":"local-mini-cars-racing","name":"Mini Cars Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1010/Mini-Cars-Racing.jpg","url":"https://cloud.onlinegames.io/games/2021/unity/mini-cars-racing/index-og.html"},{"id":"local-drift-rider","name":"Drift Rider","type":"embed","thumb":"https://www.onlinegames.io/media/posts/553/Drift-Rider.jpg","url":"https://www.onlinegames.io/games/2023/unity3/drift-rider/index.html"},{"id":"local-slow-roads","name":"Slow Roads","type":"embed","thumb":"https://www.onlinegames.io/media/posts/725/Slow-Roads-io-Play.jpg","url":"https://www.onlinegames.io/games/2024/more/slow-roads/index.html"},{"id":"local-taxi-simulator","name":"Taxi Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/465/Taxi-Simulator.jpg","url":"https://www.onlinegames.io/games/2022/unity/taxi-simulator/index.html"},{"id":"local-crazy-parking-fury","name":"Crazy Parking Fury","type":"embed","thumb":"https://www.onlinegames.io/media/posts/643/Crazy-Parking-Fury.jpg","url":"https://www.onlinegames.io/games/2022/unity3/crazy-parking-fury/index.html"},{"id":"local-eggy-car","name":"Eggy Car","type":"embed","thumb":"https://www.onlinegames.io/media/posts/390/Eggy-Car.jpg","url":"https://html5.gamedistribution.com/59a98bf799ef499d9d7b9285bccaa196/?gd_sdk_referrer_url=https://www.onlinegames.io/eggy-car"},{"id":"local-jelly-car-simulator","name":"Jelly Car Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/917/jelly-car.jpg","url":"https://playhop.com/app/383730?utm_source=distrib&is-united-page=1&skip-guard=1&header=no&utm_medium=cristian-ovidiu&clid=8531463"},{"id":"local-cars-simulator","name":"Cars Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/15/Cars-Simulator-3.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/cars-simulator/index2.html"},{"id":"local-car-parking","name":"Car Parking","type":"embed","thumb":"https://www.onlinegames.io/media/posts/334/Car-Parking.webp","url":"https://cloud.freezenova.com/games/monoa-city-parking/unblocked.html"},{"id":"local-max-speed","name":"Max Speed","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1309/max-speed.webp","url":"https://html5.gamedistribution.com/48f3d14ced3646b781e256ca7f9bfa30/?gd_sdk_referrer_url=https://www.onlinegames.io/max-speed/"},{"id":"local-formula-traffic-racer","name":"Formula Traffic Racer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1119/formula-traffic-racer.webp","url":"https://html5.gamedistribution.com/940c7c7f620b46f0ba61998e9a98b8fb/?gd_sdk_referrer_url=https://www.onlinegames.io/formula-traffic-racer/"},{"id":"local-stunt-simulator-multiplayer","name":"Stunt Simulator Multiplayer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/682/Stunt-Simulator-Multiplayer-Play.jpg","url":"https://www.onlinegames.io/games/2021/unity/stunt-simulator-multiplayer/index.html"},{"id":"local-vehicles-simulator-2","name":"Vehicles Simulator 2","type":"embed","thumb":"https://www.onlinegames.io/media/posts/695/Vehicles-Simulator-2.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/vehicles-simulator-2/index2.html"},{"id":"local-elite-racing","name":"Elite Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/666/Elite-Racing.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/elite-racing/index.html"},{"id":"local-stunt-simulator","name":"Stunt Simulator","type":"embed","thumb":"https://www.onlinegames.io/media/posts/18/Stunt-Simulator-Game.jpg","url":"https://unblocked-games.s3.amazonaws.com/games/stunt-simulator/index2.html"},{"id":"local-poly-racing-cars","name":"Poly Racing Cars","type":"embed","thumb":"https://www.onlinegames.io/media/posts/835/Poly-racing-cars-image.jpg","url":"https://cloud.onlinegames.io/games/2022/unity3/poly-racing-cars/index-og.html"},{"id":"local-super-mini-racing","name":"Super Mini Racing","type":"embed","thumb":"https://www.onlinegames.io/media/posts/819/Super-Mini-Racing.jpg","url":"https://www.onlinegames.io/games/2022/unity4/super-mini-racing/index.html"},{"id":"local-city-stunts","name":"City Stunts","type":"embed","thumb":"https://www.onlinegames.io/media/posts/629/City-Stunts-Game.jpg","url":"https://www.onlinegames.io/games/2023/unity3/city-stunts/index.html"},{"id":"local-traffic-jam-3d","name":"Traffic Jam 3D","type":"embed","thumb":"https://www.onlinegames.io/media/posts/784/Traffic-Jam.jpg","url":"https://html5.gamedistribution.com/337302b23b5943d8bcfc501d81d50cdb/?gd_sdk_referrer_url=https://www.onlinegames.io/traffic-jam-3d/"},{"id":"local-monster-truck-mountain-climb","name":"Monster Truck Mountain Climb","type":"embed","thumb":"https://www.onlinegames.io/media/posts/924/monster-truck-mountain-climb.jpg","url":"https://cloud.onlinegames.io/games/2021/2/monster-truck-mountain-climb/index-og.html"},{"id":"local-golfdash","name":"Golfdash","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1409/golfdash.webp","url":"https://html5.gamedistribution.com/96e8930b69c044c687e3dc617bdb4a43/?gd_sdk_referrer_url=https://www.onlinegames.io/golfdash"},{"id":"local-bloxorz","name":"Bloxorz","type":"embed","thumb":"https://www.onlinegames.io/media/posts/849/bloxorz.jpg","url":"https://cloud.onlinegames.io/games/2024/gm/games4/bloxorz/index.html"},{"id":"local-pixel-path","name":"Pixel Path","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1050/pixel_path_game.webp","url":"https://html5.gamedistribution.com/3ffc5c0944f54f06afb212ca7d80bb00/?gd_sdk_referrer_url=https://www.onlinegames.io/pixel-path/"},{"id":"local-definitely-not-a-platformer","name":"Definitely Not a Platformer","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1410/definitely-not-a-platformer.webp","url":"https://html5.gamedistribution.com/68ea3a38ad79429ebc7a73aa35c4114b/?gd_sdk_referrer_url=https://www.onlinegames.io/definitely-not-a-platformer"},{"id":"local-mahjong","name":"Mahjong","type":"embed","thumb":"https://www.onlinegames.io/media/posts/966/Mahjong.jpg","url":"https://cloud.onlinegames.io/games/2025/unity/mahjong/index-og.html"},{"id":"local-jelly-run-2048","name":"Jelly Run 2048","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1335/jelly-run-2048.webp","url":"https://html5.gamedistribution.com/95447102992c46629b7addf13099f990/?gd_sdk_referrer_url=https://www.onlinegames.io/jelly-run-2048/"},{"id":"local-mergest-kingdom","name":"Mergest Kingdom","type":"embed","thumb":"https://www.onlinegames.io/media/posts/412/Mergest-Kingdom-Online.jpg","url":"https://html5.gamedistribution.com/b5203bfef51242c39690c761321d769f/?gd_sdk_referrer_url=https://www.onlinegames.io/the-mergest-kingdom"},{"id":"local-unpacking","name":"Unpacking","type":"embed","thumb":"https://www.onlinegames.io/media/posts/481/Unpacking.jpg","url":"https://html5.gamedistribution.com/d445590892294eebb41d983e1c598ab1/?gd_sdk_referrer_url=https://www.onlinegames.io/unpacking"},{"id":"local-hidden-objects","name":"Hidden Objects","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1120/hidden-objects.webp","url":"https://html5.gamedistribution.com/87bdc78edaac4365aa21f3acdfe7791d/?gd_sdk_referrer_url=https://www.onlinegames.io/hidden-objects/"},{"id":"local-tic-tac-toe","name":"Tic Tac Toe","type":"embed","thumb":"https://www.onlinegames.io/media/posts/529/Tic-Tac-Toe.jpg","url":"https://www.onlinegames.io/games/2021/unity2/tic-tac-toe/index.html"},{"id":"local-bookworm","name":"Bookworm","type":"embed","thumb":"https://www.onlinegames.io/media/posts/866/bookworm.jpg","url":"https://cloud.onlinegames.io/games/2024/flash/bookworm/index-og.html"},{"id":"local-juice-merge","name":"Juice Merge","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1367/juice-merge.webp","url":"https://html5.gamedistribution.com/d4c11a64ed754d71b4671d699c66a9c7/?gd_sdk_referrer_url=https://www.onlinegames.io/juice-merge/"},{"id":"local-rummikub","name":"Rummikub","type":"embed","thumb":"https://www.onlinegames.io/media/posts/387/Rummikub-Online.jpg","url":"https://html5.gamedistribution.com/6bf29e0982a64f898a81c3f3612aba26/?gd_sdk_referrer_url=https://www.onlinegames.io/rummikub"},{"id":"local-tile-match","name":"Tile Match","type":"embed","thumb":"https://www.onlinegames.io/media/posts/939/tile-match.jpg","url":"https://cloud.onlinegames.io/games/2025/unity/tile-match/index-og.html"},{"id":"local-home-design","name":"Home Design","type":"embed","thumb":"https://www.onlinegames.io/media/posts/763/home-design.jpg","url":"https://html5.gamedistribution.com/2752a06ef4f9406cbbe85d3f78096d25/?gd_sdk_referrer_url=https://www.onlinegames.io/home-design/"},{"id":"local-cake-match-puzzle","name":"Cake Match Puzzle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/908/55.jpg","url":"https://cloud.onlinegames.io/games/2024/unity3/cake-match-puzzle/index-og.html"},{"id":"local-2048","name":"2048","type":"embed","thumb":"https://www.onlinegames.io/media/posts/916/2048.jpg","url":"https://cloud.onlinegames.io/games/2025/html/2048/index.html"},{"id":"local-block-blast","name":"Block Blast","type":"embed","thumb":"https://www.onlinegames.io/media/posts/876/block-blast.jpg","url":"https://cloud.onlinegames.io/games/2024/unity3/block-blast/index-og.html"},{"id":"local-labuba-merge","name":"Labuba Merge","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1386/labuba-merge.webp","url":"https://html5.gamedistribution.com/3bd8d990c6294379a7755f938a4944b4/?gd_sdk_referrer_url=https://www.onlinegames.io/labuba-merge/"},{"id":"local-world-guesser","name":"World Guesser","type":"embed","thumb":"https://www.onlinegames.io/media/posts/888/world-guesser.jpg","url":"https://www.worldguessr.com/"},{"id":"local-watermelon-game","name":"Watermelon Game","type":"embed","thumb":"https://www.onlinegames.io/media/posts/928/Watermelon-Game-Online.jpg","url":"https://cloud.onlinegames.io/games/2025/construct/321/watermelon-game/index-og.html"},{"id":"local-solitaire-adventure","name":"Solitaire Adventure","type":"embed","thumb":"https://www.onlinegames.io/media/posts/519/Solitaire-Adventure-Tripeaks.jpg","url":"https://www.onlinegames.io/games/2022/unity4/solitaire-adventure/index.html"},{"id":"local-nuts-and-bolts-puzzle","name":"Nuts and Bolts Puzzle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/965/nuts-and-bolts-puzzle.jpg","url":"https://cloud.onlinegames.io/games/2025/unity/nuts-and-bolts-puzzle/index-og.html"},{"id":"local-wordle","name":"Wordle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/938/wordle.jpg","url":"https://cloud.onlinegames.io/games/2025/html/wordle/index-og.html"},{"id":"local-words-from-words","name":"Words from Words","type":"embed","thumb":"https://www.onlinegames.io/media/posts/983/words-from-words.jpg","url":"https://html5.gamedistribution.com/607f9f304899446aaf075339ba3dff81/?gd_sdk_referrer_url=https://www.onlinegames.io/words-from-words/"},{"id":"local-tetris","name":"Tetris","type":"embed","thumb":"https://www.onlinegames.io/media/posts/758/Tetris-Online.jpg","url":"https://www.onlinegames.io/games/2024/more/tetris/index.html"},{"id":"local-merge-cakes","name":"Merge Cakes","type":"embed","thumb":"https://www.onlinegames.io/media/posts/743/Merge-Cakes.jpg","url":"https://www.onlinegames.io/games/2024/more/merge-cakes/index.html"},{"id":"local-coffee-color-blocks","name":"Coffee Color Blocks","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1240/coffee-color-blocks.webp","url":"https://html5.gamedistribution.com/0904d5fb5d0044fe9fddf1cd5834cff2/?gd_sdk_referrer_url=https://www.onlinegames.io/coffee-color-blocks/"},{"id":"local-tiny-golf-king","name":"Tiny Golf King","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1349/tiny-golf-king.webp","url":"https://html5.gamedistribution.com/4b94472f98f442339ca0eb5312950482/?gd_sdk_referrer_url=https://www.onlinegames.io/tiny-golf-king/"},{"id":"local-find-hidden-cats","name":"Find Hidden Cats","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1290/find-hidden-cats.webp","url":"https://html5.gamedistribution.com/892fa29a7d4145958b37ea309752bf1b/?gd_sdk_referrer_url=https://www.onlinegames.io/find-hidden-cats/"},{"id":"local-google-feud","name":"Google Feud","type":"embed","thumb":"https://www.onlinegames.io/media/posts/384/Google-Feud.jpg","url":"https://googlefeud.com/"},{"id":"local-bus-parking-out","name":"Bus Parking Out","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1206/bus-parking-out.webp","url":"https://html5.gamedistribution.com/ee798269399449d0b1acb60f81dff1fc/?gd_sdk_referrer_url=https://www.onlinegames.io/bus-parking-out/"},{"id":"local-block-puzzle-slide-block-jam","name":"Block Puzzle: Slide Block Jam","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1228/block-puzzle-slide-block-jam.webp","url":"https://html5.gamedistribution.com/008e8e99c8d646afa6ee7d5057ee15c0/?gd_sdk_referrer_url=https://www.onlinegames.io/block-puzzle:-slide-block-jam/"},{"id":"local-hidden-objects-brain-teaser","name":"Hidden Objects: Brain Teaser","type":"embed","thumb":"https://www.onlinegames.io/media/posts/677/Hidden-Objects.jpg","url":"https://html5.gamedistribution.com/251c20b086c84cf3a227374e9022606d/?gd_sdk_referrer_url=https://www.onlinegames.io/hidden-objects-brain-teaser"},{"id":"local-unblock-it-3d","name":"Unblock It 3D","type":"embed","thumb":"https://www.onlinegames.io/media/posts/993/Unblocked-It-3D-2.webp","url":"https://html5.gamedistribution.com/bb321f67a2fc481ba31308582f3df0d5/?gd_sdk_referrer_url=https://www.onlinegames.io/unblock-it-3d/"},{"id":"local-draw-bridge-puzzle","name":"Draw Bridge Puzzle","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1248/draw-bridge-puzzle.webp","url":"https://html5.gamedistribution.com/516ceca89758466fa613fa96980eef76/?gd_sdk_referrer_url=https://www.onlinegames.io/draw-bridge-puzzle-1/"},{"id":"local-collect-em-all","name":"Collect Em All","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1328/collect-em-all.webp","url":"https://html5.gamedistribution.com/1d46874719574bc5be034bf45e93dbdb/?gd_sdk_referrer_url=https://www.onlinegames.io/collect-em-all-1/"},{"id":"local-grandmaster-chess","name":"Grandmaster Chess","type":"embed","thumb":"https://www.onlinegames.io/media/posts/429/Grandmaster-Chess-Online.jpg","url":"https://www.onlinegames.io/games/2022/unity/grandmaster-chess/index.html"},{"id":"local-arrow-sorting","name":"Arrow Sorting","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1365/arrow-sorting.webp","url":"https://html5.gamedistribution.com/2fb1dc3ebec147eeb9d7875354afcc20/?gd_sdk_referrer_url=https://www.onlinegames.io/arrow-sorting/"},{"id":"local-house-painter","name":"House Painter","type":"embed","thumb":"https://www.onlinegames.io/media/posts/700/House-Painter.jpg","url":"https://www.onlinegames.io/games/2023/construct/238/house-painter/index.html"},{"id":"local-soccer-merge","name":"Soccer Merge","type":"embed","thumb":"https://www.onlinegames.io/media/posts/647/Soccer-Merge.jpg","url":"https://html5.gamedistribution.com/669b650069914123b72bbeef5a95e2d3/?gd_sdk_referrer_url=https://www.onlinegames.io/soccer-merge"},{"id":"local-mini-crossword","name":"Mini Crossword","type":"embed","thumb":"https://www.onlinegames.io/media/posts/439/Mini-Crossword-Game.jpg","url":"https://www.onlinegames.io/games/2023/mjs/mini-crossword/index.html"},{"id":"local-wordmeister","name":"Wordmeister","type":"embed","thumb":"https://www.onlinegames.io/media/posts/513/Wordmeister-Game.jpg","url":"https://html5.gamedistribution.com/b6439239c9ab43bf925defdb54ed0cbe/?gd_sdk_referrer_url=https://www.onlinegames.io/wordmeister"},{"id":"local-bubble-game-3","name":"Bubble Game 3","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1255/bubble-game-3.webp","url":"https://html5.gamedistribution.com/27673bc45d2e4b27b7cd24e422f7c257/?gd_sdk_referrer_url=https://www.onlinegames.io/Bubble-Game-3/"},{"id":"local-gummy-blocks","name":"Gummy Blocks","type":"embed","thumb":"https://www.onlinegames.io/media/posts/568/Gummy-Blocks.jpg","url":"https://www.onlinegames.io/games/2023/code/gummy-blocks/index.html"},{"id":"local-city-tower-builder","name":"City Tower Builder","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1331/city-tower-builder-2.webp","url":"https://html5.gamedistribution.com/9f82549300b14817a917bfca75210fd0/?gd_sdk_referrer_url=https://www.onlinegames.io/city-tower-builder/"},{"id":"local-sudoku-village","name":"Sudoku Village","type":"embed","thumb":"https://www.onlinegames.io/media/posts/571/Sudoku-Village.jpg","url":"https://html5.gamedistribution.com/2625fa22f02b461eb45b4dff282c70b8/?gd_sdk_referrer_url=https://www.onlinegames.io/sudoku-village"},{"id":"local-draw-the-car-path","name":"Draw the Car Path","type":"embed","thumb":"https://www.onlinegames.io/media/posts/936/draw-the-car-path.jpg","url":"https://cloud.onlinegames.io/games/2021/4/draw-the-car-path/index-og.html"},{"id":"local-text-talk","name":"Text Talk","type":"embed","thumb":"https://www.onlinegames.io/media/posts/511/Text-Talk.jpg","url":"https://html5.gamedistribution.com/446ebdc3a4f9449db46859a15d502ae9/?gd_sdk_referrer_url=https://www.onlinegames.io/text-talk"},{"id":"local-marble-zumba-stack","name":"Marble Zumba Stack","type":"embed","thumb":"https://www.onlinegames.io/media/posts/652/Marble-Zumba-Stack.jpg","url":"https://www.onlinegames.io/games/2022/unity/marble-zumba-stack/index.html"},{"id":"local-chess-fill","name":"Chess Fill","type":"embed","thumb":"https://www.onlinegames.io/media/posts/433/Chess-Fill.jpg","url":"https://html5.gamedistribution.com/169fb99eaca444bfb5d8cd329e680d2e/?gd_sdk_referrer_url=https://www.onlinegames.io/chess-fill"},{"id":"local-sweet-sugar-match","name":"Sweet Sugar Match","type":"embed","thumb":"https://www.onlinegames.io/media/posts/576/Sweet-Sugar-Match.jpg","url":"https://www.onlinegames.io/games/2022/unity/sweet-sugar-match/index.html"},{"id":"local-word-connect","name":"Word Connect","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1132/word-connect.webp","url":"https://cloud.onlinegames.io/games/2025/unity2/word-connect/index-og.html"},{"id":"local-fish-out-of-water","name":"Fish Out of Water","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1414/fish-out-of-water-2.webp","url":"https://html5.gamedistribution.com/bece97115f26426491fa08e409e545aa/?gd_sdk_referrer_url=https://www.onlinegames.io/fish-out-of-water"},{"id":"local-football-bros-io","name":"Football Bros IO","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1173/football-bros-io.webp","url":"https://footballbros.io/"},{"id":"local-a-small-world-cup","name":"A Small World Cup","type":"embed","thumb":"https://www.onlinegames.io/media/posts/909/a-small-world-cp.jpg","url":"https://cloud.onlinegames.io/games/2024/more2/a-small-world-cup/index.html"},{"id":"local-backflip-dive-3d","name":"Backflip Dive 3D","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1083/Backflip-Dive-3D-2.webp","url":"https://html5.gamedistribution.com/a9d7229d3be14c0284d5281d125f27f3/?gd_sdk_referrer_url=https://www.onlinegames.io/backflip-dive-3d/"},{"id":"local-football-penalty-2026","name":"Football Penalty 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1406/football-penalty-2026-2.webp","url":"https://html5.gamedistribution.com/9e0857a030cf4c1f821af4b359a870fe/?gd_sdk_referrer_url=https://www.onlinegames.io/football-penalty-2026"},{"id":"local-basketball-stars-2026","name":"Basketball Stars 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1171/basketball-stars-2026.webp","url":"https://html5.gamedistribution.com/516d6908fbc848bdb89e65a58a43a7dc/?gd_sdk_referrer_url=https://www.onlinegames.io/basketball-stars-2026/"},{"id":"local-football-legends-2026","name":"Football Legends 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1307/football-legends-2026.webp","url":"https://html5.gamedistribution.com/13eabea86f7c4cd993a156258420e9ec/?gd_sdk_referrer_url=https://www.onlinegames.io/football-legends-2026/"},{"id":"local-tennis-masters-2026","name":"Tennis Masters 2026","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1391/tennis-masters-2026.webp","url":"https://html5.gamedistribution.com/ab2f156d72894fd8a5dedb85b34a05e4/?gd_sdk_referrer_url=https://www.onlinegames.io/tennis-masters-2026"},{"id":"local-office-golf","name":"Office Golf","type":"embed","thumb":"https://www.onlinegames.io/media/posts/1403/office-golf.webp","url":"https://html5.gamedistribution.com/19c63777ed1e4653b64b2200560907fd/?gd_sdk_referrer_url=https://www.onlinegames.io/office-golf"}];const IGNITE_PROLL=[{"id":"proll-g-slope","name":"Slope","type":"embed","thumb":"","url":"https://games.proll.dev/g/slope"},{"id":"proll-g-retro-bowl","name":"Retro Bowl","type":"embed","thumb":"","url":"https://games.proll.dev/g/retro-bowl"},{"id":"proll-g-deadshotio","name":"DeadShot.io","type":"embed","thumb":"","url":"https://games.proll.dev/g/deadshotio"},{"id":"proll-g-gunspin","name":"Gunspin","type":"embed","thumb":"","url":"https://games.proll.dev/g/gunspin"},{"id":"proll-g-1v1lol","name":"1v1.lol","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/2.webp","url":"https://games.proll.dev/g/1v1lol"},{"id":"proll-g-blockblast","name":"Block Blast","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/66.webp","url":"https://games.proll.dev/g/blockblast"},{"id":"proll-g-idle-breakout","name":"Idle Breakout","type":"embed","thumb":"","url":"https://games.proll.dev/g/idle-breakout"},{"id":"proll-g-learntofly","name":"Learn To Fly","type":"embed","thumb":"","url":"https://games.proll.dev/g/learntofly"},{"id":"proll-g-baldisbasics","name":"Baldi's Basics","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/43.webp","url":"https://games.proll.dev/g/baldisbasics"},{"id":"proll-g-gunmayhem","name":"Gun Mayhem","type":"embed","thumb":"","url":"https://games.proll.dev/g/gunmayhem"},{"id":"proll-g-gunmayhem2","name":"Gun Mayhem 2","type":"embed","thumb":"","url":"https://games.proll.dev/g/gunmayhem2"},{"id":"proll-g-wallsmash","name":"Wall Smash","type":"embed","thumb":"","url":"https://games.proll.dev/g/wallsmash"},{"id":"proll-g-fnaf","name":"FNAF 1","type":"embed","thumb":"","url":"https://games.proll.dev/g/fnaf"},{"id":"proll-g-fnaf-2","name":"FNAF 2","type":"embed","thumb":"","url":"https://games.proll.dev/g/fnaf-2"},{"id":"proll-g-driftboss","name":"Drift Boss","type":"embed","thumb":"","url":"https://games.proll.dev/g/driftboss"},{"id":"proll-g-jacksmith","name":"Jack Smith","type":"embed","thumb":"","url":"https://games.proll.dev/g/jacksmith"},{"id":"proll-imagetracer","name":"Image Tracer","type":"embed","thumb":"","url":"https://games.proll.dev/imagetracer"},{"id":"proll-g-infinitecraft","name":"Infinite Craft","type":"embed","thumb":"","url":"https://games.proll.dev/g/infinitecraft"},{"id":"proll-g-crazytunnel3d","name":"Crazy Tunnel 3D","type":"embed","thumb":"","url":"https://games.proll.dev/g/crazytunnel3d"},{"id":"proll-g-lazyjump3d","name":"Lazy Jump 3D","type":"embed","thumb":"","url":"https://games.proll.dev/g/lazyjump3d"},{"id":"proll-g-houseofhazards","name":"House Of Hazards","type":"embed","thumb":"","url":"https://games.proll.dev/g/houseofhazards"},{"id":"proll-g-holeio","name":"Hole.io","type":"embed","thumb":"","url":"https://games.proll.dev/g/holeio"},{"id":"proll-g-cut-the-rope","name":"Cut The Rope","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/120.webp","url":"https://games.proll.dev/g/cut-the-rope"},{"id":"proll-g-tanktrouble","name":"Tank Trouble","type":"embed","thumb":"","url":"https://games.proll.dev/g/tanktrouble"},{"id":"proll-g-drifthunters","name":"Drift Hunters","type":"embed","thumb":"","url":"https://games.proll.dev/g/drifthunters"},{"id":"proll-g-volleyrandom","name":"Volley Random","type":"embed","thumb":"","url":"https://games.proll.dev/g/volleyrandom"},{"id":"proll-g-draw-the-hill","name":"Draw The Hill","type":"embed","thumb":"","url":"https://games.proll.dev/g/draw-the-hill"},{"id":"proll-g-basketballio","name":"Basketball Bros","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/55.webp","url":"https://games.proll.dev/g/basketballio"},{"id":"proll-g-justfall","name":"Just Fall","type":"embed","thumb":"","url":"https://games.proll.dev/g/justfall"},{"id":"proll-g-snowrider3d","name":"Snow Rider 3D","type":"embed","thumb":"","url":"https://games.proll.dev/g/snowrider3d"},{"id":"proll-g-tetris","name":"Tetris","type":"embed","thumb":"","url":"https://games.proll.dev/g/tetris"},{"id":"proll-g-checkoutfrenzy","name":"Checkout Frenzy","type":"embed","thumb":"","url":"https://games.proll.dev/g/checkoutfrenzy"},{"id":"proll-g-fireboywatergirlforsettemple","name":"Fireboy & Watergirl","type":"embed","thumb":"","url":"https://games.proll.dev/g/fireboywatergirlforsettemple"},{"id":"proll-g-tinyfishing","name":"Tiny Fishing","type":"embed","thumb":"","url":"https://games.proll.dev/g/tinyfishing"},{"id":"proll-g-timeshooter","name":"Time Shooter","type":"embed","thumb":"","url":"https://games.proll.dev/g/timeshooter"},{"id":"proll-g-getaway-shootout","name":"Getaway Shootout","type":"embed","thumb":"","url":"https://games.proll.dev/g/getaway-shootout"},{"id":"proll-g-soccer-random","name":"Soccer Random","type":"embed","thumb":"","url":"https://games.proll.dev/g/soccer-random"},{"id":"proll-g-crossyroad","name":"Crossy Road","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/115.webp","url":"https://games.proll.dev/g/crossyroad"},{"id":"proll-g-rooftopsnipers","name":"Rooftop Sniper","type":"embed","thumb":"","url":"https://games.proll.dev/g/rooftopsnipers"},{"id":"proll-g-boxingrandom","name":"Boxing Random","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/79.webp","url":"https://games.proll.dev/g/boxingrandom"},{"id":"proll-g-adventurecapitalist","name":"Adventure Capitalist","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/15.webp","url":"https://games.proll.dev/g/adventurecapitalist"},{"id":"proll-g-hideandsmash","name":"Hide & Smash","type":"embed","thumb":"","url":"https://games.proll.dev/g/hideandsmash"},{"id":"proll-g-monkey-mart","name":"MonkeyMart","type":"embed","thumb":"","url":"https://games.proll.dev/g/monkey-mart"},{"id":"proll-g-rb-college","name":"Retro Bowl College","type":"embed","thumb":"","url":"https://games.proll.dev/g/rb-college"},{"id":"proll-server","name":"Windows Desktop","type":"embed","thumb":"","url":"https://games.proll.dev/server"},{"id":"proll-g-mc","name":"Minecraft","type":"embed","thumb":"","url":"https://games.proll.dev/g/mc"},{"id":"proll-g-btd5","name":"Bloons TD5","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/68.webp","url":"https://games.proll.dev/g/btd5"},{"id":"proll-g-mrmine","name":"Mr Mine","type":"embed","thumb":"","url":"https://games.proll.dev/g/mrmine"},{"id":"proll-g-run2","name":"Run 2","type":"embed","thumb":"","url":"https://games.proll.dev/g/run2"},{"id":"proll-g-run3","name":"Run 3","type":"embed","thumb":"","url":"https://games.proll.dev/g/run3"},{"id":"proll-g-elonmusk","name":"Spend Elon's Money","type":"embed","thumb":"","url":"https://games.proll.dev/g/elonmusk"},{"id":"proll-g-pvz","name":"Plants V Zombies","type":"embed","thumb":"","url":"https://games.proll.dev/g/pvz"},{"id":"proll-g-ducklife","name":"Duck Life","type":"embed","thumb":"","url":"https://games.proll.dev/g/ducklife"},{"id":"proll-g-minesweeper","name":"Mine Sweeper","type":"embed","thumb":"","url":"https://games.proll.dev/g/minesweeper"},{"id":"proll-g-pixelgun","name":"Pixel Gun","type":"embed","thumb":"","url":"https://games.proll.dev/g/pixelgun"},{"id":"proll-g-googlesnake","name":"Google Snake","type":"embed","thumb":"","url":"https://games.proll.dev/g/googlesnake"},{"id":"proll-g-ngon","name":"N Gon","type":"embed","thumb":"","url":"https://games.proll.dev/g/ngon"},{"id":"proll-g-ovo","name":"OVO","type":"embed","thumb":"","url":"https://games.proll.dev/g/ovo"},{"id":"proll-g-basketballstars","name":"Basketball Stars","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/54.webp","url":"https://games.proll.dev/g/basketballstars"},{"id":"proll-g-stacktris","name":"Stacktris","type":"embed","thumb":"","url":"https://games.proll.dev/g/stacktris"},{"id":"proll-g-blackjack","name":"Black Jack","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/65.webp","url":"https://games.proll.dev/g/blackjack"},{"id":"proll-g-dbz","name":"DBZ Devolution","type":"embed","thumb":"","url":"https://games.proll.dev/g/dbz"},{"id":"proll-g-drivemad","name":"Drive Mad","type":"embed","thumb":"","url":"https://games.proll.dev/g/drivemad"},{"id":"proll-g-papas-game","name":"Papa's Games","type":"embed","thumb":"","url":"https://games.proll.dev/g/papas-game"},{"id":"proll-g-henry-stickman","name":"Stickman Games","type":"embed","thumb":"","url":"https://games.proll.dev/g/henry-stickman"},{"id":"proll-g-vex","name":"Vex Games","type":"embed","thumb":"","url":"https://games.proll.dev/g/vex"},{"id":"proll-g-2048","name":"2048","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/8.webp","url":"https://games.proll.dev/g/2048"},{"id":"proll-g-paperio2","name":"Paper.io 2","type":"embed","thumb":"","url":"https://games.proll.dev/g/paperio2"},{"id":"proll-g-bitlife","name":"Bitlife","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/63.webp","url":"https://games.proll.dev/g/bitlife"},{"id":"proll-g-1","name":"1","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/0.webp","url":"https://games.proll.dev/g/1"},{"id":"proll-g-subway-surfers","name":"Subway Surfers","type":"embed","thumb":"","url":"https://games.proll.dev/g/subway-surfers"},{"id":"proll-g-basketball-random","name":"Basketball Random","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/56.webp","url":"https://games.proll.dev/g/basketball-random"},{"id":"proll-g-motox3m","name":"MotoX3M","type":"embed","thumb":"","url":"https://games.proll.dev/g/motox3m"},{"id":"proll-g-cookieclicker","name":"Cookie Clicker","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/103.webp","url":"https://games.proll.dev/g/cookieclicker"},{"id":"proll-g-temple-run-2","name":"Temple Run 2","type":"embed","thumb":"","url":"https://games.proll.dev/g/temple-run-2"},{"id":"proll-g-stickman-golf","name":"Stickman Golf","type":"embed","thumb":"","url":"https://games.proll.dev/g/stickman-golf"},{"id":"proll-g-case-clicker","name":"CSGO Case Opener","type":"embed","thumb":"https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@l001/covers/117.webp","url":"https://games.proll.dev/g/case-clicker"},{"id":"proll-g-pandemic2","name":"Pandemic 2","type":"embed","thumb":"","url":"https://games.proll.dev/g/pandemic2"},{"id":"proll-g-riddleschool","name":"Riddle School Games","type":"embed","thumb":"","url":"https://games.proll.dev/g/riddleschool"},{"id":"proll-g-cupcake2048","name":"Cupcake 2048","type":"embed","thumb":"","url":"https://games.proll.dev/g/cupcake2048"},{"id":"proll-g-jetpack-joyride","name":"Jetpack Joyride","type":"embed","thumb":"","url":"https://games.proll.dev/g/jetpack-joyride"},{"id":"proll-g-geodash","name":"Geometry Dash","type":"embed","thumb":"","url":"https://games.proll.dev/g/geodash"},{"id":"proll-g-ducklife1","name":"Duck Life 1","type":"embed","thumb":"","url":"https://games.proll.dev/g/ducklife1"},{"id":"proll-g-sandboxels","name":"Sand Boxels","type":"embed","thumb":"","url":"https://games.proll.dev/g/sandboxels"}];const IGNITE_ALIASES={"basketball bros":"basket bros","basketball random":"basket random","crossy road":"crossy roads","csgo case opener":"csgo clicker","mine sweeper":"minesweeper","plants v zombies":"plants vs zombies","fnaf 1":"five nights at freddys","fnaf 2":"five nights at freddys 2","dbz devolution":"dragon ball z devolution","paperio 2":"paper io 2","hole io":"hole io","deadshot io":"deadshot io","motox3m":"moto x3m","hide smash":"hide and smash","fireboy watergirl":"fireboy and watergirl","retro bowl college":"retro bowl college","bloons td5":"bloons td5"};const IGNITE_NORM=s=>String(s).toLowerCase().replace(/,\s*webport$/,"").replace(/&/g," and ").replace(/[^a-z0-9]+/g," ").trim();let IGNITE_COVERS=null;async function igniteCovers(){if(IGNITE_COVERS)return IGNITE_COVERS;let m={};try{const c=JSON.parse(localStorage.getItem("ignite.covers.v1")||"null");c&&typeof c=="object"&&(m=c)}catch{}if(Object.keys(m).length>50)return IGNITE_COVERS=m;for(const b of["main","lib"]){try{const r=await Promise.race([fetch("https://cdn.jsdelivr.net/gh/skidding-code/truffled-lib@"+b+"/zones.json"),new Promise((_,j)=>setTimeout(j,4500))]);if(!r.ok)continue;const z=await r.json();if(!Array.isArray(z))continue;for(const e of z){if(!e||typeof e.cover!="string"||!e.cover.startsWith("https://cdn.jsdelivr.net/"))continue;for(const n of[e.name,...(e.altNames||[])]){const k=IGNITE_NORM(n);k&&!m[k]&&(m[k]=e.cover)}}if(Object.keys(m).length>50){try{localStorage.setItem("ignite.covers.v1",JSON.stringify(m))}catch{}break}}catch{}}return IGNITE_COVERS=m}function igniteCoverFor(g,m){if(g.thumb&&g.thumb.startsWith("https://cdn.jsdelivr.net/"))return g.thumb;const k=IGNITE_NORM(g.name);return m[k]||m[IGNITE_ALIASES[k]]||m[IGNITE_NORM(g.name.replace(/\s*(games?)$/i,""))]||""}const Q=300;function k(e){return e&&typeof e=="object"?e:{}}function A(e){const t=k(e);return typeof t.id!="string"||typeof t.name!="string"||t.type!=="embed"&&t.type!=="proxy"?null:{id:t.id,name:t.name,type:t.type,thumb:typeof t.thumb=="string"?t.thumb:""}}async function G(e){await M();const t=await fetch(F(e),{credentials:T,cache:"no-store"}),a=await t.json().catch(()=>null),l=k(a);if(!t.ok){const c=typeof l.error=="string"&&l.error?l.error:"Couldn't reach the games service. Try reloading.";throw new Error(c)}return l}function E(e){return e?/^https?:\/\//i.test(e)?e:F(e.startsWith("/")?e:`/${e}`):""}async function Y(e){const t=new URLSearchParams;e.q&&t.set("q",e.q),e.random&&t.set("random","1");let l=[];try{const a=await Promise.race([G(`/api/games?${t}`),new Promise((_,r)=>setTimeout(r,2500))]);l=Array.isArray(a.games)?a.games.map(A).filter(c=>!!c):[]}catch{}const q=(e.q||"").trim().toLowerCase(),cv=await igniteCovers(),pr=IGNITE_PROLL.filter(g=>!q||g.name.toLowerCase().includes(q)).map(g=>({id:g.id,name:g.name,type:g.type,thumb:igniteCoverFor(g,cv)})),o=IGNITE_GAMES.filter(g=>!q||g.name.toLowerCase().includes(q)).map(g=>({id:g.id,name:g.name,type:g.type,thumb:igniteCoverFor(g,cv)||g.thumb})),m=[...pr,...o,...l];return{games:m,total:m.length,page:1,pages:1}}async function H(e){const L=IGNITE_PROLL.find(g=>g.id===e)||IGNITE_GAMES.find(g=>g.id===e);if(L)return{url:L.url,thumb:L.thumb,type:"embed",meta:{id:L.id,name:L.name,type:"embed",thumb:L.thumb}};const t=await G(`/api/games/${encodeURIComponent(e)}`),a=A(t.meta),l=typeof t.url=="string"?t.url:"";if(!l||!a)throw new Error("Couldn't launch that game.");return{url:E(l),thumb:typeof t.thumb=="string"?E(t.thumb):"",type:t.type==="proxy"?"proxy":"embed",meta:a}}function K(e,t){const[a,l]=i.useState(e);return i.useEffect(()=>{const c=window.setTimeout(()=>l(e),t);return()=>window.clearTimeout(c)},[e,t]),a}function V(e,t){return e instanceof Error&&e.message?e.message:t}function W(e=!1){const[t,a]=i.useState("loading"),[l,c]=i.useState([]),[m,n]=i.useState({}),[u,f]=i.useState(0),[y,b]=i.useState(!1),[x,d]=i.useState(null),[v,N]=i.useState(""),[g,S]=i.useState(null),p=K(v.trim(),Q),j=!p;i.useEffect(()=>{if(e)return;let o=!0;return b(!0),d(null),Y({q:p||void 0,random:j}).then(h=>{if(!o)return;c(h.games),f(h.total);const w={};for(const C of h.games)w[C.id]=E(C.thumb);n(w),a("ready"),d(null)}).catch(h=>{o&&(a("error"),d(V(h,"Couldn't load games.")))}).finally(()=>{o&&b(!1)}),()=>{o=!1}},[p,e,j]);const s=i.useCallback(async o=>{d(null),S(o.id);try{return await H(o.id)}catch{return null}finally{S(null)}},[]);return{status:t,error:x,games:l,images:m,total:u,pageLoading:y,query:v,setQuery:N,shuffled:j,launching:g,play:s,debouncedQuery:p}}const R="_mih0yj4";function X({controller:e,name:t,src:a,onClose:l}){const c=i.useRef(null),m=i.useRef(I());return i.useEffect(()=>{const n=$(),u=f=>{f.key==="Escape"&&l()};return n.addEventListener("keydown",u),()=>n.removeEventListener("keydown",u)},[l]),i.useEffect(()=>{const n=c.current;return!e||!n?void 0:(q(e,R,n,m.current,{onUrl:()=>{},onTitle:()=>{}}).go(a),()=>P(m.current,R))},[e,a]),r.jsxs("div",{className:"_mih0yj4",children:[!e&&r.jsx("div",{className:"games-stage-loading",children:"Starting game…"}),r.jsx("iframe",{ref:c,className:"_kt8yn17",title:t,allow:_,allowFullScreen:!0,onPointerDown:n=>n.currentTarget.focus()}),r.jsx("button",{type:"button",className:"_k2ow2d7",onClick:l,"aria-label":"Close",children:r.jsx(z,{size:16})})]})}const J={ids:[],entries:{}},Z="games.saved.v2";function ee(e){const[t,a]=i.useState(()=>U(e,J));return i.useEffect(()=>B(e,t),[e,t]),[t,a]}function te({game:e,src:t,favorited:a,launching:l,onPlay:c,onToggleFav:m,onUnavailable:n}){const[u,f]=i.useState(!1),[bd,sb]=i.useState(!1);return i.useEffect(()=>{t||/^(local|proll)-/.test(e.id)||n(e.id)},[t,e.id,n]),(!t&&!/^(local|proll)-/.test(e.id))||u?null:r.jsxs("div",{className:`_p3xhvnp ${l?"launching":""}`,onClick:c,role:"button",tabIndex:0,title:e.name,children:[bd||!t?r.jsx("div",{className:"_45j08ng ignite-thumb-fallback",children:e.name.charAt(0)}):r.jsx("img",{className:"_45j08ng",src:t,alt:e.name,loading:"lazy",onError:()=>{/^(local|proll)-/.test(String(e.id))?sb(!0):(f(!0),n(e.id))}}),l&&r.jsx("span",{className:"game-tile-spin"}),r.jsx("span",{className:"_43oo6jb",children:e.name}),r.jsx("button",{type:"button",className:`_j427epn ${a?"on":""}`,onClick:y=>{y.stopPropagation(),m()},"aria-label":"Favorite",children:r.jsx(L,{size:15,filled:a})})]})}function re({controller:e,onOpenUrl:t}){const[a,l]=i.useState(!1),[c,m]=ee(Z),n=W(a),[u,f]=i.useState(null),[y,b]=i.useState({}),x=i.useCallback(s=>b(o=>o[s]?o:{...o,[s]:!0}),[]),d=i.useMemo(()=>c.ids.map(s=>c.entries[s]).filter(Boolean),[c]),v=i.useCallback(async s=>{const o=await n.play(s);if(!o){x(s.id);return}o.type==="proxy"?t(o.url):f({url:o.url,name:s.name})},[n.play,t,x]),N=i.useCallback(s=>{m(o=>{if(o.ids.includes(s.id)){const h={...o.entries};return delete h[s.id],{ids:o.ids.filter(w=>w!==s.id),entries:h}}return{ids:[s.id,...o.ids],entries:{...o.entries,[s.id]:s}}})},[m]),g=i.useMemo(()=>(a?d.filter(o=>!n.query.trim()||o.name.toLowerCase().includes(n.query.trim().toLowerCase())):n.games).filter(o=>!y[o.id]),[a,n.games,n.query,d,y]),S=i.useMemo(()=>{if(!a)return n.images;const s={};for(const o of d)s[o.id]=E(o.thumb);return s},[a,n.images,d]),p=a?"No favorites yet.":"No games found.",j=(n.status==="loading"||n.pageLoading)&&g.length===0;return r.jsxs("div",{className:`_j54ff7r${u?" _5cmgbsy":""}`,children:[r.jsxs("div",{className:"_9j181ai",children:[r.jsxs("div",{className:"_f17g5y4",children:[r.jsxs("div",{className:"_2pwuuvh",children:[r.jsx(D,{size:15}),r.jsx("input",{value:n.query,onChange:s=>n.setQuery(s.target.value),placeholder:"Search games"})]}),r.jsxs("button",{type:"button",className:`games-filter ${a?"on":""}`,onClick:()=>l(s=>!s),children:[r.jsx(L,{size:14,filled:a})," Favorites"," ",c.ids.length>0&&r.jsx("span",{className:"games-count",children:c.ids.length})]}),!a&&g.length>0&&r.jsxs("button",{type:"button",className:"games-filter",onClick:()=>void v(g[Math.floor(Math.random()*g.length)]),children:[r.jsx(O,{size:14})," Random"]})]}),n.status==="error"&&!n.error&&r.jsx("div",{className:"games-error",children:"Couldn't reach the games service. Try reloading."}),n.error&&r.jsx("div",{className:"games-error",children:n.error}),r.jsx("section",{className:"games-section",children:j?r.jsx("div",{className:"games-empty",children:"Loading games…"}):g.length===0?r.jsx("div",{className:"games-empty",children:p}):r.jsx("div",{className:"games-grid",children:g.map(s=>r.jsx(te,{game:s,src:S[s.id],favorited:c.ids.includes(s.id),launching:n.launching===s.id,onPlay:()=>void v(s),onToggleFav:()=>N(s),onUnavailable:x},s.id))})})]}),u&&r.jsx(X,{controller:e,name:u.name,src:u.url,onClose:()=>f(null)})]})}export{re as GamesPage};
@@ -1 +1 @@
1
- import{r as d,j as s}from"./react-BNEptbwn-8068ec8f.js";import{a0 as u,V as p}from"./index-COUSXtyQ-8068ec8f.js";/* empty css *//* empty css */import"./motion-B1hdS1Lc-8068ec8f.js";const h=["No ads","3M AI tokens/day","Exclusive Plus links","Discord Plus role"];function y({account:e,onOpenAccount:a}){var r;const[t,n]=d.useState(!1),l=e.status==="signed-in",c=e.isPlus,o=async()=>{var i;if(!l){a();return}n(!0);try{await e.checkout(((i=e.user)==null?void 0:i.email)??void 0)}finally{n(!1)}};return s.jsx("div",{className:"settings-page plus-page",children:s.jsxs("div",{className:"settings-page-inner",children:[s.jsxs("div",{className:"settings-page-head",children:[s.jsxs("h1",{children:["IGNITE OS BROWSER",s.jsx("span",{className:"plus-page-mark",children:"+"})]}),s.jsx("p",{children:"Remove ads, unlock 3M AI tokens/day, and get Discord perks."})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"What you get"}),s.jsx("ul",{className:"plus-page-perks",children:h.map(i=>s.jsx("li",{children:i},i))}),s.jsx("p",{className:"plus-page-price",children:"$6.99 / month · cancel anytime"})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Get Plus"}),e.status==="loading"?s.jsx("p",{className:"plus-page-hint",children:"Checking your account…"}):c?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"plus-page-hint",children:"You're already on IGNITE OS BROWSER Plus."}),s.jsx("button",{type:"button",className:"account-btn ghost",onClick:()=>void e.manageBilling(),children:"Manage billing"})]}):l?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"plus-page-hint",children:["Signed in as ",(r=e.user)==null?void 0:r.email,". Continue to Stripe to subscribe."]}),s.jsx(u,{}),e.authError&&s.jsx("div",{className:"account-error",children:e.authError}),s.jsx("button",{type:"button",className:"account-btn primary",disabled:t,onClick:()=>void o(),children:t?"Opening Stripe…":"Upgrade to Plus"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"plus-page-hint",children:"Create a IGNITE OS BROWSER account first, then you can buy Plus."}),s.jsx("button",{type:"button",className:"account-btn primary",onClick:a,children:"Create an account"})]})]}),s.jsxs("div",{className:"settings-page-foot",children:[s.jsx(p,{size:14}),s.jsx("span",{children:"IGNITE OS BROWSER"})]})]})})}export{y as PlusPage};
1
+ import{r as d,j as s}from"./react-BNEptbwn-8068ec8f.js";import{a0 as u,V as p}from"./index-COUSXtyQ-8068ec8f.js";/* empty css *//* empty css */import"./motion-B1hdS1Lc-8068ec8f.js";const h=["No ads","3M AI tokens/day","Exclusive Plus links","Discord Plus role"];function y({account:e,onOpenAccount:a}){var r;const[t,n]=d.useState(!1),l=e.status==="signed-in",c=e.isPlus,o=async()=>{var i;if(!l){a();return}n(!0);try{await e.checkout(((i=e.user)==null?void 0:i.email)??void 0)}finally{n(!1)}};return s.jsx("div",{className:"settings-page plus-page",children:s.jsxs("div",{className:"settings-page-inner",children:[s.jsxs("div",{className:"settings-page-head",children:[s.jsxs("h1",{children:["Ignite OS",s.jsx("span",{className:"plus-page-mark",children:"+"})]}),s.jsx("p",{children:"Remove ads, unlock 3M AI tokens/day, and get Discord perks."})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"What you get"}),s.jsx("ul",{className:"plus-page-perks",children:h.map(i=>s.jsx("li",{children:i},i))}),s.jsx("p",{className:"plus-page-price",children:"$6.99 / month · cancel anytime"})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("div",{className:"settings-section-title",children:"Get Plus"}),e.status==="loading"?s.jsx("p",{className:"plus-page-hint",children:"Checking your account…"}):c?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"plus-page-hint",children:"You're already on Ignite OS Plus."}),s.jsx("button",{type:"button",className:"account-btn ghost",onClick:()=>void e.manageBilling(),children:"Manage billing"})]}):l?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"plus-page-hint",children:["Signed in as ",(r=e.user)==null?void 0:r.email,". Continue to Stripe to subscribe."]}),s.jsx(u,{}),e.authError&&s.jsx("div",{className:"account-error",children:e.authError}),s.jsx("button",{type:"button",className:"account-btn primary",disabled:t,onClick:()=>void o(),children:t?"Opening Stripe…":"Upgrade to Plus"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"plus-page-hint",children:"Create a Ignite OS account first, then you can buy Plus."}),s.jsx("button",{type:"button",className:"account-btn primary",onClick:a,children:"Create an account"})]})]}),s.jsxs("div",{className:"settings-page-foot",children:[s.jsx(p,{size:14}),s.jsx("span",{children:"Ignite OS"})]})]})})}export{y as PlusPage};