@seams/voice-capture 0.69.1 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/browser/card.js +89 -32
- package/dist/esm/card/phraseCard.js +124 -14
- package/dist/esm/card/prompt.js +86 -14
- package/dist/types/card/index.d.ts +1 -1
- package/dist/types/card/phraseCard.d.ts +23 -2
- package/dist/types/card/types.d.ts +22 -0
- package/package.json +1 -1
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
|
package/dist/browser/card.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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.65, 0, 0.35, 1)`,p=[`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 m=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=>g(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:`cubic-bezier(0.2, 0.7, 0.2, 1)`});for(let[e,t]of i.entries())_(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(h(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 g(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 v(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 v(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 v(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 v(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;this.line.dataset.seal=``;let n=2*Math.PI*21.5;this.ring.style.strokeDasharray=String(n);let r=(e,n)=>({duration:t?0:e,easing:n,fill:`forwards`});this.bar.animate([{transform:`scaleX(1)`},{transform:`scaleX(0)`}],r(440,f)),await this.ring.animate([{strokeDashoffset:n},{strokeDashoffset:0}],r(440,f)).finished,!this.stale(e)&&(this.seal.animate([{transform:`scale(0)`},{transform:`scale(1)`}],r(320,`cubic-bezier(0.34, 1.56, 0.64, 1)`)),await v(t?0:220),!this.stale(e)&&await this.check.animate([{strokeDashoffset:1},{strokeDashoffset:0}],r(260,d)).finished)}resetLine(){this.morph=null,this.states=[],delete this.line.dataset.seal;for(let e of[this.bar,this.ring,this.seal,this.check])e.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 h(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 p){let r=e.createElementNS(u,`path`);r.setAttribute(`d`,n),t.append(r)}return t}function g(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 _(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 v(e){return new Promise(t=>window.setTimeout(t,e))}var y,b,x,S,C,w,T,E,D,ee,O,k,A,te,j={},M=[],ne=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,N=Array.isArray;function P(e,t){for(var n in t)e[n]=t[n];return e}function F(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function I(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?y.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 L(e,o,r,i,null)}function L(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??++x,__i:-1,__u:0};return i==null&&b.vnode!=null&&b.vnode(a),a}function R(e){return e.children}function z(e,t){this.props=e,this.context=t}function B(e,t){if(t==null)return e.__?B(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`?B(e):null}function re(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=P({},t);a.__v=t.__v+1,b.vnode&&b.vnode(a),me(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??B(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,ge(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)&&S.push(e)&&!V.__r++||C!=b.debounceRendering)&&((C=b.debounceRendering)||w)(V)}function V(){try{for(var e,t=1;S.length;)S.length>t&&S.sort(T),e=S.shift(),t=S.length,re(e)}finally{S.length=V.__r=0}}function oe(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||M,v=t.length;for(c=se(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||j,p.__i=d,g=me(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&ye(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=ce(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 se(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]=L(null,o,null,null,null):N(o)?o=e.__k[a]=L(R,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=L(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=ue(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=B(s)),be(s,s));return r}function ce(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=ce(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=B(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function le(e,t){return t||=[],e==null||typeof e==`boolean`||(N(e)?e.some(function(e){le(e,t)}):t.push(e)),t}function ue(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 de(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||ne.test(t)?n:n+`px`}function fe(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||de(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||de(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(O,`$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[ee]=r[ee]:(n[ee]=k,e.addEventListener(t,a?te:A,a)):e.removeEventListener(t,a?te:A,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 pe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[D]==null)t[D]=k++;else if(t[D]<n[ee])return;return n(b.event?b.event(t):t)}}}function me(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,x,S,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=b.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(v=t.props,y=D.prototype&&D.prototype.render,x=(u=D.contextType)&&r[u.__c],S=u?x?x.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new D(v,S):(t.__c=f=new z(v,S),f.constructor=D,f.render=xe),x&&x.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=P({},f.__s)),P(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,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,S)){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)}),M.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=B(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,S),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=S,f.props=v,f.__P=e,f.__e=!1,C=b.__r,w=0,y)f.state=f.__s,f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),M.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=P(P({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=u!=null&&u.type===R&&u.key==null?_e(u.props.children):u,s=oe(e,N(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--;)F(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||he(t),b.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ve(n.__e,t,n,r,i,a,o,c,l);return(u=b.diffed)&&u(t),128&t.__u?void 0:s}function he(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(he))}function ge(e,t,n){for(var r=0;r<n.length;r++)ye(n[r],n[++r],n[++r]);b.__c&&b.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){b.__e(e,t.__v)}})}function _e(e){return typeof e!=`object`||!e||e.__b>0?e:N(e)?e.map(_e):e.constructor===void 0?P({},e):null}function ve(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||j,_=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&&=(b.__m&&b.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&y.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 _||fe(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||fe(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=``),oe(t.type==`template`?e.content:e,N(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&B(n,0),s,c),a!=null)for(l=a.length;l--;)F(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])&&fe(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&fe(e,l,h,g[l],i))}return e}function ye(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){b.__e(e,n)}}function be(e,t,n){var r,i;if(b.unmount&&b.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ye(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){b.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&be(r[i],t,n||typeof e.type!=`function`);n||F(e.__e),e.__c=e.__=e.__e=void 0}function xe(e,t,n){return this.constructor(e,n)}function Se(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),b.__&&b.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],me(t,e=(!r&&n||t).__k=I(R,null,[e]),i||j,j,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?y.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ge(a,e,o),e.props.children=null}y=M.slice,b={__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}},x=0,z.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=P({},this.state);typeof e==`function`&&(e=e(P({},n),this.props)),e&&P(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ae(this))},z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ae(this))},z.prototype.render=R,S=[],w=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,T=function(e,t){return e.__v.__b-t.__v.__b},V.__r=0,E=Math.random().toString(8),D=`__d`+E,ee=`__a`+E,O=/(PointerCapture)$|Capture$/i,k=0,A=pe(!1),te=pe(!0);var Ce,H,we,Te,Ee=0,De=[],U=b,Oe=U.__b,ke=U.__r,Ae=U.diffed,je=U.__c,Me=U.unmount,Ne=U.__;function Pe(e,t){U.__h&&U.__h(H,e,Ee||t),Ee=0;var n=H.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Fe(e){return Ee=1,Ie(Ge,e)}function Ie(e,t,n){var r=Pe(Ce++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ge(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=H,!H.__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};H.__f=!0;var a=H.shouldComponentUpdate,o=H.componentWillUpdate;H.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)},H.shouldComponentUpdate=i}return r.__N||r.__}function Le(e,t){var n=Pe(Ce++,3);!U.__s&&We(n.__H,t)&&(n.__=e,n.u=t,H.__H.__h.push(n))}function Re(e){return Ee=5,ze(function(){return{current:e}},[])}function ze(e,t){var n=Pe(Ce++,7);return We(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Be(e,t){return Ee=8,ze(function(){return e},t)}function Ve(){var e=Pe(Ce++,11);if(!e.__){for(var t=H.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function W(){for(var e;e=De.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(G),t.__h.some(K),t.__h=[]}catch(n){t.__h=[],U.__e(n,e.__v)}}}U.__b=function(e){H=null,Oe&&Oe(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ne&&Ne(e,t)},U.__r=function(e){ke&&ke(e),Ce=0;var t=(H=e.__c).__H;t&&(we===H?(t.__h=[],H.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(G),t.__h.some(K),t.__h=[],Ce=0)),we=H},U.diffed=function(e){Ae&&Ae(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(De.push(t)!==1&&Te===U.requestAnimationFrame||((Te=U.requestAnimationFrame)||Ue)(W)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),we=H=null},U.__c=function(e,t){t.some(function(e){try{e.__h.some(G),e.__h=e.__h.filter(function(e){return!e.__||K(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],U.__e(n,e.__v)}}),je&&je(e,t)},U.unmount=function(e){Me&&Me(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{G(e)}catch(e){t=e}}),n.__H=void 0,t&&U.__e(t,n.__v))};var He=typeof requestAnimationFrame==`function`;function Ue(e){var t,n=function(){clearTimeout(r),He&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);He&&(t=requestAnimationFrame(n))}function G(e){var t=H,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),H=t}function K(e){var t=H;e.__c=e.__(),H=t}function We(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ge(e,t){return typeof t==`function`?t(e):t}function Ke(e,t){for(var n in t)e[n]=t[n];return e}function qe(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 Je(e,t){this.props=e,this.context=t}(Je.prototype=new z).isPureReactComponent=!0,Je.prototype.shouldComponentUpdate=function(e,t){return qe(this.props,e)||qe(this.state,t)};var Ye=b.__b;b.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ye&&Ye(e)};var Xe=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function Ze(e){function t(t){var n=Ke({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Xe,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var Qe=b.__e;b.__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)}Qe(e,t,n,r)};var $e=b.unmount;function et(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=Ke({},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 et(e,t,n)})),e}function tt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return tt(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 nt(){this.__u=0,this.o=null,this.__b=null}function rt(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function it(){this.i=null,this.l=null}b.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),$e&&$e(e)},(nt.prototype=new z).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=rt(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]=tt(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)},nt.prototype.componentWillUnmount=function(){this.o=[]},nt.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]=et(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&I(R,null,e.fallback);return i&&(i.__u&=-33),[I(R,null,t.__a?null:e.children),i]};var at=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]}};(it.prototype=new z).__a=function(e){var t=this,n=rt(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),at(t,e,r)):i()};n?n(a):a()}},it.prototype.render=function(e){this.i=null,this.l=new Map;var t=le(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},it.prototype.componentDidUpdate=it.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){at(e,n,t)})};var ot=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,st=/^(?: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]/,ct=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,lt=/[A-Z0-9]/g,ut=typeof document<`u`,dt=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};z.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(z.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ft=b.event;b.event=function(e){return ft&&(e=ft(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var pt={configurable:!0,get:function(){return this.class}},mt=b.vnode;b.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||ut&&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`||dt(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:ct.test(a)&&(a=s):s=a=`oninput`:i&&st.test(a)?a=a.replace(lt,`-$&`).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=le(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=le(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`,pt)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=ot,mt&&mt(e)};var ht=b.__r;b.__r=function(e){ht&&ht(e),e.__c};var gt=b.diffed;b.diffed=function(e){gt&>(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 _t=0;Array.isArray;function q(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:--_t,__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 b.vnode&&b.vnode(l),l}function vt(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 yt(e){let t=vt(e);return t?`rgb(${t[0]}, ${t[1]}, ${t[2]})`:null}function bt(e){let t=vt(e);return t?`${t[0]}, ${t[1]}, ${t[2]}`:null}const xt={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}},St=[{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}],Ct=36*St.length,wt={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 Tt(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 Et(e,t=1){return Math.max(.5,Math.round(e*t*100)/100)}function Dt(e,t){return`calc(50% + (var(--vb-cx-${t}) + var(--vb-x${e}-${t})) * var(--vb-w-${t}) * var(--vb-z-${t}, 1))`}function Ot({id:e,colors:t,alpha:n,sw:r,sh:i,y:a,fade:o,count:s}){return(s?St.slice(0,s):St).map((s,c)=>{let l=n>=1?t[c%t.length]:Tt(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 ${Dt(c,e)} ${f}, ${l} 0%, transparent ${o}%)`}).join(`,
|
|
2
|
-
`)}function
|
|
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&<.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&>(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
6
|
border-radius: ${I(n)};
|
|
7
|
-
background: ${
|
|
7
|
+
background: ${he};
|
|
8
8
|
box-shadow: inset 0 0 ${I(te)} 1px ${s};
|
|
9
9
|
-webkit-mask-image:
|
|
10
|
-
${
|
|
10
|
+
${_e(170,64,45,.3)},
|
|
11
11
|
linear-gradient(white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white),
|
|
12
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
16
|
linear-gradient(white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white),
|
|
17
17
|
linear-gradient(to right, white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white);
|
|
18
18
|
mask-composite: intersect, add;
|
|
@@ -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
|
-
${
|
|
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
|
-
${
|
|
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
|
`)}
|
|
@@ -71,15 +71,15 @@ ${St.map((e,n)=>` --vb-x${n}-${t}: ${e.x}px;
|
|
|
71
71
|
padding: ${I(r)};
|
|
72
72
|
clip-path: inset(0 round ${I(n)});
|
|
73
73
|
background:
|
|
74
|
-
${
|
|
75
|
-
${
|
|
74
|
+
${pe},
|
|
75
|
+
${me};
|
|
76
76
|
-webkit-mask:
|
|
77
|
-
${
|
|
77
|
+
${_e(170,64,45)},
|
|
78
78
|
linear-gradient(#fff 0 0) content-box,
|
|
79
79
|
linear-gradient(#fff 0 0);
|
|
80
80
|
-webkit-mask-composite: source-in, xor;
|
|
81
81
|
mask:
|
|
82
|
-
${
|
|
82
|
+
${_e(170,64,45)},
|
|
83
83
|
linear-gradient(#fff 0 0) content-box,
|
|
84
84
|
linear-gradient(#fff 0 0);
|
|
85
85
|
mask-composite: intersect, exclude;
|
|
@@ -89,18 +89,18 @@ ${St.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
|
-
${
|
|
93
|
-
${
|
|
92
|
+
${ve(`stroke`,z)}
|
|
93
|
+
${se}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/* Inner glow — soft light inside the element, faded off at the corners.
|
|
97
97
|
With distortion on, this copy is clipped to ABOVE the band line (the
|
|
98
98
|
polygon the driver writes each frame) and a mirror layer below carries
|
|
99
99
|
the displacement filter, so only the glow under the line warps. */
|
|
100
|
-
${
|
|
101
|
-
[data-voice-beam="${t}"][data-fading]::before`,`content: "";`,O?`clip-path: var(--vb-clip-above-${t}, inset(0 round ${n}px));`:`clip-path: inset(0 round ${n}px);`,
|
|
102
|
-
${O?
|
|
103
|
-
[data-voice-beam="${t}"][data-fading] [data-voice-beam-warp="inner"]`,`display: block;`,`clip-path: var(--vb-clip-below-${t}, inset(0 round ${n}px));`,
|
|
100
|
+
${ye(`[data-voice-beam="${t}"][data-active]::before,
|
|
101
|
+
[data-voice-beam="${t}"][data-fading]::before`,`content: "";`,O?`clip-path: var(--vb-clip-above-${t}, inset(0 round ${n}px));`:`clip-path: inset(0 round ${n}px);`,se)}
|
|
102
|
+
${O?ye(`[data-voice-beam="${t}"][data-active] [data-voice-beam-warp="inner"],
|
|
103
|
+
[data-voice-beam="${t}"][data-fading] [data-voice-beam-warp="inner"]`,`display: block;`,`clip-path: var(--vb-clip-below-${t}, inset(0 round ${n}px));`,ce):``}
|
|
104
104
|
|
|
105
105
|
/* Bloom — the blurred halo, tallest of the three, above the content. */
|
|
106
106
|
[data-voice-beam="${t}"] [data-voice-beam-bloom],
|
|
@@ -119,9 +119,9 @@ ${O?be(`[data-voice-beam="${t}"][data-active] [data-voice-beam-warp="inner"],
|
|
|
119
119
|
|
|
120
120
|
[data-voice-beam="${t}"] [data-voice-beam-bloom],
|
|
121
121
|
[data-voice-beam="${t}"] [data-voice-beam-warp="bloom"] {
|
|
122
|
-
-webkit-mask: ${
|
|
123
|
-
mask: ${
|
|
124
|
-
background: ${
|
|
122
|
+
-webkit-mask: ${_e(200,130,35)};
|
|
123
|
+
mask: ${_e(200,130,35)};
|
|
124
|
+
background: ${ge};
|
|
125
125
|
z-index: 3;
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -129,16 +129,16 @@ ${O?be(`[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
|
-
${
|
|
133
|
-
${
|
|
132
|
+
${ve(`bloom`,V)}
|
|
133
|
+
${le}
|
|
134
134
|
}
|
|
135
135
|
${O?`
|
|
136
136
|
[data-voice-beam="${t}"][data-active] [data-voice-beam-warp="bloom"],
|
|
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
|
-
${
|
|
141
|
-
${
|
|
140
|
+
${ve(`bloom`,V)}
|
|
141
|
+
${ue}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/* Processing drops the distortion: the driver marks the wrapper once 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(${I(
|
|
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(${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 ${
|
|
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)) ${
|
|
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)) ${
|
|
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
|
|
@@ -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 At=null;function jt(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function Mt(){let e=jt();return e?(At||=new e,At.state===`suspended`&&At.resume().catch(()=>{}),At):null}const Nt=new WeakMap;function Pt(e){let t=Mt();if(!t||e.getAudioTracks().length===0)return null;let n=Nt.get(e);n||(n={node:t.createMediaStreamSource(e),refs:0},Nt.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{}Nt.delete(e)}}}}}const Ft=new WeakMap;function It(e){let t=Ft.get(e);return t||(t={level:0,bands:[0,0,0],phase:0,scanA:0,scanT:0,t:0,lastTs:0,warp:1},Ft.set(e,t)),t}const Lt=new Set;let J=null,Rt=0,Y=0,zt=!1,Bt=!1,Vt=0,Ht=0;const Ut=Math.PI*2,Wt=[[80,300],[300,2e3],[2e3,6e3]];function Gt(e){return e<0?0:e>1?1:e}function Kt(e,t){let n=t/2;return((e+n)%t+t)%t-n}function qt(e,t){let n=e/(t/2+4);return Math.max(0,1-n*n)}function X(e,t){if(e<=t)return 0;let n=(e-t)/Math.max(.001,1-t);return Gt((1-Math.exp(-3*n))/(1-Math.exp(-3)))}function Jt(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 Yt=!(typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent)),Xt=.05,Zt=.1;function Qt(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 $t(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 en(e,t,n){return Math.max(0,Math.min(e,t/2,n/2))}function tn(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 nn(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,_=Qt(d,e.bandCurve,e.bandSpread,e.bandSkew)+$t(Math.abs(l-i),g,u,e.bandTailPosition,e.bandTailCurve),v=t.corner>0?tn(l,n,en(e.radius,n,r))*t.corner:0;h.push([l,c-s*_-v])}return h}function rn(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 an(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/Xt)*Xt));if(i===e.filterTop)return;e.filterTop=i;let a=1+Math.max(.1,12/n),o=e.filter;o.setAttribute(`x`,`${-Zt*100}%`),o.setAttribute(`width`,`${(1+2*Zt)*100}%`),o.setAttribute(`y`,`${(i*100).toFixed(0)}%`),o.setAttribute(`height`,`${((a-i)*100).toFixed(1)}%`)}function on(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 sn(e){return(1-Math.cos(Ut*e))/2}function cn(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]=Wt[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 ln={level:0,bands:[0,0,0]};function un(e){J=requestAnimationFrame(un);let t=Y?e-Y:0;if(Y=e,zt){if(Bt=!Bt,Bt)return;e>=Ht&&(zt=!1,Vt=0)}else t>22?Vt?e-Vt>500&&(zt=!0,Bt=!1,Ht=e+4e3):Vt=e:Vt=0;e-Rt<14.666666666666668||(Rt=e,Lt.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)cn(t,ln);else{let e=a.getLevel?Gt(a.getLevel()):0;ln.level=e,ln.bands[0]=e,ln.bands[1]=e*(.72+.28*Math.sin(l*9.1)),ln.bands[2]=e*(.6+.4*Math.sin(l*13.7+2))}let u=X(ln.level,i.threshold);o.level=Jt(o.level,u,c,i.attack,i.release);for(let e=0;e<3;e++){let t=X(ln.bands[e],i.threshold*.6);o.bands[e]=Jt(o.bands[e],t,c,i.attack,i.release*1.15)}let d=Ct*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=Jt(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(Ut*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=en(i.radius,m,h),R=p*i.cornerFollow;r.style.setProperty(`--vb-cy-${i.id}`,`${(-tn(F,m,L,I*1.4)*R).toFixed(1)}px`),o.warp=Jt(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=nn(i,P,m,h);(t.displace&&!B||i.coreLight>0)&&rn(r,i.id,e,m,h),t.filter&&!B&&Yt&&an(t,e,h),t.ctx&&on(t,P,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<St.length;e++){let t=St[e],n=Kt(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*qt(n,d)).toFixed(3));let s=m/2+(C+n*w)*M;r.style.setProperty(`--vb-y${e}-${i.id}`,`${(-tn(s,m,L,I)*R).toFixed(1)}px`)}let re=i.staticColors||i.reducedMotion||i.hueRange===0?0:-i.hueRange+2*i.hueRange*sn(l/i.hueDuration);r.style.setProperty(`--vb-hue-${i.id}`,`${re.toFixed(2)}deg`),(n=t.onLevel)==null||n.call(t,o.level),t.paintedConfig=i}))}function dn(){J??=(Rt=0,Y=0,Vt=0,requestAnimationFrame(un))}function fn(){Lt.size===0&&J!=null&&(cancelAnimationFrame(J),J=null)}function pn(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:It(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=Pt(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 Lt.add(i),dn(),()=>{var e;Lt.delete(i),(e=i.releaseAnalyser)==null||e.call(i),fn()}}const mn={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},hn={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}},gn={default:{brightness:1.15},pill:{brightness:1.35,saturation:1.5},mobile:{strength:1,brightness:1.2,saturation:1.5}},_n={default:{},pill:{},mobile:{strength:1}};function vn(e=`default`,t=`dark`){return(t===`light`?_n[e]:void 0)??gn[e]}const yn={default:{bandStrength:1.7},pill:{bandStrength:2},mobile:{bandStrength:1.7}};function bn(e=`default`,t=`dark`){let n=hn[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)),{...mn,...r,...n,...t===`light`?yn[e]:void 0}}const xn={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`}},Sn=typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent),Cn=(()=>{if(typeof document>`u`)return!0;let e=document.createElement(`canvas`).getContext(`2d`);return!!e&&typeof e.filter==`string`})();function wn(){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 Tn(){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 En(e,t){return e===`auto`?t:e}const Dn=Ze(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:z,bandCurve:B,bandSpread:re,bandSkew:ie,bandOffset:ae,bandTail:V,bandTailPosition:oe,bandTailCurve:se,bandTailOverflow:ce,bandAberration:le,distortion:ue,distortionDetail:de,glowWidth:fe,glowHeight:pe,lobeSpacing:me,rangeWidth:he,rangeHeight:ge,softness:_e,coreSize:ve,coreLight:ye,coreLightWidth:be,coreLightHeight:xe,strokeScale:Se,innerScale:Ce,innerHeight:H,bloomScale:we,bloomHeight:Te,strength:Ee,className:De,style:U,css:Oe,onLevel:ke,onActivate:Ae,onDeactivate:je,onAnimationEnd:Me,...Ne},Pe){let Ie=Ve().replace(/:/g,`-`),W=En(T,wn()),He=C?C.join(`|`):``,Ue=w?[w.core,w.above,w.mid,w.below].join(`|`):``,G=bn(t,W),K=Math.max(.05,n??G.scale),We=M??G.glowSize,Ge=ne??G.strokeOpacity,Ke=N??G.innerOpacity,qe=P??G.bloomOpacity,Je=g??G.processingDuration,Ye=_??G.processingLevel,Xe=v??G.processingTravel,Ze=y??G.processingCurve,Qe=b??G.cornerFollow,$e=l??G.idle,et=d??G.reach,tt=f??G.spread,nt=(m??G.flow)*K,rt=(F??G.bend)*K,it=I??G.bandStrength,at=(L??G.bandWidth)*K,ot=z??G.bandPosition,st=B??G.bandCurve,ct=re??G.bandSpread,lt=ie??G.bandSkew,ut=(ae??G.bandOffset)*K,dt=V??G.bandTail,ft=oe??G.bandTailPosition,pt=se??G.bandTailCurve,mt=(ce??G.bandTailOverflow)*K,ht=le??G.bandAberration,gt=ue??G.distortion,_t=(de??G.distortionDetail)/K,vt=(fe??G.glowWidth)*K,yt=(pe??G.glowHeight)*K,St=(me??G.lobeSpacing)*K,Ct=(he??G.rangeWidth)*K,wt=(ge??G.rangeHeight)*K,Tt=_e??G.softness,Et=(ve??G.coreSize)*K,Dt=Math.max(0,Math.min(3,ye??G.coreLight)),Ot=be??G.coreLightWidth,At=xe??G.coreLightHeight,jt=Se??G.strokeScale,Mt=Ce??G.innerScale,Nt=H??G.innerHeight,Pt=we??G.bloomScale,Ft=Te??G.bloomHeight,It=Tn(),Lt=Re(null),[J,Rt]=Fe(O),[Y,zt]=Fe(!1),[Bt,Vt]=Fe(!0),[Ht,Ut]=Fe(null),[Wt,Gt]=Fe(0);Le(()=>{if(!Sn)return;let e=Lt.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=Sn&&Wt>6e4?0:gt;Le(()=>{if(A!=null)return;let e=Lt.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&&!J&&!Y?Rt(!0):!O&&J&&!Y&&zt(!0)},[O,J,Y]),Le(()=>{let e=Lt.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),je?.()):t.includes(`fade-in`)&&Ae?.(),Me?.(e)},[Ae,je,Me]),X=xt[W],Jt=A??Ht??16,Yt=vn(t,W),Xt=Ee??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(()=>kt({id:Ie,borderRadius:Jt,borderWidth:1,strokeOpacity:X.strokeOpacity*Ge,innerOpacity:X.innerOpacity*Ke,bloomOpacity:X.bloomOpacity*qe,innerShadow:X.innerShadow,colorVariant:S,colors:C,brightness:$t,saturation:en,theme:W,hueBase:X.hueBase??0,glowSize:We*K,glowWidth:vt,glowHeight:yt,strokeScale:jt,innerScale:Mt,innerHeight:Nt,bloomScale:Pt,bloomHeight:Ft,coreSize:Et,coreLight:Dt,coreLightWidth:Ot,coreLightHeight:At,rangeWidth:Ct,rangeHeight:wt,softness:Tt,distortion:Kt>0,scale:K}),[Ie,Jt,X,S,He,$t,en,W,G,We,Ge,Ke,qe,K,vt,yt,jt,Mt,Nt,Pt,Ft,Et,Dt,Ot,At,Ct,wt,Tt,Kt>0]),nn=ze(()=>({id:Ie,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,$e)),breatheDuration:Math.max(.2,u),reach:Math.max(0,et),spread:Math.max(0,tt),bands:p,flow:nt,lobeSpacing:Math.max(.1,St),bend:Math.max(0,rt),bandStrength:Math.max(0,it),bandWidth:Math.max(0,at),bandPosition:Math.max(0,ot),bandCurve:Math.max(.3,st),bandSpread:Math.max(.05,ct),bandSkew:Math.max(-.9,Math.min(.9,lt)),bandOffset:ut,bandTail:Math.max(0,Math.min(1.5,dt)),bandTailPosition:Math.max(0,Math.min(.98,ft)),bandTailCurve:Math.max(.5,pt),bandTailOverflow:Math.max(0,mt),bandAberration:Math.max(0,Math.min(1,ht)),rangeWidth:Ct,rangeHeight:wt,theme:W,bandColors:{core:w?.core&&bt(w.core)||xn[W].core,above:w?.above&&bt(w.above)||xn[W].above,mid:w?.mid&&bt(w.mid)||xn[W].mid,below:w?.below&&bt(w.below)||xn[W].below},distortion:Math.max(0,Math.min(1,Kt)),coreLight:Dt,scale:K,radius:Jt,processing:h,processingDuration:Math.max(.05,Je),processingLevel:Math.max(0,Math.min(1,Ye)),processingEase:Math.max(.05,x),processingTravel:Math.max(0,Xe),processingCurve:Math.max(1,Ze),cornerFollow:Math.max(0,Math.min(1,Qe)),hueRange:Math.max(0,Zt),hueDuration:Math.max(.5,Qt),staticColors:S===`mono`?!0:E,reducedMotion:It,paused:k}),[Ie,a,o,s,c,$e,u,et,tt,p,nt,St,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,Ct,wt,W,Ue,Kt,Dt,K,Jt,h,Je,Ye,x,Xe,Ze,Qe,Zt,Qt,E,S,It,k]),rn=Re(i);rn.current=i;let an=Re(ke);an.current=ke,Le(()=>{if(!(J||Y)||!Bt)return;let e=Lt.current;return e?pn(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,J,Y,Bt]);let on=Be(e=>{Lt.current=e,typeof Pe==`function`?Pe(e):Pe&&(Pe.current=e)},[Pe]),sn={...U??{},"--voice-strength":Math.max(0,Math.min(1,Xt))};return q(R,{children:[q(`style`,{children:Oe?`${tn}
|
|
295
|
-
${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"data-voice-type":t,"data-voice-halfres":``,"data-active":J&&!Y?``:void 0,"data-fading":Y?``:void 0,"data-paused":J&&!Y&&(!Bt||k)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:De,style:sn,onAnimationEnd:qt,children:[e,q(`div`,{"data-voice-beam-bloom":!0}),Kt>0&&q(R,{children:[q(`div`,{"data-voice-beam-warp":`inner`}),q(`div`,{"data-voice-beam-warp":`bloom`})]}),!Cn&&q(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),q(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),Dt>0&&q(`div`,{"data-voice-beam-core":!0,children:q(`div`,{})}),Kt>0&&q(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:q(`filter`,{id:`vb-distort-${Ie}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*_t).toFixed(4)} ${(.05*_t).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),q(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),q(`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`}),q(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),On=`http://www.w3.org/2000/svg`,Z=Math.PI*2,kn=21.5,An=Math.sqrt(12)*kn,jn=154-An,Mn=Jn(),Nn=jn+Mn.length,Pn=.56*Z*kn/2,Fn=.75,In=.35,Ln=.55,Rn=22.5,zn=4.5,Bn=.3,Vn=Zn(.65,0,.35,1),Hn=Zn(.4,0,.2,1),Un=Zn(.34,1.56,.64,1),Wn=Zn(.2,0,0,1);var Gn=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(On,`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(On,`g`);t.classList.add(`seams-voiceid-ribbon-pixels`),t.setAttribute(`opacity`,`0`),(308-(301+zn))/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(On,`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-zn/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(On,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*(Bn+(1-Bn)*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?Ln+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-Wn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Wn(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 $(Ln,In+(1-In)*n,Wn(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-Wn(Q(n/150)),o=Vn(Q(i/.6)),s=Kn(!1)*kn*560,c=Xn(i,Nn,s),l=jn+Xn(i,Nn+Pn-jn,s),u=Ln+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,jn,308-jn,a)),this.middle.setAttribute(`opacity`,(u*(1-Wn(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+Kn(!1)*t,i=Pn/kn,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+Fn*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-Fn)*a*n]])e.setAttribute(`d`,Yn({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=Hn(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+Kn(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:Kn(!1)*650*(r-r*r/2),a=Vn(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Z,a)},Un(Q((n-600)/420)),Vn(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Wn(o);this.ripple.setAttribute(`r`,$(Rn,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`,(Rn*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`,Yn(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=qn(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 Kn(e){return Z/(e?3200:1800)}function qn(e){if(e<=jn)return{x:e,y:32,onLine:!0};if(e<Nn){let t=e-jn,n=0,r=Mn.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Mn.lengths[e]<t?n=e:r=e}let i=(t-Mn.lengths[n])/(Mn.lengths[r]-Mn.lengths[n]||1);return{x:$(Mn.points[n][0],Mn.points[r][0],i),y:$(Mn.points[n][1],Mn.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-Nn)/kn;return{x:154+kn*Math.cos(t),y:32+kn*Math.sin(t),onLine:!1}}function Jn(){let e=[[jn,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[jn+An*i,32-kn*(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 Yn(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+kn*Math.cos(i),o=32+kn*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Xn(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function Zn(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 Qn=Dn,$n={light:{core:`#8b98a5`,above:`#cfd9de`,mid:`#aab8c2`,below:`#657786`},dark:{core:`#ffffff`,above:`#8b98a5`,mid:`#cfd9de`,below:`#536471`}};function er(e){let t=e.trim();return Object.hasOwn(wt,t)?t:`ocean`}var tr=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new Gn(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(),Se(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){Se(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=er(e);Se(I(Qn,{className:`seams-voiceid-beam`,theme:t,...n===`mono`?{bandColors:$n[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 nr=`
|
|
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%; }
|
|
@@ -813,6 +813,56 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
813
813
|
color: var(--seams-colors-textPrimary, #eff2f3);
|
|
814
814
|
}
|
|
815
815
|
.seams-voiceid-status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
|
|
816
|
+
/* A result's receipt (PhraseResultView.receipt): a quiet box between the caption and the detail,
|
|
817
|
+
with a checked row for each check of the result, in the seal's colour. */
|
|
818
|
+
.seams-voiceid-status .seams-voiceid-receipt {
|
|
819
|
+
margin: 0.625rem 0;
|
|
820
|
+
padding: 0.625rem 0.875rem;
|
|
821
|
+
border: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
|
|
822
|
+
border-radius: 0.875rem;
|
|
823
|
+
text-align: left;
|
|
824
|
+
font-size: 0.8125rem;
|
|
825
|
+
line-height: 1.45;
|
|
826
|
+
color: var(--seams-colors-textPrimary, #eff2f3);
|
|
827
|
+
}
|
|
828
|
+
.seams-voiceid-receipt-head {
|
|
829
|
+
display: flex;
|
|
830
|
+
justify-content: space-between;
|
|
831
|
+
align-items: baseline;
|
|
832
|
+
gap: 0.5rem;
|
|
833
|
+
margin-bottom: 0.375rem;
|
|
834
|
+
}
|
|
835
|
+
.seams-voiceid-receipt-source {
|
|
836
|
+
font-size: 0.75rem;
|
|
837
|
+
color: var(--seams-colors-textSecondary, #9aa4ab);
|
|
838
|
+
}
|
|
839
|
+
.seams-voiceid-receipt-rows {
|
|
840
|
+
display: grid;
|
|
841
|
+
grid-template-columns: 1rem auto minmax(0, 1fr);
|
|
842
|
+
column-gap: 0.5rem;
|
|
843
|
+
row-gap: 0.25rem;
|
|
844
|
+
align-items: center;
|
|
845
|
+
}
|
|
846
|
+
.seams-voiceid-receipt-check {
|
|
847
|
+
display: flex;
|
|
848
|
+
color: var(--seams-colors-voiceSeal, var(--seams-colors-voiceLine, var(--seams-colors-textPrimary, #eff2f3)));
|
|
849
|
+
}
|
|
850
|
+
.seams-voiceid-receipt-check svg {
|
|
851
|
+
fill: none;
|
|
852
|
+
stroke: currentColor;
|
|
853
|
+
stroke-width: 2.4;
|
|
854
|
+
stroke-linecap: round;
|
|
855
|
+
stroke-linejoin: round;
|
|
856
|
+
}
|
|
857
|
+
.seams-voiceid-receipt-label { color: var(--seams-colors-textSecondary, #9aa4ab); }
|
|
858
|
+
.seams-voiceid-receipt-value { overflow-wrap: anywhere; }
|
|
859
|
+
.seams-voiceid-receipt-foot {
|
|
860
|
+
display: block;
|
|
861
|
+
margin-top: 0.5rem;
|
|
862
|
+
padding-top: 0.5rem;
|
|
863
|
+
border-top: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
|
|
864
|
+
font-size: 0.75rem;
|
|
865
|
+
}
|
|
816
866
|
.seams-voiceid-heard-mark {
|
|
817
867
|
background: none;
|
|
818
868
|
color: var(--seams-colors-error, oklch(0.74 0.166 19));
|
|
@@ -1030,7 +1080,14 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
1030
1080
|
color: var(--seams-colors-buttonBackground, var(--seams-colors-textPrimary, #eff2f3));
|
|
1031
1081
|
pointer-events: none;
|
|
1032
1082
|
}
|
|
1033
|
-
.seams-voiceid-line-icon > svg { width: 46%; height: 46%; }
|
|
1083
|
+
.seams-voiceid-line-icon > svg { grid-area: 1 / 1; width: 46%; height: 46%; }
|
|
1084
|
+
/* The tick waits, undrawn, in the same place as the microphone (phraseCard.ts sealIcon). */
|
|
1085
|
+
.seams-voiceid-line-icon-check { opacity: 0; }
|
|
1086
|
+
.seams-voiceid-line-icon-check > path { stroke-dasharray: 1; stroke-dashoffset: 1; }
|
|
1087
|
+
/* In a form card the check's line ends in the microphone's circle, not in a ring and a seal: the
|
|
1088
|
+
bar draws back into the circle from the right, and the circle's microphone turns into a tick. */
|
|
1089
|
+
.seams-voiceid-status-line[data-seal="icon"] > :is(.seams-voiceid-status-ring, .seams-voiceid-status-seal, .seams-voiceid-status-check) { opacity: 0; }
|
|
1090
|
+
.seams-voiceid-status-line[data-seal="icon"] > .seams-voiceid-status-bar { transform-origin: 0% 50%; }
|
|
1034
1091
|
.seams-voiceid-prompt[data-context][data-phrase-view="result"] > .seams-voiceid-line-icon { display: none; }
|
|
1035
1092
|
.seams-voiceid-prompt[data-context] > :is(.seams-voiceid-ribbon, .seams-voiceid-status-line) {
|
|
1036
1093
|
box-sizing: border-box;
|
|
@@ -1048,4 +1105,4 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
1048
1105
|
.seams-voiceid-close:hover { background: var(--seams-colors-surface, #202b31); }
|
|
1049
1106
|
.seams-voiceid-primary:hover:not(:disabled) { opacity: 0.9; }
|
|
1050
1107
|
}
|
|
1051
|
-
`,rr=new WeakSet;function ir(e){if(rr.has(e))return;rr.add(e);try{let t=new CSSStyleSheet;t.replaceSync(nr),e.adoptedStyleSheets=[...e.adoptedStyleSheets,t];return}catch{}let t=e.createElement(`style`),n=c();n&&t.setAttribute(`nonce`,n),t.textContent=nr,(e.head??e.documentElement).appendChild(t)}var ar=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,ir(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 tr(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=Or(e,`Cancel`,Cr),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(Dr(n)),this.element.dataset.context=``}showBack(e){if(e){this.cancel.setAttribute(`aria-label`,`Close`);let e=Or(this.element.ownerDocument,`Back`,wr);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`,wr),this.cancel}showMinimize(){let e=Or(this.element.ownerDocument,`Minimize`,Tr);return e.classList.add(`seams-voiceid-minimize`),this.cancel.before(e),e}change(e){return this.pendingChange=hr(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&&!mr()){if(await Promise.all(n.map(vr)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=hr(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),yr(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<pr){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,yr(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`)||yr(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 dr(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(xr))}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(lr)),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`,ur(t,a,sr-or+e*cr)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const or=150,sr=450,cr=40;function lr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function ur(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 dr(e){throw Error(`Unexpected capture event: ${String(e)}`)}const fr=`seams-voiceid-row`,pr=800;function mr(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function hr(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(gr)}}function gr(e){e()}function _r(e){for(let t of e.getAnimations())t.id===fr&&t.cancel()}function vr(e){let t=Number(getComputedStyle(e).opacity);return _r(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:fr}).finished.catch(br)}function yr(e){let t=mr();for(let[n,r]of e.entries()){_r(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:fr})}}function br(){}function xr({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:140*(1-t),easing:l,id:fr})}function Sr(e){if(!e.isConnected||mr()){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(br).finally(()=>e.remove())}const Cr=`M6 6l12 12M18 6L6 18`,wr=`m15 18-6-6 6-6`,Tr=`M6 12h12`,Er=[`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 Dr(e){let t=e.createElement(`span`);t.className=`seams-voiceid-line-icon`,t.setAttribute(`aria-hidden`,`true`);let n=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);n.setAttribute(`viewBox`,`0 0 24 24`);for(let t of Er){let r=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);r.setAttribute(`d`,t),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,`1.8`),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),n.append(r)}return t.append(n),t}function Or(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 kr=`Say this with your voice`,Ar=[`colorBackground`,`textPrimary`,`textSecondary`,`textMuted`,`borderPrimary`,`surface`,`surface3`,`buttonBackground`,`textButton`,`error`,`info`,`voiceLine`,`voiceEcho`,`voiceEchoDeep`,`voiceFill`,`voicePixelBackground`];function jr(e){return new Mr(e)}var Mr=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,Fr);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`,kr),Nr(this.element,e.colors),this.prompt=new ar(document,kr,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?Ir(f):null;f&&(this.prompt.continueFrom(f),this.prompt.record.hidden=!0,this.autoStart=!1),this.card=new m(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 h=u===`back`?this.pressBack:this.pressClose;this.prompt.cancel.addEventListener(`click`,h),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??Pr(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=Lr();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(),Sr(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 Nr(e,t){if(t)for(let n of Ar){let r=t[n];r&&e.style.setProperty(`--seams-colors-${n}`,r)}}function Pr(e){return getComputedStyle(e).getPropertyValue(`--seams-shape-voiceLine`).trim()===`pixels`?`pixels`:`wave`}function Fr(){}function Ir(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function Lr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{m as PhraseCard,ar as VoicePrompt,Gn as VoiceRibbon,tr as VoiceVisual,Sr as leaveSurface,jr as openPhraseCard};
|
|
1108
|
+
`,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};
|
|
@@ -18,6 +18,10 @@ const GAP_CLOSE_MS = 240;
|
|
|
18
18
|
const RING_MS = 440;
|
|
19
19
|
const SEAL_MS = 320;
|
|
20
20
|
const CHECK_MS = 260;
|
|
21
|
+
/** A form card: the bar draws back into the microphone's circle, then the microphone goes. */
|
|
22
|
+
const RETRACT_MS = 360;
|
|
23
|
+
const ICON_SWAP_MS = 160;
|
|
24
|
+
const PULSE_MS = 320;
|
|
21
25
|
const RING_RADIUS = 21.5;
|
|
22
26
|
const SEAL_RADIUS = 22.5;
|
|
23
27
|
const CHECK_PATH = "M161 26.8 151.4 36.3 147.1 32";
|
|
@@ -155,6 +159,7 @@ var PhraseCard = class {
|
|
|
155
159
|
dim: false,
|
|
156
160
|
caption: `result:${JSON.stringify([
|
|
157
161
|
view.caption,
|
|
162
|
+
view.receipt ?? null,
|
|
158
163
|
view.detail,
|
|
159
164
|
view.link ?? null
|
|
160
165
|
])}`,
|
|
@@ -162,7 +167,7 @@ var PhraseCard = class {
|
|
|
162
167
|
};
|
|
163
168
|
await this.transition(rows, version, () => {
|
|
164
169
|
element.dataset.phraseView = "result";
|
|
165
|
-
this.writeCaption(this.markedText(view.caption), this.detailNodes(view));
|
|
170
|
+
this.writeCaption(this.markedText(view.caption), this.detailNodes(view), view.receipt);
|
|
166
171
|
this.writeAction(view.action);
|
|
167
172
|
this.prompt.record.hidden = false;
|
|
168
173
|
});
|
|
@@ -244,21 +249,51 @@ var PhraseCard = class {
|
|
|
244
249
|
}
|
|
245
250
|
detailNodes(view) {
|
|
246
251
|
if (!view.link) return [view.detail];
|
|
247
|
-
const link = this.prompt.element.ownerDocument.createElement("a");
|
|
248
|
-
link.href = view.link.href;
|
|
249
|
-
link.target = "_blank";
|
|
250
|
-
link.rel = "noopener noreferrer";
|
|
251
|
-
link.textContent = view.link.text;
|
|
252
252
|
return [
|
|
253
253
|
view.detail,
|
|
254
254
|
" ",
|
|
255
|
-
link
|
|
255
|
+
this.linkNode(view.link)
|
|
256
256
|
];
|
|
257
257
|
}
|
|
258
|
-
/**
|
|
259
|
-
|
|
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) {
|
|
260
294
|
const status = this.prompt.status;
|
|
261
|
-
|
|
295
|
+
status.classList.toggle("seams-voiceid-has-receipt", receipt !== void 0);
|
|
296
|
+
if (typeof first === "string" && second.length === 0 && !receipt) {
|
|
262
297
|
status.classList.remove("seams-voiceid-two-lines");
|
|
263
298
|
status.textContent = first;
|
|
264
299
|
return;
|
|
@@ -270,7 +305,11 @@ var PhraseCard = class {
|
|
|
270
305
|
const two = document.createElement("span");
|
|
271
306
|
two.className = "seams-voiceid-caption-detail";
|
|
272
307
|
two.append(...second);
|
|
273
|
-
status.replaceChildren(
|
|
308
|
+
status.replaceChildren(...receipt ? [
|
|
309
|
+
one,
|
|
310
|
+
this.receiptNode(receipt),
|
|
311
|
+
two
|
|
312
|
+
] : [one, two]);
|
|
274
313
|
status.classList.add("seams-voiceid-two-lines");
|
|
275
314
|
}
|
|
276
315
|
writeAction(action) {
|
|
@@ -341,13 +380,21 @@ var PhraseCard = class {
|
|
|
341
380
|
this.paintStates();
|
|
342
381
|
if (blocked) await wait(this.motion.matches ? 0 : BLOCKER_HOLD_MS);
|
|
343
382
|
}
|
|
344
|
-
/**
|
|
383
|
+
/**
|
|
384
|
+
* The segments fill and the gaps close. Then the line shrinks as the ring draws, and the seal
|
|
385
|
+
* and its check come; in a form card, the line ends in the microphone's circle instead.
|
|
386
|
+
*/
|
|
345
387
|
async sealLine(version) {
|
|
346
388
|
await this.setSegments(Array.from({ length: SEGMENTS }, () => "done"));
|
|
347
389
|
if (this.stale(version)) return;
|
|
348
390
|
const reduced = this.motion.matches;
|
|
349
391
|
await this.tween(reduced ? 0 : GAP_CLOSE_MS, (progress) => this.layoutSegments(GAP * (1 - progress), 3));
|
|
350
392
|
if (this.stale(version)) return;
|
|
393
|
+
const icon = this.lineIcon();
|
|
394
|
+
if (icon) {
|
|
395
|
+
await this.sealIcon(version, icon, reduced);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
351
398
|
this.line.dataset.seal = "";
|
|
352
399
|
const circumference = 2 * Math.PI * RING_RADIUS;
|
|
353
400
|
this.ring.style.strokeDasharray = String(circumference);
|
|
@@ -364,16 +411,58 @@ var PhraseCard = class {
|
|
|
364
411
|
if (this.stale(version)) return;
|
|
365
412
|
await this.check.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], timing(CHECK_MS, EASE_IN_OUT)).finished;
|
|
366
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* A form card's success: the solid bar draws back to the left into the microphone's circle,
|
|
416
|
+
* the microphone goes, and a tick draws in its place in the button's colour, with one small
|
|
417
|
+
* pulse of the circle. The pill then becomes the result's button.
|
|
418
|
+
*/
|
|
419
|
+
async sealIcon(version, icon, reduced) {
|
|
420
|
+
this.line.dataset.seal = "icon";
|
|
421
|
+
const timing = (duration, easing) => ({
|
|
422
|
+
duration: reduced ? 0 : duration,
|
|
423
|
+
easing,
|
|
424
|
+
fill: "forwards"
|
|
425
|
+
});
|
|
426
|
+
const bar = this.bar.getBoundingClientRect();
|
|
427
|
+
const circle = icon.getBoundingClientRect();
|
|
428
|
+
const scale = this.bar.getScreenCTM()?.a || 1;
|
|
429
|
+
const shift = (circle.left + circle.width / 2 - bar.left) / scale;
|
|
430
|
+
await this.bar.animate([{ transform: "translateX(0) scaleX(1)" }, { transform: `translateX(${shift}px) scaleX(0)` }], timing(RETRACT_MS, EASE_RING)).finished;
|
|
431
|
+
if (this.stale(version)) return;
|
|
432
|
+
const { microphone, check, tick } = lineIconParts(icon);
|
|
433
|
+
microphone?.animate([{
|
|
434
|
+
opacity: 1,
|
|
435
|
+
transform: "scale(1)"
|
|
436
|
+
}, {
|
|
437
|
+
opacity: 0,
|
|
438
|
+
transform: "scale(0.6)"
|
|
439
|
+
}], timing(ICON_SWAP_MS, EASE_IN_OUT));
|
|
440
|
+
check?.animate([{ opacity: 0 }, { opacity: 1 }], timing(ICON_SWAP_MS, EASE_IN_OUT));
|
|
441
|
+
icon.animate([
|
|
442
|
+
{ transform: "scale(1)" },
|
|
443
|
+
{ transform: "scale(1.1)" },
|
|
444
|
+
{ transform: "scale(1)" }
|
|
445
|
+
], timing(PULSE_MS, EASE_MOVE));
|
|
446
|
+
await tick?.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], timing(CHECK_MS, EASE_IN_OUT)).finished;
|
|
447
|
+
}
|
|
448
|
+
/** The microphone's circle of a form card, or null for another card. */
|
|
449
|
+
lineIcon() {
|
|
450
|
+
return this.prompt.element.querySelector(":scope > .seams-voiceid-line-icon");
|
|
451
|
+
}
|
|
367
452
|
resetLine() {
|
|
368
453
|
this.morph = null;
|
|
369
454
|
this.states = [];
|
|
370
455
|
delete this.line.dataset.seal;
|
|
456
|
+
const icon = this.lineIcon();
|
|
457
|
+
const iconParts = icon ? Object.values(lineIconParts(icon)) : [];
|
|
371
458
|
for (const part of [
|
|
372
459
|
this.bar,
|
|
373
460
|
this.ring,
|
|
374
461
|
this.seal,
|
|
375
|
-
this.check
|
|
376
|
-
|
|
462
|
+
this.check,
|
|
463
|
+
icon,
|
|
464
|
+
...iconParts
|
|
465
|
+
]) part?.getAnimations().forEach((animation) => animation.cancel());
|
|
377
466
|
this.layoutSegments(0, 3);
|
|
378
467
|
this.paintStates();
|
|
379
468
|
}
|
|
@@ -425,6 +514,18 @@ function passkeyIcon(document) {
|
|
|
425
514
|
}
|
|
426
515
|
return icon;
|
|
427
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
|
+
}
|
|
428
529
|
/** Fades out from where the element is, so a row that is still arriving never flashes. */
|
|
429
530
|
function fade(element, duration) {
|
|
430
531
|
const from = Number(getComputedStyle(element).opacity);
|
|
@@ -452,5 +553,14 @@ function fadeIn(element, reduced, delay) {
|
|
|
452
553
|
function wait(ms) {
|
|
453
554
|
return new Promise((resolve) => window.setTimeout(resolve, ms));
|
|
454
555
|
}
|
|
556
|
+
/** The parts of a form card's microphone circle that the success animation moves. */
|
|
557
|
+
function lineIconParts(icon) {
|
|
558
|
+
const check = icon.querySelector(".seams-voiceid-line-icon-check");
|
|
559
|
+
return {
|
|
560
|
+
microphone: icon.querySelector(".seams-voiceid-line-icon-microphone"),
|
|
561
|
+
check,
|
|
562
|
+
tick: check?.querySelector("path") ?? null
|
|
563
|
+
};
|
|
564
|
+
}
|
|
455
565
|
//#endregion
|
|
456
566
|
export { PhraseCard };
|
package/dist/esm/card/prompt.js
CHANGED
|
@@ -524,6 +524,56 @@ const CSS = `
|
|
|
524
524
|
color: var(--seams-colors-textPrimary, #eff2f3);
|
|
525
525
|
}
|
|
526
526
|
.seams-voiceid-status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
|
|
527
|
+
/* A result's receipt (PhraseResultView.receipt): a quiet box between the caption and the detail,
|
|
528
|
+
with a checked row for each check of the result, in the seal's colour. */
|
|
529
|
+
.seams-voiceid-status .seams-voiceid-receipt {
|
|
530
|
+
margin: 0.625rem 0;
|
|
531
|
+
padding: 0.625rem 0.875rem;
|
|
532
|
+
border: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
|
|
533
|
+
border-radius: 0.875rem;
|
|
534
|
+
text-align: left;
|
|
535
|
+
font-size: 0.8125rem;
|
|
536
|
+
line-height: 1.45;
|
|
537
|
+
color: var(--seams-colors-textPrimary, #eff2f3);
|
|
538
|
+
}
|
|
539
|
+
.seams-voiceid-receipt-head {
|
|
540
|
+
display: flex;
|
|
541
|
+
justify-content: space-between;
|
|
542
|
+
align-items: baseline;
|
|
543
|
+
gap: 0.5rem;
|
|
544
|
+
margin-bottom: 0.375rem;
|
|
545
|
+
}
|
|
546
|
+
.seams-voiceid-receipt-source {
|
|
547
|
+
font-size: 0.75rem;
|
|
548
|
+
color: var(--seams-colors-textSecondary, #9aa4ab);
|
|
549
|
+
}
|
|
550
|
+
.seams-voiceid-receipt-rows {
|
|
551
|
+
display: grid;
|
|
552
|
+
grid-template-columns: 1rem auto minmax(0, 1fr);
|
|
553
|
+
column-gap: 0.5rem;
|
|
554
|
+
row-gap: 0.25rem;
|
|
555
|
+
align-items: center;
|
|
556
|
+
}
|
|
557
|
+
.seams-voiceid-receipt-check {
|
|
558
|
+
display: flex;
|
|
559
|
+
color: var(--seams-colors-voiceSeal, var(--seams-colors-voiceLine, var(--seams-colors-textPrimary, #eff2f3)));
|
|
560
|
+
}
|
|
561
|
+
.seams-voiceid-receipt-check svg {
|
|
562
|
+
fill: none;
|
|
563
|
+
stroke: currentColor;
|
|
564
|
+
stroke-width: 2.4;
|
|
565
|
+
stroke-linecap: round;
|
|
566
|
+
stroke-linejoin: round;
|
|
567
|
+
}
|
|
568
|
+
.seams-voiceid-receipt-label { color: var(--seams-colors-textSecondary, #9aa4ab); }
|
|
569
|
+
.seams-voiceid-receipt-value { overflow-wrap: anywhere; }
|
|
570
|
+
.seams-voiceid-receipt-foot {
|
|
571
|
+
display: block;
|
|
572
|
+
margin-top: 0.5rem;
|
|
573
|
+
padding-top: 0.5rem;
|
|
574
|
+
border-top: 1px solid var(--seams-colors-borderPrimary, rgba(239, 242, 243, 0.16));
|
|
575
|
+
font-size: 0.75rem;
|
|
576
|
+
}
|
|
527
577
|
.seams-voiceid-heard-mark {
|
|
528
578
|
background: none;
|
|
529
579
|
color: var(--seams-colors-error, oklch(0.74 0.166 19));
|
|
@@ -741,7 +791,14 @@ const CSS = `
|
|
|
741
791
|
color: var(--seams-colors-buttonBackground, var(--seams-colors-textPrimary, #eff2f3));
|
|
742
792
|
pointer-events: none;
|
|
743
793
|
}
|
|
744
|
-
.seams-voiceid-line-icon > svg { width: 46%; height: 46%; }
|
|
794
|
+
.seams-voiceid-line-icon > svg { grid-area: 1 / 1; width: 46%; height: 46%; }
|
|
795
|
+
/* The tick waits, undrawn, in the same place as the microphone (phraseCard.ts sealIcon). */
|
|
796
|
+
.seams-voiceid-line-icon-check { opacity: 0; }
|
|
797
|
+
.seams-voiceid-line-icon-check > path { stroke-dasharray: 1; stroke-dashoffset: 1; }
|
|
798
|
+
/* In a form card the check's line ends in the microphone's circle, not in a ring and a seal: the
|
|
799
|
+
bar draws back into the circle from the right, and the circle's microphone turns into a tick. */
|
|
800
|
+
.seams-voiceid-status-line[data-seal="icon"] > :is(.seams-voiceid-status-ring, .seams-voiceid-status-seal, .seams-voiceid-status-check) { opacity: 0; }
|
|
801
|
+
.seams-voiceid-status-line[data-seal="icon"] > .seams-voiceid-status-bar { transform-origin: 0% 50%; }
|
|
745
802
|
.seams-voiceid-prompt[data-context][data-phrase-view="result"] > .seams-voiceid-line-icon { display: none; }
|
|
746
803
|
.seams-voiceid-prompt[data-context] > :is(.seams-voiceid-ribbon, .seams-voiceid-status-line) {
|
|
747
804
|
box-sizing: border-box;
|
|
@@ -1353,25 +1410,40 @@ const MICROPHONE_PATHS = [
|
|
|
1353
1410
|
"M8 21h8",
|
|
1354
1411
|
"M12 17v4"
|
|
1355
1412
|
];
|
|
1356
|
-
/** The
|
|
1413
|
+
/** The tick that takes the microphone's place when a form card's check passes. */
|
|
1414
|
+
const ICON_CHECK_PATH = "M5 12.5l4.5 4.5L19 7.5";
|
|
1415
|
+
/**
|
|
1416
|
+
* The microphone at the left of a form card's button, in its own circle, and the tick that
|
|
1417
|
+
* takes its place when the check passes (phraseCard.ts sealIcon).
|
|
1418
|
+
*/
|
|
1357
1419
|
function microphoneIcon(document) {
|
|
1358
1420
|
const circle = document.createElement("span");
|
|
1359
1421
|
circle.className = "seams-voiceid-line-icon";
|
|
1360
1422
|
circle.setAttribute("aria-hidden", "true");
|
|
1423
|
+
const icon = lineIconSvg(document, "seams-voiceid-line-icon-microphone");
|
|
1424
|
+
for (const d of MICROPHONE_PATHS) icon.append(lineIconPath(document, d, "1.8"));
|
|
1425
|
+
const check = lineIconSvg(document, "seams-voiceid-line-icon-check");
|
|
1426
|
+
const tick = lineIconPath(document, ICON_CHECK_PATH, "2.6");
|
|
1427
|
+
tick.setAttribute("pathLength", "1");
|
|
1428
|
+
check.append(tick);
|
|
1429
|
+
circle.append(icon, check);
|
|
1430
|
+
return circle;
|
|
1431
|
+
}
|
|
1432
|
+
function lineIconSvg(document, className) {
|
|
1361
1433
|
const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1362
1434
|
icon.setAttribute("viewBox", "0 0 24 24");
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
return
|
|
1435
|
+
icon.setAttribute("class", className);
|
|
1436
|
+
return icon;
|
|
1437
|
+
}
|
|
1438
|
+
function lineIconPath(document, d, width) {
|
|
1439
|
+
const part = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1440
|
+
part.setAttribute("d", d);
|
|
1441
|
+
part.setAttribute("fill", "none");
|
|
1442
|
+
part.setAttribute("stroke", "currentColor");
|
|
1443
|
+
part.setAttribute("stroke-width", width);
|
|
1444
|
+
part.setAttribute("stroke-linecap", "round");
|
|
1445
|
+
part.setAttribute("stroke-linejoin", "round");
|
|
1446
|
+
return part;
|
|
1375
1447
|
}
|
|
1376
1448
|
/** A control in a corner of the card, with an icon and no text. */
|
|
1377
1449
|
function cornerButton(document, label, path) {
|
|
@@ -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
|
-
/**
|
|
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. */
|
|
@@ -63,8 +73,19 @@ export declare class PhraseCard {
|
|
|
63
73
|
* segment, which then shows its colour. Resolves when the result may follow.
|
|
64
74
|
*/
|
|
65
75
|
private setSegments;
|
|
66
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The segments fill and the gaps close. Then the line shrinks as the ring draws, and the seal
|
|
78
|
+
* and its check come; in a form card, the line ends in the microphone's circle instead.
|
|
79
|
+
*/
|
|
67
80
|
private sealLine;
|
|
81
|
+
/**
|
|
82
|
+
* A form card's success: the solid bar draws back to the left into the microphone's circle,
|
|
83
|
+
* the microphone goes, and a tick draws in its place in the button's colour, with one small
|
|
84
|
+
* pulse of the circle. The pill then becomes the result's button.
|
|
85
|
+
*/
|
|
86
|
+
private sealIcon;
|
|
87
|
+
/** The microphone's circle of a form card, or null for another card. */
|
|
88
|
+
private lineIcon;
|
|
68
89
|
private resetLine;
|
|
69
90
|
private paintStates;
|
|
70
91
|
private layoutSegments;
|
|
@@ -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