@seams/voice-capture 0.69.2 → 0.70.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/README.md CHANGED
@@ -108,6 +108,11 @@ try {
108
108
 
109
109
  - `record()` resolves with `recorded` (the samples) or `cancelled`. A too quiet recording
110
110
  stays on the card with "Try again".
111
+ - A result can have a `receipt`: a box between the caption and the detail, with a checked row
112
+ for each check and a link to check it again, such as the TEE attestation of the call:
113
+ `{ title: 'TEE receipt', source: 'Intel TDX · OutLayer', rows: [{ label: 'Voice', value:
114
+ 'matched alice.near' }], link: { text: 'View TDX quote', href } }`. The check marks have the
115
+ seal's colour (`voiceSeal`, else `voiceLine`).
111
116
  - `autoStart: true` starts the first recording with no press on Record. Use it when the person
112
117
  just asked for the card with a click or a key. The card then shows no Record button and has
113
118
  no row for it, so it is shorter and its rows sit in the middle. If the browser starts audio
@@ -1,20 +1,20 @@
1
- import{S as e,h as t,n,o as r,r as i,s as a,u as o,v as s,w as c}from"./chunks/microphone-BQVF_tVV.js";const l=`cubic-bezier(0.2, 0, 0, 1)`,u=`http://www.w3.org/2000/svg`,d=`cubic-bezier(0.2, 0, 0, 1)`,f=`cubic-bezier(0.2, 0.7, 0.2, 1)`,p=`cubic-bezier(0.65, 0, 0.35, 1)`,m=[`M18.9 7a8 8 0 0 1 1.1 5v1a6 6 0 0 0 .8 3`,`M8 11a4 4 0 0 1 8 0v1a10 10 0 0 0 2 6`,`M12 11v2a14 14 0 0 0 2.5 8`,`M8 15a18 18 0 0 0 1.8 6`,`M4.9 19a22 22 0 0 1-.9-7v-1a8 8 0 0 1 12-6.95`];var h=class{line;segments=[];bar;ring;seal;check;motion=matchMedia(`(prefers-reduced-motion: reduce)`);rows;states=[];rendering=Promise.resolve();morph=null;rotation=0;version=0;disposed=!1;constructor(e,t,n=null){this.prompt=e,this.copy=t;let r=e.element.ownerDocument;this.line=r.createElementNS(u,`svg`),this.line.classList.add(`seams-voiceid-status-line`),this.line.setAttribute(`viewBox`,`0 0 308 64`),this.line.setAttribute(`aria-hidden`,`true`);for(let e=0;e<6;e+=1){let e=r.createElementNS(u,`rect`);e.setAttribute(`rx`,`1.5`),this.line.append(e),this.segments.push(e)}this.bar=r.createElementNS(u,`path`),this.bar.classList.add(`seams-voiceid-status-bar`),this.bar.setAttribute(`d`,`M1.5 32H306.5`),this.ring=r.createElementNS(u,`circle`),this.ring.classList.add(`seams-voiceid-status-ring`),this.ring.setAttribute(`r`,`21.5`),this.seal=r.createElementNS(u,`circle`),this.seal.classList.add(`seams-voiceid-status-seal`),this.seal.setAttribute(`r`,`22.5`);for(let e of[this.ring,this.seal])e.setAttribute(`cx`,`154`),e.setAttribute(`cy`,`32`);this.check=r.createElementNS(u,`path`),this.check.classList.add(`seams-voiceid-status-check`),this.check.setAttribute(`d`,`M161 26.8 151.4 36.3 147.1 32`),this.check.setAttribute(`pathLength`,`1`),this.line.append(this.bar,this.ring,this.seal,this.check),e.ribbon.after(this.line),this.rows=n?{...this.promptRows(),label:n.label,caption:`handed-over:${n.message}`,action:``}:this.promptRows(),this.layoutSegments(0,3)}showPrompt(){let e=this.begin();return this.queue(async()=>{if(this.stale(e))return;let t=this.prompt.element;t.removeAttribute(`aria-busy`),await this.transition(this.promptRows(),e,()=>{delete t.dataset.phraseView,delete t.dataset.phraseLine,this.writeCaption(this.copy.message,[]),this.writeAction({label:this.copy.action}),this.resetLine(),this.prompt.ready(this.copy.message)}),this.stale(e)||this.prompt.record.focus()})}beginCheck(){this.disposed||this.morph||(this.prompt.flattenLine(),this.morph=this.openSegments())}show(e){let t=this.begin();return this.queue(async()=>{if(this.stale(t))return;let n=this.prompt.element;if(this.prompt.flattenLine(),this.morph??=this.openSegments(),e.kind===`check`){n.setAttribute(`aria-busy`,`true`);let r=e.details[0]??``,i={label:e.label,head:this.copy.sentence,headline:!1,dim:!0,caption:`check:${e.caption}:${r}`,action:``};if(await this.transition(i,t,()=>{n.dataset.phraseView=`check`,this.writeCaption(e.caption,[r])}),await this.morph,this.stale(t))return;await this.setSegments(e.segments),this.stale(t)||this.rotateDetails(e.details,t);return}if(n.removeAttribute(`aria-busy`),await this.morph,this.stale(t)||(e.line===`seal`?await this.sealLine(t):await this.setSegments(e.line),this.stale(t)))return;this.prompt.quietLine();let r={label:e.label,head:e.headline,headline:!0,dim:!1,caption:`result:${JSON.stringify([e.caption,e.detail,e.link??null])}`,action:`result:${e.action.icon??``}:${e.action.label}`};await this.transition(r,t,()=>{n.dataset.phraseView=`result`,this.writeCaption(this.markedText(e.caption),this.detailNodes(e)),this.writeAction(e.action),this.prompt.record.hidden=!1}),!this.stale(t)&&(this.prompt.record.disabled=e.action.busy===!0,e.action.busy||this.prompt.record.focus())})}dispose(){this.disposed=!0,this.version+=1,window.clearInterval(this.rotation)}begin(){return window.clearInterval(this.rotation),this.version+=1,this.version}stale(e){return this.disposed||e!==this.version}queue(e){return this.rendering=this.rendering.then(e,e),this.rendering}promptRows(){return{label:this.copy.label,head:this.copy.sentence,headline:!1,dim:!1,caption:`prompt:${this.copy.message}`,action:`prompt:${this.copy.action}`}}async transition(e,t,n){let r=this.prompt,i=[[`label`,r.title],[`head`,r.phrase],[`caption`,r.status],[`action`,r.actionRow]].filter(([t])=>this.rows[t]!==e[t]||t===`head`&&this.rows.headline!==e.headline).map(([,e])=>e);if(r.phrase.classList.toggle(`seams-voiceid-phrase-dim`,e.dim),i.length>0&&!this.motion.matches&&await Promise.all(i.map(e=>_(e,150))),this.stale(t))return;let a=r.ribbon.getBoundingClientRect().top,o=r.element.getBoundingClientRect().height;r.title.textContent=e.label,r.phrase.textContent=e.head,r.phrase.classList.toggle(`seams-voiceid-success-headline`,e.headline),n(),this.rows=e,r.fillFrame(o);let s=a-r.ribbon.getBoundingClientRect().top;if(Math.abs(s)>.5&&!this.motion.matches)for(let e of[r.ribbon,this.line])e.animate([{transform:`translateY(${s}px)`},{transform:`none`}],{duration:180,easing:f});for(let[e,t]of i.entries())v(t,this.motion.matches,0+e*20)}markedText(e){if(typeof e==`string`)return[e];let t=this.prompt.element.ownerDocument;return e.map(e=>{if(typeof e==`string`)return e;let n=t.createElement(`mark`);return n.className=`seams-voiceid-heard-mark`,n.textContent=e.mark,n})}detailNodes(e){if(!e.link)return[e.detail];let t=this.prompt.element.ownerDocument.createElement(`a`);return t.href=e.link.href,t.target=`_blank`,t.rel=`noopener noreferrer`,t.textContent=e.link.text,[e.detail,` `,t]}writeCaption(e,t){let n=this.prompt.status;if(typeof e==`string`&&t.length===0){n.classList.remove(`seams-voiceid-two-lines`),n.textContent=e;return}let r=n.ownerDocument,i=r.createElement(`span`);i.className=`seams-voiceid-caption`,i.append(...typeof e==`string`?[e]:e);let a=r.createElement(`span`);a.className=`seams-voiceid-caption-detail`,a.append(...t),n.replaceChildren(i,a),n.classList.add(`seams-voiceid-two-lines`)}writeAction(e){let t=this.prompt.record;t.replaceChildren(),e.icon===`passkey`&&t.append(g(t.ownerDocument)),t.append(e.label)}rotateDetails(e,t){if(e.length<2)return;let n=0;this.rotation=window.setInterval(()=>{n+=1,(n>=e.length-1||this.stale(t))&&window.clearInterval(this.rotation),n<e.length&&!this.stale(t)&&this.swapDetail(e[n],t)},1300)}async swapDetail(e,t){let n=this.prompt.status.querySelector(`.seams-voiceid-caption-detail`);n&&(this.motion.matches||await _(n,90),!this.stale(t)&&(n.textContent=e,n.getAnimations().forEach(e=>e.cancel()),n.animate([{opacity:0,transform:this.motion.matches?`none`:`translateY(2px)`},{opacity:1,transform:`none`}],{duration:160,easing:d,fill:`both`})))}async openSegments(){await y(this.motion.matches?0:200),!this.disposed&&(this.states=Array.from({length:6},()=>`done`),this.paintStates(),this.prompt.element.dataset.phraseLine=`status`,await this.tween(this.motion.matches?0:200,e=>this.layoutSegments(8*e,1+2*e)),!this.disposed&&(this.states=this.states.map((e,t)=>t===0?`done`:`idle`),this.paintStates(),await y(this.motion.matches?0:240)))}async setSegments(e){let t=e.map((e,t)=>e===`done`&&this.states[t]===`run`?t:-1).filter(e=>e>=0),n=[...e];this.states=n.map((e,n)=>t.includes(n)?`run`:e===`fail`||e===`wait`||e===`skip`?this.states[n]??`idle`:e),this.paintStates();for(let e of t){if(await y(this.motion.matches?0:70),this.disposed)return;this.states[e]=`done`,this.paintStates()}let r=n.some(e=>e===`fail`||e===`wait`);this.states=n,this.paintStates(),r&&await y(this.motion.matches?0:240)}async sealLine(e){if(await this.setSegments(Array.from({length:6},()=>`done`)),this.stale(e))return;let t=this.motion.matches;if(await this.tween(t?0:240,e=>this.layoutSegments(8*(1-e),3)),this.stale(e))return;let n=this.lineIcon();if(n){await this.sealIcon(e,n,t);return}this.line.dataset.seal=``;let r=2*Math.PI*21.5;this.ring.style.strokeDasharray=String(r);let i=(e,n)=>({duration:t?0:e,easing:n,fill:`forwards`});this.bar.animate([{transform:`scaleX(1)`},{transform:`scaleX(0)`}],i(440,p)),await this.ring.animate([{strokeDashoffset:r},{strokeDashoffset:0}],i(440,p)).finished,!this.stale(e)&&(this.seal.animate([{transform:`scale(0)`},{transform:`scale(1)`}],i(320,`cubic-bezier(0.34, 1.56, 0.64, 1)`)),await y(t?0:220),!this.stale(e)&&await this.check.animate([{strokeDashoffset:1},{strokeDashoffset:0}],i(260,d)).finished)}async sealIcon(e,t,n){this.line.dataset.seal=`icon`;let r=(e,t)=>({duration:n?0:e,easing:t,fill:`forwards`}),i=this.bar.getBoundingClientRect(),a=t.getBoundingClientRect(),o=this.bar.getScreenCTM()?.a||1,s=(a.left+a.width/2-i.left)/o;if(await this.bar.animate([{transform:`translateX(0) scaleX(1)`},{transform:`translateX(${s}px) scaleX(0)`}],r(360,p)).finished,this.stale(e))return;let{microphone:c,check:l,tick:u}=b(t);c?.animate([{opacity:1,transform:`scale(1)`},{opacity:0,transform:`scale(0.6)`}],r(160,d)),l?.animate([{opacity:0},{opacity:1}],r(160,d)),t.animate([{transform:`scale(1)`},{transform:`scale(1.1)`},{transform:`scale(1)`}],r(320,f)),await u?.animate([{strokeDashoffset:1},{strokeDashoffset:0}],r(260,d)).finished}lineIcon(){return this.prompt.element.querySelector(`:scope > .seams-voiceid-line-icon`)}resetLine(){this.morph=null,this.states=[],delete this.line.dataset.seal;let e=this.lineIcon(),t=e?Object.values(b(e)):[];for(let n of[this.bar,this.ring,this.seal,this.check,e,...t])n?.getAnimations().forEach(e=>e.cancel());this.layoutSegments(0,3),this.paintStates()}paintStates(){for(let[e,t]of this.segments.entries()){let n=this.states[e];n?t.dataset.state=n:delete t.dataset.state}}layoutSegments(e,t){let n=(308-5*e)/6;for(let[r,i]of this.segments.entries())i.setAttribute(`x`,(r*(n+e)).toFixed(2)),i.setAttribute(`width`,n.toFixed(2)),i.setAttribute(`y`,(32-t/2).toFixed(2)),i.setAttribute(`height`,t.toFixed(2))}tween(e,t){return e<=0?(t(1),Promise.resolve()):new Promise(n=>{let r=performance.now(),i=a=>{if(this.disposed)return n();let o=Math.min(1,(a-r)/e);t(1-(1-o)**3),o<1?requestAnimationFrame(i):n()};requestAnimationFrame(i)})}};function g(e){let t=e.createElementNS(u,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`width`,`18`),t.setAttribute(`height`,`18`),t.setAttribute(`aria-hidden`,`true`),t.classList.add(`seams-voiceid-action-icon`);for(let n of m){let r=e.createElementNS(u,`path`);r.setAttribute(`d`,n),t.append(r)}return t}function _(e,t){let n=Number(getComputedStyle(e).opacity);return e.animate([{opacity:n},{opacity:0}],{duration:t*n,easing:`ease-in`,fill:`forwards`}).finished}function v(e,t,n){e.getAnimations().forEach(e=>e.cancel()),e.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:1,transform:`none`}],{delay:t?0:n,duration:t?150:140,easing:l,fill:`both`})}function y(e){return new Promise(t=>window.setTimeout(t,e))}function b(e){let t=e.querySelector(`.seams-voiceid-line-icon-check`);return{microphone:e.querySelector(`.seams-voiceid-line-icon-microphone`),check:t,tick:t?.querySelector(`path`)??null}}var x,S,C,w,T,E,D,ee,O,k,A,te,j,M,N={},P=[],F=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I=Array.isArray;function L(e,t){for(var n in t)e[n]=t[n];return e}function ne(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function R(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?x.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return z(e,o,r,i,null)}function z(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++C,__i:-1,__u:0};return i==null&&S.vnode!=null&&S.vnode(a),a}function B(e){return e.children}function V(e,t){this.props=e,this.context=t}function H(e,t){if(t==null)return e.__?H(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?H(e):null}function re(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=L({},t);a.__v=t.__v+1,S.vnode&&S.vnode(a),he(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??H(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,_e(r,a,i),t.__e=t.__=null,a.__e!=n&&ie(a)}}function ie(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ie(e)}function ae(e){(!e.__d&&(e.__d=!0)&&w.push(e)&&!oe.__r++||T!=S.debounceRendering)&&((T=S.debounceRendering)||E)(oe)}function oe(){try{for(var e,t=1;w.length;)w.length>t&&w.sort(D),e=w.shift(),t=w.length,re(e)}finally{w.length=oe.__r=0}}function se(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||P,v=t.length;for(c=ce(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||N,p.__i=d,g=he(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&be(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=le(p,c,e),f.__e&&=null):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function ce(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=z(null,o,null,null,null):I(o)?o=e.__k[a]=z(B,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=z(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=de(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=H(s)),xe(s,s));return r}function le(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=le(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=H(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ue(e,t){return t||=[],e==null||typeof e==`boolean`||(I(e)?e.some(function(e){ue(e,t)}):t.push(e)),t}function de(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function fe(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||F.test(t)?n:n+`px`}function pe(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||fe(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||fe(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(A,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[k]=r[k]:(n[k]=te,e.addEventListener(t,a?M:j,a)):e.removeEventListener(t,a?M:j,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function me(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[O]==null)t[O]=te++;else if(t[O]<n[k])return;return n(S.event?S.event(t):t)}}}function he(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,C,w,T,E,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=S.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(v=t.props,y=D.prototype&&D.prototype.render,b=(u=D.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new D(v,x):(t.__c=f=new V(v,x),f.constructor=D,f.render=Se),b&&b.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=L({},f.__s)),L(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),P.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=H(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,C=S.__r,w=0,y)f.state=f.__s,f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),P.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=L(L({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=u!=null&&u.type===B&&u.key==null?ve(u.props.children):u,s=se(e,I(T)?T:[T],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(E=a.length;E--;)ne(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||ge(t),S.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ye(n.__e,t,n,r,i,a,o,c,l);return(u=S.diffed)&&u(t),128&t.__u?void 0:s}function ge(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ge))}function _e(e,t,n){for(var r=0;r<n.length;r++)be(n[r],n[++r],n[++r]);S.__c&&S.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){S.__e(e,t.__v)}})}function ve(e){return typeof e!=`object`||!e||e.__b>0?e:I(e)?e.map(ve):e.constructor===void 0?L({},e):null}function ye(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||N,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(S.__m&&S.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&x.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||pe(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||pe(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),se(t.type==`template`?e.content:e,I(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&H(n,0),s,c),a!=null)for(l=a.length;l--;)ne(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&pe(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&pe(e,l,h,g[l],i))}return e}function be(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){S.__e(e,n)}}function xe(e,t,n){var r,i;if(S.unmount&&S.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||be(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){S.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&xe(r[i],t,n||typeof e.type!=`function`);n||ne(e.__e),e.__c=e.__=e.__e=void 0}function Se(e,t,n){return this.constructor(e,n)}function Ce(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),S.__&&S.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],he(t,e=(!r&&n||t).__k=R(B,null,[e]),i||N,N,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?x.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),_e(a,e,o),e.props.children=null}x=P.slice,S={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},C=0,V.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=L({},this.state);typeof e==`function`&&(e=e(L({},n),this.props)),e&&L(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ae(this))},V.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ae(this))},V.prototype.render=B,w=[],E=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,D=function(e,t){return e.__v.__b-t.__v.__b},oe.__r=0,ee=Math.random().toString(8),O=`__d`+ee,k=`__a`+ee,A=/(PointerCapture)$|Capture$/i,te=0,j=me(!1),M=me(!0);var we,U,Te,Ee,De=0,Oe=[],W=S,ke=W.__b,Ae=W.__r,je=W.diffed,Me=W.__c,Ne=W.unmount,Pe=W.__;function G(e,t){W.__h&&W.__h(U,e,De||t),De=0;var n=U.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Fe(e){return De=1,Ie(Ke,e)}function Ie(e,t,n){var r=G(we++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ke(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=U,!U.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};U.__f=!0;var a=U.shouldComponentUpdate,o=U.componentWillUpdate;U.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},U.shouldComponentUpdate=i}return r.__N||r.__}function Le(e,t){var n=G(we++,3);!W.__s&&Ge(n.__H,t)&&(n.__=e,n.u=t,U.__H.__h.push(n))}function Re(e){return De=5,ze(function(){return{current:e}},[])}function ze(e,t){var n=G(we++,7);return Ge(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Be(e,t){return De=8,ze(function(){return e},t)}function Ve(){var e=G(we++,11);if(!e.__){for(var t=U.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function He(){for(var e;e=Oe.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ue),t.__h.some(We),t.__h=[]}catch(n){t.__h=[],W.__e(n,e.__v)}}}W.__b=function(e){U=null,ke&&ke(e)},W.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pe&&Pe(e,t)},W.__r=function(e){Ae&&Ae(e),we=0;var t=(U=e.__c).__H;t&&(Te===U?(t.__h=[],U.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Ue),t.__h.some(We),t.__h=[],we=0)),Te=U},W.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Oe.push(t)!==1&&Ee===W.requestAnimationFrame||((Ee=W.requestAnimationFrame)||q)(He)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),Te=U=null},W.__c=function(e,t){t.some(function(e){try{e.__h.some(Ue),e.__h=e.__h.filter(function(e){return!e.__||We(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],W.__e(n,e.__v)}}),Me&&Me(e,t)},W.unmount=function(e){Ne&&Ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Ue(e)}catch(e){t=e}}),n.__H=void 0,t&&W.__e(t,n.__v))};var K=typeof requestAnimationFrame==`function`;function q(e){var t,n=function(){clearTimeout(r),K&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);K&&(t=requestAnimationFrame(n))}function Ue(e){var t=U,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),U=t}function We(e){var t=U;e.__c=e.__(),U=t}function Ge(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ke(e,t){return typeof t==`function`?t(e):t}function qe(e,t){for(var n in t)e[n]=t[n];return e}function Je(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Ye(e,t){this.props=e,this.context=t}(Ye.prototype=new V).isPureReactComponent=!0,Ye.prototype.shouldComponentUpdate=function(e,t){return Je(this.props,e)||Je(this.state,t)};var Xe=S.__b;S.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Xe&&Xe(e)};var Ze=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function Qe(e){function t(t){var n=qe({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Ze,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var $e=S.__e;S.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}$e(e,t,n,r)};var et=S.unmount;function tt(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=qe({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return tt(e,t,n)})),e}function nt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return nt(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function rt(){this.__u=0,this.o=null,this.__b=null}function it(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function at(){this.i=null,this.l=null}S.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),et&&et(e)},(rt.prototype=new V).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=it(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=nt(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},rt.prototype.componentWillUnmount=function(){this.o=[]},rt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=tt(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&R(B,null,e.fallback);return i&&(i.__u&=-33),[R(B,null,t.__a?null:e.children),i]};var ot=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(at.prototype=new V).__a=function(e){var t=this,n=it(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),ot(t,e,r)):i()};n?n(a):a()}},at.prototype.render=function(e){this.i=null,this.l=new Map;var t=ue(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},at.prototype.componentDidUpdate=at.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){ot(e,n,t)})};var st=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,ct=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,lt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ut=/[A-Z0-9]/g,dt=typeof document<`u`,ft=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};V.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(V.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var pt=S.event;S.event=function(e){return pt&&(e=pt(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var mt={configurable:!0,get:function(){return this.class}},ht=S.vnode;S.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||dt&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||ft(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:lt.test(a)&&(a=s):s=a=`oninput`:i&&ct.test(a)?a=a.replace(ut,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=ue(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=ue(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,`className`,mt)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=st,ht&&ht(e)};var gt=S.__r;S.__r=function(e){gt&&gt(e),e.__c};var _t=S.diffed;S.diffed=function(e){_t&&_t(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};var vt=0;Array.isArray;function J(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--vt,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return S.vnode&&S.vnode(l),l}function yt(e){let t=e.trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){let e=n[1].length===3?n[1].split(``).map(e=>e+e).join(``):n[1];return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}let r=t.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);return r?[Math.round(+r[1]),Math.round(+r[2]),Math.round(+r[3])]:null}function bt(e){let t=yt(e);return t?`rgb(${t[0]}, ${t[1]}, ${t[2]})`:null}function xt(e){let t=yt(e);return t?`${t[0]}, ${t[1]}, ${t[2]}`:null}const St={dark:{strokeOpacity:1.16,innerOpacity:.47,bloomOpacity:.89,innerShadow:`rgba(255, 255, 255, 0.1)`,saturation:1.2,brightness:1.1},light:{strokeOpacity:1.2,innerOpacity:.85,bloomOpacity:.5,innerShadow:`rgba(0, 0, 0, 0.08)`,saturation:1.6,brightness:.95,hueRange:40,hueDuration:8.5,hueBase:5,strength:.8,bandStrength:1.7}},Ct=[{x:0,w:74,h:46,band:0},{x:-36,w:54,h:40,band:1},{x:36,w:54,h:40,band:1},{x:-72,w:48,h:32,band:2},{x:72,w:48,h:32,band:2},{x:-108,w:42,h:26,band:1},{x:108,w:42,h:26,band:1}],wt=36*Ct.length,Tt={colorful:{dark:[`rgb(255, 70, 120)`,`rgb(60, 190, 255)`,`rgb(175, 70, 255)`,`rgb(60, 220, 130)`,`rgb(255, 150, 40)`,`rgb(90, 100, 255)`,`rgb(40, 200, 190)`],light:[`rgb(255, 201, 21)`,`rgb(126, 196, 255)`,`rgb(180, 40, 230)`,`rgb(235, 100, 160)`,`rgb(255, 176, 122)`,`rgb(154, 160, 255)`,`rgb(127, 217, 238)`]},mono:{dark:[`rgb(215, 215, 215)`,`rgb(180, 180, 180)`,`rgb(190, 190, 190)`,`rgb(160, 160, 160)`,`rgb(170, 170, 170)`,`rgb(150, 150, 150)`,`rgb(155, 155, 155)`],light:[`rgb(60, 60, 60)`,`rgb(90, 90, 90)`,`rgb(85, 85, 85)`,`rgb(110, 110, 110)`,`rgb(105, 105, 105)`,`rgb(125, 125, 125)`,`rgb(120, 120, 120)`]},ocean:{dark:[`rgb(80, 140, 255)`,`rgb(40, 200, 230)`,`rgb(120, 90, 255)`,`rgb(30, 170, 210)`,`rgb(160, 80, 240)`,`rgb(60, 110, 255)`,`rgb(40, 190, 180)`],light:[`rgb(40, 100, 240)`,`rgb(20, 160, 200)`,`rgb(90, 60, 230)`,`rgb(20, 130, 180)`,`rgb(130, 50, 220)`,`rgb(40, 80, 230)`,`rgb(20, 150, 150)`]},sunset:{dark:[`rgb(255, 110, 60)`,`rgb(255, 180, 40)`,`rgb(255, 60, 90)`,`rgb(255, 210, 80)`,`rgb(240, 70, 140)`,`rgb(255, 140, 50)`,`rgb(230, 50, 110)`],light:[`rgb(235, 80, 30)`,`rgb(230, 150, 10)`,`rgb(230, 30, 70)`,`rgb(225, 175, 30)`,`rgb(215, 40, 110)`,`rgb(235, 110, 20)`,`rgb(205, 30, 90)`]},forest:{dark:[`rgb(70, 220, 120)`,`rgb(40, 200, 180)`,`rgb(140, 230, 80)`,`rgb(30, 170, 140)`,`rgb(190, 235, 70)`,`rgb(50, 190, 110)`,`rgb(30, 150, 120)`],light:[`rgb(30, 170, 80)`,`rgb(20, 150, 130)`,`rgb(90, 180, 30)`,`rgb(20, 130, 100)`,`rgb(130, 180, 20)`,`rgb(30, 150, 80)`,`rgb(20, 120, 90)`]},candy:{dark:[`rgb(255, 90, 170)`,`rgb(255, 120, 220)`,`rgb(210, 80, 255)`,`rgb(255, 150, 190)`,`rgb(180, 110, 255)`,`rgb(255, 70, 140)`,`rgb(230, 100, 240)`],light:[`rgb(235, 40, 140)`,`rgb(230, 70, 190)`,`rgb(180, 40, 230)`,`rgb(235, 100, 160)`,`rgb(150, 70, 230)`,`rgb(230, 30, 110)`,`rgb(200, 60, 210)`]},ice:{dark:[`rgb(150, 230, 255)`,`rgb(90, 200, 255)`,`rgb(190, 240, 255)`,`rgb(120, 190, 255)`,`rgb(160, 220, 250)`,`rgb(80, 170, 255)`,`rgb(200, 235, 255)`],light:[`rgb(30, 160, 220)`,`rgb(20, 130, 210)`,`rgb(60, 180, 230)`,`rgb(40, 120, 220)`,`rgb(50, 160, 220)`,`rgb(20, 110, 220)`,`rgb(70, 170, 230)`]},gold:{dark:[`rgb(255, 200, 70)`,`rgb(255, 170, 40)`,`rgb(255, 220, 110)`,`rgb(240, 150, 30)`,`rgb(255, 235, 140)`,`rgb(230, 160, 40)`,`rgb(250, 210, 90)`],light:[`rgb(200, 140, 10)`,`rgb(190, 120, 0)`,`rgb(210, 160, 30)`,`rgb(180, 110, 0)`,`rgb(205, 170, 40)`,`rgb(175, 115, 5)`,`rgb(195, 150, 20)`]}};function Et(e,t){let n=e.match(/^rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);return n?`rgba(${n[1]}, ${n[2]}, ${n[3]}, ${t.toFixed(2)})`:e}function Dt(e,t=1){return Math.max(.5,Math.round(e*t*100)/100)}function Ot(e,t){return`calc(50% + (var(--vb-cx-${t}) + var(--vb-x${e}-${t})) * var(--vb-w-${t}) * var(--vb-z-${t}, 1))`}function kt({id:e,colors:t,alpha:n,sw:r,sh:i,y:a,fade:o,count:s}){return(s?Ct.slice(0,s):Ct).map((s,c)=>{let l=n>=1?t[c%t.length]:Et(t[c%t.length],n),u=`calc(${Math.round(s.w*r)}px * var(--vb-w-${e}) * var(--vb-z-${e}, 1))`,d=`calc(${Math.round(s.h*i)}px * var(--vb-h-${e}) * var(--vb-l${c}-${e}) * var(--vb-z-${e}, 1))`,f=`calc(100% + (${a}px + var(--vb-y${c}-${e})) * var(--vb-z-${e}, 1))`;return`radial-gradient(ellipse ${u} ${d} at ${Ot(c,e)} ${f}, ${l} 0%, transparent ${o}%)`}).join(`,
2
- `)}function At(e){let{id:t,borderRadius:n,borderWidth:r,strokeOpacity:i,innerOpacity:a,bloomOpacity:o,innerShadow:s,colorVariant:c,colors:l,brightness:u,saturation:d,theme:f,hueBase:p=0,glowSize:m=1,glowWidth:h=1,glowHeight:g=1,strokeScale:_=1,innerScale:v=1,innerHeight:y=1,bloomScale:b=1,bloomHeight:x=1,coreSize:S=1,coreLight:C=0,coreLightWidth:w=1,coreLightHeight:T=1,rangeWidth:E=1,rangeHeight:D=1,softness:ee=1,distortion:O=!1,scale:k=1}=e,A=Math.round(28*k*10)/10,te=Math.round(9*k*10)/10,j=Math.max(0,n-r),M=Math.round(Math.max(40,Math.min(95,70*ee))),N=e=>h*e,P=e=>g*e,F=e=>Math.round(e*10)/10,I=`var(--vb-z-${t}, 1)`,L=e=>`calc(${F(e)}px * ${I})`,ne=f===`dark`,R=Tt[c][ne?`dark`:`light`].map((e,t)=>{let n=l?.[t];return n&&bt(n)||e}),z=c===`mono`?.6:1,B=(i*z).toFixed(2),V=(a*z).toFixed(2),H=(o*z).toFixed(2),re=u.toFixed(2),ie=d.toFixed(2),ae=`hue-rotate(calc(var(--voice-hue-base, ${p}deg) + var(--vb-hue-${t})))`,oe=O?` url(#vb-distort-${t})`:``,se=`filter: ${ae} brightness(${re}) saturate(${ie});`,ce=`filter: ${ae} brightness(${re}) saturate(${ie})${oe};`,le=`filter: blur(${L(Dt(10,m))}) ${ae} brightness(${re}) saturate(${ie});`,ue=`filter: blur(${L(Dt(10,m))}) ${ae} brightness(${re}) saturate(${ie})${oe};`,de=`calc(50% + var(--vb-cx-${t}) * var(--vb-w-${t}) * ${I})`,fe=`calc(100% + (2px + var(--vb-cy-${t})) * ${I})`,pe=ne?`radial-gradient(ellipse calc(${F(30*S)}px * var(--vb-w-${t}) * ${I}) calc(${F(30*S)}px * var(--vb-h-${t}) * ${I}) at ${de} ${fe}, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.14) 30%, transparent 65%)`:`radial-gradient(ellipse calc(${F(40*S)}px * var(--vb-w-${t}) * ${I}) calc(${F(30*S)}px * var(--vb-h-${t}) * ${I}) at ${de} ${fe}, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.22) 35%, transparent 70%)`,me=kt({id:t,colors:R,alpha:1,sw:N(_),sh:P(_),y:2,fade:M}),he=kt({id:t,colors:R,alpha:.46,sw:N(.9*v),sh:P(.9*v*y),y:0,fade:M}),ge=kt({id:t,colors:R,alpha:ne?.9:.7,sw:N(1.15*b),sh:P(1.5*b*x),y:0,fade:Math.min(95,M+2)}),_e=(e,n,r,i=0)=>`radial-gradient(ellipse calc(${F(e*E)}px * var(--vb-w-${t}) * var(--vb-mw-${t}) * ${I}) calc((${F(n*D)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${I}) at ${de} calc(100% + var(--vb-cy-${t}) * ${I}), white 0%, rgba(255, 255, 255, 0.5) ${r}%${i>0?`, rgba(255, 255, 255, ${i}) 85%`:``}, transparent 100%)`,ve=(e,n)=>`opacity: calc(var(--vb-opacity-${t}, 1) * var(--vb-glow-${t}) * ${n} * var(--voice-${e}-opacity, 1) * var(--voice-strength, 1));`,ye=(e,t,r,i)=>`${e} {
1
+ import{S as e,h as t,n,o as r,r as i,s as a,u as o,v as s,w as c}from"./chunks/microphone-BQVF_tVV.js";const l=`cubic-bezier(0.2, 0, 0, 1)`,u=`http://www.w3.org/2000/svg`,d=`cubic-bezier(0.2, 0, 0, 1)`,f=`cubic-bezier(0.2, 0.7, 0.2, 1)`,p=`cubic-bezier(0.65, 0, 0.35, 1)`,m=[`M18.9 7a8 8 0 0 1 1.1 5v1a6 6 0 0 0 .8 3`,`M8 11a4 4 0 0 1 8 0v1a10 10 0 0 0 2 6`,`M12 11v2a14 14 0 0 0 2.5 8`,`M8 15a18 18 0 0 0 1.8 6`,`M4.9 19a22 22 0 0 1-.9-7v-1a8 8 0 0 1 12-6.95`];var h=class{line;segments=[];bar;ring;seal;check;motion=matchMedia(`(prefers-reduced-motion: reduce)`);rows;states=[];rendering=Promise.resolve();morph=null;rotation=0;version=0;disposed=!1;constructor(e,t,n=null){this.prompt=e,this.copy=t;let r=e.element.ownerDocument;this.line=r.createElementNS(u,`svg`),this.line.classList.add(`seams-voiceid-status-line`),this.line.setAttribute(`viewBox`,`0 0 308 64`),this.line.setAttribute(`aria-hidden`,`true`);for(let e=0;e<6;e+=1){let e=r.createElementNS(u,`rect`);e.setAttribute(`rx`,`1.5`),this.line.append(e),this.segments.push(e)}this.bar=r.createElementNS(u,`path`),this.bar.classList.add(`seams-voiceid-status-bar`),this.bar.setAttribute(`d`,`M1.5 32H306.5`),this.ring=r.createElementNS(u,`circle`),this.ring.classList.add(`seams-voiceid-status-ring`),this.ring.setAttribute(`r`,`21.5`),this.seal=r.createElementNS(u,`circle`),this.seal.classList.add(`seams-voiceid-status-seal`),this.seal.setAttribute(`r`,`22.5`);for(let e of[this.ring,this.seal])e.setAttribute(`cx`,`154`),e.setAttribute(`cy`,`32`);this.check=r.createElementNS(u,`path`),this.check.classList.add(`seams-voiceid-status-check`),this.check.setAttribute(`d`,`M161 26.8 151.4 36.3 147.1 32`),this.check.setAttribute(`pathLength`,`1`),this.line.append(this.bar,this.ring,this.seal,this.check),e.ribbon.after(this.line),this.rows=n?{...this.promptRows(),label:n.label,caption:`handed-over:${n.message}`,action:``}:this.promptRows(),this.layoutSegments(0,3)}showPrompt(){let e=this.begin();return this.queue(async()=>{if(this.stale(e))return;let t=this.prompt.element;t.removeAttribute(`aria-busy`),await this.transition(this.promptRows(),e,()=>{delete t.dataset.phraseView,delete t.dataset.phraseLine,this.writeCaption(this.copy.message,[]),this.writeAction({label:this.copy.action}),this.resetLine(),this.prompt.ready(this.copy.message)}),this.stale(e)||this.prompt.record.focus()})}beginCheck(){this.disposed||this.morph||(this.prompt.flattenLine(),this.morph=this.openSegments())}show(e){let t=this.begin();return this.queue(async()=>{if(this.stale(t))return;let n=this.prompt.element;if(this.prompt.flattenLine(),this.morph??=this.openSegments(),e.kind===`check`){n.setAttribute(`aria-busy`,`true`);let r=e.details[0]??``,i={label:e.label,head:this.copy.sentence,headline:!1,dim:!0,caption:`check:${e.caption}:${r}`,action:``};if(await this.transition(i,t,()=>{n.dataset.phraseView=`check`,this.writeCaption(e.caption,[r])}),await this.morph,this.stale(t))return;await this.setSegments(e.segments),this.stale(t)||this.rotateDetails(e.details,t);return}if(n.removeAttribute(`aria-busy`),await this.morph,this.stale(t)||(e.line===`seal`?await this.sealLine(t):await this.setSegments(e.line),this.stale(t)))return;this.prompt.quietLine();let r={label:e.label,head:e.headline,headline:!0,dim:!1,caption:`result:${JSON.stringify([e.caption,e.receipt??null,e.detail,e.link??null])}`,action:`result:${e.action.icon??``}:${e.action.label}`};await this.transition(r,t,()=>{n.dataset.phraseView=`result`,this.writeCaption(this.markedText(e.caption),this.detailNodes(e),e.receipt),this.writeAction(e.action),this.prompt.record.hidden=!1}),!this.stale(t)&&(this.prompt.record.disabled=e.action.busy===!0,e.action.busy||this.prompt.record.focus())})}dispose(){this.disposed=!0,this.version+=1,window.clearInterval(this.rotation)}begin(){return window.clearInterval(this.rotation),this.version+=1,this.version}stale(e){return this.disposed||e!==this.version}queue(e){return this.rendering=this.rendering.then(e,e),this.rendering}promptRows(){return{label:this.copy.label,head:this.copy.sentence,headline:!1,dim:!1,caption:`prompt:${this.copy.message}`,action:`prompt:${this.copy.action}`}}async transition(e,t,n){let r=this.prompt,i=[[`label`,r.title],[`head`,r.phrase],[`caption`,r.status],[`action`,r.actionRow]].filter(([t])=>this.rows[t]!==e[t]||t===`head`&&this.rows.headline!==e.headline).map(([,e])=>e);if(r.phrase.classList.toggle(`seams-voiceid-phrase-dim`,e.dim),i.length>0&&!this.motion.matches&&await Promise.all(i.map(e=>v(e,150))),this.stale(t))return;let a=r.ribbon.getBoundingClientRect().top,o=r.element.getBoundingClientRect().height;r.title.textContent=e.label,r.phrase.textContent=e.head,r.phrase.classList.toggle(`seams-voiceid-success-headline`,e.headline),n(),this.rows=e,r.fillFrame(o);let s=a-r.ribbon.getBoundingClientRect().top;if(Math.abs(s)>.5&&!this.motion.matches)for(let e of[r.ribbon,this.line])e.animate([{transform:`translateY(${s}px)`},{transform:`none`}],{duration:180,easing:f});for(let[e,t]of i.entries())y(t,this.motion.matches,0+e*20)}markedText(e){if(typeof e==`string`)return[e];let t=this.prompt.element.ownerDocument;return e.map(e=>{if(typeof e==`string`)return e;let n=t.createElement(`mark`);return n.className=`seams-voiceid-heard-mark`,n.textContent=e.mark,n})}detailNodes(e){return e.link?[e.detail,` `,this.linkNode(e.link)]:[e.detail]}linkNode(e){let t=this.prompt.element.ownerDocument.createElement(`a`);return t.href=e.href,t.target=`_blank`,t.rel=`noopener noreferrer`,t.textContent=e.text,t}receiptNode(e){let t=this.prompt.element.ownerDocument,n=(e,n,...r)=>{let i=t.createElement(e);return i.className=n,i.append(...r),i},r=n(`span`,`seams-voiceid-receipt-head`,n(`b`,``,e.title));e.source&&r.append(n(`span`,`seams-voiceid-receipt-source`,e.source));let i=n(`span`,`seams-voiceid-receipt`,r,n(`span`,`seams-voiceid-receipt-rows`,...e.rows.flatMap(e=>[n(`span`,`seams-voiceid-receipt-check`,_(t)),n(`span`,`seams-voiceid-receipt-label`,e.label),n(`span`,`seams-voiceid-receipt-value`,e.value)])));return e.link&&i.append(n(`span`,`seams-voiceid-receipt-foot`,this.linkNode(e.link))),i}writeCaption(e,t,n){let r=this.prompt.status;if(r.classList.toggle(`seams-voiceid-has-receipt`,n!==void 0),typeof e==`string`&&t.length===0&&!n){r.classList.remove(`seams-voiceid-two-lines`),r.textContent=e;return}let i=r.ownerDocument,a=i.createElement(`span`);a.className=`seams-voiceid-caption`,a.append(...typeof e==`string`?[e]:e);let o=i.createElement(`span`);o.className=`seams-voiceid-caption-detail`,o.append(...t),r.replaceChildren(...n?[a,this.receiptNode(n),o]:[a,o]),r.classList.add(`seams-voiceid-two-lines`)}writeAction(e){let t=this.prompt.record;t.replaceChildren(),e.icon===`passkey`&&t.append(g(t.ownerDocument)),t.append(e.label)}rotateDetails(e,t){if(e.length<2)return;let n=0;this.rotation=window.setInterval(()=>{n+=1,(n>=e.length-1||this.stale(t))&&window.clearInterval(this.rotation),n<e.length&&!this.stale(t)&&this.swapDetail(e[n],t)},1300)}async swapDetail(e,t){let n=this.prompt.status.querySelector(`.seams-voiceid-caption-detail`);n&&(this.motion.matches||await v(n,90),!this.stale(t)&&(n.textContent=e,n.getAnimations().forEach(e=>e.cancel()),n.animate([{opacity:0,transform:this.motion.matches?`none`:`translateY(2px)`},{opacity:1,transform:`none`}],{duration:160,easing:d,fill:`both`})))}async openSegments(){await b(this.motion.matches?0:200),!this.disposed&&(this.states=Array.from({length:6},()=>`done`),this.paintStates(),this.prompt.element.dataset.phraseLine=`status`,await this.tween(this.motion.matches?0:200,e=>this.layoutSegments(8*e,1+2*e)),!this.disposed&&(this.states=this.states.map((e,t)=>t===0?`done`:`idle`),this.paintStates(),await b(this.motion.matches?0:240)))}async setSegments(e){let t=e.map((e,t)=>e===`done`&&this.states[t]===`run`?t:-1).filter(e=>e>=0),n=[...e];this.states=n.map((e,n)=>t.includes(n)?`run`:e===`fail`||e===`wait`||e===`skip`?this.states[n]??`idle`:e),this.paintStates();for(let e of t){if(await b(this.motion.matches?0:70),this.disposed)return;this.states[e]=`done`,this.paintStates()}let r=n.some(e=>e===`fail`||e===`wait`);this.states=n,this.paintStates(),r&&await b(this.motion.matches?0:240)}async sealLine(e){if(await this.setSegments(Array.from({length:6},()=>`done`)),this.stale(e))return;let t=this.motion.matches;if(await this.tween(t?0:240,e=>this.layoutSegments(8*(1-e),3)),this.stale(e))return;let n=this.lineIcon();if(n){await this.sealIcon(e,n,t);return}this.line.dataset.seal=``;let r=2*Math.PI*21.5;this.ring.style.strokeDasharray=String(r);let i=(e,n)=>({duration:t?0:e,easing:n,fill:`forwards`});this.bar.animate([{transform:`scaleX(1)`},{transform:`scaleX(0)`}],i(440,p)),await this.ring.animate([{strokeDashoffset:r},{strokeDashoffset:0}],i(440,p)).finished,!this.stale(e)&&(this.seal.animate([{transform:`scale(0)`},{transform:`scale(1)`}],i(320,`cubic-bezier(0.34, 1.56, 0.64, 1)`)),await b(t?0:220),!this.stale(e)&&await this.check.animate([{strokeDashoffset:1},{strokeDashoffset:0}],i(260,d)).finished)}async sealIcon(e,t,n){this.line.dataset.seal=`icon`;let r=(e,t)=>({duration:n?0:e,easing:t,fill:`forwards`}),i=this.bar.getBoundingClientRect(),a=t.getBoundingClientRect(),o=this.bar.getScreenCTM()?.a||1,s=(a.left+a.width/2-i.left)/o;if(await this.bar.animate([{transform:`translateX(0) scaleX(1)`},{transform:`translateX(${s}px) scaleX(0)`}],r(360,p)).finished,this.stale(e))return;let{microphone:c,check:l,tick:u}=x(t);c?.animate([{opacity:1,transform:`scale(1)`},{opacity:0,transform:`scale(0.6)`}],r(160,d)),l?.animate([{opacity:0},{opacity:1}],r(160,d)),t.animate([{transform:`scale(1)`},{transform:`scale(1.1)`},{transform:`scale(1)`}],r(320,f)),await u?.animate([{strokeDashoffset:1},{strokeDashoffset:0}],r(260,d)).finished}lineIcon(){return this.prompt.element.querySelector(`:scope > .seams-voiceid-line-icon`)}resetLine(){this.morph=null,this.states=[],delete this.line.dataset.seal;let e=this.lineIcon(),t=e?Object.values(x(e)):[];for(let n of[this.bar,this.ring,this.seal,this.check,e,...t])n?.getAnimations().forEach(e=>e.cancel());this.layoutSegments(0,3),this.paintStates()}paintStates(){for(let[e,t]of this.segments.entries()){let n=this.states[e];n?t.dataset.state=n:delete t.dataset.state}}layoutSegments(e,t){let n=(308-5*e)/6;for(let[r,i]of this.segments.entries())i.setAttribute(`x`,(r*(n+e)).toFixed(2)),i.setAttribute(`width`,n.toFixed(2)),i.setAttribute(`y`,(32-t/2).toFixed(2)),i.setAttribute(`height`,t.toFixed(2))}tween(e,t){return e<=0?(t(1),Promise.resolve()):new Promise(n=>{let r=performance.now(),i=a=>{if(this.disposed)return n();let o=Math.min(1,(a-r)/e);t(1-(1-o)**3),o<1?requestAnimationFrame(i):n()};requestAnimationFrame(i)})}};function g(e){let t=e.createElementNS(u,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`width`,`18`),t.setAttribute(`height`,`18`),t.setAttribute(`aria-hidden`,`true`),t.classList.add(`seams-voiceid-action-icon`);for(let n of m){let r=e.createElementNS(u,`path`);r.setAttribute(`d`,n),t.append(r)}return t}function _(e){let t=e.createElementNS(u,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`width`,`15`),t.setAttribute(`height`,`15`),t.setAttribute(`aria-hidden`,`true`);let n=e.createElementNS(u,`path`);return n.setAttribute(`d`,`M5 12l5 5L20 7`),t.append(n),t}function v(e,t){let n=Number(getComputedStyle(e).opacity);return e.animate([{opacity:n},{opacity:0}],{duration:t*n,easing:`ease-in`,fill:`forwards`}).finished}function y(e,t,n){e.getAnimations().forEach(e=>e.cancel()),e.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:1,transform:`none`}],{delay:t?0:n,duration:t?150:140,easing:l,fill:`both`})}function b(e){return new Promise(t=>window.setTimeout(t,e))}function x(e){let t=e.querySelector(`.seams-voiceid-line-icon-check`);return{microphone:e.querySelector(`.seams-voiceid-line-icon-microphone`),check:t,tick:t?.querySelector(`path`)??null}}var S,C,w,T,E,D,ee,O,k,A,te,j,M,ne,N={},P=[],F=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I=Array.isArray;function L(e,t){for(var n in t)e[n]=t[n];return e}function re(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function R(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?S.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return z(e,o,r,i,null)}function z(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++w,__i:-1,__u:0};return i==null&&C.vnode!=null&&C.vnode(a),a}function B(e){return e.children}function V(e,t){this.props=e,this.context=t}function H(e,t){if(t==null)return e.__?H(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?H(e):null}function ie(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=L({},t);a.__v=t.__v+1,C.vnode&&C.vnode(a),ge(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??H(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,ve(r,a,i),t.__e=t.__=null,a.__e!=n&&ae(a)}}function ae(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ae(e)}function oe(e){(!e.__d&&(e.__d=!0)&&T.push(e)&&!se.__r++||E!=C.debounceRendering)&&((E=C.debounceRendering)||D)(se)}function se(){try{for(var e,t=1;T.length;)T.length>t&&T.sort(ee),e=T.shift(),t=T.length,ie(e)}finally{T.length=se.__r=0}}function ce(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||P,v=t.length;for(c=le(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||N,p.__i=d,g=ge(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&xe(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=ue(p,c,e),f.__e&&=null):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function le(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=z(null,o,null,null,null):I(o)?o=e.__k[a]=z(B,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=z(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=fe(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=H(s)),Se(s,s));return r}function ue(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=ue(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=H(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function de(e,t){return t||=[],e==null||typeof e==`boolean`||(I(e)?e.some(function(e){de(e,t)}):t.push(e)),t}function fe(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function pe(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||F.test(t)?n:n+`px`}function me(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||pe(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||pe(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(te,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[A]=r[A]:(n[A]=j,e.addEventListener(t,a?ne:M,a)):e.removeEventListener(t,a?ne:M,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function he(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[k]==null)t[k]=j++;else if(t[k]<n[A])return;return n(C.event?C.event(t):t)}}}function ge(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,w,T,E,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=C.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(v=t.props,y=D.prototype&&D.prototype.render,b=(u=D.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new D(v,x):(t.__c=f=new V(v,x),f.constructor=D,f.render=Ce),b&&b.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=L({},f.__s)),L(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),P.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=H(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,S=C.__r,w=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),P.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=L(L({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=u!=null&&u.type===B&&u.key==null?ye(u.props.children):u,s=ce(e,I(T)?T:[T],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(E=a.length;E--;)re(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||_e(t),C.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=be(n.__e,t,n,r,i,a,o,c,l);return(u=C.diffed)&&u(t),128&t.__u?void 0:s}function _e(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(_e))}function ve(e,t,n){for(var r=0;r<n.length;r++)xe(n[r],n[++r],n[++r]);C.__c&&C.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){C.__e(e,t.__v)}})}function ye(e){return typeof e!=`object`||!e||e.__b>0?e:I(e)?e.map(ye):e.constructor===void 0?L({},e):null}function be(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||N,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(C.__m&&C.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&S.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||me(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||me(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),ce(t.type==`template`?e.content:e,I(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&H(n,0),s,c),a!=null)for(l=a.length;l--;)re(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&me(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&me(e,l,h,g[l],i))}return e}function xe(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){C.__e(e,n)}}function Se(e,t,n){var r,i;if(C.unmount&&C.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||xe(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){C.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Se(r[i],t,n||typeof e.type!=`function`);n||re(e.__e),e.__c=e.__=e.__e=void 0}function Ce(e,t,n){return this.constructor(e,n)}function we(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),C.__&&C.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],ge(t,e=(!r&&n||t).__k=R(B,null,[e]),i||N,N,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?S.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ve(a,e,o),e.props.children=null}S=P.slice,C={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},w=0,V.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=L({},this.state);typeof e==`function`&&(e=e(L({},n),this.props)),e&&L(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),oe(this))},V.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),oe(this))},V.prototype.render=B,T=[],D=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ee=function(e,t){return e.__v.__b-t.__v.__b},se.__r=0,O=Math.random().toString(8),k=`__d`+O,A=`__a`+O,te=/(PointerCapture)$|Capture$/i,j=0,M=he(!1),ne=he(!0);var Te,U,Ee,De,Oe=0,ke=[],W=C,Ae=W.__b,je=W.__r,Me=W.diffed,Ne=W.__c,Pe=W.unmount,G=W.__;function Fe(e,t){W.__h&&W.__h(U,e,Oe||t),Oe=0;var n=U.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Ie(e){return Oe=1,Le(qe,e)}function Le(e,t,n){var r=Fe(Te++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):qe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=U,!U.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};U.__f=!0;var a=U.shouldComponentUpdate,o=U.componentWillUpdate;U.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},U.shouldComponentUpdate=i}return r.__N||r.__}function Re(e,t){var n=Fe(Te++,3);!W.__s&&Ke(n.__H,t)&&(n.__=e,n.u=t,U.__H.__h.push(n))}function ze(e){return Oe=5,Be(function(){return{current:e}},[])}function Be(e,t){var n=Fe(Te++,7);return Ke(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ve(e,t){return Oe=8,Be(function(){return e},t)}function He(){var e=Fe(Te++,11);if(!e.__){for(var t=U.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function K(){for(var e;e=ke.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(We),t.__h.some(Ge),t.__h=[]}catch(n){t.__h=[],W.__e(n,e.__v)}}}W.__b=function(e){U=null,Ae&&Ae(e)},W.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),G&&G(e,t)},W.__r=function(e){je&&je(e),Te=0;var t=(U=e.__c).__H;t&&(Ee===U?(t.__h=[],U.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(We),t.__h.some(Ge),t.__h=[],Te=0)),Ee=U},W.diffed=function(e){Me&&Me(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ke.push(t)!==1&&De===W.requestAnimationFrame||((De=W.requestAnimationFrame)||Ue)(K)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),Ee=U=null},W.__c=function(e,t){t.some(function(e){try{e.__h.some(We),e.__h=e.__h.filter(function(e){return!e.__||Ge(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],W.__e(n,e.__v)}}),Ne&&Ne(e,t)},W.unmount=function(e){Pe&&Pe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{We(e)}catch(e){t=e}}),n.__H=void 0,t&&W.__e(t,n.__v))};var q=typeof requestAnimationFrame==`function`;function Ue(e){var t,n=function(){clearTimeout(r),q&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);q&&(t=requestAnimationFrame(n))}function We(e){var t=U,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),U=t}function Ge(e){var t=U;e.__c=e.__(),U=t}function Ke(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function qe(e,t){return typeof t==`function`?t(e):t}function Je(e,t){for(var n in t)e[n]=t[n];return e}function Ye(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Xe(e,t){this.props=e,this.context=t}(Xe.prototype=new V).isPureReactComponent=!0,Xe.prototype.shouldComponentUpdate=function(e,t){return Ye(this.props,e)||Ye(this.state,t)};var Ze=C.__b;C.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ze&&Ze(e)};var Qe=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function $e(e){function t(t){var n=Je({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Qe,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var et=C.__e;C.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}et(e,t,n,r)};var tt=C.unmount;function nt(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Je({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return nt(e,t,n)})),e}function rt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return rt(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function it(){this.__u=0,this.o=null,this.__b=null}function at(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function ot(){this.i=null,this.l=null}C.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),tt&&tt(e)},(it.prototype=new V).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=at(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=rt(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},it.prototype.componentWillUnmount=function(){this.o=[]},it.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=nt(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&R(B,null,e.fallback);return i&&(i.__u&=-33),[R(B,null,t.__a?null:e.children),i]};var st=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(ot.prototype=new V).__a=function(e){var t=this,n=at(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),st(t,e,r)):i()};n?n(a):a()}},ot.prototype.render=function(e){this.i=null,this.l=new Map;var t=de(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},ot.prototype.componentDidUpdate=ot.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){st(e,n,t)})};var ct=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,lt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ut=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,dt=/[A-Z0-9]/g,ft=typeof document<`u`,pt=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};V.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(V.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var mt=C.event;C.event=function(e){return mt&&(e=mt(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var ht={configurable:!0,get:function(){return this.class}},gt=C.vnode;C.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||ft&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||pt(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:ut.test(a)&&(a=s):s=a=`oninput`:i&&lt.test(a)?a=a.replace(dt,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=de(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=de(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,`className`,ht)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=ct,gt&&gt(e)};var _t=C.__r;C.__r=function(e){_t&&_t(e),e.__c};var vt=C.diffed;C.diffed=function(e){vt&&vt(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};var yt=0;Array.isArray;function J(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--yt,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return C.vnode&&C.vnode(l),l}function bt(e){let t=e.trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){let e=n[1].length===3?n[1].split(``).map(e=>e+e).join(``):n[1];return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}let r=t.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);return r?[Math.round(+r[1]),Math.round(+r[2]),Math.round(+r[3])]:null}function xt(e){let t=bt(e);return t?`rgb(${t[0]}, ${t[1]}, ${t[2]})`:null}function St(e){let t=bt(e);return t?`${t[0]}, ${t[1]}, ${t[2]}`:null}const Ct={dark:{strokeOpacity:1.16,innerOpacity:.47,bloomOpacity:.89,innerShadow:`rgba(255, 255, 255, 0.1)`,saturation:1.2,brightness:1.1},light:{strokeOpacity:1.2,innerOpacity:.85,bloomOpacity:.5,innerShadow:`rgba(0, 0, 0, 0.08)`,saturation:1.6,brightness:.95,hueRange:40,hueDuration:8.5,hueBase:5,strength:.8,bandStrength:1.7}},wt=[{x:0,w:74,h:46,band:0},{x:-36,w:54,h:40,band:1},{x:36,w:54,h:40,band:1},{x:-72,w:48,h:32,band:2},{x:72,w:48,h:32,band:2},{x:-108,w:42,h:26,band:1},{x:108,w:42,h:26,band:1}],Tt=36*wt.length,Et={colorful:{dark:[`rgb(255, 70, 120)`,`rgb(60, 190, 255)`,`rgb(175, 70, 255)`,`rgb(60, 220, 130)`,`rgb(255, 150, 40)`,`rgb(90, 100, 255)`,`rgb(40, 200, 190)`],light:[`rgb(255, 201, 21)`,`rgb(126, 196, 255)`,`rgb(180, 40, 230)`,`rgb(235, 100, 160)`,`rgb(255, 176, 122)`,`rgb(154, 160, 255)`,`rgb(127, 217, 238)`]},mono:{dark:[`rgb(215, 215, 215)`,`rgb(180, 180, 180)`,`rgb(190, 190, 190)`,`rgb(160, 160, 160)`,`rgb(170, 170, 170)`,`rgb(150, 150, 150)`,`rgb(155, 155, 155)`],light:[`rgb(60, 60, 60)`,`rgb(90, 90, 90)`,`rgb(85, 85, 85)`,`rgb(110, 110, 110)`,`rgb(105, 105, 105)`,`rgb(125, 125, 125)`,`rgb(120, 120, 120)`]},ocean:{dark:[`rgb(80, 140, 255)`,`rgb(40, 200, 230)`,`rgb(120, 90, 255)`,`rgb(30, 170, 210)`,`rgb(160, 80, 240)`,`rgb(60, 110, 255)`,`rgb(40, 190, 180)`],light:[`rgb(40, 100, 240)`,`rgb(20, 160, 200)`,`rgb(90, 60, 230)`,`rgb(20, 130, 180)`,`rgb(130, 50, 220)`,`rgb(40, 80, 230)`,`rgb(20, 150, 150)`]},sunset:{dark:[`rgb(255, 110, 60)`,`rgb(255, 180, 40)`,`rgb(255, 60, 90)`,`rgb(255, 210, 80)`,`rgb(240, 70, 140)`,`rgb(255, 140, 50)`,`rgb(230, 50, 110)`],light:[`rgb(235, 80, 30)`,`rgb(230, 150, 10)`,`rgb(230, 30, 70)`,`rgb(225, 175, 30)`,`rgb(215, 40, 110)`,`rgb(235, 110, 20)`,`rgb(205, 30, 90)`]},forest:{dark:[`rgb(70, 220, 120)`,`rgb(40, 200, 180)`,`rgb(140, 230, 80)`,`rgb(30, 170, 140)`,`rgb(190, 235, 70)`,`rgb(50, 190, 110)`,`rgb(30, 150, 120)`],light:[`rgb(30, 170, 80)`,`rgb(20, 150, 130)`,`rgb(90, 180, 30)`,`rgb(20, 130, 100)`,`rgb(130, 180, 20)`,`rgb(30, 150, 80)`,`rgb(20, 120, 90)`]},candy:{dark:[`rgb(255, 90, 170)`,`rgb(255, 120, 220)`,`rgb(210, 80, 255)`,`rgb(255, 150, 190)`,`rgb(180, 110, 255)`,`rgb(255, 70, 140)`,`rgb(230, 100, 240)`],light:[`rgb(235, 40, 140)`,`rgb(230, 70, 190)`,`rgb(180, 40, 230)`,`rgb(235, 100, 160)`,`rgb(150, 70, 230)`,`rgb(230, 30, 110)`,`rgb(200, 60, 210)`]},ice:{dark:[`rgb(150, 230, 255)`,`rgb(90, 200, 255)`,`rgb(190, 240, 255)`,`rgb(120, 190, 255)`,`rgb(160, 220, 250)`,`rgb(80, 170, 255)`,`rgb(200, 235, 255)`],light:[`rgb(30, 160, 220)`,`rgb(20, 130, 210)`,`rgb(60, 180, 230)`,`rgb(40, 120, 220)`,`rgb(50, 160, 220)`,`rgb(20, 110, 220)`,`rgb(70, 170, 230)`]},gold:{dark:[`rgb(255, 200, 70)`,`rgb(255, 170, 40)`,`rgb(255, 220, 110)`,`rgb(240, 150, 30)`,`rgb(255, 235, 140)`,`rgb(230, 160, 40)`,`rgb(250, 210, 90)`],light:[`rgb(200, 140, 10)`,`rgb(190, 120, 0)`,`rgb(210, 160, 30)`,`rgb(180, 110, 0)`,`rgb(205, 170, 40)`,`rgb(175, 115, 5)`,`rgb(195, 150, 20)`]}};function Dt(e,t){let n=e.match(/^rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);return n?`rgba(${n[1]}, ${n[2]}, ${n[3]}, ${t.toFixed(2)})`:e}function Ot(e,t=1){return Math.max(.5,Math.round(e*t*100)/100)}function kt(e,t){return`calc(50% + (var(--vb-cx-${t}) + var(--vb-x${e}-${t})) * var(--vb-w-${t}) * var(--vb-z-${t}, 1))`}function At({id:e,colors:t,alpha:n,sw:r,sh:i,y:a,fade:o,count:s}){return(s?wt.slice(0,s):wt).map((s,c)=>{let l=n>=1?t[c%t.length]:Dt(t[c%t.length],n),u=`calc(${Math.round(s.w*r)}px * var(--vb-w-${e}) * var(--vb-z-${e}, 1))`,d=`calc(${Math.round(s.h*i)}px * var(--vb-h-${e}) * var(--vb-l${c}-${e}) * var(--vb-z-${e}, 1))`,f=`calc(100% + (${a}px + var(--vb-y${c}-${e})) * var(--vb-z-${e}, 1))`;return`radial-gradient(ellipse ${u} ${d} at ${kt(c,e)} ${f}, ${l} 0%, transparent ${o}%)`}).join(`,
2
+ `)}function jt(e){let{id:t,borderRadius:n,borderWidth:r,strokeOpacity:i,innerOpacity:a,bloomOpacity:o,innerShadow:s,colorVariant:c,colors:l,brightness:u,saturation:d,theme:f,hueBase:p=0,glowSize:m=1,glowWidth:h=1,glowHeight:g=1,strokeScale:_=1,innerScale:v=1,innerHeight:y=1,bloomScale:b=1,bloomHeight:x=1,coreSize:S=1,coreLight:C=0,coreLightWidth:w=1,coreLightHeight:T=1,rangeWidth:E=1,rangeHeight:D=1,softness:ee=1,distortion:O=!1,scale:k=1}=e,A=Math.round(28*k*10)/10,te=Math.round(9*k*10)/10,j=Math.max(0,n-r),M=Math.round(Math.max(40,Math.min(95,70*ee))),ne=e=>h*e,N=e=>g*e,P=e=>Math.round(e*10)/10,F=`var(--vb-z-${t}, 1)`,I=e=>`calc(${P(e)}px * ${F})`,L=f===`dark`,re=Et[c][L?`dark`:`light`].map((e,t)=>{let n=l?.[t];return n&&xt(n)||e}),R=c===`mono`?.6:1,z=(i*R).toFixed(2),B=(a*R).toFixed(2),V=(o*R).toFixed(2),H=u.toFixed(2),ie=d.toFixed(2),ae=`hue-rotate(calc(var(--voice-hue-base, ${p}deg) + var(--vb-hue-${t})))`,oe=O?` url(#vb-distort-${t})`:``,se=`filter: ${ae} brightness(${H}) saturate(${ie});`,ce=`filter: ${ae} brightness(${H}) saturate(${ie})${oe};`,le=`filter: blur(${I(Ot(10,m))}) ${ae} brightness(${H}) saturate(${ie});`,ue=`filter: blur(${I(Ot(10,m))}) ${ae} brightness(${H}) saturate(${ie})${oe};`,de=`calc(50% + var(--vb-cx-${t}) * var(--vb-w-${t}) * ${F})`,fe=`calc(100% + (2px + var(--vb-cy-${t})) * ${F})`,pe=L?`radial-gradient(ellipse calc(${P(30*S)}px * var(--vb-w-${t}) * ${F}) calc(${P(30*S)}px * var(--vb-h-${t}) * ${F}) at ${de} ${fe}, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.14) 30%, transparent 65%)`:`radial-gradient(ellipse calc(${P(40*S)}px * var(--vb-w-${t}) * ${F}) calc(${P(30*S)}px * var(--vb-h-${t}) * ${F}) at ${de} ${fe}, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.22) 35%, transparent 70%)`,me=At({id:t,colors:re,alpha:1,sw:ne(_),sh:N(_),y:2,fade:M}),he=At({id:t,colors:re,alpha:.46,sw:ne(.9*v),sh:N(.9*v*y),y:0,fade:M}),ge=At({id:t,colors:re,alpha:L?.9:.7,sw:ne(1.15*b),sh:N(1.5*b*x),y:0,fade:Math.min(95,M+2)}),_e=(e,n,r,i=0)=>`radial-gradient(ellipse calc(${P(e*E)}px * var(--vb-w-${t}) * var(--vb-mw-${t}) * ${F}) calc((${P(n*D)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${F}) at ${de} calc(100% + var(--vb-cy-${t}) * ${F}), white 0%, rgba(255, 255, 255, 0.5) ${r}%${i>0?`, rgba(255, 255, 255, ${i}) 85%`:``}, transparent 100%)`,ve=(e,n)=>`opacity: calc(var(--vb-opacity-${t}, 1) * var(--vb-glow-${t}) * ${n} * var(--voice-${e}-opacity, 1) * var(--voice-strength, 1));`,ye=(e,t,r,i)=>`${e} {
3
3
  ${t}
4
4
  position: absolute;
5
5
  inset: 0;
6
- border-radius: ${L(n)};
6
+ border-radius: ${I(n)};
7
7
  background: ${he};
8
- box-shadow: inset 0 0 ${L(te)} 1px ${s};
8
+ box-shadow: inset 0 0 ${I(te)} 1px ${s};
9
9
  -webkit-mask-image:
10
10
  ${_e(170,64,45,.3)},
11
- linear-gradient(white, transparent ${L(A)}, transparent calc(100% - ${A}px * ${I}), white),
12
- linear-gradient(to right, white, transparent ${L(A)}, transparent calc(100% - ${A}px * ${I}), white);
11
+ linear-gradient(white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white),
12
+ linear-gradient(to right, white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white);
13
13
  -webkit-mask-composite: source-in, source-over;
14
14
  mask-image:
15
15
  ${_e(170,64,45,.3)},
16
- linear-gradient(white, transparent ${L(A)}, transparent calc(100% - ${A}px * ${I}), white),
17
- linear-gradient(to right, white, transparent ${L(A)}, transparent calc(100% - ${A}px * ${I}), white);
16
+ linear-gradient(white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white),
17
+ linear-gradient(to right, white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white);
18
18
  mask-composite: intersect, add;
19
19
  pointer-events: none;
20
20
  /* Its own compositing layer: WebKit otherwise re-rasterizes the
@@ -23,7 +23,7 @@ import{S as e,h as t,n,o as r,r as i,s as a,u as o,v as s,w as c}from"./chunks/m
23
23
  will-change: transform;
24
24
  z-index: 1;
25
25
  ${r}
26
- ${ve(`inner`,V)}
26
+ ${ve(`inner`,B)}
27
27
  ${i}
28
28
  }`;return`
29
29
  @property --vb-opacity-${t} {
@@ -38,7 +38,7 @@ import{S as e,h as t,n,o as r,r as i,s as a,u as o,v as s,w as c}from"./chunks/m
38
38
  overflow: hidden;
39
39
  --vb-h-${t}: 0.8;
40
40
  --vb-w-${t}: 1;
41
- ${Ct.map((e,n)=>` --vb-x${n}-${t}: ${e.x}px;
41
+ ${wt.map((e,n)=>` --vb-x${n}-${t}: ${e.x}px;
42
42
  --vb-l${n}-${t}: 1;
43
43
  --vb-y${n}-${t}: 0px;`).join(`
44
44
  `)}
@@ -67,9 +67,9 @@ ${Ct.map((e,n)=>` --vb-x${n}-${t}: ${e.x}px;
67
67
  content: "";
68
68
  position: absolute;
69
69
  inset: 0;
70
- border-radius: ${L(j)};
71
- padding: ${L(r)};
72
- clip-path: inset(0 round ${L(n)});
70
+ border-radius: ${I(j)};
71
+ padding: ${I(r)};
72
+ clip-path: inset(0 round ${I(n)});
73
73
  background:
74
74
  ${pe},
75
75
  ${me};
@@ -89,7 +89,7 @@ ${Ct.map((e,n)=>` --vb-x${n}-${t}: ${e.x}px;
89
89
  host runs at a sixth of the frame rate without this). */
90
90
  will-change: transform;
91
91
  z-index: 2;
92
- ${ve(`stroke`,B)}
92
+ ${ve(`stroke`,z)}
93
93
  ${se}
94
94
  }
95
95
 
@@ -108,7 +108,7 @@ ${O?ye(`[data-voice-beam="${t}"][data-active] [data-voice-beam-warp="inner"],
108
108
  display: none;
109
109
  position: absolute;
110
110
  inset: 0;
111
- border-radius: ${L(j)};
111
+ border-radius: ${I(j)};
112
112
  pointer-events: none;
113
113
  /* Its own compositing layer: WebKit otherwise re-rasterizes the
114
114
  filtered layer into the parent every frame on the CPU (a phone-sized
@@ -129,7 +129,7 @@ ${O?ye(`[data-voice-beam="${t}"][data-active] [data-voice-beam-warp="inner"],
129
129
  [data-voice-beam="${t}"][data-fading] [data-voice-beam-bloom] {
130
130
  display: block;
131
131
  clip-path: ${O?`var(--vb-clip-above-${t}, inset(0 round ${n}px))`:`inset(0 round ${n}px)`};
132
- ${ve(`bloom`,H)}
132
+ ${ve(`bloom`,V)}
133
133
  ${le}
134
134
  }
135
135
  ${O?`
@@ -137,7 +137,7 @@ ${O?`
137
137
  [data-voice-beam="${t}"][data-fading] [data-voice-beam-warp="bloom"] {
138
138
  display: block;
139
139
  clip-path: var(--vb-clip-below-${t}, inset(0 round ${n}px));
140
- ${ve(`bloom`,H)}
140
+ ${ve(`bloom`,V)}
141
141
  ${ue}
142
142
  }
143
143
 
@@ -161,11 +161,11 @@ ${O?`
161
161
  Up to 1 it is the wash's opacity; past 1 the solid white core widens
162
162
  too, for a centre that stays lighter than a strong band. It follows the
163
163
  glow's presence but not \`strength\`, which would only dim it. */
164
- ${C>0?(()=>{let e=Math.max(0,Math.min(2,C-1)),n=Math.min(1,e),r=Math.max(0,e-1),i=1+.3*e,a=F(45*n+27*r),o=F(40+25*n+15*r),s=Math.min(1,.55+.35*n+.1*r).toFixed(2),c=F(72+14*n+8*r);return`[data-voice-beam="${t}"] [data-voice-beam-core] {
164
+ ${C>0?(()=>{let e=Math.max(0,Math.min(2,C-1)),n=Math.min(1,e),r=Math.max(0,e-1),i=1+.3*e,a=P(45*n+27*r),o=P(40+25*n+15*r),s=Math.min(1,.55+.35*n+.1*r).toFixed(2),c=P(72+14*n+8*r);return`[data-voice-beam="${t}"] [data-voice-beam-core] {
165
165
  display: none;
166
166
  position: absolute;
167
167
  inset: 0;
168
- border-radius: ${L(j)};
168
+ border-radius: ${I(j)};
169
169
  overflow: hidden;
170
170
  pointer-events: none;
171
171
  /* Its own compositing layer: WebKit otherwise re-rasterizes the
@@ -174,14 +174,14 @@ ${C>0?(()=>{let e=Math.max(0,Math.min(2,C-1)),n=Math.min(1,e),r=Math.max(0,e-1),
174
174
  will-change: transform;
175
175
  /* The blur sits on this wrapper and the band-line clip on the child,
176
176
  so the cut edge is blurred too rather than left hard. */
177
- filter: blur(${L(Dt(8,m))});
177
+ filter: blur(${I(Ot(8,m))});
178
178
  z-index: 4;
179
179
  }
180
180
 
181
181
  [data-voice-beam="${t}"] [data-voice-beam-core] > div {
182
182
  position: absolute;
183
183
  inset: 0;
184
- background: radial-gradient(ellipse calc(${F(120*w*i*k)}px * var(--vb-w-${t}) * ${I}) calc((${F(70*T*i*k)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${I}) at ${de} calc(100% + var(--vb-cy-${t}) * ${I}), white 0%, white ${a}%, rgba(255, 255, 255, ${s}) ${o}%, transparent ${c}%);
184
+ background: radial-gradient(ellipse calc(${P(120*w*i*k)}px * var(--vb-w-${t}) * ${F}) calc((${P(70*T*i*k)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${F}) at ${de} calc(100% + var(--vb-cy-${t}) * ${F}), white 0%, white ${a}%, rgba(255, 255, 255, ${s}) ${o}%, transparent ${c}%);
185
185
  clip-path: var(--vb-clip-below-${t}, none);
186
186
  }
187
187
 
@@ -219,12 +219,12 @@ ${C>0?(()=>{let e=Math.max(0,Math.min(2,C-1)),n=Math.min(1,e),r=Math.max(0,e-1),
219
219
  2D context has no filter (WebKit) the driver sets them and the layers
220
220
  are blurred here instead — the ridge on the band canvas, its wider
221
221
  halo on the canvas beneath. */
222
- filter: blur(var(--vb-band-blur-${t}, 0px)) ${ae} brightness(${re}) saturate(${ie});
222
+ filter: blur(var(--vb-band-blur-${t}, 0px)) ${ae} brightness(${H}) saturate(${ie});
223
223
  }
224
224
 
225
225
  [data-voice-beam="${t}"][data-active] [data-voice-beam-band-halo],
226
226
  [data-voice-beam="${t}"][data-fading] [data-voice-beam-band-halo] {
227
- filter: blur(var(--vb-band-halo-blur-${t}, 0px)) ${ae} brightness(${re}) saturate(${ie});
227
+ filter: blur(var(--vb-band-halo-blur-${t}, 0px)) ${ae} brightness(${H}) saturate(${ie});
228
228
  }
229
229
 
230
230
  /* Resolution. The soft layers — inner light and its warp mirror, bloom and
@@ -256,22 +256,22 @@ ${O?`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
256
256
  [data-voice-beam="${t}"][data-voice-halfres][data-fading]::before,
257
257
  [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-bloom],
258
258
  [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-bloom] {
259
- clip-path: var(--vb-clip-above-z-${t}, inset(0 round ${L(n)}));
259
+ clip-path: var(--vb-clip-above-z-${t}, inset(0 round ${I(n)}));
260
260
  }
261
261
  [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-warp],
262
262
  [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-warp] {
263
- clip-path: var(--vb-clip-below-z-${t}, inset(0 round ${L(n)}));
263
+ clip-path: var(--vb-clip-below-z-${t}, inset(0 round ${I(n)}));
264
264
  }
265
265
  /* Processing (warp off): the mirrors are gone, so the base layers paint
266
266
  the whole box again — this must outweigh the split above. */
267
267
  [data-voice-beam="${t}"][data-voice-halfres][data-voice-warp="off"]::before,
268
268
  [data-voice-beam="${t}"][data-voice-halfres][data-voice-warp="off"] [data-voice-beam-bloom] {
269
- clip-path: inset(0 round ${L(n)});
269
+ clip-path: inset(0 round ${I(n)});
270
270
  }`:`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
271
271
  [data-voice-beam="${t}"][data-voice-halfres][data-fading]::before,
272
272
  [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-bloom],
273
273
  [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-bloom] {
274
- clip-path: inset(0 round ${L(n)});
274
+ clip-path: inset(0 round ${I(n)});
275
275
  }`}
276
276
  [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-core] > div {
277
277
  clip-path: var(--vb-clip-below-z-${t}, none);
@@ -291,8 +291,8 @@ ${O?`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
291
291
  [data-voice-beam="${t}"][data-paused] [data-voice-beam-bloom] {
292
292
  animation-play-state: paused !important;
293
293
  }
294
- `}let jt=null;function Mt(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function Nt(){let e=Mt();return e?(jt||=new e,jt.state===`suspended`&&jt.resume().catch(()=>{}),jt):null}const Pt=new WeakMap;function Ft(e){let t=Nt();if(!t||e.getAudioTracks().length===0)return null;let n=Pt.get(e);n||(n={node:t.createMediaStreamSource(e),refs:0},Pt.set(e,n)),n.refs+=1;let r=t.createAnalyser();r.fftSize=1024,r.smoothingTimeConstant=.5,n.node.connect(r);let i=!1;return{analyser:r,release:()=>{if(!i){i=!0;try{n.node.disconnect(r)}catch{}if(--n.refs,n.refs<=0){try{n.node.disconnect()}catch{}Pt.delete(e)}}}}}const It=new WeakMap;function Lt(e){let t=It.get(e);return t||(t={level:0,bands:[0,0,0],phase:0,scanA:0,scanT:0,t:0,lastTs:0,warp:1},It.set(e,t)),t}const Rt=new Set;let Y=null,zt=0,Bt=0,Vt=!1,Ht=!1,Ut=0,Wt=0;const Gt=Math.PI*2,Kt=[[80,300],[300,2e3],[2e3,6e3]];function qt(e){return e<0?0:e>1?1:e}function X(e,t){let n=t/2;return((e+n)%t+t)%t-n}function Jt(e,t){let n=e/(t/2+4);return Math.max(0,1-n*n)}function Yt(e,t){if(e<=t)return 0;let n=(e-t)/Math.max(.001,1-t);return qt((1-Math.exp(-3*n))/(1-Math.exp(-3)))}function Xt(e,t,n,r,i){let a=t>e?r:i,o=1-Math.exp(-n/Math.max(.001,a));return e+(t-e)*o}const Zt=!(typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent)),Qt=.05,$t=.1;function en(e,t,n,r){let i=e<0?1-r:1+r,a=Math.max(.05,n*i),o=Math.exp(-((Math.abs(e)/a)**+t)),s=Math.exp(-((1/a)**t));return Math.max(0,(o-s)/(1-s))}function tn(e,t,n,r,i){if(n<=0||t<=0)return 0;let a=t*Math.max(0,Math.min(.98,r));return e<=a?0:n*Math.min(1,(e-a)/Math.max(1,t-a))**+Math.max(.5,i)}function nn(e,t,n){return Math.max(0,Math.min(e,t/2,n/2))}function rn(e,t,n,r=0){if(n<=0)return 0;let i=Math.min(e,t-e)-r;if(i>=n)return 0;if(i<=0)return n;let a=n-i;return n-Math.sqrt(Math.max(0,n*n-a*a))}function an(e,t,n,r){let i=n/2+t.cx*t.w,a=170*e.rangeWidth*t.w*t.mw,o=r*.82*Math.min(1,e.scale),s=Math.min(o,(64*e.rangeHeight*t.h+t.lift)*e.bandPosition),c=r-e.bandOffset,l=Math.min(1,t.corner*4),u=e.bandTail*(1-l*l*(3-2*l)),d=u>.001,f=d?e.bandTailOverflow:0,p=d?-f:i-a,m=d?n+f:i+a,h=[];for(let o=0;o<=56;o++){let l=p+(m-p)*o/56,d=Math.max(-1,Math.min(1,(l-i)/Math.max(1,a))),g=(l<i?i:n-i)+f,_=en(d,e.bandCurve,e.bandSpread,e.bandSkew)+tn(Math.abs(l-i),g,u,e.bandTailPosition,e.bandTailCurve),v=t.corner>0?rn(l,n,nn(e.radius,n,r))*t.corner:0;h.push([l,c-s*_-v])}return h}function on(e,t,n,r,i){for(let[a,o]of[[``,1],[`-z`,.5]]){let s=e=>(e*o).toFixed(1)+`px`,c=n.map(([e,t])=>`${s(e)} ${s(t)}`),l=`polygon(0 ${s(i)}, ${c.join(`, `)}, ${s(r)} ${s(i)})`,u=`polygon(0 0, ${s(r)} 0, ${s(r)} ${s(i)}, ${c.slice().reverse().join(`, `)}, 0 ${s(i)})`;e.style.setProperty(`--vb-clip-below${a}-${t}`,l),e.style.setProperty(`--vb-clip-above${a}-${t}`,u)}}function sn(e,t,n){let r=n;for(let e=0;e<t.length;e++)t[e][1]<r&&(r=t[e][1]);let i=Math.max(0,Math.min(.9,Math.floor((r-6)/n/Qt)*Qt));if(i===e.filterTop)return;e.filterTop=i;let a=1+Math.max(.1,12/n),o=e.filter;o.setAttribute(`x`,`${-$t*100}%`),o.setAttribute(`width`,`${(1+2*$t)*100}%`),o.setAttribute(`y`,`${(i*100).toFixed(0)}%`),o.setAttribute(`height`,`${((a-i)*100).toFixed(1)}%`)}function cn(e,t,n){let{canvas:r,ctx:i,el:a,config:o}=e;if(!r||!i)return;let s=a.clientWidth,c=a.clientHeight;if(!s||!c)return;let l=Math.min(2,typeof window<`u`&&window.devicePixelRatio||1),u=Math.round(s*l),d=Math.round(c*l);(r.width!==u||r.height!==d)&&(r.width=u,r.height=d),i.setTransform(l,0,0,l,0,0),i.clearRect(0,0,s,c);let f=e.haloCanvas,p=e.haloCtx;f&&p&&((f.width!==u||f.height!==d)&&(f.width=u,f.height=d),p.setTransform(l,0,0,l,0,0),p.clearRect(0,0,s,c));let m=Math.min(1,.6*o.bandStrength*t.strength);if(m<.005||o.bandWidth<=0)return;let h=o.theme===`dark`,g=o.bandWidth*(1+.35*t.level),_=o.bandAberration*(.35+.65*t.level),v=(4+12*_)*o.scale,y=4*_*o.scale,b=(e,t)=>{i.beginPath(),i.moveTo(n[0][0]+e,n[0][1]+t);for(let r=1;r<n.length;r++)i.lineTo(n[r][0]+e,n[r][1]+t)},x={r:o.bandColors.above,g:o.bandColors.mid,c:o.bandColors.core,b:o.bandColors.below},S=(h?.42:.4)*m,C=14*g,w=3.5*o.bandWidth/2,T=w*l,E=typeof i.filter==`string`,D=E?`0px`:`${w.toFixed(2)}px`;e.cssBlur!==D&&(a.style.setProperty(`--vb-band-blur-${o.id}`,D),a.style.setProperty(`--vb-band-halo-blur-${o.id}`,E?`0px`:`${(w*3).toFixed(2)}px`),e.cssBlur=D);let ee=[[1,.16],[.72,.2],[.46,.26],[.22,.34]],O=[{rgb:x.r,a:1,ox:y,oy:-v},{rgb:x.g,a:.55,ox:y*.35,oy:-v*.35},{rgb:x.b,a:1,ox:-y,oy:v},{rgb:x.c,a:.9,ox:0,oy:0}];i.lineCap=`round`,i.lineJoin=`round`,i.globalCompositeOperation=`source-over`;let k=n[0][0],A=n[n.length-1][0],te=(e,t)=>{let n=i.createLinearGradient(k,0,A,0),r=o.bandTail>0?.015:.18;return n.addColorStop(0,`rgba(${e}, 0)`),n.addColorStop(r,`rgba(${e}, ${t.toFixed(3)})`),n.addColorStop(1-r,`rgba(${e}, ${t.toFixed(3)})`),n.addColorStop(1,`rgba(${e}, 0)`),n},j=!E&&p?p:i;E&&(i.filter=`blur(${(T*3).toFixed(1)}px)`),j.lineCap=`round`,j.lineJoin=`round`,j.strokeStyle=te(x.c,S*.3),j.lineWidth=C*2.2,j.beginPath(),j.moveTo(n[0][0],n[0][1]);for(let e=1;e<n.length;e++)j.lineTo(n[e][0],n[e][1]);j.stroke(),E&&(i.filter=`blur(${T.toFixed(1)}px)`);for(let e of O)for(let[t,n]of ee)i.strokeStyle=te(e.rgb,S*e.a*n),i.lineWidth=Math.max(.6,C*t),b(e.ox,e.oy),i.stroke();E&&(i.filter=`none`),i.globalCompositeOperation=`source-over`}function ln(e){return(1-Math.cos(Gt*e))/2}function un(e,t){let n=e.analyser,r=e.time,i=e.freq;n.getFloatTimeDomainData(r);let a=0;for(let e=0;e<r.length;e++)a+=r[e]*r[e];t.level=Math.sqrt(a/r.length)*5*e.config.sensitivity,n.getByteFrequencyData(i);let o=n.context.sampleRate/n.fftSize;for(let n=0;n<3;n++){let[r,a]=Kt[n],s=Math.max(0,Math.floor(r/o)),c=Math.min(i.length-1,Math.ceil(a/o)),l=0;for(let e=s;e<=c;e++)l+=i[e];let u=c>=s?l/(c-s+1)/255:0;t.bands[n]=u*1.7*e.config.sensitivity}}const dn={level:0,bands:[0,0,0]};function fn(e){Y=requestAnimationFrame(fn);let t=Bt?e-Bt:0;if(Bt=e,Vt){if(Ht=!Ht,Ht)return;e>=Wt&&(Vt=!1,Ut=0)}else t>22?Ut?e-Ut>500&&(Vt=!0,Ht=!1,Wt=e+4e3):Ut=e:Ut=0;e-zt<14.666666666666668||(zt=e,Rt.forEach(t=>{var n;let{el:r,config:i,source:a,s:o}=t,s=i.paused;if(s&&t.paintedConfig===i)return;let c=s?0:o.lastTs?Math.min(.05,(e-o.lastTs)/1e3):1/60;o.lastTs=e,o.t+=c;let l=o.t;if(!s)if(t.analyser)un(t,dn);else{let e=a.getLevel?qt(a.getLevel()):0;dn.level=e,dn.bands[0]=e,dn.bands[1]=e*(.72+.28*Math.sin(l*9.1)),dn.bands[2]=e*(.6+.4*Math.sin(l*13.7+2))}let u=Yt(dn.level,i.threshold);o.level=Xt(o.level,u,c,i.attack,i.release);for(let e=0;e<3;e++){let t=Yt(dn.bands[e],i.threshold*.6);o.bands[e]=Xt(o.bands[e],t,c,i.attack,i.release*1.15)}let d=wt*i.lobeSpacing;i.processing&&o.scanA<.001&&o.scanT===0&&(o.scanT=Math.max(.05,i.processingDuration)/2);let f=Math.max(.05,i.processingEase);o.scanA=Xt(o.scanA,i.processing?1:0,c,f*.9,f*.8),i.processing?o.scanT+=c:o.scanA<.001&&(o.scanT=0);let p=o.scanA*o.scanA*(3-2*o.scanA),m=r.clientWidth,h=r.clientHeight,g=d/2*i.processingTravel,_=o.scanT/Math.max(.05,i.processingDuration),v=Math.floor(_),y=_-v,b=Math.max(1,i.processingCurve),x=y<.5?.5*(2*y)**b:1-.5*(2-2*y)**b,S=i.reducedMotion?0:v%2==0?2*x-1:1-2*x,C=p*g*S,w=1-p*.6,T=1-p*.45,E=1+p*.3*(1-S*S),D=i.reducedMotion?.5:.5+.5*Math.sin(Gt*l/i.breatheDuration),ee=o.level+(1-o.level)*i.idle*D,O=Math.max(0,Math.min(1,(p-.25)/.75)),k=O*O*(3-2*O),A=Math.max(ee,i.processingLevel*k),te=.15+.85*A,j=.5+i.reach*A,M=(.85+i.spread*A)*E;i.flow!==0&&!i.reducedMotion&&(o.phase=((o.phase+i.flow*A*c)%d+d)%d),r.style.setProperty(`--vb-level-${i.id}`,o.level.toFixed(3)),r.style.setProperty(`--vb-cx-${i.id}`,`${C.toFixed(1)}px`),r.style.setProperty(`--vb-mw-${i.id}`,T.toFixed(3));let N=i.bend*A;r.style.setProperty(`--vb-bh-${i.id}`,`${Math.max(0,N).toFixed(1)}px`);let P=i.bend>0?Math.min(1,N/i.bend):0;r.style.setProperty(`--vb-bendA-${i.id}`,P.toFixed(3));let F={cx:C,w:M,h:j,mw:T,lift:N,strength:P,level:o.level,corner:p},I=m/2+C*M,L=30*i.scale*M,ne=nn(i.radius,m,h),R=p*i.cornerFollow;r.style.setProperty(`--vb-cy-${i.id}`,`${(-rn(I,m,ne,L*1.4)*R).toFixed(1)}px`),o.warp=Xt(o.warp,i.processing?0:1,c,.35,.06);let z=o.warp,B=t.displace!=null&&z<.03;if(B!==t.warpOff&&(t.warpOff=B,B?r.setAttribute(`data-voice-warp`,`off`):r.removeAttribute(`data-voice-warp`)),m&&h&&(t.ctx||t.displace)){let e=an(i,F,m,h);(t.displace&&!B||i.coreLight>0)&&on(r,i.id,e,m,h),t.filter&&!B&&Zt&&sn(t,e,h),t.ctx&&cn(t,F,e)}if(t.displace&&!B){let e=i.reducedMotion?0:i.distortion*120*i.scale*(.15+.85*A)*z;t.displace.scale.baseVal=e,t.noiseShift&&(t.noiseShift.dx.baseVal=8*i.scale*Math.sin(l*.9),t.noiseShift.dy.baseVal=4*i.scale*Math.sin(l*.6+1.3))}r.style.setProperty(`--vb-glow-${i.id}`,te.toFixed(3)),r.style.setProperty(`--vb-h-${i.id}`,j.toFixed(3)),r.style.setProperty(`--vb-w-${i.id}`,M.toFixed(3));for(let e=0;e<Ct.length;e++){let t=Ct[e],n=X(t.x*i.lobeSpacing+o.phase,d),a=i.bands?.6+.7*o.bands[t.band]:1;r.style.setProperty(`--vb-x${e}-${i.id}`,`${(n*w).toFixed(1)}px`),r.style.setProperty(`--vb-l${e}-${i.id}`,(a*Jt(n,d)).toFixed(3));let s=m/2+(C+n*w)*M;r.style.setProperty(`--vb-y${e}-${i.id}`,`${(-rn(s,m,ne,L)*R).toFixed(1)}px`)}let V=i.staticColors||i.reducedMotion||i.hueRange===0?0:-i.hueRange+2*i.hueRange*ln(l/i.hueDuration);r.style.setProperty(`--vb-hue-${i.id}`,`${V.toFixed(2)}deg`),(n=t.onLevel)==null||n.call(t,o.level),t.paintedConfig=i}))}function pn(){Y??=(zt=0,Bt=0,Ut=0,requestAnimationFrame(fn))}function mn(){Rt.size===0&&Y!=null&&(cancelAnimationFrame(Y),Y=null)}function hn(e,t,n,r){let i={el:e,config:t,source:n,onLevel:r,analyser:null,releaseAnalyser:null,time:null,freq:null,canvas:null,ctx:null,haloCanvas:null,haloCtx:null,displace:null,noiseShift:null,filter:null,filterTop:-1,s:Lt(e),paintedConfig:null,cssBlur:null,warpOff:e.hasAttribute(`data-voice-warp`)};t.distortion>0&&(i.displace=e.querySelector(`:scope > svg feDisplacementMap`),i.noiseShift=e.querySelector(`:scope > svg feOffset`),i.filter=e.querySelector(`:scope > svg filter`));let a=e.querySelector(`:scope > [data-voice-beam-band]`);if(a){i.canvas=a,i.ctx=a.getContext(`2d`);let t=e.querySelector(`:scope > [data-voice-beam-band-halo]`);t&&(i.haloCanvas=t,i.haloCtx=t.getContext(`2d`))}if(i.s.lastTs=0,n.stream){let e=Ft(n.stream);e&&(i.analyser=e.analyser,i.releaseAnalyser=e.release,i.time=new Float32Array(e.analyser.fftSize),i.freq=new Uint8Array(e.analyser.frequencyBinCount))}return Rt.add(i),pn(),()=>{var e;Rt.delete(i),(e=i.releaseAnalyser)==null||e.call(i),mn()}}const gn={scale:1,glowSize:1,processingDuration:1.1,processingLevel:.55,processingTravel:1.55,processingCurve:2.1,cornerFollow:.45,strokeOpacity:1,innerOpacity:1,bloomOpacity:1,idle:.18,reach:1.2,spread:1.05,flow:48,bend:60,bandStrength:1.55,bandWidth:2.15,bandPosition:.35,bandCurve:1.75,bandSpread:.87,bandSkew:.12,bandOffset:-27,bandTail:.59,bandTailPosition:.67,bandTailCurve:2.4,bandTailOverflow:15,bandAberration:.89,distortion:.62,distortionDetail:2.3,glowWidth:.65,glowHeight:1.25,lobeSpacing:.85,rangeWidth:.75,rangeHeight:1,softness:1.07,coreSize:1,coreLight:0,coreLightWidth:1,coreLightHeight:1,strokeScale:1,innerScale:1,innerHeight:1,bloomScale:1,bloomHeight:1},_n={default:{},pill:{scale:.45,glowSize:.95,strokeOpacity:1.2,innerOpacity:.85,reach:1.35,spread:1.1,flow:0,bend:23,bandStrength:1.55,bandWidth:1.85,bandCurve:1.95,bandSpread:.38,bandOffset:-16,bandTail:0,processingTravel:2,cornerFollow:0,distortion:.45,distortionDetail:3,glowWidth:.65,glowHeight:.95,lobeSpacing:.45,rangeWidth:.8,rangeHeight:.7,softness:.88,coreSize:.25,strokeScale:1.25,innerScale:.95,bloomScale:1.05,bloomHeight:2.25},mobile:{scale:1.25,spread:.45,reach:3,flow:60,bend:70,bandWidth:2.4,bandCurve:1.55,bandSpread:.9,bandOffset:-50,bandTail:.62,bandTailPosition:.42,bandTailCurve:2.7,bandTailOverflow:22,processingDuration:1.05,processingLevel:.35,processingTravel:1,cornerFollow:.4,bandStrength:1.8,distortionDetail:2,glowWidth:1.15,glowHeight:2.1,lobeSpacing:1.35,rangeWidth:1.25,rangeHeight:1.2,softness:1.1}},vn={default:{brightness:1.15},pill:{brightness:1.35,saturation:1.5},mobile:{strength:1,brightness:1.2,saturation:1.5}},yn={default:{},pill:{},mobile:{strength:1}};function bn(e=`default`,t=`dark`){return(t===`light`?yn[e]:void 0)??vn[e]}const xn={default:{bandStrength:1.7},pill:{bandStrength:2},mobile:{bandStrength:1.7}};function Sn(e=`default`,t=`dark`){let n=_n[e],r={};return t===`light`&&(n.reach===void 0&&(r.reach=1.8),n.spread===void 0&&(r.spread=.8),n.coreLight===void 0&&(r.coreLight=1.8)),{...gn,...r,...n,...t===`light`?xn[e]:void 0}}const Cn={dark:{core:`255, 255, 255`,above:`255, 70, 80`,mid:`90, 255, 150`,below:`80, 140, 255`},light:{core:`197, 139, 255`,above:`255, 122, 182`,mid:`126, 196, 255`,below:`45, 255, 171`}},wn=typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent),Tn=(()=>{if(typeof document>`u`)return!0;let e=document.createElement(`canvas`).getContext(`2d`);return!!e&&typeof e.filter==`string`})();function En(){let[e,t]=Fe(()=>typeof window>`u`||window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return Le(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),n=e=>t(e.matches?`dark`:`light`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Dn(){let[e,t]=Fe(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return Le(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function On(e,t){return e===`auto`?t:e}const kn=Qe(function({children:e,type:t=`default`,scale:n,stream:r=null,level:i=0,sensitivity:a=3.1,threshold:o=.015,attack:s=.325,release:c=.86,idle:l,breatheDuration:u=5.2,reach:d,spread:f,bands:p=!0,flow:m,processing:h=!1,processingDuration:g,processingLevel:_,processingTravel:v,processingCurve:y,cornerFollow:b,processingEase:x=.6,colorVariant:S=`colorful`,colors:C,bandColors:w,theme:T=`dark`,staticColors:E=!1,hueRange:D,hueDuration:ee,active:O=!0,paused:k=!1,borderRadius:A,brightness:te,saturation:j,glowSize:M,strokeOpacity:N,innerOpacity:P,bloomOpacity:F,bend:I,bandStrength:L,bandWidth:ne,bandPosition:R,bandCurve:z,bandSpread:V,bandSkew:H,bandOffset:re,bandTail:ie,bandTailPosition:ae,bandTailCurve:oe,bandTailOverflow:se,bandAberration:ce,distortion:le,distortionDetail:ue,glowWidth:de,glowHeight:fe,lobeSpacing:pe,rangeWidth:me,rangeHeight:he,softness:ge,coreSize:_e,coreLight:ve,coreLightWidth:ye,coreLightHeight:be,strokeScale:xe,innerScale:Se,innerHeight:Ce,bloomScale:we,bloomHeight:U,strength:Te,className:Ee,style:De,css:Oe,onLevel:W,onActivate:ke,onDeactivate:Ae,onAnimationEnd:je,...Me},Ne){let Pe=Ve().replace(/:/g,`-`),G=On(T,En()),Ie=C?C.join(`|`):``,He=w?[w.core,w.above,w.mid,w.below].join(`|`):``,K=Sn(t,G),q=Math.max(.05,n??K.scale),Ue=M??K.glowSize,We=N??K.strokeOpacity,Ge=P??K.innerOpacity,Ke=F??K.bloomOpacity,qe=g??K.processingDuration,Je=_??K.processingLevel,Ye=v??K.processingTravel,Xe=y??K.processingCurve,Ze=b??K.cornerFollow,Qe=l??K.idle,$e=d??K.reach,et=f??K.spread,tt=(m??K.flow)*q,nt=(I??K.bend)*q,rt=L??K.bandStrength,it=(ne??K.bandWidth)*q,at=R??K.bandPosition,ot=z??K.bandCurve,st=V??K.bandSpread,ct=H??K.bandSkew,lt=(re??K.bandOffset)*q,ut=ie??K.bandTail,dt=ae??K.bandTailPosition,ft=oe??K.bandTailCurve,pt=(se??K.bandTailOverflow)*q,mt=ce??K.bandAberration,ht=le??K.distortion,gt=(ue??K.distortionDetail)/q,_t=(de??K.glowWidth)*q,vt=(fe??K.glowHeight)*q,yt=(pe??K.lobeSpacing)*q,bt=(me??K.rangeWidth)*q,Ct=(he??K.rangeHeight)*q,wt=ge??K.softness,Tt=(_e??K.coreSize)*q,Et=Math.max(0,Math.min(3,ve??K.coreLight)),Dt=ye??K.coreLightWidth,Ot=be??K.coreLightHeight,kt=xe??K.strokeScale,jt=Se??K.innerScale,Mt=Ce??K.innerHeight,Nt=we??K.bloomScale,Pt=U??K.bloomHeight,Ft=Dn(),It=Re(null),[Lt,Rt]=Fe(O),[Y,zt]=Fe(!1),[Bt,Vt]=Fe(!0),[Ht,Ut]=Fe(null),[Wt,Gt]=Fe(0);Le(()=>{if(!wn)return;let e=It.current;if(!e)return;let t=()=>Gt(e.clientWidth*e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let Kt=wn&&Wt>6e4?0:ht;Le(()=>{if(A!=null)return;let e=It.current;if(!e)return;let t=()=>{let t=e.firstElementChild;if(!t)return;let n=getComputedStyle(t),r=parseFloat(n.borderTopLeftRadius);!isNaN(r)&&r>0&&Ut(r)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!1}),()=>n.disconnect()},[A,e]),Le(()=>{O&&!Lt&&!Y?Rt(!0):!O&&Lt&&!Y&&zt(!0)},[O,Lt,Y]),Le(()=>{let e=It.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{for(let t of e)Vt(t.isIntersecting)},{rootMargin:`256px`});return t.observe(e),()=>t.disconnect()},[]);let qt=Be(e=>{let t=e.animationName;t.includes(`fade-out`)?(Rt(!1),zt(!1),Ae?.()):t.includes(`fade-in`)&&ke?.(),je?.(e)},[ke,Ae,je]),X=St[G],Jt=A??Ht??16,Yt=bn(t,G),Xt=Te??Yt.strength??X.strength??1,Zt=D??X.hueRange??24,Qt=ee??X.hueDuration??12,$t=te??Yt.brightness??X.brightness,en=j??Yt.saturation??X.saturation,tn=ze(()=>At({id:Pe,borderRadius:Jt,borderWidth:1,strokeOpacity:X.strokeOpacity*We,innerOpacity:X.innerOpacity*Ge,bloomOpacity:X.bloomOpacity*Ke,innerShadow:X.innerShadow,colorVariant:S,colors:C,brightness:$t,saturation:en,theme:G,hueBase:X.hueBase??0,glowSize:Ue*q,glowWidth:_t,glowHeight:vt,strokeScale:kt,innerScale:jt,innerHeight:Mt,bloomScale:Nt,bloomHeight:Pt,coreSize:Tt,coreLight:Et,coreLightWidth:Dt,coreLightHeight:Ot,rangeWidth:bt,rangeHeight:Ct,softness:wt,distortion:Kt>0,scale:q}),[Pe,Jt,X,S,Ie,$t,en,G,K,Ue,We,Ge,Ke,q,_t,vt,kt,jt,Mt,Nt,Pt,Tt,Et,Dt,Ot,bt,Ct,wt,Kt>0]),nn=ze(()=>({id:Pe,sensitivity:Math.max(0,a),threshold:Math.max(0,Math.min(.95,o)),attack:Math.max(0,s),release:Math.max(0,c),idle:Math.max(0,Math.min(1,Qe)),breatheDuration:Math.max(.2,u),reach:Math.max(0,$e),spread:Math.max(0,et),bands:p,flow:tt,lobeSpacing:Math.max(.1,yt),bend:Math.max(0,nt),bandStrength:Math.max(0,rt),bandWidth:Math.max(0,it),bandPosition:Math.max(0,at),bandCurve:Math.max(.3,ot),bandSpread:Math.max(.05,st),bandSkew:Math.max(-.9,Math.min(.9,ct)),bandOffset:lt,bandTail:Math.max(0,Math.min(1.5,ut)),bandTailPosition:Math.max(0,Math.min(.98,dt)),bandTailCurve:Math.max(.5,ft),bandTailOverflow:Math.max(0,pt),bandAberration:Math.max(0,Math.min(1,mt)),rangeWidth:bt,rangeHeight:Ct,theme:G,bandColors:{core:w?.core&&xt(w.core)||Cn[G].core,above:w?.above&&xt(w.above)||Cn[G].above,mid:w?.mid&&xt(w.mid)||Cn[G].mid,below:w?.below&&xt(w.below)||Cn[G].below},distortion:Math.max(0,Math.min(1,Kt)),coreLight:Et,scale:q,radius:Jt,processing:h,processingDuration:Math.max(.05,qe),processingLevel:Math.max(0,Math.min(1,Je)),processingEase:Math.max(.05,x),processingTravel:Math.max(0,Ye),processingCurve:Math.max(1,Xe),cornerFollow:Math.max(0,Math.min(1,Ze)),hueRange:Math.max(0,Zt),hueDuration:Math.max(.5,Qt),staticColors:S===`mono`?!0:E,reducedMotion:Ft,paused:k}),[Pe,a,o,s,c,Qe,u,$e,et,p,tt,yt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,bt,Ct,G,He,Kt,Et,q,Jt,h,qe,Je,x,Ye,Xe,Ze,Zt,Qt,E,S,Ft,k]),rn=Re(i);rn.current=i;let an=Re(W);an.current=W,Le(()=>{if(!(Lt||Y)||!Bt)return;let e=It.current;return e?hn(e,nn,{stream:r,getLevel:()=>{let e=rn.current;return typeof e==`function`?e():e}},e=>an.current?.call(an,e)):void 0},[nn,r,Lt,Y,Bt]);let on=Be(e=>{It.current=e,typeof Ne==`function`?Ne(e):Ne&&(Ne.current=e)},[Ne]),sn={...De??{},"--voice-strength":Math.max(0,Math.min(1,Xt))};return J(B,{children:[J(`style`,{children:Oe?`${tn}
295
- ${Oe.split(`{id}`).join(Pe)}`:tn}),J(`div`,{...Me,ref:on,"data-voice-beam":Pe,"data-voice-type":t,"data-voice-halfres":``,"data-active":Lt&&!Y?``:void 0,"data-fading":Y?``:void 0,"data-paused":Lt&&!Y&&(!Bt||k)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:Ee,style:sn,onAnimationEnd:qt,children:[e,J(`div`,{"data-voice-beam-bloom":!0}),Kt>0&&J(B,{children:[J(`div`,{"data-voice-beam-warp":`inner`}),J(`div`,{"data-voice-beam-warp":`bloom`})]}),!Tn&&J(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),J(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),Et>0&&J(`div`,{"data-voice-beam-core":!0,children:J(`div`,{})}),Kt>0&&J(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:J(`filter`,{id:`vb-distort-${Pe}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[J(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*gt).toFixed(4)} ${(.05*gt).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),J(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),J(`feColorMatrix`,{in:`moved`,type:`matrix`,values:`1 0 0 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0 1`,result:`map`}),J(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),An=`http://www.w3.org/2000/svg`,Z=Math.PI*2,jn=21.5,Mn=Math.sqrt(12)*jn,Nn=154-Mn,Pn=Xn(),Fn=Nn+Pn.length,In=.56*Z*jn/2,Ln=.75,Rn=.35,zn=.55,Bn=22.5,Vn=4.5,Hn=.3,Un=$n(.65,0,.35,1),Wn=$n(.4,0,.2,1),Gn=$n(.34,1.56,.64,1),Kn=$n(.2,0,0,1);var qn=class{element;lines=[];ripple;track;middle;top;bottom;seal;check;motion=matchMedia(`(prefers-reduced-motion: reduce)`);phase=`idle`;stage={kind:`line`};settleSuccess=null;successBegun=null;frame=0;previousTime=0;position=0;target=0;level=0;stopped=!1;lineStyle=`wave`;pixels=null;pixelLevels=Array(44).fill(0);pixelHeights=Array(44).fill(-1);pixelClock=0;constructor(e,t=`ring`){this.checking=t,this.element=e.createElementNS(An,`svg`),this.element.classList.add(`seams-voiceid-ribbon`),this.element.setAttribute(`viewBox`,`0 0 308 64`),this.element.setAttribute(`aria-hidden`,`true`),this.ripple=this.append(e,`circle`,`1.5`),this.track=this.append(e,`circle`,`2`),this.middle=this.append(e,`path`,`1`),this.top=this.append(e,`path`,`2`),this.bottom=this.append(e,`path`,`2`),this.seal=this.append(e,`circle`,`0`),this.seal.setAttribute(`fill`,`currentColor`),this.seal.setAttribute(`stroke`,`none`),this.check=this.append(e,`path`,`2.6`),this.check.classList.add(`seams-voiceid-ribbon-check`),this.check.setAttribute(`d`,`M161 26.8 151.4 36.3 147.1 32`),this.check.setAttribute(`stroke-linejoin`,`round`),this.check.setAttribute(`pathLength`,`1`),this.check.setAttribute(`stroke-dasharray`,`1`);for(let e of[this.ripple,this.track,this.seal])e.setAttribute(`cx`,`154`),e.setAttribute(`cy`,`32`);if(this.track.setAttribute(`r`,`21.5`),t===`segments`){this.element.dataset.seamsProgressLine=``;for(let[e,t]of[this.top,this.middle,this.bottom].entries())t.dataset.seamsProgressSegment=String(e)}for(let t=3;t>=0;--t){let n=this.append(e,`path`,t===0?`1`:`0.65`);n.classList.add(t===0?`seams-voiceid-ribbon-line`:`seams-voiceid-ribbon-echo`),t>0&&(n.dataset.layer=String(t)),this.lines.push(n)}this.paint(performance.now())}readLevel=()=>this.level;setLineStyle(e){this.lineStyle=e,this.element.dataset.lineStyle=e,e===`pixels`&&!this.pixels&&(this.pixels=this.makePixels()),this.pixelHeights.fill(-1),this.paint(performance.now()),this.wake()}makePixels(){let e=this.element.ownerDocument,t=e.createElementNS(An,`g`);t.classList.add(`seams-voiceid-ribbon-pixels`),t.setAttribute(`opacity`,`0`),(308-(301+Vn))/2;let n=[];for(let r=0;r<44;r+=1){let i=[];for(let n=-4;n<=4;n+=1){let a=e.createElementNS(An,`rect`);a.classList.add(`seams-voiceid-ribbon-pixel`);let o=Math.abs(n);a.dataset.band=o===0?`0`:o<=2?`1`:`2`,a.setAttribute(`x`,(1.25+r*7).toFixed(2)),a.setAttribute(`y`,(32-Vn/2+n*6).toFixed(2)),a.setAttribute(`width`,`4.5`),a.setAttribute(`height`,`4.5`),a.setAttribute(`rx`,`1`),a.setAttribute(`opacity`,`0`),t.append(a),i.push(a)}n.push(i)}return this.element.prepend(t),{group:t,columns:n}}lineWidth(){let e=this.lines[this.lines.length-1],t=e?Number.parseFloat(getComputedStyle(e).strokeWidth):NaN;return Number.isFinite(t)&&t>0?t:1}setPhase(e){if(e===`processing`&&this.stage.kind===`line`){let e=Math.max(this.level,this.idleAmplitude(performance.now()));this.stage={kind:this.checking===`segments`?`segments`:`capture`,startedAt:performance.now(),amplitude:e}}else e!==`processing`&&(this.stage={kind:`line`},this.settle());this.phase=e,this.target=0,this.element.dataset.phase=e,this.wake()}succeed(e){if(this.stopped||this.stage.kind===`sealed`)return Promise.resolve();this.stage.kind===`line`&&this.setPhase(`processing`);let t=new Promise(this.awaitSuccess);return this.successBegun=e,this.stage.kind===`spin`&&this.beginSuccess(performance.now()),this.wake(),t}add(e){if(this.phase!==`listening`||this.stopped)return;let t=Math.max(0,e.rms-.003);this.target=(t/(t+.055))**.65*(e.speech?1:.15),this.element.dataset.speech=String(e.speech),this.wake()}dispose(){this.stopped=!0,cancelAnimationFrame(this.frame),this.frame=0,this.level=0,this.target=0,this.settle()}awaitSuccess=e=>{this.settle(),this.settleSuccess=e};settle(){let e=this.settleSuccess;this.settleSuccess=null,this.successBegun=null,e?.()}append(e,t,n){let r=e.createElementNS(An,t);return r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,n),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`vector-effect`,`non-scaling-stroke`),r.setAttribute(`opacity`,`0`),this.element.append(r),r}wake(){!this.stopped&&this.frame===0&&(this.previousTime=performance.now(),this.frame=requestAnimationFrame(this.draw))}draw=e=>{if(this.frame=0,this.stopped)return;let t=Math.min(50,Math.max(0,e-this.previousTime));this.previousTime=e,this.level+=(this.target-this.level)*(1-Math.exp(-t/(this.target>this.level?55:200))),this.motion.matches||(this.position+=t*(.0012+this.level*.003)),this.lineStyle===`pixels`&&this.stepPixels(t),this.paint(e),!this.element.isConnected||this.stage.kind===`sealed`||this.stage.kind===`line`&&this.phase===`idle`&&this.level<=.001&&this.pixelLevels.every(e=>e<=.001)||(this.frame=requestAnimationFrame(this.draw))};idleAmplitude(e){return this.phase!==`listening`||this.motion.matches?0:.085*(.72+.28*Math.sin(e/2600*Z))}stepPixels(e){for(this.pixelClock+=e;this.pixelClock>=70;)this.pixelClock-=70,this.pixelLevels.shift(),this.pixelLevels.push(this.level*(Hn+(1-Hn)*Math.random()))}paint(e){for(let e of[this.ripple,this.track,this.middle,this.top,this.bottom,this.seal,this.check])e.setAttribute(`opacity`,`0`);for(let e of this.lines)e.setAttribute(`opacity`,`0`);switch(this.pixels?.group.setAttribute(`opacity`,`0`),this.stage.kind){case`line`:this.lineStyle===`pixels`?this.paintPixels(e):this.paintLine(Math.max(this.level,this.idleAmplitude(e)));return;case`capture`:this.paintCapture(e,this.stage);return;case`segments`:this.paintSegments(e,this.stage);return;case`spin`:this.paintArc(this.spinnerArc(e,this.stage),1);return;case`success`:this.paintSuccess(e,this.stage);return;case`sealed`:this.paintSeal({start:0,sweep:Z},1,1);return}}paintLine(e){for(let t=0;t<this.lines.length;t+=1){let n=3-t;this.lines[t].setAttribute(`d`,this.linePath(n,e,0,308,1)),this.lines[t].setAttribute(`opacity`,String(n===0?zn+e*.4:.1+e*.1))}}paintPixels(e){if(!this.pixels)return;this.pixels.group.setAttribute(`opacity`,`1`);let t=this.phase===`listening`&&!this.motion.matches;for(let[n,r]of this.pixels.columns.entries()){let i=this.pixelLevels[n]??0;if(t){let t=Math.sin(e/2400*Z-n*.55);i=Math.max(i,.18+.12*t)}let a=Math.min(4,Math.round(i*4*1.3));if(a!==this.pixelHeights[n]){this.pixelHeights[n]=a;for(let[e,t]of r.entries())t.setAttribute(`opacity`,Math.abs(e-4)<=a?`1`:`0`)}}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-Kn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Kn(Q(r/200))),a=(308-2*i)/3;for(let[e,t]of[this.top,this.middle,this.bottom].entries()){let n=e*(a+i);t.setAttribute(`d`,`M${n.toFixed(2)} 32H${(n+a).toFixed(2)}`),t.setAttribute(`stroke-width`,String(this.lineWidth())),t.setAttribute(`opacity`,this.segmentOpacity(r,e))}}segmentOpacity(e,t){if(this.motion.matches)return`0.8`;let n=.5+.5*Math.cos(Z*(e-t*150)/900);return $(zn,Rn+(1-Rn)*n,Kn(Q(e/200))).toFixed(3)}paintCapture(e,t){let n=this.motion.matches?920:e-t.startedAt;if(n>=560){this.paintJoin(e,Math.min(n-560,360));return}let r=t.amplitude,i=n/560,a=1-Kn(Q(n/150)),o=Un(Q(i/.6)),s=Jn(!1)*jn*560,c=Qn(i,Fn,s),l=Nn+Qn(i,Fn+In-Nn,s),u=zn+r*.4;for(let[e,t]of[[this.top,!1],[this.bottom,!0]])e.setAttribute(`d`,this.halfPath(c,l,t,r,a)),e.setAttribute(`stroke-width`,$(this.lineWidth(),Math.max(2,this.lineWidth()),o).toFixed(2)),e.setAttribute(`opacity`,$(u,1,o).toFixed(3));this.middle.setAttribute(`d`,this.linePath(0,r,Nn,308-Nn,a)),this.middle.setAttribute(`opacity`,(u*(1-Kn(Q(n/180)))).toFixed(3));for(let e=0;e<3;e+=1){let t=3-e;this.lines[e].setAttribute(`d`,this.linePath(t,r,0,308,a)),this.lines[e].setAttribute(`opacity`,((.1+r*.1)*(1-Q(n/200))).toFixed(3))}this.track.setAttribute(`opacity`,(.1*Q((i-.4)/.6)).toFixed(3))}paintJoin(e,t){let n=(1-Math.cos(Math.PI*t/360))/2,r=-Math.PI/2+Jn(!1)*t,i=In/jn,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+Ln*a*n;if(this.motion.matches||t>=360){this.stage={kind:`spin`,startedAt:e,base:o-Z*.14},this.settleSuccess&&this.beginSuccess(e),this.paint(e);return}this.track.setAttribute(`opacity`,`0.1`);for(let[e,t]of[[this.top,o],[this.bottom,r+Math.PI-(1-Ln)*a*n]])e.setAttribute(`d`,Zn({start:t,sweep:i})),e.setAttribute(`stroke-width`,`2`),e.setAttribute(`opacity`,`1`)}spinnerArc(e,t){let n=e-t.startedAt,r=this.motion.matches?2600:1500,i=(n+r/2)%r/r,a=i<.5,o=Wn(a?i/.5:(i-.5)/.5),s=a?$(1,56,o):$(56,1,o),c=a?$(0,-14,o):$(-14,-99,o);return{start:t.base+Jn(this.motion.matches)*n-Z*c/100,sweep:Z*s/100}}beginSuccess(e){if(this.stage.kind!==`spin`)return;this.stage={kind:`success`,startedAt:e,from:this.spinnerArc(e,this.stage)};let t=this.successBegun;this.successBegun=null,t?.()}paintSuccess(e,t){let n=e-t.startedAt;if(n>=1140){this.stage={kind:`sealed`},this.settle(),this.paint(e);return}let r=Q(n/650),i=this.motion.matches?0:Jn(!1)*650*(r-r*r/2),a=Un(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Z,a)},Gn(Q((n-600)/420)),Un(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Kn(o);this.ripple.setAttribute(`r`,$(Bn,34,e).toFixed(2)),this.ripple.setAttribute(`opacity`,((1-e)*.45).toFixed(3))}}paintSeal(e,t,n){this.paintArc(e,1),this.seal.setAttribute(`r`,(Bn*Math.max(0,t)).toFixed(2)),this.seal.setAttribute(`opacity`,t>0?`1`:`0`),this.check.setAttribute(`stroke-dashoffset`,(1-n).toFixed(3)),this.check.setAttribute(`opacity`,n>0?`1`:`0`)}paintArc(e,t){this.track.setAttribute(`opacity`,String(.1*t)),this.top.setAttribute(`d`,Zn(e)),this.top.setAttribute(`stroke-width`,`2`),this.top.setAttribute(`opacity`,`1`)}displacement(e,t,n){let r=n/308,i=Math.sin(Math.PI*r)**1.7;if(this.motion.matches)return t*5*i;let a=Math.sin(r*Math.PI*4-this.position+e*.5)*.7+Math.sin(r*Math.PI*7+this.position*.7+e)*.3;return t*(26-e*4)*i*a}linePath(e,t,n,r,i){let a=``,o=Math.max(2,Math.ceil((r-n)/2));for(let s=0;s<=o;s+=1){let c=n+(r-n)*s/o,l=32+this.displacement(e,t,c)*i;a+=`${s===0?`M`:`L`}${c.toFixed(2)},${l.toFixed(2)} `}return a}halfPath(e,t,n,r,i){let a=``,o=Math.max(2,Math.ceil((t-e)/1.5));for(let s=0;s<=o;s+=1){let c=Yn(e+(t-e)*s/o),l=n?308-c.x:c.x,u=n?64-c.y:c.y;c.onLine&&(u+=this.displacement(0,r,l)*i),a+=`${s===0?`M`:`L`}${l.toFixed(2)},${u.toFixed(2)} `}return a}};function Jn(e){return Z/(e?3200:1800)}function Yn(e){if(e<=Nn)return{x:e,y:32,onLine:!0};if(e<Fn){let t=e-Nn,n=0,r=Pn.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Pn.lengths[e]<t?n=e:r=e}let i=(t-Pn.lengths[n])/(Pn.lengths[r]-Pn.lengths[n]||1);return{x:$(Pn.points[n][0],Pn.points[r][0],i),y:$(Pn.points[n][1],Pn.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-Fn)/jn;return{x:154+jn*Math.cos(t),y:32+jn*Math.sin(t),onLine:!1}}function Xn(){let e=[[Nn,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[Nn+Mn*i,32-jn*(4*i**3-3*i**4)],o=e[e.length-1];n+=Math.hypot(a[0]-o[0],a[1]-o[1]),e.push(a),t.push(n)}return{points:e,lengths:t,length:n}}function Zn(e){let t=Math.max(2,Math.ceil(80*e.sweep/Z)),n=``;for(let r=0;r<=t;r+=1){let i=e.start+e.sweep*r/t,a=154+jn*Math.cos(i),o=32+jn*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Qn(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function $n(e,t,n,r){let i=(e,t,n)=>((1-3*n+3*t)*e+(3*n-6*t))*e*e+3*t*e,a=(e,t,n)=>3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t;return o=>{if(o<=0)return 0;if(o>=1)return 1;let s=o;for(let t=0;t<6;t+=1){let t=a(s,e,n);if(t===0)break;s-=(i(s,e,n)-o)/t}return i(Q(s),t,r)}}function Q(e){return e<0?0:e>1?1:e}function $(e,t,n){return e+(t-e)*n}const er=kn,tr={light:{core:`#8b98a5`,above:`#cfd9de`,mid:`#aab8c2`,below:`#657786`},dark:{core:`#ffffff`,above:`#8b98a5`,mid:`#cfd9de`,below:`#536471`}};function nr(e){let t=e.trim();return Object.hasOwn(Tt,t)?t:`ocean`}var rr=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new qn(e,n),this.element=this.ribbon.element,this.glow=e.createElement(`div`),this.glow.className=`seams-voiceid-glow`,this.glow.setAttribute(`aria-hidden`,`true`),this.render(),queueMicrotask(this.render);let r=c();if(r)for(let e of this.glow.querySelectorAll(`style`))e.nonce=r;this.themeObserver=new MutationObserver(this.render),this.themeObserver.observe(e.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),this.themeObserver.observe(e.body,{attributes:!0,attributeFilter:[`data-theme`]})}setLineStyle(e){this.ribbon.setLineStyle(e)}listen(){this.setPhase(`listening`)}add(e){this.ribbon.add(e)}checking(){this.setPhase(`processing`)}accept(){this.setPhase(`idle`)}flatten(){this.disposed||(this.phase=`processing`,this.ribbon.setPhase(`idle`),this.render())}ready(){this.setPhase(`idle`)}succeed(e){return this.disposed?Promise.resolve():(this.phase=`idle`,this.render(),this.ribbon.succeed(e))}stop(){this.disposed||(this.disposed=!0,this.themeObserver.disconnect(),this.ribbon.dispose(),Ce(null,this.glow))}setPhase(e){this.disposed||(this.phase=e,this.ribbon.setPhase(e),this.render())}render=()=>{if(this.disposed)return;let e=getComputedStyle(this.prompt).getPropertyValue(`--seams-colors-voiceBeam`).trim();if(this.glow.hidden=e===`none`,this.glow.hidden){Ce(null,this.glow);return}let t=(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,n=nr(e);Ce(R(er,{className:`seams-voiceid-beam`,theme:t,...n===`mono`?{bandColors:tr[t]}:{},level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:n,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const ir=`
294
+ `}let Mt=null;function Nt(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function Pt(){let e=Nt();return e?(Mt||=new e,Mt.state===`suspended`&&Mt.resume().catch(()=>{}),Mt):null}const Ft=new WeakMap;function It(e){let t=Pt();if(!t||e.getAudioTracks().length===0)return null;let n=Ft.get(e);n||(n={node:t.createMediaStreamSource(e),refs:0},Ft.set(e,n)),n.refs+=1;let r=t.createAnalyser();r.fftSize=1024,r.smoothingTimeConstant=.5,n.node.connect(r);let i=!1;return{analyser:r,release:()=>{if(!i){i=!0;try{n.node.disconnect(r)}catch{}if(--n.refs,n.refs<=0){try{n.node.disconnect()}catch{}Ft.delete(e)}}}}}const Lt=new WeakMap;function Rt(e){let t=Lt.get(e);return t||(t={level:0,bands:[0,0,0],phase:0,scanA:0,scanT:0,t:0,lastTs:0,warp:1},Lt.set(e,t)),t}const Y=new Set;let zt=null,Bt=0,Vt=0,Ht=!1,Ut=!1,Wt=0,Gt=0;const Kt=Math.PI*2,qt=[[80,300],[300,2e3],[2e3,6e3]];function X(e){return e<0?0:e>1?1:e}function Jt(e,t){let n=t/2;return((e+n)%t+t)%t-n}function Yt(e,t){let n=e/(t/2+4);return Math.max(0,1-n*n)}function Xt(e,t){if(e<=t)return 0;let n=(e-t)/Math.max(.001,1-t);return X((1-Math.exp(-3*n))/(1-Math.exp(-3)))}function Zt(e,t,n,r,i){let a=t>e?r:i,o=1-Math.exp(-n/Math.max(.001,a));return e+(t-e)*o}const Qt=!(typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent)),$t=.05,en=.1;function tn(e,t,n,r){let i=e<0?1-r:1+r,a=Math.max(.05,n*i),o=Math.exp(-((Math.abs(e)/a)**+t)),s=Math.exp(-((1/a)**t));return Math.max(0,(o-s)/(1-s))}function nn(e,t,n,r,i){if(n<=0||t<=0)return 0;let a=t*Math.max(0,Math.min(.98,r));return e<=a?0:n*Math.min(1,(e-a)/Math.max(1,t-a))**+Math.max(.5,i)}function rn(e,t,n){return Math.max(0,Math.min(e,t/2,n/2))}function an(e,t,n,r=0){if(n<=0)return 0;let i=Math.min(e,t-e)-r;if(i>=n)return 0;if(i<=0)return n;let a=n-i;return n-Math.sqrt(Math.max(0,n*n-a*a))}function on(e,t,n,r){let i=n/2+t.cx*t.w,a=170*e.rangeWidth*t.w*t.mw,o=r*.82*Math.min(1,e.scale),s=Math.min(o,(64*e.rangeHeight*t.h+t.lift)*e.bandPosition),c=r-e.bandOffset,l=Math.min(1,t.corner*4),u=e.bandTail*(1-l*l*(3-2*l)),d=u>.001,f=d?e.bandTailOverflow:0,p=d?-f:i-a,m=d?n+f:i+a,h=[];for(let o=0;o<=56;o++){let l=p+(m-p)*o/56,d=Math.max(-1,Math.min(1,(l-i)/Math.max(1,a))),g=(l<i?i:n-i)+f,_=tn(d,e.bandCurve,e.bandSpread,e.bandSkew)+nn(Math.abs(l-i),g,u,e.bandTailPosition,e.bandTailCurve),v=t.corner>0?an(l,n,rn(e.radius,n,r))*t.corner:0;h.push([l,c-s*_-v])}return h}function sn(e,t,n,r,i){for(let[a,o]of[[``,1],[`-z`,.5]]){let s=e=>(e*o).toFixed(1)+`px`,c=n.map(([e,t])=>`${s(e)} ${s(t)}`),l=`polygon(0 ${s(i)}, ${c.join(`, `)}, ${s(r)} ${s(i)})`,u=`polygon(0 0, ${s(r)} 0, ${s(r)} ${s(i)}, ${c.slice().reverse().join(`, `)}, 0 ${s(i)})`;e.style.setProperty(`--vb-clip-below${a}-${t}`,l),e.style.setProperty(`--vb-clip-above${a}-${t}`,u)}}function cn(e,t,n){let r=n;for(let e=0;e<t.length;e++)t[e][1]<r&&(r=t[e][1]);let i=Math.max(0,Math.min(.9,Math.floor((r-6)/n/$t)*$t));if(i===e.filterTop)return;e.filterTop=i;let a=1+Math.max(.1,12/n),o=e.filter;o.setAttribute(`x`,`${-en*100}%`),o.setAttribute(`width`,`${(1+2*en)*100}%`),o.setAttribute(`y`,`${(i*100).toFixed(0)}%`),o.setAttribute(`height`,`${((a-i)*100).toFixed(1)}%`)}function ln(e,t,n){let{canvas:r,ctx:i,el:a,config:o}=e;if(!r||!i)return;let s=a.clientWidth,c=a.clientHeight;if(!s||!c)return;let l=Math.min(2,typeof window<`u`&&window.devicePixelRatio||1),u=Math.round(s*l),d=Math.round(c*l);(r.width!==u||r.height!==d)&&(r.width=u,r.height=d),i.setTransform(l,0,0,l,0,0),i.clearRect(0,0,s,c);let f=e.haloCanvas,p=e.haloCtx;f&&p&&((f.width!==u||f.height!==d)&&(f.width=u,f.height=d),p.setTransform(l,0,0,l,0,0),p.clearRect(0,0,s,c));let m=Math.min(1,.6*o.bandStrength*t.strength);if(m<.005||o.bandWidth<=0)return;let h=o.theme===`dark`,g=o.bandWidth*(1+.35*t.level),_=o.bandAberration*(.35+.65*t.level),v=(4+12*_)*o.scale,y=4*_*o.scale,b=(e,t)=>{i.beginPath(),i.moveTo(n[0][0]+e,n[0][1]+t);for(let r=1;r<n.length;r++)i.lineTo(n[r][0]+e,n[r][1]+t)},x={r:o.bandColors.above,g:o.bandColors.mid,c:o.bandColors.core,b:o.bandColors.below},S=(h?.42:.4)*m,C=14*g,w=3.5*o.bandWidth/2,T=w*l,E=typeof i.filter==`string`,D=E?`0px`:`${w.toFixed(2)}px`;e.cssBlur!==D&&(a.style.setProperty(`--vb-band-blur-${o.id}`,D),a.style.setProperty(`--vb-band-halo-blur-${o.id}`,E?`0px`:`${(w*3).toFixed(2)}px`),e.cssBlur=D);let ee=[[1,.16],[.72,.2],[.46,.26],[.22,.34]],O=[{rgb:x.r,a:1,ox:y,oy:-v},{rgb:x.g,a:.55,ox:y*.35,oy:-v*.35},{rgb:x.b,a:1,ox:-y,oy:v},{rgb:x.c,a:.9,ox:0,oy:0}];i.lineCap=`round`,i.lineJoin=`round`,i.globalCompositeOperation=`source-over`;let k=n[0][0],A=n[n.length-1][0],te=(e,t)=>{let n=i.createLinearGradient(k,0,A,0),r=o.bandTail>0?.015:.18;return n.addColorStop(0,`rgba(${e}, 0)`),n.addColorStop(r,`rgba(${e}, ${t.toFixed(3)})`),n.addColorStop(1-r,`rgba(${e}, ${t.toFixed(3)})`),n.addColorStop(1,`rgba(${e}, 0)`),n},j=!E&&p?p:i;E&&(i.filter=`blur(${(T*3).toFixed(1)}px)`),j.lineCap=`round`,j.lineJoin=`round`,j.strokeStyle=te(x.c,S*.3),j.lineWidth=C*2.2,j.beginPath(),j.moveTo(n[0][0],n[0][1]);for(let e=1;e<n.length;e++)j.lineTo(n[e][0],n[e][1]);j.stroke(),E&&(i.filter=`blur(${T.toFixed(1)}px)`);for(let e of O)for(let[t,n]of ee)i.strokeStyle=te(e.rgb,S*e.a*n),i.lineWidth=Math.max(.6,C*t),b(e.ox,e.oy),i.stroke();E&&(i.filter=`none`),i.globalCompositeOperation=`source-over`}function un(e){return(1-Math.cos(Kt*e))/2}function dn(e,t){let n=e.analyser,r=e.time,i=e.freq;n.getFloatTimeDomainData(r);let a=0;for(let e=0;e<r.length;e++)a+=r[e]*r[e];t.level=Math.sqrt(a/r.length)*5*e.config.sensitivity,n.getByteFrequencyData(i);let o=n.context.sampleRate/n.fftSize;for(let n=0;n<3;n++){let[r,a]=qt[n],s=Math.max(0,Math.floor(r/o)),c=Math.min(i.length-1,Math.ceil(a/o)),l=0;for(let e=s;e<=c;e++)l+=i[e];let u=c>=s?l/(c-s+1)/255:0;t.bands[n]=u*1.7*e.config.sensitivity}}const fn={level:0,bands:[0,0,0]};function pn(e){zt=requestAnimationFrame(pn);let t=Vt?e-Vt:0;if(Vt=e,Ht){if(Ut=!Ut,Ut)return;e>=Gt&&(Ht=!1,Wt=0)}else t>22?Wt?e-Wt>500&&(Ht=!0,Ut=!1,Gt=e+4e3):Wt=e:Wt=0;e-Bt<14.666666666666668||(Bt=e,Y.forEach(t=>{var n;let{el:r,config:i,source:a,s:o}=t,s=i.paused;if(s&&t.paintedConfig===i)return;let c=s?0:o.lastTs?Math.min(.05,(e-o.lastTs)/1e3):1/60;o.lastTs=e,o.t+=c;let l=o.t;if(!s)if(t.analyser)dn(t,fn);else{let e=a.getLevel?X(a.getLevel()):0;fn.level=e,fn.bands[0]=e,fn.bands[1]=e*(.72+.28*Math.sin(l*9.1)),fn.bands[2]=e*(.6+.4*Math.sin(l*13.7+2))}let u=Xt(fn.level,i.threshold);o.level=Zt(o.level,u,c,i.attack,i.release);for(let e=0;e<3;e++){let t=Xt(fn.bands[e],i.threshold*.6);o.bands[e]=Zt(o.bands[e],t,c,i.attack,i.release*1.15)}let d=Tt*i.lobeSpacing;i.processing&&o.scanA<.001&&o.scanT===0&&(o.scanT=Math.max(.05,i.processingDuration)/2);let f=Math.max(.05,i.processingEase);o.scanA=Zt(o.scanA,i.processing?1:0,c,f*.9,f*.8),i.processing?o.scanT+=c:o.scanA<.001&&(o.scanT=0);let p=o.scanA*o.scanA*(3-2*o.scanA),m=r.clientWidth,h=r.clientHeight,g=d/2*i.processingTravel,_=o.scanT/Math.max(.05,i.processingDuration),v=Math.floor(_),y=_-v,b=Math.max(1,i.processingCurve),x=y<.5?.5*(2*y)**b:1-.5*(2-2*y)**b,S=i.reducedMotion?0:v%2==0?2*x-1:1-2*x,C=p*g*S,w=1-p*.6,T=1-p*.45,E=1+p*.3*(1-S*S),D=i.reducedMotion?.5:.5+.5*Math.sin(Kt*l/i.breatheDuration),ee=o.level+(1-o.level)*i.idle*D,O=Math.max(0,Math.min(1,(p-.25)/.75)),k=O*O*(3-2*O),A=Math.max(ee,i.processingLevel*k),te=.15+.85*A,j=.5+i.reach*A,M=(.85+i.spread*A)*E;i.flow!==0&&!i.reducedMotion&&(o.phase=((o.phase+i.flow*A*c)%d+d)%d),r.style.setProperty(`--vb-level-${i.id}`,o.level.toFixed(3)),r.style.setProperty(`--vb-cx-${i.id}`,`${C.toFixed(1)}px`),r.style.setProperty(`--vb-mw-${i.id}`,T.toFixed(3));let ne=i.bend*A;r.style.setProperty(`--vb-bh-${i.id}`,`${Math.max(0,ne).toFixed(1)}px`);let N=i.bend>0?Math.min(1,ne/i.bend):0;r.style.setProperty(`--vb-bendA-${i.id}`,N.toFixed(3));let P={cx:C,w:M,h:j,mw:T,lift:ne,strength:N,level:o.level,corner:p},F=m/2+C*M,I=30*i.scale*M,L=rn(i.radius,m,h),re=p*i.cornerFollow;r.style.setProperty(`--vb-cy-${i.id}`,`${(-an(F,m,L,I*1.4)*re).toFixed(1)}px`),o.warp=Zt(o.warp,i.processing?0:1,c,.35,.06);let R=o.warp,z=t.displace!=null&&R<.03;if(z!==t.warpOff&&(t.warpOff=z,z?r.setAttribute(`data-voice-warp`,`off`):r.removeAttribute(`data-voice-warp`)),m&&h&&(t.ctx||t.displace)){let e=on(i,P,m,h);(t.displace&&!z||i.coreLight>0)&&sn(r,i.id,e,m,h),t.filter&&!z&&Qt&&cn(t,e,h),t.ctx&&ln(t,P,e)}if(t.displace&&!z){let e=i.reducedMotion?0:i.distortion*120*i.scale*(.15+.85*A)*R;t.displace.scale.baseVal=e,t.noiseShift&&(t.noiseShift.dx.baseVal=8*i.scale*Math.sin(l*.9),t.noiseShift.dy.baseVal=4*i.scale*Math.sin(l*.6+1.3))}r.style.setProperty(`--vb-glow-${i.id}`,te.toFixed(3)),r.style.setProperty(`--vb-h-${i.id}`,j.toFixed(3)),r.style.setProperty(`--vb-w-${i.id}`,M.toFixed(3));for(let e=0;e<wt.length;e++){let t=wt[e],n=Jt(t.x*i.lobeSpacing+o.phase,d),a=i.bands?.6+.7*o.bands[t.band]:1;r.style.setProperty(`--vb-x${e}-${i.id}`,`${(n*w).toFixed(1)}px`),r.style.setProperty(`--vb-l${e}-${i.id}`,(a*Yt(n,d)).toFixed(3));let s=m/2+(C+n*w)*M;r.style.setProperty(`--vb-y${e}-${i.id}`,`${(-an(s,m,L,I)*re).toFixed(1)}px`)}let B=i.staticColors||i.reducedMotion||i.hueRange===0?0:-i.hueRange+2*i.hueRange*un(l/i.hueDuration);r.style.setProperty(`--vb-hue-${i.id}`,`${B.toFixed(2)}deg`),(n=t.onLevel)==null||n.call(t,o.level),t.paintedConfig=i}))}function mn(){zt??=(Bt=0,Vt=0,Wt=0,requestAnimationFrame(pn))}function hn(){Y.size===0&&zt!=null&&(cancelAnimationFrame(zt),zt=null)}function gn(e,t,n,r){let i={el:e,config:t,source:n,onLevel:r,analyser:null,releaseAnalyser:null,time:null,freq:null,canvas:null,ctx:null,haloCanvas:null,haloCtx:null,displace:null,noiseShift:null,filter:null,filterTop:-1,s:Rt(e),paintedConfig:null,cssBlur:null,warpOff:e.hasAttribute(`data-voice-warp`)};t.distortion>0&&(i.displace=e.querySelector(`:scope > svg feDisplacementMap`),i.noiseShift=e.querySelector(`:scope > svg feOffset`),i.filter=e.querySelector(`:scope > svg filter`));let a=e.querySelector(`:scope > [data-voice-beam-band]`);if(a){i.canvas=a,i.ctx=a.getContext(`2d`);let t=e.querySelector(`:scope > [data-voice-beam-band-halo]`);t&&(i.haloCanvas=t,i.haloCtx=t.getContext(`2d`))}if(i.s.lastTs=0,n.stream){let e=It(n.stream);e&&(i.analyser=e.analyser,i.releaseAnalyser=e.release,i.time=new Float32Array(e.analyser.fftSize),i.freq=new Uint8Array(e.analyser.frequencyBinCount))}return Y.add(i),mn(),()=>{var e;Y.delete(i),(e=i.releaseAnalyser)==null||e.call(i),hn()}}const _n={scale:1,glowSize:1,processingDuration:1.1,processingLevel:.55,processingTravel:1.55,processingCurve:2.1,cornerFollow:.45,strokeOpacity:1,innerOpacity:1,bloomOpacity:1,idle:.18,reach:1.2,spread:1.05,flow:48,bend:60,bandStrength:1.55,bandWidth:2.15,bandPosition:.35,bandCurve:1.75,bandSpread:.87,bandSkew:.12,bandOffset:-27,bandTail:.59,bandTailPosition:.67,bandTailCurve:2.4,bandTailOverflow:15,bandAberration:.89,distortion:.62,distortionDetail:2.3,glowWidth:.65,glowHeight:1.25,lobeSpacing:.85,rangeWidth:.75,rangeHeight:1,softness:1.07,coreSize:1,coreLight:0,coreLightWidth:1,coreLightHeight:1,strokeScale:1,innerScale:1,innerHeight:1,bloomScale:1,bloomHeight:1},vn={default:{},pill:{scale:.45,glowSize:.95,strokeOpacity:1.2,innerOpacity:.85,reach:1.35,spread:1.1,flow:0,bend:23,bandStrength:1.55,bandWidth:1.85,bandCurve:1.95,bandSpread:.38,bandOffset:-16,bandTail:0,processingTravel:2,cornerFollow:0,distortion:.45,distortionDetail:3,glowWidth:.65,glowHeight:.95,lobeSpacing:.45,rangeWidth:.8,rangeHeight:.7,softness:.88,coreSize:.25,strokeScale:1.25,innerScale:.95,bloomScale:1.05,bloomHeight:2.25},mobile:{scale:1.25,spread:.45,reach:3,flow:60,bend:70,bandWidth:2.4,bandCurve:1.55,bandSpread:.9,bandOffset:-50,bandTail:.62,bandTailPosition:.42,bandTailCurve:2.7,bandTailOverflow:22,processingDuration:1.05,processingLevel:.35,processingTravel:1,cornerFollow:.4,bandStrength:1.8,distortionDetail:2,glowWidth:1.15,glowHeight:2.1,lobeSpacing:1.35,rangeWidth:1.25,rangeHeight:1.2,softness:1.1}},yn={default:{brightness:1.15},pill:{brightness:1.35,saturation:1.5},mobile:{strength:1,brightness:1.2,saturation:1.5}},bn={default:{},pill:{},mobile:{strength:1}};function xn(e=`default`,t=`dark`){return(t===`light`?bn[e]:void 0)??yn[e]}const Sn={default:{bandStrength:1.7},pill:{bandStrength:2},mobile:{bandStrength:1.7}};function Cn(e=`default`,t=`dark`){let n=vn[e],r={};return t===`light`&&(n.reach===void 0&&(r.reach=1.8),n.spread===void 0&&(r.spread=.8),n.coreLight===void 0&&(r.coreLight=1.8)),{..._n,...r,...n,...t===`light`?Sn[e]:void 0}}const wn={dark:{core:`255, 255, 255`,above:`255, 70, 80`,mid:`90, 255, 150`,below:`80, 140, 255`},light:{core:`197, 139, 255`,above:`255, 122, 182`,mid:`126, 196, 255`,below:`45, 255, 171`}},Tn=typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent),En=(()=>{if(typeof document>`u`)return!0;let e=document.createElement(`canvas`).getContext(`2d`);return!!e&&typeof e.filter==`string`})();function Dn(){let[e,t]=Ie(()=>typeof window>`u`||window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return Re(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),n=e=>t(e.matches?`dark`:`light`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function On(){let[e,t]=Ie(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return Re(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function kn(e,t){return e===`auto`?t:e}const An=$e(function({children:e,type:t=`default`,scale:n,stream:r=null,level:i=0,sensitivity:a=3.1,threshold:o=.015,attack:s=.325,release:c=.86,idle:l,breatheDuration:u=5.2,reach:d,spread:f,bands:p=!0,flow:m,processing:h=!1,processingDuration:g,processingLevel:_,processingTravel:v,processingCurve:y,cornerFollow:b,processingEase:x=.6,colorVariant:S=`colorful`,colors:C,bandColors:w,theme:T=`dark`,staticColors:E=!1,hueRange:D,hueDuration:ee,active:O=!0,paused:k=!1,borderRadius:A,brightness:te,saturation:j,glowSize:M,strokeOpacity:ne,innerOpacity:N,bloomOpacity:P,bend:F,bandStrength:I,bandWidth:L,bandPosition:re,bandCurve:R,bandSpread:z,bandSkew:V,bandOffset:H,bandTail:ie,bandTailPosition:ae,bandTailCurve:oe,bandTailOverflow:se,bandAberration:ce,distortion:le,distortionDetail:ue,glowWidth:de,glowHeight:fe,lobeSpacing:pe,rangeWidth:me,rangeHeight:he,softness:ge,coreSize:_e,coreLight:ve,coreLightWidth:ye,coreLightHeight:be,strokeScale:xe,innerScale:Se,innerHeight:Ce,bloomScale:we,bloomHeight:Te,strength:U,className:Ee,style:De,css:Oe,onLevel:ke,onActivate:W,onDeactivate:Ae,onAnimationEnd:je,...Me},Ne){let Pe=He().replace(/:/g,`-`),G=kn(T,Dn()),Fe=C?C.join(`|`):``,Le=w?[w.core,w.above,w.mid,w.below].join(`|`):``,K=Cn(t,G),q=Math.max(.05,n??K.scale),Ue=M??K.glowSize,We=ne??K.strokeOpacity,Ge=N??K.innerOpacity,Ke=P??K.bloomOpacity,qe=g??K.processingDuration,Je=_??K.processingLevel,Ye=v??K.processingTravel,Xe=y??K.processingCurve,Ze=b??K.cornerFollow,Qe=l??K.idle,$e=d??K.reach,et=f??K.spread,tt=(m??K.flow)*q,nt=(F??K.bend)*q,rt=I??K.bandStrength,it=(L??K.bandWidth)*q,at=re??K.bandPosition,ot=R??K.bandCurve,st=z??K.bandSpread,ct=V??K.bandSkew,lt=(H??K.bandOffset)*q,ut=ie??K.bandTail,dt=ae??K.bandTailPosition,ft=oe??K.bandTailCurve,pt=(se??K.bandTailOverflow)*q,mt=ce??K.bandAberration,ht=le??K.distortion,gt=(ue??K.distortionDetail)/q,_t=(de??K.glowWidth)*q,vt=(fe??K.glowHeight)*q,yt=(pe??K.lobeSpacing)*q,bt=(me??K.rangeWidth)*q,xt=(he??K.rangeHeight)*q,wt=ge??K.softness,Tt=(_e??K.coreSize)*q,Et=Math.max(0,Math.min(3,ve??K.coreLight)),Dt=ye??K.coreLightWidth,Ot=be??K.coreLightHeight,kt=xe??K.strokeScale,At=Se??K.innerScale,Mt=Ce??K.innerHeight,Nt=we??K.bloomScale,Pt=Te??K.bloomHeight,Ft=On(),It=ze(null),[Lt,Rt]=Ie(O),[Y,zt]=Ie(!1),[Bt,Vt]=Ie(!0),[Ht,Ut]=Ie(null),[Wt,Gt]=Ie(0);Re(()=>{if(!Tn)return;let e=It.current;if(!e)return;let t=()=>Gt(e.clientWidth*e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let Kt=Tn&&Wt>6e4?0:ht;Re(()=>{if(A!=null)return;let e=It.current;if(!e)return;let t=()=>{let t=e.firstElementChild;if(!t)return;let n=getComputedStyle(t),r=parseFloat(n.borderTopLeftRadius);!isNaN(r)&&r>0&&Ut(r)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!1}),()=>n.disconnect()},[A,e]),Re(()=>{O&&!Lt&&!Y?Rt(!0):!O&&Lt&&!Y&&zt(!0)},[O,Lt,Y]),Re(()=>{let e=It.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{for(let t of e)Vt(t.isIntersecting)},{rootMargin:`256px`});return t.observe(e),()=>t.disconnect()},[]);let qt=Ve(e=>{let t=e.animationName;t.includes(`fade-out`)?(Rt(!1),zt(!1),Ae?.()):t.includes(`fade-in`)&&W?.(),je?.(e)},[W,Ae,je]),X=Ct[G],Jt=A??Ht??16,Yt=xn(t,G),Xt=U??Yt.strength??X.strength??1,Zt=D??X.hueRange??24,Qt=ee??X.hueDuration??12,$t=te??Yt.brightness??X.brightness,en=j??Yt.saturation??X.saturation,tn=Be(()=>jt({id:Pe,borderRadius:Jt,borderWidth:1,strokeOpacity:X.strokeOpacity*We,innerOpacity:X.innerOpacity*Ge,bloomOpacity:X.bloomOpacity*Ke,innerShadow:X.innerShadow,colorVariant:S,colors:C,brightness:$t,saturation:en,theme:G,hueBase:X.hueBase??0,glowSize:Ue*q,glowWidth:_t,glowHeight:vt,strokeScale:kt,innerScale:At,innerHeight:Mt,bloomScale:Nt,bloomHeight:Pt,coreSize:Tt,coreLight:Et,coreLightWidth:Dt,coreLightHeight:Ot,rangeWidth:bt,rangeHeight:xt,softness:wt,distortion:Kt>0,scale:q}),[Pe,Jt,X,S,Fe,$t,en,G,K,Ue,We,Ge,Ke,q,_t,vt,kt,At,Mt,Nt,Pt,Tt,Et,Dt,Ot,bt,xt,wt,Kt>0]),nn=Be(()=>({id:Pe,sensitivity:Math.max(0,a),threshold:Math.max(0,Math.min(.95,o)),attack:Math.max(0,s),release:Math.max(0,c),idle:Math.max(0,Math.min(1,Qe)),breatheDuration:Math.max(.2,u),reach:Math.max(0,$e),spread:Math.max(0,et),bands:p,flow:tt,lobeSpacing:Math.max(.1,yt),bend:Math.max(0,nt),bandStrength:Math.max(0,rt),bandWidth:Math.max(0,it),bandPosition:Math.max(0,at),bandCurve:Math.max(.3,ot),bandSpread:Math.max(.05,st),bandSkew:Math.max(-.9,Math.min(.9,ct)),bandOffset:lt,bandTail:Math.max(0,Math.min(1.5,ut)),bandTailPosition:Math.max(0,Math.min(.98,dt)),bandTailCurve:Math.max(.5,ft),bandTailOverflow:Math.max(0,pt),bandAberration:Math.max(0,Math.min(1,mt)),rangeWidth:bt,rangeHeight:xt,theme:G,bandColors:{core:w?.core&&St(w.core)||wn[G].core,above:w?.above&&St(w.above)||wn[G].above,mid:w?.mid&&St(w.mid)||wn[G].mid,below:w?.below&&St(w.below)||wn[G].below},distortion:Math.max(0,Math.min(1,Kt)),coreLight:Et,scale:q,radius:Jt,processing:h,processingDuration:Math.max(.05,qe),processingLevel:Math.max(0,Math.min(1,Je)),processingEase:Math.max(.05,x),processingTravel:Math.max(0,Ye),processingCurve:Math.max(1,Xe),cornerFollow:Math.max(0,Math.min(1,Ze)),hueRange:Math.max(0,Zt),hueDuration:Math.max(.5,Qt),staticColors:S===`mono`?!0:E,reducedMotion:Ft,paused:k}),[Pe,a,o,s,c,Qe,u,$e,et,p,tt,yt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,bt,xt,G,Le,Kt,Et,q,Jt,h,qe,Je,x,Ye,Xe,Ze,Zt,Qt,E,S,Ft,k]),rn=ze(i);rn.current=i;let an=ze(ke);an.current=ke,Re(()=>{if(!(Lt||Y)||!Bt)return;let e=It.current;return e?gn(e,nn,{stream:r,getLevel:()=>{let e=rn.current;return typeof e==`function`?e():e}},e=>an.current?.call(an,e)):void 0},[nn,r,Lt,Y,Bt]);let on=Ve(e=>{It.current=e,typeof Ne==`function`?Ne(e):Ne&&(Ne.current=e)},[Ne]),sn={...De??{},"--voice-strength":Math.max(0,Math.min(1,Xt))};return J(B,{children:[J(`style`,{children:Oe?`${tn}
295
+ ${Oe.split(`{id}`).join(Pe)}`:tn}),J(`div`,{...Me,ref:on,"data-voice-beam":Pe,"data-voice-type":t,"data-voice-halfres":``,"data-active":Lt&&!Y?``:void 0,"data-fading":Y?``:void 0,"data-paused":Lt&&!Y&&(!Bt||k)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:Ee,style:sn,onAnimationEnd:qt,children:[e,J(`div`,{"data-voice-beam-bloom":!0}),Kt>0&&J(B,{children:[J(`div`,{"data-voice-beam-warp":`inner`}),J(`div`,{"data-voice-beam-warp":`bloom`})]}),!En&&J(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),J(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),Et>0&&J(`div`,{"data-voice-beam-core":!0,children:J(`div`,{})}),Kt>0&&J(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:J(`filter`,{id:`vb-distort-${Pe}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[J(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*gt).toFixed(4)} ${(.05*gt).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),J(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),J(`feColorMatrix`,{in:`moved`,type:`matrix`,values:`1 0 0 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0 1`,result:`map`}),J(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),jn=`http://www.w3.org/2000/svg`,Z=Math.PI*2,Mn=21.5,Nn=Math.sqrt(12)*Mn,Pn=154-Nn,Fn=Zn(),In=Pn+Fn.length,Ln=.56*Z*Mn/2,Rn=.75,zn=.35,Bn=.55,Vn=22.5,Hn=4.5,Un=.3,Wn=er(.65,0,.35,1),Gn=er(.4,0,.2,1),Kn=er(.34,1.56,.64,1),qn=er(.2,0,0,1);var Jn=class{element;lines=[];ripple;track;middle;top;bottom;seal;check;motion=matchMedia(`(prefers-reduced-motion: reduce)`);phase=`idle`;stage={kind:`line`};settleSuccess=null;successBegun=null;frame=0;previousTime=0;position=0;target=0;level=0;stopped=!1;lineStyle=`wave`;pixels=null;pixelLevels=Array(44).fill(0);pixelHeights=Array(44).fill(-1);pixelClock=0;constructor(e,t=`ring`){this.checking=t,this.element=e.createElementNS(jn,`svg`),this.element.classList.add(`seams-voiceid-ribbon`),this.element.setAttribute(`viewBox`,`0 0 308 64`),this.element.setAttribute(`aria-hidden`,`true`),this.ripple=this.append(e,`circle`,`1.5`),this.track=this.append(e,`circle`,`2`),this.middle=this.append(e,`path`,`1`),this.top=this.append(e,`path`,`2`),this.bottom=this.append(e,`path`,`2`),this.seal=this.append(e,`circle`,`0`),this.seal.setAttribute(`fill`,`currentColor`),this.seal.setAttribute(`stroke`,`none`),this.check=this.append(e,`path`,`2.6`),this.check.classList.add(`seams-voiceid-ribbon-check`),this.check.setAttribute(`d`,`M161 26.8 151.4 36.3 147.1 32`),this.check.setAttribute(`stroke-linejoin`,`round`),this.check.setAttribute(`pathLength`,`1`),this.check.setAttribute(`stroke-dasharray`,`1`);for(let e of[this.ripple,this.track,this.seal])e.setAttribute(`cx`,`154`),e.setAttribute(`cy`,`32`);if(this.track.setAttribute(`r`,`21.5`),t===`segments`){this.element.dataset.seamsProgressLine=``;for(let[e,t]of[this.top,this.middle,this.bottom].entries())t.dataset.seamsProgressSegment=String(e)}for(let t=3;t>=0;--t){let n=this.append(e,`path`,t===0?`1`:`0.65`);n.classList.add(t===0?`seams-voiceid-ribbon-line`:`seams-voiceid-ribbon-echo`),t>0&&(n.dataset.layer=String(t)),this.lines.push(n)}this.paint(performance.now())}readLevel=()=>this.level;setLineStyle(e){this.lineStyle=e,this.element.dataset.lineStyle=e,e===`pixels`&&!this.pixels&&(this.pixels=this.makePixels()),this.pixelHeights.fill(-1),this.paint(performance.now()),this.wake()}makePixels(){let e=this.element.ownerDocument,t=e.createElementNS(jn,`g`);t.classList.add(`seams-voiceid-ribbon-pixels`),t.setAttribute(`opacity`,`0`),(308-(301+Hn))/2;let n=[];for(let r=0;r<44;r+=1){let i=[];for(let n=-4;n<=4;n+=1){let a=e.createElementNS(jn,`rect`);a.classList.add(`seams-voiceid-ribbon-pixel`);let o=Math.abs(n);a.dataset.band=o===0?`0`:o<=2?`1`:`2`,a.setAttribute(`x`,(1.25+r*7).toFixed(2)),a.setAttribute(`y`,(32-Hn/2+n*6).toFixed(2)),a.setAttribute(`width`,`4.5`),a.setAttribute(`height`,`4.5`),a.setAttribute(`rx`,`1`),a.setAttribute(`opacity`,`0`),t.append(a),i.push(a)}n.push(i)}return this.element.prepend(t),{group:t,columns:n}}lineWidth(){let e=this.lines[this.lines.length-1],t=e?Number.parseFloat(getComputedStyle(e).strokeWidth):NaN;return Number.isFinite(t)&&t>0?t:1}setPhase(e){if(e===`processing`&&this.stage.kind===`line`){let e=Math.max(this.level,this.idleAmplitude(performance.now()));this.stage={kind:this.checking===`segments`?`segments`:`capture`,startedAt:performance.now(),amplitude:e}}else e!==`processing`&&(this.stage={kind:`line`},this.settle());this.phase=e,this.target=0,this.element.dataset.phase=e,this.wake()}succeed(e){if(this.stopped||this.stage.kind===`sealed`)return Promise.resolve();this.stage.kind===`line`&&this.setPhase(`processing`);let t=new Promise(this.awaitSuccess);return this.successBegun=e,this.stage.kind===`spin`&&this.beginSuccess(performance.now()),this.wake(),t}add(e){if(this.phase!==`listening`||this.stopped)return;let t=Math.max(0,e.rms-.003);this.target=(t/(t+.055))**.65*(e.speech?1:.15),this.element.dataset.speech=String(e.speech),this.wake()}dispose(){this.stopped=!0,cancelAnimationFrame(this.frame),this.frame=0,this.level=0,this.target=0,this.settle()}awaitSuccess=e=>{this.settle(),this.settleSuccess=e};settle(){let e=this.settleSuccess;this.settleSuccess=null,this.successBegun=null,e?.()}append(e,t,n){let r=e.createElementNS(jn,t);return r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,n),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`vector-effect`,`non-scaling-stroke`),r.setAttribute(`opacity`,`0`),this.element.append(r),r}wake(){!this.stopped&&this.frame===0&&(this.previousTime=performance.now(),this.frame=requestAnimationFrame(this.draw))}draw=e=>{if(this.frame=0,this.stopped)return;let t=Math.min(50,Math.max(0,e-this.previousTime));this.previousTime=e,this.level+=(this.target-this.level)*(1-Math.exp(-t/(this.target>this.level?55:200))),this.motion.matches||(this.position+=t*(.0012+this.level*.003)),this.lineStyle===`pixels`&&this.stepPixels(t),this.paint(e),!this.element.isConnected||this.stage.kind===`sealed`||this.stage.kind===`line`&&this.phase===`idle`&&this.level<=.001&&this.pixelLevels.every(e=>e<=.001)||(this.frame=requestAnimationFrame(this.draw))};idleAmplitude(e){return this.phase!==`listening`||this.motion.matches?0:.085*(.72+.28*Math.sin(e/2600*Z))}stepPixels(e){for(this.pixelClock+=e;this.pixelClock>=70;)this.pixelClock-=70,this.pixelLevels.shift(),this.pixelLevels.push(this.level*(Un+(1-Un)*Math.random()))}paint(e){for(let e of[this.ripple,this.track,this.middle,this.top,this.bottom,this.seal,this.check])e.setAttribute(`opacity`,`0`);for(let e of this.lines)e.setAttribute(`opacity`,`0`);switch(this.pixels?.group.setAttribute(`opacity`,`0`),this.stage.kind){case`line`:this.lineStyle===`pixels`?this.paintPixels(e):this.paintLine(Math.max(this.level,this.idleAmplitude(e)));return;case`capture`:this.paintCapture(e,this.stage);return;case`segments`:this.paintSegments(e,this.stage);return;case`spin`:this.paintArc(this.spinnerArc(e,this.stage),1);return;case`success`:this.paintSuccess(e,this.stage);return;case`sealed`:this.paintSeal({start:0,sweep:Z},1,1);return}}paintLine(e){for(let t=0;t<this.lines.length;t+=1){let n=3-t;this.lines[t].setAttribute(`d`,this.linePath(n,e,0,308,1)),this.lines[t].setAttribute(`opacity`,String(n===0?Bn+e*.4:.1+e*.1))}}paintPixels(e){if(!this.pixels)return;this.pixels.group.setAttribute(`opacity`,`1`);let t=this.phase===`listening`&&!this.motion.matches;for(let[n,r]of this.pixels.columns.entries()){let i=this.pixelLevels[n]??0;if(t){let t=Math.sin(e/2400*Z-n*.55);i=Math.max(i,.18+.12*t)}let a=Math.min(4,Math.round(i*4*1.3));if(a!==this.pixelHeights[n]){this.pixelHeights[n]=a;for(let[e,t]of r.entries())t.setAttribute(`opacity`,Math.abs(e-4)<=a?`1`:`0`)}}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-qn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:qn(Q(r/200))),a=(308-2*i)/3;for(let[e,t]of[this.top,this.middle,this.bottom].entries()){let n=e*(a+i);t.setAttribute(`d`,`M${n.toFixed(2)} 32H${(n+a).toFixed(2)}`),t.setAttribute(`stroke-width`,String(this.lineWidth())),t.setAttribute(`opacity`,this.segmentOpacity(r,e))}}segmentOpacity(e,t){if(this.motion.matches)return`0.8`;let n=.5+.5*Math.cos(Z*(e-t*150)/900);return $(Bn,zn+(1-zn)*n,qn(Q(e/200))).toFixed(3)}paintCapture(e,t){let n=this.motion.matches?920:e-t.startedAt;if(n>=560){this.paintJoin(e,Math.min(n-560,360));return}let r=t.amplitude,i=n/560,a=1-qn(Q(n/150)),o=Wn(Q(i/.6)),s=Yn(!1)*Mn*560,c=$n(i,In,s),l=Pn+$n(i,In+Ln-Pn,s),u=Bn+r*.4;for(let[e,t]of[[this.top,!1],[this.bottom,!0]])e.setAttribute(`d`,this.halfPath(c,l,t,r,a)),e.setAttribute(`stroke-width`,$(this.lineWidth(),Math.max(2,this.lineWidth()),o).toFixed(2)),e.setAttribute(`opacity`,$(u,1,o).toFixed(3));this.middle.setAttribute(`d`,this.linePath(0,r,Pn,308-Pn,a)),this.middle.setAttribute(`opacity`,(u*(1-qn(Q(n/180)))).toFixed(3));for(let e=0;e<3;e+=1){let t=3-e;this.lines[e].setAttribute(`d`,this.linePath(t,r,0,308,a)),this.lines[e].setAttribute(`opacity`,((.1+r*.1)*(1-Q(n/200))).toFixed(3))}this.track.setAttribute(`opacity`,(.1*Q((i-.4)/.6)).toFixed(3))}paintJoin(e,t){let n=(1-Math.cos(Math.PI*t/360))/2,r=-Math.PI/2+Yn(!1)*t,i=Ln/Mn,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+Rn*a*n;if(this.motion.matches||t>=360){this.stage={kind:`spin`,startedAt:e,base:o-Z*.14},this.settleSuccess&&this.beginSuccess(e),this.paint(e);return}this.track.setAttribute(`opacity`,`0.1`);for(let[e,t]of[[this.top,o],[this.bottom,r+Math.PI-(1-Rn)*a*n]])e.setAttribute(`d`,Qn({start:t,sweep:i})),e.setAttribute(`stroke-width`,`2`),e.setAttribute(`opacity`,`1`)}spinnerArc(e,t){let n=e-t.startedAt,r=this.motion.matches?2600:1500,i=(n+r/2)%r/r,a=i<.5,o=Gn(a?i/.5:(i-.5)/.5),s=a?$(1,56,o):$(56,1,o),c=a?$(0,-14,o):$(-14,-99,o);return{start:t.base+Yn(this.motion.matches)*n-Z*c/100,sweep:Z*s/100}}beginSuccess(e){if(this.stage.kind!==`spin`)return;this.stage={kind:`success`,startedAt:e,from:this.spinnerArc(e,this.stage)};let t=this.successBegun;this.successBegun=null,t?.()}paintSuccess(e,t){let n=e-t.startedAt;if(n>=1140){this.stage={kind:`sealed`},this.settle(),this.paint(e);return}let r=Q(n/650),i=this.motion.matches?0:Yn(!1)*650*(r-r*r/2),a=Wn(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Z,a)},Kn(Q((n-600)/420)),Wn(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=qn(o);this.ripple.setAttribute(`r`,$(Vn,34,e).toFixed(2)),this.ripple.setAttribute(`opacity`,((1-e)*.45).toFixed(3))}}paintSeal(e,t,n){this.paintArc(e,1),this.seal.setAttribute(`r`,(Vn*Math.max(0,t)).toFixed(2)),this.seal.setAttribute(`opacity`,t>0?`1`:`0`),this.check.setAttribute(`stroke-dashoffset`,(1-n).toFixed(3)),this.check.setAttribute(`opacity`,n>0?`1`:`0`)}paintArc(e,t){this.track.setAttribute(`opacity`,String(.1*t)),this.top.setAttribute(`d`,Qn(e)),this.top.setAttribute(`stroke-width`,`2`),this.top.setAttribute(`opacity`,`1`)}displacement(e,t,n){let r=n/308,i=Math.sin(Math.PI*r)**1.7;if(this.motion.matches)return t*5*i;let a=Math.sin(r*Math.PI*4-this.position+e*.5)*.7+Math.sin(r*Math.PI*7+this.position*.7+e)*.3;return t*(26-e*4)*i*a}linePath(e,t,n,r,i){let a=``,o=Math.max(2,Math.ceil((r-n)/2));for(let s=0;s<=o;s+=1){let c=n+(r-n)*s/o,l=32+this.displacement(e,t,c)*i;a+=`${s===0?`M`:`L`}${c.toFixed(2)},${l.toFixed(2)} `}return a}halfPath(e,t,n,r,i){let a=``,o=Math.max(2,Math.ceil((t-e)/1.5));for(let s=0;s<=o;s+=1){let c=Xn(e+(t-e)*s/o),l=n?308-c.x:c.x,u=n?64-c.y:c.y;c.onLine&&(u+=this.displacement(0,r,l)*i),a+=`${s===0?`M`:`L`}${l.toFixed(2)},${u.toFixed(2)} `}return a}};function Yn(e){return Z/(e?3200:1800)}function Xn(e){if(e<=Pn)return{x:e,y:32,onLine:!0};if(e<In){let t=e-Pn,n=0,r=Fn.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Fn.lengths[e]<t?n=e:r=e}let i=(t-Fn.lengths[n])/(Fn.lengths[r]-Fn.lengths[n]||1);return{x:$(Fn.points[n][0],Fn.points[r][0],i),y:$(Fn.points[n][1],Fn.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-In)/Mn;return{x:154+Mn*Math.cos(t),y:32+Mn*Math.sin(t),onLine:!1}}function Zn(){let e=[[Pn,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[Pn+Nn*i,32-Mn*(4*i**3-3*i**4)],o=e[e.length-1];n+=Math.hypot(a[0]-o[0],a[1]-o[1]),e.push(a),t.push(n)}return{points:e,lengths:t,length:n}}function Qn(e){let t=Math.max(2,Math.ceil(80*e.sweep/Z)),n=``;for(let r=0;r<=t;r+=1){let i=e.start+e.sweep*r/t,a=154+Mn*Math.cos(i),o=32+Mn*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function $n(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function er(e,t,n,r){let i=(e,t,n)=>((1-3*n+3*t)*e+(3*n-6*t))*e*e+3*t*e,a=(e,t,n)=>3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t;return o=>{if(o<=0)return 0;if(o>=1)return 1;let s=o;for(let t=0;t<6;t+=1){let t=a(s,e,n);if(t===0)break;s-=(i(s,e,n)-o)/t}return i(Q(s),t,r)}}function Q(e){return e<0?0:e>1?1:e}function $(e,t,n){return e+(t-e)*n}const tr=An,nr={light:{core:`#8b98a5`,above:`#cfd9de`,mid:`#aab8c2`,below:`#657786`},dark:{core:`#ffffff`,above:`#8b98a5`,mid:`#cfd9de`,below:`#536471`}};function rr(e){let t=e.trim();return Object.hasOwn(Et,t)?t:`ocean`}var ir=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new Jn(e,n),this.element=this.ribbon.element,this.glow=e.createElement(`div`),this.glow.className=`seams-voiceid-glow`,this.glow.setAttribute(`aria-hidden`,`true`),this.render(),queueMicrotask(this.render);let r=c();if(r)for(let e of this.glow.querySelectorAll(`style`))e.nonce=r;this.themeObserver=new MutationObserver(this.render),this.themeObserver.observe(e.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),this.themeObserver.observe(e.body,{attributes:!0,attributeFilter:[`data-theme`]})}setLineStyle(e){this.ribbon.setLineStyle(e)}listen(){this.setPhase(`listening`)}add(e){this.ribbon.add(e)}checking(){this.setPhase(`processing`)}accept(){this.setPhase(`idle`)}flatten(){this.disposed||(this.phase=`processing`,this.ribbon.setPhase(`idle`),this.render())}ready(){this.setPhase(`idle`)}succeed(e){return this.disposed?Promise.resolve():(this.phase=`idle`,this.render(),this.ribbon.succeed(e))}stop(){this.disposed||(this.disposed=!0,this.themeObserver.disconnect(),this.ribbon.dispose(),we(null,this.glow))}setPhase(e){this.disposed||(this.phase=e,this.ribbon.setPhase(e),this.render())}render=()=>{if(this.disposed)return;let e=getComputedStyle(this.prompt).getPropertyValue(`--seams-colors-voiceBeam`).trim();if(this.glow.hidden=e===`none`,this.glow.hidden){we(null,this.glow);return}let t=(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,n=rr(e);we(R(tr,{className:`seams-voiceid-beam`,theme:t,...n===`mono`?{bandColors:nr[t]}:{},level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:n,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const ar=`
296
296
  .seams-voiceid-activation-surface { width: min(100%, 26.25rem); margin: 0 auto; background: transparent; }
297
297
  /* Inside an operation's card the card is the frame: the prompt fills it edge to edge. */
298
298
  .seams-voiceid-activation-surface.seams-voiceid-in-card { width: 100%; }
@@ -311,6 +311,9 @@ ${Oe.split(`{id}`).join(Pe)}`:tn}),J(`div`,{...Me,ref:on,"data-voice-beam":Pe,"d
311
311
  margin: 0 auto;
312
312
  padding: 3.5rem 1.5rem 1.5rem;
313
313
  display: grid;
314
+ /* One column, never wider than the card: a long word in one row (an account of 64 characters)
315
+ must not push the other rows, such as the receipt and the button, out of the card. */
316
+ grid-template-columns: minmax(0, 1fr);
314
317
  /* Named rows. The context row is empty (0 high) unless the card shows the text that its sentence
315
318
  speaks for. A host that sets its own rows keeps these names. */
316
319
  grid-template-rows: [context] auto [title] auto [phrase] minmax(6rem, auto) [line] 5rem [status] minmax(3.375rem, auto) [action] minmax(5rem, auto);
@@ -580,6 +583,8 @@ ${Oe.split(`{id}`).join(Pe)}`:tn}),J(`div`,{...Me,ref:on,"data-voice-beam":Pe,"d
580
583
  .seams-voiceid-prompt > :not(.seams-voiceid-glow) { position: relative; z-index: 1; }
581
584
  .seams-voiceid-prompt > .seams-voiceid-close { position: absolute; }
582
585
  .seams-voiceid-prompt .seams-voiceid-status {
586
+ /* A word that is longer than the line breaks inside the card. */
587
+ overflow-wrap: anywhere;
583
588
  font-size: 0.75rem;
584
589
  line-height: 1.5;
585
590
  min-height: 3.375rem;
@@ -813,6 +818,56 @@ ${Oe.split(`{id}`).join(Pe)}`:tn}),J(`div`,{...Me,ref:on,"data-voice-beam":Pe,"d
813
818
  color: var(--seams-colors-textPrimary, #eff2f3);
814
819
  }
815
820
  .seams-voiceid-status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
821
+ /* A result's receipt (PhraseResultView.receipt): a quiet box between the caption and the detail,
822
+ with a checked row for each check of the result, in the seal's colour. */
823
+ .seams-voiceid-status .seams-voiceid-receipt {
824
+ margin: 0.625rem 0;
825
+ padding: 0.625rem 0.875rem;
826
+ border: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
827
+ border-radius: 0.875rem;
828
+ text-align: left;
829
+ font-size: 0.8125rem;
830
+ line-height: 1.45;
831
+ color: var(--seams-colors-textPrimary, #eff2f3);
832
+ }
833
+ .seams-voiceid-receipt-head {
834
+ display: flex;
835
+ justify-content: space-between;
836
+ align-items: baseline;
837
+ gap: 0.5rem;
838
+ margin-bottom: 0.375rem;
839
+ }
840
+ .seams-voiceid-receipt-source {
841
+ font-size: 0.75rem;
842
+ color: var(--seams-colors-textSecondary, #9aa4ab);
843
+ }
844
+ .seams-voiceid-receipt-rows {
845
+ display: grid;
846
+ grid-template-columns: 1rem auto minmax(0, 1fr);
847
+ column-gap: 0.5rem;
848
+ row-gap: 0.25rem;
849
+ align-items: center;
850
+ }
851
+ .seams-voiceid-receipt-check {
852
+ display: flex;
853
+ color: var(--seams-colors-voiceSeal, var(--seams-colors-voiceLine, var(--seams-colors-textPrimary, #eff2f3)));
854
+ }
855
+ .seams-voiceid-receipt-check svg {
856
+ fill: none;
857
+ stroke: currentColor;
858
+ stroke-width: 2.4;
859
+ stroke-linecap: round;
860
+ stroke-linejoin: round;
861
+ }
862
+ .seams-voiceid-receipt-label { color: var(--seams-colors-textSecondary, #9aa4ab); }
863
+ .seams-voiceid-receipt-value { overflow-wrap: anywhere; }
864
+ .seams-voiceid-receipt-foot {
865
+ display: block;
866
+ margin-top: 0.5rem;
867
+ padding-top: 0.5rem;
868
+ border-top: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
869
+ font-size: 0.75rem;
870
+ }
816
871
  .seams-voiceid-heard-mark {
817
872
  background: none;
818
873
  color: var(--seams-colors-error, oklch(0.74 0.166 19));
@@ -1055,4 +1110,4 @@ ${Oe.split(`{id}`).join(Pe)}`:tn}),J(`div`,{...Me,ref:on,"data-voice-beam":Pe,"d
1055
1110
  .seams-voiceid-close:hover { background: var(--seams-colors-surface, #202b31); }
1056
1111
  .seams-voiceid-primary:hover:not(:disabled) { opacity: 0.9; }
1057
1112
  }
1058
- `,ar=new WeakSet;function or(e){if(ar.has(e))return;ar.add(e);try{let t=new CSSStyleSheet;t.replaceSync(ir),e.adoptedStyleSheets=[...e.adoptedStyleSheets,t];return}catch{}let t=e.createElement(`style`),n=c();n&&t.setAttribute(`nonce`,n),t.textContent=ir,(e.head??e.documentElement).appendChild(t)}var sr=class{element;title;phrase;status;record;cancel;progress;ribbon;actionRow;microphone;microphoneRequested=!1;visual;disposed=!1;pendingChange=null;changing=null;laidOut=!1;hidden=!1;sizes=new ResizeObserver(this.observeSize.bind(this));frameFill=0;onFrameFitted=[];constructor(e,t,n,r=`ring`,i=e=>e){this.display=i,or(e),this.element=e.createElement(`section`),this.element.className=`seams-voiceid-prompt`,this.element.setAttribute(`aria-label`,t),this.title=e.createElement(`h2`),this.title.textContent=`Read aloud`,this.phrase=e.createElement(`p`),this.phrase.className=`seams-voiceid-phrase`,this.phrase.dataset.voiceidPhrase=``,this.phrase.setAttribute(`aria-live`,`polite`),this.setPhrase(n),this.visual=new rr(e,this.element,r),this.status=e.createElement(`p`),this.status.className=`seams-voiceid-status`,this.status.setAttribute(`role`,`status`),this.record=e.createElement(`button`),this.record.type=`button`,this.record.className=`seams-voiceid-primary`,this.record.textContent=`Record`,this.cancel=Mr(e,`Cancel`,Tr),this.progress=e.createElement(`div`),this.progress.className=`seams-voiceid-progress-slot`;let a=e.createElement(`div`);a.className=`seams-voiceid-record-slot`,this.actionRow=a,this.ribbon=this.visual.element,this.microphone=e.createElement(`button`),this.microphone.type=`button`,this.microphone.className=`seams-voiceid-microphone`,this.microphone.textContent=`Use system microphone`,this.microphone.hidden=!0,this.microphone.addEventListener(`click`,this.changeMicrophone),a.append(this.record,this.microphone),this.element.append(this.visual.glow,this.cancel,this.title,this.phrase,this.visual.element,this.status,a,this.progress),this.sizes.observe(this.element)}useVoiceLine(e){this.element.dataset.voiceLine=e,this.visual.setLineStyle(e)}showContext(e,t){let n=this.element.ownerDocument,r=n.createElement(`figure`);r.className=`seams-voiceid-context`;let i=n.createElement(`figcaption`);i.className=`seams-voiceid-context-label`,i.textContent=e;let a=n.createElement(`blockquote`);a.textContent=t,r.append(i,a),this.title.before(r),this.element.append(kr(n)),this.element.dataset.context=``}showBack(e){if(e){this.cancel.setAttribute(`aria-label`,`Close`);let e=Mr(this.element.ownerDocument,`Back`,Er);return e.classList.add(`seams-voiceid-back`),this.cancel.before(e),e}return this.cancel.classList.add(`seams-voiceid-back`),this.cancel.setAttribute(`aria-label`,`Back`),this.cancel.querySelector(`path`)?.setAttribute(`d`,Er),this.cancel}showMinimize(){let e=Mr(this.element.ownerDocument,`Minimize`,Dr);return e.classList.add(`seams-voiceid-minimize`),this.cancel.before(e),e}change(e){return this.pendingChange=_r(this.pendingChange,e),this.changing??=this.drainChanges().finally(this.changesDrained),this.changing}changesDrained=()=>{this.changing=null};async drainChanges(){let e=[];for(;this.pendingChange&&!this.disposed;){let t=this.pendingChange;this.pendingChange=null;let n=this.changingRows(t).filter(t=>!e.includes(t));if(n.length>0&&!gr()){if(await Promise.all(n.map(br)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=_r(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),xr(e),e=[]}}changingRows(e){let t=[];e.title!==void 0&&e.title!==this.title.textContent&&t.push(this.title),e.phrase!==void 0&&e.phrase!==this.phrase.dataset.voiceidPhrase&&t.push(this.phrase),e.status!==void 0&&e.status!==this.status.textContent&&t.push(this.status);let n=e.action;return n&&(n.label!==void 0&&n.label!==this.record.textContent||n.hidden!==void 0&&n.hidden!==this.record.hidden)&&t.push(this.actionRow),t}rowOrder(e){return[this.title,this.phrase,this.status,this.actionRow].filter(t=>e.includes(t))}writeChange(e){e.title!==void 0&&(this.title.textContent=e.title),e.phrase!==void 0&&this.setPhrase(e.phrase),e.status!==void 0&&(this.status.textContent=e.status),e.action?.label!==void 0&&(this.record.textContent=e.action.label),e.action?.hidden!==void 0&&(this.record.hidden=e.action.hidden),e.apply?.()}readyChange(e,t={}){return this.change({...t,status:e,action:{...t.action,hidden:!1},apply:()=>{t.apply?.(),this.unlockLayout(),this.visual.ready(),this.element.dataset.capture=`ready`,this.record.disabled=!1,this.microphone.hidden=!this.microphoneRequested}})}skipEntrance(){this.element.classList.add(`seams-voiceid-entered`)}fillFrame(e=window.innerHeight,t=`top`,n){n&&this.onFrameFitted.push(n);let r=this.element.closest(`.seams-voiceid-hugged`);if(!r||this.disposed){this.frameFitted();return}let i=++this.frameFill,a=t===`center`||this.element.dataset.frameFill===`center`;this.element.style.minHeight=``,r.style.height=``,delete this.element.dataset.frameFill;let o=this.element.getBoundingClientRect().height;if(e<=o+1){this.frameFitted();return}r.style.height=`${o}px`,a&&(this.element.dataset.frameFill=`center`);let s=e;this.element.style.minHeight=`${s}px`;let c=0,l=performance.now(),u=()=>{if(!(i!==this.frameFill||this.disposed)){if(s=Math.min(s,Math.max(window.innerHeight,o)),this.element.style.minHeight=`${s}px`,c=window.innerHeight<=o+1?c+1:0,c<2&&performance.now()-l<hr){requestAnimationFrame(u);return}this.element.style.minHeight=``,r.style.height=``,delete this.element.dataset.frameFill,this.frameFitted()}};requestAnimationFrame(u)}releaseRows=()=>{delete this.element.dataset.rowsHeld,xr(this.rows())};frameFitted(){for(let e of this.onFrameFitted.splice(0))e()}rows(){return[...this.element.children].filter(e=>!e.matches(`.seams-voiceid-glow, .seams-voiceid-close, .seams-voiceid-progress-slot`))}observeSize(e){let t=e.at(-1)?.contentRect;if(!t||this.disposed)return;if(t.height===0){if(!this.laidOut)return;this.hidden=!0,this.skipEntrance();return}if(!this.laidOut){this.laidOut=!0,this.element.classList.contains(`seams-voiceid-entered`)||xr(this.rows());return}if(!this.hidden)return;this.hidden=!1,this.element.dataset.rowsHeld=``,this.fillFrame(window.innerHeight,`center`,this.releaseRows);let n=this.element.ownerDocument.activeElement;(!n||n===this.element.ownerDocument.body)&&(this.element.tabIndex=-1,this.element.focus({preventScroll:!0}))}setPhrase(e){let t=this.display(e);this.phrase.textContent=t.charAt(0).toUpperCase()+t.slice(1)+`.`,this.phrase.dataset.voiceidPhrase=e}capture=e=>{if(!this.disposed)switch(e.kind){case`opening`:this.microphoneRequested=!0,this.microphone.hidden=!0;return;case`listening`:this.microphone.hidden=!0,this.element.dataset.capture=`listening`,this.change({status:`Listening`,action:{hidden:!0}}),this.visual.listen();return;case`activity`:this.visual.add(e);return;case`measured`:e.quality.noise===`high`&&(this.status.textContent=`Background noise is high. Move closer to the microphone.`);return;case`processing`:this.element.dataset.capture=`processing`,this.lockLayout(),this.visual.checking(),this.change({status:`Checking your voice…`});return;default:return pr(e)}};continueFrom(e){this.skipEntrance(),this.element.tabIndex=-1;let t=e.querySelector(`:scope > h2`)?.textContent,n=e.querySelector(`:scope > .seams-voiceid-status`)?.textContent,r=e.querySelector(`:scope > .seams-voiceid-record-slot > .seams-voiceid-primary`);t!=null&&(this.title.textContent=t),n!=null&&(this.status.textContent=n),r&&(this.record.textContent=r.textContent,this.record.hidden=r.hidden);let i=[[e.querySelector(`:scope > h2`),this.title],[e.querySelector(`:scope > .seams-voiceid-phrase`),this.phrase],[e.querySelector(`:scope > .seams-voiceid-status`),this.status],[e.querySelector(`:scope > .seams-voiceid-record-slot`),this.actionRow]].flatMap(([e,t])=>{let n=e?Number(getComputedStyle(e).opacity):1;return n<.99?[{row:t,opacity:n}]:[]});i.length>0&&queueMicrotask(()=>i.forEach(Cr))}accepted(){this.visual.accept()}flattenLine(){this.visual.flatten()}quietLine(){this.visual.ready()}async succeed(e,t,n=this.element.getBoundingClientRect()){this.disposed||(this.element.dataset.capture=`succeeded`,this.record.hidden=!0,this.microphone.hidden=!0,await this.visual.succeed(this.beginSuccess.bind(this,e,t,n)))}ready(e){this.unlockLayout(),this.visual.ready(),this.element.dataset.capture=`ready`,this.status.textContent=e,this.record.hidden=!1,this.record.disabled=!1,this.microphone.hidden=!this.microphoneRequested}changeMicrophone=()=>{this.useSystemMicrophone()};async useSystemMicrophone(){this.record.disabled=!0,this.microphone.disabled=!0,await o(),!this.disposed&&(this.status.textContent=`The next recording will use your system microphone.`,this.record.disabled=!1,this.microphone.disabled=!1,this.microphone.hidden=!0,this.record.focus())}dispose(){this.disposed=!0,this.sizes.disconnect(),this.microphone.removeEventListener(`click`,this.changeMicrophone),this.visual.stop()}lockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=`${e.getBoundingClientRect().height}px`;this.element.style.height=this.element.style.minHeight}async beginSuccess(e,t,n){if(this.disposed)return;let r=this.visual.element.getBoundingClientRect(),i=(n.top+n.bottom-r.top-r.bottom)/2;if(this.visual.element.animate([{translate:`0 0`},{translate:`0 ${i}px`}],{duration:600,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`forwards`}),await Promise.all([this.title,this.phrase,this.status].map(dr)),this.disposed)return;this.phrase.textContent=e,this.phrase.classList.add(`seams-voiceid-success-headline`),this.status.textContent=t,this.status.classList.add(`seams-voiceid-success-message`);let a=matchMedia(`(prefers-reduced-motion: reduce)`).matches;for(let[e,t]of[this.phrase,this.status].entries())t.style.translate=`0 ${i}px`,fr(t,a,lr-cr+e*ur)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const cr=150,lr=450,ur=40;function dr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function fr(e,t,n){e.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:1,transform:`none`}],{delay:n,duration:300,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`both`})}function pr(e){throw Error(`Unexpected capture event: ${String(e)}`)}const mr=`seams-voiceid-row`,hr=800;function gr(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function _r(e,t){if(!e)return t;let n=[e.apply,t.apply].filter(e=>e!==void 0);return{...e,...t,action:e.action||t.action?{...e.action,...t.action}:void 0,apply:n.length===0?void 0:()=>n.forEach(vr)}}function vr(e){e()}function yr(e){for(let t of e.getAnimations())t.id===mr&&t.cancel()}function br(e){let t=Number(getComputedStyle(e).opacity);return yr(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:mr}).finished.catch(Sr)}function xr(e){let t=gr();for(let[n,r]of e.entries()){yr(r);let e=Number(getComputedStyle(r).opacity);e!==0&&r.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:e,transform:`none`}],{delay:t?0:0+n*20,duration:t?150:140,easing:l,fill:`backwards`,id:mr})}}function Sr(){}function Cr({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:140*(1-t),easing:l,id:mr})}function wr(e){if(!e.isConnected||gr()){e.remove();return}e.inert=!0,e.classList.remove(`seams-auth-method-activation-surface`),delete e.dataset.seamsVoiceidHandoff;let t=e.getBoundingClientRect();e.style.position=`fixed`,e.style.top=`${t.top}px`,e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,e.style.margin=`0`,e.style.pointerEvents=`none`;let n=Number(getComputedStyle(e).opacity);e.animate([{opacity:n},{opacity:0}],{duration:150*n,easing:`ease-in`,fill:`forwards`}).finished.catch(Sr).finally(()=>e.remove())}const Tr=`M6 6l12 12M18 6L6 18`,Er=`m15 18-6-6 6-6`,Dr=`M6 12h12`,Or=[`M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1-6 0z`,`M5 10a7 7 0 0 0 14 0`,`M8 21h8`,`M12 17v4`];function kr(e){let t=e.createElement(`span`);t.className=`seams-voiceid-line-icon`,t.setAttribute(`aria-hidden`,`true`);let n=Ar(e,`seams-voiceid-line-icon-microphone`);for(let t of Or)n.append(jr(e,t,`1.8`));let r=Ar(e,`seams-voiceid-line-icon-check`),i=jr(e,`M5 12.5l4.5 4.5L19 7.5`,`2.6`);return i.setAttribute(`pathLength`,`1`),r.append(i),t.append(n,r),t}function Ar(e,t){let n=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`class`,t),n}function jr(e,t,n){let r=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);return r.setAttribute(`d`,t),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,n),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),r}function Mr(e,t,n){let r=e.createElement(`button`);r.type=`button`,r.className=`seams-voiceid-close`,r.setAttribute(`aria-label`,t);let i=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);i.setAttribute(`viewBox`,`0 0 24 24`),i.setAttribute(`width`,`20`),i.setAttribute(`height`,`20`),i.setAttribute(`aria-hidden`,`true`);let a=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);return a.setAttribute(`d`,n),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`stroke-width`,`1.75`),a.setAttribute(`stroke-linecap`,`round`),i.append(a),r.append(i),r}const Nr=`Say this with your voice`,Pr=[`colorBackground`,`textPrimary`,`textSecondary`,`textMuted`,`borderPrimary`,`surface`,`surface3`,`buttonBackground`,`textButton`,`error`,`info`,`voiceLine`,`voiceEcho`,`voiceEchoDeep`,`voiceFill`,`voicePixelBackground`];function Fr(e){return new Ir(e)}var Ir=class{element;prompt;card;unmounted;outer;detector;pressed;back;minimize;minimizedHook;progressedHook;minimized=!1;progress=``;recorder=null;recording=null;choice=null;view=null;started=!1;closed=!1;autoStart;expectedSpeechMs;speechDetectorReady=!1;constructor(e){let{sentence:n,frame:r={}}=e,i=e.signal;this.outer=i,this.detector=e.detector,this.autoStart=e.autoStart===!0,this.expectedSpeechMs=t(n);let a=document.querySelector(`.seams-voiceid-activation-surface[data-seams-voiceid-handoff]`);e.detector===`level`?this.speechDetectorReady=!0:s.prepare().then(this.detectorStarted,zr);let o=r.parent??document.body;this.element=document.createElement(`section`),this.element.className=[`seams-voiceid-activation-surface`,r.className].filter(Boolean).join(` `),this.element.setAttribute(`role`,`dialog`),this.element.setAttribute(`aria-modal`,`true`),this.element.setAttribute(`aria-label`,Nr),Lr(this.element,e.colors),this.prompt=new sr(document,Nr,n);let c=e.context?.sentenceLabel??`Say this sentence`;this.prompt.title.textContent=c;let l=/[.!?]$/.test(n)?n:`${n}.`;this.prompt.phrase.textContent=l,delete this.prompt.phrase.dataset.voiceidPhrase,this.prompt.status.textContent=``,this.prompt.record.textContent=`Record`;let u=r.controls??`close`;this.pressed=r.pressed;let d=u===`close`?null:this.prompt.showBack(u===`back_and_close`);e.context&&this.prompt.showContext(e.context.label,e.context.text),this.back=d===this.prompt.cancel?null:d,this.minimizedHook=r.minimized,this.progressedHook=r.progressed,this.minimize=r.minimized?this.prompt.showMinimize():null;let f=a?.querySelector(`:scope > .seams-voiceid-prompt`)??null,p=f?Br(f):null;f&&(this.prompt.continueFrom(f),this.prompt.record.hidden=!0,this.autoStart=!1),this.card=new h(this.prompt,{label:c,sentence:l,message:``,action:`Record`},p),this.autoStart&&(this.prompt.record.hidden=!0,this.prompt.element.dataset.autoStart=``,this.prompt.element.tabIndex=-1),this.element.append(this.prompt.element),this.prompt.record.addEventListener(`click`,this.press);let m=u===`back`?this.pressBack:this.pressClose;this.prompt.cancel.addEventListener(`click`,m),this.back?.addEventListener(`click`,this.pressBack),this.minimize?.addEventListener(`click`,this.pressMinimize),this.element.addEventListener(`cancel`,this.cancel),i.addEventListener(`abort`,this.cancel),a?a.replaceWith(this.element):o.appendChild(this.element);let g=e.voiceLine??Rr(this.prompt.element);g===`pixels`&&this.prompt.useVoiceLine(g),r.hugged&&this.element.classList.add(`seams-voiceid-hugged`),this.unmounted=r.mounted?.(this.element),p||this.autoStart?this.prompt.element.focus({preventScroll:!0}):this.prompt.record.focus(),i.aborted&&this.cancel()}record(){if(this.closed)return Promise.resolve({kind:`cancelled`});this.settleChoice(`replaced`),this.recording?.resolve({kind:`cancelled`});let e=Vr();return this.recording=e,this.view?(this.view=null,this.report({stage:`recording`,done:0,total:0}),this.card.showPrompt()):this.autoStart&&this.begin(e),this.autoStart=!1,e.promise}show(e){if(delete this.prompt.element.dataset.autoStart,this.closed)return Promise.resolve(`closed`);if(this.settleChoice(`replaced`),this.view=e,e.kind===`check`){let t=e.segments.filter(e=>e===`done`||e===`skip`).length;this.report({stage:`checking`,done:t,total:e.segments.length})}else this.report({stage:`result`,done:0,total:0}),this.needPerson();return this.card.show(e),new Promise(e=>{this.choice=e})}close(){this.closed||(this.closed=!0,this.recorder?.abort(),this.recording?.resolve({kind:`cancelled`}),this.settleChoice(`closed`),this.unmounted?.(),this.outer.removeEventListener(`abort`,this.cancel),this.element.removeEventListener(`cancel`,this.cancel),this.prompt.record.removeEventListener(`click`,this.press),this.prompt.cancel.removeEventListener(`click`,this.pressBack),this.prompt.cancel.removeEventListener(`click`,this.pressClose),this.back?.removeEventListener(`click`,this.pressBack),this.minimize?.removeEventListener(`click`,this.pressMinimize),this.card.dispose(),this.prompt.dispose(),wr(this.element))}press=()=>{if(this.view){this.view.kind===`result`&&!this.view.action.busy&&this.settleChoice(`action`);return}!this.recording||this.started||this.begin(this.recording)};begin(t){this.started=!0,this.report({stage:`recording`,done:0,total:0}),this.prompt.record.disabled=!0,this.prompt.status.textContent=this.speechDetectorReady?`Opening microphone…`:`Loading ${e().label}…`,this.attempt(t,this.autoStart)}async attempt(e,t=!1){let o=new AbortController;this.recorder=o;try{let t=await i(o.signal,this.capture,{expectedSpeechMs:this.expectedSpeechMs,detector:this.detector});if(this.recording!==e||this.closed){t.samples?.fill(0);return}if(t.kind===`insufficient_audio`){this.retry(r(t.quality));return}let n=t.lastSoundAtMs??performance.now();this.started=!1,this.recording=null,e.resolve({kind:`recorded`,samples:t.samples,endOfSpeechAt:n})}catch(r){if(this.recording!==e||this.closed)return;if(r instanceof a){this.retry(r.message);return}if(t&&r instanceof n){this.retry(``,`Record`);return}this.started=!1,this.recording=null,e.reject(r instanceof Error?r:Error(String(r)))}}detectorStarted=()=>{this.speechDetectorReady=!0};capture=e=>{e.kind===`processing`?(this.report({stage:`checking`,done:0,total:0}),this.card.beginCheck()):this.prompt.capture(e)};retry(e,t=`Try again`){this.started=!1,delete this.prompt.element.dataset.autoStart,this.prompt.record.textContent=t,this.prompt.ready(e),this.prompt.record.focus(),this.report({stage:`recording`,done:0,total:0}),this.needPerson()}report(e){let t=`${e.stage}:${e.done}:${e.total}`;t===this.progress||this.closed||(this.progress=t,this.progressedHook?.(e))}pressMinimize=()=>{this.closed||(this.minimized=!0,this.minimizedHook?.(!0))};needPerson(){this.minimized&&(this.minimized=!1,this.minimizedHook?.(!1))}settleChoice(e){let t=this.choice;this.choice=null,t?.(e)}pressBack=()=>this.pressControl(`back`);pressClose=()=>this.pressControl(`close`);pressControl(e){this.view?.kind!==`check`&&(this.pressed?.(e),this.cancel())}cancel=()=>{this.view?.kind===`check`&&!this.outer.aborted||(this.recording&&(this.recorder?.abort(),this.recording.resolve({kind:`cancelled`}),this.recording=null,this.started=!1),this.settleChoice(`closed`),this.outer.aborted&&this.close())}};function Lr(e,t){if(t)for(let n of Pr){let r=t[n];r&&e.style.setProperty(`--seams-colors-${n}`,r)}}function Rr(e){return getComputedStyle(e).getPropertyValue(`--seams-shape-voiceLine`).trim()===`pixels`?`pixels`:`wave`}function zr(){}function Br(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function Vr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{h as PhraseCard,sr as VoicePrompt,qn as VoiceRibbon,rr as VoiceVisual,wr as leaveSurface,Fr as openPhraseCard};
1113
+ `,or=new WeakSet;function sr(e){if(or.has(e))return;or.add(e);try{let t=new CSSStyleSheet;t.replaceSync(ar),e.adoptedStyleSheets=[...e.adoptedStyleSheets,t];return}catch{}let t=e.createElement(`style`),n=c();n&&t.setAttribute(`nonce`,n),t.textContent=ar,(e.head??e.documentElement).appendChild(t)}var cr=class{element;title;phrase;status;record;cancel;progress;ribbon;actionRow;microphone;microphoneRequested=!1;visual;disposed=!1;pendingChange=null;changing=null;laidOut=!1;hidden=!1;sizes=new ResizeObserver(this.observeSize.bind(this));frameFill=0;onFrameFitted=[];constructor(e,t,n,r=`ring`,i=e=>e){this.display=i,sr(e),this.element=e.createElement(`section`),this.element.className=`seams-voiceid-prompt`,this.element.setAttribute(`aria-label`,t),this.title=e.createElement(`h2`),this.title.textContent=`Read aloud`,this.phrase=e.createElement(`p`),this.phrase.className=`seams-voiceid-phrase`,this.phrase.dataset.voiceidPhrase=``,this.phrase.setAttribute(`aria-live`,`polite`),this.setPhrase(n),this.visual=new ir(e,this.element,r),this.status=e.createElement(`p`),this.status.className=`seams-voiceid-status`,this.status.setAttribute(`role`,`status`),this.record=e.createElement(`button`),this.record.type=`button`,this.record.className=`seams-voiceid-primary`,this.record.textContent=`Record`,this.cancel=Nr(e,`Cancel`,Er),this.progress=e.createElement(`div`),this.progress.className=`seams-voiceid-progress-slot`;let a=e.createElement(`div`);a.className=`seams-voiceid-record-slot`,this.actionRow=a,this.ribbon=this.visual.element,this.microphone=e.createElement(`button`),this.microphone.type=`button`,this.microphone.className=`seams-voiceid-microphone`,this.microphone.textContent=`Use system microphone`,this.microphone.hidden=!0,this.microphone.addEventListener(`click`,this.changeMicrophone),a.append(this.record,this.microphone),this.element.append(this.visual.glow,this.cancel,this.title,this.phrase,this.visual.element,this.status,a,this.progress),this.sizes.observe(this.element)}useVoiceLine(e){this.element.dataset.voiceLine=e,this.visual.setLineStyle(e)}showContext(e,t){let n=this.element.ownerDocument,r=n.createElement(`figure`);r.className=`seams-voiceid-context`;let i=n.createElement(`figcaption`);i.className=`seams-voiceid-context-label`,i.textContent=e;let a=n.createElement(`blockquote`);a.textContent=t,r.append(i,a),this.title.before(r),this.element.append(Ar(n)),this.element.dataset.context=``}showBack(e){if(e){this.cancel.setAttribute(`aria-label`,`Close`);let e=Nr(this.element.ownerDocument,`Back`,Dr);return e.classList.add(`seams-voiceid-back`),this.cancel.before(e),e}return this.cancel.classList.add(`seams-voiceid-back`),this.cancel.setAttribute(`aria-label`,`Back`),this.cancel.querySelector(`path`)?.setAttribute(`d`,Dr),this.cancel}showMinimize(){let e=Nr(this.element.ownerDocument,`Minimize`,Or);return e.classList.add(`seams-voiceid-minimize`),this.cancel.before(e),e}change(e){return this.pendingChange=vr(this.pendingChange,e),this.changing??=this.drainChanges().finally(this.changesDrained),this.changing}changesDrained=()=>{this.changing=null};async drainChanges(){let e=[];for(;this.pendingChange&&!this.disposed;){let t=this.pendingChange;this.pendingChange=null;let n=this.changingRows(t).filter(t=>!e.includes(t));if(n.length>0&&!_r()){if(await Promise.all(n.map(xr)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=vr(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),Sr(e),e=[]}}changingRows(e){let t=[];e.title!==void 0&&e.title!==this.title.textContent&&t.push(this.title),e.phrase!==void 0&&e.phrase!==this.phrase.dataset.voiceidPhrase&&t.push(this.phrase),e.status!==void 0&&e.status!==this.status.textContent&&t.push(this.status);let n=e.action;return n&&(n.label!==void 0&&n.label!==this.record.textContent||n.hidden!==void 0&&n.hidden!==this.record.hidden)&&t.push(this.actionRow),t}rowOrder(e){return[this.title,this.phrase,this.status,this.actionRow].filter(t=>e.includes(t))}writeChange(e){e.title!==void 0&&(this.title.textContent=e.title),e.phrase!==void 0&&this.setPhrase(e.phrase),e.status!==void 0&&(this.status.textContent=e.status),e.action?.label!==void 0&&(this.record.textContent=e.action.label),e.action?.hidden!==void 0&&(this.record.hidden=e.action.hidden),e.apply?.()}readyChange(e,t={}){return this.change({...t,status:e,action:{...t.action,hidden:!1},apply:()=>{t.apply?.(),this.unlockLayout(),this.visual.ready(),this.element.dataset.capture=`ready`,this.record.disabled=!1,this.microphone.hidden=!this.microphoneRequested}})}skipEntrance(){this.element.classList.add(`seams-voiceid-entered`)}fillFrame(e=window.innerHeight,t=`top`,n){n&&this.onFrameFitted.push(n);let r=this.element.closest(`.seams-voiceid-hugged`);if(!r||this.disposed){this.frameFitted();return}let i=++this.frameFill,a=t===`center`||this.element.dataset.frameFill===`center`;this.element.style.minHeight=``,r.style.height=``,delete this.element.dataset.frameFill;let o=this.element.getBoundingClientRect().height;if(e<=o+1){this.frameFitted();return}r.style.height=`${o}px`,a&&(this.element.dataset.frameFill=`center`);let s=e;this.element.style.minHeight=`${s}px`;let c=0,l=performance.now(),u=()=>{if(!(i!==this.frameFill||this.disposed)){if(s=Math.min(s,Math.max(window.innerHeight,o)),this.element.style.minHeight=`${s}px`,c=window.innerHeight<=o+1?c+1:0,c<2&&performance.now()-l<gr){requestAnimationFrame(u);return}this.element.style.minHeight=``,r.style.height=``,delete this.element.dataset.frameFill,this.frameFitted()}};requestAnimationFrame(u)}releaseRows=()=>{delete this.element.dataset.rowsHeld,Sr(this.rows())};frameFitted(){for(let e of this.onFrameFitted.splice(0))e()}rows(){return[...this.element.children].filter(e=>!e.matches(`.seams-voiceid-glow, .seams-voiceid-close, .seams-voiceid-progress-slot`))}observeSize(e){let t=e.at(-1)?.contentRect;if(!t||this.disposed)return;if(t.height===0){if(!this.laidOut)return;this.hidden=!0,this.skipEntrance();return}if(!this.laidOut){this.laidOut=!0,this.element.classList.contains(`seams-voiceid-entered`)||Sr(this.rows());return}if(!this.hidden)return;this.hidden=!1,this.element.dataset.rowsHeld=``,this.fillFrame(window.innerHeight,`center`,this.releaseRows);let n=this.element.ownerDocument.activeElement;(!n||n===this.element.ownerDocument.body)&&(this.element.tabIndex=-1,this.element.focus({preventScroll:!0}))}setPhrase(e){let t=this.display(e);this.phrase.textContent=t.charAt(0).toUpperCase()+t.slice(1)+`.`,this.phrase.dataset.voiceidPhrase=e}capture=e=>{if(!this.disposed)switch(e.kind){case`opening`:this.microphoneRequested=!0,this.microphone.hidden=!0;return;case`listening`:this.microphone.hidden=!0,this.element.dataset.capture=`listening`,this.change({status:`Listening`,action:{hidden:!0}}),this.visual.listen();return;case`activity`:this.visual.add(e);return;case`measured`:e.quality.noise===`high`&&(this.status.textContent=`Background noise is high. Move closer to the microphone.`);return;case`processing`:this.element.dataset.capture=`processing`,this.lockLayout(),this.visual.checking(),this.change({status:`Checking your voice…`});return;default:return mr(e)}};continueFrom(e){this.skipEntrance(),this.element.tabIndex=-1;let t=e.querySelector(`:scope > h2`)?.textContent,n=e.querySelector(`:scope > .seams-voiceid-status`)?.textContent,r=e.querySelector(`:scope > .seams-voiceid-record-slot > .seams-voiceid-primary`);t!=null&&(this.title.textContent=t),n!=null&&(this.status.textContent=n),r&&(this.record.textContent=r.textContent,this.record.hidden=r.hidden);let i=[[e.querySelector(`:scope > h2`),this.title],[e.querySelector(`:scope > .seams-voiceid-phrase`),this.phrase],[e.querySelector(`:scope > .seams-voiceid-status`),this.status],[e.querySelector(`:scope > .seams-voiceid-record-slot`),this.actionRow]].flatMap(([e,t])=>{let n=e?Number(getComputedStyle(e).opacity):1;return n<.99?[{row:t,opacity:n}]:[]});i.length>0&&queueMicrotask(()=>i.forEach(wr))}accepted(){this.visual.accept()}flattenLine(){this.visual.flatten()}quietLine(){this.visual.ready()}async succeed(e,t,n=this.element.getBoundingClientRect()){this.disposed||(this.element.dataset.capture=`succeeded`,this.record.hidden=!0,this.microphone.hidden=!0,await this.visual.succeed(this.beginSuccess.bind(this,e,t,n)))}ready(e){this.unlockLayout(),this.visual.ready(),this.element.dataset.capture=`ready`,this.status.textContent=e,this.record.hidden=!1,this.record.disabled=!1,this.microphone.hidden=!this.microphoneRequested}changeMicrophone=()=>{this.useSystemMicrophone()};async useSystemMicrophone(){this.record.disabled=!0,this.microphone.disabled=!0,await o(),!this.disposed&&(this.status.textContent=`The next recording will use your system microphone.`,this.record.disabled=!1,this.microphone.disabled=!1,this.microphone.hidden=!0,this.record.focus())}dispose(){this.disposed=!0,this.sizes.disconnect(),this.microphone.removeEventListener(`click`,this.changeMicrophone),this.visual.stop()}lockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=`${e.getBoundingClientRect().height}px`;this.element.style.height=this.element.style.minHeight}async beginSuccess(e,t,n){if(this.disposed)return;let r=this.visual.element.getBoundingClientRect(),i=(n.top+n.bottom-r.top-r.bottom)/2;if(this.visual.element.animate([{translate:`0 0`},{translate:`0 ${i}px`}],{duration:600,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`forwards`}),await Promise.all([this.title,this.phrase,this.status].map(fr)),this.disposed)return;this.phrase.textContent=e,this.phrase.classList.add(`seams-voiceid-success-headline`),this.status.textContent=t,this.status.classList.add(`seams-voiceid-success-message`);let a=matchMedia(`(prefers-reduced-motion: reduce)`).matches;for(let[e,t]of[this.phrase,this.status].entries())t.style.translate=`0 ${i}px`,pr(t,a,ur-lr+e*dr)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const lr=150,ur=450,dr=40;function fr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function pr(e,t,n){e.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:1,transform:`none`}],{delay:n,duration:300,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`both`})}function mr(e){throw Error(`Unexpected capture event: ${String(e)}`)}const hr=`seams-voiceid-row`,gr=800;function _r(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function vr(e,t){if(!e)return t;let n=[e.apply,t.apply].filter(e=>e!==void 0);return{...e,...t,action:e.action||t.action?{...e.action,...t.action}:void 0,apply:n.length===0?void 0:()=>n.forEach(yr)}}function yr(e){e()}function br(e){for(let t of e.getAnimations())t.id===hr&&t.cancel()}function xr(e){let t=Number(getComputedStyle(e).opacity);return br(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:hr}).finished.catch(Cr)}function Sr(e){let t=_r();for(let[n,r]of e.entries()){br(r);let e=Number(getComputedStyle(r).opacity);e!==0&&r.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:e,transform:`none`}],{delay:t?0:0+n*20,duration:t?150:140,easing:l,fill:`backwards`,id:hr})}}function Cr(){}function wr({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:140*(1-t),easing:l,id:hr})}function Tr(e){if(!e.isConnected||_r()){e.remove();return}e.inert=!0,e.classList.remove(`seams-auth-method-activation-surface`),delete e.dataset.seamsVoiceidHandoff;let t=e.getBoundingClientRect();e.style.position=`fixed`,e.style.top=`${t.top}px`,e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,e.style.margin=`0`,e.style.pointerEvents=`none`;let n=Number(getComputedStyle(e).opacity);e.animate([{opacity:n},{opacity:0}],{duration:150*n,easing:`ease-in`,fill:`forwards`}).finished.catch(Cr).finally(()=>e.remove())}const Er=`M6 6l12 12M18 6L6 18`,Dr=`m15 18-6-6 6-6`,Or=`M6 12h12`,kr=[`M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1-6 0z`,`M5 10a7 7 0 0 0 14 0`,`M8 21h8`,`M12 17v4`];function Ar(e){let t=e.createElement(`span`);t.className=`seams-voiceid-line-icon`,t.setAttribute(`aria-hidden`,`true`);let n=jr(e,`seams-voiceid-line-icon-microphone`);for(let t of kr)n.append(Mr(e,t,`1.8`));let r=jr(e,`seams-voiceid-line-icon-check`),i=Mr(e,`M5 12.5l4.5 4.5L19 7.5`,`2.6`);return i.setAttribute(`pathLength`,`1`),r.append(i),t.append(n,r),t}function jr(e,t){let n=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`class`,t),n}function Mr(e,t,n){let r=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);return r.setAttribute(`d`,t),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,n),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),r}function Nr(e,t,n){let r=e.createElement(`button`);r.type=`button`,r.className=`seams-voiceid-close`,r.setAttribute(`aria-label`,t);let i=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);i.setAttribute(`viewBox`,`0 0 24 24`),i.setAttribute(`width`,`20`),i.setAttribute(`height`,`20`),i.setAttribute(`aria-hidden`,`true`);let a=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);return a.setAttribute(`d`,n),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`stroke-width`,`1.75`),a.setAttribute(`stroke-linecap`,`round`),i.append(a),r.append(i),r}const Pr=`Say this with your voice`,Fr=[`colorBackground`,`textPrimary`,`textSecondary`,`textMuted`,`borderPrimary`,`surface`,`surface3`,`buttonBackground`,`textButton`,`error`,`info`,`voiceLine`,`voiceEcho`,`voiceEchoDeep`,`voiceFill`,`voicePixelBackground`];function Ir(e){return new Lr(e)}var Lr=class{element;prompt;card;unmounted;outer;detector;pressed;back;minimize;minimizedHook;progressedHook;minimized=!1;progress=``;recorder=null;recording=null;choice=null;view=null;started=!1;closed=!1;autoStart;expectedSpeechMs;speechDetectorReady=!1;constructor(e){let{sentence:n,frame:r={}}=e,i=e.signal;this.outer=i,this.detector=e.detector,this.autoStart=e.autoStart===!0,this.expectedSpeechMs=t(n);let a=document.querySelector(`.seams-voiceid-activation-surface[data-seams-voiceid-handoff]`);e.detector===`level`?this.speechDetectorReady=!0:s.prepare().then(this.detectorStarted,Br);let o=r.parent??document.body;this.element=document.createElement(`section`),this.element.className=[`seams-voiceid-activation-surface`,r.className].filter(Boolean).join(` `),this.element.setAttribute(`role`,`dialog`),this.element.setAttribute(`aria-modal`,`true`),this.element.setAttribute(`aria-label`,Pr),Rr(this.element,e.colors),this.prompt=new cr(document,Pr,n);let c=e.context?.sentenceLabel??`Say this sentence`;this.prompt.title.textContent=c;let l=/[.!?]$/.test(n)?n:`${n}.`;this.prompt.phrase.textContent=l,delete this.prompt.phrase.dataset.voiceidPhrase,this.prompt.status.textContent=``,this.prompt.record.textContent=`Record`;let u=r.controls??`close`;this.pressed=r.pressed;let d=u===`close`?null:this.prompt.showBack(u===`back_and_close`);e.context&&this.prompt.showContext(e.context.label,e.context.text),this.back=d===this.prompt.cancel?null:d,this.minimizedHook=r.minimized,this.progressedHook=r.progressed,this.minimize=r.minimized?this.prompt.showMinimize():null;let f=a?.querySelector(`:scope > .seams-voiceid-prompt`)??null,p=f?Vr(f):null;f&&(this.prompt.continueFrom(f),this.prompt.record.hidden=!0,this.autoStart=!1),this.card=new h(this.prompt,{label:c,sentence:l,message:``,action:`Record`},p),this.autoStart&&(this.prompt.record.hidden=!0,this.prompt.element.dataset.autoStart=``,this.prompt.element.tabIndex=-1),this.element.append(this.prompt.element),this.prompt.record.addEventListener(`click`,this.press);let m=u===`back`?this.pressBack:this.pressClose;this.prompt.cancel.addEventListener(`click`,m),this.back?.addEventListener(`click`,this.pressBack),this.minimize?.addEventListener(`click`,this.pressMinimize),this.element.addEventListener(`cancel`,this.cancel),i.addEventListener(`abort`,this.cancel),a?a.replaceWith(this.element):o.appendChild(this.element);let g=e.voiceLine??zr(this.prompt.element);g===`pixels`&&this.prompt.useVoiceLine(g),r.hugged&&this.element.classList.add(`seams-voiceid-hugged`),this.unmounted=r.mounted?.(this.element),p||this.autoStart?this.prompt.element.focus({preventScroll:!0}):this.prompt.record.focus(),i.aborted&&this.cancel()}record(){if(this.closed)return Promise.resolve({kind:`cancelled`});this.settleChoice(`replaced`),this.recording?.resolve({kind:`cancelled`});let e=Hr();return this.recording=e,this.view?(this.view=null,this.report({stage:`recording`,done:0,total:0}),this.card.showPrompt()):this.autoStart&&this.begin(e),this.autoStart=!1,e.promise}show(e){if(delete this.prompt.element.dataset.autoStart,this.closed)return Promise.resolve(`closed`);if(this.settleChoice(`replaced`),this.view=e,e.kind===`check`){let t=e.segments.filter(e=>e===`done`||e===`skip`).length;this.report({stage:`checking`,done:t,total:e.segments.length})}else this.report({stage:`result`,done:0,total:0}),this.needPerson();return this.card.show(e),new Promise(e=>{this.choice=e})}close(){this.closed||(this.closed=!0,this.recorder?.abort(),this.recording?.resolve({kind:`cancelled`}),this.settleChoice(`closed`),this.unmounted?.(),this.outer.removeEventListener(`abort`,this.cancel),this.element.removeEventListener(`cancel`,this.cancel),this.prompt.record.removeEventListener(`click`,this.press),this.prompt.cancel.removeEventListener(`click`,this.pressBack),this.prompt.cancel.removeEventListener(`click`,this.pressClose),this.back?.removeEventListener(`click`,this.pressBack),this.minimize?.removeEventListener(`click`,this.pressMinimize),this.card.dispose(),this.prompt.dispose(),Tr(this.element))}press=()=>{if(this.view){this.view.kind===`result`&&!this.view.action.busy&&this.settleChoice(`action`);return}!this.recording||this.started||this.begin(this.recording)};begin(t){this.started=!0,this.report({stage:`recording`,done:0,total:0}),this.prompt.record.disabled=!0,this.prompt.status.textContent=this.speechDetectorReady?`Opening microphone…`:`Loading ${e().label}…`,this.attempt(t,this.autoStart)}async attempt(e,t=!1){let o=new AbortController;this.recorder=o;try{let t=await i(o.signal,this.capture,{expectedSpeechMs:this.expectedSpeechMs,detector:this.detector});if(this.recording!==e||this.closed){t.samples?.fill(0);return}if(t.kind===`insufficient_audio`){this.retry(r(t.quality));return}let n=t.lastSoundAtMs??performance.now();this.started=!1,this.recording=null,e.resolve({kind:`recorded`,samples:t.samples,endOfSpeechAt:n})}catch(r){if(this.recording!==e||this.closed)return;if(r instanceof a){this.retry(r.message);return}if(t&&r instanceof n){this.retry(``,`Record`);return}this.started=!1,this.recording=null,e.reject(r instanceof Error?r:Error(String(r)))}}detectorStarted=()=>{this.speechDetectorReady=!0};capture=e=>{e.kind===`processing`?(this.report({stage:`checking`,done:0,total:0}),this.card.beginCheck()):this.prompt.capture(e)};retry(e,t=`Try again`){this.started=!1,delete this.prompt.element.dataset.autoStart,this.prompt.record.textContent=t,this.prompt.ready(e),this.prompt.record.focus(),this.report({stage:`recording`,done:0,total:0}),this.needPerson()}report(e){let t=`${e.stage}:${e.done}:${e.total}`;t===this.progress||this.closed||(this.progress=t,this.progressedHook?.(e))}pressMinimize=()=>{this.closed||(this.minimized=!0,this.minimizedHook?.(!0))};needPerson(){this.minimized&&(this.minimized=!1,this.minimizedHook?.(!1))}settleChoice(e){let t=this.choice;this.choice=null,t?.(e)}pressBack=()=>this.pressControl(`back`);pressClose=()=>this.pressControl(`close`);pressControl(e){this.view?.kind!==`check`&&(this.pressed?.(e),this.cancel())}cancel=()=>{this.view?.kind===`check`&&!this.outer.aborted||(this.recording&&(this.recorder?.abort(),this.recording.resolve({kind:`cancelled`}),this.recording=null,this.started=!1),this.settleChoice(`closed`),this.outer.aborted&&this.close())}};function Rr(e,t){if(t)for(let n of Fr){let r=t[n];r&&e.style.setProperty(`--seams-colors-${n}`,r)}}function zr(e){return getComputedStyle(e).getPropertyValue(`--seams-shape-voiceLine`).trim()===`pixels`?`pixels`:`wave`}function Br(){}function Vr(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function Hr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{h as PhraseCard,cr as VoicePrompt,Jn as VoiceRibbon,ir as VoiceVisual,Tr as leaveSurface,Ir as openPhraseCard};
@@ -159,6 +159,7 @@ var PhraseCard = class {
159
159
  dim: false,
160
160
  caption: `result:${JSON.stringify([
161
161
  view.caption,
162
+ view.receipt ?? null,
162
163
  view.detail,
163
164
  view.link ?? null
164
165
  ])}`,
@@ -166,7 +167,7 @@ var PhraseCard = class {
166
167
  };
167
168
  await this.transition(rows, version, () => {
168
169
  element.dataset.phraseView = "result";
169
- this.writeCaption(this.markedText(view.caption), this.detailNodes(view));
170
+ this.writeCaption(this.markedText(view.caption), this.detailNodes(view), view.receipt);
170
171
  this.writeAction(view.action);
171
172
  this.prompt.record.hidden = false;
172
173
  });
@@ -248,21 +249,51 @@ var PhraseCard = class {
248
249
  }
249
250
  detailNodes(view) {
250
251
  if (!view.link) return [view.detail];
251
- const link = this.prompt.element.ownerDocument.createElement("a");
252
- link.href = view.link.href;
253
- link.target = "_blank";
254
- link.rel = "noopener noreferrer";
255
- link.textContent = view.link.text;
256
252
  return [
257
253
  view.detail,
258
254
  " ",
259
- link
255
+ this.linkNode(view.link)
260
256
  ];
261
257
  }
262
- /** One line for the prompt; a caption and a detail line for the check and the result. */
263
- writeCaption(first, second) {
258
+ /** A link that opens in a new tab, such as a transaction or an attestation. */
259
+ linkNode(link) {
260
+ const anchor = this.prompt.element.ownerDocument.createElement("a");
261
+ anchor.href = link.href;
262
+ anchor.target = "_blank";
263
+ anchor.rel = "noopener noreferrer";
264
+ anchor.textContent = link.text;
265
+ return anchor;
266
+ }
267
+ /**
268
+ * The receipt box: its title and source on one line, a checked row for each check, and its
269
+ * link at the end.
270
+ */
271
+ receiptNode(receipt) {
272
+ const document = this.prompt.element.ownerDocument;
273
+ const element = (tag, className, ...children) => {
274
+ const node = document.createElement(tag);
275
+ node.className = className;
276
+ node.append(...children);
277
+ return node;
278
+ };
279
+ const head = element("span", "seams-voiceid-receipt-head", element("b", "", receipt.title));
280
+ if (receipt.source) head.append(element("span", "seams-voiceid-receipt-source", receipt.source));
281
+ const box = element("span", "seams-voiceid-receipt", head, element("span", "seams-voiceid-receipt-rows", ...receipt.rows.flatMap((row) => [
282
+ element("span", "seams-voiceid-receipt-check", checkIcon(document)),
283
+ element("span", "seams-voiceid-receipt-label", row.label),
284
+ element("span", "seams-voiceid-receipt-value", row.value)
285
+ ])));
286
+ if (receipt.link) box.append(element("span", "seams-voiceid-receipt-foot", this.linkNode(receipt.link)));
287
+ return box;
288
+ }
289
+ /**
290
+ * One line for the prompt; a caption and a detail line for the check and the result, with the
291
+ * result's receipt between them.
292
+ */
293
+ writeCaption(first, second, receipt) {
264
294
  const status = this.prompt.status;
265
- if (typeof first === "string" && second.length === 0) {
295
+ status.classList.toggle("seams-voiceid-has-receipt", receipt !== void 0);
296
+ if (typeof first === "string" && second.length === 0 && !receipt) {
266
297
  status.classList.remove("seams-voiceid-two-lines");
267
298
  status.textContent = first;
268
299
  return;
@@ -274,7 +305,11 @@ var PhraseCard = class {
274
305
  const two = document.createElement("span");
275
306
  two.className = "seams-voiceid-caption-detail";
276
307
  two.append(...second);
277
- status.replaceChildren(one, two);
308
+ status.replaceChildren(...receipt ? [
309
+ one,
310
+ this.receiptNode(receipt),
311
+ two
312
+ ] : [one, two]);
278
313
  status.classList.add("seams-voiceid-two-lines");
279
314
  }
280
315
  writeAction(action) {
@@ -479,6 +514,18 @@ function passkeyIcon(document) {
479
514
  }
480
515
  return icon;
481
516
  }
517
+ /** The check mark of a receipt row, in the seal's colour. */
518
+ function checkIcon(document) {
519
+ const icon = document.createElementNS(SVG_NAMESPACE, "svg");
520
+ icon.setAttribute("viewBox", "0 0 24 24");
521
+ icon.setAttribute("width", "15");
522
+ icon.setAttribute("height", "15");
523
+ icon.setAttribute("aria-hidden", "true");
524
+ const path = document.createElementNS(SVG_NAMESPACE, "path");
525
+ path.setAttribute("d", "M5 12l5 5L20 7");
526
+ icon.append(path);
527
+ return icon;
528
+ }
482
529
  /** Fades out from where the element is, so a row that is still arriving never flashes. */
483
530
  function fade(element, duration) {
484
531
  const from = Number(getComputedStyle(element).opacity);
@@ -22,6 +22,9 @@ const CSS = `
22
22
  margin: 0 auto;
23
23
  padding: 3.5rem 1.5rem 1.5rem;
24
24
  display: grid;
25
+ /* One column, never wider than the card: a long word in one row (an account of 64 characters)
26
+ must not push the other rows, such as the receipt and the button, out of the card. */
27
+ grid-template-columns: minmax(0, 1fr);
25
28
  /* Named rows. The context row is empty (0 high) unless the card shows the text that its sentence
26
29
  speaks for. A host that sets its own rows keeps these names. */
27
30
  grid-template-rows: [context] auto [title] auto [phrase] minmax(6rem, auto) [line] 5rem [status] minmax(3.375rem, auto) [action] minmax(5rem, auto);
@@ -291,6 +294,8 @@ const CSS = `
291
294
  .seams-voiceid-prompt > :not(.seams-voiceid-glow) { position: relative; z-index: 1; }
292
295
  .seams-voiceid-prompt > .seams-voiceid-close { position: absolute; }
293
296
  .seams-voiceid-prompt .seams-voiceid-status {
297
+ /* A word that is longer than the line breaks inside the card. */
298
+ overflow-wrap: anywhere;
294
299
  font-size: 0.75rem;
295
300
  line-height: 1.5;
296
301
  min-height: 3.375rem;
@@ -524,6 +529,56 @@ const CSS = `
524
529
  color: var(--seams-colors-textPrimary, #eff2f3);
525
530
  }
526
531
  .seams-voiceid-status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
532
+ /* A result's receipt (PhraseResultView.receipt): a quiet box between the caption and the detail,
533
+ with a checked row for each check of the result, in the seal's colour. */
534
+ .seams-voiceid-status .seams-voiceid-receipt {
535
+ margin: 0.625rem 0;
536
+ padding: 0.625rem 0.875rem;
537
+ border: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
538
+ border-radius: 0.875rem;
539
+ text-align: left;
540
+ font-size: 0.8125rem;
541
+ line-height: 1.45;
542
+ color: var(--seams-colors-textPrimary, #eff2f3);
543
+ }
544
+ .seams-voiceid-receipt-head {
545
+ display: flex;
546
+ justify-content: space-between;
547
+ align-items: baseline;
548
+ gap: 0.5rem;
549
+ margin-bottom: 0.375rem;
550
+ }
551
+ .seams-voiceid-receipt-source {
552
+ font-size: 0.75rem;
553
+ color: var(--seams-colors-textSecondary, #9aa4ab);
554
+ }
555
+ .seams-voiceid-receipt-rows {
556
+ display: grid;
557
+ grid-template-columns: 1rem auto minmax(0, 1fr);
558
+ column-gap: 0.5rem;
559
+ row-gap: 0.25rem;
560
+ align-items: center;
561
+ }
562
+ .seams-voiceid-receipt-check {
563
+ display: flex;
564
+ color: var(--seams-colors-voiceSeal, var(--seams-colors-voiceLine, var(--seams-colors-textPrimary, #eff2f3)));
565
+ }
566
+ .seams-voiceid-receipt-check svg {
567
+ fill: none;
568
+ stroke: currentColor;
569
+ stroke-width: 2.4;
570
+ stroke-linecap: round;
571
+ stroke-linejoin: round;
572
+ }
573
+ .seams-voiceid-receipt-label { color: var(--seams-colors-textSecondary, #9aa4ab); }
574
+ .seams-voiceid-receipt-value { overflow-wrap: anywhere; }
575
+ .seams-voiceid-receipt-foot {
576
+ display: block;
577
+ margin-top: 0.5rem;
578
+ padding-top: 0.5rem;
579
+ border-top: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
580
+ font-size: 0.75rem;
581
+ }
527
582
  .seams-voiceid-heard-mark {
528
583
  background: none;
529
584
  color: var(--seams-colors-error, oklch(0.74 0.166 19));
@@ -1,5 +1,5 @@
1
1
  export { openPhraseCard, type PhraseCardColor, type PhraseCardColors, type PhraseCardContext, type PhraseCardControl, type PhraseCardControls, type PhraseCardFrame, type PhraseCardInput, type PhraseCardProgress, } from './surface';
2
- export type { PhraseCheckView, PhraseChoice, PhraseRecording, PhraseResultView, PhraseSegmentState, PhraseSurface, PhraseText, PhraseView, } from './types';
2
+ export type { PhraseCheckView, PhraseChoice, PhraseReceipt, PhraseRecording, PhraseResultView, PhraseSegmentState, PhraseSurface, PhraseText, PhraseView, } from './types';
3
3
  export { leaveSurface, VoicePrompt, type PhraseDisplay, type PromptChange } from './prompt';
4
4
  export { PhraseCard, type HandedOverRows, type PromptCopy } from './phraseCard';
5
5
  export { VoiceRibbon, type VoiceCheckingStyle, type VoiceLineStyle } from './ribbon';
@@ -50,7 +50,17 @@ export declare class PhraseCard {
50
50
  private transition;
51
51
  private markedText;
52
52
  private detailNodes;
53
- /** One line for the prompt; a caption and a detail line for the check and the result. */
53
+ /** A link that opens in a new tab, such as a transaction or an attestation. */
54
+ private linkNode;
55
+ /**
56
+ * The receipt box: its title and source on one line, a checked row for each check, and its
57
+ * link at the end.
58
+ */
59
+ private receiptNode;
60
+ /**
61
+ * One line for the prompt; a caption and a detail line for the check and the result, with the
62
+ * result's receipt between them.
63
+ */
54
64
  private writeCaption;
55
65
  private writeAction;
56
66
  /** Changes the second caption line every 1.3 s and stays on the last line. */
@@ -28,12 +28,34 @@ export type PhraseCheckView = Readonly<{
28
28
  details: readonly string[];
29
29
  segments: readonly PhraseSegmentState[];
30
30
  }>;
31
+ /**
32
+ * The proof of a result, in a box between the caption and the detail: who checked what, and a
33
+ * link to check it again, such as a TEE attestation.
34
+ */
35
+ export type PhraseReceipt = Readonly<{
36
+ /** For example "TEE receipt". */
37
+ title: string;
38
+ /** Where the checks ran, at the right of the title, for example "Intel TDX · OutLayer". */
39
+ source?: string;
40
+ /** One checked line each, for example `{ label: 'Voice', value: 'matched alice.near' }`. */
41
+ rows: readonly Readonly<{
42
+ label: string;
43
+ value: string;
44
+ }>[];
45
+ /** A link under the rows, for example the attestation of the call. */
46
+ link?: Readonly<{
47
+ text: string;
48
+ href: string;
49
+ }>;
50
+ }>;
31
51
  /** A result or a question: a headline takes the sentence's place, with one action. */
32
52
  export type PhraseResultView = Readonly<{
33
53
  kind: 'result';
34
54
  label: string;
35
55
  headline: string;
36
56
  caption: PhraseText;
57
+ /** The proof of the result, under the caption. */
58
+ receipt?: PhraseReceipt;
37
59
  detail: string;
38
60
  /** A link after the detail, such as a transaction in a block explorer. */
39
61
  link?: Readonly<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seams/voice-capture",
3
- "version": "0.69.2",
3
+ "version": "0.70.1",
4
4
  "type": "module",
5
5
  "description": "Records one spoken sentence in the browser, with speech detection, a quality check and a phrase card",
6
6
  "license": "Apache-2.0",