@seams/voice-capture 0.68.0 → 0.68.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -109,8 +109,10 @@ try {
109
109
  - `record()` resolves with `recorded` (the samples) or `cancelled`. A too quiet recording
110
110
  stays on the card with "Try again".
111
111
  - `autoStart: true` starts the first recording with no press on Record. Use it when the person
112
- just asked for the card with a click or a key. If the browser starts audio only after a
113
- press, the card keeps its Record button.
112
+ just asked for the card with a click or a key. The card then shows no Record button and has
113
+ no row for it, so it is shorter and its rows sit in the middle. If the browser starts audio
114
+ only after a press, the card shows its Record button; "Try again" and a result's button
115
+ bring the row back too.
114
116
  - `show()` resolves with `action` when the person selects the button of a result, `closed`
115
117
  when the person closes the card, or `replaced` when a new view or recording takes its place.
116
118
  - The card uses the CSS variables `--seams-colors-*`, `--seams-shape-*` and
@@ -118,6 +120,17 @@ try {
118
120
  Record and the other main buttons use `--seams-colors-buttonBackground` and
119
121
  `--seams-colors-textButton`. Without them, the main button has the text colour
120
122
  (`textPrimary`) with the card's background colour as its text.
123
+ The voice line and the Beam glow under it take these values, and keep today's look
124
+ without them:
125
+
126
+ | CSS variable | Theme key (Seams Wallet) | What it sets | Default |
127
+ | --- | --- | --- | --- |
128
+ | `--seams-colors-voiceLine` | `colors.voiceLine` | The voice line, its ring and its seal | The text colour |
129
+ | `--seams-colors-voiceEcho` | `colors.voiceEcho` | Echo lines 1 and 3 behind the line | `voiceLine` |
130
+ | `--seams-colors-voiceEchoDeep` | `colors.voiceEchoDeep` | Echo line 2 | `voiceEcho` |
131
+ | `--seams-colors-voiceBeam` | `colors.voiceBeam` | The Beam palette: `colorful`, `mono`, `ocean`, `sunset`, `forest`, `candy`, `ice` or `gold`. `mono` is grey, band included | `ocean` |
132
+ | `--seams-shape-voiceLineWidth` | `shape.voiceLineWidth` | The width of the voice line | `1px` |
133
+ | `--seams-shape-voiceEchoWidth` | `shape.voiceEchoWidth` | The width of the echo lines | `0.65px` |
121
134
  `data-theme="light"` or `"dark"` on the page selects the glow colours.
122
135
  - `frame` adds what a host needs: the parent element, more class names, the corner controls,
123
136
  and a callback when the card is in the document.
@@ -292,7 +292,7 @@ ${O?`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
292
292
  animation-play-state: paused !important;
293
293
  }
294
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=Kn(),Nn=jn+Mn.length,Pn=.56*Z*kn/2,Fn=.75,In=.35,Ln=.55,Rn=22.5,zn=Yn(.65,0,.35,1),Bn=Yn(.4,0,.2,1),Vn=Yn(.34,1.56,.64,1),Hn=Yn(.2,0,0,1);var Un=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;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)this.lines.push(this.append(e,`path`,t===0?`1`:`0.65`));this.paint(performance.now())}readLevel=()=>this.level;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.paint(e),!this.element.isConnected||this.stage.kind===`sealed`||this.stage.kind===`line`&&this.phase===`idle`&&this.level<=.001||(this.frame=requestAnimationFrame(this.draw))};idleAmplitude(e){return this.phase!==`listening`||this.motion.matches?0:.085*(.72+.28*Math.sin(e/2600*Z))}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.stage.kind){case`line`: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))}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-Hn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Hn(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`,`1`),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,Hn(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-Hn(Q(n/150)),o=zn(Q(i/.6)),s=Wn(!1)*kn*560,c=Jn(i,Nn,s),l=jn+Jn(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`,$(1,2,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-Hn(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+Wn(!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`,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=Bn(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+Wn(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:Wn(!1)*650*(r-r*r/2),a=zn(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Z,a)},Vn(Q((n-600)/420)),zn(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Hn(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`,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=Gn(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 Wn(e){return Z/(e?3200:1800)}function Gn(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 Kn(){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 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+kn*Math.cos(i),o=32+kn*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Jn(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function Yn(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 Xn=Dn;var Zn=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new Un(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();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`]})}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=()=>{this.disposed||Se(I(Xn,{className:`seams-voiceid-beam`,theme:(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:`ocean`,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const Qn=`
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=Kn(),Nn=jn+Mn.length,Pn=.56*Z*kn/2,Fn=.75,In=.35,Ln=.55,Rn=22.5,zn=Yn(.65,0,.35,1),Bn=Yn(.4,0,.2,1),Vn=Yn(.34,1.56,.64,1),Hn=Yn(.2,0,0,1);var Un=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;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;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.paint(e),!this.element.isConnected||this.stage.kind===`sealed`||this.stage.kind===`line`&&this.phase===`idle`&&this.level<=.001||(this.frame=requestAnimationFrame(this.draw))};idleAmplitude(e){return this.phase!==`listening`||this.motion.matches?0:.085*(.72+.28*Math.sin(e/2600*Z))}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.stage.kind){case`line`: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))}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-Hn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Hn(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,Hn(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-Hn(Q(n/150)),o=zn(Q(i/.6)),s=Wn(!1)*kn*560,c=Jn(i,Nn,s),l=jn+Jn(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-Hn(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+Wn(!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`,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=Bn(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+Wn(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:Wn(!1)*650*(r-r*r/2),a=zn(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Z,a)},Vn(Q((n-600)/420)),zn(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Hn(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`,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=Gn(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 Wn(e){return Z/(e?3200:1800)}function Gn(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 Kn(){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 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+kn*Math.cos(i),o=32+kn*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Jn(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function Yn(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 Xn=Dn,Zn={light:{core:`#8b98a5`,above:`#cfd9de`,mid:`#aab8c2`,below:`#657786`},dark:{core:`#ffffff`,above:`#8b98a5`,mid:`#cfd9de`,below:`#536471`}};function Qn(e){let t=e.trim();return Object.hasOwn(wt,t)?t:`ocean`}var $n=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new Un(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();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`]})}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=(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,t=Qn(getComputedStyle(this.prompt).getPropertyValue(`--seams-colors-voiceBeam`));Se(I(Xn,{className:`seams-voiceid-beam`,theme:e,...t===`mono`?{bandColors:Zn[e]}:{},level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:t,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const er=`
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%; }
@@ -544,6 +544,17 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
544
544
  overflow: visible;
545
545
  }
546
546
  .seams-voiceid-ribbon .seams-voiceid-ribbon-check { stroke: var(--seams-colors-colorBackground, #192024); }
547
+ /* The theme can colour the voice line (with its ring and its seal) and its three echo lines,
548
+ and set their widths. With none of these values, the line has the card's text colour. */
549
+ .seams-voiceid-ribbon { color: var(--seams-colors-voiceLine, currentColor); }
550
+ .seams-voiceid-ribbon .seams-voiceid-ribbon-line { stroke-width: var(--seams-shape-voiceLineWidth, 1px); }
551
+ .seams-voiceid-ribbon .seams-voiceid-ribbon-echo {
552
+ stroke-width: var(--seams-shape-voiceEchoWidth, 0.65px);
553
+ color: var(--seams-colors-voiceEcho, var(--seams-colors-voiceLine, currentColor));
554
+ }
555
+ .seams-voiceid-ribbon .seams-voiceid-ribbon-echo[data-layer="2"] {
556
+ color: var(--seams-colors-voiceEchoDeep, var(--seams-colors-voiceEcho, var(--seams-colors-voiceLine, currentColor)));
557
+ }
547
558
  .seams-voiceid-prompt .seams-voiceid-phrase.seams-voiceid-success-headline {
548
559
  display: grid;
549
560
  align-content: end;
@@ -755,6 +766,11 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
755
766
  grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 0;
756
767
  }
757
768
  .seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-record-slot { display: none; }
769
+ /* A card that records by itself (autoStart) has no Record row: its rows sit in the middle. */
770
+ .seams-voiceid-prompt[data-auto-start] {
771
+ grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 0;
772
+ }
773
+ .seams-voiceid-prompt[data-auto-start] > .seams-voiceid-record-slot { display: none; }
758
774
  .seams-voiceid-prompt[data-phrase-view] .seams-voiceid-microphone { display: none; }
759
775
  .seams-voiceid-prompt .seams-voiceid-close { transition: opacity 150ms ease, visibility 0s linear 0s; }
760
776
  .seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-close {
@@ -798,4 +814,4 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
798
814
  .seams-voiceid-close:hover { background: var(--seams-colors-surface, #202b31); }
799
815
  .seams-voiceid-primary:hover:not(:disabled) { opacity: 0.9; }
800
816
  }
801
- `,$n=new WeakSet;function er(e){if($n.has(e))return;$n.add(e);try{let t=new CSSStyleSheet;t.replaceSync(Qn),e.adoptedStyleSheets=[...e.adoptedStyleSheets,t];return}catch{}let t=e.createElement(`style`),n=c();n&&t.setAttribute(`nonce`,n),t.textContent=Qn,(e.head??e.documentElement).appendChild(t)}var tr=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,er(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 Zn(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=xr(e,`Cancel`,yr),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)}showBack(e){if(e){this.cancel.setAttribute(`aria-label`,`Close`);let e=xr(this.element.ownerDocument,`Back`,br);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`,br),this.cancel}change(e){return this.pendingChange=dr(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&&!ur()){if(await Promise.all(n.map(mr)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=dr(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),hr(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<lr){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,hr(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`)||hr(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 sr(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(_r))}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(ar)),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`,or(t,a,rr-nr+e*ir)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const nr=150,rr=450,ir=40;function ar(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function or(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 sr(e){throw Error(`Unexpected capture event: ${String(e)}`)}const cr=`seams-voiceid-row`,lr=800;function ur(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function dr(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(fr)}}function fr(e){e()}function pr(e){for(let t of e.getAnimations())t.id===cr&&t.cancel()}function mr(e){let t=Number(getComputedStyle(e).opacity);return pr(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:cr}).finished.catch(gr)}function hr(e){let t=ur();for(let[n,r]of e.entries()){pr(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:20+n*30,duration:t?150:200,easing:l,fill:`backwards`,id:cr})}}function gr(){}function _r({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:200*(1-t),easing:l,id:cr})}function vr(e){if(!e.isConnected||ur()){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(gr).finally(()=>e.remove())}const yr=`M6 6l12 12M18 6L6 18`,br=`m15 18-6-6 6-6`;function xr(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 Sr=`Say this with your voice`,Cr=`Say this sentence`,wr=`Read it naturally, then pause.`;function Tr(e){return new Er(e)}var Er=class{element;prompt;card;unmounted;outer;detector;pressed;back;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,Dr);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`,Sr),this.prompt=new tr(document,Sr,n),this.prompt.title.textContent=Cr;let c=/[.!?]$/.test(n)?n:`${n}.`;this.prompt.phrase.textContent=c,delete this.prompt.phrase.dataset.voiceidPhrase,this.prompt.status.textContent=wr,this.prompt.record.textContent=`Record`;let l=r.controls??`close`;this.pressed=r.pressed;let u=l===`close`?null:this.prompt.showBack(l===`back_and_close`);this.back=u===this.prompt.cancel?null:u;let d=a?.querySelector(`:scope > .seams-voiceid-prompt`)??null,f=d?Or(d):null;d&&(this.prompt.continueFrom(d),this.prompt.record.hidden=!0,this.autoStart=!1),this.card=new m(this.prompt,{label:Cr,sentence:c,message:wr,action:`Record`},f),this.element.append(this.prompt.element),this.prompt.record.addEventListener(`click`,this.press);let p=l===`back`?this.pressBack:this.pressClose;this.prompt.cancel.addEventListener(`click`,p),this.back?.addEventListener(`click`,this.pressBack),this.element.addEventListener(`cancel`,this.cancel),i.addEventListener(`abort`,this.cancel),a?a.replaceWith(this.element):o.appendChild(this.element),r.hugged&&this.element.classList.add(`seams-voiceid-hugged`),this.unmounted=r.mounted?.(this.element),f?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=kr();return this.recording=e,this.view?(this.view=null,this.card.showPrompt()):this.autoStart&&this.begin(e),this.autoStart=!1,e.promise}show(e){return this.closed?Promise.resolve(`closed`):(this.settleChoice(`replaced`),this.view=e,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.card.dispose(),this.prompt.dispose(),vr(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.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(wr,`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.card.beginCheck():this.prompt.capture(e)};retry(e,t=`Try again`){this.started=!1,this.prompt.record.textContent=t,this.prompt.ready(e),this.prompt.record.focus()}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 Dr(){}function Or(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function kr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{m as PhraseCard,tr as VoicePrompt,Un as VoiceRibbon,Zn as VoiceVisual,vr as leaveSurface,Tr as openPhraseCard};
817
+ `,tr=new WeakSet;function nr(e){if(tr.has(e))return;tr.add(e);try{let t=new CSSStyleSheet;t.replaceSync(er),e.adoptedStyleSheets=[...e.adoptedStyleSheets,t];return}catch{}let t=e.createElement(`style`),n=c();n&&t.setAttribute(`nonce`,n),t.textContent=er,(e.head??e.documentElement).appendChild(t)}var rr=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,nr(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 $n(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=Cr(e,`Cancel`,xr),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)}showBack(e){if(e){this.cancel.setAttribute(`aria-label`,`Close`);let e=Cr(this.element.ownerDocument,`Back`,Sr);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`,Sr),this.cancel}change(e){return this.pendingChange=pr(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&&!fr()){if(await Promise.all(n.map(gr)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=pr(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),_r(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<dr){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,_r(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`)||_r(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 lr(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(yr))}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(sr)),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`,cr(t,a,ar-ir+e*or)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const ir=150,ar=450,or=40;function sr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function cr(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 lr(e){throw Error(`Unexpected capture event: ${String(e)}`)}const ur=`seams-voiceid-row`,dr=800;function fr(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function pr(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(mr)}}function mr(e){e()}function hr(e){for(let t of e.getAnimations())t.id===ur&&t.cancel()}function gr(e){let t=Number(getComputedStyle(e).opacity);return hr(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:ur}).finished.catch(vr)}function _r(e){let t=fr();for(let[n,r]of e.entries()){hr(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:20+n*30,duration:t?150:200,easing:l,fill:`backwards`,id:ur})}}function vr(){}function yr({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:200*(1-t),easing:l,id:ur})}function br(e){if(!e.isConnected||fr()){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(vr).finally(()=>e.remove())}const xr=`M6 6l12 12M18 6L6 18`,Sr=`m15 18-6-6 6-6`;function Cr(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 wr=`Say this with your voice`,Tr=`Say this sentence`,Er=`Read it naturally, then pause.`;function Dr(e){return new Or(e)}var Or=class{element;prompt;card;unmounted;outer;detector;pressed;back;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,kr);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`,wr),this.prompt=new rr(document,wr,n),this.prompt.title.textContent=Tr;let c=/[.!?]$/.test(n)?n:`${n}.`;this.prompt.phrase.textContent=c,delete this.prompt.phrase.dataset.voiceidPhrase,this.prompt.status.textContent=Er,this.prompt.record.textContent=`Record`;let l=r.controls??`close`;this.pressed=r.pressed;let u=l===`close`?null:this.prompt.showBack(l===`back_and_close`);this.back=u===this.prompt.cancel?null:u;let d=a?.querySelector(`:scope > .seams-voiceid-prompt`)??null,f=d?Ar(d):null;d&&(this.prompt.continueFrom(d),this.prompt.record.hidden=!0,this.autoStart=!1),this.card=new m(this.prompt,{label:Tr,sentence:c,message:Er,action:`Record`},f),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 p=l===`back`?this.pressBack:this.pressClose;this.prompt.cancel.addEventListener(`click`,p),this.back?.addEventListener(`click`,this.pressBack),this.element.addEventListener(`cancel`,this.cancel),i.addEventListener(`abort`,this.cancel),a?a.replaceWith(this.element):o.appendChild(this.element),r.hugged&&this.element.classList.add(`seams-voiceid-hugged`),this.unmounted=r.mounted?.(this.element),f||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=jr();return this.recording=e,this.view?(this.view=null,this.card.showPrompt()):this.autoStart&&this.begin(e),this.autoStart=!1,e.promise}show(e){return delete this.prompt.element.dataset.autoStart,this.closed?Promise.resolve(`closed`):(this.settleChoice(`replaced`),this.view=e,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.card.dispose(),this.prompt.dispose(),br(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.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(Er,`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.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()}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 kr(){}function Ar(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function jr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{m as PhraseCard,rr as VoicePrompt,Un as VoiceRibbon,$n as VoiceVisual,br as leaveSurface,Dr as openPhraseCard};
@@ -1,5 +1,5 @@
1
1
  import { PhraseCard } from "./phraseCard.js";
2
- import { t as VoiceVisual } from "../chunks/visual-Di3ojTED.js";
2
+ import { t as VoiceVisual } from "../chunks/visual-CeEQ8QkM.js";
3
3
  import { VoiceRibbon } from "./ribbon.js";
4
4
  import { VoicePrompt, leaveSurface } from "./prompt.js";
5
5
  import { openPhraseCard } from "./surface.js";
@@ -1,7 +1,7 @@
1
1
  import { styleNonce } from "../config.js";
2
2
  import { useSystemVoiceMicrophone } from "../microphoneInput.js";
3
3
  import { ROW_EASE } from "./rowMotion.js";
4
- import { t as VoiceVisual } from "../chunks/visual-Di3ojTED.js";
4
+ import { t as VoiceVisual } from "../chunks/visual-CeEQ8QkM.js";
5
5
  //#region src/card/prompt.ts
6
6
  const CSS = `
7
7
  .seams-voiceid-activation-surface { width: min(100%, 26.25rem); margin: 0 auto; background: transparent; }
@@ -255,6 +255,17 @@ const CSS = `
255
255
  overflow: visible;
256
256
  }
257
257
  .seams-voiceid-ribbon .seams-voiceid-ribbon-check { stroke: var(--seams-colors-colorBackground, #192024); }
258
+ /* The theme can colour the voice line (with its ring and its seal) and its three echo lines,
259
+ and set their widths. With none of these values, the line has the card's text colour. */
260
+ .seams-voiceid-ribbon { color: var(--seams-colors-voiceLine, currentColor); }
261
+ .seams-voiceid-ribbon .seams-voiceid-ribbon-line { stroke-width: var(--seams-shape-voiceLineWidth, 1px); }
262
+ .seams-voiceid-ribbon .seams-voiceid-ribbon-echo {
263
+ stroke-width: var(--seams-shape-voiceEchoWidth, 0.65px);
264
+ color: var(--seams-colors-voiceEcho, var(--seams-colors-voiceLine, currentColor));
265
+ }
266
+ .seams-voiceid-ribbon .seams-voiceid-ribbon-echo[data-layer="2"] {
267
+ color: var(--seams-colors-voiceEchoDeep, var(--seams-colors-voiceEcho, var(--seams-colors-voiceLine, currentColor)));
268
+ }
258
269
  .seams-voiceid-prompt .seams-voiceid-phrase.seams-voiceid-success-headline {
259
270
  display: grid;
260
271
  align-content: end;
@@ -466,6 +477,11 @@ const CSS = `
466
477
  grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 0;
467
478
  }
468
479
  .seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-record-slot { display: none; }
480
+ /* A card that records by itself (autoStart) has no Record row: its rows sit in the middle. */
481
+ .seams-voiceid-prompt[data-auto-start] {
482
+ grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 0;
483
+ }
484
+ .seams-voiceid-prompt[data-auto-start] > .seams-voiceid-record-slot { display: none; }
469
485
  .seams-voiceid-prompt[data-phrase-view] .seams-voiceid-microphone { display: none; }
470
486
  .seams-voiceid-prompt .seams-voiceid-close { transition: opacity 150ms ease, visibility 0s linear 0s; }
471
487
  .seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-close {
@@ -94,10 +94,21 @@ var VoiceRibbon = class {
94
94
  this.bottom
95
95
  ].entries()) segment.dataset.seamsProgressSegment = String(index);
96
96
  }
97
- for (let layer = 3; layer >= 0; layer -= 1) this.lines.push(this.append(document, "path", layer === 0 ? "1" : "0.65"));
97
+ for (let layer = 3; layer >= 0; layer -= 1) {
98
+ const line = this.append(document, "path", layer === 0 ? "1" : "0.65");
99
+ line.classList.add(layer === 0 ? "seams-voiceid-ribbon-line" : "seams-voiceid-ribbon-echo");
100
+ if (layer > 0) line.dataset.layer = String(layer);
101
+ this.lines.push(line);
102
+ }
98
103
  this.paint(performance.now());
99
104
  }
100
105
  readLevel = () => this.level;
106
+ /** The voice line's width now: 1, or the theme's `voiceLineWidth`. */
107
+ lineWidth() {
108
+ const line = this.lines[this.lines.length - 1];
109
+ const width = line ? Number.parseFloat(getComputedStyle(line).strokeWidth) : NaN;
110
+ return Number.isFinite(width) && width > 0 ? width : 1;
111
+ }
101
112
  setPhase(phase) {
102
113
  if (phase === "processing" && this.stage.kind === "line") {
103
114
  const amplitude = Math.max(this.level, this.idleAmplitude(performance.now()));
@@ -242,7 +253,7 @@ var VoiceRibbon = class {
242
253
  ].entries()) {
243
254
  const start = index * (width + gap);
244
255
  segment.setAttribute("d", `M${start.toFixed(2)} ${MID}H${(start + width).toFixed(2)}`);
245
- segment.setAttribute("stroke-width", "1");
256
+ segment.setAttribute("stroke-width", String(this.lineWidth()));
246
257
  segment.setAttribute("opacity", this.segmentOpacity(split, index));
247
258
  }
248
259
  }
@@ -268,7 +279,7 @@ var VoiceRibbon = class {
268
279
  const lineOpacity = LINE_REST_OPACITY + amplitude * .4;
269
280
  for (const [half, turned] of [[this.top, false], [this.bottom, true]]) {
270
281
  half.setAttribute("d", this.halfPath(tail, head, turned, amplitude, waveScale));
271
- half.setAttribute("stroke-width", lerp(1, 2, settled).toFixed(2));
282
+ half.setAttribute("stroke-width", lerp(this.lineWidth(), Math.max(2, this.lineWidth()), settled).toFixed(2));
272
283
  half.setAttribute("opacity", lerp(lineOpacity, 1, settled).toFixed(3));
273
284
  }
274
285
  this.middle.setAttribute("d", this.linePath(0, amplitude, BEND_START, WIDTH - BEND_START, waveScale));
@@ -79,6 +79,11 @@ var CardSurface = class {
79
79
  message: PROMPT_MESSAGE,
80
80
  action: "Record"
81
81
  }, rows);
82
+ if (this.autoStart) {
83
+ this.prompt.record.hidden = true;
84
+ this.prompt.element.dataset.autoStart = "";
85
+ this.prompt.element.tabIndex = -1;
86
+ }
82
87
  this.element.append(this.prompt.element);
83
88
  this.prompt.record.addEventListener("click", this.press);
84
89
  const corner = controls === "back" ? this.pressBack : this.pressClose;
@@ -90,7 +95,7 @@ var CardSurface = class {
90
95
  else parent.appendChild(this.element);
91
96
  if (frame.hugged) this.element.classList.add("seams-voiceid-hugged");
92
97
  this.unmounted = frame.mounted?.(this.element);
93
- if (rows) this.prompt.element.focus({ preventScroll: true });
98
+ if (rows || this.autoStart) this.prompt.element.focus({ preventScroll: true });
94
99
  else this.prompt.record.focus();
95
100
  if (outer.aborted) this.cancel();
96
101
  }
@@ -108,6 +113,7 @@ var CardSurface = class {
108
113
  return recording.promise;
109
114
  }
110
115
  show(view) {
116
+ delete this.prompt.element.dataset.autoStart;
111
117
  if (this.closed) return Promise.resolve("closed");
112
118
  this.settleChoice("replaced");
113
119
  this.view = view;
@@ -197,6 +203,7 @@ var CardSurface = class {
197
203
  };
198
204
  retry(message, action = "Try again") {
199
205
  this.started = false;
206
+ delete this.prompt.element.dataset.autoStart;
200
207
  this.prompt.record.textContent = action;
201
208
  this.prompt.ready(message);
202
209
  this.prompt.record.focus();
@@ -1,2 +1,2 @@
1
- import { t as VoiceVisual } from "../chunks/visual-Di3ojTED.js";
2
- export { VoiceVisual };
1
+ import { n as beamPalette, t as VoiceVisual } from "../chunks/visual-CeEQ8QkM.js";
2
+ export { VoiceVisual, beamPalette };
@@ -1430,6 +1430,31 @@ ${Le.split("{id}").join(de)}` : ca }), /* @__PURE__ */ jsxs("div", {
1430
1430
  ]
1431
1431
  })] });
1432
1432
  });
1433
+ /** The Beam's palette without a theme value. */
1434
+ const DEFAULT_BEAM = "ocean";
1435
+ /**
1436
+ * The band of the Beam in greys, for the `mono` palette: its own band has colour fringes in
1437
+ * every palette, pink on light and red and blue on dark.
1438
+ */
1439
+ const GREY_BAND = {
1440
+ light: {
1441
+ core: "#8b98a5",
1442
+ above: "#cfd9de",
1443
+ mid: "#aab8c2",
1444
+ below: "#657786"
1445
+ },
1446
+ dark: {
1447
+ core: "#ffffff",
1448
+ above: "#8b98a5",
1449
+ mid: "#cfd9de",
1450
+ below: "#536471"
1451
+ }
1452
+ };
1453
+ /** The theme's `voiceBeam`, the name of a Beam palette, or the default one. */
1454
+ function beamPalette(value) {
1455
+ const name = value.trim();
1456
+ return Object.hasOwn(Va, name) ? name : DEFAULT_BEAM;
1457
+ }
1433
1458
  /** Shared by enrollment, unlock and signing. The recorder remains the only audio owner. */
1434
1459
  var VoiceVisual = class {
1435
1460
  element;
@@ -1503,18 +1528,21 @@ var VoiceVisual = class {
1503
1528
  }
1504
1529
  render = () => {
1505
1530
  if (this.disposed) return;
1531
+ const mode = (this.prompt.closest("[data-theme]")?.getAttribute("data-theme") ?? this.prompt.ownerDocument.documentElement.getAttribute("data-theme")) === "light" ? "light" : "dark";
1532
+ const palette = beamPalette(getComputedStyle(this.prompt).getPropertyValue("--seams-colors-voiceBeam"));
1506
1533
  render(createElement(VoiceBeamView, {
1507
1534
  className: "seams-voiceid-beam",
1508
- theme: (this.prompt.closest("[data-theme]")?.getAttribute("data-theme") ?? this.prompt.ownerDocument.documentElement.getAttribute("data-theme")) === "light" ? "light" : "dark",
1535
+ theme: mode,
1536
+ ...palette === "mono" ? { bandColors: GREY_BAND[mode] } : {},
1509
1537
  level: this.ribbon.readLevel,
1510
1538
  processing: this.phase === "processing",
1511
1539
  active: this.phase !== "idle",
1512
1540
  staticColors: true,
1513
- colorVariant: "ocean",
1541
+ colorVariant: palette,
1514
1542
  borderRadius: Number.parseFloat(getComputedStyle(this.prompt).borderRadius) || 16,
1515
1543
  children: null
1516
1544
  }), this.glow);
1517
1545
  };
1518
1546
  };
1519
1547
  //#endregion
1520
- export { VoiceVisual as t };
1548
+ export { beamPalette as n, VoiceVisual as t };
@@ -27,6 +27,8 @@ export declare class VoiceRibbon {
27
27
  private stopped;
28
28
  constructor(document: Document, checking?: VoiceCheckingStyle);
29
29
  readonly readLevel: () => number;
30
+ /** The voice line's width now: 1, or the theme's `voiceLineWidth`. */
31
+ private lineWidth;
30
32
  setPhase(phase: RibbonPhase): void;
31
33
  /**
32
34
  * Closes the ring into the success seal; resolves when the check is drawn.
@@ -1,5 +1,8 @@
1
+ import { type VoiceBeamColorVariant } from 'voice-glow';
1
2
  import type { VoiceActivityEvent } from '../microphone';
2
3
  import { type VoiceCheckingStyle } from './ribbon';
4
+ /** The theme's `voiceBeam`, the name of a Beam palette, or the default one. */
5
+ export declare function beamPalette(value: string): VoiceBeamColorVariant;
3
6
  /** Shared by enrollment, unlock and signing. The recorder remains the only audio owner. */
4
7
  export declare class VoiceVisual {
5
8
  readonly element: SVGSVGElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seams/voice-capture",
3
- "version": "0.68.0",
3
+ "version": "0.68.1",
4
4
  "type": "module",
5
5
  "description": "Records one spoken sentence in the browser, with speech detection, a quality check and a phrase card",
6
6
  "license": "Apache-2.0",