Streaming AI Response Card
An AI answer card that streams safe markdown with a caret, code copy, sources, tools and feedback.
Preview and code
index.html
<!--
MIT License
Copyright (c) 2026 Suraj Maurya
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-->
<div class="ar-stage">
<article class="ar">
<header class="ar-hd"><div class="ar-hl"><span class="ar-orb"></span><span class="ar-tt">Assistant</span><span class="ar-mb">Ownly AI 2.0</span></div><div class="ar-st" role="status" aria-live="polite"></div></header>
<div class="ar-ct"></div>
<div class="ar-tools"></div>
<div class="ar-src"></div>
<div class="ar-acts">
<button type="button" class="ar-ib ar-copy" aria-label="Copy response" title="Copy"></button>
<button type="button" class="ar-ib ar-re" aria-label="Regenerate response" title="Regenerate"></button>
<span class="ar-sep" aria-hidden="true"></span>
<button type="button" class="ar-ib ar-fb" data-f="like" aria-label="Good response" aria-pressed="false" title="Good response"></button>
<button type="button" class="ar-ib ar-fb dn" data-f="dislike" aria-label="Poor response" aria-pressed="false" title="Poor response"></button>
</div>
</article>
</div>
styles.css
.ar-stage{width:100%;height:calc(100vh - 40px);overflow-y:auto;padding:24px 14px;border-radius:16px;background:#000;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;scrollbar-width:thin;scrollbar-color:#262626 transparent}
.ar{width:100%;max-width:672px;margin:0 auto;padding:24px;border-radius:20px;background:#0b0b0c;color:#d4d4d4;box-shadow:0 0 0 1px rgba(255,255,255,.07),0 24px 48px -32px rgba(0,0,0,.5);-webkit-font-smoothing:antialiased}
.ar svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
.ar-hd{display:flex;align-items:center;justify-content:space-between;gap:12px}
.ar-hl{display:flex;align-items:center;gap:10px;min-width:0}
.ar-orb{flex:none;width:18px;height:18px;border-radius:50%;background:conic-gradient(from 200deg,#c7d2fe,#fbcfe8,#fde68a,#a7f3d0,#c7d2fe);box-shadow:inset 0 0 0 1px rgba(255,255,255,.45),0 1px 4px rgba(120,120,160,.35)}
.ar.busy .ar-orb{animation:ar-rot 7s linear infinite}
@keyframes ar-rot{to{transform:rotate(360deg)}}
.ar-tt{color:#f5f5f5;font-size:13px;font-weight:500;letter-spacing:-.01em}
.ar-mb{overflow:hidden;color:#737373;font-size:12px;white-space:nowrap;text-overflow:ellipsis}
.ar-st{display:flex;flex:none;align-items:center;gap:12px;color:#737373;font-size:12px}
.ar-st .live{display:flex;align-items:center;gap:6px}
.ar-st .live i{width:6px;height:6px;border-radius:50%;background:#10b981;animation:ar-pu 2s cubic-bezier(.4,0,.6,1) infinite}
@keyframes ar-pu{50%{opacity:.5}}
.ar-shim{background:linear-gradient(90deg,#737373 35%,#d4d4d4 50%,#737373 65%);background-size:250% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:ar-sh 1.8s linear infinite}
@keyframes ar-sh{from{background-position:120% 0}to{background-position:-120% 0}}
.ar-ct{display:flex;flex-direction:column;gap:16px;padding:20px 0;color:#d4d4d4;font-size:14.5px;line-height:1.7;letter-spacing:-.003em}
.ar-blk{animation:ar-in .28s cubic-bezier(.23,1,.32,1) both}
.ar-blk.still{animation:none}
@keyframes ar-in{from{opacity:0;transform:translateY(5px)}}
.ar-ct h3{margin:0;padding-top:8px;color:#fff;font-weight:600;line-height:1.35;letter-spacing:-.02em}
.ar-ct h3.l1{font-size:19px}.ar-ct h3.l2{font-size:16.5px}.ar-ct h3.l3{font-size:15px}.ar-ct h3.l4{font-size:14.5px}
.ar-ct p{margin:0;overflow-wrap:break-word}
.ar-ct strong{color:#fff;font-weight:600}
.ar-ct ul,.ar-ct ol{display:flex;flex-direction:column;gap:6px;margin:0;padding-left:20px}
.ar-ct li{padding-left:4px;overflow-wrap:break-word}.ar-ct li::marker{color:#a3a3a3}
.ar-ct blockquote{margin:0;padding-left:16px;border-left:2px solid rgba(255,255,255,.15);color:#737373}
.ar-ct hr{margin:0;border:0;border-top:1px solid rgba(255,255,255,.08)}
.ar-ic{padding:2px 6px;border-radius:6px;background:rgba(255,255,255,.03);color:#f5f5f5;font:.86em ui-monospace,SFMono-Regular,Menlo,monospace;box-shadow:0 0 0 1px rgba(255,255,255,.07)}
.ar-a{display:inline;color:#f5f5f5;font-weight:500;text-decoration:underline;text-decoration-color:#525252;text-underline-offset:3px;transition:text-decoration-color .15s;overflow-wrap:break-word}
.ar-a:hover{text-decoration-color:#d4d4d4}
.ar-a svg{display:inline-block;width:.7em;height:.7em;margin-left:2px;color:#a3a3a3;stroke-width:2;vertical-align:baseline}
.ar-blocked{text-decoration:underline dotted #a3a3a3;text-underline-offset:4px;cursor:help}
.ar-caret{display:inline-block;width:2px;height:1.05em;margin-left:3px;border-radius:999px;background:currentColor;vertical-align:-.2em;animation:ar-bl 1.1s ease-in-out infinite}
@keyframes ar-bl{50%{opacity:.15}}
.ar-cb{margin:0;overflow:hidden;border-radius:12px;background:rgba(255,255,255,.03);box-shadow:0 0 0 1px rgba(255,255,255,.07)}
.ar-cb figcaption{display:flex;align-items:center;justify-content:space-between;height:36px;padding:0 6px 0 14px}
.ar-cb figcaption span{overflow:hidden;color:#737373;font:11px ui-monospace,SFMono-Regular,Menlo,monospace;white-space:nowrap;text-overflow:ellipsis}
.ar-cbtn{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 8px;border:0;border-radius:6px;background:none;color:#737373;font:inherit;font-size:11.5px;cursor:pointer;transition:color .15s}
.ar-cbtn:hover{color:#f5f5f5}.ar-cbtn svg{width:12px;height:12px;stroke-width:1.7}
.ar-cbtn.ok{color:#10b981}
.ar-cb pre{margin:0;padding:2px 14px 14px;overflow-x:auto;color:#e5e5e5;font:12.5px/1.7 ui-monospace,SFMono-Regular,Menlo,monospace;outline:none}
.ar-tbl{overflow-x:auto;border-radius:12px;box-shadow:0 0 0 1px rgba(255,255,255,.07)}
.ar-tbl table{width:100%;min-width:320px;border-collapse:collapse;font-size:13px;text-align:left}
.ar-tbl th{padding:10px 14px;background:rgba(255,255,255,.03);color:#737373;font-size:11.5px;font-weight:500}
.ar-tbl td{padding:10px 14px;border-top:1px solid rgba(255,255,255,.06);color:#d4d4d4}
.ar-sk{display:flex;flex-direction:column;gap:10px;padding:20px 0}
.ar-sk i{height:10px;border-radius:999px;background:rgba(255,255,255,.07);animation:ar-sk 1.6s ease-in-out infinite}
.ar-sk i:nth-child(1){width:75%}.ar-sk i:nth-child(2){width:92%;animation-delay:.15s}.ar-sk i:nth-child(3){width:50%;animation-delay:.3s}
@keyframes ar-sk{0%,to{opacity:.5}50%{opacity:1}}
.ar-tg{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 10px 0 12px;border:0;border-radius:999px;background:rgba(255,255,255,.03);color:#737373;font:inherit;font-size:12.5px;cursor:pointer;box-shadow:0 0 0 1px rgba(255,255,255,.07);transition:color .15s,transform .15s}
.ar-tg:hover{color:#f5f5f5}.ar-tg:active{transform:scale(.98)}
.ar-tg svg{width:12px;height:12px;stroke-width:1.7}
.ar-chev{transition:transform .2s}.open>.ar-tg .ar-chev,.open>.ar-sb .ar-chev{transform:rotate(180deg)}
.ar-col{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows .4s cubic-bezier(.25,1,.4,1),opacity .3s}
.open>.ar-col{grid-template-rows:1fr;opacity:1}
.ar-col>ul{min-height:0;margin:0;padding:0;overflow:hidden;list-style:none}
.ar-tools{padding-top:4px}
.ar-tools li{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 4px;font-size:12.5px}
.ar-tools li span{display:flex;align-items:center;gap:10px;min-width:0;color:#d4d4d4;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.ar-tools li i{flex:none;width:6px;height:6px;border-radius:50%;background:#10b981}
.ar-tools li em{flex:none;color:#a3a3a3;font-style:normal;font-variant-numeric:tabular-nums}
.ar-src{padding-top:8px}
.ar-sb{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 8px 0 0;border:0;border-radius:8px;background:none;color:#737373;font:inherit;font-size:12.5px;cursor:pointer;transition:color .15s}
.ar-sb:hover{color:#f5f5f5}.ar-sb svg{width:14px;height:14px;stroke-width:1.7}.ar-sb b{color:#a3a3a3;font-weight:400;font-variant-numeric:tabular-nums}
.ar-sr{display:flex;align-items:flex-start;gap:12px;padding:8px 10px;border-radius:12px;color:inherit;text-decoration:none;transition:background .15s}
a.ar-sr:hover{background:rgba(255,255,255,.04)}
.ar-sr .n{flex:none;width:16px;margin-top:1px;color:#a3a3a3;font-size:11.5px;text-align:right;font-variant-numeric:tabular-nums}
.ar-sr .m{flex:1;min-width:0}
.ar-sr .t{display:flex;align-items:baseline;gap:8px}
.ar-sr .t b{overflow:hidden;color:#f5f5f5;font-size:13px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}.ar-sr .t small{flex:none;color:#a3a3a3;font-size:11.5px}
.ar-sr .s{display:block;margin-top:2px;overflow:hidden;color:#737373;font-size:12px;white-space:nowrap;text-overflow:ellipsis}
.ar-sr>svg{flex:none;width:12px;height:12px;margin-top:2px;color:#a3a3a3;stroke-width:1.7}
.ar-acts{display:flex;align-items:center;gap:2px;margin-left:-8px;padding-top:12px}
.ar-ib{display:grid;place-items:center;min-width:32px;height:32px;padding:0;border:0;border-radius:8px;background:none;color:#737373;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:color .15s,background .15s,transform .15s}
.ar-ib:hover{background:rgba(255,255,255,.06);color:#f5f5f5}.ar-ib:active{transform:scale(.94)}
.ar-ib:disabled{pointer-events:none;opacity:.3}
.ar-ib svg{width:15px;height:15px;stroke-width:1.7}
.ar-ib.on{background:rgba(255,255,255,.07);color:#fff}
.ar-fb.dn svg{transform:rotate(180deg)}
.ar-copy.ok svg{color:#10b981;stroke-width:2.2}
.ar.busy .ar-re svg{animation:ar-rot 1s linear infinite}
.ar-sep{width:1px;height:16px;margin:0 4px;background:rgba(255,255,255,.08)}
.ar button:focus-visible,.ar a:focus-visible,.ar pre:focus-visible{outline:none;box-shadow:0 0 0 2px rgba(255,255,255,.4)}
@media (max-width:520px){.ar{padding:16px}.ar-ct{font-size:14px}.ar-ib{min-width:40px;height:40px}}
@media (prefers-reduced-motion:reduce){.ar *{animation:none!important}.ar-col{transition:none}}
script.js
(function(){
var P={copy:'M9 9h10v10H9zM5 15V5h10',check:'M5 12.5l4.5 4.5L19 7.5',retry:'M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5',up:'M7 10v12M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z',ext:'M7 17 17 7M8 7h9v9',chev:'m6 9 6 6 6-6',tool:'M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2.4-.6-.6-2.4Z'};
function ic(n,c){return '<svg viewBox="0 0 24 24"'+(c?' class="'+c+'"':'')+' aria-hidden="true"><path d="'+P[n]+'"/></svg>';}
function esc(s){return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');}
var BASE='https://relative.invalid';
function safe(raw){if(!raw)return null;var v=raw.trim();if(!v||/[\u0000-\u001f\u007f]/.test(v))return null;var u;try{u=new URL(v,BASE);}catch(e){return null;}if(u.origin===BASE)return v;if(['http:','https:','mailto:'].indexOf(u.protocol)<0)return null;if(u.username||u.password)return null;return u.href;}
function host(h){try{var u=new URL(h,BASE);if(u.origin===BASE)return '';if(u.protocol==='mailto:')return 'email';return u.hostname.replace(/^www\./,'');}catch(e){return '';}}
function ext(h){try{return new URL(h,BASE).origin!==BASE;}catch(e){return false;}}
var INL=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\s][^*\n]*\*|\[[^\]\n]+\]\([^)\s]+(?:\s+"[^"]*")?\))/g;
function inl(t){var out='',last=0,m,re=new RegExp(INL.source,'g');while((m=re.exec(t))!==null){if(m.index>last)out+=esc(t.slice(last,m.index));var s=m[0];
if(s[0]==='`')out+='<code class="ar-ic">'+esc(s.slice(1,-1))+'</code>';else if(s.slice(0,2)==='**')out+='<strong>'+inl(s.slice(2,-2))+'</strong>';else if(s[0]==='*')out+='<em>'+inl(s.slice(1,-1))+'</em>';
else{var p=s.match(/^\[([^\]]+)\]\(([^)\s]+)/);if(p){var h=safe(p[2]);if(!h)out+='<span class="ar-blocked" title="Link blocked for your safety">'+inl(p[1])+'</span>';else{var x=ext(h),hs=host(h);out+='<a class="ar-a" href="'+esc(h)+'" title="'+esc(hs?hs+' — '+h:h)+'"'+(x?' target="_blank" rel="noopener noreferrer nofollow ugc" referrerpolicy="no-referrer"':'')+'>'+inl(p[1])+(x?'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="'+P.ext+'"/></svg>':'')+'</a>';}}}
last=re.lastIndex;}if(last<t.length)out+=esc(t.slice(last));return out;}
var RE={fence:/^\s*```(.*)$/,h:/^(#{1,4})\s+(.*)$/,ul:/^\s*[-*+]\s+(.*)$/,ol:/^\s*\d+[.)]\s+(.*)$/,q:/^\s*>\s?(.*)$/,hr:/^\s*([-*_])(\s*\1){2,}\s*$/,td:/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/};
function row(l){return l.trim().replace(/^\|/,'').replace(/\|$/,'').split('|').map(function(s){return s.trim();});}
function parse(raw){var L=raw.replace(/\r\n?/g,'\n').split('\n'),out=[],i=0;function sb(k){var l=L[k];return RE.fence.test(l)||RE.h.test(l)||RE.hr.test(l)||RE.ul.test(l)||RE.ol.test(l)||RE.q.test(l)||(l.indexOf('|')>=0&&k+1<L.length&&RE.td.test(L[k+1]));}
while(i<L.length){var l=L[i],f=l.match(RE.fence);if(f){var c=[];i++;while(i<L.length&&!RE.fence.test(L[i]))c.push(L[i++]);i++;out.push({t:'code',lang:f[1].trim()||'text',code:c.join('\n')});continue;}
if(l.indexOf('|')>=0&&i+1<L.length&&RE.td.test(L[i+1])){var hd=row(l),rows=[];i+=2;while(i<L.length&&L[i].indexOf('|')>=0&&L[i].trim())rows.push(row(L[i++]));out.push({t:'table',h:hd,r:rows});continue;}
var h=l.match(RE.h);if(h){out.push({t:'h',lv:h[1].length,x:h[2]});i++;continue;}
if(RE.hr.test(l)){out.push({t:'hr'});i++;continue;}
if(RE.q.test(l)){var q=[];while(i<L.length&&RE.q.test(L[i]))q.push(L[i++].match(RE.q)[1]);out.push({t:'q',x:q.join(' ')});continue;}
var isU=RE.ul.test(l);if(isU||RE.ol.test(l)){var re2=isU?RE.ul:RE.ol,it=[];while(i<L.length&&re2.test(L[i]))it.push(L[i++].match(re2)[1]);out.push({t:'list',o:!isU,it:it});continue;}
if(!l.trim()){i++;continue;}var pa=[];while(i<L.length&&L[i].trim()&&!(pa.length&&sb(i)))pa.push(L[i++]);out.push({t:'p',x:pa.join(' ')});}return out;}
var CARET='<span class="ar-caret" aria-hidden="true"></span>';
function blockHTML(b,caret){var c=caret?CARET:'';switch(b.t){case 'h':return '<h3 class="l'+b.lv+'">'+inl(b.x)+c+'</h3>';case 'p':return '<p>'+inl(b.x)+c+'</p>';
case 'code':return '<figure class="ar-cb"><figcaption><span>'+esc(b.lang)+'</span><button type="button" class="ar-cbtn">'+ic('copy')+'<span>Copy</span></button></figcaption><pre tabindex="0"><code>'+esc(b.code)+'</code></pre></figure>'+c;
case 'list':var tg=b.o?'ol':'ul';return '<'+tg+'>'+b.it.map(function(x,j){return '<li>'+inl(x)+(caret&&j===b.it.length-1?CARET:'')+'</li>';}).join('')+'</'+tg+'>';
case 'q':return '<blockquote>'+inl(b.x)+c+'</blockquote>';case 'hr':return '<hr>'+c;
case 'table':return '<div class="ar-tbl"><table><thead><tr>'+b.h.map(function(x){return '<th scope="col">'+inl(x)+'</th>';}).join('')+'</tr></thead><tbody>'+b.r.map(function(r){return '<tr>'+r.map(function(x){return '<td>'+inl(x)+'</td>';}).join('')+'</tr>';}).join('')+'</tbody></table></div>'+c;}return '';}
var DEMO='## Shipping a safer UI\nModel output is **untrusted input**, so every link is checked before it renders. Here are three links in the same sentence: [a normal one](https://ownlyplans.com/plans/), [a script link](javascript:alert(document.cookie)) and [an obfuscated one](java\tscript:alert(1)).\n\n- Only `http`, `https` and `mailto` become links\n- Credentials like `https://good.com@evil.com` are rejected\n- External links open with `noopener noreferrer nofollow`\n\n```ts\nimport { safeHref } from "./ai-response";\n\nsafeHref("javascript:alert(1)"); // null\nsafeHref("https://ownlyplans.com"); // "https://ownlyplans.com/"\n```\n\n| Scheme | Allowed |\n| --- | --- |\n| https | Yes |\n| javascript | No |\n| data | No |\n\n> Treat every URL from a model like a URL from a stranger.';
var SRC=[{t:'Ownly documentation',u:'https://ownlyplans.com/plans/',s:'Components, tokens and registry'},{t:'Blocked example',u:'javascript:alert(1)',s:'This link never renders as a link'},{t:'Web Content Accessibility Guidelines (WCAG 2.2)',u:'https://www.w3.org/WAI/standards-guidelines/wcag/',s:'Focus visible criteria, contrast ratios and reduced motion guidance.'}];
var TOOLS=[['search_docs','120ms'],['read_file','48ms'],['run_tests','1.2s']];
var reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
document.querySelectorAll('.ar').forEach(function(root){
var ct=root.querySelector('.ar-ct'),st=root.querySelector('.ar-st'),tools=root.querySelector('.ar-tools'),src=root.querySelector('.ar-src'),cp=root.querySelector('.ar-copy'),re=root.querySelector('.ar-re'),text='',status='generating',run=0,shown=0,fb=null;
cp.innerHTML=ic('copy');re.innerHTML=ic('retry');root.querySelectorAll('.ar-fb').forEach(function(b){b.innerHTML=ic('up');});
tools.innerHTML='<button type="button" class="ar-tg" aria-expanded="false">'+ic('tool')+'Used '+TOOLS.length+' tools'+ic('chev','ar-chev')+'</button><div class="ar-col"><ul>'+TOOLS.map(function(t){return '<li><span><i aria-hidden="true"></i>'+t[0]+'</span><em>'+t[1]+'</em></li>';}).join('')+'</ul></div>';
src.innerHTML='<button type="button" class="ar-sb" aria-expanded="false">'+ic('chev','ar-chev')+'Sources <b>'+SRC.length+'</b></button><div class="ar-col"><ul>'+SRC.map(function(s,i){var h=safe(s.u),hs=h?host(h):'',inner='<span class="n">'+(i+1)+'</span><span class="m"><span class="t"><b>'+esc(s.t)+'</b>'+(hs?'<small>'+hs+'</small>':'')+'</span><span class="s">'+esc(s.s)+'</span></span>'+(h&&ext(h)?ic('ext'):'');return '<li>'+(h?'<a class="ar-sr" href="'+esc(h)+'" title="'+esc(h)+'" target="_blank" rel="noopener noreferrer nofollow ugc" referrerpolicy="no-referrer">'+inner+'</a>':'<div class="ar-sr" title="Link blocked for your safety">'+inner+'</div>')+'</li>';}).join('')+'</ul></div>';
[tools,src].forEach(function(w){var b=w.querySelector('button');b.addEventListener('click',function(){var o=!w.classList.contains('open');w.classList.toggle('open',o);b.setAttribute('aria-expanded',o);});});
function header(){var busy=status==='streaming'||status==='generating';root.classList.toggle('busy',busy);re.disabled=busy;st.innerHTML=status==='streaming'?'<span class="live"><i aria-hidden="true"></i>Streaming</span>':status==='generating'?'<span class="ar-shim">Thinking</span>':'<span>Just now</span>';tools.hidden=src.hidden=busy;}
function paint(){header();if(status==='generating'&&!text){ct.className='ar-ct';ct.innerHTML='<div class="ar-sk" role="status" aria-label="Generating response"><i></i><i></i><i></i></div>';shown=0;return;}
var B=parse(text),last=B.length-1,streaming=status==='streaming',html='';
B.forEach(function(b,i){var caret=streaming&&i===last&&['code','table','hr'].indexOf(b.t)<0;html+='<div class="ar-blk'+(i<shown||reduce?' still':'')+'">'+blockHTML(b,caret)+'</div>';});
if(streaming&&B[last]&&['code','table','hr'].indexOf(B[last].t)>=0)html+=CARET;
var pre=ct.querySelectorAll('pre'),sl=[].map.call(pre,function(p){return p.scrollLeft;});ct.innerHTML=html;[].forEach.call(ct.querySelectorAll('pre'),function(p,i){if(sl[i])p.scrollLeft=sl[i];});shown=B.length;}
function start(){var id=++run;text='';status='generating';shown=0;paint();
setTimeout(function(){if(id!==run)return;status='streaming';var i=0;(function tick(){if(id!==run)return;i=Math.min(DEMO.length,i+(reduce?DEMO.length:3));text=DEMO.slice(0,i);if(i<DEMO.length){paint();setTimeout(tick,16);}else{status='complete';paint();}})();},reduce?0:900);}
function copy(t,btn,lbl){var ok=function(){btn.classList.add('ok');btn.innerHTML=ic('check')+(lbl?'<span>Copied</span>':'');if(!lbl)btn.setAttribute('aria-label','Response copied');clearTimeout(btn._t);btn._t=setTimeout(function(){btn.classList.remove('ok');btn.innerHTML=ic('copy')+(lbl?'<span>Copy</span>':'');if(!lbl)btn.setAttribute('aria-label','Copy response');},1800);};
try{if(navigator.clipboard&&isSecureContext){navigator.clipboard.writeText(t).then(ok,function(){});return;}}catch(e){}var a=document.createElement('textarea');a.value=t;a.readOnly=true;a.style.cssText='position:fixed;left:-9999px;top:0';document.body.appendChild(a);a.select();try{if(document.execCommand('copy'))ok();}catch(e){}a.remove();}
ct.addEventListener('click',function(e){var b=e.target.closest('.ar-cbtn');if(!b)return;copy(b.closest('figure').querySelector('code').textContent,b,true);});
cp.addEventListener('click',function(){copy(text,cp,false);});re.addEventListener('click',start);
root.querySelectorAll('.ar-fb').forEach(function(b){b.addEventListener('click',function(){fb=fb===b.dataset.f?null:b.dataset.f;root.querySelectorAll('.ar-fb').forEach(function(x){x.classList.toggle('on',x.dataset.f===fb);x.setAttribute('aria-pressed',x.dataset.f===fb);});});});
start();
});
})();
About
A response card for AI chat and search products. A spinning pastel orb and a shimmering Thinking label show while skeleton lines pulse, then the answer streams in block by block with a blinking caret: headings, bold and italic text, inline code, lists, a quote, a table and a code block with its own copy button. Links are checked before they render, so only http, https and mail links become real links and anything risky, like a script link, shows as plain dotted text. Below the answer you can expand the sources with numbers and hosts, see which tools were used with timings, copy the whole answer, regenerate it, and give it a thumbs up or down.


