@kitn.ai/ui 0.19.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -0
- package/NOTICE +54 -0
- package/dist/components/audio-visualizer/audio-visualizer.voice-fixture.d.ts +59 -0
- package/dist/components/audio-visualizer/aurora.glsl.d.ts +114 -0
- package/dist/components/audio-visualizer/index.d.ts +155 -0
- package/dist/components/audio-visualizer/shader-canvas.d.ts +130 -0
- package/dist/components/audio-visualizer/sizes.d.ts +25 -0
- package/dist/components/audio-visualizer/variant-aurora.d.ts +89 -0
- package/dist/components/audio-visualizer/variant-bar.d.ts +46 -0
- package/dist/components/audio-visualizer/variant-custom.d.ts +73 -0
- package/dist/components/audio-visualizer/variant-grid.d.ts +22 -0
- package/dist/components/audio-visualizer/variant-radial.d.ts +13 -0
- package/dist/components/audio-visualizer/variant-wave.d.ts +11 -0
- package/dist/components/audio-visualizer/wave.glsl.d.ts +16 -0
- package/dist/create-tween-hvpmSuwW.js +7 -0
- package/dist/custom-elements.json +282 -0
- package/dist/elements/agent-card.js +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/attachments.js +1 -1
- package/dist/elements/audio-visualizer.d.ts +1 -0
- package/dist/elements/audio-visualizer.js +1 -0
- package/dist/elements/autoloader.js +1 -1
- package/dist/elements/avatar.js +1 -1
- package/dist/elements/badge.js +1 -1
- package/dist/elements/button.js +1 -1
- package/dist/elements/card.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chain-of-thought.js +1 -1
- package/dist/elements/chat-scope-picker.js +1 -1
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/checkpoint.js +1 -1
- package/dist/elements/choice.js +1 -1
- package/dist/elements/chunks/{Icon-11SRdjJ4.js → Icon-Tj58ES_d.js} +1 -1
- package/dist/elements/chunks/{action-icons-CtRg17uX.js → action-icons-ns1Fnedj.js} +1 -1
- package/dist/elements/chunks/arrow-left-DQocUFvy.js +1 -0
- package/dist/elements/chunks/{attachments-CBqQRh60.js → attachments-mCB5F1Fq.js} +1 -1
- package/dist/elements/chunks/audio-visualizer-BqNy7dfm.js +1 -0
- package/dist/elements/chunks/{badge-CxklEXQm.js → badge-B4Zuajl2.js} +1 -1
- package/dist/elements/chunks/{button-BD7lUvVB.js → button-ZWNif3--.js} +1 -1
- package/dist/elements/chunks/{card-B-PRGXdj.js → card-BkHbp4BA.js} +1 -1
- package/dist/elements/chunks/{chat-thread-DIZbRIKG.js → chat-thread-CkRN6pZ7.js} +1 -1
- package/dist/elements/chunks/check-B9-gn6SS.js +1 -0
- package/dist/elements/chunks/chevron-down-BNsxc2hk.js +1 -0
- package/dist/elements/chunks/chevron-right-Hv00StBO.js +1 -0
- package/dist/elements/chunks/circle-0e3KJTDr.js +1 -0
- package/dist/elements/chunks/circle-check-BNAS0JEy.js +1 -0
- package/dist/elements/chunks/{circle-x-mtjCO_Ok.js → circle-x-B7faJFlY.js} +1 -1
- package/dist/elements/chunks/{code-block-BeWVttmU.js → code-block-BFUHn6Va.js} +1 -1
- package/dist/elements/chunks/collapsible-DM1Ckd4e.js +1 -0
- package/dist/elements/chunks/{composer-CavJww3d.js → composer-BguS0QL_.js} +2 -2
- package/dist/elements/chunks/{context-CnlsNJSJ.js → context-Cb7k4F-v.js} +1 -1
- package/dist/elements/chunks/{conversation-list-5O_KdI_I.js → conversation-list-CvoAkWhN.js} +1 -1
- package/dist/elements/chunks/create-tween-oVvAIG8r.js +7 -0
- package/dist/elements/chunks/{default-input-CB46cJJ1.js → default-input-Cqqilg9t.js} +1 -1
- package/dist/elements/chunks/define-D1din7Ld.js +1 -0
- package/dist/elements/chunks/{disclosure-BtFK3a-M.js → disclosure-CIZ5c8nO.js} +1 -1
- package/dist/elements/chunks/{download-qJv1dS3M.js → download-Dsbg3ste.js} +1 -1
- package/dist/elements/chunks/{dropdown-UhtAueYR.js → dropdown-BDd1-Zgi.js} +1 -1
- package/dist/elements/chunks/{ellipsis-B1sOOqiJ.js → ellipsis-Dw6qrss-.js} +1 -1
- package/dist/elements/chunks/{external-link-DToP_VKE.js → external-link-Vt74zAoL.js} +1 -1
- package/dist/elements/chunks/{file-text-BwUs_Pj4.js → file-text-CZrZF6_v.js} +1 -1
- package/dist/elements/chunks/{file-tree-C6RhmSnX.js → file-tree-DF4okKyo.js} +1 -1
- package/dist/elements/chunks/{folder-H_Xp0GYP.js → folder-glP5rha4.js} +1 -1
- package/dist/elements/chunks/{hover-card-Dn3yrk1l.js → hover-card-Cmm6Q53m.js} +1 -1
- package/dist/elements/chunks/{icon-BrxJQXzC.js → icon-BLb8beoi.js} +1 -1
- package/dist/elements/chunks/{info-11eT2q5H.js → info-CIsv92JK.js} +1 -1
- package/dist/elements/chunks/{input-B9oZKDfb.js → input-Dds1kFyt.js} +1 -1
- package/dist/elements/chunks/{kbd-D2fx3rWh.js → kbd-De_xbgi9.js} +1 -1
- package/dist/elements/chunks/{link-B-RNYWNw.js → link-i4r_k7z4.js} +1 -1
- package/dist/elements/chunks/{loader-BJh_aRlp.js → loader-BmQH4s3V.js} +1 -1
- package/dist/elements/chunks/{markdown-BIpjrDFv.js → markdown-Zi21WhUz.js} +7 -7
- package/dist/elements/chunks/{message-CPfqj8Gi.js → message-BqyXDN3-.js} +1 -1
- package/dist/elements/chunks/{message-feedback-8uj0aVYh.js → message-feedback-Djr3z6Yb.js} +1 -1
- package/dist/elements/chunks/message-square-vFAgbDaX.js +1 -0
- package/dist/elements/chunks/{minimize-2-C9qkiTJg.js → minimize-2--ifeCGrl.js} +1 -1
- package/dist/elements/chunks/{model-switcher-DRrMcRXH.js → model-switcher-B94YAKsM.js} +1 -1
- package/dist/elements/chunks/{overlay-C8_FUL8q.js → overlay-kD8dwRv_.js} +1 -1
- package/dist/elements/chunks/{paperclip-MA9hxLhW.js → paperclip-q21dYOSK.js} +1 -1
- package/dist/elements/chunks/{progress-bar-y5G6HDjg.js → progress-bar-BrAIIaaJ.js} +1 -1
- package/dist/elements/chunks/{prompt-suggestion-LalWvCJy.js → prompt-suggestion-Bjn2K-fR.js} +1 -1
- package/dist/elements/chunks/reasoning-DTpCGtnY.js +1 -0
- package/dist/elements/chunks/{resizable-xhYF5lCQ.js → resizable-Dp4JExql.js} +1 -1
- package/dist/elements/chunks/{rotate-cw-2ndEXjgS.js → rotate-cw-CFWWkpj2.js} +1 -1
- package/dist/elements/chunks/{scroll-area-BzOPDXrZ.js → scroll-area-Bb0kHH1j.js} +1 -1
- package/dist/elements/chunks/scroll-button-B0cH5fXf.js +1 -0
- package/dist/elements/chunks/{separator-CPvL5Xdl.js → separator-9kRgr1X9.js} +1 -1
- package/dist/elements/chunks/{settings-hmzIuNXD.js → settings-B8lmec4D.js} +1 -1
- package/dist/elements/chunks/{settings-group-BiIym17O.js → settings-group-I0hEuXiN.js} +1 -1
- package/dist/elements/chunks/{share-BbziTAzn.js → share-C3lTiYGt.js} +1 -1
- package/dist/elements/chunks/{skeleton-Bxhs1thL.js → skeleton-DSXW5Yya.js} +1 -1
- package/dist/elements/chunks/{star-BHL3Va5p.js → star-CSJtGxgv.js} +1 -1
- package/dist/elements/chunks/{store-tpnnWlxY.js → store-CHyW95TP.js} +1 -1
- package/dist/elements/chunks/{text-shimmer-1DCKivKx.js → text-shimmer-Cn9TmNpI.js} +1 -1
- package/dist/elements/chunks/{textarea-Czaowo9F.js → textarea-CUwqAX0G.js} +1 -1
- package/dist/elements/chunks/{thumbs-up-CdLqA13R.js → thumbs-up-PNVVThEF.js} +1 -1
- package/dist/elements/chunks/{toast-store-BvBquUFA.js → toast-store-DKbQn3Wn.js} +1 -1
- package/dist/elements/chunks/{tool-4P_ne8Go.js → tool-DjTRpIpl.js} +1 -1
- package/dist/elements/chunks/tooltip-CgBZCVKp.js +1 -0
- package/dist/elements/chunks/{triangle-alert-BllqxXq8.js → triangle-alert-DsHTHCPm.js} +1 -1
- package/dist/elements/chunks/{use-card-resolution-73xiddIW.js → use-card-resolution-BSu_XHjH.js} +1 -1
- package/dist/elements/chunks/variant-aurora-Dc4nQUia.js +218 -0
- package/dist/elements/chunks/variant-custom-y_3kVQhS.js +1 -0
- package/dist/elements/chunks/variant-wave-D5OR1-9Z.js +116 -0
- package/dist/elements/chunks/{video-O9rA6k7S.js → video-B7vmenoC.js} +1 -1
- package/dist/elements/chunks/x-GRUeeQFT.js +1 -0
- package/dist/elements/coachmark.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command.js +1 -1
- package/dist/elements/compare.js +1 -1
- package/dist/elements/composer.js +1 -1
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/context-meter.js +1 -1
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/define.d.ts +11 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/embed.js +1 -1
- package/dist/elements/empty.js +1 -1
- package/dist/elements/feedback-bar.js +1 -1
- package/dist/elements/file-tree.js +1 -1
- package/dist/elements/file-upload.js +1 -1
- package/dist/elements/form.js +1 -1
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/icon.js +1 -1
- package/dist/elements/image.js +1 -1
- package/dist/elements/input.js +1 -1
- package/dist/elements/kbd.js +1 -1
- package/dist/elements/link-preview.js +1 -1
- package/dist/elements/loader.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/menu.js +1 -1
- package/dist/elements/message-skills.js +1 -1
- package/dist/elements/message.js +1 -1
- package/dist/elements/model-switcher.js +1 -1
- package/dist/elements/nav.js +1 -1
- package/dist/elements/notice.js +1 -1
- package/dist/elements/pane-group.js +1 -1
- package/dist/elements/pane.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/progress-bar.js +1 -1
- package/dist/elements/prompt-dock.js +1 -1
- package/dist/elements/prompt-input.js +1 -1
- package/dist/elements/prompt-suggestions.js +1 -1
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +1 -1
- package/dist/elements/screen.js +1 -1
- package/dist/elements/scroll-area.js +1 -1
- package/dist/elements/scroll-button.js +1 -1
- package/dist/elements/search.js +1 -1
- package/dist/elements/segmented.js +1 -1
- package/dist/elements/separator.js +1 -1
- package/dist/elements/setting-item.js +1 -1
- package/dist/elements/settings-group.js +1 -1
- package/dist/elements/skeleton.js +1 -1
- package/dist/elements/slots.d.ts +12 -0
- package/dist/elements/source.js +1 -1
- package/dist/elements/status.js +1 -1
- package/dist/elements/switch.js +1 -1
- package/dist/elements/tabs.js +1 -1
- package/dist/elements/tasks.js +1 -1
- package/dist/elements/text-shimmer.js +1 -1
- package/dist/elements/thinking-bar.js +1 -1
- package/dist/elements/thread.js +1 -1
- package/dist/elements/toast.js +1 -1
- package/dist/elements/tool.js +1 -1
- package/dist/elements/tooltip.js +1 -1
- package/dist/elements/voice-input.js +1 -1
- package/dist/elements/voice-output.js +1 -1
- package/dist/elements.d.ts +38 -0
- package/dist/index.js +18 -17
- package/dist/index.server.js +16404 -0
- package/dist/kai.es.js +1 -1
- package/dist/llms/llms-full.txt +40 -4
- package/dist/llms/llms.txt +3 -3
- package/dist/primitives/audio-bands.d.ts +106 -0
- package/dist/primitives/create-tween.d.ts +33 -0
- package/dist/primitives/use-audio-analysis.d.ts +149 -0
- package/dist/primitives/use-sequencer.d.ts +13 -0
- package/dist/primitives/use-voice-recorder.d.ts +1 -0
- package/dist/primitives/visualizer-sequences.d.ts +39 -0
- package/dist/react/index.d.ts +41 -0
- package/dist/react.js +159 -153
- package/dist/register-impl-DQyejdfb.js +145 -0
- package/dist/test-utils/fake-clock.d.ts +45 -0
- package/dist/variant-aurora-DVtGqVH6.js +218 -0
- package/dist/variant-custom-Dif-IV4u.js +1 -0
- package/dist/variant-wave-DbfNdvSi.js +116 -0
- package/frameworks/react/index.tsx +42 -0
- package/llms-full.txt +40 -4
- package/llms.txt +3 -3
- package/package.json +11 -3
- package/src/components/audio-visualizer/audio-visualizer.voice-fixture.ts +257 -0
- package/src/components/audio-visualizer/aurora.glsl.ts +330 -0
- package/src/components/audio-visualizer/index.tsx +442 -0
- package/src/components/audio-visualizer/shader-canvas.tsx +846 -0
- package/src/components/audio-visualizer/sizes.ts +54 -0
- package/src/components/audio-visualizer/variant-aurora.tsx +299 -0
- package/src/components/audio-visualizer/variant-bar.tsx +143 -0
- package/src/components/audio-visualizer/variant-custom.tsx +338 -0
- package/src/components/audio-visualizer/variant-grid.tsx +170 -0
- package/src/components/audio-visualizer/variant-radial.tsx +158 -0
- package/src/components/audio-visualizer/variant-wave.tsx +125 -0
- package/src/components/audio-visualizer/wave.glsl.ts +130 -0
- package/src/components/component-meta.json +24 -24
- package/src/elements/audio-visualizer.tsx +183 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/define.tsx +12 -1
- package/src/elements/element-manifest.json +4 -0
- package/src/elements/element-meta.json +170 -0
- package/src/elements/element-types.d.ts +38 -0
- package/src/elements/register-impl.ts +1 -0
- package/src/elements/slots.ts +35 -0
- package/src/primitives/audio-bands.ts +174 -0
- package/src/primitives/create-tween.ts +214 -0
- package/src/primitives/use-audio-analysis.ts +321 -0
- package/src/primitives/use-sequencer.ts +53 -0
- package/src/primitives/use-voice-recorder.ts +16 -4
- package/src/primitives/visualizer-sequences.ts +350 -0
- package/src/test-utils/fake-clock.ts +88 -0
- package/dist/elements/chunks/arrow-left-CifsGq8x.js +0 -1
- package/dist/elements/chunks/check-CUKS495w.js +0 -1
- package/dist/elements/chunks/chevron-down-AELmYT1j.js +0 -1
- package/dist/elements/chunks/chevron-right-C8g26oKh.js +0 -1
- package/dist/elements/chunks/circle-DGcI8Cft.js +0 -1
- package/dist/elements/chunks/circle-check-DuU0IcBQ.js +0 -1
- package/dist/elements/chunks/collapsible-DGjADCN6.js +0 -1
- package/dist/elements/chunks/define-DfTe4zwZ.js +0 -1
- package/dist/elements/chunks/message-square-CCSQ4M9g.js +0 -1
- package/dist/elements/chunks/reasoning-CW3SDdb4.js +0 -1
- package/dist/elements/chunks/scroll-button-B1x4cYqM.js +0 -1
- package/dist/elements/chunks/tooltip-CBeFqJKk.js +0 -1
- package/dist/elements/chunks/x-DeS3rQhx.js +0 -1
- package/dist/register-impl-CaaHJcea.js +0 -145
package/dist/kai.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const Sn={bash:()=>import("./bash-InADTalH.js"),javascript:()=>import("./javascript-C25yR2R2.js"),typescript:()=>import("./typescript-RycA9KXf.js"),tsx:()=>import("./tsx-B8rCNbgL.js"),html:()=>import("./html-CPZ3oZQ7.js"),css:()=>import("./css-M7EaDHN_.js"),json:()=>import("./json-DxJze_jm.js"),vue:()=>import("./vue-BmIZj4XD.js"),svelte:()=>import("./svelte--5p79yCD.js")},On={"github-dark-dimmed":()=>import("./github-dark-dimmed-DUshB20C.js"),"github-light":()=>import("./github-light-JYsPkUQd.js")},xn={js:"javascript",ts:"typescript",jsx:"tsx",sh:"bash",shell:"bash"},Nt="github-dark-dimmed";let Ot=!0,xt={...Sn},At={...On},kt={...xn},jt=null;const zt=new Set,Ft=new Set;function An(){return jt||(jt=(async()=>{const[{createHighlighterCore:t},{createJavaScriptRegexEngine:n}]=await Promise.all([import("./core-C8fzo39E.js"),import("./engine-javascript-C1x7zo1_.js")]);return t({themes:[],langs:[],engine:n()})})()),jt}function Rt(t){return kt[t]??t}async function kn(t,n){const e=Rt(n);if(zt.has(e))return!0;const r=xt[e];return r?(await t.loadLanguage(r()),zt.add(e),!0):!1}async function Kt(t,n){if(Ft.has(n))return!0;const e=At[n];return e?(await t.loadTheme(e()),Ft.add(n),!0):!1}function jn(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ct(t){return`<pre><code>${jn(t)}</code></pre>`}async function Pn(t,n,e){if(!Ot||!t)return ct(t);try{const r=await An();if(!await kn(r,n))return ct(t);const o=await Kt(r,e)?e:await Kt(r,Nt)?Nt:null;return o?r.codeToHtml(t,{lang:Rt(n),theme:o}):ct(t)}catch{return ct(t)}}function _n(t){t.enabled!==void 0&&(Ot=t.enabled),t.languages&&(xt={...xt,...t.languages}),t.themes&&(At={...At,...t.themes}),t.aliases&&(kt={...kt,...t.aliases})}function qn(){return Ot}const p={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Lt(this.context.count)},getNextContextId(){return Lt(this.context.count++)}};function Lt(t){const n=String(t),e=n.length-1;return p.context.id+(e?String.fromCharCode(96+e):"")+n}function Pt(t){p.context=t}function Cn(){return{...p.context,id:p.getNextContextId(),count:0}}const Se=!1,Mn=(t,n)=>t===n,V=Symbol("solid-proxy"),Jt=typeof Proxy=="function",X=Symbol("solid-track"),Oe=Symbol("solid-dev-component"),at={equals:Mn};let Y=null,Ut=en;const P=1,Z=2,Wt={owned:null,cleanups:null,context:null,owner:null},_t={};var f=null;let l=null,J=null,U=null,h=null,b=null,O=null,ft=0;function F(t,n){const e=h,r=f,o=t.length===0,s=n===void 0?r:n,i=o?Wt:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=o?t:()=>t(()=>m(()=>z(i)));f=i,h=null;try{return k(u,!0)}finally{h=e,f=r}}function E(t,n){n=n?Object.assign({},at,n):at;const e={value:t,observers:null,observerSlots:null,comparator:n.equals||void 0},r=o=>(typeof o=="function"&&(l&&l.running&&l.sources.has(e)?o=o(e.tValue):o=o(e.value)),tn(e,o));return[Zt.bind(e),r]}function Bt(t,n,e){const r=et(t,n,!0,P);J&&l&&l.running?b.push(r):W(r)}function Gt(t,n,e){const r=et(t,n,!1,P);J&&l&&l.running?b.push(r):W(r)}function Qt(t,n,e){Ut=Kn;const r=et(t,n,!1,P),o=nt&&Ct(nt);o&&(r.suspense=o),(!e||!e.render)&&(r.user=!0),O?O.push(r):W(r)}function A(t,n,e){e=e?Object.assign({},at,e):at;const r=et(t,n,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=e.equals||void 0,J&&l&&l.running?(r.tState=P,b.push(r)):W(r),Zt.bind(r)}function Vn(t){return t&&typeof t=="object"&&"then"in t}function En(t,n,e){let r,o,s;typeof n=="function"?(r=t,o=n,s=e||{}):(r=!0,o=t,s=n||{});let i=null,u=_t,c=null,d=!1,g=!1,a="initialValue"in s,w=typeof r=="function"&&A(r);const S=new Set,[_,D]=(s.storage||E)(s.initialValue),[N,L]=E(void 0),[q,C]=E(void 0,{equals:!1}),[M,T]=E(a?"ready":"unresolved");p.context&&(c=p.getNextContextId(),s.ssrLoadFrom==="initial"?u=s.initialValue:p.load&&p.has(c)&&(u=p.load(c)));function H(y,v,$,x){return i===y&&(i=null,x!==void 0&&(a=!0),(y===u||v===u)&&s.onHydrated&&queueMicrotask(()=>s.onHydrated(x,{value:v})),u=_t,l&&y&&d?(l.promises.delete(y),d=!1,k(()=>{l.running=!0,Tt(v,$)},!1)):Tt(v,$)),v}function Tt(y,v){k(()=>{v===void 0&&D(()=>y),T(v!==void 0?"errored":a?"ready":"unresolved"),L(v);for(const $ of S.keys())$.decrement();S.clear()},!1)}function mt(){const y=nt&&Ct(nt),v=_(),$=N();if($!==void 0&&!i)throw $;return h&&!h.user&&y&&Bt(()=>{q(),i&&(y.resolved&&l&&d?l.promises.add(i):S.has(y)||(y.increment(),S.add(y)))}),v}function St(y=!0){if(y!==!1&&g)return;g=!1;const v=w?w():r;if(d=l&&l.running,v==null||v===!1){H(i,m(_));return}l&&i&&l.promises.delete(i);let $;const x=u!==_t?u:m(()=>{try{return o(v,{value:_(),refetching:y})}catch(Q){$=Q}});if($!==void 0){H(i,void 0,gt($),v);return}else if(!Vn(x))return H(i,x,void 0,v),x;return i=x,"v"in x?(x.s===1?H(i,x.v,void 0,v):H(i,void 0,gt(x.v),v),x):(g=!0,queueMicrotask(()=>g=!1),k(()=>{T(a?"refreshing":"pending"),C()},!1),x.then(Q=>H(x,Q,void 0,v),Q=>H(x,void 0,gt(Q),v)))}Object.defineProperties(mt,{state:{get:()=>M()},error:{get:()=>N()},loading:{get(){const y=M();return y==="pending"||y==="refreshing"}},latest:{get(){if(!a)return mt();const y=N();if(y&&!i)throw y;return _()}}});let Ht=f;return w?Bt(()=>(Ht=f,St(!1))):St(!1),[mt,{refetch:y=>Xt(Ht,()=>St(y)),mutate:D}]}function $n(t){return k(t,!1)}function m(t){if(!U&&h===null)return t();const n=h;h=null;try{return U?U.untrack(t):t()}finally{h=n}}function Dn(t,n,e){const r=Array.isArray(t);let o,s=e&&e.defer;return i=>{let u;if(r){u=Array(t.length);for(let d=0;d<t.length;d++)u[d]=t[d]()}else u=t();if(s)return s=!1,i;const c=m(()=>n(u,o,i));return o=u,c}}function In(t){Qt(()=>m(t))}function tt(t){return f===null||(f.cleanups===null?f.cleanups=[t]:f.cleanups.push(t)),t}function Tn(t,n){Y||(Y=Symbol("error")),f=et(void 0,void 0,!0),f.context={...f.context,[Y]:[n]},l&&l.running&&l.sources.add(f);try{return t()}catch(e){ot(e)}finally{f=f.owner}}function qt(){return h}function Hn(){return f}function Xt(t,n){const e=f,r=h;f=t,h=null;try{return k(n,!0)}catch(o){ot(o)}finally{f=e,h=r}}function Nn(t){if(l&&l.running)return t(),l.done;const n=h,e=f;return Promise.resolve().then(()=>{h=n,f=e;let r;return(J||nt)&&(r=l||(l={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),r.done||(r.done=new Promise(o=>r.resolve=o)),r.running=!0),k(t,!1),h=f=null,r?r.done:void 0})}const[xe,Yt]=E(!1);function zn(t,n){const e=Symbol("context");return{id:e,Provider:Ln(e),defaultValue:t}}function Ct(t){let n;return f&&f.context&&(n=f.context[t.id])!==void 0?n:t.defaultValue}function Mt(t){const n=A(t),e=A(()=>Vt(n()));return e.toArray=()=>{const r=e();return Array.isArray(r)?r:r!=null?[r]:[]},e}let nt;function Zt(){const t=l&&l.running;if(this.sources&&(t?this.tState:this.state))if((t?this.tState:this.state)===P)W(this);else{const n=b;b=null,k(()=>dt(this),!1),b=n}if(h){const n=this.observers;if(!n||n[n.length-1]!==h){const e=n?n.length:0;h.sources?(h.sources.push(this),h.sourceSlots.push(e)):(h.sources=[this],h.sourceSlots=[e]),n?(n.push(h),this.observerSlots.push(h.sources.length-1)):(this.observers=[h],this.observerSlots=[h.sources.length-1])}}return t&&l.sources.has(this)?this.tValue:this.value}function tn(t,n,e){let r=l&&l.running&&l.sources.has(t)?t.tValue:t.value;if(!t.comparator||!t.comparator(r,n)){if(l){const o=l.running;(o||!e&&l.sources.has(t))&&(l.sources.add(t),t.tValue=n),o||(t.value=n)}else t.value=n;t.observers&&t.observers.length&&k(()=>{for(let o=0;o<t.observers.length;o+=1){const s=t.observers[o],i=l&&l.running;i&&l.disposed.has(s)||((i?!s.tState:!s.state)&&(s.pure?b.push(s):O.push(s),s.observers&&rn(s)),i?s.tState=P:s.state=P)}if(b.length>1e6)throw b=[],new Error},!1)}return n}function W(t){if(!t.fn)return;z(t);const n=ft;nn(t,l&&l.running&&l.sources.has(t)?t.tValue:t.value,n),l&&!l.running&&l.sources.has(t)&&queueMicrotask(()=>{k(()=>{l&&(l.running=!0),h=f=t,nn(t,t.tValue,n),h=f=null},!1)})}function nn(t,n,e){let r;const o=f,s=h;h=f=t;try{r=t.fn(n)}catch(i){return t.pure&&(l&&l.running?(t.tState=P,t.tOwned&&t.tOwned.forEach(z),t.tOwned=void 0):(t.state=P,t.owned&&t.owned.forEach(z),t.owned=null)),t.updatedAt=e+1,ot(i)}finally{h=s,f=o}(!t.updatedAt||t.updatedAt<=e)&&(t.updatedAt!=null&&"observers"in t?tn(t,r,!0):l&&l.running&&t.pure?(l.sources.has(t)||(t.value=r),l.sources.add(t),t.tValue=r):t.value=r,t.updatedAt=e)}function et(t,n,e,r=P,o){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:n,owner:f,context:f?f.context:null,pure:e};if(l&&l.running&&(s.state=0,s.tState=r),f===null||f!==Wt&&(l&&l.running&&f.pure?f.tOwned?f.tOwned.push(s):f.tOwned=[s]:f.owned?f.owned.push(s):f.owned=[s]),U&&s.fn){const i=s.fn,[u,c]=E(void 0,{equals:!1}),d=U.factory(i,c);tt(()=>d.dispose());let g;const a=()=>Nn(c).then(()=>{g&&(g.dispose(),g=void 0)});s.fn=w=>(u(),l&&l.running?(g||(g=U.factory(i,a)),g.track(w)):d.track(w))}return s}function rt(t){const n=l&&l.running;if((n?t.tState:t.state)===0)return;if((n?t.tState:t.state)===Z)return dt(t);if(t.suspense&&m(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<ft);){if(n&&l.disposed.has(t))return;(n?t.tState:t.state)&&e.push(t)}for(let r=e.length-1;r>=0;r--){if(t=e[r],n){let o=t,s=e[r+1];for(;(o=o.owner)&&o!==s;)if(l.disposed.has(o))return}if((n?t.tState:t.state)===P)W(t);else if((n?t.tState:t.state)===Z){const o=b;b=null,k(()=>dt(t,e[0]),!1),b=o}}}function k(t,n){if(b)return t();let e=!1;n||(b=[]),O?e=!0:O=[],ft++;try{const r=t();return Fn(e),r}catch(r){e||(O=null),b=null,ot(r)}}function Fn(t){if(b&&(J&&l&&l.running?Rn(b):en(b),b=null),t)return;let n;if(l){if(!l.promises.size&&!l.queue.size){const r=l.sources,o=l.disposed;O.push.apply(O,l.effects),n=l.resolve;for(const s of O)"tState"in s&&(s.state=s.tState),delete s.tState;l=null,k(()=>{for(const s of o)z(s);for(const s of r){if(s.value=s.tValue,s.owned)for(let i=0,u=s.owned.length;i<u;i++)z(s.owned[i]);s.tOwned&&(s.owned=s.tOwned),delete s.tValue,delete s.tOwned,s.tState=0}Yt(!1)},!1)}else if(l.running){l.running=!1,l.effects.push.apply(l.effects,O),O=null,Yt(!0);return}}const e=O;O=null,e.length&&k(()=>Ut(e),!1),n&&n()}function en(t){for(let n=0;n<t.length;n++)rt(t[n])}function Rn(t){for(let n=0;n<t.length;n++){const e=t[n],r=l.queue;r.has(e)||(r.add(e),J(()=>{r.delete(e),k(()=>{l.running=!0,rt(e)},!1),l&&(l.running=!1)}))}}function Kn(t){let n,e=0;for(n=0;n<t.length;n++){const r=t[n];r.user?t[e++]=r:rt(r)}if(p.context){if(p.count){p.effects||(p.effects=[]),p.effects.push(...t.slice(0,e));return}Pt()}for(p.effects&&(p.done||!p.count)&&(t=[...p.effects,...t],e+=p.effects.length,delete p.effects),n=0;n<e;n++)rt(t[n])}function dt(t,n){const e=l&&l.running;e?t.tState=0:t.state=0;for(let r=0;r<t.sources.length;r+=1){const o=t.sources[r];if(o.sources){const s=e?o.tState:o.state;s===P?o!==n&&(!o.updatedAt||o.updatedAt<ft)&&rt(o):s===Z&&dt(o,n)}}}function rn(t){const n=l&&l.running;for(let e=0;e<t.observers.length;e+=1){const r=t.observers[e];(n?!r.tState:!r.state)&&(n?r.tState=Z:r.state=Z,r.pure?b.push(r):O.push(r),r.observers&&rn(r))}}function z(t){let n;if(t.sources)for(;t.sources.length;){const e=t.sources.pop(),r=t.sourceSlots.pop(),o=e.observers;if(o&&o.length){const s=o.pop(),i=e.observerSlots.pop();r<o.length&&(s.sourceSlots[i]=r,o[r]=s,e.observerSlots[r]=i)}}if(t.tOwned){for(n=t.tOwned.length-1;n>=0;n--)z(t.tOwned[n]);delete t.tOwned}if(l&&l.running&&t.pure)on(t,!0);else if(t.owned){for(n=t.owned.length-1;n>=0;n--)z(t.owned[n]);t.owned=null}if(t.cleanups){for(n=t.cleanups.length-1;n>=0;n--)t.cleanups[n]();t.cleanups=null}l&&l.running?t.tState=0:t.state=0}function on(t,n){if(n||(t.tState=0,l.disposed.add(t)),t.owned)for(let e=0;e<t.owned.length;e++)on(t.owned[e])}function gt(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function sn(t,n,e){try{for(const r of n)r(t)}catch(r){ot(r,e&&e.owner||null)}}function ot(t,n=f){const e=Y&&n&&n.context&&n.context[Y],r=gt(t);if(!e)throw r;O?O.push({fn(){sn(r,e,n)},state:P}):sn(r,e,n)}function Vt(t){if(typeof t=="function"&&!t.length)return Vt(t());if(Array.isArray(t)){const n=[];for(let e=0;e<t.length;e++){const r=Vt(t[e]);if(Array.isArray(r))if(r.length<32768)n.push.apply(n,r);else for(let o=0;o<r.length;o++)n.push(r[o]);else n.push(r)}return n}return t}function Ln(t,n){return function(e){let r;return Gt(()=>r=m(()=>(f.context={...f.context,[t]:e.value},Mt(()=>e.children))),void 0),r}}const Et=Symbol("fallback");function ht(t){for(let n=0;n<t.length;n++)t[n]()}function Jn(t,n,e={}){let r=[],o=[],s=[],i=0,u=n.length>1?[]:null;return tt(()=>ht(s)),()=>{let c=t()||[],d=c.length,g,a;return c[X],m(()=>{let S,_,D,N,L,q,C,M,T;if(d===0)i!==0&&(ht(s),s=[],r=[],o=[],i=0,u&&(u=[])),e.fallback&&(r=[Et],o[0]=F(H=>(s[0]=H,e.fallback())),i=1);else if(i===0){for(o=new Array(d),a=0;a<d;a++)r[a]=c[a],o[a]=F(w);i=d}else{for(D=new Array(d),N=new Array(d),u&&(L=new Array(d)),q=0,C=Math.min(i,d);q<C&&r[q]===c[q];q++);for(C=i-1,M=d-1;C>=q&&M>=q&&r[C]===c[M];C--,M--)D[M]=o[C],N[M]=s[C],u&&(L[M]=u[C]);for(S=new Map,_=new Array(M+1),a=M;a>=q;a--)T=c[a],g=S.get(T),_[a]=g===void 0?-1:g,S.set(T,a);for(g=q;g<=C;g++)T=r[g],a=S.get(T),a!==void 0&&a!==-1?(D[a]=o[g],N[a]=s[g],u&&(L[a]=u[g]),a=_[a],S.set(T,a)):s[g]();for(a=q;a<d;a++)a in D?(o[a]=D[a],s[a]=N[a],u&&(u[a]=L[a],u[a](a))):o[a]=F(w);o=o.slice(0,i=d),r=c.slice(0)}return o});function w(S){if(s[a]=S,u){const[_,D]=E(a);return u[a]=D,n(c[a],_)}return n(c[a])}}}function Un(t,n,e={}){let r=[],o=[],s=[],i=[],u=0,c;return tt(()=>ht(s)),()=>{const d=t()||[],g=d.length;return d[X],m(()=>{if(g===0)return u!==0&&(ht(s),s=[],r=[],o=[],u=0,i=[]),e.fallback&&(r=[Et],o[0]=F(w=>(s[0]=w,e.fallback())),u=1),o;for(r[0]===Et&&(s[0](),s=[],r=[],o=[],u=0),c=0;c<g;c++)c<r.length&&r[c]!==d[c]?i[c](()=>d[c]):c>=r.length&&(o[c]=F(a));for(;c<r.length;c++)s[c]();return u=i.length=s.length=g,r=d.slice(0),o=o.slice(0,u)});function a(w){s[c]=w;const[S,_]=E(d[c]);return i[c]=_,n(S,c)}}}let un=!1;function Wn(){un=!0}function Bn(t,n){if(un&&p.context){const e=p.context;Pt(Cn());const r=m(()=>t(n||{}));return Pt(e),r}return m(()=>t(n||{}))}function pt(){return!0}const $t={get(t,n,e){return n===V?e:t.get(n)},has(t,n){return n===V?!0:t.has(n)},set:pt,deleteProperty:pt,getOwnPropertyDescriptor(t,n){return{configurable:!0,enumerable:!0,get(){return t.get(n)},set:pt,deleteProperty:pt}},ownKeys(t){return t.keys()}};function Dt(t){return(t=typeof t=="function"?t():t)?t:{}}function Gn(){for(let t=0,n=this.length;t<n;++t){const e=this[t]();if(e!==void 0)return e}}function Qn(...t){let n=!1;for(let i=0;i<t.length;i++){const u=t[i];n=n||!!u&&V in u,t[i]=typeof u=="function"?(n=!0,A(u)):u}if(Jt&&n)return new Proxy({get(i){for(let u=t.length-1;u>=0;u--){const c=Dt(t[u])[i];if(c!==void 0)return c}},has(i){for(let u=t.length-1;u>=0;u--)if(i in Dt(t[u]))return!0;return!1},keys(){const i=[];for(let u=0;u<t.length;u++)i.push(...Object.keys(Dt(t[u])));return[...new Set(i)]}},$t);const e={},r=Object.create(null);for(let i=t.length-1;i>=0;i--){const u=t[i];if(!u)continue;const c=Object.getOwnPropertyNames(u);for(let d=c.length-1;d>=0;d--){const g=c[d];if(g==="__proto__"||g==="constructor")continue;const a=Object.getOwnPropertyDescriptor(u,g);if(!r[g])r[g]=a.get?{enumerable:!0,configurable:!0,get:Gn.bind(e[g]=[a.get.bind(u)])}:a.value!==void 0?a:void 0;else{const w=e[g];w&&(a.get?w.push(a.get.bind(u)):a.value!==void 0&&w.push(()=>a.value))}}}const o={},s=Object.keys(r);for(let i=s.length-1;i>=0;i--){const u=s[i],c=r[u];c&&c.get?Object.defineProperty(o,u,c):o[u]=c?c.value:void 0}return o}function Xn(t,...n){const e=n.length;if(Jt&&V in t){const o=e>1?n.flat():n[0],s=n.map(i=>new Proxy({get(u){return i.includes(u)?t[u]:void 0},has(u){return i.includes(u)&&u in t},keys(){return i.filter(u=>u in t)}},$t));return s.push(new Proxy({get(i){return o.includes(i)?void 0:t[i]},has(i){return o.includes(i)?!1:i in t},keys(){return Object.keys(t).filter(i=>!o.includes(i))}},$t)),s}const r=[];for(let o=0;o<=e;o++)r[o]={};for(const o of Object.getOwnPropertyNames(t)){let s=e;for(let u=0;u<n.length;u++)if(n[u].includes(o)){s=u;break}const i=Object.getOwnPropertyDescriptor(t,o);!i.get&&!i.set&&i.enumerable&&i.writable&&i.configurable?r[s][o]=i.value:Object.defineProperty(r[s],o,i)}return r}let Yn=0;function Zn(){return p.context?p.getNextContextId():`cl-${Yn++}`}const ln=t=>`Stale read from <${t}>.`;function te(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Jn(()=>t.each,t.children,n||void 0))}function ne(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Un(()=>t.each,t.children,n||void 0))}function ee(t){const n=t.keyed,e=A(()=>t.when,void 0,void 0),r=n?e:A(e,void 0,{equals:(o,s)=>!o==!s});return A(()=>{const o=r();if(o){const s=t.children;return typeof s=="function"&&s.length>0?m(()=>s(n?o:()=>{if(!m(r))throw ln("Show");return e()})):s}return t.fallback},void 0,void 0)}function re(t){const n=Mt(()=>t.children),e=A(()=>{const r=n(),o=Array.isArray(r)?r:[r];let s=()=>{};for(let i=0;i<o.length;i++){const u=i,c=o[i],d=s,g=A(()=>d()?void 0:c.when,void 0,void 0),a=c.keyed?g:A(g,void 0,{equals:(w,S)=>!w==!S});s=()=>d()||(a()?[u,g,c]:void 0)}return s});return A(()=>{const r=e()();if(!r)return t.fallback;const[o,s,i]=r,u=i.children;return typeof u=="function"&&u.length>0?m(()=>u(i.keyed?s():()=>{var c;if(((c=m(e)())==null?void 0:c[0])!==o)throw ln("Match");return s()})):u},void 0,void 0)}function oe(t){return t}let yt;function se(t){let n;p.context&&p.load&&(n=p.load(p.getContextId()));const[e,r]=E(n,void 0);return yt||(yt=new Set),yt.add(r),tt(()=>yt.delete(r)),A(()=>{let o;if(o=e()){const s=t.fallback;return typeof s=="function"&&s.length?m(()=>s(o,()=>r())):s}return Tn(()=>t.children,r)},void 0,void 0)}const vt=Symbol("store-raw"),R=Symbol("store-node"),I=Symbol("store-has"),cn=Symbol("store-self");function an(t){let n=t[V];if(!n&&(Object.defineProperty(t,V,{value:n=new Proxy(t,le)}),!Array.isArray(t))){const e=Object.keys(t),r=Object.getOwnPropertyDescriptors(t),o=Object.getPrototypeOf(t),s=o!==null&&t!==null&&typeof t=="object"&&!Array.isArray(t)&&o!==Object.prototype;if(s){const i=Object.getOwnPropertyDescriptors(o);e.push(...Object.keys(i)),Object.assign(r,i)}for(let i=0,u=e.length;i<u;i++){const c=e[i];s&&c==="constructor"||r[c].get&&Object.defineProperty(t,c,{configurable:!0,enumerable:r[c].enumerable,get:r[c].get.bind(n)})}}return n}function B(t){let n;return t!=null&&typeof t=="object"&&(t[V]||!(n=Object.getPrototypeOf(t))||n===Object.prototype||Array.isArray(t))}function K(t,n=new Set){let e,r,o,s;if(e=t!=null&&t[vt])return e;if(!B(t)||n.has(t))return t;if(Array.isArray(t)){Object.isFrozen(t)?t=t.slice(0):n.add(t);for(let i=0,u=t.length;i<u;i++)o=t[i],(r=K(o,n))!==o&&(t[i]=r)}else{Object.isFrozen(t)?t=Object.assign({},t):n.add(t);const i=Object.keys(t),u=Object.getOwnPropertyDescriptors(t);for(let c=0,d=i.length;c<d;c++)s=i[c],!u[s].get&&(o=t[s],(r=K(o,n))!==o&&(t[s]=r))}return t}function bt(t,n){let e=t[n];return e||Object.defineProperty(t,n,{value:e=Object.create(null)}),e}function st(t,n,e){if(t[n])return t[n];const[r,o]=E(e,{equals:!1,internal:!0});return r.$=o,t[n]=r}function ie(t,n){const e=Reflect.getOwnPropertyDescriptor(t,n);return!e||e.get||!e.configurable||n===V||n===R||(delete e.value,delete e.writable,e.get=()=>t[V][n]),e}function fn(t){qt()&&st(bt(t,R),cn)()}function ue(t){return fn(t),Reflect.ownKeys(t)}const le={get(t,n,e){if(n===vt)return t;if(n===V)return e;if(n===X)return fn(t),e;const r=bt(t,R),o=r[n];let s=o?o():t[n];if(n===R||n===I||n==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(t,n);qt()&&(typeof s!="function"||t.hasOwnProperty(n))&&!(i&&i.get)&&(s=st(r,n,s)())}return B(s)?an(s):s},has(t,n){return n===vt||n===V||n===X||n===R||n===I||n==="__proto__"?!0:(qt()&&st(bt(t,I),n)(),n in t)},set(){return!0},deleteProperty(){return!0},ownKeys:ue,getOwnPropertyDescriptor:ie};function G(t,n,e,r=!1){if(n==="__proto__"||!r&&t[n]===e)return;const o=t[n],s=t.length;e===void 0?(delete t[n],t[I]&&t[I][n]&&o!==void 0&&t[I][n].$()):(t[n]=e,t[I]&&t[I][n]&&o===void 0&&t[I][n].$());let i=bt(t,R),u;if((u=st(i,n,o))&&u.$(()=>e),Array.isArray(t)&&t.length!==s){for(let c=t.length;c<s;c++)(u=i[c])&&u.$();(u=st(i,"length",s))&&u.$(t.length)}(u=i[cn])&&u.$()}function dn(t,n){const e=Object.keys(n);for(let r=0;r<e.length;r+=1){const o=e[r];gn(o)||G(t,o,n[o])}}function gn(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function ce(t,n){if(typeof n=="function"&&(n=n(t)),n=K(n),Array.isArray(n)){if(t===n)return;let e=0,r=n.length;for(;e<r;e++){const o=n[e];t[e]!==o&&G(t,e,o)}G(t,"length",r)}else dn(t,n)}function it(t,n,e=[]){let r,o=t;if(n.length>1){r=n.shift();const i=typeof r,u=Array.isArray(t);if(i==="string"&&(r==="__proto__"||n.length>1&&gn(r)))return;if(Array.isArray(r)){for(let c=0;c<r.length;c++)it(t,[r[c]].concat(n),e);return}else if(u&&i==="function"){for(let c=0;c<t.length;c++)r(t[c],c)&&it(t,[c].concat(n),e);return}else if(u&&i==="object"){const{from:c=0,to:d=t.length-1,by:g=1}=r;for(let a=c;a<=d;a+=g)it(t,[a].concat(n),e);return}else if(n.length>1){it(t[r],n,[r].concat(e));return}o=t[r],e=[r].concat(e)}let s=n[0];typeof s=="function"&&(s=s(o,e),s===o)||r===void 0&&s==null||(s=K(s),r===void 0||B(o)&&B(s)&&!Array.isArray(s)?dn(o,s):G(t,r,s))}function hn(...[t,n]){const e=K(t||{}),r=Array.isArray(e),o=an(e);function s(...i){$n(()=>{r&&i.length===1?ce(e,i[0]):it(e,i)})}return[o,s]}const Ae=Symbol("store-root"),wt=new WeakMap,pn={get(t,n){if(n===vt)return t;const e=t[n];if(n===V||n===X||n===R||n===I||n==="__proto__")return e;let r;return B(e)?wt.get(e)||(wt.set(e,r=new Proxy(e,pn)),r):e},set(t,n,e){return G(t,n,K(e)),!0},deleteProperty(t,n){return G(t,n,void 0,!0),!0}};function yn(t){return n=>{if(B(n)){let e;(e=wt.get(n))||wt.set(n,e=new Proxy(n,pn)),t(e)}return n}}let j={};function vn(t){j.stack&&t.setAttribute("stack",j.stack),j.position&&t.setAttribute("position",j.position),j.max!==void 0&&t.setAttribute("max",String(j.max)),j.appearance&&t.setAttribute("appearance",j.appearance),j.inverse!==void 0&&(j.inverse?t.setAttribute("inverse",""):t.removeAttribute("inverse"))}function ae(t){j={...j,...t},!(typeof document>"u")&&document.querySelectorAll("kai-toast-region").forEach(n=>vn(n))}const fe=5e3,de=7e3,{toasts:It,setToasts:ut,mounted:ke,setMounted:ge}=F(()=>{const[t,n]=hn([]),[e,r]=E(!1);return{toasts:t,setToasts:n,mounted:e,setMounted:r}});let bn=0;function he(){return bn+=1,`toast-${bn}`}function pe(t){const n=t.duration??fe;return n===0?0:t.action?Math.max(n,de):n}const wn=new Map;function ye(t=null){if(typeof document>"u")return;const n=wn.get(t);if(n&&n.isConnected)return n;const e=document.createElement("kai-toast-region");return document.body.appendChild(e),e.toasts=It,t&&(e.target=t),vn(e),wn.set(t,e),ge(!0),e}function ve(t){const n=It.findIndex(e=>e.id===t.id);n>=0?ut(n,t):ut(yn(e=>{e.push(t)}))}function mn(t){ut(n=>n.filter(e=>e.id!==t))}function be(t){return{id:t,dismiss:()=>mn(t),update:n=>{const e=It.findIndex(r=>r.id===t);e>=0&&ut(e,r=>({...r,...n}))}}}function lt(t,n,e){ye(n?.target??null);const r=n?.id??he(),o={id:r,message:t,variant:n?.variant??e,appearance:n?.appearance??j.appearance??"pill",inverse:n?.inverse??j.inverse??!1,description:n?.description,action:n?.action,duration:n?.duration,dismissible:n?.dismissible,target:n?.target};return ve(o),be(r)}const we=Object.assign((t,n)=>lt(t,n,"neutral"),{success:(t,n)=>lt(t,n,"success"),warning:(t,n)=>lt(t,n,"warning"),error:(t,n)=>lt(t,n,"error"),info:(t,n)=>lt(t,n,"info"),dismiss:mn,clear:()=>ut([])}),me=typeof window<"u"&&typeof customElements<"u"?import("./register-impl-CaaHJcea.js"):Promise.resolve();export{K as A,se as E,te as F,ne as I,oe as M,ee as S,F as a,Gt as b,A as c,_n as configureCodeHighlighting,ae as configureToasts,Qt as d,Wn as e,me as elementsReady,E as f,Hn as g,Xn as h,zn as i,qn as isCodeHighlightingEnabled,Bn as j,Ct as k,Zn as l,Qn as m,In as n,tt as o,Dn as p,En as q,Xt as r,p as s,Pn as t,we as toast,m as u,re as v,Mt as w,pe as x,hn as y,yn as z};
|
|
1
|
+
const Sn={bash:()=>import("./bash-InADTalH.js"),javascript:()=>import("./javascript-C25yR2R2.js"),typescript:()=>import("./typescript-RycA9KXf.js"),tsx:()=>import("./tsx-B8rCNbgL.js"),html:()=>import("./html-CPZ3oZQ7.js"),css:()=>import("./css-M7EaDHN_.js"),json:()=>import("./json-DxJze_jm.js"),vue:()=>import("./vue-BmIZj4XD.js"),svelte:()=>import("./svelte--5p79yCD.js")},On={"github-dark-dimmed":()=>import("./github-dark-dimmed-DUshB20C.js"),"github-light":()=>import("./github-light-JYsPkUQd.js")},xn={js:"javascript",ts:"typescript",jsx:"tsx",sh:"bash",shell:"bash"},Nt="github-dark-dimmed";let Ot=!0,xt={...Sn},At={...On},kt={...xn},jt=null;const zt=new Set,Ft=new Set;function An(){return jt||(jt=(async()=>{const[{createHighlighterCore:t},{createJavaScriptRegexEngine:n}]=await Promise.all([import("./core-C8fzo39E.js"),import("./engine-javascript-C1x7zo1_.js")]);return t({themes:[],langs:[],engine:n()})})()),jt}function Rt(t){return kt[t]??t}async function kn(t,n){const e=Rt(n);if(zt.has(e))return!0;const r=xt[e];return r?(await t.loadLanguage(r()),zt.add(e),!0):!1}async function Kt(t,n){if(Ft.has(n))return!0;const e=At[n];return e?(await t.loadTheme(e()),Ft.add(n),!0):!1}function jn(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ct(t){return`<pre><code>${jn(t)}</code></pre>`}async function Pn(t,n,e){if(!Ot||!t)return ct(t);try{const r=await An();if(!await kn(r,n))return ct(t);const o=await Kt(r,e)?e:await Kt(r,Nt)?Nt:null;return o?r.codeToHtml(t,{lang:Rt(n),theme:o}):ct(t)}catch{return ct(t)}}function _n(t){t.enabled!==void 0&&(Ot=t.enabled),t.languages&&(xt={...xt,...t.languages}),t.themes&&(At={...At,...t.themes}),t.aliases&&(kt={...kt,...t.aliases})}function qn(){return Ot}const p={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Lt(this.context.count)},getNextContextId(){return Lt(this.context.count++)}};function Lt(t){const n=String(t),e=n.length-1;return p.context.id+(e?String.fromCharCode(96+e):"")+n}function Pt(t){p.context=t}function Cn(){return{...p.context,id:p.getNextContextId(),count:0}}const Se=!1,Mn=(t,n)=>t===n,V=Symbol("solid-proxy"),Jt=typeof Proxy=="function",X=Symbol("solid-track"),Oe=Symbol("solid-dev-component"),at={equals:Mn};let Y=null,Ut=en;const P=1,Z=2,Wt={owned:null,cleanups:null,context:null,owner:null},_t={};var f=null;let l=null,J=null,U=null,h=null,b=null,O=null,ft=0;function F(t,n){const e=h,r=f,o=t.length===0,s=n===void 0?r:n,i=o?Wt:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=o?t:()=>t(()=>m(()=>z(i)));f=i,h=null;try{return k(u,!0)}finally{h=e,f=r}}function E(t,n){n=n?Object.assign({},at,n):at;const e={value:t,observers:null,observerSlots:null,comparator:n.equals||void 0},r=o=>(typeof o=="function"&&(l&&l.running&&l.sources.has(e)?o=o(e.tValue):o=o(e.value)),tn(e,o));return[Zt.bind(e),r]}function Bt(t,n,e){const r=et(t,n,!0,P);J&&l&&l.running?b.push(r):W(r)}function Gt(t,n,e){const r=et(t,n,!1,P);J&&l&&l.running?b.push(r):W(r)}function Qt(t,n,e){Ut=Kn;const r=et(t,n,!1,P),o=nt&&Ct(nt);o&&(r.suspense=o),(!e||!e.render)&&(r.user=!0),O?O.push(r):W(r)}function A(t,n,e){e=e?Object.assign({},at,e):at;const r=et(t,n,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=e.equals||void 0,J&&l&&l.running?(r.tState=P,b.push(r)):W(r),Zt.bind(r)}function Vn(t){return t&&typeof t=="object"&&"then"in t}function En(t,n,e){let r,o,s;typeof n=="function"?(r=t,o=n,s=e||{}):(r=!0,o=t,s=n||{});let i=null,u=_t,c=null,d=!1,g=!1,a="initialValue"in s,w=typeof r=="function"&&A(r);const S=new Set,[_,D]=(s.storage||E)(s.initialValue),[N,L]=E(void 0),[q,C]=E(void 0,{equals:!1}),[M,T]=E(a?"ready":"unresolved");p.context&&(c=p.getNextContextId(),s.ssrLoadFrom==="initial"?u=s.initialValue:p.load&&p.has(c)&&(u=p.load(c)));function H(y,v,$,x){return i===y&&(i=null,x!==void 0&&(a=!0),(y===u||v===u)&&s.onHydrated&&queueMicrotask(()=>s.onHydrated(x,{value:v})),u=_t,l&&y&&d?(l.promises.delete(y),d=!1,k(()=>{l.running=!0,Tt(v,$)},!1)):Tt(v,$)),v}function Tt(y,v){k(()=>{v===void 0&&D(()=>y),T(v!==void 0?"errored":a?"ready":"unresolved"),L(v);for(const $ of S.keys())$.decrement();S.clear()},!1)}function mt(){const y=nt&&Ct(nt),v=_(),$=N();if($!==void 0&&!i)throw $;return h&&!h.user&&y&&Bt(()=>{q(),i&&(y.resolved&&l&&d?l.promises.add(i):S.has(y)||(y.increment(),S.add(y)))}),v}function St(y=!0){if(y!==!1&&g)return;g=!1;const v=w?w():r;if(d=l&&l.running,v==null||v===!1){H(i,m(_));return}l&&i&&l.promises.delete(i);let $;const x=u!==_t?u:m(()=>{try{return o(v,{value:_(),refetching:y})}catch(Q){$=Q}});if($!==void 0){H(i,void 0,gt($),v);return}else if(!Vn(x))return H(i,x,void 0,v),x;return i=x,"v"in x?(x.s===1?H(i,x.v,void 0,v):H(i,void 0,gt(x.v),v),x):(g=!0,queueMicrotask(()=>g=!1),k(()=>{T(a?"refreshing":"pending"),C()},!1),x.then(Q=>H(x,Q,void 0,v),Q=>H(x,void 0,gt(Q),v)))}Object.defineProperties(mt,{state:{get:()=>M()},error:{get:()=>N()},loading:{get(){const y=M();return y==="pending"||y==="refreshing"}},latest:{get(){if(!a)return mt();const y=N();if(y&&!i)throw y;return _()}}});let Ht=f;return w?Bt(()=>(Ht=f,St(!1))):St(!1),[mt,{refetch:y=>Xt(Ht,()=>St(y)),mutate:D}]}function $n(t){return k(t,!1)}function m(t){if(!U&&h===null)return t();const n=h;h=null;try{return U?U.untrack(t):t()}finally{h=n}}function Dn(t,n,e){const r=Array.isArray(t);let o,s=e&&e.defer;return i=>{let u;if(r){u=Array(t.length);for(let d=0;d<t.length;d++)u[d]=t[d]()}else u=t();if(s)return s=!1,i;const c=m(()=>n(u,o,i));return o=u,c}}function In(t){Qt(()=>m(t))}function tt(t){return f===null||(f.cleanups===null?f.cleanups=[t]:f.cleanups.push(t)),t}function Tn(t,n){Y||(Y=Symbol("error")),f=et(void 0,void 0,!0),f.context={...f.context,[Y]:[n]},l&&l.running&&l.sources.add(f);try{return t()}catch(e){ot(e)}finally{f=f.owner}}function qt(){return h}function Hn(){return f}function Xt(t,n){const e=f,r=h;f=t,h=null;try{return k(n,!0)}catch(o){ot(o)}finally{f=e,h=r}}function Nn(t){if(l&&l.running)return t(),l.done;const n=h,e=f;return Promise.resolve().then(()=>{h=n,f=e;let r;return(J||nt)&&(r=l||(l={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),r.done||(r.done=new Promise(o=>r.resolve=o)),r.running=!0),k(t,!1),h=f=null,r?r.done:void 0})}const[xe,Yt]=E(!1);function zn(t,n){const e=Symbol("context");return{id:e,Provider:Ln(e),defaultValue:t}}function Ct(t){let n;return f&&f.context&&(n=f.context[t.id])!==void 0?n:t.defaultValue}function Mt(t){const n=A(t),e=A(()=>Vt(n()));return e.toArray=()=>{const r=e();return Array.isArray(r)?r:r!=null?[r]:[]},e}let nt;function Zt(){const t=l&&l.running;if(this.sources&&(t?this.tState:this.state))if((t?this.tState:this.state)===P)W(this);else{const n=b;b=null,k(()=>dt(this),!1),b=n}if(h){const n=this.observers;if(!n||n[n.length-1]!==h){const e=n?n.length:0;h.sources?(h.sources.push(this),h.sourceSlots.push(e)):(h.sources=[this],h.sourceSlots=[e]),n?(n.push(h),this.observerSlots.push(h.sources.length-1)):(this.observers=[h],this.observerSlots=[h.sources.length-1])}}return t&&l.sources.has(this)?this.tValue:this.value}function tn(t,n,e){let r=l&&l.running&&l.sources.has(t)?t.tValue:t.value;if(!t.comparator||!t.comparator(r,n)){if(l){const o=l.running;(o||!e&&l.sources.has(t))&&(l.sources.add(t),t.tValue=n),o||(t.value=n)}else t.value=n;t.observers&&t.observers.length&&k(()=>{for(let o=0;o<t.observers.length;o+=1){const s=t.observers[o],i=l&&l.running;i&&l.disposed.has(s)||((i?!s.tState:!s.state)&&(s.pure?b.push(s):O.push(s),s.observers&&rn(s)),i?s.tState=P:s.state=P)}if(b.length>1e6)throw b=[],new Error},!1)}return n}function W(t){if(!t.fn)return;z(t);const n=ft;nn(t,l&&l.running&&l.sources.has(t)?t.tValue:t.value,n),l&&!l.running&&l.sources.has(t)&&queueMicrotask(()=>{k(()=>{l&&(l.running=!0),h=f=t,nn(t,t.tValue,n),h=f=null},!1)})}function nn(t,n,e){let r;const o=f,s=h;h=f=t;try{r=t.fn(n)}catch(i){return t.pure&&(l&&l.running?(t.tState=P,t.tOwned&&t.tOwned.forEach(z),t.tOwned=void 0):(t.state=P,t.owned&&t.owned.forEach(z),t.owned=null)),t.updatedAt=e+1,ot(i)}finally{h=s,f=o}(!t.updatedAt||t.updatedAt<=e)&&(t.updatedAt!=null&&"observers"in t?tn(t,r,!0):l&&l.running&&t.pure?(l.sources.has(t)||(t.value=r),l.sources.add(t),t.tValue=r):t.value=r,t.updatedAt=e)}function et(t,n,e,r=P,o){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:n,owner:f,context:f?f.context:null,pure:e};if(l&&l.running&&(s.state=0,s.tState=r),f===null||f!==Wt&&(l&&l.running&&f.pure?f.tOwned?f.tOwned.push(s):f.tOwned=[s]:f.owned?f.owned.push(s):f.owned=[s]),U&&s.fn){const i=s.fn,[u,c]=E(void 0,{equals:!1}),d=U.factory(i,c);tt(()=>d.dispose());let g;const a=()=>Nn(c).then(()=>{g&&(g.dispose(),g=void 0)});s.fn=w=>(u(),l&&l.running?(g||(g=U.factory(i,a)),g.track(w)):d.track(w))}return s}function rt(t){const n=l&&l.running;if((n?t.tState:t.state)===0)return;if((n?t.tState:t.state)===Z)return dt(t);if(t.suspense&&m(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<ft);){if(n&&l.disposed.has(t))return;(n?t.tState:t.state)&&e.push(t)}for(let r=e.length-1;r>=0;r--){if(t=e[r],n){let o=t,s=e[r+1];for(;(o=o.owner)&&o!==s;)if(l.disposed.has(o))return}if((n?t.tState:t.state)===P)W(t);else if((n?t.tState:t.state)===Z){const o=b;b=null,k(()=>dt(t,e[0]),!1),b=o}}}function k(t,n){if(b)return t();let e=!1;n||(b=[]),O?e=!0:O=[],ft++;try{const r=t();return Fn(e),r}catch(r){e||(O=null),b=null,ot(r)}}function Fn(t){if(b&&(J&&l&&l.running?Rn(b):en(b),b=null),t)return;let n;if(l){if(!l.promises.size&&!l.queue.size){const r=l.sources,o=l.disposed;O.push.apply(O,l.effects),n=l.resolve;for(const s of O)"tState"in s&&(s.state=s.tState),delete s.tState;l=null,k(()=>{for(const s of o)z(s);for(const s of r){if(s.value=s.tValue,s.owned)for(let i=0,u=s.owned.length;i<u;i++)z(s.owned[i]);s.tOwned&&(s.owned=s.tOwned),delete s.tValue,delete s.tOwned,s.tState=0}Yt(!1)},!1)}else if(l.running){l.running=!1,l.effects.push.apply(l.effects,O),O=null,Yt(!0);return}}const e=O;O=null,e.length&&k(()=>Ut(e),!1),n&&n()}function en(t){for(let n=0;n<t.length;n++)rt(t[n])}function Rn(t){for(let n=0;n<t.length;n++){const e=t[n],r=l.queue;r.has(e)||(r.add(e),J(()=>{r.delete(e),k(()=>{l.running=!0,rt(e)},!1),l&&(l.running=!1)}))}}function Kn(t){let n,e=0;for(n=0;n<t.length;n++){const r=t[n];r.user?t[e++]=r:rt(r)}if(p.context){if(p.count){p.effects||(p.effects=[]),p.effects.push(...t.slice(0,e));return}Pt()}for(p.effects&&(p.done||!p.count)&&(t=[...p.effects,...t],e+=p.effects.length,delete p.effects),n=0;n<e;n++)rt(t[n])}function dt(t,n){const e=l&&l.running;e?t.tState=0:t.state=0;for(let r=0;r<t.sources.length;r+=1){const o=t.sources[r];if(o.sources){const s=e?o.tState:o.state;s===P?o!==n&&(!o.updatedAt||o.updatedAt<ft)&&rt(o):s===Z&&dt(o,n)}}}function rn(t){const n=l&&l.running;for(let e=0;e<t.observers.length;e+=1){const r=t.observers[e];(n?!r.tState:!r.state)&&(n?r.tState=Z:r.state=Z,r.pure?b.push(r):O.push(r),r.observers&&rn(r))}}function z(t){let n;if(t.sources)for(;t.sources.length;){const e=t.sources.pop(),r=t.sourceSlots.pop(),o=e.observers;if(o&&o.length){const s=o.pop(),i=e.observerSlots.pop();r<o.length&&(s.sourceSlots[i]=r,o[r]=s,e.observerSlots[r]=i)}}if(t.tOwned){for(n=t.tOwned.length-1;n>=0;n--)z(t.tOwned[n]);delete t.tOwned}if(l&&l.running&&t.pure)on(t,!0);else if(t.owned){for(n=t.owned.length-1;n>=0;n--)z(t.owned[n]);t.owned=null}if(t.cleanups){for(n=t.cleanups.length-1;n>=0;n--)t.cleanups[n]();t.cleanups=null}l&&l.running?t.tState=0:t.state=0}function on(t,n){if(n||(t.tState=0,l.disposed.add(t)),t.owned)for(let e=0;e<t.owned.length;e++)on(t.owned[e])}function gt(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function sn(t,n,e){try{for(const r of n)r(t)}catch(r){ot(r,e&&e.owner||null)}}function ot(t,n=f){const e=Y&&n&&n.context&&n.context[Y],r=gt(t);if(!e)throw r;O?O.push({fn(){sn(r,e,n)},state:P}):sn(r,e,n)}function Vt(t){if(typeof t=="function"&&!t.length)return Vt(t());if(Array.isArray(t)){const n=[];for(let e=0;e<t.length;e++){const r=Vt(t[e]);if(Array.isArray(r))if(r.length<32768)n.push.apply(n,r);else for(let o=0;o<r.length;o++)n.push(r[o]);else n.push(r)}return n}return t}function Ln(t,n){return function(e){let r;return Gt(()=>r=m(()=>(f.context={...f.context,[t]:e.value},Mt(()=>e.children))),void 0),r}}const Et=Symbol("fallback");function ht(t){for(let n=0;n<t.length;n++)t[n]()}function Jn(t,n,e={}){let r=[],o=[],s=[],i=0,u=n.length>1?[]:null;return tt(()=>ht(s)),()=>{let c=t()||[],d=c.length,g,a;return c[X],m(()=>{let S,_,D,N,L,q,C,M,T;if(d===0)i!==0&&(ht(s),s=[],r=[],o=[],i=0,u&&(u=[])),e.fallback&&(r=[Et],o[0]=F(H=>(s[0]=H,e.fallback())),i=1);else if(i===0){for(o=new Array(d),a=0;a<d;a++)r[a]=c[a],o[a]=F(w);i=d}else{for(D=new Array(d),N=new Array(d),u&&(L=new Array(d)),q=0,C=Math.min(i,d);q<C&&r[q]===c[q];q++);for(C=i-1,M=d-1;C>=q&&M>=q&&r[C]===c[M];C--,M--)D[M]=o[C],N[M]=s[C],u&&(L[M]=u[C]);for(S=new Map,_=new Array(M+1),a=M;a>=q;a--)T=c[a],g=S.get(T),_[a]=g===void 0?-1:g,S.set(T,a);for(g=q;g<=C;g++)T=r[g],a=S.get(T),a!==void 0&&a!==-1?(D[a]=o[g],N[a]=s[g],u&&(L[a]=u[g]),a=_[a],S.set(T,a)):s[g]();for(a=q;a<d;a++)a in D?(o[a]=D[a],s[a]=N[a],u&&(u[a]=L[a],u[a](a))):o[a]=F(w);o=o.slice(0,i=d),r=c.slice(0)}return o});function w(S){if(s[a]=S,u){const[_,D]=E(a);return u[a]=D,n(c[a],_)}return n(c[a])}}}function Un(t,n,e={}){let r=[],o=[],s=[],i=[],u=0,c;return tt(()=>ht(s)),()=>{const d=t()||[],g=d.length;return d[X],m(()=>{if(g===0)return u!==0&&(ht(s),s=[],r=[],o=[],u=0,i=[]),e.fallback&&(r=[Et],o[0]=F(w=>(s[0]=w,e.fallback())),u=1),o;for(r[0]===Et&&(s[0](),s=[],r=[],o=[],u=0),c=0;c<g;c++)c<r.length&&r[c]!==d[c]?i[c](()=>d[c]):c>=r.length&&(o[c]=F(a));for(;c<r.length;c++)s[c]();return u=i.length=s.length=g,r=d.slice(0),o=o.slice(0,u)});function a(w){s[c]=w;const[S,_]=E(d[c]);return i[c]=_,n(S,c)}}}let un=!1;function Wn(){un=!0}function Bn(t,n){if(un&&p.context){const e=p.context;Pt(Cn());const r=m(()=>t(n||{}));return Pt(e),r}return m(()=>t(n||{}))}function pt(){return!0}const $t={get(t,n,e){return n===V?e:t.get(n)},has(t,n){return n===V?!0:t.has(n)},set:pt,deleteProperty:pt,getOwnPropertyDescriptor(t,n){return{configurable:!0,enumerable:!0,get(){return t.get(n)},set:pt,deleteProperty:pt}},ownKeys(t){return t.keys()}};function Dt(t){return(t=typeof t=="function"?t():t)?t:{}}function Gn(){for(let t=0,n=this.length;t<n;++t){const e=this[t]();if(e!==void 0)return e}}function Qn(...t){let n=!1;for(let i=0;i<t.length;i++){const u=t[i];n=n||!!u&&V in u,t[i]=typeof u=="function"?(n=!0,A(u)):u}if(Jt&&n)return new Proxy({get(i){for(let u=t.length-1;u>=0;u--){const c=Dt(t[u])[i];if(c!==void 0)return c}},has(i){for(let u=t.length-1;u>=0;u--)if(i in Dt(t[u]))return!0;return!1},keys(){const i=[];for(let u=0;u<t.length;u++)i.push(...Object.keys(Dt(t[u])));return[...new Set(i)]}},$t);const e={},r=Object.create(null);for(let i=t.length-1;i>=0;i--){const u=t[i];if(!u)continue;const c=Object.getOwnPropertyNames(u);for(let d=c.length-1;d>=0;d--){const g=c[d];if(g==="__proto__"||g==="constructor")continue;const a=Object.getOwnPropertyDescriptor(u,g);if(!r[g])r[g]=a.get?{enumerable:!0,configurable:!0,get:Gn.bind(e[g]=[a.get.bind(u)])}:a.value!==void 0?a:void 0;else{const w=e[g];w&&(a.get?w.push(a.get.bind(u)):a.value!==void 0&&w.push(()=>a.value))}}}const o={},s=Object.keys(r);for(let i=s.length-1;i>=0;i--){const u=s[i],c=r[u];c&&c.get?Object.defineProperty(o,u,c):o[u]=c?c.value:void 0}return o}function Xn(t,...n){const e=n.length;if(Jt&&V in t){const o=e>1?n.flat():n[0],s=n.map(i=>new Proxy({get(u){return i.includes(u)?t[u]:void 0},has(u){return i.includes(u)&&u in t},keys(){return i.filter(u=>u in t)}},$t));return s.push(new Proxy({get(i){return o.includes(i)?void 0:t[i]},has(i){return o.includes(i)?!1:i in t},keys(){return Object.keys(t).filter(i=>!o.includes(i))}},$t)),s}const r=[];for(let o=0;o<=e;o++)r[o]={};for(const o of Object.getOwnPropertyNames(t)){let s=e;for(let u=0;u<n.length;u++)if(n[u].includes(o)){s=u;break}const i=Object.getOwnPropertyDescriptor(t,o);!i.get&&!i.set&&i.enumerable&&i.writable&&i.configurable?r[s][o]=i.value:Object.defineProperty(r[s],o,i)}return r}let Yn=0;function Zn(){return p.context?p.getNextContextId():`cl-${Yn++}`}const ln=t=>`Stale read from <${t}>.`;function te(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Jn(()=>t.each,t.children,n||void 0))}function ne(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Un(()=>t.each,t.children,n||void 0))}function ee(t){const n=t.keyed,e=A(()=>t.when,void 0,void 0),r=n?e:A(e,void 0,{equals:(o,s)=>!o==!s});return A(()=>{const o=r();if(o){const s=t.children;return typeof s=="function"&&s.length>0?m(()=>s(n?o:()=>{if(!m(r))throw ln("Show");return e()})):s}return t.fallback},void 0,void 0)}function re(t){const n=Mt(()=>t.children),e=A(()=>{const r=n(),o=Array.isArray(r)?r:[r];let s=()=>{};for(let i=0;i<o.length;i++){const u=i,c=o[i],d=s,g=A(()=>d()?void 0:c.when,void 0,void 0),a=c.keyed?g:A(g,void 0,{equals:(w,S)=>!w==!S});s=()=>d()||(a()?[u,g,c]:void 0)}return s});return A(()=>{const r=e()();if(!r)return t.fallback;const[o,s,i]=r,u=i.children;return typeof u=="function"&&u.length>0?m(()=>u(i.keyed?s():()=>{var c;if(((c=m(e)())==null?void 0:c[0])!==o)throw ln("Match");return s()})):u},void 0,void 0)}function oe(t){return t}let yt;function se(t){let n;p.context&&p.load&&(n=p.load(p.getContextId()));const[e,r]=E(n,void 0);return yt||(yt=new Set),yt.add(r),tt(()=>yt.delete(r)),A(()=>{let o;if(o=e()){const s=t.fallback;return typeof s=="function"&&s.length?m(()=>s(o,()=>r())):s}return Tn(()=>t.children,r)},void 0,void 0)}const vt=Symbol("store-raw"),R=Symbol("store-node"),I=Symbol("store-has"),cn=Symbol("store-self");function an(t){let n=t[V];if(!n&&(Object.defineProperty(t,V,{value:n=new Proxy(t,le)}),!Array.isArray(t))){const e=Object.keys(t),r=Object.getOwnPropertyDescriptors(t),o=Object.getPrototypeOf(t),s=o!==null&&t!==null&&typeof t=="object"&&!Array.isArray(t)&&o!==Object.prototype;if(s){const i=Object.getOwnPropertyDescriptors(o);e.push(...Object.keys(i)),Object.assign(r,i)}for(let i=0,u=e.length;i<u;i++){const c=e[i];s&&c==="constructor"||r[c].get&&Object.defineProperty(t,c,{configurable:!0,enumerable:r[c].enumerable,get:r[c].get.bind(n)})}}return n}function B(t){let n;return t!=null&&typeof t=="object"&&(t[V]||!(n=Object.getPrototypeOf(t))||n===Object.prototype||Array.isArray(t))}function K(t,n=new Set){let e,r,o,s;if(e=t!=null&&t[vt])return e;if(!B(t)||n.has(t))return t;if(Array.isArray(t)){Object.isFrozen(t)?t=t.slice(0):n.add(t);for(let i=0,u=t.length;i<u;i++)o=t[i],(r=K(o,n))!==o&&(t[i]=r)}else{Object.isFrozen(t)?t=Object.assign({},t):n.add(t);const i=Object.keys(t),u=Object.getOwnPropertyDescriptors(t);for(let c=0,d=i.length;c<d;c++)s=i[c],!u[s].get&&(o=t[s],(r=K(o,n))!==o&&(t[s]=r))}return t}function bt(t,n){let e=t[n];return e||Object.defineProperty(t,n,{value:e=Object.create(null)}),e}function st(t,n,e){if(t[n])return t[n];const[r,o]=E(e,{equals:!1,internal:!0});return r.$=o,t[n]=r}function ie(t,n){const e=Reflect.getOwnPropertyDescriptor(t,n);return!e||e.get||!e.configurable||n===V||n===R||(delete e.value,delete e.writable,e.get=()=>t[V][n]),e}function fn(t){qt()&&st(bt(t,R),cn)()}function ue(t){return fn(t),Reflect.ownKeys(t)}const le={get(t,n,e){if(n===vt)return t;if(n===V)return e;if(n===X)return fn(t),e;const r=bt(t,R),o=r[n];let s=o?o():t[n];if(n===R||n===I||n==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(t,n);qt()&&(typeof s!="function"||t.hasOwnProperty(n))&&!(i&&i.get)&&(s=st(r,n,s)())}return B(s)?an(s):s},has(t,n){return n===vt||n===V||n===X||n===R||n===I||n==="__proto__"?!0:(qt()&&st(bt(t,I),n)(),n in t)},set(){return!0},deleteProperty(){return!0},ownKeys:ue,getOwnPropertyDescriptor:ie};function G(t,n,e,r=!1){if(n==="__proto__"||!r&&t[n]===e)return;const o=t[n],s=t.length;e===void 0?(delete t[n],t[I]&&t[I][n]&&o!==void 0&&t[I][n].$()):(t[n]=e,t[I]&&t[I][n]&&o===void 0&&t[I][n].$());let i=bt(t,R),u;if((u=st(i,n,o))&&u.$(()=>e),Array.isArray(t)&&t.length!==s){for(let c=t.length;c<s;c++)(u=i[c])&&u.$();(u=st(i,"length",s))&&u.$(t.length)}(u=i[cn])&&u.$()}function dn(t,n){const e=Object.keys(n);for(let r=0;r<e.length;r+=1){const o=e[r];gn(o)||G(t,o,n[o])}}function gn(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function ce(t,n){if(typeof n=="function"&&(n=n(t)),n=K(n),Array.isArray(n)){if(t===n)return;let e=0,r=n.length;for(;e<r;e++){const o=n[e];t[e]!==o&&G(t,e,o)}G(t,"length",r)}else dn(t,n)}function it(t,n,e=[]){let r,o=t;if(n.length>1){r=n.shift();const i=typeof r,u=Array.isArray(t);if(i==="string"&&(r==="__proto__"||n.length>1&&gn(r)))return;if(Array.isArray(r)){for(let c=0;c<r.length;c++)it(t,[r[c]].concat(n),e);return}else if(u&&i==="function"){for(let c=0;c<t.length;c++)r(t[c],c)&&it(t,[c].concat(n),e);return}else if(u&&i==="object"){const{from:c=0,to:d=t.length-1,by:g=1}=r;for(let a=c;a<=d;a+=g)it(t,[a].concat(n),e);return}else if(n.length>1){it(t[r],n,[r].concat(e));return}o=t[r],e=[r].concat(e)}let s=n[0];typeof s=="function"&&(s=s(o,e),s===o)||r===void 0&&s==null||(s=K(s),r===void 0||B(o)&&B(s)&&!Array.isArray(s)?dn(o,s):G(t,r,s))}function hn(...[t,n]){const e=K(t||{}),r=Array.isArray(e),o=an(e);function s(...i){$n(()=>{r&&i.length===1?ce(e,i[0]):it(e,i)})}return[o,s]}const Ae=Symbol("store-root"),wt=new WeakMap,pn={get(t,n){if(n===vt)return t;const e=t[n];if(n===V||n===X||n===R||n===I||n==="__proto__")return e;let r;return B(e)?wt.get(e)||(wt.set(e,r=new Proxy(e,pn)),r):e},set(t,n,e){return G(t,n,K(e)),!0},deleteProperty(t,n){return G(t,n,void 0,!0),!0}};function yn(t){return n=>{if(B(n)){let e;(e=wt.get(n))||wt.set(n,e=new Proxy(n,pn)),t(e)}return n}}let j={};function vn(t){j.stack&&t.setAttribute("stack",j.stack),j.position&&t.setAttribute("position",j.position),j.max!==void 0&&t.setAttribute("max",String(j.max)),j.appearance&&t.setAttribute("appearance",j.appearance),j.inverse!==void 0&&(j.inverse?t.setAttribute("inverse",""):t.removeAttribute("inverse"))}function ae(t){j={...j,...t},!(typeof document>"u")&&document.querySelectorAll("kai-toast-region").forEach(n=>vn(n))}const fe=5e3,de=7e3,{toasts:It,setToasts:ut,mounted:ke,setMounted:ge}=F(()=>{const[t,n]=hn([]),[e,r]=E(!1);return{toasts:t,setToasts:n,mounted:e,setMounted:r}});let bn=0;function he(){return bn+=1,`toast-${bn}`}function pe(t){const n=t.duration??fe;return n===0?0:t.action?Math.max(n,de):n}const wn=new Map;function ye(t=null){if(typeof document>"u")return;const n=wn.get(t);if(n&&n.isConnected)return n;const e=document.createElement("kai-toast-region");return document.body.appendChild(e),e.toasts=It,t&&(e.target=t),vn(e),wn.set(t,e),ge(!0),e}function ve(t){const n=It.findIndex(e=>e.id===t.id);n>=0?ut(n,t):ut(yn(e=>{e.push(t)}))}function mn(t){ut(n=>n.filter(e=>e.id!==t))}function be(t){return{id:t,dismiss:()=>mn(t),update:n=>{const e=It.findIndex(r=>r.id===t);e>=0&&ut(e,r=>({...r,...n}))}}}function lt(t,n,e){ye(n?.target??null);const r=n?.id??he(),o={id:r,message:t,variant:n?.variant??e,appearance:n?.appearance??j.appearance??"pill",inverse:n?.inverse??j.inverse??!1,description:n?.description,action:n?.action,duration:n?.duration,dismissible:n?.dismissible,target:n?.target};return ve(o),be(r)}const we=Object.assign((t,n)=>lt(t,n,"neutral"),{success:(t,n)=>lt(t,n,"success"),warning:(t,n)=>lt(t,n,"warning"),error:(t,n)=>lt(t,n,"error"),info:(t,n)=>lt(t,n,"info"),dismiss:mn,clear:()=>ut([])}),me=typeof window<"u"&&typeof customElements<"u"?import("./register-impl-DQyejdfb.js").then(t=>t.r):Promise.resolve();export{K as A,se as E,te as F,ne as I,oe as M,ee as S,F as a,Gt as b,A as c,_n as configureCodeHighlighting,ae as configureToasts,Qt as d,Wn as e,me as elementsReady,E as f,Hn as g,Xn as h,zn as i,qn as isCodeHighlightingEnabled,Bn as j,Ct as k,Zn as l,Qn as m,In as n,tt as o,Dn as p,En as q,Xt as r,p as s,Pn as t,we as toast,m as u,re as v,Mt as w,pe as x,hn as y,yn as z};
|
package/dist/llms/llms-full.txt
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @kitn.ai/ui
|
|
5
5
|
|
|
6
|
-
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML.
|
|
6
|
+
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. 80 custom elements, every one prefixed `kai-` (e.g. `<kai-chat>`, `<kai-artifact>`): streaming responses, markdown + code rendering, reasoning/tool panels, attachments, conversation sidebar, voice input. Zero framework dependency for consumers; the SolidJS runtime it is authored in is bundled in, so the host needs nothing.
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -37,7 +37,7 @@ Drop an element into any framework (React, Vue, plain HTML). Data in via JS prop
|
|
|
37
37
|
- `<kai-prompt-input>` — standalone composer with send button.
|
|
38
38
|
|
|
39
39
|
**Layer 2 — composable primitives** (`import { … } from '@kitn.ai/ui'`):
|
|
40
|
-
All
|
|
40
|
+
All 80 elements are also exported individually. Use them for custom layouts or features `<kai-chat>` does not expose (ChainOfThought, FeedbackBar, ThinkingBar, VoiceInput, …). Your bundler tree-shakes the rest.
|
|
41
41
|
|
|
42
42
|
## Key rules for the web components
|
|
43
43
|
|
|
@@ -99,7 +99,7 @@ For Tailwind builds: `@import "@kitn.ai/ui/theme.css"` in your CSS.
|
|
|
99
99
|
|
|
100
100
|
## Docs
|
|
101
101
|
|
|
102
|
-
- Full element reference (all
|
|
102
|
+
- Full element reference (all 80 elements, every prop/event): ./llms-full.txt — https://kitn.dev/llms-full.txt
|
|
103
103
|
- Machine-readable Custom Elements Manifest: https://unpkg.com/@kitn.ai/ui/dist/custom-elements.json
|
|
104
104
|
- Working examples: https://github.com/kitn-ai/ui/tree/main/examples
|
|
105
105
|
- Storybook: https://storybook.kitn.dev
|
|
@@ -173,7 +173,7 @@ The same rule applies to every array/object property (`models`, `context`, `sugg
|
|
|
173
173
|
|
|
174
174
|
---
|
|
175
175
|
|
|
176
|
-
## Element reference (
|
|
176
|
+
## Element reference (80 elements, generated from custom-elements.json)
|
|
177
177
|
|
|
178
178
|
Every element also accepts the `theme` attribute. Array/object properties are marked with a `—` attribute: they must be set as JS properties.
|
|
179
179
|
|
|
@@ -267,6 +267,42 @@ Every element also accepts the `theme` attribute. Array/object properties are ma
|
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
270
|
+
### `kai-audio-visualizer` / `AudioVisualizer`
|
|
271
|
+
|
|
272
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
273
|
+
|
|
274
|
+
| Property | Attribute | Type | Description |
|
|
275
|
+
|---|---|---|---|
|
|
276
|
+
| `variant` | `variant` | `undefined \| string` | Look to render: `bar` (default), `grid`, `radial`, `wave`, `aurora`, `custom`. `aura` is accepted as a LiveKit-markup alias for `aurora`. Attribute: `variant`. |
|
|
277
|
+
| `state` | `state` | `undefined \| string` | `idle` (default), `connecting`, `listening`, `thinking`, `speaking`, `disconnected` (connection down: the dead, flat look). LiveKit's room-lifecycle state names are accepted as aliases. Attribute: `state`. |
|
|
278
|
+
| `size` | `size` | `undefined \| string` | `icon` \| `sm` \| `md` (default) \| `lg` \| `xl`. Attribute: `size`. |
|
|
279
|
+
| `barCount` | `bar-count` | `undefined \| number` | Bars to draw. Bar and radial only. Attribute: `bar-count`. |
|
|
280
|
+
| `count` | `count` | `undefined \| number` | Grid only: rows and columns of the (always square) grid. Attribute: `count`. |
|
|
281
|
+
| `radius` | `radius` | `undefined \| number` | Radial only: ring distance from center, in px. Attribute: `radius`. |
|
|
282
|
+
| `spread` | `spread` | `undefined \| number` | Grid only: ring distance for the connecting animation, in cells. Attribute: `spread`. |
|
|
283
|
+
| `interval` | `interval` | `undefined \| number` | Grid only: ms between scripted frames. Attribute: `interval`. |
|
|
284
|
+
| `color` | `color` | `undefined \| string` | CSS color for the geometry, overriding the inherited `currentColor`. Attribute: `color`. |
|
|
285
|
+
| `complexity` | `complexity` | `undefined \| number` | Shader variants only: pattern density, 0..1. Attribute: `complexity`. |
|
|
286
|
+
| `label` | `label` | `undefined \| string` | Setting this makes the element an announced image (`role="img"`) instead of decorative (`aria-hidden`). Attribute: `label`. |
|
|
287
|
+
| `stream` | — | `undefined \| MediaStream` | Live microphone or WebRTC audio to analyze. JS property only. |
|
|
288
|
+
| `audioElement` | — | `undefined \| HTMLMediaElement` | An `<audio>` or `<video>` element to tap for its audio. JS property only. |
|
|
289
|
+
| `bands` | — | `undefined \| number[]` | Pre-computed levels, 0..1. Set this and no AudioContext is ever built, which is what keeps headless/SSR rendering and browser-speech-synthesis playback (which exposes no audio node) free of Web Audio entirely. JS property only. A new array reference is required for each update; mutating the existing array in place will not re-render. |
|
|
290
|
+
| `shader` | — | `undefined \| { fragment: string; uniforms?: undefined \| Record<string, { type: "1f" \| "1i" \| "1fv" \| "2f" \| "3f" \| "3fv" \| "4f" \| "4fv" \| "Matrix2fv" \| "Matrix3fv" \| "Matrix4fv"; value: number \| number[] }> }` | Custom fragment shader for `variant="custom"`. JS property only. |
|
|
291
|
+
| `animateWhenNotVisible` | `animate-when-not-visible` | `undefined \| false \| true` | Shader variants only: keep animating while scrolled off screen. Off by default, which stops drawing and releases the WebGL context until the element comes back (browsers ration contexts to roughly 16 a page). Does not override `prefers-reduced-motion`. Attribute: `animate-when-not-visible`. |
|
|
292
|
+
|
|
293
|
+
_No events._
|
|
294
|
+
|
|
295
|
+
**Styleable parts** (restyle from outside via `kai-audio-visualizer::part(name)`):
|
|
296
|
+
|
|
297
|
+
| Part | Description |
|
|
298
|
+
|---|---|
|
|
299
|
+
| `::part(bar)` | A single bar in the `bar` variant, or a single spoke in the `radial` variant. Also carries `data-kai-index` and `data-kai-highlighted` ("true"/"false") for use inside the shadow root; to style the lit state from OUTSIDE, combine with the `highlighted` part below rather than an attribute selector. — `kai-audio-visualizer::part(bar) { border-radius: 2px } kai-audio-visualizer::part(bar highlighted) { background: var(--brand) }` |
|
|
300
|
+
| `::part(cell)` | A single dot in the `grid` variant. Also carries `data-kai-index` and `data-kai-highlighted` ("true"/"false") for use inside the shadow root; to style the lit state from OUTSIDE, combine with the `highlighted` part below rather than an attribute selector. — `kai-audio-visualizer::part(cell) { border-radius: 9999px } kai-audio-visualizer::part(cell highlighted) { background: var(--brand) }` |
|
|
301
|
+
| `::part(highlighted)` | A second part TOKEN present on a `bar` or `cell` exactly when the sequencer or live audio has it lit, not a standalone styleable element. Combine it in the same `::part()` argument: `::part(bar highlighted)` or `::part(cell highlighted)`. This is the external equivalent of the internal `data-kai-highlighted="true"` attribute, which a `::part()` selector cannot reach (an attribute selector cannot follow a pseudo-element). — `kai-audio-visualizer::part(bar highlighted) { background: var(--brand) } kai-audio-visualizer::part(cell highlighted) { background: var(--brand) }` |
|
|
302
|
+
| `::part(canvas)` | The WebGL canvas backing the `wave` and `aurora` variants. Restyle its size or radius, or layer a mask/filter, from outside. — `kai-audio-visualizer::part(canvas) { border-radius: 0.75rem }` |
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
270
306
|
### `kai-avatar` / `Avatar`
|
|
271
307
|
|
|
272
308
|
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
package/dist/llms/llms.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AUTO-GENERATED by scripts/gen-llms.mjs — do not edit by hand. Run `npm run build`. -->
|
|
2
2
|
# @kitn.ai/ui
|
|
3
3
|
|
|
4
|
-
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML.
|
|
4
|
+
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. 80 custom elements, every one prefixed `kai-` (e.g. `<kai-chat>`, `<kai-artifact>`): streaming responses, markdown + code rendering, reasoning/tool panels, attachments, conversation sidebar, voice input. Zero framework dependency for consumers; the SolidJS runtime it is authored in is bundled in, so the host needs nothing.
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
@@ -35,7 +35,7 @@ Drop an element into any framework (React, Vue, plain HTML). Data in via JS prop
|
|
|
35
35
|
- `<kai-prompt-input>` — standalone composer with send button.
|
|
36
36
|
|
|
37
37
|
**Layer 2 — composable primitives** (`import { … } from '@kitn.ai/ui'`):
|
|
38
|
-
All
|
|
38
|
+
All 80 elements are also exported individually. Use them for custom layouts or features `<kai-chat>` does not expose (ChainOfThought, FeedbackBar, ThinkingBar, VoiceInput, …). Your bundler tree-shakes the rest.
|
|
39
39
|
|
|
40
40
|
## Key rules for the web components
|
|
41
41
|
|
|
@@ -97,7 +97,7 @@ For Tailwind builds: `@import "@kitn.ai/ui/theme.css"` in your CSS.
|
|
|
97
97
|
|
|
98
98
|
## Docs
|
|
99
99
|
|
|
100
|
-
- Full element reference (all
|
|
100
|
+
- Full element reference (all 80 elements, every prop/event): ./llms-full.txt — https://kitn.dev/llms-full.txt
|
|
101
101
|
- Machine-readable Custom Elements Manifest: https://unpkg.com/@kitn.ai/ui/dist/custom-elements.json
|
|
102
102
|
- Working examples: https://github.com/kitn-ai/ui/tree/main/examples
|
|
103
103
|
- Storybook: https://storybook.kitn.dev
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure reductions from AnalyserNode output to the numbers a visualizer draws.
|
|
3
|
+
*
|
|
4
|
+
* Ported from livekit/components-js `packages/react/src/hooks/useTrackVolume.ts`
|
|
5
|
+
* (Apache License 2.0). Both the dB normalization curve AND the band split
|
|
6
|
+
* are carried over so our output matches theirs frame for frame: the split
|
|
7
|
+
* is upstream's linear-proportional chunking (their PR #1265). An interim
|
|
8
|
+
* revision here spaced the buckets geometrically to serve a wide raw-mic
|
|
9
|
+
* window; both reverted together -- see `reduceToBands` below and the
|
|
10
|
+
* DEFAULTS docstring in use-audio-analysis.ts for the full story.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Map one `getFloatFrequencyData` decibel value to 0..1.
|
|
14
|
+
*
|
|
15
|
+
* The `sqrt` at the end is a perceptual curve, not a normalization step: it
|
|
16
|
+
* lifts quiet detail so low-level audio still moves the bars visibly.
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeDb(value: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* Average a slice of the frequency spectrum into `bands` buckets.
|
|
21
|
+
*
|
|
22
|
+
* `loPass` / `hiPass` are BIN INDICES relative to `fftSize`, not frequencies.
|
|
23
|
+
* Upstream's naming is misleading; the behavior is a plain array slice.
|
|
24
|
+
*
|
|
25
|
+
* Bucket edges are LINEAR-PROPORTIONAL across `[loPass, hiPass]` -- upstream
|
|
26
|
+
* LiveKit's own distribution (`useMultibandTrackVolume`, useTrackVolume.ts
|
|
27
|
+
* lines 141-153, rewritten to proportional chunking by their PR #1265): each
|
|
28
|
+
* band averages an equal consecutive run of bins, `floor(i * total / bands)`
|
|
29
|
+
* to `floor((i + 1) * total / bands)`, and a run that comes out empty reads
|
|
30
|
+
* 0 (their `chunkLength === 0` branch). With the default window's 100 bins
|
|
31
|
+
* and 5 bands, that is 20 bins averaged per band -- the averaging itself is
|
|
32
|
+
* part of upstream's idle stillness, diluting any single flickering bin
|
|
33
|
+
* 20:1 (noise-floor diagnosis, table B).
|
|
34
|
+
*
|
|
35
|
+
* An interim revision spaced these buckets geometrically so that a wide
|
|
36
|
+
* raw-microphone window (bins 4-120) kept its upper buckets alive. That
|
|
37
|
+
* concentrated the noisiest few low bins into band 0 undiluted, which the
|
|
38
|
+
* centre-out mirror below then promoted to the CENTRE element -- the
|
|
39
|
+
* measured core of the "white noise when the mic is on" defect (diagnosis
|
|
40
|
+
* table B: geometric band 0 idled at 0.52 on real room tone where this
|
|
41
|
+
* split reads 0.32 over the same wide window, and exactly 0 over the
|
|
42
|
+
* default one). Reverted to upstream's split when the default window
|
|
43
|
+
* reverted; the mirror stays, it is orthogonal.
|
|
44
|
+
*/
|
|
45
|
+
export declare function reduceToBands(freq: Float32Array, bands: number, loPass: number, hiPass: number): number[];
|
|
46
|
+
/** Root-mean-square of `getByteFrequencyData`, scaled to 0..1. */
|
|
47
|
+
export declare function reduceToVolume(bytes: Uint8Array): number;
|
|
48
|
+
/**
|
|
49
|
+
* Resize a caller-supplied band array to exactly `count` entries. Extra values
|
|
50
|
+
* are dropped; a short array repeats its last value (0 when empty) so a
|
|
51
|
+
* consumer passing the wrong length gets a sane picture instead of holes.
|
|
52
|
+
*/
|
|
53
|
+
export declare function normalizeVolumeBands(bands: number[], count: number): number[];
|
|
54
|
+
/**
|
|
55
|
+
* Maps a smaller, ordered set of "half" band values (index 0 = loudest,
|
|
56
|
+
* typically lowest frequency) onto `count` positions laid out in a straight
|
|
57
|
+
* line -- a row of bars, or a row of grid columns -- centre-outward and
|
|
58
|
+
* mirrored: band 0 lands on the centre (an odd `count`) or the centre PAIR
|
|
59
|
+
* (an even one, both positions sharing band 0), band 1 on the pair either
|
|
60
|
+
* side of that, and so on outward to the two ends.
|
|
61
|
+
*
|
|
62
|
+
* Every scripted state in this component is already centre-oriented
|
|
63
|
+
* (`listening` blinks the centre bar, `connecting` sweeps inward from both
|
|
64
|
+
* ends, `thinking` sweeps the middle row) -- `speaking` ramping left to
|
|
65
|
+
* right, because it fed the analyser's raw band order straight across, was
|
|
66
|
+
* the one state inconsistent with that. This closes that gap.
|
|
67
|
+
*
|
|
68
|
+
* `halfBands` should have exactly `Math.ceil(count / 2)` entries -- the
|
|
69
|
+
* caller is responsible for requesting that many bands from
|
|
70
|
+
* `useAudioAnalysis`, matching counts exactly rather than leaning on
|
|
71
|
+
* `normalizeVolumeBands`'s pad-by-repeating-the-last-value, which would
|
|
72
|
+
* produce a subtly wrong (not obviously broken) shape here. A shorter
|
|
73
|
+
* `halfBands` still degrades sanely: the outermost positions repeat the last
|
|
74
|
+
* value available rather than reading `undefined`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function mirrorBandsCenterOut(halfBands: number[], count: number): number[];
|
|
77
|
+
/**
|
|
78
|
+
* Maps a smaller, ordered set of "half" band values onto `count` positions
|
|
79
|
+
* arranged around a RING (radial's spokes), mirrored left-right across a
|
|
80
|
+
* single vertical axis rather than fanned from a linear centre: index 0 and
|
|
81
|
+
* index `count / 2` (for an even `count`; radial warns when `count` is not
|
|
82
|
+
* divisible by 4, so this is the common case) are each their own fixed
|
|
83
|
+
* point of the reflection and both land band 0, and every other index pairs
|
|
84
|
+
* with its mirror partner at `count - i`, sharing a band.
|
|
85
|
+
*
|
|
86
|
+
* Radial's own geometry (`variant-radial.tsx`) places index 0 at the
|
|
87
|
+
* BOTTOM of the ring (`rotate(0) translateY(radius)`, and CSS rotation is
|
|
88
|
+
* clockwise for a positive angle), so band 0 (usually the loudest) reads at
|
|
89
|
+
* the bottom, fading toward the top -- not band 0 at both the top AND the
|
|
90
|
+
* bottom, which would need a second, horizontal mirror axis on top of this
|
|
91
|
+
* one. Chosen over that fuller symmetry because it reuses the exact same
|
|
92
|
+
* `Math.ceil(count / 2)` band request as the linear mirror above (one rule
|
|
93
|
+
* for every variant, not a radial-specific band count), and because the
|
|
94
|
+
* task's request was "spikes vary in length, not moving as one" -- this
|
|
95
|
+
* already delivers that. If bottom-loud/top-quiet reads wrong in practice,
|
|
96
|
+
* swapping to true 4-fold symmetry is a self-contained change here, not
|
|
97
|
+
* elsewhere.
|
|
98
|
+
*
|
|
99
|
+
* For an even `count`, the antipodal index (`count / 2`) needs one more
|
|
100
|
+
* distinct band than the linear mirror does (rings run 0..`count / 2`, not
|
|
101
|
+
* 0..`count / 2 - 1`) -- with only `Math.ceil(count / 2)` bands available,
|
|
102
|
+
* that one index clamps to the same value as its nearest neighbour rather
|
|
103
|
+
* than getting a unique band. A minor, deliberate simplification for the
|
|
104
|
+
* same one-rule-for-every-variant reason above.
|
|
105
|
+
*/
|
|
106
|
+
export declare function mirrorBandsAroundRing(halfBands: number[], count: number): number[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
export type Transition = {
|
|
3
|
+
duration: number;
|
|
4
|
+
ease?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut';
|
|
5
|
+
} | {
|
|
6
|
+
type: 'spring';
|
|
7
|
+
duration: number;
|
|
8
|
+
bounce: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A tweened number driven by requestAnimationFrame.
|
|
12
|
+
*
|
|
13
|
+
* Exists so shader uniforms can animate without pulling in a motion library.
|
|
14
|
+
* CSS transitions cannot help here: uniforms are plain JS numbers handed to
|
|
15
|
+
* WebGL every frame.
|
|
16
|
+
*
|
|
17
|
+
* `to()` interrupts whatever is in flight. An array target ping-pongs between
|
|
18
|
+
* its two values forever, which is how the listening and thinking pulses read.
|
|
19
|
+
* `duration: 0` (or no transition) sets instantly, which live volume needs so
|
|
20
|
+
* the picture never lags the audio.
|
|
21
|
+
*
|
|
22
|
+
* `animating` is true exactly while a frame loop is armed: from an animated
|
|
23
|
+
* `to()` until it lands (a ping-pong never lands, so it stays true), false
|
|
24
|
+
* for instant sets and after dispose. It is a real signal on purpose -- the
|
|
25
|
+
* aurora variant's volume-override effect reads it as its upstream-parity
|
|
26
|
+
* "scale tween idle" guard, and being reactive means that effect re-runs
|
|
27
|
+
* the moment a landing settles instead of waiting for the next volume tick.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createTween(initial: number): {
|
|
30
|
+
value: Accessor<number>;
|
|
31
|
+
animating: Accessor<boolean>;
|
|
32
|
+
to(target: number | [number, number], transition?: Transition): void;
|
|
33
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
export interface AudioAnalysisOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Number of frequency buckets to produce, or a live accessor for it.
|
|
5
|
+
* Default 5.
|
|
6
|
+
*
|
|
7
|
+
* An accessor is resolved INSIDE the analysis effect, so a change to
|
|
8
|
+
* whatever signal backs it (e.g. a caller's variant or size switching)
|
|
9
|
+
* rebuilds the analyser at the new bucket count instead of silently
|
|
10
|
+
* leaving `bands()` padded or truncated to a stale size.
|
|
11
|
+
*/
|
|
12
|
+
bands?: number | (() => number);
|
|
13
|
+
/**
|
|
14
|
+
* Low bin index of the pass window. NOT a frequency. Default 100 --
|
|
15
|
+
* upstream LiveKit's component value (see DEFAULTS below).
|
|
16
|
+
*/
|
|
17
|
+
loPass?: number;
|
|
18
|
+
/**
|
|
19
|
+
* High bin index of the pass window. NOT a frequency. Default 200 --
|
|
20
|
+
* upstream LiveKit's component value (see DEFAULTS below).
|
|
21
|
+
*
|
|
22
|
+
* Legitimately input-dependent, unlike `fftSize`/`smoothingTimeConstant`:
|
|
23
|
+
* the default window expects PROCESSED speech (an agent's TTS track, or a
|
|
24
|
+
* mic captured with AGC/noise suppression on). For raw, unprocessed input
|
|
25
|
+
* -- an un-gained recording, music, ambience -- a wide low window such as
|
|
26
|
+
* `loPass: 4, hiPass: 120` reads energy the default deliberately gates
|
|
27
|
+
* out; see DEFAULTS below for the trade both ways.
|
|
28
|
+
*/
|
|
29
|
+
hiPass?: number;
|
|
30
|
+
/** Minimum ms between updates. Default 32 (about 30fps). */
|
|
31
|
+
updateInterval?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The default window is upstream LiveKit's COMPONENT window, bins 100-200:
|
|
35
|
+
* every shipped agents-ui visualizer passes `{ loPass: 100, hiPass: 200 }`
|
|
36
|
+
* (agent-audio-visualizer-bar.tsx:181-183, grid.tsx:279-281,
|
|
37
|
+
* radial.tsx:142-144 -- radial's loPass was 80 until their PR #1265). Their
|
|
38
|
+
* HOOK's own default is 100-600 (useTrackVolume.ts:95-101), but no shipped
|
|
39
|
+
* component uses it, so parity means matching the components.
|
|
40
|
+
*
|
|
41
|
+
* At fftSize 2048 that is ~2.34-4.69kHz at 48kHz (2.15-4.31kHz at 44.1kHz):
|
|
42
|
+
* the sibilance band, ABOVE where a room's noise floor lives. Everything at
|
|
43
|
+
* or below -100dB normalizes to exactly 0 (see normalizeDb), and a real
|
|
44
|
+
* room's tone measures ~17dB BELOW that floor across this window while
|
|
45
|
+
* sitting ~27dB ABOVE it across 86-258Hz (noise-floor diagnosis, table A).
|
|
46
|
+
* The narrow high window plus the hard -100dB floor IS upstream's noise
|
|
47
|
+
* gate -- there is no explicit gate anywhere in their pipeline -- and it is
|
|
48
|
+
* what keeps their idle bars perfectly still where a wide window shows the
|
|
49
|
+
* room breathing.
|
|
50
|
+
*
|
|
51
|
+
* The trade, measured on a real un-processed recording ("this is a test,
|
|
52
|
+
* testing one two three, hello world"): through 100-200, quiet
|
|
53
|
+
* natural-volume speech frames read all-zero (54% of that clip's frames;
|
|
54
|
+
* consonants and sibilance still register on the louder ones). Upstream
|
|
55
|
+
* lives with that because their input is conditioned before analysis -- an
|
|
56
|
+
* agent's loud TTS track, or a local mic captured with autoGainControl +
|
|
57
|
+
* noiseSuppression + echoCancellation + voiceIsolation (livekit-client
|
|
58
|
+
* defaults.ts:27-30) that lifts speech toward target level. Ours follows:
|
|
59
|
+
* the mic stories request the same constraint set. For RAW input where that
|
|
60
|
+
* trade reads wrong (un-gained recordings, music), `loPass: 4, hiPass: 120`
|
|
61
|
+
* (86Hz-2.6kHz: fundamental + first two formants) remains the measured
|
|
62
|
+
* opt-in -- it read those same quiet frames at mean 0.234 with only true
|
|
63
|
+
* silence at zero -- at the documented cost of visualizing the room's noise
|
|
64
|
+
* floor on the centre elements (the defect that reverted this default).
|
|
65
|
+
*/
|
|
66
|
+
export declare const DEFAULTS: {
|
|
67
|
+
readonly bands: 5;
|
|
68
|
+
readonly loPass: 100;
|
|
69
|
+
readonly hiPass: 200;
|
|
70
|
+
readonly updateInterval: 32;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* `fftSize`/`smoothingTimeConstant` are deliberately NOT caller-configurable
|
|
74
|
+
* options, unlike everything above. They exist in two different, non-tunable
|
|
75
|
+
* shapes below instead: one AnalyserNode per reduction, each matching
|
|
76
|
+
* upstream LiveKit's own hook for that reduction. A single flat
|
|
77
|
+
* `smoothingTimeConstant` option (this hook's original design) is exactly
|
|
78
|
+
* the bug that made bars snap back to rest instead of easing like upstream's
|
|
79
|
+
* do: one value silently applied to both a fast reduction and a slow one.
|
|
80
|
+
* Hard-coding removes the only way a caller (or a future edit here) could
|
|
81
|
+
* reintroduce that.
|
|
82
|
+
*
|
|
83
|
+
* These analyser shapes (and DEFAULTS above) are EXPORTED as the kit's
|
|
84
|
+
* analysis-settings contract: external instrumentation -- the
|
|
85
|
+
* examples/internal/livekit-parity probe -- imports them instead of
|
|
86
|
+
* restating the numbers, so a change here propagates instead of drifting.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Matches upstream's `useMultibandTrackVolume`, which drives the DOM
|
|
90
|
+
* bar/grid/radial variants: `{ fftSize: 2048 }`, no `smoothingTimeConstant`
|
|
91
|
+
* given, so the AnalyserNode uses the Web Audio spec default of 0.8. That
|
|
92
|
+
* slow decay (roughly 330ms to fall to 10% of a peak, at this hook's 32ms
|
|
93
|
+
* sample interval) is what makes bars ease back to rest after speech stops
|
|
94
|
+
* instead of snapping.
|
|
95
|
+
*/
|
|
96
|
+
export declare const BANDS_ANALYSER: {
|
|
97
|
+
readonly fftSize: 2048;
|
|
98
|
+
readonly smoothingTimeConstant: 0.8;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Matches upstream's `useTrackVolume` as the wave/aura hooks call it:
|
|
102
|
+
* `{ fftSize: 512, smoothingTimeConstant: 0.55 }`
|
|
103
|
+
* (use-agent-audio-visualizer-wave.ts:55-56, aura.ts:62-63). Faster decay
|
|
104
|
+
* (roughly 123ms to 10% of peak) keeps the shaders' reactivity within the
|
|
105
|
+
* ~33ms lag the aurora variant was tuned against; the bands' slower 0.8
|
|
106
|
+
* here would make the shaders visibly sluggish. Upstream reaches the same
|
|
107
|
+
* two-analyser structure differently -- two hooks, each with its own
|
|
108
|
+
* analyser (and its own AudioContext) -- but the constants match ours
|
|
109
|
+
* exactly.
|
|
110
|
+
*
|
|
111
|
+
* `minDecibels`/`maxDecibels` are upstream's `createAudioAnalyser` defaults
|
|
112
|
+
* (livekit-client src/room/utils.ts:548-553), NOT the Web Audio spec's
|
|
113
|
+
* -100/-30. They only rescale getByteFrequencyData -- this analyser's whole
|
|
114
|
+
* output -- mapping the byte range over a 20dB window that saturates at
|
|
115
|
+
* -80dB. That is what makes upstream's volume scalar run hot (speech
|
|
116
|
+
* ~0.5-0.9) and their wave/aura feel alive; on the spec scale the same
|
|
117
|
+
* speech read ~3x colder here (0.31 vs 0.80, noise-floor diagnosis,
|
|
118
|
+
* addendum 1), leaving our shaders under-reacting. The BANDS analyser gets
|
|
119
|
+
* no such pair: it is read with getFloatFrequencyData, where these two
|
|
120
|
+
* properties have no effect at all.
|
|
121
|
+
*/
|
|
122
|
+
export declare const VOLUME_ANALYSER: {
|
|
123
|
+
readonly fftSize: 512;
|
|
124
|
+
readonly smoothingTimeConstant: 0.55;
|
|
125
|
+
readonly minDecibels: -100;
|
|
126
|
+
readonly maxDecibels: -80;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Turn a live audio source into numbers a visualizer can draw.
|
|
130
|
+
*
|
|
131
|
+
* Runs TWO analysers off one source node: `bands` for the DOM variants and a
|
|
132
|
+
* scalar `volume` for the shader ones, each with its own `fftSize` and
|
|
133
|
+
* `smoothingTimeConstant` matching upstream's two separate hooks (see
|
|
134
|
+
* BANDS_ANALYSER / VOLUME_ANALYSER above). An earlier version of this hook
|
|
135
|
+
* shared a single analyser between both reductions as an optimization; that
|
|
136
|
+
* silently forced one smoothing behavior onto both and made bars snap back
|
|
137
|
+
* to rest instead of easing like upstream's do. What this still saves over
|
|
138
|
+
* upstream: one shared, cached source node per element/stream (see
|
|
139
|
+
* elementSources/streamSources below) instead of a fresh one per hook
|
|
140
|
+
* instance, and one requestAnimationFrame loop reading both analysers each
|
|
141
|
+
* tick instead of two independent timers.
|
|
142
|
+
*
|
|
143
|
+
* Safe to call with no source: it emits zeros and never constructs a context,
|
|
144
|
+
* which is what makes the state-driven (no audio) mode work.
|
|
145
|
+
*/
|
|
146
|
+
export declare function useAudioAnalysis(source: () => MediaStream | HTMLMediaElement | undefined, options?: AudioAnalysisOptions): {
|
|
147
|
+
bands: Accessor<number[]>;
|
|
148
|
+
volume: Accessor<number>;
|
|
149
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* One requestAnimationFrame loop emitting a monotonically increasing tick
|
|
4
|
+
* whenever `interval()` milliseconds have elapsed.
|
|
5
|
+
*
|
|
6
|
+
* RAF rather than setInterval: the browser parks it on hidden tabs, so an
|
|
7
|
+
* off-screen visualizer costs nothing. Upstream leaks a timer here.
|
|
8
|
+
*
|
|
9
|
+
* An interval of `Infinity` (or anything non-finite) parks the loop entirely
|
|
10
|
+
* and holds the tick at 0. The radial variant uses that while `thinking`,
|
|
11
|
+
* where a CSS spin drives the motion instead.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSequencer(interval: () => number): Accessor<number>;
|
|
@@ -4,6 +4,7 @@ export interface UseVoiceRecorderOptions {
|
|
|
4
4
|
export declare function useVoiceRecorder(options?: UseVoiceRecorderOptions): {
|
|
5
5
|
isRecording: import('solid-js').Accessor<boolean>;
|
|
6
6
|
error: import('solid-js').Accessor<string | null>;
|
|
7
|
+
stream: import('solid-js').Accessor<MediaStream | undefined>;
|
|
7
8
|
start: () => Promise<Blob>;
|
|
8
9
|
stop: () => void;
|
|
9
10
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure `state -> highlight set` mappers for the audio visualizer variants.
|
|
3
|
+
*
|
|
4
|
+
* Ported from livekit/components-js `packages/shadcn/hooks/agents-ui/`
|
|
5
|
+
* (Apache License 2.0). Upstream runs four separate animator hooks, each with
|
|
6
|
+
* its own requestAnimationFrame loop. We keep the sequences (verbatim) but move
|
|
7
|
+
* the timing into one shared driver, `use-sequencer.ts`.
|
|
8
|
+
*
|
|
9
|
+
* Every generator returns a NON-EMPTY array so callers can index with
|
|
10
|
+
* `sequence[tick % sequence.length]` without a guard.
|
|
11
|
+
*/
|
|
12
|
+
export type VisualizerState = 'idle' | 'connecting' | 'listening' | 'thinking' | 'speaking' | 'disconnected';
|
|
13
|
+
export interface Coordinate {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function normalizeState(input: string | undefined): VisualizerState;
|
|
18
|
+
export declare function barSequence(state: VisualizerState, barCount: number): number[][];
|
|
19
|
+
export declare function barInterval(state: VisualizerState, barCount: number): number;
|
|
20
|
+
export declare function gridSequence(state: VisualizerState, rows: number, columns: number, spread?: number): Coordinate[];
|
|
21
|
+
export declare function radialSequence(state: VisualizerState, barCount: number): number[][];
|
|
22
|
+
export declare function radialInterval(state: VisualizerState): number;
|
|
23
|
+
/**
|
|
24
|
+
* Uniform targets for the aura and custom shaders. An array intensity means
|
|
25
|
+
* "ping-pong between these two" (see create-tween). `speaking` intensity is
|
|
26
|
+
* omitted from the pulse because live volume drives it instantly instead.
|
|
27
|
+
*/
|
|
28
|
+
export declare function shaderTargets(state: VisualizerState): {
|
|
29
|
+
intensity: number | [number, number];
|
|
30
|
+
speed: number;
|
|
31
|
+
};
|
|
32
|
+
/** Uniform targets for the wave shader. Same shape, different curve. */
|
|
33
|
+
export declare function waveTargets(state: VisualizerState): {
|
|
34
|
+
speed: number;
|
|
35
|
+
amplitude: number;
|
|
36
|
+
frequency: number;
|
|
37
|
+
opacity: number | [number, number];
|
|
38
|
+
pulseDuration: number;
|
|
39
|
+
};
|