@qikbar/qikbar 0.0.25 → 0.1.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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -0
  3. package/dist/ai/agent.d.ts +42 -0
  4. package/dist/ai/byok.d.ts +29 -0
  5. package/dist/ai/index.d.ts +8 -0
  6. package/dist/ai/providers.d.ts +82 -0
  7. package/dist/ai/sse.d.ts +9 -0
  8. package/dist/ai.js +36 -0
  9. package/dist/ai.js.map +7 -0
  10. package/dist/chunks/bar-D5CSPT3U.js +2031 -0
  11. package/dist/chunks/bar-D5CSPT3U.js.map +7 -0
  12. package/dist/chunks/chunk-2ADXL7KQ.js +358 -0
  13. package/dist/chunks/chunk-2ADXL7KQ.js.map +7 -0
  14. package/dist/chunks/chunk-6TC6G2C5.js +107 -0
  15. package/dist/chunks/chunk-6TC6G2C5.js.map +7 -0
  16. package/dist/chunks/chunk-HBBSETRF.js +153 -0
  17. package/dist/chunks/chunk-HBBSETRF.js.map +7 -0
  18. package/dist/chunks/chunk-I77YSUJN.js +104 -0
  19. package/dist/chunks/chunk-I77YSUJN.js.map +7 -0
  20. package/dist/chunks/chunk-IJ3WUM3T.js +544 -0
  21. package/dist/chunks/chunk-IJ3WUM3T.js.map +7 -0
  22. package/dist/chunks/chunk-MPTP2EWW.js +8 -0
  23. package/dist/chunks/chunk-MPTP2EWW.js.map +7 -0
  24. package/dist/chunks/chunk-N4Y2Z6YD.js +69 -0
  25. package/dist/chunks/chunk-N4Y2Z6YD.js.map +7 -0
  26. package/dist/chunks/chunk-PQEHV3D4.js +124 -0
  27. package/dist/chunks/chunk-PQEHV3D4.js.map +7 -0
  28. package/dist/chunks/chunk-VXTYD56F.js +453 -0
  29. package/dist/chunks/chunk-VXTYD56F.js.map +7 -0
  30. package/dist/chunks/chunk-YCVJQ7U3.js +52 -0
  31. package/dist/chunks/chunk-YCVJQ7U3.js.map +7 -0
  32. package/dist/core/define.d.ts +40 -0
  33. package/dist/core/frecency.d.ts +16 -0
  34. package/dist/core/hotkeys.d.ts +39 -0
  35. package/dist/core/lazy.d.ts +48 -0
  36. package/dist/core/search.d.ts +42 -0
  37. package/dist/core/storage.d.ts +5 -0
  38. package/dist/core/types.d.ts +601 -0
  39. package/dist/extensions/index.d.ts +30 -0
  40. package/dist/extensions/math.d.ts +14 -0
  41. package/dist/extensions.js +476 -0
  42. package/dist/extensions.js.map +7 -0
  43. package/dist/index.d.ts +27 -0
  44. package/dist/index.js +67 -0
  45. package/dist/index.js.map +7 -0
  46. package/dist/qikbar.global.js +259 -0
  47. package/dist/qikbar.global.js.map +7 -0
  48. package/dist/react/index.d.ts +66 -0
  49. package/dist/react.js +119 -0
  50. package/dist/react.js.map +7 -0
  51. package/dist/server/index.d.ts +47 -0
  52. package/dist/server.js +93 -0
  53. package/dist/server.js.map +7 -0
  54. package/dist/styles.css +222 -0
  55. package/dist/theme.d.ts +5 -0
  56. package/dist/theme.js +20 -0
  57. package/dist/theme.js.map +7 -0
  58. package/dist/ui/bar.d.ts +252 -0
  59. package/dist/ui/dom.d.ts +21 -0
  60. package/dist/ui/icons.d.ts +88 -0
  61. package/dist/ui/markdown.d.ts +8 -0
  62. package/dist/ui/nav.d.ts +8 -0
  63. package/dist/ui/styles.d.ts +6 -0
  64. package/dist/ui/themes.d.ts +27 -0
  65. package/dist/ui/views.d.ts +148 -0
  66. package/dist/utils.d.ts +10 -0
  67. package/dist/utils.js +50 -0
  68. package/dist/utils.js.map +7 -0
  69. package/package.json +88 -43
  70. package/dist/qikbar.es.js +0 -8748
  71. package/dist/qikbar.umd.js +0 -113
  72. package/dist/types/boot.d.ts +0 -72
  73. package/dist/types/index.d.ts +0 -1
  74. package/dist/types/init.d.ts +0 -2
  75. package/dist/types/main.d.ts +0 -4
  76. package/dist/types/shared/AsyncRoot.d.ts +0 -5
  77. package/dist/types/shared/CommandFooter.d.ts +0 -5
  78. package/dist/types/shared/Crumbs.d.ts +0 -6
  79. package/dist/types/shared/Details.d.ts +0 -3
  80. package/dist/types/shared/ErrorBoundary.d.ts +0 -15
  81. package/dist/types/shared/Icon.d.ts +0 -4
  82. package/dist/types/shared/List.d.ts +0 -30
  83. package/dist/types/shared/Qikbar.d.ts +0 -5
  84. package/dist/types/shared/Root.d.ts +0 -4
  85. package/dist/types/shared/Search.d.ts +0 -1
  86. package/dist/types/shared/commandContext.d.ts +0 -8
  87. package/dist/types/shared/useDebounce.d.ts +0 -1
  88. package/dist/types/utils/liquid.d.ts +0 -4
  89. package/dist/types/vite-env.d.ts +0 -1
@@ -0,0 +1,259 @@
1
+ "use strict";var Qikbar=(()=>{var ne=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var Vt=Object.prototype.hasOwnProperty;var Nt=(s,e,t)=>e in s?ne(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var q=(s,e,t)=>()=>{if(t)throw t[0];try{return s&&(e=s(s=0)),e}catch(i){throw t=[i],i}};var we=(s,e)=>{for(var t in e)ne(s,t,{get:e[t],enumerable:!0})},Kt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ft(e))!Vt.call(s,r)&&r!==t&&ne(s,r,{get:()=>e[r],enumerable:!(i=_t(e,r))||i.enumerable});return s};var zt=s=>Kt(ne({},"__esModule",{value:!0}),s);var m=(s,e,t)=>Nt(s,typeof e!="symbol"?e+"":e,t);function O(s){let e=We.get(s);return e||(e=s.trim().split(/\s+/).map(t=>{let i=t.toLowerCase().split("+");t.endsWith("++")&&i.splice(i.length-2,2,"+");let r={key:"",meta:!1,ctrl:!1,alt:!1,shift:!1};for(let n of i)n==="mod"?C?r.meta=!0:r.ctrl=!0:n==="cmd"||n==="meta"||n==="command"?r.meta=!0:n==="ctrl"||n==="control"?r.ctrl=!0:n==="alt"||n==="option"||n==="opt"?r.alt=!0:n==="shift"?r.shift=!0:r.key=jt[n]??n;return r}),We.set(s,e),e)}function Dt(s){let e=s.code;return e?.startsWith("Key")?e.slice(3).toLowerCase():e?.startsWith("Digit")?e.slice(5):(s.key??"").toLowerCase()}function Ge(s,e){if(s.metaKey!==e.meta||s.ctrlKey!==e.ctrl||s.altKey!==e.alt)return!1;let t=Dt(s);return e.shift!==s.shiftKey&&!(e.key.length===1&&!/[a-z0-9]/.test(e.key))?!1:t===e.key||(s.key??"").toLowerCase()===e.key}function E(s,e){let t=O(e);return t.length===1&&Ge(s,t[0])}function $(s){return O(s).map(e=>{let t=C?Bt:Ut,i=[];return C?(e.ctrl&&i.push(t.ctrl),e.alt&&i.push(t.alt),e.shift&&i.push(t.shift),e.meta&&i.push(t.meta)):(e.ctrl&&i.push(t.ctrl),e.meta&&i.push(t.meta),e.alt&&i.push(t.alt),e.shift&&i.push(t.shift)),i.push(t[e.key]??(e.key.length===1?e.key.toUpperCase():Qt(e.key))),i})}function Qt(s){return s.charAt(0).toUpperCase()+s.slice(1)}function j(s){let e=s;if(!e||!e.tagName)return!1;let t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}function U(s){let e=O(s);return e.length===1&&(e[0].meta||e[0].ctrl||e[0].alt)}var C,jt,We,Bt,Ut,z,H=q(()=>{"use strict";C=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.userAgentData?.platform??navigator.platform??navigator.userAgent),jt={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",del:"delete",plus:"+"},We=new Map;Bt={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7",enter:"\u21B5",escape:"esc",backspace:"\u232B",delete:"\u2326",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",tab:"\u21E5"," ":"Space"},Ut={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift",enter:"\u21B5",escape:"Esc",backspace:"\u232B",delete:"Del",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",tab:"Tab"," ":"Space"};z=class{constructor(e=900){m(this,"timeout",e);m(this,"buffer",[]);m(this,"timer")}feed(e,t){if(["Shift","Meta","Control","Alt"].includes(e.key))return[];this.buffer.push(e),this.buffer.length>4&&this.buffer.shift(),clearTimeout(this.timer),this.timer=setTimeout(()=>this.buffer=[],this.timeout);let i=[];for(let r of t){let n=O(r);if(n.length>this.buffer.length)continue;let o=this.buffer.slice(-n.length);n.every((a,c)=>Ge(o[c],a))&&i.push(r)}return i.length&&(this.buffer=[]),i}reset(){this.buffer=[],clearTimeout(this.timer)}}});function Je(s){return{...s,type:"list"}}function Ye(s){return{...s,type:"grid"}}function Xe(s){return{...s,type:"detail"}}function Ze(s){return{...s,type:"form"}}function et(s={}){return{...s,type:"chat"}}function ke(s){return s}function tt(s){return s}function it(s){return s}function rt(s){return s}var M,oe=q(()=>{"use strict";M={copy(s,e={}){return{title:"Copy to Clipboard",icon:"copy",shortcut:"mod+c",...e,async run(t){let i=await t.copy(typeof s=="function"?s():s);t.toast({title:i?"Copied to clipboard":"Copy failed",style:i?"success":"failure"})}}},open(s,e={}){return{title:"Open in Browser",icon:"external",...e,run:t=>t.openUrl(s)}},navigate(s,e={}){return{title:"Open",icon:"arrow-right",...e,run:t=>t.navigate(s)}},navigateNewTab(s,e={}){return{title:"Open in New Tab",icon:"external",shortcut:"mod+enter",...e,run:t=>t.navigate(s,{newTab:!0})}},push(s,e,t={}){return{title:s,icon:"chevron-right",...t,run:i=>typeof e=="function"?e(i):e}},ask(s,e={}){return{title:"Ask AI",icon:"sparkles",shortcut:"mod+j",...e,run:()=>({type:"chat",prompt:s})}}}});function ae(){let s=new Map;return{getItem:e=>s.get(e)??null,setItem:(e,t)=>{s.set(e,t)},removeItem:e=>{s.delete(e)}}}function P(){try{let s=globalThis.localStorage,e="__qikbar__";return s.setItem(e,"1"),s.removeItem(e),s}catch{return ae()}}function Q(s,e){return{get(t){try{let i=s.getItem(`${e}:${t}`);return i==null?void 0:JSON.parse(i)}catch{return}},set(t,i){try{i===void 0?s.removeItem(`${e}:${t}`):s.setItem(`${e}:${t}`,JSON.stringify(i))}catch{}},remove(t){try{s.removeItem(`${e}:${t}`)}catch{}}}}var W=q(()=>{"use strict"});function dt(s,e){async function*t(i,r={}){for await(let n of s.stream({messages:[{role:"user",content:i}],system:r.system??e,signal:r.signal}))if(n.type==="text")yield n.text;else if(n.type==="error")throw new Error(n.error)}return{provider:s,stream:t,async ask(i,r){let n="";for await(let o of t(i,r))n+=o;return n}}}function Xt(s){if(s===void 0)return"Done.";if(typeof s=="string")return s;try{return JSON.stringify(s)}catch{return String(s)}}async function*ht(s){let{provider:e,system:t,signal:i}=s,r=e.tools===!1?[]:s.tools??[],n=[...s.messages],o=s.maxSteps??6;for(let a=0;a<o;a++){let c=[],l,h="";for await(let d of e.stream({messages:[...n],system:t,tools:r.length&&a<o-1?r.map(p=>p.definition):void 0,signal:i}))d.type==="text"?(h+=d.text,yield d):d.type==="tool_call"?c.push(d.call):d.type==="error"?yield d:d.type==="done"&&(l=d.message);if(l??(l={role:"assistant",content:h,toolCalls:c.length?c:void 0}),n.push(l),yield{type:"message",message:l},!c.length||i.aborted)return;for(let d of c){let p=r.find(y=>y.definition.name===d.name),g=p?.label?.(d.args)??d.name;yield{type:"tool_start",call:d,label:g};let f,b=!1;if(d.error)f=d.error,b=!0;else if(!p)f=`Unknown tool "${d.name}".`,b=!0;else try{f=Xt(await p.run(d.args,i))}catch(y){f=y instanceof Error?y.message:String(y),b=!0}f.length>ct&&(f=`${f.slice(0,ct)}\u2026 (truncated)`);let v={role:"tool",toolCallId:d.id,toolName:d.name,content:f,...b?{isError:b}:{}};if(n.push(v),yield{type:"message",message:v},yield{type:"tool_end",call:d,ok:!b,result:f},i.aborted)return}}}var ct,pt=q(()=>{"use strict";ct=12e3});var D,Ce=q(()=>{"use strict";D=class{constructor(e){m(this,"storage",e);m(this,"entries");this.entries=e.get("frecency")??{}}record(e){let t=this.entries[e]??{c:0,t:0};t.c++,t.t=Date.now(),this.entries[e]=t;let i=Object.keys(this.entries);if(i.length>200){i.sort((r,n)=>this.entries[r].t-this.entries[n].t);for(let r of i.slice(0,i.length-200))delete this.entries[r]}this.storage.set("frecency",this.entries)}score(e){let t=this.entries[e];if(!t)return 0;let i=Math.pow(.5,(Date.now()-t.t)/2592e5),r=Math.log2(1+t.c)*i;return r/(1+r)}top(e){return Object.keys(this.entries).map(t=>[t,this.score(t)]).filter(([,t])=>t>.02).sort((t,i)=>i[1]-t[1]).slice(0,e).map(([t])=>t)}clear(){this.entries={},this.storage.remove("frecency")}}});function T(s){let e=s.toLowerCase();if(!/[^\u0000-\u007f]/.test(e))return e;let t=e.normalize("NFD").replace(/[̀-ͯ]/g,"");return t.length===e.length?t:e}function X(s,e){if(e===0)return 14;let t=s[e-1];if(Zt.has(t))return 10;let i=s[e];return t!==t.toUpperCase()&&i!==i.toLowerCase()?8:/[0-9]/.test(i)&&!/[0-9]/.test(t)?10/2:0}function Le(s,e,t){let i=0,r=-2,n=0;for(let o=0;o<t.length;o++){let a=t[o],c=16+X(e,a);if(a===r+1)n++,c+=6+Math.min(n,3);else if(n=0,o>0){let l=a-r-1;c-=3+1*Math.min(l-1,12)}e[a]===s[o]&&(c+=1),i+=c,r=a}return i}function F(s,e,t=T(e)){let i=s.length,r=t.length;if(i===0)return{score:0,positions:[]};if(i>r)return null;if(t===s)return{score:1,positions:Array.from({length:i},(f,b)=>b)};let n=0,o=-1;for(let f=0;f<r;f++)if(t[f]===s[n]&&(n++,n===i)){o=f;break}if(o<0)return null;n=i-1;let a=o;for(let f=o;f>=0;f--)if(t[f]===s[n]&&(n--,n<0)){a=f;break}let c=ut(s,e,t,a),l=c?Le(s,e,c):-1/0,h=0;for(let f=0;f<r-i+1&&h<4;f++){if(f===a||t[f]!==s[0]||X(e,f)===0)continue;h++;let b=ut(s,e,t,f);if(!b)continue;let v=Le(s,e,b);v>l&&(l=v,c=b)}if(!c)return null;let d=t.indexOf(s);for(let f=0;d>=0&&f<4;f++){let b=Array.from({length:i},(y,x)=>d+x),v=Le(s,e,b);v>l&&(l=v,c=b),d=t.indexOf(s,d+1)}let p=Math.min((r-i)*.15,6),g=(l-p)/(i*37);for(let f=0;f<c.length;f++){let b=c[f];(f===0||b!==c[f-1]+1)&&X(e,b)===0&&(g*=.72)}return g=Math.max(.01,Math.min(.99,g)),{score:g,positions:c}}function ut(s,e,t,i){let r=s.length,n=[],o=0;for(let a=i;a<t.length&&o<r;a++)if(t[a]===s[o]){if(o>0&&X(e,a)===0&&a!==n[n.length-1]+1){let c=ei(t,e,s,o,a+1);c>=0&&(a=c)}n.push(a),o++}return o===r?n:null}function ei(s,e,t,i,r){let n=t[i],o=t.length-i;for(let a=r;a<=s.length-o;a++)if(s[a]===n&&X(e,a)>0){let c=i+1;for(let l=a+1;l<s.length&&c<t.length;l++)s[l]===t[c]&&c++;return c===t.length?a:-1}return-1}function Re(s){let e=0;for(let t=0;t<s.length;t++){let i=s.charCodeAt(t);i>=97&&i<=122?e|=1<<i-97:i>=48&&i<=57&&(e|=1<<26)}return e}function ti(s){let e=ft.get(s);return(!e||e.title!==s.title)&&(e={mask:0,title:s.title,titleNorm:T(s.title),subtitle:s.subtitle?T(s.subtitle):"",keywords:s.keywords?s.keywords.map(T):[],section:s.section?T(s.section):"",description:s.description?T(s.description):""},e.mask=Re(`${e.titleNorm} ${e.subtitle} ${e.keywords.join(" ")} ${e.section} ${e.description}`),ft.set(s,e)),e}function Z(s,e){let t=T(e.trim());return t?mt(s,t,t.split(/\s+/).filter(Boolean),Re(t)):{score:0,positions:[]}}function mt(s,e,t,i){let r=ti(s);if((i&r.mask)!==i)return null;let n=F(e,r.title,r.titleNorm),o=0,a=new Set,c=!0;if(t.length>1||!n){for(let d of t){let p=0,g=F(d,r.title,r.titleNorm);if(g){p=g.score;for(let f of g.positions)a.add(f)}for(let f of r.keywords){let b=F(d,f,f);b&&b.score*.88>p&&(p=b.score*.88)}if(r.subtitle){let f=F(d,r.subtitle,r.subtitle);f&&f.score*.7>p&&(p=f.score*.7)}if(r.section){let f=F(d,r.section,r.section);f&&f.score*.5>p&&(p=f.score*.5)}if(p===0&&r.description&&d.length>2&&r.description.includes(d)&&(p=.3),p===0){c=!1;break}o+=p}o/=t.length}let l=0,h=[];if(n&&n.score>=o)l=n.score,h=n.positions;else if(c&&o>0)l=o*.95,h=[...a].sort((d,p)=>d-p);else if(n)l=n.score,h=n.positions;else return null;return r.titleNorm.startsWith(e)&&(l=Math.min(.995,l+.15)),{score:l,positions:h}}function L(s,e,t={}){let{boost:i,limit:r,threshold:n=.05}=t,o=[],a=T(e.trim()),c=a.split(/\s+/).filter(Boolean),l=Re(a);for(let g of s){let f=a?mt(g,a,c,l):{score:0,positions:[]};if(!f||a&&f.score<n)continue;let b=f.score+(g.priority??0)*.1;i&&(b+=i(g)),o.push({item:g,score:b,positions:f.positions})}let h=o.map((g,f)=>[g,f]);h.sort((g,f)=>f[0].score-g[0].score||g[1]-f[1]);let d=h.map(g=>g[0]),p=d[0]?.score??0;return a.length>=3&&p>=.6&&(d=d.filter(g=>g.score>=p*.55)),r?d.slice(0,r):d}var Zt,ft,Oe=q(()=>{"use strict";Zt=new Set([" ","-","_",".","/",":","\\","(","[","{",",","@","#",'"',"'",">","|","+","&"]);ft=new WeakMap});function ce(s,e=16){let t=$e[s];if(t)return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}var $e,He=q(()=>{"use strict";$e={search:'<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',command:'<path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',"arrow-left":'<path d="M19 12H5"/><path d="m12 19-7-7 7-7"/>',"arrow-up-right":'<path d="M7 17 17 7"/><path d="M7 7h10v10"/>',"chevron-right":'<path d="m9 18 6-6-6-6"/>',"chevron-left":'<path d="m15 18-6-6 6-6"/>',"chevron-down":'<path d="m6 9 6 6 6-6"/>',"corner-down-left":'<path d="M20 4v7a4 4 0 0 1-4 4H4"/><path d="m9 10-5 5 5 5"/>',external:'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',link:'<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',copy:'<rect x="8" y="8" width="14" height="14" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',check:'<path d="M20 6 9 17l-5-5"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',plus:'<path d="M5 12h14"/><path d="M12 5v14"/>',minus:'<path d="M5 12h14"/>',home:'<path d="m3 10 9-7 9 7v10a2 2 0 0 1-2 2h-4v-7H9v7H5a2 2 0 0 1-2-2z"/>',settings:'<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M20 21a8 8 0 0 0-16 0"/>',users:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',file:'<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z"/><path d="M14 2v6h6"/>',"file-text":'<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z"/><path d="M14 2v6h6"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',book:'<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/>',bookmark:'<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"/>',star:'<path d="m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z"/>',heart:'<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"/>',clock:'<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',calendar:'<rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4"/><path d="M8 2v4"/><path d="M3 10h18"/>',calculator:'<rect x="4" y="2" width="16" height="20" rx="2"/><path d="M8 6h8"/><path d="M16 14v4"/><path d="M16 10h.01"/><path d="M12 10h.01"/><path d="M8 10h.01"/><path d="M12 14h.01"/><path d="M8 14h.01"/><path d="M12 18h.01"/><path d="M8 18h.01"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',moon:'<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>',monitor:'<rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>',palette:'<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.56-2.5 5.56-5.55C21.97 6.01 17.46 2 12 2z"/>',sparkles:'<path d="M9.94 15.5A2 2 0 0 0 8.5 14.06l-6.14-1.58a.5.5 0 0 1 0-.96L8.5 9.94A2 2 0 0 0 9.94 8.5l1.58-6.14a.5.5 0 0 1 .96 0L14.06 8.5A2 2 0 0 0 15.5 9.94l6.14 1.58a.5.5 0 0 1 0 .96L15.5 14.06a2 2 0 0 0-1.44 1.44l-1.58 6.14a.5.5 0 0 1-.96 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/>',bot:'<path d="M12 8V4H8"/><rect x="4" y="8" width="16" height="12" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/>',message:'<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',send:'<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>',mail:'<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>',bell:'<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>',"credit-card":'<rect x="2" y="5" width="20" height="14" rx="2"/><path d="M2 10h20"/>',key:'<circle cx="7.5" cy="15.5" r="5.5"/><path d="m21 2-9.6 9.6"/><path d="m15.5 7.5 3 3L22 7l-3-3"/>',lock:'<rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',"log-out":'<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>',pencil:'<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/>',eye:'<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>',refresh:'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',filter:'<path d="M22 3H2l8 9.46V19l4 2v-8.54z"/>',globe:'<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',code:'<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',terminal:'<path d="m4 17 6-6-6-6"/><path d="M12 19h8"/>',hash:'<path d="M4 9h16"/><path d="M4 15h16"/><path d="M10 3 8 21"/><path d="M16 3l-2 18"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',layers:'<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>',grid:'<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/>',list:'<path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>',"git-branch":'<path d="M6 3v12"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',package:'<path d="m7.5 4.27 9 5.15"/><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',puzzle:'<path d="M19.44 7.85c-.05.38.09.76.36 1.02l1.57 1.57c.47.47.7 1.08.7 1.7s-.23 1.23-.7 1.7l-1.61 1.61a.98.98 0 0 1-.84.28c-.47-.07-.8-.48-.97-.92a2.5 2.5 0 1 0-3.21 3.21c.44.17.85.5.92.97a.98.98 0 0 1-.28.84l-1.61 1.61c-.47.47-1.08.7-1.7.7s-1.23-.23-1.7-.7l-1.57-1.57a1.2 1.2 0 0 0-1.02-.36c-.47.07-.8.48-.97.92a2.5 2.5 0 1 1-3.21-3.21c.44-.17.85-.5.92-.97a1.2 1.2 0 0 0-.36-1.02L2.7 13.7A2.4 2.4 0 0 1 2 12c0-.62.24-1.23.7-1.7l1.57-1.57c.26-.27.64-.4 1.02-.36.47.07.8.48.97.92a2.5 2.5 0 1 0 3.21-3.21c-.44-.17-.85-.5-.92-.97a1.2 1.2 0 0 1 .36-1.02L10.3 2.7c.47-.47 1.08-.7 1.7-.7s1.23.23 1.7.7l1.57 1.57c.26.27.64.4 1.02.36.47-.07.8-.48.97-.92a2.5 2.5 0 1 1 3.21 3.21c-.44.17-.85.5-.92.97Z"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',alert:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',"check-circle":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"x-circle":'<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/>',loader:'<path d="M21 12a9 9 0 1 1-6.22-8.56"/>',circle:'<circle cx="12" cy="12" r="9"/>',dot:'<circle cx="12" cy="12" r="4" fill="currentColor"/>',"more-horizontal":'<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',"layout-dashboard":'<rect x="3" y="3" width="7" height="9" rx="1"/><rect x="14" y="3" width="7" height="5" rx="1"/><rect x="14" y="12" width="7" height="9" rx="1"/><rect x="3" y="16" width="7" height="5" rx="1"/>',"bar-chart":'<path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',inbox:'<path d="M22 12h-6l-2 3h-4l-2-3H2"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',tag:'<path d="M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>',languages:'<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>',wand:'<path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"/><path d="m14 7 3 3"/><path d="M5 6v4"/><path d="M19 14v4"/><path d="M10 2v2"/><path d="M7 8H3"/><path d="M21 16h-4"/><path d="M11 3H9"/>',keyboard:'<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M6 8h.01"/><path d="M10 8h.01"/><path d="M14 8h.01"/><path d="M18 8h.01"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/><path d="M7 16h10"/>',github:'<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"/><path d="M9 18c-4.51 2-5-2-7-2"/>'}});function u(s,e,...t){let i=document.createElement(s);if(e)for(let r in e){let n=e[r];n==null||n===!1||(r==="class"?i.className=n:r==="style"&&typeof n=="object"?Object.assign(i.style,n):r.startsWith("on")&&typeof n=="function"?i.addEventListener(r.slice(2).toLowerCase(),n):r==="html"?i.innerHTML=n:r in i&&typeof n!="string"?i[r]=n:i.setAttribute(r,n===!0?"":String(n)))}return bt(i,t),i}function bt(s,e){for(let t of e)Array.isArray(t)?bt(s,t):t!=null&&t!==!1&&s.append(t instanceof Node?t:String(t))}function k(s,e=16){if(s==null||s==="")return null;let t=u("span",{class:"qb-icon","aria-hidden":"true"});if(typeof s=="function")t.append(s());else if(typeof Node<"u"&&s instanceof Node)t.append(s.cloneNode(!0));else if(typeof s=="object"&&"url"in s)t.append(u("img",{src:s.url,alt:s.alt??"",loading:"lazy",decoding:"async",draggable:"false"}));else if(typeof s=="object"&&"color"in s){t.classList.add("qb-icon-tinted"),t.style.setProperty("--qb-tint",yt(s.color));let i=k(s.icon??"dot",e);i&&t.append(...i.childNodes)}else if(typeof s=="string"){let i=ce(s,e);i?t.innerHTML=i:s.trimStart().startsWith("<svg")?t.innerHTML=s:ii.test(s)?t.append(u("img",{src:s,alt:"",loading:"lazy",decoding:"async",draggable:"false"})):(t.classList.add("qb-icon-text"),t.textContent=s)}return t}function R(s,e="qb-kbd"){let t=u("span",{class:"qb-kbds","aria-label":s});return $(s).forEach((i,r)=>{r>0&&t.append(u("span",{class:"qb-kbd-then"},"then"));for(let n of i)t.append(u("kbd",{class:e},n))}),t}function Pe(s,e){if(!e||e.length===0)return s;let t=document.createDocumentFragment(),i=0,r=0;for(;r<e.length;){let n=e[r],o=n;for(;r+1<e.length&&e[r+1]===o+1;)r++,o++;n>i&&t.append(s.slice(i,n)),t.append(u("mark",{class:"qb-match"},s.slice(n,o+1))),i=o+1,r++}return i<s.length&&t.append(s.slice(i)),t}function yt(s){return s?gt[s]??s:gt.default}function _e(s){let e=typeof s=="string"?s:s.value,t=typeof s=="string"?void 0:s.color,i=u("span",{class:"qb-tag"},e);return t&&i.style.setProperty("--qb-tint",yt(t)),i}function ri(s){let e=new Date(s),t=(e.getTime()-Date.now())/1e3,i=Math.abs(t);return V?i<60?V.format(Math.round(t),"second"):i<3600?V.format(Math.round(t/60),"minute"):i<86400?V.format(Math.round(t/3600),"hour"):i<86400*30?V.format(Math.round(t/86400),"day"):i<86400*365?V.format(Math.round(t/(86400*30)),"month"):V.format(Math.round(t/(86400*365)),"year"):e.toLocaleDateString()}function vt(s){let e=u("span",{class:"qb-accessory",title:s.tooltip}),t=k(s.icon,14);return t&&e.append(t),s.tag&&e.append(_e(s.tag)),s.text&&e.append(u("span",null,s.text)),s.date!=null&&e.append(u("time",{datetime:new Date(s.date).toISOString()},ri(s.date))),s.kbd&&e.append(R(s.kbd)),e}function xt(s="qb"){return`${s}-${(++ni).toString(36)}`}var ii,gt,V,ni,Fe=q(()=>{"use strict";H();He();ii=/^(https?:|\/|\.\.?\/|data:image\/|blob:)/;gt={default:"var(--qb-fg-muted)",gray:"var(--qb-fg-subtle)",blue:"#3b82f6",green:"#22c55e",yellow:"#eab308",orange:"#f97316",red:"#ef4444",purple:"#a855f7",pink:"#ec4899"};V=typeof Intl<"u"&&"RelativeTimeFormat"in Intl?new Intl.RelativeTimeFormat(void 0,{numeric:"auto",style:"short"}):null;ni=0});async function N(s){try{return await navigator.clipboard.writeText(s),!0}catch{try{let e=document.createElement("textarea");e.value=s,e.setAttribute("readonly",""),e.style.cssText="position:fixed;top:-1000px;opacity:0",document.body.append(e),e.select();let t=document.execCommand("copy");return e.remove(),t}catch{return!1}}}function ee(s,e){if(e){window.open(s,"_blank","noopener");return}let t=[...document.querySelectorAll("a[href]")].find(r=>r.getAttribute("href")===s&&!r.closest(".qb-root")&&(!r.target||r.target==="_self")&&!r.hasAttribute("download"));if(t){t.click();return}let i=document.createElement("a");i.href=s,i.style.display="none",document.body.append(i),i.click(),i.remove()}var de=q(()=>{"use strict"});function K(s){return`--qb-${s.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function ue(s,e){let t=typeof s=="string"?{preset:s}:s??{},i=t.preset?Ve[t.preset]:void 0,r=i?.only??(t.preset==="light"?"light":t.preset==="dark"?"dark":e);return{vars:{...r==="dark"?i?.dark:i?.light,...t.vars,...r==="dark"?t.dark:t.light},appearance:r}}function wt(s,e=".qb-root"){let t=Object.entries(s).filter(([,i])=>i!=null&&i!=="").map(([i,r])=>` ${K(i)}: ${r};`).join(`
2
+ `);return`${e} {
3
+ ${t}
4
+ }`}var he,pe,Ve,fe=q(()=>{"use strict";he={font:'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontMono:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',fontSize:"14px",bg:"rgba(255, 255, 255, 0.92)",bgElevated:"#ffffff",fg:"#18181b",fgMuted:"#52525b",fgSubtle:"#a1a1aa",border:"rgba(0, 0, 0, 0.08)",selection:"rgba(0, 0, 0, 0.055)",selectionFg:"#09090b",hover:"rgba(0, 0, 0, 0.03)",accent:"#6d5dfc",accentFg:"#ffffff",highlight:"#6d5dfc",overlay:"rgba(24, 24, 27, 0.18)",backdropBlur:"20px",shadow:"0 0 0 1px rgba(0,0,0,.04), 0 24px 64px -12px rgba(0,0,0,.25), 0 8px 24px -8px rgba(0,0,0,.12)",radius:"14px",radiusItem:"8px",width:"680px",listHeight:"380px",rowHeight:"42px",sectionHeight:"30px",inputHeight:"56px",inputFontSize:"16px",top:"14vh",kbdBg:"rgba(0, 0, 0, 0.06)",kbdFg:"#52525b",danger:"#e5484d",success:"#30a46c",warning:"#f5a524"},pe={bg:"rgba(28, 28, 31, 0.9)",bgElevated:"#232327",fg:"#f4f4f5",fgMuted:"#a1a1aa",fgSubtle:"#71717a",border:"rgba(255, 255, 255, 0.09)",selection:"rgba(255, 255, 255, 0.075)",selectionFg:"#ffffff",hover:"rgba(255, 255, 255, 0.04)",accent:"#8b7dff",accentFg:"#ffffff",highlight:"#a99fff",overlay:"rgba(0, 0, 0, 0.45)",shadow:"0 0 0 1px rgba(255,255,255,.04), 0 24px 64px -12px rgba(0,0,0,.6), 0 8px 24px -8px rgba(0,0,0,.4)",kbdBg:"rgba(255, 255, 255, 0.08)",kbdFg:"#a1a1aa",danger:"#ff6369",success:"#3dd68c",warning:"#ffc53d"},Ve={light:{name:"light",label:"Light",only:"light"},dark:{name:"dark",label:"Dark",only:"dark"},raycast:{name:"raycast",label:"Raycast",light:{accent:"#ff6363",highlight:"#ff6363",bg:"rgba(250,250,250,.86)",radius:"12px",width:"750px",rowHeight:"40px"},dark:{accent:"#ff6363",highlight:"#ff6363",bg:"rgba(30, 30, 30, .82)",bgElevated:"#2a2a2a",selection:"rgba(255,255,255,.1)",border:"rgba(255,255,255,.1)",radius:"12px",width:"750px",rowHeight:"40px"}},linear:{name:"linear",label:"Linear",light:{accent:"#5e6ad2",highlight:"#5e6ad2",bg:"#ffffff",selection:"#f2f2f5",radius:"10px",fontSize:"13px",inputFontSize:"15px",rowHeight:"40px"},dark:{accent:"#5e6ad2",highlight:"#8d95f2",bg:"rgba(25, 26, 35, .96)",bgElevated:"#22232e",fg:"#eeeffc",fgMuted:"#9ea0b4",fgSubtle:"#6b6f85",selection:"rgba(255,255,255,.06)",border:"rgba(255,255,255,.07)",radius:"10px",fontSize:"13px",inputFontSize:"15px",rowHeight:"40px"}},vercel:{name:"vercel",label:"Vercel",light:{accent:"#000000",accentFg:"#fff",highlight:"#000",bg:"#ffffff",selection:"#f2f2f2",radius:"12px",fontSize:"14px",border:"#eaeaea"},dark:{accent:"#ffffff",accentFg:"#000",highlight:"#fff",bg:"#0a0a0a",bgElevated:"#111",fg:"#ededed",fgMuted:"#a1a1a1",fgSubtle:"#6e6e6e",selection:"#1f1f1f",border:"#262626",radius:"12px"}},github:{name:"github",label:"GitHub",light:{accent:"#0969da",highlight:"#0969da",bg:"#ffffff",selection:"#f6f8fa",fg:"#1f2328",fgMuted:"#59636e",border:"#d1d9e0",radius:"12px",radiusItem:"6px"},dark:{accent:"#4493f8",highlight:"#4493f8",bg:"#151b23",bgElevated:"#212830",fg:"#f0f6fc",fgMuted:"#9198a1",fgSubtle:"#656c76",selection:"#262c36",border:"#3d444d",radius:"12px",radiusItem:"6px"}},nord:{name:"nord",label:"Nord",light:{accent:"#5e81ac",highlight:"#5e81ac",bg:"#eceff4",bgElevated:"#e5e9f0",fg:"#2e3440",fgMuted:"#4c566a",selection:"#d8dee9",border:"#d8dee9"},dark:{accent:"#88c0d0",accentFg:"#2e3440",highlight:"#88c0d0",bg:"#2e3440",bgElevated:"#3b4252",fg:"#eceff4",fgMuted:"#d8dee9",fgSubtle:"#7b88a1",selection:"#3b4252",border:"#434c5e",kbdBg:"#434c5e",kbdFg:"#d8dee9"}},dracula:{name:"dracula",label:"Dracula",only:"dark",dark:{accent:"#bd93f9",accentFg:"#282a36",highlight:"#ff79c6",bg:"#282a36",bgElevated:"#343746",fg:"#f8f8f2",fgMuted:"#c1c4d6",fgSubtle:"#6272a4",selection:"#44475a",border:"#44475a",kbdBg:"#44475a",kbdFg:"#f8f8f2",success:"#50fa7b",danger:"#ff5555",warning:"#f1fa8c"}},catppuccin:{name:"catppuccin",label:"Catppuccin",light:{accent:"#8839ef",highlight:"#8839ef",bg:"#eff1f5",bgElevated:"#e6e9ef",fg:"#4c4f69",fgMuted:"#6c6f85",fgSubtle:"#9ca0b0",selection:"#ccd0da",border:"#ccd0da"},dark:{accent:"#cba6f7",accentFg:"#1e1e2e",highlight:"#f5c2e7",bg:"#1e1e2e",bgElevated:"#313244",fg:"#cdd6f4",fgMuted:"#a6adc8",fgSubtle:"#6c7086",selection:"#313244",border:"#45475a",kbdBg:"#313244",kbdFg:"#bac2de"}},"tokyo-night":{name:"tokyo-night",label:"Tokyo Night",only:"dark",dark:{accent:"#7aa2f7",accentFg:"#1a1b26",highlight:"#bb9af7",bg:"#1a1b26",bgElevated:"#24283b",fg:"#c0caf5",fgMuted:"#a9b1d6",fgSubtle:"#565f89",selection:"#292e42",border:"#2f344d",kbdBg:"#292e42",kbdFg:"#a9b1d6"}},"rose-pine":{name:"rose-pine",label:"Ros\xE9 Pine",light:{accent:"#907aa9",highlight:"#d7827e",bg:"#faf4ed",bgElevated:"#fffaf3",fg:"#575279",fgMuted:"#797593",fgSubtle:"#9893a5",selection:"#f2e9e1",border:"#dfdad9"},dark:{accent:"#c4a7e7",accentFg:"#191724",highlight:"#ebbcba",bg:"#191724",bgElevated:"#1f1d2e",fg:"#e0def4",fgMuted:"#908caa",fgSubtle:"#6e6a86",selection:"#26233a",border:"#26233a",kbdBg:"#26233a",kbdFg:"#908caa"}},solarized:{name:"solarized",label:"Solarized",light:{accent:"#268bd2",highlight:"#cb4b16",bg:"#fdf6e3",bgElevated:"#eee8d5",fg:"#586e75",fgMuted:"#657b83",fgSubtle:"#93a1a1",selection:"#eee8d5",border:"#e4ddc8"},dark:{accent:"#268bd2",highlight:"#b58900",bg:"#002b36",bgElevated:"#073642",fg:"#93a1a1",fgMuted:"#839496",fgSubtle:"#586e75",selection:"#073642",border:"#0a4352",kbdBg:"#073642",kbdFg:"#93a1a1"}},midnight:{name:"midnight",label:"Midnight",only:"dark",dark:{accent:"#22d3ee",accentFg:"#020617",highlight:"#67e8f9",bg:"rgba(2, 6, 23, .88)",bgElevated:"#0f172a",fg:"#e2e8f0",fgMuted:"#94a3b8",fgSubtle:"#475569",selection:"rgba(34, 211, 238, .1)",selectionFg:"#a5f3fc",border:"rgba(148, 163, 184, .14)",radius:"18px",radiusItem:"10px"}},paper:{name:"paper",label:"Paper",only:"light",light:{font:'ui-serif, Georgia, Cambria, "Times New Roman", serif',accent:"#1a1a1a",highlight:"#b4441f",bg:"#fbfaf7",bgElevated:"#ffffff",fg:"#1a1a1a",fgMuted:"#5c5a55",fgSubtle:"#9b978f",selection:"#f0ede6",border:"#e7e3da",radius:"4px",radiusItem:"2px",shadow:"0 1px 0 rgba(0,0,0,.04), 0 18px 40px -16px rgba(60,40,10,.25)"}}}});var kt,me,Ne=q(()=>{"use strict";fe();kt=s=>Object.entries(s).map(([e,t])=>`${K(e)}:${t};`).join(""),me=`
5
+ .qb-root{${kt(he)}--qb-z:2147483000;--qb-ease:cubic-bezier(.16,1,.3,1);font-family:var(--qb-font);font-size:var(--qb-font-size);line-height:1.45;color:var(--qb-fg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:start;color-scheme:light}
6
+ .qb-root[data-qb-appearance=dark]{${kt(pe)}color-scheme:dark}
7
+ :where(.qb-root) *,:where(.qb-root) *::before,:where(.qb-root) *::after{box-sizing:border-box}
8
+ :where(.qb-root) :where(button,input,textarea,select){font:inherit;color:inherit;margin:0;letter-spacing:inherit}
9
+ :where(.qb-root) button{background:none;border:0;padding:0;cursor:pointer;text-transform:none}
10
+ :where(.qb-root) svg{display:block;flex-shrink:0}
11
+ .qb-root [hidden]{display:none!important}
12
+ .qb-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
13
+
14
+ .qb-overlay{position:fixed;inset:0;z-index:var(--qb-z);background:var(--qb-overlay);animation:qb-fade .18s ease-out}
15
+ .qb-dialog{position:fixed;z-index:calc(var(--qb-z) + 1);top:var(--qb-top);left:50%;translate:-50% 0;width:min(var(--qb-width),calc(100vw - 24px));display:flex;flex-direction:column;background:var(--qb-bg);border:1px solid var(--qb-border);border-radius:var(--qb-radius);box-shadow:var(--qb-shadow);overflow:hidden;-webkit-backdrop-filter:blur(var(--qb-backdrop-blur)) saturate(1.8);backdrop-filter:blur(var(--qb-backdrop-blur)) saturate(1.8);animation:qb-in .22s var(--qb-ease);transform-origin:50% 0;outline:none}
16
+ .qb-root[data-qb-state=closing] .qb-dialog{animation:qb-out .12s ease-in forwards}
17
+ .qb-root[data-qb-state=closing] .qb-overlay{animation:qb-fade-out .12s ease-in forwards}
18
+ .qb-root[data-qb-inline]{display:block;position:relative}
19
+ .qb-root[data-qb-inline] .qb-dialog{position:relative;top:auto;left:auto;translate:none;width:100%;z-index:auto;animation:none}
20
+
21
+ .qb-header{position:relative;display:flex;align-items:center;gap:10px;height:var(--qb-input-height);padding:0 16px;border-bottom:1px solid var(--qb-border);flex-shrink:0}
22
+ .qb-header-icon{color:var(--qb-fg-subtle);display:flex}
23
+ .qb-input{flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;font-size:var(--qb-input-font-size);padding:0;caret-color:var(--qb-accent)}
24
+ .qb-input::placeholder{color:var(--qb-fg-subtle);opacity:1}
25
+ .qb-input::-webkit-search-cancel-button{display:none}
26
+ .qb-back{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:7px;background:var(--qb-kbd-bg);color:var(--qb-fg-muted);flex-shrink:0;transition:background .1s}
27
+ .qb-back:hover{color:var(--qb-fg)}
28
+ .qb-crumb{display:flex;align-items:center;gap:6px;max-width:40%;padding:3px 9px 3px 7px;border-radius:7px;background:var(--qb-kbd-bg);color:var(--qb-fg-muted);font-size:12.5px;font-weight:500;white-space:nowrap;flex-shrink:0}
29
+ .qb-crumb span:last-child{overflow:hidden;text-overflow:ellipsis}
30
+ .qb-title{flex:1;font-size:var(--qb-input-font-size);font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
31
+ .qb-hint{display:flex;align-items:center;gap:6px;color:var(--qb-fg-subtle);font-size:12px;white-space:nowrap;flex-shrink:0;cursor:pointer;border-radius:6px;padding:3px 4px 3px 7px}
32
+ .qb-hint:hover{color:var(--qb-fg-muted);background:var(--qb-hover)}
33
+ .qb-arg-cmd{display:flex;align-items:center;gap:7px;font-weight:500;white-space:nowrap;flex-shrink:0}
34
+ .qb-arg{height:30px;width:150px;min-width:80px;flex-shrink:1;border:1px solid var(--qb-border);border-radius:7px;padding:0 9px;background:var(--qb-hover);outline:none}
35
+ .qb-arg:focus{border-color:var(--qb-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--qb-accent) 22%,transparent)}
36
+ select.qb-arg{padding-right:4px}
37
+
38
+ .qb-progress{position:absolute;left:0;right:0;bottom:-1px;height:1px;overflow:hidden;pointer-events:none;opacity:0;transition:opacity .2s}
39
+ .qb-progress[data-active]{opacity:1}
40
+ .qb-progress::after{content:"";position:absolute;top:0;bottom:0;width:35%;background:linear-gradient(90deg,transparent,var(--qb-accent),transparent);animation:qb-slide 1.1s ease-in-out infinite}
41
+
42
+ .qb-body{position:relative;display:flex;height:min(var(--qb-list-height),calc(100vh - var(--qb-top) - 130px));min-height:120px;overflow:hidden}
43
+ .qb-root[data-qb-inline] .qb-body{height:var(--qb-list-height)}
44
+ .qb-scroll{flex:1;min-width:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--qb-fg) 18%,transparent) transparent;outline:none}
45
+ .qb-list{padding:6px 8px 8px;scroll-padding:8px 0}
46
+ .qb-list-inner{position:relative}
47
+ .qb-section{display:flex;align-items:flex-end;height:var(--qb-section-height);padding:0 10px 6px;color:var(--qb-fg-subtle);font-size:11.5px;font-weight:600;letter-spacing:.01em;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
48
+ .qb-item{position:relative;display:flex;align-items:center;gap:11px;height:var(--qb-row-height);padding:0 10px;border-radius:var(--qb-radius-item);cursor:pointer;user-select:none;-webkit-user-select:none;scroll-margin:8px}
49
+ .qb-item[aria-selected=true]{background:var(--qb-selection);color:var(--qb-selection-fg)}
50
+ .qb-item[aria-selected=true]::before{content:"";position:absolute;left:0;top:25%;bottom:25%;width:2px;border-radius:2px;background:var(--qb-accent);opacity:var(--qb-indicator,0)}
51
+ .qb-item-icon{display:flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;color:var(--qb-fg-muted)}
52
+ .qb-item[aria-selected=true] .qb-item-icon{color:inherit}
53
+ .qb-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;line-height:1}
54
+ .qb-icon img{width:18px;height:18px;border-radius:4px;object-fit:cover}
55
+ .qb-icon-text{font-size:15px;width:20px}
56
+ .qb-icon-tinted{color:var(--qb-tint)}
57
+ .qb-item-text{display:flex;align-items:baseline;gap:8px;flex:1;min-width:0;overflow:hidden;white-space:nowrap}
58
+ .qb-item-title{overflow:hidden;text-overflow:ellipsis;flex-shrink:0;max-width:100%}
59
+ .qb-item-subtitle{color:var(--qb-fg-subtle);font-size:.93em;overflow:hidden;text-overflow:ellipsis;min-width:0}
60
+ .qb-item-accessories{display:flex;align-items:center;gap:12px;color:var(--qb-fg-subtle);font-size:12.5px;flex-shrink:0;margin-left:auto}
61
+ .qb-item-kind{color:var(--qb-fg-subtle);font-size:12.5px;flex-shrink:0;opacity:0}
62
+ .qb-item[aria-selected=true] .qb-item-kind{opacity:1}
63
+ .qb-accessory{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
64
+ .qb-match{background:none;color:var(--qb-highlight);font-weight:600}
65
+ .qb-tag{display:inline-flex;align-items:center;height:19px;padding:0 7px;border-radius:999px;font-size:11.5px;font-weight:500;color:var(--qb-tint,var(--qb-fg-muted));background:color-mix(in srgb,var(--qb-tint,var(--qb-fg-muted)) 15%,transparent)}
66
+ .qb-kbds{display:inline-flex;align-items:center;gap:3px}
67
+ .qb-kbd{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border-radius:5px;background:var(--qb-kbd-bg);color:var(--qb-kbd-fg);font:500 11.5px/1 var(--qb-font);box-shadow:inset 0 -1px 0 color-mix(in srgb,var(--qb-fg) 8%,transparent)}
68
+ .qb-kbd-then{font-size:11px;color:var(--qb-fg-subtle);padding:0 2px}
69
+
70
+ .qb-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:24px;text-align:center;color:var(--qb-fg-muted)}
71
+ .qb-empty .qb-icon{color:var(--qb-fg-subtle);margin-bottom:6px}
72
+ .qb-empty-title{color:var(--qb-fg);font-weight:500}
73
+ .qb-empty-desc{font-size:13px;max-width:360px}
74
+ .qb-empty .qb-kbds{margin:0 2px}
75
+
76
+ .qb-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;height:42px;padding:0 8px 0 14px;border-top:1px solid var(--qb-border);color:var(--qb-fg-muted);font-size:12.5px;flex-shrink:0}
77
+ .qb-footer-left{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden;white-space:nowrap}
78
+ .qb-footer-left>span:last-child{overflow:hidden;text-overflow:ellipsis}
79
+ .qb-footer-right{display:flex;align-items:center;gap:4px;flex-shrink:0}
80
+ .qb-footer-btn{display:inline-flex;align-items:center;gap:7px;height:28px;padding:0 6px 0 8px;border-radius:7px;white-space:nowrap;transition:background .1s}
81
+ .qb-footer-btn:hover{background:var(--qb-hover)}
82
+ .qb-footer-btn.qb-primary{color:var(--qb-fg);font-weight:500}
83
+ .qb-footer-sep{width:1px;height:14px;background:var(--qb-border);margin:0 2px}
84
+ .qb-toast{display:flex;align-items:center;gap:7px;min-width:0}
85
+ .qb-toast-title{color:var(--qb-fg);font-weight:500}
86
+ .qb-toast[data-style=success] .qb-icon{color:var(--qb-success)}
87
+ .qb-toast[data-style=failure] .qb-icon{color:var(--qb-danger)}
88
+ .qb-toast[data-style=loading] .qb-icon{color:var(--qb-fg-muted)}
89
+ .qb-toast[data-style=info] .qb-icon{color:var(--qb-accent)}
90
+ .qb-brand{color:var(--qb-fg-subtle);text-decoration:none;display:inline-flex;align-items:center;gap:6px}
91
+ .qb-brand:hover{color:var(--qb-fg-muted)}
92
+
93
+ .qb-actions{position:absolute;right:8px;bottom:48px;z-index:3;width:min(330px,calc(100% - 16px));max-height:min(380px,calc(100% - 64px));display:flex;flex-direction:column;background:var(--qb-bg-elevated);border:1px solid var(--qb-border);border-radius:12px;box-shadow:0 16px 48px -8px rgba(0,0,0,.35),0 0 0 1px rgba(0,0,0,.02);overflow:hidden;animation:qb-pop .14s var(--qb-ease);transform-origin:100% 100%}
94
+ .qb-actions-title{padding:9px 14px 4px;color:var(--qb-fg-subtle);font-size:11.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
95
+ .qb-actions-list{overflow-y:auto;padding:4px 6px 6px;scrollbar-width:thin}
96
+ .qb-actions .qb-section{height:26px;padding-bottom:4px}
97
+ .qb-action{display:flex;align-items:center;gap:10px;height:34px;padding:0 8px;border-radius:7px;cursor:pointer;user-select:none;white-space:nowrap}
98
+ .qb-action[aria-selected=true]{background:var(--qb-selection);color:var(--qb-selection-fg)}
99
+ .qb-action[data-style=destructive]{color:var(--qb-danger)}
100
+ .qb-action .qb-icon{width:18px;color:var(--qb-fg-muted)}
101
+ .qb-action[data-style=destructive] .qb-icon{color:inherit}
102
+ .qb-action-title{flex:1;overflow:hidden;text-overflow:ellipsis}
103
+ .qb-actions-input{border:0;border-top:1px solid var(--qb-border);background:transparent;outline:none;height:38px;padding:0 14px;font-size:13px}
104
+ .qb-actions-input::placeholder{color:var(--qb-fg-subtle)}
105
+
106
+ .qb-detail{flex:1;min-width:0;overflow-y:auto;padding:18px 22px 22px;scrollbar-width:thin}
107
+ .qb-detail:focus,.qb-chat:focus,.qb-form:focus,.qb-dialog:focus{outline:none}
108
+ .qb-split .qb-list{flex:0 0 42%;border-right:1px solid var(--qb-border)}
109
+ .qb-split .qb-item-accessories,.qb-split .qb-item-kind{display:none}
110
+ .qb-split .qb-detail{padding:14px 18px}
111
+ .qb-meta{flex:0 0 34%;border-left:1px solid var(--qb-border);padding:14px 16px;overflow-y:auto;display:flex;flex-direction:column;gap:12px;font-size:13px}
112
+ .qb-meta-label{color:var(--qb-fg-subtle);font-size:12px;margin-bottom:2px}
113
+ .qb-meta-value{display:flex;align-items:center;gap:6px;flex-wrap:wrap;word-break:break-word}
114
+ .qb-meta a{color:var(--qb-accent);text-decoration:none}
115
+
116
+ .qb-md{font-size:14px;line-height:1.65;word-wrap:break-word;color:var(--qb-fg)}
117
+ .qb-md>*:first-child{margin-top:0}
118
+ .qb-md>*:last-child{margin-bottom:0}
119
+ .qb-md p,.qb-md ul,.qb-md ol,.qb-md blockquote,.qb-md .qb-code,.qb-md .qb-table{margin:0 0 .8em}
120
+ .qb-md h1,.qb-md h2,.qb-md h3,.qb-md h4{margin:1.2em 0 .5em;line-height:1.3;font-weight:650}
121
+ .qb-md h1{font-size:1.45em}.qb-md h2{font-size:1.25em}.qb-md h3{font-size:1.08em}.qb-md h4{font-size:1em}
122
+ .qb-md ul,.qb-md ol{padding-left:1.4em}
123
+ .qb-md li{margin:.2em 0}
124
+ .qb-md li>ul,.qb-md li>ol{margin:.2em 0}
125
+ .qb-md a{color:var(--qb-accent);text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--qb-accent) 40%,transparent);text-underline-offset:2px}
126
+ .qb-md code{font-family:var(--qb-font-mono);font-size:.88em;padding:.12em .38em;border-radius:5px;background:color-mix(in srgb,var(--qb-fg) 7%,transparent)}
127
+ .qb-md .qb-code{border:1px solid var(--qb-border);border-radius:10px;overflow:hidden;background:color-mix(in srgb,var(--qb-fg) 3.5%,transparent)}
128
+ .qb-md .qb-code-head{display:flex;justify-content:space-between;align-items:center;padding:5px 8px 5px 12px;font-size:11.5px;color:var(--qb-fg-subtle);border-bottom:1px solid var(--qb-border)}
129
+ .qb-md .qb-code-copy{font-size:11.5px;padding:2px 7px;border-radius:5px;color:var(--qb-fg-muted)}
130
+ .qb-md .qb-code-copy:hover{background:var(--qb-hover);color:var(--qb-fg)}
131
+ .qb-md pre{margin:0;padding:12px 14px;overflow-x:auto;font-size:12.5px;line-height:1.55}
132
+ .qb-md pre code{padding:0;background:none;font-size:inherit}
133
+ .qb-md blockquote{padding:.1em 0 .1em 1em;border-left:3px solid var(--qb-border);color:var(--qb-fg-muted)}
134
+ .qb-md hr{border:0;border-top:1px solid var(--qb-border);margin:1.2em 0}
135
+ .qb-md img{max-width:100%;border-radius:8px}
136
+ .qb-md .qb-table{overflow-x:auto}
137
+ .qb-md table{border-collapse:collapse;width:100%;font-size:13px}
138
+ .qb-md th,.qb-md td{border-bottom:1px solid var(--qb-border);padding:6px 10px;text-align:left}
139
+ .qb-md th{font-weight:600;color:var(--qb-fg-muted)}
140
+ .qb-md input[type=checkbox]{margin:0 .3em 0 0;vertical-align:-.1em;accent-color:var(--qb-accent)}
141
+
142
+ .qb-form{flex:1;overflow-y:auto;padding:20px 26px;display:grid;grid-template-columns:minmax(90px,30%) 1fr;gap:14px 16px;align-content:start;scrollbar-width:thin}
143
+ .qb-form-label{padding-top:7px;text-align:right;color:var(--qb-fg-muted);font-size:13px}
144
+ .qb-form-label[data-required]::after{content:" *";color:var(--qb-fg-subtle)}
145
+ .qb-field{display:flex;flex-direction:column;gap:5px;min-width:0}
146
+ .qb-field-input{width:100%;height:34px;padding:0 10px;border:1px solid var(--qb-border);border-radius:8px;background:color-mix(in srgb,var(--qb-fg) 3%,transparent);outline:none;transition:border-color .1s,box-shadow .1s}
147
+ textarea.qb-field-input{height:auto;min-height:96px;padding:8px 10px;resize:vertical;line-height:1.5}
148
+ .qb-field-input:focus{border-color:var(--qb-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--qb-accent) 22%,transparent)}
149
+ .qb-field-input[aria-invalid=true]{border-color:var(--qb-danger)}
150
+ .qb-field-check{display:flex;align-items:center;gap:8px;height:34px}
151
+ .qb-field-check input{width:16px;height:16px;accent-color:var(--qb-accent)}
152
+ .qb-field-desc{font-size:12px;color:var(--qb-fg-subtle)}
153
+ .qb-field-error{font-size:12px;color:var(--qb-danger)}
154
+
155
+ .qb-grid{flex:1;overflow-y:auto;padding:8px 12px 12px;display:grid;grid-template-columns:repeat(var(--qb-columns,5),minmax(0,1fr));gap:8px;align-content:start;scrollbar-width:thin}
156
+ .qb-grid .qb-section{grid-column:1/-1}
157
+ .qb-cell{display:flex;flex-direction:column;gap:6px;padding:4px;border-radius:12px;cursor:pointer;min-width:0;user-select:none}
158
+ .qb-cell-media{position:relative;aspect-ratio:var(--qb-aspect,1);display:flex;align-items:center;justify-content:center;border-radius:9px;background:var(--qb-hover);overflow:hidden;outline:2px solid transparent;outline-offset:1px;transition:outline-color .1s;font-size:32px;color:var(--qb-fg-muted)}
159
+ .qb-cell-media img{width:100%;height:100%;object-fit:var(--qb-fit,cover)}
160
+ .qb-cell-media .qb-icon svg{width:28px;height:28px}
161
+ .qb-cell-media .qb-icon-text{font-size:inherit;width:auto}
162
+ .qb-cell-media .qb-icon img{width:44%;height:44%;border-radius:8px}
163
+ .qb-cell[aria-selected=true] .qb-cell-media{outline-color:var(--qb-accent)}
164
+ .qb-cell-title{font-size:12.5px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 2px}
165
+ .qb-cell-subtitle{font-size:11.5px;color:var(--qb-fg-subtle);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 2px;margin-top:-4px}
166
+
167
+ .qb-chat{flex:1;overflow-y:auto;padding:18px 22px 22px;display:flex;flex-direction:column;gap:16px;scrollbar-width:thin}
168
+ .qb-msg-user{align-self:flex-end;max-width:85%;padding:8px 13px;border-radius:14px 14px 4px 14px;background:var(--qb-selection);white-space:pre-wrap;word-wrap:break-word}
169
+ .qb-msg-ai{display:flex;flex-direction:column;gap:8px;min-width:0}
170
+ .qb-msg-ai .qb-md:empty{display:none}
171
+ .qb-msg-head{display:flex;align-items:center;gap:7px;color:var(--qb-fg-subtle);font-size:12px;font-weight:500}
172
+ .qb-msg-head .qb-icon{color:var(--qb-accent)}
173
+ .qb-tools{display:flex;flex-wrap:wrap;gap:6px}
174
+ .qb-tool{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:3px 9px 3px 7px;border:1px solid var(--qb-border);border-radius:999px;font-size:12px;color:var(--qb-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
175
+ .qb-tool[data-state=done] .qb-icon{color:var(--qb-success)}
176
+ .qb-tool[data-state=error] .qb-icon{color:var(--qb-danger)}
177
+ .qb-msg-error{color:var(--qb-danger);font-size:13px}
178
+ .qb-caret{display:inline-block;width:7px;height:1em;margin-left:2px;vertical-align:-.15em;background:var(--qb-accent);border-radius:1px;animation:qb-blink 1s steps(2) infinite}
179
+ .qb-chat-empty{margin:auto;text-align:center;color:var(--qb-fg-muted);display:flex;flex-direction:column;align-items:center;gap:10px;max-width:420px}
180
+ .qb-chat-empty .qb-icon{color:var(--qb-accent)}
181
+ .qb-suggestions{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin-top:4px}
182
+ .qb-suggestion{padding:5px 11px;border:1px solid var(--qb-border);border-radius:999px;font-size:12.5px;color:var(--qb-fg-muted);transition:background .1s,color .1s}
183
+ .qb-suggestion:hover{background:var(--qb-hover);color:var(--qb-fg)}
184
+
185
+ .qb-spin svg{animation:qb-rot .7s linear infinite}
186
+
187
+ .qb-confirm-layer{position:absolute;inset:0;z-index:4;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--qb-bg) 55%,transparent);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);animation:qb-fade .12s}
188
+ .qb-confirm{width:min(340px,calc(100% - 32px));padding:20px;border:1px solid var(--qb-border);border-radius:14px;background:var(--qb-bg-elevated);box-shadow:0 20px 50px -10px rgba(0,0,0,.4);text-align:center;animation:qb-pop .16s var(--qb-ease)}
189
+ .qb-confirm-title{font-weight:600;font-size:15px}
190
+ .qb-confirm-msg{margin-top:6px;color:var(--qb-fg-muted);font-size:13px}
191
+ .qb-confirm-buttons{display:flex;gap:8px;margin-top:18px}
192
+ .qb-btn{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:8px;height:34px;padding:0 12px;border-radius:8px;border:1px solid var(--qb-border);font-weight:500;transition:filter .1s,background .1s}
193
+ .qb-btn:not(.qb-btn-primary,.qb-btn-danger):hover{background:var(--qb-hover)}
194
+ .qb-btn:focus-visible{outline:2px solid var(--qb-accent);outline-offset:1px}
195
+ .qb-btn-primary{background:var(--qb-accent);color:var(--qb-accent-fg);border-color:transparent}
196
+ .qb-btn-primary:hover,.qb-btn-danger:hover{filter:brightness(1.08)}
197
+ .qb-btn-danger{background:var(--qb-danger);color:#fff;border-color:transparent}
198
+
199
+ .qb-hud{position:fixed;left:50%;bottom:32px;translate:-50% 0;z-index:calc(var(--qb-z) + 2);display:flex;align-items:center;gap:8px;max-width:calc(100vw - 32px);padding:9px 16px 9px 12px;border:1px solid var(--qb-border);border-radius:999px;background:var(--qb-bg-elevated);color:var(--qb-fg);box-shadow:0 12px 32px -8px rgba(0,0,0,.3);font-size:13px;animation:qb-hud .22s var(--qb-ease);pointer-events:none}
200
+ .qb-hud .qb-toast-msg{color:var(--qb-fg-muted)}
201
+
202
+ @keyframes qb-fade{from{opacity:0}}
203
+ @keyframes qb-fade-out{to{opacity:0}}
204
+ @keyframes qb-in{from{opacity:0;scale:.97;translate:-50% -6px}}
205
+ @keyframes qb-out{to{opacity:0;scale:.98}}
206
+ @keyframes qb-pop{from{opacity:0;scale:.96}}
207
+ @keyframes qb-hud{from{opacity:0;translate:-50% 10px}}
208
+ @keyframes qb-slide{from{left:-35%}to{left:100%}}
209
+ @keyframes qb-rot{to{rotate:360deg}}
210
+ @keyframes qb-blink{50%{opacity:0}}
211
+ .qb-root[data-qb-inline] .qb-dialog{animation:none}
212
+
213
+ @media (max-width:640px){
214
+ .qb-dialog{top:8px;width:calc(100vw - 16px)}
215
+ .qb-body{height:min(var(--qb-list-height),58vh)}
216
+ .qb-footer-left,.qb-hint{display:none}
217
+ .qb-footer{justify-content:flex-end}
218
+ .qb-form{grid-template-columns:1fr}
219
+ .qb-form-label{text-align:left;padding:0}
220
+ .qb-meta,.qb-split .qb-detail{display:none}
221
+ .qb-split .qb-list{flex:1;border:0}
222
+ }
223
+ @media (prefers-reduced-motion:reduce){
224
+ .qb-root *,.qb-root *::before,.qb-root *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition:none!important}
225
+ .qb-progress::after{animation:qb-slide 1.6s linear infinite!important}
226
+ }
227
+ `});function I(s){return s.replace(/[&<>"']/g,e=>si[e])}function qt(s){let e=s.trim();return/^(https?:|mailto:|tel:|#|\/|\.\.?\/)/i.test(e)||/^data:image\/(png|jpe?g|gif|webp|avif);/i.test(e)||!/^[a-z][a-z0-9+.-]*:/i.test(e)?e:null}function B(s){let e=[],t=s.replace(/(`+)([\s\S]*?[^`])\1(?!`)/g,(i,r,n)=>(e.push(`<code>${I(n.trim())}</code>`),`\0${e.length-1}\0`));return t=I(t),t=t.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+&quot;([^&]*)&quot;)?\)/g,(i,r,n)=>{let o=qt(Mt(n));return o?`<img src="${I(o)}" alt="${r}" loading="lazy">`:i}),t=t.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+&quot;([^&]*)&quot;)?\)/g,(i,r,n)=>{let o=qt(Mt(n));if(!o)return r;let a=/^https?:/i.test(o);return`<a href="${I(o)}"${a?' target="_blank" rel="noopener noreferrer"':""}>${r}</a>`}),t=t.replace(/(^|[\s(])(https?:\/\/[^\s<)]+[^\s<).,;:!?'"])/g,(i,r,n)=>`${r}<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`),t=t.replace(/\*\*([^*]+)\*\*|__([^_]+)__/g,(i,r,n)=>`<strong>${r??n}</strong>`),t=t.replace(/(^|[^*\w])\*([^*\s][^*]*?)\*(?!\w)/g,"$1<em>$2</em>"),t=t.replace(/(^|[^_\w])_([^_\s][^_]*?)_(?!\w)/g,"$1<em>$2</em>"),t=t.replace(/~~([^~]+)~~/g,"<del>$1</del>"),t=t.replace(/ {2,}\n|\\\n/g,"<br>"),t.replace(/\u0000(\d+)\u0000/g,(i,r)=>e[Number(r)])}function Mt(s){return s.replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">")}function S(s){let e=s.replace(/\r\n?/g,`
228
+ `).split(`
229
+ `),t=[],i=[],r=[],n=0,o=()=>{i.length&&(t.push(`<p>${B(i.join(`
230
+ `))}</p>`),i=[])},a=(c=-1)=>{for(;r.length&&r[r.length-1].indent>c;)t.push(`</li></${r.pop().type}>`)};for(;n<e.length;){let c=e[n],l=c.match(/^\s*(```+|~~~+)\s*([\w+#.-]*)/);if(l){o(),a();let p=l[1],g=l[2]??"",f=[];for(n++;n<e.length&&!e[n].trim().startsWith(p);)f.push(e[n++]);n++,t.push(`<div class="qb-code"><div class="qb-code-head"><span>${I(g)}</span><button type="button" class="qb-code-copy" data-qb-copy>Copy</button></div><pre><code${g?` class="language-${I(g)}"`:""}>${I(f.join(`
231
+ `))}</code></pre></div>`);continue}if(!c.trim()){o();let p=e[n+1]??"";!/^\s*([-*+]|\d+[.)])\s+/.test(p)&&!/^\s{2,}\S/.test(p)&&a(),n++;continue}let h=c.match(/^(#{1,6})\s+(.*?)\s*#*\s*$/);if(h){o(),a();let p=h[1].length;t.push(`<h${p}>${B(h[2])}</h${p}>`),n++;continue}if(/^\s*([-*_])(\s*\1){2,}\s*$/.test(c)){o(),a(),t.push("<hr>"),n++;continue}if(/^\s*>/.test(c)){o(),a();let p=[];for(;n<e.length&&/^\s*>/.test(e[n]);)p.push(e[n++].replace(/^\s*>\s?/,""));t.push(`<blockquote>${S(p.join(`
232
+ `))}</blockquote>`);continue}if(c.includes("|")&&/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/.test(e[n+1]??"")){o(),a();let p=y=>y.trim().replace(/^\||\|$/g,"").split("|").map(x=>x.trim()),g=p(c),f=p(e[n+1]).map(y=>y.startsWith(":")&&y.endsWith(":")?"center":y.endsWith(":")?"right":"");n+=2;let b=[];for(;n<e.length&&e[n].includes("|")&&e[n].trim();)b.push(p(e[n++]));let v=(y,x,A)=>`<${y}${f[A]?` style="text-align:${f[A]}"`:""}>${B(x)}</${y}>`;t.push(`<div class="qb-table"><table><thead><tr>${g.map((y,x)=>v("th",y,x)).join("")}</tr></thead><tbody>${b.map(y=>`<tr>${y.map((x,A)=>v("td",x,A)).join("")}</tr>`).join("")}</tbody></table></div>`);continue}let d=c.match(/^(\s*)([-*+]|\d+[.)])\s+(.*)$/);if(d){o();let p=d[1].length,g=/\d/.test(d[2])?"ol":"ul",f=r[r.length-1];if(!f||p>f.indent){let x=g==="ol"&&parseInt(d[2],10)!==1?` start="${parseInt(d[2],10)}"`:"";t.push(`<${g}${x}><li>`),r.push({type:g,indent:p})}else{a(p);let x=r[r.length-1];x&&x.type!==g?(t.push(`</li></${r.pop().type}><${g}><li>`),r.push({type:g,indent:p})):x?t.push("</li><li>"):(t.push(`<${g}><li>`),r.push({type:g,indent:p}))}let b=d[3],v=b.match(/^\[([ xX])\]\s+(.*)$/);v?b=`<input type="checkbox" disabled${v[1]!==" "?" checked":""}> ${B(v[2])}`:b=B(b),n++;let y=[];for(;n<e.length&&/^\s{2,}\S/.test(e[n])&&!/^\s*([-*+]|\d+[.)])\s+/.test(e[n]);)y.push(e[n++].trim());t.push(b+(y.length?` ${B(y.join(`
233
+ `))}`:""));continue}a(),i.push(c),n++}return o(),a(),t.join("")}var si,Ke=q(()=>{"use strict";si={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}});function Tt(s,e){let t=parseFloat(s);return Number.isFinite(t)&&t>0?t:e}function je(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function At(s,e){let t=0,i=s.length-1;for(;t<i;){let r=t+i+1>>1;s[r]<=e?t=r:i=r-1}return t}var oi,Et,It,ze,te,ge,be,ye,ve,St=q(()=>{"use strict";de();Fe();Ke();oi=150,Et=10,It=(s,e)=>`${s.instanceId}-opt-${e.replace(/[^\w-]/g,"_")}`;ze=new WeakMap,te=class{constructor(e,t){m(this,"bar",e);m(this,"frame",t);m(this,"el");m(this,"hasInput",!0);m(this,"scroller");m(this,"inner");m(this,"emptyEl");m(this,"detailEl");m(this,"cache",new Map);m(this,"renderedKeys",[]);m(this,"selectedEl");m(this,"virtual",!1);m(this,"offsets",[]);m(this,"rowHeight",42);m(this,"sectionHeight",30);m(this,"rafId",0);m(this,"detailFor");m(this,"onScroll",()=>{!this.virtual||this.rafId||(this.rafId=requestAnimationFrame(()=>{this.rafId=0,this.renderWindow()}))});m(this,"onPointerMove",e=>{let t=e.target.closest?.("[data-index]");if(!t)return;let i=Number(t.dataset.index);i!==this.frame.selected&&this.select(i,!1)});m(this,"onClick",e=>{let t=e.target.closest?.("[data-index]");t&&(this.select(Number(t.dataset.index),!1),this.bar.runPrimary(this.frame,e.metaKey||e.ctrlKey?1:0))});this.inner=u("div",{class:"qb-list-inner"}),this.scroller=u("div",{class:`${e.cls("qb-scroll qb-list","list")}`,role:"listbox",id:`${e.instanceId}-list`,"aria-label":"Results",tabindex:"-1"},this.inner),this.emptyEl=u("div",{class:"qb-empty",hidden:!0}),t.view.type==="list"&&t.view.detail?(this.detailEl=u("div",{class:e.cls("qb-detail qb-md","detail")}),this.el=u("div",{class:"qb-split",style:"display:flex;flex:1;min-width:0;position:relative"},this.scroller,this.detailEl,this.emptyEl)):this.el=u("div",{style:"display:flex;flex:1;min-width:0;position:relative"},this.scroller,this.emptyEl),this.scroller.addEventListener("pointermove",this.onPointerMove),this.scroller.addEventListener("click",this.onClick),this.scroller.addEventListener("pointerdown",r=>r.preventDefault()),this.scroller.addEventListener("scroll",this.onScroll,{passive:!0})}measure(){let e=getComputedStyle(this.bar.dom.root);this.rowHeight=Tt(e.getPropertyValue("--qb-row-height"),42),this.sectionHeight=Tt(e.getPropertyValue("--qb-section-height"),30)}update(){let e=this.frame.rows,t=this.virtual;if(this.virtual=e.length>oi,this.virtual){t||this.measure();let i=0;this.offsets=e.map(r=>{let n=i;return i+=r.kind==="section"?this.sectionHeight:this.rowHeight,n}),this.inner.style.height=`${i}px`,this.renderWindow()}else{if(t){this.inner.style.height="";for(let{el:n}of this.cache.values())n.style.cssText=""}let i=e.map(n=>n.key),r=e.map(n=>this.rowEl(n));(!je(i,this.renderedKeys)||r.some((n,o)=>this.inner.children[o]!==n))&&(this.inner.replaceChildren(...r),this.renderedKeys=i),this.prune(new Set(i))}this.updateSelection(),this.updateEmpty(),this.updateDetail()}prune(e){if(!(this.cache.size<400))for(let t of this.cache.keys())e.has(t)||this.cache.delete(t)}renderWindow(){let e=this.frame.rows,t=this.scroller.scrollTop,i=this.scroller.clientHeight||400,r=At(this.offsets,t)-Et;r=Math.max(0,r);let n=At(this.offsets,t+i)+Et;n=Math.min(e.length,n+1);let o=[],a=[];for(let c=r;c<n;c++){let l=e[c],h=this.rowEl(l);h.style.position="absolute",h.style.top=`${this.offsets[c]}px`,h.style.left="0",h.style.right="0",o.push(h),a.push(l.key)}je(a,this.renderedKeys)||(this.inner.replaceChildren(...o),this.renderedKeys=a),this.updateSelection()}rowSig(e){return e.kind==="section"?e.title:`${e.index}|${e.positions?.join(",")??""}`}rowEl(e){let t=this.rowSig(e),i=this.cache.get(e.key);if(i&&i.sig===t&&(e.kind==="section"||i.el.__item===e.item))return i.el;let r=e.kind==="section"?this.sectionEl(e.title):this.itemEl(e);return e.kind==="item"&&(r.__item=e.item),this.cache.set(e.key,{el:r,sig:t}),r}sectionEl(e){return u("div",{class:this.bar.cls("qb-section","section"),role:"presentation"},e)}itemEl(e){let{item:t}=e,i=this.frame.view.type==="root",r=[];return t.accessories?.length?r.push(u("span",{class:"qb-item-accessories"},...t.accessories.map(vt))):t.shortcut&&r.push(u("span",{class:"qb-item-accessories"},R(t.shortcut))),i&&!t.accessories?.length&&!t.shortcut&&r.push(u("span",{class:"qb-item-kind"},this.kindOf(t))),u("div",{class:this.bar.cls("qb-item","item"),role:"option",id:It(this.bar,e.key),"aria-selected":"false","data-index":String(e.index)},u("span",{class:"qb-item-icon"},k(t.icon??(i?"command":void 0),16)),u("span",{class:"qb-item-text"},u("span",{class:"qb-item-title"},Pe(t.title,e.positions)),t.subtitle?u("span",{class:"qb-item-subtitle"},t.subtitle):null),...r)}kindOf(e){return this.bar.itemExt.get(e)?"Command":e.href?"Page":e.url?"Link":"Command"}updateSelection(){let e=this.frame.itemRows[this.frame.selected],t=e?this.cache.get(e.key)?.el:void 0;this.selectedEl&&this.selectedEl!==t&&this.selectedEl.setAttribute("aria-selected","false"),t&&t.setAttribute("aria-selected","true"),this.selectedEl=t}updateEmpty(){let e=this.frame,t=e.itemRows.length===0;if(this.scroller.hidden=t&&!this.detailEl,!t||e.loading>0&&!e.error){this.emptyEl.hidden=!0;return}let i=e.view,r="search",n="No results",o=e.query?`Nothing matches \u201C${e.query}\u201D`:null;e.error?(r="alert",n="Couldn\u2019t load results",o=e.error):i.emptyView?(r=i.emptyView.icon??r,n=i.emptyView.title,o=i.emptyView.description??null):e.view.type==="root"&&!e.query&&(n="Start typing to search",o=null),this.emptyEl.replaceChildren(k(r,28)??"",u("div",{class:"qb-empty-title"},n),o?u("div",{class:"qb-empty-desc"},o):""),this.emptyEl.hidden=!1}updateDetail(){let e=this.detailEl;if(!e)return;let t=this.bar.selectedItem(this.frame);if(t===this.detailFor)return;if(this.detailFor=t,!t?.detail){e.innerHTML=t?.description?S(t.description):"";return}let i=ze.get(t);if(i===void 0){let r=t.detail;i=typeof r=="function"?Promise.resolve(r()):r,ze.set(t,i)}typeof i=="string"?e.innerHTML=S(i):(e.innerHTML="",i.then(r=>{ze.set(t,r),this.detailFor===t&&(e.innerHTML=S(r))},r=>{this.detailFor===t&&(e.textContent=String(r?.message??r))}))}select(e,t=!0){let i=this.frame.itemRows.length;i&&(this.frame.selected=(e%i+i)%i,this.frame.selectedKey=this.frame.itemRows[this.frame.selected].key,this.frame.userMoved=!0,t&&this.ensureVisible(),this.updateSelection(),this.bar.invalidate())}move(e){let t=this.frame.itemRows.length;if(!t)return;let i=this.frame.selected+e;this.select(Math.abs(e)===1?i:Math.max(0,Math.min(t-1,i)))}ensureVisible(){let e=this.frame,t=e.itemRows[e.selected];if(!t)return;let i=e.rows.indexOf(t),r=e.rows[i-1],n,o;if(this.virtual)n=this.offsets[i],o=n+this.rowHeight,r?.kind==="section"&&(n=this.offsets[i-1]);else{let l=this.cache.get(t.key)?.el;if(!l)return;if(n=l.offsetTop,o=n+l.offsetHeight,r?.kind==="section"){let h=this.cache.get(r.key)?.el;h&&(n=h.offsetTop)}}let a=8,c=this.scroller;e.selected===0?c.scrollTop=0:n<c.scrollTop+a?c.scrollTop=n-a:o>c.scrollTop+c.clientHeight-a&&(c.scrollTop=o-c.clientHeight+a),this.virtual&&this.renderWindow()}onKey(e){let t=e.key,i=e.metaKey||e.ctrlKey;if(t==="ArrowDown"&&i)return this.select(this.frame.itemRows.length-1),!0;if(t==="ArrowUp"&&i)return this.select(0),!0;if(t==="ArrowDown"||e.ctrlKey&&!e.metaKey&&!e.altKey&&(t==="n"||t==="j"))return this.move(1),!0;if(t==="ArrowUp"||e.ctrlKey&&!e.metaKey&&!e.altKey&&t==="p")return this.move(-1),!0;if(t==="PageDown")return this.move(8),!0;if(t==="PageUp")return this.move(-8),!0;if(t==="Enter"&&!i&&!e.altKey)return this.bar.runPrimary(this.frame),!0;if(t==="Tab"&&!e.shiftKey&&!i&&!e.altKey){let r=this.bar.selectedItem(this.frame);if(r?.arguments?.length){let n=this.bar.actionsFor(r,this.frame)[0];return n&&this.bar.runAction(this.frame,r,n),!0}return this.frame.view.type==="root"&&this.bar.ai&&this.bar.ask(this.frame.query),!0}return!1}scrollTop(){return this.scroller.scrollTop}restoreScroll(e){this.scroller.scrollTop=e,this.virtual&&this.renderWindow()}resetScroll(){this.scroller.scrollTop=0}destroy(){cancelAnimationFrame(this.rafId)}};ge=class extends te{constructor(e,t){super(e,t);let i=t.view;this.scroller.className=e.cls("qb-scroll qb-grid","grid"),this.scroller.style.setProperty("--qb-columns",String(i.columns??5)),i.aspectRatio&&this.scroller.style.setProperty("--qb-aspect",i.aspectRatio),i.fit&&this.scroller.style.setProperty("--qb-fit",i.fit),this.inner.style.display="contents"}update(){let e=this.frame.rows.slice(0,600),t=e.map(r=>r.key),i=e.map(r=>this.rowEl(r));je(t,this.renderedKeys)||(this.inner.replaceChildren(...i),this.renderedKeys=t),this.updateSelection(),this.updateEmpty()}itemEl(e){let{item:t}=e,i=u("div",{class:"qb-cell-media"});if(t.image)i.append(u("img",{src:t.image,alt:"",loading:"lazy",decoding:"async",draggable:"false"}));else{let r=k(t.icon,28);r&&i.append(r)}return u("div",{class:this.bar.cls("qb-cell","item"),role:"option",id:It(this.bar,e.key),"aria-selected":"false","data-index":String(e.index),title:t.title},i,u("div",{class:"qb-cell-title"},Pe(t.title,e.positions)),t.subtitle?u("div",{class:"qb-cell-subtitle"},t.subtitle):null)}ensureVisible(){let e=this.frame.itemRows[this.frame.selected];(e&&this.cache.get(e.key)?.el)?.scrollIntoView({block:"nearest"})}onKey(e){let t=this.frame.view.columns??5;return e.key==="ArrowRight"&&!e.metaKey&&!e.ctrlKey?(this.move(1),!0):e.key==="ArrowLeft"&&!e.metaKey&&!e.ctrlKey?(this.move(-1),!0):e.key==="ArrowDown"&&!e.metaKey&&!e.ctrlKey?(this.step(t),!0):e.key==="ArrowUp"&&!e.metaKey&&!e.ctrlKey?(this.step(-t),!0):super.onKey(e)}step(e){let t=this.frame.itemRows.length,i=this.frame.selected+e;i>=0&&i<t&&this.select(i)}},be=class{constructor(e,t){m(this,"bar",e);m(this,"frame",t);m(this,"el");m(this,"hasInput",!1);m(this,"body");m(this,"rendered","");m(this,"raf",0);let i=t.view;this.body=u("div",{class:e.cls("qb-detail qb-md","detail"),tabindex:"-1"});let r=[this.body];i.metadata?.length&&r.push(u("div",{class:"qb-meta"},...i.metadata.map(n=>u("div",null,u("div",{class:"qb-meta-label"},n.label),u("div",{class:"qb-meta-value"},k(n.icon,14),n.tag?_e(n.tag):null,n.href?u("a",{href:n.href,target:/^https?:/.test(n.href)?"_blank":null,rel:"noopener"},n.value??n.href):n.value??null))))),this.el=u("div",{style:"display:flex;flex:1;min-width:0"},...r)}update(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0,this.render()}))}render(){let e=this.frame.detail;if(!e)return;let t=`${e.text.length}|${e.done}|${e.error??""}`;if(t===this.rendered)return;this.rendered=t;let i=this.body.scrollTop+this.body.clientHeight>=this.body.scrollHeight-24,r=S(e.text);e.done||(r+='<span class="qb-caret"></span>'),e.error&&(r+=`<p class="qb-msg-error">${e.error.replace(/</g,"&lt;")}</p>`),this.body.innerHTML=r,i&&!e.done&&(this.body.scrollTop=this.body.scrollHeight)}onKey(e){return e.key==="ArrowDown"?(this.body.scrollTop+=40,!0):e.key==="ArrowUp"?(this.body.scrollTop-=40,!0):e.key==="Enter"&&!e.metaKey&&!e.ctrlKey?(this.bar.runPrimary(this.frame),!0):!1}viewActions(){let e=this.frame.detail;return[{title:"Copy Content",icon:"copy",shortcut:"mod+shift+c",keepOpen:!0,run:async t=>{let i=await t.copy(e?.text??"");return t.toast({title:i?"Copied to clipboard":"Copy failed",style:i?"success":"failure"}),!1}}]}focusTarget(){return this.body}scrollTop(){return this.body.scrollTop}restoreScroll(e){this.body.scrollTop=e}destroy(){cancelAnimationFrame(this.raf)}},ye=class{constructor(e,t){m(this,"bar",e);m(this,"frame",t);m(this,"el");m(this,"hasInput",!1);m(this,"inputs",new Map);m(this,"errors",new Map);let i=t.view,r=[];for(let n of i.fields){let o=`${e.instanceId}-f-${n.name}`,a=u("label",{class:"qb-form-label",for:o,"data-required":n.required?"":null},n.type==="checkbox"?"":n.label??n.name),c=this.control(n,o),l=u("div",{class:"qb-field-error",hidden:!0,id:`${o}-err`});this.errors.set(n.name,l),r.push(a,u("div",{class:"qb-field"},c,n.description?u("div",{class:"qb-field-desc"},n.description):null,l))}this.el=u("form",{class:e.cls("qb-form","form"),novalidate:!0},...r),this.el.addEventListener("submit",n=>{n.preventDefault(),this.submit()})}control(e,t){let i=this.frame.form.values,r=o=>{i[e.name]=o,this.frame.form.errors[e.name]&&(delete this.frame.form.errors[e.name],this.showErrors())},n;if(e.type==="checkbox"){let o=u("input",{type:"checkbox",id:t,checked:!!i[e.name]});return o.addEventListener("change",()=>r(o.checked)),this.inputs.set(e.name,o),u("label",{class:"qb-field-check"},o,u("span",null,e.label??e.name))}if(e.type==="select"){let o=u("select",{class:"qb-field-input",id:t},...(e.options??[]).map(a=>u("option",{value:a.value},a.title)));o.value=String(i[e.name]??""),o.addEventListener("change",()=>r(o.value)),n=o}else if(e.type==="textarea"){let o=u("textarea",{class:"qb-field-input",id:t,placeholder:e.placeholder??"",rows:4});o.value=String(i[e.name]??""),o.addEventListener("input",()=>r(o.value)),n=o}else{let o=u("input",{class:"qb-field-input",id:t,type:e.type??"text",placeholder:e.placeholder??"",autocomplete:e.type==="password"?"off":"on",spellcheck:"false"});o.value=String(i[e.name]??""),o.addEventListener("input",()=>r(e.type==="number"?o.value===""?"":Number(o.value):o.value)),n=o}return n.setAttribute("aria-describedby",`${t}-err`),this.inputs.set(e.name,n),n}showErrors(){let e=this.frame.form.errors;for(let[t,i]of this.errors){let r=e[t];i.hidden=!r,i.textContent=r??"",this.inputs.get(t)?.setAttribute("aria-invalid",r?"true":"false")}}submit(){let e=this.frame.view,t=this.frame.form;t.errors={};for(let r of e.fields){let n=t.values[r.name];if(r.required&&(n===""||n==null||n===!1))t.errors[r.name]=`${r.label??r.name} is required`;else{let o=r.validate?.(n,t.values);o&&(t.errors[r.name]=o)}}this.showErrors();let i=Object.keys(t.errors)[0];if(i){this.inputs.get(i)?.focus();return}this.bar.runAction(this.frame,void 0,{title:e.submitLabel??"Submit",run:r=>e.onSubmit({...t.values},r)})}update(){}onKey(e){if(e.key==="Enter"&&(e.metaKey||e.ctrlKey))return this.submit(),!0;let t=e.target;return e.key==="Enter"&&t.tagName==="INPUT"&&t.type!=="checkbox"?(this.submit(),!0):!1}footerPrimary(){return{title:this.frame.view.submitLabel??"Submit",hotkey:"mod+enter",run:()=>this.submit()}}focusTarget(){return this.el.contains(document.activeElement)?document.activeElement:this.el.querySelector("input,textarea,select")??this.el}scrollTop(){return this.el.scrollTop}restoreScroll(e){this.el.scrollTop=e}destroy(){}},ve=class{constructor(e,t){m(this,"bar",e);m(this,"frame",t);m(this,"el");m(this,"hasInput",!0);m(this,"turnEls",[]);m(this,"emptyEl");m(this,"raf",0);this.el=u("div",{class:e.cls("qb-chat","chat"),role:"log","aria-live":"polite",tabindex:"-1"})}update(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0,this.render()}))}render(){let e=this.frame.chat?.turns??[];if(!e.length){this.emptyEl||(this.emptyEl=this.empty(),this.el.replaceChildren(this.emptyEl));return}this.emptyEl&&(this.emptyEl.remove(),this.emptyEl=void 0);let t=this.el.scrollTop+this.el.clientHeight>=this.el.scrollHeight-40;e.forEach((i,r)=>{let n=`${i.text.length}|${i.streaming}|${i.error??""}|${i.tools.map(c=>c.state).join()}`,o=this.turnEls[r];if(o&&o.sig===n)return;let a;if(i.role==="user")a=u("div",{class:"qb-msg-user"},i.text);else{let c=u("div",{class:"qb-msg-head"},k("sparkles",13),this.bar.aiName),l=i.tools.length?u("div",{class:"qb-tools"},...i.tools.map(p=>{let g=k(p.state==="running"?"loader":p.state==="done"?"check":"x",12);return p.state==="running"&&g.classList.add("qb-spin"),u("span",{class:"qb-tool","data-state":p.state},g,p.label)})):null,h=u("div",{class:"qb-md"}),d=S(i.text);i.streaming&&(d+=i.text||!i.tools.length?'<span class="qb-caret"></span>':""),h.innerHTML=d,a=u("div",{class:"qb-msg-ai"},c,l,h,i.error?u("div",{class:"qb-msg-error"},i.error):null)}o?o.el.replaceWith(a):this.el.append(a),this.turnEls[r]={el:a,sig:n}}),t&&(this.el.scrollTop=this.el.scrollHeight)}empty(){let e=this.bar.aiOptions?.suggestions??[],t=e.length?e:["What can I do here?","Summarize this page"];return u("div",{class:"qb-chat-empty"},k("sparkles",26),u("div",{class:"qb-empty-title"},`Ask ${this.bar.aiName} anything`),u("div",{class:"qb-empty-desc"},"Ask a question or tell it what to do, like \u201Ctake me to billing\u201D."),u("div",{class:"qb-suggestions"},...t.map(i=>{let r=u("button",{class:"qb-suggestion",type:"button"},i);return r.addEventListener("click",()=>this.bar.sendChat(this.frame,i)),r})))}lastAnswer(){let e=this.frame.chat?.turns??[];for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant"&&e[t].text)return e[t].text;return""}onKey(e){if(e.key==="Enter"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=this.frame.query.trim();return t&&this.bar.sendChat(this.frame,t),!0}return e.key==="ArrowUp"&&!this.frame.query?(this.el.scrollTop-=60,!0):e.key==="ArrowDown"&&!this.frame.query?(this.el.scrollTop+=60,!0):!1}placeholder(){return this.frame.chat?.turns.length??0?"Ask a follow-up\u2026":`Ask ${this.bar.aiName} anything\u2026`}footerPrimary(){return this.frame.chat?.controller?{title:"Stop",hotkey:"escape",run:()=>{this.bar.stopChat(this.frame)}}:{title:"Send",hotkey:"enter",run:()=>this.bar.sendChat(this.frame,this.frame.query)}}viewActions(){let e=this.frame.view;return[{title:"Copy Answer",icon:"copy",shortcut:"mod+shift+c",keepOpen:!0,run:async t=>{let i=await N(this.lastAnswer());return t.toast({title:i?"Copied answer":"Nothing to copy",style:i?"success":"failure"}),!1}},{title:"New Chat",icon:"plus",shortcut:"mod+shift+o",run:t=>(t.render({...e,type:"chat",prompt:void 0}),!1)}]}scrollTop(){return this.el.scrollTop}restoreScroll(e){this.el.scrollTop=e}destroy(){cancelAnimationFrame(this.raf)}}});var Ct={};we(Ct,{Bar:()=>Be,isView:()=>De});function pi(s,e){if(s===e)return!0;if(!s||!e)return!1;let t=Object.keys(s);return t.length!==Object.keys(e).length?!1:t.every(i=>s[i]===e[i])}async function ui(s,e){let t;try{return await Promise.race([Promise.resolve(s),new Promise((i,r)=>t=setTimeout(()=>r(new Error("timeout")),e))])}finally{clearTimeout(t)}}var ai,De,li,ci,di,hi,Be,Lt=q(()=>{"use strict";pt();oe();Ce();H();Oe();W();Fe();de();Ne();fe();St();ai=new Set(["list","grid","detail","form","chat"]),De=s=>!!s&&typeof s=="object"&&ai.has(s.type),li="nav a[href], header a[href], aside a[href], [data-qikbar-index] a[href]",ci="mod+.",di=s=>s.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64),hi=0,Be=class{constructor(e={}){m(this,"config");m(this,"instanceId",xt("qikbar"));m(this,"storageAdapter");m(this,"storage");m(this,"frecency");m(this,"registrations",new Map);m(this,"regCounter",0);m(this,"sources",new Set);m(this,"sourceExt",new WeakMap);m(this,"itemExt",new WeakMap);m(this,"extensions",new Map);m(this,"configExtensions",[]);m(this,"configSources",[]);m(this,"ids",new WeakMap);m(this,"listeners",new Map);m(this,"stack",[]);m(this,"_open",!1);m(this,"rootCache",null);m(this,"routeItems",[]);m(this,"autoItems",[]);m(this,"shortcutItems",[]);m(this,"aiOptions");m(this,"ai");m(this,"dom");m(this,"renderer");m(this,"panel");m(this,"toastState");m(this,"toastTimer");m(this,"toastId",0);m(this,"hud");m(this,"confirmState");m(this,"argMode");m(this,"seq",new z);m(this,"prevFocus",null);m(this,"teardown",[]);m(this,"appliedVars",[]);m(this,"scheduled",!1);m(this,"scrollLock");m(this,"closeTimer");m(this,"destroyed",!1);m(this,"styleEl");m(this,"onGlobalKeyDown",e=>{if(this.destroyed||e.defaultPrevented||e.isComposing)return;let t=this.config.hotkey===!1?[]:[].concat(this.config.hotkey??"mod+k"),i=j(e.target);if(t.some(l=>E(e,l)&&(!i||U(l)))){e.preventDefault(),e.stopPropagation(),this.isInline?(this.open(),this.focusInput()):this.toggle();return}if(this._open&&!this.isInline||this.isInline&&this.dom?.root.contains(e.target)||this.config.shortcuts===!1||(this.rootItems(),!this.shortcutItems.length))return;let r=this.shortcutItems.map(l=>l.shortcut).filter(l=>!i||U(l)),n=this.seq.feed(e,r);if(!n.length)return;let o=this.shortcutItems.find(l=>l.shortcut===n[0]);if(!o)return;e.preventDefault();let a=this.createFrame({type:"root"}),c=this.actionsFor(o,a)[0];c&&this.runAction(a,o,c)});m(this,"onGlobalClick",e=>{let t=e.target?.closest?.("[data-qikbar-open]");if(!t||this.destroyed)return;let i=t.getAttribute("data-qikbar-open");(i?i!==this.instanceId&&i!==this.config.namespace:this.isInline)||(e.preventDefault(),this.open({query:t.getAttribute("data-qikbar-query")??void 0}))});m(this,"onDialogKeyDown",e=>{if(e.stopPropagation(),e.isComposing||e.keyCode===229)return;let t=this.top;if(!t)return;if(this.confirmState){if(e.key==="Escape")e.preventDefault(),this.confirmState.resolve(!1);else if(e.key==="Tab"){let r=[...this.dom?.layer.querySelectorAll("button")??[]],n=r.indexOf(document.activeElement);e.preventDefault(),r[(n+(e.shiftKey?-1:1)+r.length)%r.length]?.focus()}e.stopPropagation();return}if(this.panel){this.onPanelKey(e)&&(e.preventDefault(),e.stopPropagation());return}if(this.argMode){if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.argMode=void 0,this.flush(),this.focusInput();return}if(e.key==="Enter"){e.preventDefault(),this.submitArgs();return}return}if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.escape();return}if(E(e,this.actionsHotkey)){e.preventDefault(),this.openPanel();return}if(this.renderer?.onKey(e)){e.preventDefault();return}let i=this.actionsFor(this.selectedItem(t),t);if(e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&t.view.type!=="form"){let r=i[1];if(r&&!r.shortcut){e.preventDefault(),this.runAction(t,this.selectedItem(t),r);return}}for(let r of i)if(r.shortcut&&E(e,r.shortcut)){e.preventDefault(),this.runAction(t,this.selectedItem(t),r);return}e.key==="Backspace"&&this.stack.length>1&&e.target===this.dom?.input&&!this.dom.input.value&&!e.repeat&&(e.preventDefault(),this.pop())});if(this.config={...e},this.storageAdapter=e.storage??P(),this.storage=Q(this.storageAdapter,e.namespace??"qikbar"),this.frecency=new D(this.storage),this.applyConfig(e,!0),!(typeof document>"u")&&(this.listen(document,"keydown",this.onGlobalKeyDown,!0),this.listen(document,"click",this.onGlobalClick,!0),this.inlineTarget())){let t=()=>this.open({focus:!1});document.readyState==="loading"?this.listen(document,"DOMContentLoaded",t):t()}}get isOpen(){return this._open}get query(){return this.top?.query??""}get top(){return this.stack[this.stack.length-1]}get isInline(){return!!this.config.inline}get aiName(){return this.aiOptions?.name??"AI"}get actionsHotkey(){return this.config.actionsHotkey??ci}open(e={}){if(this.destroyed||typeof document>"u")return;if(this.mount(),clearTimeout(this.closeTimer),!this._open){this._open=!0,this.prevFocus=document.activeElement,this.rootCache=null,this.autoIndex(),this.resetToRoot(),this.applyTheme();let i=this.dom;i.root.dataset.qbState="open",i.overlay.hidden=this.isInline,i.dialog.hidden=!1,this.isInline||this.lockScroll(),this.emit("open",void 0),this.config.onOpen?.()}e.view&&this.push(e.view),e.query!=null&&this.setQuery(e.query),this.flush(),e.focus!==!1&&this.focusInput(),this.emitChange()}close(){if(!this._open||!this.dom)return;if(this.closePanel(),this.confirmState?.resolve(!1),this.confirmState=void 0,this.argMode=void 0,this.isInline){this.resetToRoot(),this.flush(),document.activeElement?.blur?.(),this.emitChange();return}this._open=!1;let e=this.dom;e.root.dataset.qbState="closing";let t=()=>{if(!this._open){e.root.dataset.qbState="closed",e.dialog.hidden=!0,e.overlay.hidden=!0,this.renderer?.destroy(),this.renderer=void 0,e.body.replaceChildren();for(let n of this.stack)this.destroyFrame(n);this.stack=[]}};typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches?t():this.closeTimer=setTimeout(t,120),this.unlockScroll();let r=this.prevFocus;r&&typeof r.focus=="function"&&document.contains(r)&&r.focus({preventScroll:!0}),this.toastState&&this.renderToast(),this.emit("close",void 0),this.config.onClose?.(),this.emitChange()}toggle(){this._open&&!this.isInline?this.close():this.open()}register(e){let t=++this.regCounter;return this.registrations.set(t,Array.isArray(e)?e:[e]),this.invalidateRoot(),()=>{this.registrations.delete(t),this.invalidateRoot()}}addSource(e){return this.sources.add(e),()=>{this.sources.delete(e);for(let t of this.stack)t.sourceResults?.delete(e.id);this.invalidate()}}use(e,t={}){this.extensions.get(e.name)?.cleanup?.();let i=Q(this.storageAdapter,`${this.config.namespace??"qikbar"}:ext:${e.name}`),r={ext:e,provided:t,storage:i,prefs:()=>{let h=i.get("preferences")??{},d={};for(let p of e.preferences??[])p.default!==void 0&&(d[p.name]=p.default);return{...d,...h,...t}},missing:()=>{let h=r.prefs();return(e.preferences??[]).filter(d=>d.required&&(h[d.name]===void 0||h[d.name]===""))}},n=(e.commands??[]).map(h=>{let{name:d,...p}=h,g={section:e.title,icon:e.icon,...p,id:`${e.name}.${d}`};return this.itemExt.set(g,r),g}),o=(e.sources??[]).map(h=>(this.sourceExt.set(h,r),this.addSource(h))),a;try{a=e.setup?.({bar:this,preferences:r.prefs(),storage:i})}catch(h){console.error(`[qikbar] extension "${e.name}" setup failed`,h)}let c=!1,l={rt:r,items:n,cleanup:()=>{c||(c=!0,o.forEach(h=>h()),typeof a=="function"&&a(),this.extensions.get(e.name)===l&&this.extensions.delete(e.name),this.invalidateRoot())}};return this.extensions.set(e.name,l),this.invalidateRoot(),l.cleanup}configure(e){let t=this.config;this.config={...this.config,...e},this.applyConfig(e,!1,t),this.dom&&(("theme"in e||"appearance"in e)&&this.applyTheme(),"classNames"in e&&this.applyClassNames(),"dir"in e&&(this.dom.root.dir=this.config.dir??"")),this.invalidateRoot()}push(e,t){if(!this._open&&(this.open(),!this._open))return;let i=this.top;i&&this.renderer&&(i.scrollTop=this.renderer.scrollTop());let r=this.createFrame(e,t??i?.ext);this.stack.push(r),this.closePanel(),this.argMode=void 0,this.startFrame(r),this.flush(),this.focusInput(),this.emitChange()}pop(){if(this.stack.length<=1)return;let e=this.stack.pop();this.destroyFrame(e),this.closePanel(),this.argMode=void 0,this.flush(),this.focusInput(),this.emitChange()}setQuery(e){let t=this.top;t&&(this.dom&&(this.dom.input.value=e),this.onQueryChange(t,e))}ask(e){if(!this.ai){this.toast({style:"failure",title:"AI is not configured",message:"Pass `ai` to createQikbar()."});return}this.push({type:"chat",prompt:e?.trim()||void 0})}commands(){return this.rootItems()}on(e,t){let i=this.listeners.get(e);return i||this.listeners.set(e,i=new Set),i.add(t),()=>i.delete(t)}preload(){return Promise.resolve()}destroy(){this.destroyed=!0,this._open&&!this.isInline&&this.unlockScroll(),this._open=!1;for(let e of this.stack)this.destroyFrame(e);this.stack=[];for(let e of this.extensions.values())e.cleanup?.();for(let e of this.teardown)e();this.teardown=[],this.dom?.root.remove(),this.hud?.remove(),this.dom=void 0,this.listeners.clear()}applyConfig(e,t,i){if(("routes"in e||t)&&(this.routeItems=(this.config.routes??[]).map(r=>({id:`route:${r.path}`,title:r.title,subtitle:r.subtitle,icon:r.icon??"arrow-right",keywords:[...r.keywords??[],r.path],section:r.section??"Navigation",href:r.path,shortcut:r.shortcut}))),("sources"in e||t)&&(t||i?.sources!==this.config.sources)){for(let r of this.configSources)r();this.configSources=(this.config.sources??[]).map(r=>this.addSource(r))}if("ai"in e||t){let r=this.config.ai;this.aiOptions=r?"stream"in r?{provider:r}:r:void 0,this.ai=this.aiOptions?dt(this.aiOptions.provider,this.aiOptions.system):void 0}if("extensions"in e||t){let r=(this.config.extensions??[]).map(a=>Array.isArray(a)?{ext:a[0],prefs:a[1]}:{ext:a,prefs:void 0}),n=!t&&i?.extensions===this.config.extensions,o=r.length===this.configExtensions.length&&r.every((a,c)=>a.ext===this.configExtensions[c].ext&&pi(a.prefs,this.configExtensions[c].prefs));if(!n&&!o){for(let a of this.configExtensions)a.uninstall();this.configExtensions=r.map(a=>({...a,uninstall:this.use(a.ext,a.prefs)}))}}}inlineTarget(){let e=this.config.inline;return!e||typeof document>"u"?null:typeof e=="string"?document.querySelector(e):e}emit(e,t){this.listeners.get(e)?.forEach(i=>{try{i(t)}catch(r){console.error(r)}})}emitChange(){let e={open:this._open,query:this.query,depth:this.stack.length,loading:!!this.top?.loading};this.emit("change",e)}listen(e,t,i,r=!1){e.addEventListener(t,i,r),this.teardown.push(()=>e.removeEventListener(t,i,r))}idOf(e){return e.id??this.ids.get(e)??e.title}invalidateRoot(){if(this.rootCache=null,this._open){for(let e of this.stack)e.view.type==="root"&&this.computeRows(e);this.invalidate()}}rootItems(){if(this.rootCache)return this.rootCache;let e=[],t=new Set,i=(r,n)=>{try{if(r.when&&!r.when())return}catch{return}let o=r.id??`${n}:${r.section??""}:${r.title}`;for(;t.has(o);)o+="'";t.add(o),this.ids.set(r,o),e.push(r)};for(let r of this.config.commands??[])i(r,"cmd");for(let r of this.routeItems)i(r,"route");for(let r of this.registrations.values())for(let n of r)i(n,"reg");for(let r of this.extensions.values())for(let n of r.items)i(n,"ext");for(let r of this.autoItems)i(r,"auto");return this.ai&&this.aiOptions?.fallback!==!1&&i({id:"qikbar.ask-ai",title:`Ask ${this.aiName}`,subtitle:"Chat, or tell it what to do",icon:"sparkles",section:"AI",keywords:["chat","assistant","ai","help"],searchOnly:!0,view:{type:"chat"}},"qb"),this.rootCache=e,this.shortcutItems=e.filter(r=>r.shortcut),e}autoIndex(){let e=this.config.autoIndex;if(!e||typeof document>"u"){this.autoItems.length&&(this.autoItems=[],this.rootCache=null);return}let t=e===!0?{}:e,i=[],r=new Set;if(t.links!==!1)for(let n of document.querySelectorAll(t.links??li)){if(n.closest(".qb-root")||n.closest("[data-qikbar-ignore]"))continue;let o=n.getAttribute("href")??"";if(!o||o.startsWith("#")&&!o.startsWith("#/")||/^(javascript|mailto|tel):/i.test(o))continue;let a=(n.getAttribute("aria-label")||n.textContent||n.title||"").replace(/\s+/g," ").trim().slice(0,80);if(!a)continue;let c=n.host!==location.host,l=c?n.href:o.startsWith("#")?o:n.pathname+n.search+n.hash;if(r.has(l))continue;r.add(l);let h=n.closest("[data-qikbar-section],nav[aria-label],aside[aria-label]");i.push({id:`auto:${l}`,title:a,subtitle:c?n.host:o.startsWith("#")?o:n.pathname,section:h?.dataset.qikbarSection??h?.getAttribute("aria-label")??t.section??"Pages",icon:c?"globe":"file",keywords:[l],...c?{url:l}:{href:l}})}if(t.elements!==!1)for(let n of document.querySelectorAll("[data-qikbar]")){if(n.closest(".qb-root"))continue;let o=(n.dataset.qikbar||n.getAttribute("aria-label")||n.textContent||"").replace(/\s+/g," ").trim().slice(0,80);o&&i.push({id:`el:${n.id||o}`,title:o,subtitle:n.dataset.qikbarSubtitle,keywords:n.dataset.qikbarKeywords?.split(",").map(a=>a.trim()),section:n.dataset.qikbarSection??"Actions",icon:n.dataset.qikbarIcon??"zap",shortcut:n.dataset.qikbarShortcut,run:()=>{n.click()}})}this.autoItems=i,this.rootCache=null}createFrame(e,t,i){return{id:++hi,view:e,query:("query"in e&&typeof e.query=="string"?e.query:"")||"",selected:0,rows:[],itemRows:[],loading:0,controller:new AbortController,ext:t,args:i}}resetToRoot(){for(let t of this.stack)this.destroyFrame(t);let e=this.createFrame({type:"root"});e.sourceResults=new Map,this.stack=[e],this.renderer?.destroy(),this.renderer=void 0,this.dom&&(this.dom.input.value=""),this.computeRows(e)}destroyFrame(e){e.controller.abort(),e.queryController?.abort(),e.chat?.controller?.abort();try{e.view.onClose?.()}catch(t){console.error(t)}}startFrame(e){let t=e.view;if(t.type==="list"||t.type==="grid")typeof t.items=="function"&&this.loadItems(e,!0),this.computeRows(e);else if(t.type==="detail")this.loadDetail(e,t);else if(t.type==="form"){let i={};for(let r of t.fields)i[r.name]=r.defaultValue??(r.type==="checkbox"?!1:r.type==="select"?r.options?.[0]?.value??"":"");e.form={values:i,errors:{}}}else t.type==="chat"&&(e.chat={messages:[],turns:[]},t.prompt&&queueMicrotask(()=>this.sendChat(e,t.prompt)))}replaceFrame(e,t){let i=this.stack.indexOf(e);if(i<0)return;let r=this.createFrame(t,e.ext,e.args);t.type===e.view.type&&!("query"in t&&t.query!=null)&&(r.query=e.query),e===this.top&&this.renderer&&(r.scrollTop=this.renderer.scrollTop()),r.selectedKey=e.itemRows[e.selected]?.key,r.userMoved=!!r.selectedKey,this.destroyFrame(e),this.stack[i]=r,this.startFrame(r),this.invalidate()}computeRows(e){let t=e.view,i;t.type==="root"?i=this.rootGroups(e):t.type==="list"||t.type==="grid"?i=this.listGroups(e,t):i=[];let r=[],n=[],o=new Set;for(let a of i)if(a.entries.length){a.title&&r.push({kind:"section",key:`s:${a.title}`,title:a.title});for(let c of a.entries){let l=t.type==="root"?this.idOf(c.item):c.item.id??`${a.title}:${c.item.title}`;for(;o.has(l);)l+="'";o.add(l);let h={kind:"item",key:l,item:c.item,positions:c.positions,index:n.length};r.push(h),n.push(h)}}if(e.rows=r,e.itemRows=n,e.userMoved||(e.selectedKey=void 0,e.selected=0),e.selectedKey){let a=n.findIndex(c=>c.key===e.selectedKey);e.selected=a>=0?a:Math.min(e.selected,Math.max(0,n.length-1))}else e.selected=Math.min(e.selected,Math.max(0,n.length-1));e.selectedKey=n[e.selected]?.key}rootGroups(e){let t=e.query.trim(),i=this.rootItems(),r=[],n=new Map,o=h=>{let d=n.get(h);return d||(d={title:h,entries:[]},n.set(h,d),r.push(d)),d};if(!t){let h=new Set,d=this.config.recents===!1?0:typeof this.config.recents=="number"?this.config.recents:4;if(d){let p=new Map(i.map(g=>[this.idOf(g),g]));for(let g of this.frecency.top(d*2)){let f=p.get(g);if(!(!f||f.searchOnly)&&(o("Recent").entries.push({item:f}),h.add(f),h.size>=d))break}}for(let p of i)p.searchOnly||h.has(p)||o(p.section??"Commands").entries.push({item:p});return r}let a=h=>{for(let d of this.sources){if((d.position??"bottom")!==h)continue;let p=e.sourceResults?.get(d.id);if(!p?.length)continue;let g=o(d.title??"Results"),f=d.filter?L(p,t):p.map(b=>({item:b,positions:Z(b,t)?.positions}));for(let b of f.slice(0,d.limit??8))g.entries.push({item:b.item,positions:b.positions})}};a("top");let c=L(i,t,{boost:h=>this.frecency.score(this.idOf(h))*.3,limit:300});for(let h of c)o(h.item.section??"Commands").entries.push({item:h.item,positions:h.positions});a("bottom");let l=(this.config.fallbacks??[]).map((h,d)=>({...h,id:`fallback:${d}`,title:h.title.replaceAll("{query}",t),subtitle:h.subtitle?.replaceAll("{query}",t)}));if(this.ai&&this.aiOptions?.fallback!==!1&&l.unshift({id:"qikbar.ask-ai-fallback",title:`Ask ${this.aiName}`,subtitle:`\u201C${t.length>60?`${t.slice(0,60)}\u2026`:t}\u201D`,icon:"sparkles",accessories:[{kbd:"tab"}],noHistory:!0,run:()=>({type:"chat",prompt:t})}),l.length){let h=o(`Use \u201C${t.length>24?`${t.slice(0,24)}\u2026`:t}\u201D with\u2026`);for(let d of l)h.entries.push({item:d})}return r}listGroups(e,t){let i=typeof t.items=="function"?e.items??[]:t.items,r=e.query.trim(),o=(t.filter??typeof t.items!="function")&&r?L(i,r).map(l=>({item:l.item,positions:l.positions})):i.map(l=>({item:l})),a=[],c=new Map;for(let l of o){let h=l.item.section??"",d=c.get(h);d||(d={title:h,entries:[]},c.set(h,d),a.push(d)),d.entries.push(l)}return a}onQueryChange(e,t){if(e.query===t)return;e.query=t;let i=e.view;(i.type==="root"||i.type==="list"||i.type==="grid")&&(e.selected=0,e.selectedKey=void 0,e.userMoved=!1,i.type==="root"?this.searchSources(e):typeof i.items=="function"&&this.loadItems(e,!1),this.computeRows(e),this.renderer?.resetScroll?.()),this.invalidate(),this.emitChange()}searchSources(e){e.queryController?.abort();let t=new AbortController;e.queryController=t;let i=e.query.trim(),r=e.sourceResults??(e.sourceResults=new Map);for(let n of this.sources){let o=r.get(n.id);if(i.length<(n.minQueryLength??1)){r.delete(n.id);continue}o&&r.set(n.id,o.filter(h=>Z(h,i)));let a=async()=>{if(!t.signal.aborted){e.loading++,this.invalidate();try{let h=this.sourceExt.get(n),d=await n.search({query:i,signal:t.signal,ctx:this.makeContext(e,{ext:h,signal:t.signal})});if(t.signal.aborted)return;if(h)for(let p of d)this.itemExt.set(p,h);r.set(n.id,d)}catch(h){t.signal.aborted||console.error(`[qikbar] source "${n.id}" failed`,h)}finally{e.loading--,!t.signal.aborted&&this.stack.includes(e)&&this.computeRows(e),this.invalidate()}}},c=n.debounce??150,l=setTimeout(a,c);t.signal.addEventListener("abort",()=>clearTimeout(l))}}loadItems(e,t){let i=e.view;if(typeof i.items!="function")return;let r=i.items;e.queryController?.abort();let n=new AbortController;e.queryController=n,e.controller.signal.addEventListener("abort",()=>n.abort());let o=async()=>{if(!n.signal.aborted){e.loading++,e.error=void 0,this.invalidate();try{let a=r({query:e.query,signal:n.signal,ctx:this.makeContext(e,{signal:n.signal})});if(a&&typeof a[Symbol.asyncIterator]=="function")for await(let c of a){if(n.signal.aborted)return;this.setItems(e,c)}else{let c=await a;n.signal.aborted||this.setItems(e,c)}}catch(a){n.signal.aborted||(e.error=a instanceof Error?a.message:String(a),e.items=[],this.computeRows(e))}finally{e.loading--,this.invalidate()}}};if(t)o();else{let a=setTimeout(o,i.debounce??120);n.signal.addEventListener("abort",()=>clearTimeout(a))}}setItems(e,t){if(e.items=t,e.ext)for(let i of t)this.itemExt.set(i,e.ext);this.computeRows(e),this.invalidate()}async loadDetail(e,t){e.detail={text:"",done:!1},e.loading++;try{let i=t.markdown;if(typeof i=="function"&&(i=await i()),typeof i=="string")e.detail.text=i;else for await(let r of i){if(e.controller.signal.aborted)return;e.detail.text+=r,this.invalidate()}}catch(i){e.controller.signal.aborted||(e.detail.error=i instanceof Error?i.message:String(i))}finally{e.detail.done=!0,e.loading--,this.invalidate()}}makeContext(e,t={}){let i=t.ext??e.ext;return{bar:this,get query(){return e.query},signal:t.signal??e.controller.signal,preferences:i?i.prefs():{},arguments:t.args??e.args??{},storage:i?.storage??this.storage,ai:this.ai,push:n=>this.push(n,i),pop:()=>this.pop(),render:n=>{this.stack.includes(e)?this.replaceFrame(e,n):this.push(n,i)},close:()=>this.close(),navigate:(n,o)=>this.navigate(n,o?.newTab??!1),openUrl:n=>{this.close(),window.open(n,"_blank","noopener,noreferrer")},copy:n=>N(n),toast:n=>this.toast(n),confirm:n=>this.confirm(n),setQuery:n=>{e===this.top?this.setQuery(n):e.query=n}}}navigate(e,t=!1){this.isInline||this.close();let i=this.config.navigate;if(i)return i(e,{newTab:t});ee(e,t)}actionsFor(e,t){let i=this.renderer?.frame===t?this.renderer.viewActions?.()??[]:[],r=[...t.view.actions??[],...i];if(!e)return r;t.actionCache??(t.actionCache=new WeakMap);let n=t.actionCache.get(e);if(n)return n;let o=[];if(e.run&&o.push({title:t.view.type==="root"?"Run Command":"Run",icon:"corner-down-left",run:e.run}),e.view){let c=e.view;o.push({title:"Open",icon:"chevron-right",run:l=>typeof c=="function"?c(l):c})}if(e.href){let c=e.href;o.push(M.navigate(c,{title:"Open"})),o.push(M.navigateNewTab(c)),o.push(M.copy(()=>new URL(c,location.href).href,{title:"Copy Link",icon:"link",shortcut:"mod+shift+c"}))}e.url&&(o.push(M.open(e.url)),o.push(M.copy(e.url,{title:"Copy URL",icon:"link",shortcut:"mod+shift+c"}))),e.actions&&o.push(...e.actions),o.push(...r);let a=this.itemExt.get(e);return t.view.type==="root"&&a?.ext.preferences?.length&&o.push({title:`Configure ${a.ext.title}`,icon:"settings",section:"Extension",run:()=>this.preferencesForm(a)}),t.view.type==="root"&&this.frecency.score(this.idOf(e))>0&&o.push({title:"Clear Recent History",icon:"history",section:"History",keepOpen:!0,run:()=>(this.frecency.clear(),this.computeRows(t),this.invalidate(),!1)}),t.actionCache.set(e,o),o}selectedItem(e=this.top){if(e)return e.itemRows[e.selected]?.item}async runAction(e,t,i,r){if(t?.arguments?.length&&!r){this.enterArgMode(e,t,i);return}let n=(t&&this.itemExt.get(t))??e.ext;if(t&&n&&n.missing().length){this.push(this.preferencesForm(n,()=>this.runAction(e,t,i,r)),n);return}t&&e.view.type==="root"&&!t.noHistory&&this.frecency.record(this.idOf(t)),t&&(this.config.onRun?.(t,i),this.emit("run",{item:t,action:i}));let o=!1,a=this.makeContext(e,{ext:n,args:r}),c=Object.create(a,{push:{value:l=>(o=!0,a.push(l))},render:{value:l=>(o=!0,a.render(l))},pop:{value:()=>(o=!0,a.pop())},close:{value:()=>(o=!0,a.close())},navigate:{value:(l,h)=>(o=!0,a.navigate(l,h))},openUrl:{value:l=>(o=!0,a.openUrl(l))}});e.loading++,this.invalidate();try{let l=await i.run(c);De(l)?this.push(l,n):l===!1||i.keepOpen||o||this.close()}catch(l){console.error(l),this.toast({style:"failure",title:"Something went wrong",message:l instanceof Error?l.message:String(l)})}finally{e.loading--,this.invalidate()}}runPrimary(e=this.top,t=0){if(!e)return;let i=this.selectedItem(e),r=this.actionsFor(i,e)[t];r&&this.runAction(e,i,r)}preferencesForm(e,t){let i=e.prefs();return{type:"form",title:`Configure ${e.ext.title}`,submitLabel:t?"Save and Continue":"Save",fields:(e.ext.preferences??[]).map(r=>({name:r.name,label:r.title,description:r.description,type:r.type==="text"?"text":r.type,required:r.required,placeholder:r.placeholder,options:r.options,defaultValue:i[r.name]??r.default})),onSubmit:r=>{let n=e.storage.get("preferences")??{};return e.storage.set("preferences",{...n,...r}),this.toast({style:"success",title:"Preferences saved"}),this.pop(),t?.(),!1}}}enterArgMode(e,t,i){this.argMode={item:t,action:i,frame:e,values:{}},this.closePanel(),this.flush(),this.dom?.args.querySelector("input,select")?.focus()}submitArgs(){let e=this.argMode;if(!e||!this.dom)return;let t=(e.item.arguments??[]).find(i=>i.required&&!e.values[i.name]?.trim());if(t){this.dom.args.querySelector(`[name="${CSS.escape(t.name)}"]`)?.focus();return}this.argMode=void 0,this.runAction(e.frame,e.item,e.action,e.values),this.flush()}sendChat(e,t){let i=e.chat;if(!i||!this.aiOptions||!t.trim()||i.controller&&!i.controller.signal.aborted)return;let r=new AbortController;e.controller.signal.addEventListener("abort",()=>r.abort()),i.controller=r,i.messages.push({role:"user",content:t}),i.turns.push({role:"user",text:t,tools:[]});let n={role:"assistant",text:"",tools:[],streaming:!0};i.turns.push(n),e===this.top&&this.dom&&(this.dom.input.value="",e.query=""),e.loading++,this.invalidate();let o=e.view,a=o.tools!==!1&&this.aiOptions.tools!==!1;(async()=>{try{for await(let l of ht({provider:this.aiOptions.provider,messages:i.messages,system:o.system??this.systemPrompt(a),tools:a?this.agentTools(e):[],maxSteps:this.aiOptions.maxSteps??6,signal:r.signal})){if(l.type==="text")n.text+=l.text;else if(l.type==="message")i.messages.push(l.message);else if(l.type==="tool_start")n.text&&!/\n\s*$/.test(n.text)&&(n.text+=`
234
+
235
+ `),n.tools.push({label:l.label,state:"running"});else if(l.type==="tool_end"){let h=n.tools.find(d=>d.state==="running");h&&(h.state=l.ok?"done":"error")}else l.type==="error"&&(n.error=l.error);this.invalidate()}}catch(l){r.signal.aborted||(n.error=l instanceof Error?l.message:String(l))}finally{n.streaming=!1;for(let l of n.tools)l.state==="running"&&(l.state="error");e.loading--,i.controller=void 0,this.invalidate()}})()}stopChat(e){let t=e.chat?.controller;return t&&!t.signal.aborted?(t.abort(),!0):!1}systemPrompt(e){let t=[`You are ${this.aiName}, the assistant built into this web app's command bar.`,"Answer concisely in Markdown. Prefer short paragraphs and lists."];if(typeof document<"u"&&t.push(`The user is on the page "${document.title}" (${location.pathname}).`),e){let i=this.rootItems().filter(r=>!r.id?.startsWith("qikbar."));t.push("","You can act inside the app:","- Call `run` with an item id to open a page or run a command when the user asks you to go somewhere or do something.","- Call `search` to find commands, pages and records that are not listed below.","Only call tools when the user wants something done or found in the app; otherwise just answer. After acting, confirm briefly what you did.","","Available items (id | title | section):",...i.slice(0,80).map(r=>`${this.idOf(r)} | ${r.title}${r.subtitle?` \u2014 ${r.subtitle}`:""} | ${r.section??"Commands"}`)),i.length>80&&t.push(`\u2026and ${i.length-80} more (use search).`)}return this.aiOptions?.system&&t.push("",this.aiOptions.system),t.join(`
236
+ `)}agentTools(e){let t=new Map,i=o=>t.get(o)??this.rootItems().find(a=>this.idOf(a)===o),r=[{definition:{name:"search",description:"Search the app's commands, pages and records (including results from connected data sources). Returns matching items with ids you can pass to `run`.",parameters:{type:"object",properties:{query:{type:"string",description:"What to look for"}},required:["query"]}},label:o=>`Searching \u201C${String(o.query??"")}\u201D`,run:async(o,a)=>{let c=String(o.query??""),l=L(this.rootItems(),c,{limit:10}).map(p=>p.item),h=await Promise.all([...this.sources].map(async p=>{if(c.length<(p.minQueryLength??1))return[];try{let g=this.sourceExt.get(p),f=await ui(p.search({query:c,signal:a,ctx:this.makeContext(e,{ext:g,signal:a})}),6e3);if(g)for(let b of f)this.itemExt.set(b,g);return f.slice(0,p.limit??8).map(b=>({item:b,section:p.title??p.id}))}catch{return[]}})),d=[...l.map(p=>({item:p,section:p.section??"Commands"})),...h.flat()];return d.length?d.map(({item:p,section:g},f)=>{let b=p.id&&!t.has(p.id)?p.id:`${g}#${f}`;return t.set(b,p),{id:b,title:p.title,subtitle:p.subtitle,section:g,description:p.description,href:p.href??p.url}}):"No results."}},{definition:{name:"run",description:"Open or run an item (page, command or record) by id. Use ids from the system prompt or from `search`.",parameters:{type:"object",properties:{id:{type:"string"},arguments:{type:"object",description:"Values for the command arguments, if it has any.",additionalProperties:{type:"string"}}},required:["id"]}},label:o=>{let a=i(String(o.id??""));return a?`Opening ${a.title}`:`Running ${String(o.id??"")}`},run:async o=>{let a=i(String(o.id??""));if(!a)throw new Error(`No item with id "${String(o.id)}". Use search first.`);let c=this.itemExt.get(a);if(c?.missing().length)throw new Error(`${c.ext.title} needs to be configured first. Ask the user to open it from the command bar.`);let l=this.actionsFor(a,this.stack[0]??e)[0];if(!l)throw new Error("This item has no action.");if(l.style==="destructive"&&!await this.confirm({title:`${l.title}?`,message:a.title,destructive:!0,confirmLabel:l.title}))return"The user cancelled.";if(a.href){let g=this.config.navigate;return g?g(a.href,{newTab:!1}):ee(a.href,!1),this.frecency.record(this.idOf(a)),`Navigated to ${a.href}.`}if(a.url)return window.open(a.url,"_blank","noopener,noreferrer"),`Opened ${a.url} in a new tab.`;let h=Object.fromEntries(Object.entries(o.arguments??{}).map(([g,f])=>[g,String(f)])),d=Object.create(this.makeContext(e,{ext:c,args:h}),{close:{value:()=>{}}}),p=await l.run(d);return this.frecency.record(this.idOf(a)),De(p)?(this.push(p,c),`Opened the "${a.title}" view for the user.`):`Ran "${a.title}".`}}];this.aiOptions?.pageContext!==!1&&typeof document<"u"&&r.push({definition:{name:"read_page",description:'Read the visible text of the page the user is currently on. Use it when the user asks about "this page" or its content.',parameters:{type:"object",properties:{}}},label:()=>"Reading this page",run:async()=>{let a=(document.querySelector("main, [role=main], article")??document.body).innerText.replace(/\n{3,}/g,`
237
+
238
+ `).trim();return`# ${document.title}
239
+ URL: ${location.href}
240
+
241
+ ${a.slice(0,2e4)}`}});let n=(o,a,c)=>{for(let l of o)r.push({definition:{name:di(c?`${c}__${l.name}`:l.name),description:l.description,parameters:l.parameters??{type:"object",properties:{}}},label:()=>l.description.split(/[.\n]/)[0].slice(0,60),run:async h=>{if(l.confirm){let d=typeof l.confirm=="function"?l.confirm(h):`Allow ${this.aiName} to ${l.name}?`;if(!await this.confirm({title:d,confirmLabel:"Allow"}))return"The user declined."}return l.run(h,this.makeContext(e,{ext:a}))}})};n(this.config.tools??[],void 0,"");for(let o of this.extensions.values())n(o.rt.ext.tools??[],o.rt,o.rt.ext.name);return r}toast(e){let t=typeof e=="string"?{title:e}:e,i=++this.toastId,r=()=>{clearTimeout(this.toastTimer);let o=this.toastState;if(!o)return;let a=o.duration??(o.style==="loading"?0:2600);a>0&&(this.toastTimer=setTimeout(()=>n(),a))},n=()=>{this.toastState?.id===i&&(this.toastState=void 0,this.renderToast())};return this.toastState={...t,id:i},r(),this.renderToast(),{update:o=>{this.toastState?.id===i&&(this.toastState={...this.toastState,...o},r(),this.renderToast())},hide:n}}confirm(e){let t=typeof e=="string"?{title:e}:e;return!this._open||!this.dom?Promise.resolve(typeof window<"u"?window.confirm(t.message?`${t.title}
242
+
243
+ ${t.message}`:t.title):!1):(this.confirmState?.resolve(!1),new Promise(i=>{this.confirmState={...t,resolve:r=>{this.confirmState=void 0,this.renderLayer(),this.focusInput(),i(r)}},this.renderLayer()}))}escape(){let e=this.top;if(e&&!(e.chat&&this.stopChat(e))){if(this.stack.length>1)return this.pop();if(e.query)return this.setQuery("");this.close()}}openPanel(){let e=this.top;if(!e||!this.dom)return;if(this.panel)return this.closePanel();let t=this.selectedItem(e),i=this.actionsFor(t,e);i.length&&(this.panel={item:t,actions:i,filter:"",selected:0},this.renderPanel())}closePanel(){this.panel&&(this.panel.el?.remove(),this.panel=void 0,this.focusInput())}panelActions(){let e=this.panel;return e.filter?L(e.actions,e.filter).map(t=>t.item):e.actions}onPanelKey(e){let t=this.panel,i=this.panelActions();if(e.key==="Escape"||E(e,this.actionsHotkey))return this.closePanel(),!0;if(e.key==="ArrowDown"||e.ctrlKey&&e.key==="n")return t.selected=(t.selected+1)%Math.max(1,i.length),this.renderPanel(),!0;if(e.key==="ArrowUp"||e.ctrlKey&&e.key==="p")return t.selected=(t.selected-1+i.length)%Math.max(1,i.length),this.renderPanel(),!0;if(e.key==="Enter"){let r=i[t.selected];return r&&this.runFromPanel(r),!0}for(let r of t.actions)if(r.shortcut&&E(e,r.shortcut))return this.runFromPanel(r),!0;return!1}runFromPanel(e){let t=this.panel?.item,i=this.top;this.closePanel(),this.runAction(i,t,e)}renderPanel(){let e=this.panel,t=this.dom;if(!e||!t)return;e.el||(e.list=u("div",{class:"qb-actions-list",role:"listbox",id:`${this.instanceId}-actions`}),e.input=u("input",{class:"qb-actions-input",placeholder:"Search for actions\u2026","aria-label":"Search actions",autocomplete:"off",spellcheck:"false",onInput:()=>{e.filter=e.input.value,e.selected=0,this.renderPanel()}}),e.el=u("div",{class:this.cls("qb-actions","actions"),role:"dialog","aria-label":"Actions"},u("div",{class:"qb-actions-title"},e.item?.title??"Actions"),e.list,e.input),e.el.addEventListener("pointerdown",o=>{o.target!==e.input&&o.preventDefault()}),t.dialog.append(e.el),e.input.focus());let i=this.panelActions();e.selected=Math.min(e.selected,Math.max(0,i.length-1));let r=[],n;i.forEach((o,a)=>{!e.filter&&o.section&&o.section!==n&&r.push(u("div",{class:"qb-section"},o.section)),n=o.section;let c=o.shortcut??(a===0&&!e.filter?"enter":a===1&&!e.filter?"mod+enter":void 0),l=u("div",{class:"qb-action",role:"option",id:`${this.instanceId}-action-${a}`,"aria-selected":a===e.selected?"true":"false","data-style":o.style??"default",onClick:()=>this.runFromPanel(o),onPointermove:()=>{e.selected!==a&&(e.selected=a,this.renderPanel())}},k(o.icon??"dot",15),u("span",{class:"qb-action-title"},o.title),c?R(c):null);r.push(l)}),i.length||r.push(u("div",{class:"qb-empty-desc",style:"padding:10px 8px"},"No matching actions")),e.list.replaceChildren(...r),e.input.setAttribute("aria-activedescendant",`${this.instanceId}-action-${e.selected}`),e.list.querySelector("[aria-selected=true]")?.scrollIntoView({block:"nearest"})}cls(e,t){let i=this.config.classNames?.[t];return i?`${e} ${i}`:e}injectStyles(){if(this.config.unstyled||typeof document>"u"||document.getElementById("qikbar-styles"))return;let t=document.createElement("style");t.id="qikbar-styles",this.config.nonce&&(t.nonce=this.config.nonce),t.textContent=me,document.head.append(t),this.styleEl=t}mount(){if(this.dom||typeof document>"u")return;this.injectStyles();let e=this.instanceId,t=u("input",{class:this.cls("qb-input","input"),type:"text",role:"combobox",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",enterkeyhint:"go","aria-autocomplete":"list","aria-expanded":"true","aria-controls":`${e}-list`,"aria-label":"Search"});t.addEventListener("input",()=>{let y=this.top;y&&this.onQueryChange(y,t.value)});let i=u("button",{class:"qb-back",type:"button","aria-label":"Back",title:"Back",html:""});i.append(k("arrow-left",15)),i.addEventListener("click",()=>this.pop());let r=u("button",{class:"qb-hint",type:"button"});r.addEventListener("click",()=>this.ask(this.top?.query));let n=u("div",{class:"qb-progress","aria-hidden":"true"}),o=u("div",{class:this.cls("qb-header","header")},i,u("div",{class:"qb-crumb"}),u("span",{class:"qb-header-icon"},k("search",18)),t,u("div",{class:"qb-args",style:"display:contents"}),u("div",{class:"qb-title"}),r,n),a=u("div",{class:"qb-body"}),c=u("div",{class:"qb-footer-left","aria-live":"polite"}),l=u("div",{class:"qb-footer-right"}),h=u("div",{class:this.cls("qb-footer","footer")},c,l),d=u("div",{style:"display:contents"}),p=u("div",{class:this.cls("qb-dialog","dialog"),role:"dialog","aria-modal":this.isInline?"false":"true","aria-label":"Command bar",tabindex:"-1",hidden:!0},o,a,h,d),g=u("div",{class:this.cls("qb-overlay","overlay"),hidden:!0});g.addEventListener("pointerdown",y=>{y.preventDefault(),this.close()});let f=u("div",{class:"qb-sr-only","aria-live":"polite"}),b=u("div",{class:this.cls("qb-root","root"),"data-qb-state":"closed",id:e},g,p,f);this.config.dir&&(b.dir=this.config.dir),p.addEventListener("keydown",this.onDialogKeyDown),p.addEventListener("click",y=>{let x=y.target.closest?.("[data-qb-copy]");if(x){let A=x.closest(".qb-code")?.querySelector("code")?.textContent??"";N(A).then(Pt=>{x.textContent=Pt?"Copied":"Failed",setTimeout(()=>x.textContent="Copy",1200)})}this.panel&&!y.target.closest?.(".qb-actions")&&!y.target.closest?.(".qb-footer-btn")&&this.closePanel()});let v=this.inlineTarget();v?(b.dataset.qbInline="",v.append(b)):(this.config.container??document.body).append(b),this.dom={root:b,overlay:g,dialog:p,header:o,back:i,crumb:o.querySelector(".qb-crumb"),searchIcon:o.querySelector(".qb-header-icon"),input:t,args:o.querySelector(".qb-args"),title:o.querySelector(".qb-title"),hint:r,progress:n,body:a,footer:h,footerLeft:c,footerRight:l,layer:d,live:f},this.applyTheme(),this.watchAppearance(),this.listen(document,"focusin",(y=>{this._open&&!this.isInline&&this.dom&&!this.dom.root.contains(y.target)&&this.focusInput()}))}applyClassNames(){let e=this.dom;e&&(e.root.className=this.cls("qb-root","root"),e.overlay.className=this.cls("qb-overlay","overlay"),e.dialog.className=this.cls("qb-dialog","dialog"),e.header.className=this.cls("qb-header","header"),e.input.className=this.cls("qb-input","input"),e.footer.className=this.cls("qb-footer","footer"),this.renderer&&(this.renderer.destroy(),this.renderer=void 0,this.flush()))}resolveAppearance(){let e=this.config.appearance??"auto";if(typeof e=="function")return e();if(e!=="auto")return e;let t=document.documentElement,i=document.body,r=a=>!!a&&(a.classList.contains("dark")||a.dataset.theme==="dark"||a.dataset.mode==="dark"||a.dataset.colorScheme==="dark"||a.dataset.bsTheme==="dark"),n=a=>!!a&&(a.classList.contains("light")||a.dataset.theme==="light"||a.dataset.mode==="light"||a.dataset.colorScheme==="light"||a.dataset.bsTheme==="light");if(r(t)||r(i))return"dark";if(n(t)||n(i))return"light";let o=t.style.colorScheme||getComputedStyle(t).colorScheme;return o==="dark"?"dark":o==="light"?"light":typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}applyTheme(){let e=this.dom?.root;if(!e)return;let{vars:t,appearance:i}=ue(this.config.theme,this.resolveAppearance());e.dataset.qbAppearance=i;let r=typeof this.config.theme=="string"?this.config.theme:this.config.theme?.preset;r?e.dataset.qbTheme=r:delete e.dataset.qbTheme;for(let n of this.appliedVars)e.style.removeProperty(n);this.appliedVars=[];for(let[n,o]of Object.entries(t)){if(o==null||o==="")continue;let a=K(n);e.style.setProperty(a,o),this.appliedVars.push(a)}}watchAppearance(){if(typeof MutationObserver>"u")return;let e=()=>{this.dom&&(this.config.appearance??"auto")==="auto"&&this.applyTheme()},t=new MutationObserver(e);if(t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","data-mode","data-color-scheme","data-bs-theme","style"]}),document.body&&t.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme","data-mode"]}),this.teardown.push(()=>t.disconnect()),typeof matchMedia<"u"){let i=matchMedia("(prefers-color-scheme: dark)");i.addEventListener?.("change",e),this.teardown.push(()=>i.removeEventListener?.("change",e))}}lockScroll(){let e=document.documentElement,t=window.innerWidth-e.clientWidth;this.scrollLock={overflow:e.style.overflow,paddingRight:e.style.paddingRight},e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`)}unlockScroll(){if(!this.scrollLock)return;let e=document.documentElement;e.style.overflow=this.scrollLock.overflow,e.style.paddingRight=this.scrollLock.paddingRight,this.scrollLock=void 0}focusInput(){if(!this.dom||!this._open)return;let e=this.renderer?.focusTarget?.()??(this.dom.input.hidden?this.dom.dialog:this.dom.input);document.activeElement!==e&&e.focus({preventScroll:!0})}invalidate(){this.scheduled||!this.dom||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.flush()}))}flush(){let e=this.dom,t=this.top;!e||!t||!this._open&&!this.isInline||(!this.renderer||this.renderer.frame!==t?(this.renderer?.destroy(),this.renderer=this.createRenderer(t),e.body.replaceChildren(this.renderer.el),this.renderer.update(),t.scrollTop&&this.renderer.restoreScroll(t.scrollTop),t.selected>0&&this.renderer.ensureVisible?.()):this.renderer.update(),this.renderHeader(t),this.renderFooter(t),this.renderLayer(),this.panel&&this.renderPanel())}createRenderer(e){switch(e.view.type){case"grid":return new ge(this,e);case"detail":return new be(this,e);case"form":return new ye(this,e);case"chat":return new ve(this,e);default:return new te(this,e)}}renderHeader(e){let t=this.dom,i=e.view,r=this.stack.length,n=this.renderer?.hasInput??!0;t.back.hidden=r<=1;let o=r>1?i.title??(i.type==="chat"?this.aiName:void 0):void 0;if(t.crumb.hidden=!o||!n,o&&n&&t.crumb.replaceChildren(...[k(e.ext?.ext.icon,13),u("span",null,o)].filter(Boolean)),t.searchIcon.hidden=r>1||!!this.argMode,this.argMode){let l=this.argMode;if(t.input.hidden=!0,t.title.hidden=!0,t.args.dataset.for!==this.idOf(l.item)){t.args.dataset.for=this.idOf(l.item);let h=(l.item.arguments??[]).map(d=>{if(d.type==="dropdown"){let g=u("select",{class:"qb-arg",name:d.name,"aria-label":d.placeholder??d.name},...(d.options??[]).map(f=>u("option",{value:f.value},f.title)));return l.values[d.name]=g.value,g.addEventListener("change",()=>l.values[d.name]=g.value),g}let p=u("input",{class:"qb-arg",name:d.name,type:d.type==="password"?"password":"text",placeholder:`${d.placeholder??d.name}${d.required?"":" (optional)"}`,"aria-label":d.placeholder??d.name,autocomplete:"off",spellcheck:"false"});return p.addEventListener("input",()=>l.values[d.name]=p.value),p});t.args.replaceChildren(u("span",{class:"qb-arg-cmd"},k(l.item.icon,16),l.item.title),...h)}t.args.hidden=!1}else{t.args.hidden=!0,delete t.args.dataset.for,t.args.replaceChildren(),t.input.hidden=!n,t.title.hidden=n,n||(t.title.textContent=i.title??"");let l=this.renderer?.placeholder?.()??i.placeholder??(i.type==="root"?this.config.placeholder??"Search for commands, pages and more\u2026":"Search\u2026");t.input.placeholder!==l&&(t.input.placeholder=l),t.input.value!==e.query&&(t.input.value=e.query)}let a=e.itemRows[e.selected];a&&(i.type==="root"||i.type==="list"||i.type==="grid")?t.input.setAttribute("aria-activedescendant",`${this.instanceId}-opt-${a.key.replace(/[^\w-]/g,"_")}`):t.input.removeAttribute("aria-activedescendant");let c=!!this.ai&&i.type==="root"&&!this.argMode&&this.aiOptions?.fallback!==!1;t.hint.hidden=!c,c&&!t.hint.childElementCount&&t.hint.append(u("span",null,`Ask ${this.aiName}`),R("tab")),e.loading>0?t.progress.dataset.active="":delete t.progress.dataset.active}renderFooter(e){let t=this.dom;!this.toastState||!this._open?this.renderFooterLeft(e):this.renderToast();let i=[],r=this.renderer?.footerPrimary?.(),n=this.actionsFor(this.selectedItem(e),e),o=r??(n[0]?{title:n[0].title,hotkey:"enter",run:()=>this.runPrimary(e)}:void 0);this.argMode?i.push(this.footerButton(`Run ${this.argMode.item.title}`,"enter",()=>this.submitArgs(),!0)):o&&i.push(this.footerButton(o.title,o.hotkey,o.run,!0)),n.length>(r?0:1)&&!this.argMode&&i.push(u("span",{class:"qb-footer-sep"}),this.footerButton("Actions",this.actionsHotkey,()=>this.openPanel())),t.footerRight.replaceChildren(...i)}renderFooterLeft(e){let t=this.dom,i=e.view,r=[];if(this.stack.length>1&&i.title){let n=k(e.ext?.ext.icon??"layers",14);n&&r.push(n),r.push(u("span",null,i.title))}else if(this.config.footer)r.push(u("span",null,this.config.footer));else if(this.config.branding){let n=u("a",{class:"qb-brand",href:"https://qikbar.com",target:"_blank",rel:"noopener"},k("command",13),"qikbar");r.push(n)}t.footerLeft.replaceChildren(...r)}footerButton(e,t,i,r=!1){let n=u("button",{class:`qb-footer-btn${r?" qb-primary":""}`,type:"button"},u("span",null,e),R(t));return n.addEventListener("pointerdown",o=>o.preventDefault()),n.addEventListener("click",i),n}renderToast(){let e=this.toastState,t=r=>r==="success"?"check-circle":r==="failure"?"x-circle":r==="loading"?"loader":"info",i=r=>{let n=k(t(e.style),14);return e.style==="loading"&&n.classList.add("qb-spin"),u("div",{class:this.cls(r,"toast"),"data-style":e.style??"info",role:"status"},n,u("span",{class:"qb-toast-title"},e.title),e.message?u("span",{class:"qb-toast-msg"},e.message):null)};if(this._open&&this.dom){this.hud?.remove(),this.hud=void 0,e?this.dom.footerLeft.replaceChildren(i("qb-toast")):this.top&&this.renderFooterLeft(this.top);return}typeof document>"u"||(this.mount(),this.hud?.remove(),this.hud=void 0,!(!e||!this.dom)&&(this.applyTheme(),this.hud=i("qb-hud"),this.dom.root.append(this.hud)))}renderLayer(){let e=this.dom;if(!e)return;let t=this.confirmState;if(!t){e.layer.replaceChildren();return}if(e.layer.firstChild)return;let i=u("button",{class:"qb-btn",type:"button"},t.cancelLabel??"Cancel"),r=u("button",{class:`qb-btn ${t.destructive?"qb-btn-danger":"qb-btn-primary"}`,type:"button"},t.confirmLabel??"Confirm",R("enter"));i.addEventListener("click",()=>t.resolve(!1)),r.addEventListener("click",()=>t.resolve(!0)),r.addEventListener("keydown",n=>{n.key==="Enter"&&(n.preventDefault(),t.resolve(!0))}),e.layer.append(u("div",{class:"qb-confirm-layer"},u("div",{class:"qb-confirm",role:"alertdialog","aria-modal":"true","aria-label":t.title},u("div",{class:"qb-confirm-title"},t.title),t.message?u("div",{class:"qb-confirm-msg"},t.message):null,u("div",{class:"qb-confirm-buttons"},i,r)))),r.focus()}announce(e){this.dom&&(this.dom.live.textContent=e)}}});var Ti={};we(Ti,{Frecency:()=>D,SequenceMatcher:()=>z,action:()=>M,anthropic:()=>J,baseDark:()=>pe,baseLight:()=>he,browserAI:()=>Te,byok:()=>Se,chat:()=>et,copyText:()=>N,createQikbar:()=>fi,css:()=>me,cssVarName:()=>K,defaultNavigate:()=>ee,defaultStorage:()=>P,defineCommands:()=>tt,defineExtension:()=>ke,defineSource:()=>it,defineTool:()=>rt,detail:()=>Xe,escapeHtml:()=>I,extensions:()=>Qe,form:()=>Ze,formatHotkey:()=>$,fuzzyMatch:()=>F,gemini:()=>Y,grid:()=>Ye,iconSvg:()=>ce,icons:()=>$e,isEditable:()=>j,isMac:()=>C,list:()=>Je,matchItem:()=>Z,matchesHotkey:()=>E,memoryStorage:()=>ae,normalize:()=>T,ollama:()=>Ee,openai:()=>_,openaiCompatible:()=>Me,parseHotkey:()=>O,presets:()=>Ve,proxy:()=>Ae,rank:()=>L,renderMarkdown:()=>S,resolveThemeVars:()=>ue,scopedStorage:()=>Q,themeToCss:()=>wt,version:()=>mi});H();var se=class{constructor(e,t){m(this,"loader",t);m(this,"bar");m(this,"loading");m(this,"queue",[]);m(this,"config");m(this,"teardown",[]);m(this,"destroyed",!1);if(this.config={...e},typeof document>"u")return;if(e.inline){this.load();return}let i=o=>{let a=this.config.hotkey===!1?[]:[].concat(this.config.hotkey??"mod+k"),c=j(o.target);!this.bar&&a.some(l=>E(o,l)&&(!c||U(l)))&&(o.preventDefault(),this.open())},r=o=>{let a=o.target?.closest?.("[data-qikbar-open]");if(!a||this.bar)return;let c=a.getAttribute("data-qikbar-open");c&&c!==this.config.namespace||(o.preventDefault(),this.open({query:a.getAttribute("data-qikbar-query")??void 0}))};document.addEventListener("keydown",i,!0),document.addEventListener("click",r,!0),this.teardown.push(()=>{document.removeEventListener("keydown",i,!0),document.removeEventListener("click",r,!0)});let n=globalThis.requestIdleCallback;n?n(()=>{this.load()},{timeout:2500}):setTimeout(()=>{this.load()},1200)}preload(){return this.load().then(()=>{})}load(){return this.loading??(this.loading=this.loader().then(({Bar:e})=>{if(this.destroyed)throw new Error("destroyed");for(let r of this.teardown)r();this.teardown=[];let t=new e(this.config);this.bar=t;let i=this.queue;this.queue=[];for(let r of i)r(t);return t})),this.loading.catch(e=>{this.destroyed||console.error("[qikbar] failed to load UI",e)}),this.loading}run(e){this.bar?e(this.bar):(this.queue.push(e),this.load())}disposable(e){if(this.bar)return e(this.bar);let t,i=!1;return this.queue.push(r=>{i||(t=e(r))}),()=>{i=!0,t?.()}}get isOpen(){return this.bar?.isOpen??!1}get query(){return this.bar?.query??""}get ai(){return this.bar?.ai}open(e){this.run(t=>t.open(e))}close(){this.bar?.close()}toggle(){this.bar?this.bar.toggle():this.open()}register(e){return this.disposable(t=>t.register(e))}addSource(e){return this.disposable(t=>t.addSource(e))}use(e,t){return this.disposable(i=>i.use(e,t))}configure(e){this.bar?this.bar.configure(e):this.config={...this.config,...e}}push(e){this.run(t=>t.push(e))}pop(){this.bar?.pop()}setQuery(e){this.run(t=>t.setQuery(e))}ask(e){this.run(t=>t.ask(e))}toast(e){if(this.bar)return this.bar.toast(e);let t,i=[];return this.run(r=>{t=r.toast(e);for(let n of i)n(t)}),{update:r=>t?t.update(r):i.push(n=>n.update(r)),hide:()=>t?t.hide():i.push(r=>r.hide())}}commands(){return this.bar?.commands()??[]}on(e,t){return this.disposable(i=>i.on(e,t))}destroy(){this.destroyed=!0;for(let e of this.teardown)e();this.teardown=[],this.queue=[],this.bar?.destroy()}};oe();H();W();async function*nt(s){if(!s.body)return;let e=s.body.getReader(),t=new TextDecoder,i="";try{for(;;){let{value:r,done:n}=await e.read();if(n)break;i+=t.decode(r,{stream:!0});let o;for(;(o=i.indexOf(`
244
+ `))>=0;){let a=i.slice(0,o).replace(/\r$/,"");i=i.slice(o+1),yield a}}i+=t.decode(),i&&(yield i)}finally{e.releaseLock()}}async function*le(s){let e,t=[];for await(let i of nt(s))i===""?(t.length&&(yield{event:e,data:t.join(`
245
+ `)}),e=void 0,t=[]):i.startsWith("data:")?t.push(i.slice(i[5]===" "?6:5)):i.startsWith("event:")&&(e=i.slice(6).trim());t.length&&(yield{event:e,data:t.join(`
246
+ `)})}async function*st(s){for await(let e of nt(s))e.trim()&&(yield JSON.parse(e))}async function G(s,e){let t="";try{let i=await s.text();try{let r=JSON.parse(i);t=r?.error?.message??r?.message??r?.error??i}catch{t=i}}catch{}return new Error(`${e} ${s.status}: ${String(t||s.statusText).slice(0,300)}`)}var Wt=0,ot=()=>`call_${Date.now().toString(36)}${(Wt++).toString(36)}`;function at(s){if(!s.trim())return{args:{}};try{let e=JSON.parse(s);return e&&typeof e=="object"&&!Array.isArray(e)?{args:e}:{args:{},error:"Tool arguments must be a JSON object."}}catch{return{args:{},error:`Invalid JSON arguments: ${s.slice(0,200)}`}}}var Gt=/claude-(opus|sonnet|haiku|fable|mythos)-5|claude-opus-4-[5-8]/,Jt=/^claude-(opus-5|opus-5-5|sonnet-5-5|fable-5-1)$/;function J(s={}){let e=s.model??"claude-opus-5-5",t=(s.baseURL??"https://api.anthropic.com").replace(/\/$/,""),i=s.fetch??((...n)=>fetch(...n));function r(n){let o=[];for(let a of n)if(a.role==="user")o.push({role:"user",content:a.content});else if(a.role==="assistant")if(a.raw?.provider==="anthropic")o.push({role:"assistant",content:a.raw.data});else{let c=[];a.content&&c.push({type:"text",text:a.content});for(let l of a.toolCalls??[])c.push({type:"tool_use",id:l.id,name:l.name,input:l.args});o.push({role:"assistant",content:c.length?c:a.content||"\u2026"})}else{let c={type:"tool_result",tool_use_id:a.toolCallId,content:a.content,...a.isError?{is_error:!0}:{}},l=o[o.length-1];l?.role==="user"&&Array.isArray(l.content)&&l.content[0]?.type==="tool_result"?l.content.push(c):o.push({role:"user",content:[c]})}return o}return{id:"anthropic",model:e,async*stream(n){let o={"content-type":"application/json","anthropic-version":"2023-06-01",...s.headers};s.apiKey&&(o["x-api-key"]=s.apiKey,o["anthropic-dangerous-direct-browser-access"]="true");let a={model:e,max_tokens:n.maxTokens??s.maxTokens??16e3,stream:!0,messages:r(n.messages)};n.system&&(a.system=n.system),n.tools?.length&&(a.tools=n.tools.map(b=>({name:b.name,description:b.description,input_schema:b.parameters,eager_input_streaming:!0})));let c=s.effort===void 0?Gt.test(e)?"low":!1:s.effort;c&&(a.output_config={effort:c}),s.fallbacks!==!1&&Jt.test(e)&&!s.baseURL&&(a.fallbacks="default",o["anthropic-beta"]=[o["anthropic-beta"],"server-side-fallback-2026-07-01"].filter(Boolean).join(","));let l=await i(`${t}/v1/messages`,{method:"POST",headers:o,body:JSON.stringify(a),signal:n.signal});if(!l.ok)throw await G(l,"Anthropic");let h={},d,p="";for await(let b of le(l)){if(!b.data||b.data==="[DONE]")continue;let v=JSON.parse(b.data);switch(v.type){case"content_block_start":{let y={...v.content_block};y.type==="tool_use"&&(y._json=""),h[v.index]=y,y.type==="text"&&y.text&&(p+=y.text,yield{type:"text",text:y.text});break}case"content_block_delta":{let y=h[v.index],x=v.delta;if(!y)break;x.type==="text_delta"?(y.text=(y.text??"")+x.text,p+=x.text,yield{type:"text",text:x.text}):x.type==="input_json_delta"?y._json+=x.partial_json:x.type==="thinking_delta"?y.thinking=(y.thinking??"")+x.thinking:x.type==="signature_delta"&&(y.signature=x.signature);break}case"content_block_stop":{let y=h[v.index];if(y?.type==="tool_use"){let{args:x,error:A}=at(y._json);y.input=x,A&&(y._error=A),delete y._json}break}case"message_delta":v.delta?.stop_reason&&(d=v.delta.stop_reason);break;case"error":throw new Error(`Anthropic: ${v.error?.message??"stream error"}`)}}let g=Object.keys(h).map(Number).sort((b,v)=>b-v).map(b=>h[b]),f=[];if(d!=="max_tokens"&&d!=="refusal")for(let b of g){if(b.type!=="tool_use")continue;let v={id:b.id,name:b.name,args:b.input??{}};b._error&&(v.error=b._error),f.push(v),yield{type:"tool_call",call:v}}for(let b of g)delete b._error;d==="refusal"&&(yield{type:"error",error:"The model declined to answer this request."}),yield{type:"done",stopReason:d,message:{role:"assistant",content:p,toolCalls:f.length?f:void 0,raw:{provider:"anthropic",data:g}}}}}}function _(s={}){let e=s.model??"gpt-6-luna",t=(s.baseURL??"https://api.openai.com/v1").replace(/\/$/,""),i=s.fetch??((...n)=>fetch(...n));function r(n,o){let a=[];o&&a.push({role:"system",content:o});for(let c of n)c.role==="user"?a.push({role:"user",content:c.content}):c.role==="assistant"?a.push({role:"assistant",content:c.content||null,...c.toolCalls?.length?{tool_calls:c.toolCalls.map(l=>({id:l.id,type:"function",function:{name:l.name,arguments:JSON.stringify(l.args)}}))}:{}}):a.push({role:"tool",tool_call_id:c.toolCallId,content:c.content});return a}return{id:s.id??"openai",model:e,tools:s.tools??!0,async*stream(n){let o={model:e,stream:!0,messages:r(n.messages,n.system)},a=n.maxTokens??s.maxTokens;a&&(o.max_completion_tokens=a),n.tools?.length&&s.tools!==!1&&(o.tools=n.tools.map(g=>({type:"function",function:{name:g.name,description:g.description,parameters:g.parameters}})));let c=await i(`${t}/chat/completions`,{method:"POST",headers:{"content-type":"application/json",...s.apiKey?{authorization:`Bearer ${s.apiKey}`}:{},...s.headers},body:JSON.stringify(o),signal:n.signal});if(!c.ok)throw await G(c,s.id??"OpenAI");let l="",h,d=[];for await(let g of le(c)){if(!g.data||g.data==="[DONE]")continue;let f=JSON.parse(g.data);if(f.error)throw new Error(`${s.id??"OpenAI"}: ${f.error.message??f.error}`);let b=f.choices?.[0];if(!b)continue;let v=b.delta??{};typeof v.content=="string"&&v.content&&(l+=v.content,yield{type:"text",text:v.content});for(let y of v.tool_calls??[]){let x=y.index??0;d[x]??(d[x]={id:y.id??ot(),name:"",json:""}),y.id&&(d[x].id=y.id),y.function?.name&&(d[x].name+=y.function.name),y.function?.arguments&&(d[x].json+=y.function.arguments)}b.finish_reason&&(h=b.finish_reason)}let p=[];if(h!=="length"&&h!=="content_filter")for(let g of d.filter(Boolean)){let{args:f,error:b}=at(g.json),v={id:g.id,name:g.name,args:f,...b?{error:b}:{}};p.push(v),yield{type:"tool_call",call:v}}h==="content_filter"&&(yield{type:"error",error:"The response was blocked by the provider\u2019s content filter."}),yield{type:"done",stopReason:h,message:{role:"assistant",content:l,toolCalls:p.length?p:void 0}}}}}function Me(s){return _({id:"openai-compatible",...s})}function Ee(s={model:"llama3.2"}){return _({id:"ollama",baseURL:s.baseURL??"http://localhost:11434/v1",model:s.model,tools:s.tools})}function qe(s){let{additionalProperties:e,$schema:t,default:i,...r}=s,n={...r};return r.properties&&(n.properties=Object.fromEntries(Object.entries(r.properties).map(([o,a])=>[o,qe(a)]))),r.items&&(n.items=qe(r.items)),n}function Y(s={}){let e=s.model??"gemini-flash-latest",t=(s.baseURL??"https://generativelanguage.googleapis.com/v1beta").replace(/\/$/,""),i=s.fetch??((...n)=>fetch(...n));function r(n){let o=[];for(let a of n)if(a.role==="user")o.push({role:"user",parts:[{text:a.content}]});else if(a.role==="assistant")if(a.raw?.provider==="gemini")o.push({role:"model",parts:a.raw.data});else{let c=[];a.content&&c.push({text:a.content});for(let l of a.toolCalls??[])c.push({functionCall:{name:l.name,args:l.args}});o.push({role:"model",parts:c.length?c:[{text:""}]})}else{let c={functionResponse:{name:a.toolName??"tool",response:a.isError?{error:a.content}:{result:a.content}}},l=o[o.length-1];l?.role==="user"&&l.parts[0]?.functionResponse?l.parts.push(c):o.push({role:"user",parts:[c]})}return o}return{id:"gemini",model:e,async*stream(n){let o={contents:r(n.messages)};n.system&&(o.systemInstruction={parts:[{text:n.system}]}),n.tools?.length&&(o.tools=[{functionDeclarations:n.tools.map(g=>({name:g.name,description:g.description,...g.parameters?.properties&&Object.keys(g.parameters.properties).length?{parameters:qe(g.parameters)}:{}}))}]);let a=n.maxTokens??s.maxTokens;a&&(o.generationConfig={maxOutputTokens:a});let c=await i(`${t}/models/${encodeURIComponent(e)}:streamGenerateContent?alt=sse`,{method:"POST",headers:{"content-type":"application/json",...s.apiKey?{"x-goog-api-key":s.apiKey}:{},...s.headers},body:JSON.stringify(o),signal:n.signal});if(!c.ok)throw await G(c,"Gemini");let l="",h,d=[],p=[];for await(let g of le(c)){if(!g.data)continue;let f=JSON.parse(g.data);if(f.error)throw new Error(`Gemini: ${f.error.message}`);if(f.promptFeedback?.blockReason){yield{type:"error",error:`Blocked by Gemini (${f.promptFeedback.blockReason}).`};continue}let b=f.candidates?.[0];if(b){for(let v of b.content?.parts??[])if(v.functionCall){d.push(v);let y={id:v.functionCall.id??ot(),name:v.functionCall.name,args:v.functionCall.args??{}};p.push(y)}else if(typeof v.text=="string"){let y=d[d.length-1];!v.thought&&y&&typeof y.text=="string"&&!y.thought&&!y.thoughtSignature&&!v.thoughtSignature?y.text+=v.text:d.push({...v}),!v.thought&&v.text&&(l+=v.text,yield{type:"text",text:v.text})}else d.push(v);b.finishReason&&(h=b.finishReason)}}if(h!=="MAX_TOKENS")for(let g of p)yield{type:"tool_call",call:g};h==="SAFETY"&&(yield{type:"error",error:"The response was blocked by Gemini safety filters."}),yield{type:"done",stopReason:h,message:{role:"assistant",content:l,toolCalls:p.length&&h!=="MAX_TOKENS"?p:void 0,raw:{provider:"gemini",data:d}}}}}}var Te=Object.assign(function(){return{id:"browser",model:"on-device",tools:!1,async*stream(e){let t=globalThis.LanguageModel;if(!t)throw new Error("Built-in AI is not available in this browser.");let i=e.messages.filter(c=>c.role!=="tool"),r=i.pop(),n=[...e.system?[{role:"system",content:e.system}]:[],...i.map(c=>({role:c.role,content:c.content}))],o=await t.create({initialPrompts:n,signal:e.signal}),a="";try{let c=o.promptStreaming(r?.content??"",{signal:e.signal});for await(let l of c){let h=l.startsWith(a)&&a?l.slice(a.length):l;a+=h,h&&(yield{type:"text",text:h})}}finally{o.destroy?.()}yield{type:"done",message:{role:"assistant",content:a}}}}},{async isAvailable(){let s=globalThis.LanguageModel;if(!s?.availability)return!1;try{return await s.availability()!=="unavailable"}catch{return!1}}});function Ae(s){let e=typeof s=="string"?{url:s}:s,t=e.fetch??((...i)=>fetch(...i));return{id:"proxy",async*stream(i){let r=typeof e.headers=="function"?await e.headers():e.headers,n=await t(e.url,{method:"POST",headers:{"content-type":"application/json",accept:"application/x-ndjson",...r},credentials:e.credentials??"same-origin",body:JSON.stringify({messages:i.messages,system:i.system,tools:i.tools,maxTokens:i.maxTokens}),signal:i.signal});if(!n.ok)throw await G(n,"AI proxy");yield*st(n)}}}W();var lt={anthropic:"Anthropic (Claude)",openai:"OpenAI",gemini:"Google Gemini","openai-compatible":"OpenAI-compatible (OpenRouter, Groq, Ollama\u2026)"};function Ie(s,e){try{let t=s.getItem(e);return t?JSON.parse(t):void 0}catch{return}}var Se=Object.assign(function(e={}){let t=e.storage??P(),i=e.key??"qikbar:byok";return{id:"byok",get model(){return Ie(t,i)?.model},async*stream(r){let n=Ie(t,i);if(!n?.apiKey&&n?.vendor!=="openai-compatible"){yield{type:"error",error:"Add your AI API key first: search for \u201CAI Settings\u201D in the command bar."},yield{type:"done",message:{role:"assistant",content:""}};return}yield*(n.vendor==="anthropic"?J({apiKey:n.apiKey,model:n.model||void 0}):n.vendor==="gemini"?Y({apiKey:n.apiKey,model:n.model||void 0}):_({apiKey:n.apiKey||void 0,model:n.model||void 0,baseURL:n.baseURL||void 0})).stream(r)}}},{settings:Yt});function Yt(s={}){let e=s.storage??P(),t=s.key??"qikbar:byok",i=s.vendors??Object.keys(lt);return{name:"qikbar-ai-settings",title:"AI",icon:"key",commands:[{name:"settings",title:"AI Settings",subtitle:"Use your own API key",keywords:["api key","openai","anthropic","claude","gemini","model","byok"],icon:"key",view:()=>{let r=Ie(e,t);return{type:"form",title:"AI Settings",submitLabel:"Save",fields:[{name:"vendor",label:"Provider",type:"select",options:i.map(n=>({title:lt[n],value:n})),defaultValue:r?.vendor??i[0]},{name:"apiKey",label:"API key",type:"password",placeholder:"Stored only in this browser",defaultValue:r?.apiKey??"",description:"Your key never leaves your browser except to call the provider directly."},{name:"model",label:"Model",placeholder:"Leave empty for the default",defaultValue:r?.model??""},{name:"baseURL",label:"Base URL",placeholder:"Only for OpenAI-compatible APIs",defaultValue:r?.baseURL??""}],onSubmit(n,o){e.setItem(t,JSON.stringify(n)),o.toast({title:"AI settings saved",style:"success"})}}}},{name:"clear",title:"Remove AI API Key",icon:"trash",keywords:["byok","api key"],searchOnly:!0,async run(r){if(!await r.confirm({title:"Remove your API key?",destructive:!0,confirmLabel:"Remove"}))return!1;e.removeItem(t),r.toast({title:"API key removed",style:"success"})}}]}}function fi(s={}){return new se(s,()=>Promise.resolve().then(()=>(Lt(),Ct)))}var mi="0.1.0";fe();Ne();Oe();H();Ce();W();Ke();He();de();var Qe={};we(Qe,{aiActions:()=>qi,calculator:()=>xi,convert:()=>xe,evaluate:()=>ie,formatNumber:()=>re,page:()=>ki,shortcutLabel:()=>Ei,shortcuts:()=>Mi,themeSwitcher:()=>wi});oe();H();var Rt={pi:Math.PI,\u03C0:Math.PI,e:Math.E,tau:Math.PI*2,phi:(1+Math.sqrt(5))/2},gi={sqrt:Math.sqrt,cbrt:Math.cbrt,abs:Math.abs,round:(s,e=0)=>Math.round(s*10**e)/10**e,floor:Math.floor,ceil:Math.ceil,sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,log:Math.log10,log2:Math.log2,ln:Math.log,exp:Math.exp,min:Math.min,max:Math.max};function bi(s){let e=[],t=0,i=s.replace(/×/g,"*").replace(/÷/g,"/").replace(/−/g,"-");for(;t<i.length;){let r=i[t];if(/\s/.test(r)){t++;continue}let n=i.slice(t).match(/^(\d[\d_]*(\.\d+)?|\.\d+)(e[+-]?\d+)?/i);if(n){e.push({t:"num",v:parseFloat(n[0].replace(/_/g,""))}),t+=n[0].length;continue}if(i.startsWith("**",t)){e.push({t:"op",v:"^"}),t+=2;continue}if("+-*/^".includes(r)){e.push({t:"op",v:r}),t++;continue}if(r==="%"){e.push({t:"%"}),t++;continue}if(r==="("||r===")"||r===","){e.push({t:r}),t++;continue}let o=i.slice(t).match(/^[a-zπ][a-z0-9_]*/i);if(o){e.push({t:"id",v:o[0].toLowerCase()}),t+=o[0].length;continue}throw new Error(`Unexpected "${r}"`)}return e}var Ue=class{constructor(e){m(this,"tokens",e);m(this,"i",0)}peek(){return this.tokens[this.i]}next(){return this.tokens[this.i++]}parse(){let e=this.expr();if(this.i<this.tokens.length)throw new Error("Unexpected input");return e}expr(){let e=this.term();for(;;){let t=this.peek();if(t?.t==="op"&&(t.v==="+"||t.v==="-")){this.next();let i=this.i,r=this.term();this.isBarePercent(i)&&(r=e*r),e=t.v==="+"?e+r:e-r}else return e}}isBarePercent(e){return this.tokens[e]?.t==="num"&&this.tokens[e+1]?.t==="%"&&this.i===e+2}term(){let e=this.power();for(;;){let t=this.peek();if(t?.t==="op"&&(t.v==="*"||t.v==="/")){this.next();let i=this.power();e=t.v==="*"?e*i:e/i}else if(t&&(t.t==="num"||t.t==="("||t.t==="id"&&t.v!=="of"))e*=this.power();else if(t?.t==="id"&&t.v==="of")this.next(),e*=this.power();else return e}}power(){let e=this.unary(),t=this.peek();return t?.t==="op"&&t.v==="^"?(this.next(),e**this.power()):e}unary(){let e=this.peek();if(e?.t==="op"&&(e.v==="-"||e.v==="+")){this.next();let t=this.unary();return e.v==="-"?-t:t}return this.postfix()}postfix(){let e=this.primary();for(;this.peek()?.t==="%";)this.next(),e/=100;return e}primary(){let e=this.next();if(!e)throw new Error("Unexpected end");if(e.t==="num")return e.v;if(e.t==="("){let t=this.expr();if(this.next()?.t!==")")throw new Error("Missing )");return t}if(e.t==="id"){if(e.v in Rt)return Rt[e.v];let t=gi[e.v];if(t){if(this.peek()?.t!=="(")return t(this.power());this.next();let i=[this.expr()];for(;this.peek()?.t===",";)this.next(),i.push(this.expr());if(this.next()?.t!==")")throw new Error("Missing )");return t(...i)}throw new Error(`Unknown "${e.v}"`)}throw new Error("Unexpected token")}};function ie(s){let e=new Ue(bi(s)).parse();if(!Number.isFinite(e))throw new Error("Not a finite number");return e}var w=(s,e,t,...i)=>i.map(r=>[r,{dim:s,factor:e,label:t}]),Ot=new Map([...w("length",1,"m","m","meter","meters","metre","metres"),...w("length",1e3,"km","km","kilometer","kilometers","kilometre","kilometres"),...w("length",.01,"cm","cm","centimeter","centimeters"),...w("length",.001,"mm","mm","millimeter","millimeters"),...w("length",1609.344,"mi","mi","mile","miles"),...w("length",.3048,"ft","ft","foot","feet"),...w("length",.0254,"in","inch","inches"),...w("length",.9144,"yd","yd","yard","yards"),...w("mass",1,"kg","kg","kilogram","kilograms","kilo","kilos"),...w("mass",.001,"g","g","gram","grams"),...w("mass",.45359237,"lb","lb","lbs","pound","pounds"),...w("mass",.028349523125,"oz","oz","ounce","ounces"),...w("mass",6.35029318,"st","st","stone","stones"),...w("data",1,"B","b","byte","bytes"),...w("data",1024,"KB","kb","kib","kilobyte","kilobytes"),...w("data",1024**2,"MB","mb","mib","megabyte","megabytes"),...w("data",1024**3,"GB","gb","gib","gigabyte","gigabytes"),...w("data",1024**4,"TB","tb","tib","terabyte","terabytes"),...w("time",1,"s","s","sec","second","seconds"),...w("time",60,"min","min","mins","minute","minutes"),...w("time",3600,"h","h","hr","hrs","hour","hours"),...w("time",86400,"d","d","day","days"),...w("time",604800,"wk","wk","week","weeks"),...w("volume",1,"L","l","liter","liters","litre","litres"),...w("volume",.001,"mL","ml","milliliter","milliliters"),...w("volume",3.785411784,"gal","gal","gallon","gallons"),...w("volume",.2365882365,"cup","cup","cups"),...w("temp",1,"\xB0C","c","\xB0c","celsius"),...w("temp",1,"\xB0F","f","\xB0f","fahrenheit"),...w("temp",1,"K","k","kelvin")]);function yi(s,e){return e==="\xB0C"?s+273.15:e==="\xB0F"?(s-32)*5/9+273.15:s}function vi(s,e){return e==="\xB0C"?s-273.15:e==="\xB0F"?(s-273.15)*9/5+32:s}function xe(s){let e=s.trim().match(/^(.+?)\s*([a-z°]+)\s+(?:in|to|as|=)\s+([a-z°]+)$/i);if(!e)return;let t=Ot.get(e[2].toLowerCase()),i=Ot.get(e[3].toLowerCase());if(!t||!i||t.dim!==i.dim)return;let r=ie(e[1]);return t.dim==="temp"?{value:vi(yi(r,t.label),i.label),unit:i.label}:{value:r*t.factor/i.factor,unit:i.label}}function re(s){return Math.abs(s)>=1e15||Math.abs(s)<1e-6&&s!==0?s.toExponential(6).replace(/\.?0+e/,"e"):(Math.round(s*1e10)/1e10).toLocaleString(void 0,{maximumFractionDigits:10})}function $t(s){let e=s.trim();return!e||!/\d|pi|π/.test(e)||/^\d+(\.\d+)?$/.test(e)?!1:/[+\-*/^%×÷()]|\b(in|to)\b|\b(sqrt|sin|cos|tan|log|ln|abs|round|of)\b/i.test(e)}function xi(){return{name:"calculator",title:"Calculator",icon:"calculator",description:"Evaluate math and convert units as you type.",sources:[{id:"calculator",title:"Calculator",position:"top",debounce:0,search({query:s}){let e=s.trim().replace(/^=/,"");if(!$t(e))return[];let t;try{let r=xe(e);t=r?`${re(r.value)} ${r.unit}`:re(ie(e))}catch{return[]}let i=t.replace(/,/g,"");return[{id:"calculator:result",title:t,subtitle:`= ${e}`,icon:"calculator",noHistory:!0,accessories:[{text:"Copy",kbd:"enter"}],actions:[M.copy(i,{title:"Copy Result",shortcut:void 0}),M.copy(`${e} = ${t}`,{title:"Copy Equation",shortcut:"mod+shift+c"})]}]}}]}}function wi(s={}){let e=s.storageKey??"theme",t=s.set??(n=>{let o=n==="dark"||n==="system"&&matchMedia("(prefers-color-scheme: dark)").matches,a=document.documentElement;a.classList.toggle("dark",o),a.classList.toggle("light",!o),a.style.colorScheme=o?"dark":"light";try{n==="system"?localStorage.removeItem(e):localStorage.setItem(e,n)}catch{}}),i=()=>document.documentElement.classList.contains("dark")||document.documentElement.dataset.theme==="dark",r=(n,o)=>a=>{t(n),a.toast({title:o,style:"success",duration:1500})};return{name:"theme",title:"Appearance",icon:"palette",commands:[{name:"toggle",title:"Toggle Dark Mode",icon:"moon",keywords:["theme","light","dark","appearance","night"],shortcut:s.shortcut===!1?void 0:s.shortcut??"mod+shift+l",run:n=>r(i()?"light":"dark",i()?"Light mode":"Dark mode")(n)},{name:"light",title:"Use Light Theme",icon:"sun",keywords:["theme","appearance"],searchOnly:!0,run:r("light","Light mode")},{name:"dark",title:"Use Dark Theme",icon:"moon",keywords:["theme","appearance"],searchOnly:!0,run:r("dark","Dark mode")},{name:"system",title:"Use System Theme",icon:"monitor",keywords:["theme","appearance","auto"],searchOnly:!0,run:r("system","System theme")}]}}function ki(s={}){let e=s.headings??"h1[id], h2[id], h3[id]",t=(i,r,n,o,a={})=>({name:i,title:r,icon:n,searchOnly:!0,run:async c=>{await o(c)},...a});return{name:"page",title:"Page",icon:"file",commands:[t("back","Go Back","arrow-left",()=>history.back(),{keywords:["history","previous"]}),t("forward","Go Forward","arrow-right",()=>history.forward(),{keywords:["history","next"]}),t("reload","Reload Page","refresh",()=>location.reload(),{keywords:["refresh"]}),t("copy-url","Copy Page URL","link",async i=>{let r=await i.copy(location.href);i.toast({title:r?"Copied page URL":"Copy failed",style:r?"success":"failure"})},{keywords:["link","share","address"]}),t("top","Scroll to Top","arrow-up-right",()=>window.scrollTo({top:0,behavior:"smooth"})),t("bottom","Scroll to Bottom","chevron-down",()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:"smooth"})),t("print","Print Page","file-text",()=>setTimeout(()=>window.print(),150)),t("share","Share Page\u2026","send",()=>navigator.share?.({title:document.title,url:location.href}),{when:()=>typeof navigator<"u"&&"share"in navigator})],sources:e?[{id:"page-headings",title:"On This Page",debounce:0,filter:!0,limit:6,search(){let i=new Set;return[...document.querySelectorAll(e)].filter(r=>!r.closest(".qb-root")&&r.id&&!i.has(r.id)&&i.add(r.id)).map(r=>({id:`heading:${r.id}`,title:(r.textContent??"").replace(/\s+/g," ").trim(),subtitle:`#${r.id}`,icon:"hash",noHistory:!0,run:n=>{n.close(),history.replaceState(null,"",`#${r.id}`),r.scrollIntoView({behavior:"smooth",block:"start"})}}))}}]:[]}}function Ht(s=16e3){return(document.querySelector("main, [role=main], article")??document.body).innerText.replace(/\n{3,}/g,`
247
+
248
+ `).trim().slice(0,s)}function qi(){let s,e="",t=r=>r.ai?!1:(r.toast({title:"AI is not configured",style:"failure"}),!0),i=(r,n,o)=>{if(t(r))return!1;let a=r.ai.stream(o,{signal:r.signal});return{type:"detail",title:n,markdown:a,actions:[M.ask(`${o}
249
+
250
+ Let's discuss.`,{title:"Continue in Chat"})]}};return{name:"ai-actions",title:"AI",icon:"sparkles",setup({bar:r}){return s=r,r.on("open",()=>{e=typeof window<"u"?(window.getSelection()?.toString()??"").trim():""})},commands:[{name:"summarize-page",title:"Summarize This Page",icon:"sparkles",keywords:["tldr","summary","ai"],when:()=>!!s?.ai,run:r=>i(r,"Summary",`Summarize this web page in a few bullet points, then one sentence on what the reader should do next.
251
+
252
+ Title: ${document.title}
253
+
254
+ ${Ht()}`)},{name:"explain-selection",title:"Explain Selected Text",icon:"wand",keywords:["ai","selection","what does this mean"],when:()=>!!s?.ai&&!!e,run:r=>i(r,"Explanation",`Explain this clearly and briefly:
255
+
256
+ ${e}`)},{name:"translate",title:"Translate",subtitle:"Selection or page",icon:"languages",keywords:["ai","language"],when:()=>!!s?.ai,arguments:[{name:"language",placeholder:"Language",required:!0}],run:r=>i(r,`Translation (${r.arguments.language})`,`Translate the following into ${r.arguments.language}. Reply with only the translation, keeping Markdown formatting.
257
+
258
+ ${e||Ht(6e3)}`)}]}}function Mi(){return{name:"shortcuts",title:"Help",icon:"keyboard",commands:[{name:"list",title:"Keyboard Shortcuts",icon:"keyboard",keywords:["hotkeys","keys","help","cheatsheet"],view:s=>{let e=s.bar.commands().filter(i=>i.shortcut).map(i=>({...i,section:i.section??"Commands",accessories:[{kbd:i.shortcut}]})),t=[["Open command bar","mod+k"],["Move selection","arrowdown"],["Run selected","enter"],["Secondary action","mod+enter"],["Show actions","mod+."],["Ask AI","tab"],["Go back","escape"]].map(([i,r])=>({title:i,section:"Command bar",accessories:[{kbd:r}],icon:"command"}));return{type:"list",title:"Keyboard Shortcuts",placeholder:"Search shortcuts\u2026",items:[...e,...t],actions:[]}}}]}}function Ei(s){return $(s).map(e=>e.join(C?"":"+")).join(" ")}return zt(Ti);})();
259
+ //# sourceMappingURL=qikbar.global.js.map