PageSourceSearch

https://openplanner.fr/assets/TranscriptionApp-CGRKdjdK.js

js openplanner.fr collected 2026-09-25 22:16:18 UTC 51,480 bytes, 38 lines download raw bytes

1var Me=Object.defineProperty;var $e=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var y=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);import{d5 as Ue,d6 as He,c as We,bj as k,bR as De,_ as Be,r as b,D as $,i as p,h as T,d7 as ze,l as M,y as fe,T as L,ab as V,d8 as Fe,k as I,ad as pe,B as P,ag as Q,co as qe,C as G}from"./index-B347TT6i.js";import{u as me}from"./index-BHbLDZRg.js";import{B as Ve,u as je}from"./PublicApp-DNSKi1k4.js";import"./index-DIIm5txE.js";import"./Bluesky-BtCvu4s2.js";import"./jobStatus-DUH7ReE7.js";import"./types-CcQt0Yq5.js";import"./Edit-Ds7j_WDf.js";function Ge(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function Ke(e,t){e.classList?e.classList.add(t):Ge(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function ge(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Je(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=ge(e.className,t):e.setAttribute("class",ge(e.className&&e.className.baseVal||"",t))}var Xe=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return Ke(t,r)})},te=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return Je(t,r)})},ue=function(e){Ue(t,e);function t(){for(var r,o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return r=e.call.apply(e,[this].concat(s))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(i,a){var c=r.resolveArguments(i,a),u=c[0],d=c[1];r.removeClasses(u,"exit"),r.addClass(u,d?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(i,a)},r.onEntering=function(i,a){var c=r.resolveArguments(i,a),u=c[0],d=c[1],h=d?"appear":"enter";r.addClass(u,h,"active"),r.props.onEntering&&r.props.onEntering(i,a)},r.onEntered=function(i,a){var c=r.resolveArguments(i,a),u=c[0],d=c[1],h=d?"appear":"enter";r.removeClasses(u,h),r.addClass(u,h,"done"),r.props.onEntered&&r.props.onEntered(i,a)},r.onExit=function(i){var a=r.resolveArguments(i),c=a[0];r.removeClasses(c,"appear"),r.removeClasses(c,"enter"),r.addClass(c,"exit","base"),r.props.onExit&&r.props.onExit(i)},r.onExiting=function(i){var a=r.resolveArguments(i),c=a[0];r.addClass(c,"exit","active"),r.props.onExiting&&r.props.onExiting(i)},r.onExited=function(i){var a=r.resolveArguments(i),c=a[0];r.removeClasses(c,"exit"),r.addClass(c,"exit","done"),r.props.onExited&&r.props.onExited(i)},r.resolveArguments=function(i,a){return r.props.nodeRef?[r.props.nodeRef.current,i]:[i,a]},r.getClassNames=function(i){var a=r.props.classNames,c=typeof a=="string",u=c&&a?a+"-":"",d=c?""+u+i:a[i],h=c?d+"-active":a[i+"Active"],v=c?d+"-done":a[i+"Done"];return{baseClassName:d,activeClassName:h,doneClassName:v}},r}var n=t.prototype;return n.addClass=function(o,s,l){var i=this.getClassNames(s)[l+"ClassName"],a=this.getClassNames("enter"),c=a.doneClassName;s==="appear"&&l==="done"&&c&&(i+=" "+c),l==="active"&&o&&He(o),i&&(this.appliedClasses[s][l]=i,Xe(o,i))},n.removeClasses=function(o,s){var l=this.appliedClasses[s],i=l.base,a=l.active,c=l.done;this.appliedClasses[s]={},i&&te(o,i),a&&te(o,a),c&&te(o,c)},n.render=function(){var o=this.props;o.classNames;var s=We(o,["classNames"]);return k.createElement(De,Be({},s,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(k.Component);ue.defaultProps={classNames:""};ue.propTypes={};const Ye=ue,Qe=(e,t)=>{const[n,r]=b.useState({isLoading:!1,error:null,reply:null,eventData:null});return b.useEffect(()=>{(async()=>{try{if(r(d=>({...d,error:null,isLoading:!0})),!t||t.length===0){r(d=>({...d,isLoading:!1,error:"Missing password"}));return}const s=new URL(Ve);s.pathname+=`v1/${e}/transcription`;const l=await fetch(s,{method:"GET",headers:{"Content-Type":"application/json",password:t}});if(!l.ok){r(d=>({...d,isLoading:!1,error:`HTTP error! status: ${l.status}`}));return}const i=await l.json();r(d=>({...d,reply:i}));const a=new URL(i.dataUrl),c=await fetch(a);if(!c.ok){r(d=>({...d,isLoading:!1,error:`HTTP error! status: ${c.status}`}));return}const u=await c.json();r(d=>({...d,isLoading:!1,eventData:u}))}catch(s){r(l=>({...l,isLoading:!1,error:`Error! status: ${s}`}))}})()},[e,t]),n},Ze=5*60*1e3,et=2**31-1,tt=(e,t)=>{b.useEffect(()=>{if(!e)return;const n=$.fromISO(e);
1if(!n.isValid)return;const r=n.toMillis()+Ze-$.now().toMillis();if(r>et)return;const o=setTimeout(t,Math.max(0,r));return()=>clearTimeout(o)},[e,t])},nt=["Arial","Comic Sans MS","Times New Roman","Courier New","Georgia","Verdana"],rt=["Sunny Tech","Clever Cloud","Gladia","Billetweb"],R={fontSize:40,lineHeight:1,fontName:"Arial",backgroundColor:"000000",textColor:"ffffff",maxLines:3,alignment:"left",languages:["fr","en"],customVocabulary:rt,endpointing:.2,hideSettings:!0},se=e=>e.startsWith("#")?e:`#${e}`,Z=e=>e.startsWith("#")?e.slice(1):e,ot=e=>{const t=new URLSearchParams(e),n=(l,i,a=!1)=>{const c=t.get(l);if(c===null)return i;const u=Number(c);return Number.isFinite(u)&&(u>0||a&&u===0)?u:i},r=l=>l?l.split(",").map(i=>i.trim()).filter(Boolean):null,o=t.get("alignment"),s=r(t.get("languages"));return{fontSize:n("font_size",R.fontSize),lineHeight:n("line_height",R.lineHeight),fontName:t.get("font_name")||R.fontName,backgroundColor:Z(t.get("background_color")||R.backgroundColor),textColor:Z(t.get("text_color")||R.textColor),maxLines:Math.round(n("max_lines",R.maxLines)),alignment:o==="left"||o==="right"?o:R.alignment,languages:s!=null&&s.length?s:R.languages,customVocabulary:r(t.get("custom_vocabulary"))??R.customVocabulary,endpointing:n("endpointing",R.endpointing,!0),hideSettings:t.has("hide_settings")?t.get("hide_settings")==="true":R.hideSettings}},K=450,ie=b.forwardRef(({text:e,dim:t},n)=>p("div",{ref:n,className:"caption-row",children:p("div",{className:"caption-inner",children:p("p",{style:{margin:0,padding:0,opacity:t?.75:1},children:e})})}));
1ie.displayName="CaptionRow";const st=({lines:e,partial:t,settings:n})=>{const{fontSize:r,lineHeight:o,fontName:s,backgroundColor:l,textColor:i,maxLines:a,alignment:c}=n,u=r*o,d=e.slice(-Math.max(0,a-(t?1:0))),h=b.useRef(new Map),v=g=>{const C=h.current.get(g);if(C)return C;const f=b.createRef();return h.current.set(g,f),f};return T(M,{sx:{position:"absolute",top:0,left:0,width:"100%",boxSizing:"border-box",padding:"20px",overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"flex-start",fontWeight:600,fontFamily:s,fontSize:`${r}px`,lineHeight:`${u}px`,backgroundColor:se(l),color:se(i),textAlign:c,wordBreak:"break-word"},children:[p(ze,{component:null,children:d.map(g=>{const C=v(g.id);return p(Ye,{nodeRef:C,timeout:K,classNames:"caption",enter:!1,children:p(ie,{ref:C,text:g.text})},g.id)})}),t&&p(ie,{text:t,dim:!0}),p("style",{children:`
2                .caption-row { display: grid; grid-template-rows: 1fr; }
3                .caption-inner { overflow: hidden; }
4                .caption-exit { grid-template-rows: 1fr; opacity: 1; }
5                .caption-exit-active {
6                    grid-template-rows: 0fr;
7                    opacity: 0;
8                    transition: grid-template-rows ${K}ms ease, opacity ${K}ms ease;
9                }
10                .caption-exit-active .caption-inner { transform: translateY(-12px); transition: transform ${K}ms ease; }
11            `})]})},ve=e=>$.fromISO(e).toFormat("HH:mm"),it=(e,t,n)=>n<e?{label:`starts in ${Math.ceil(e.diff(n,"minutes").minutes)} min`,color:"#8ab4ff"}:n<=t?{label:`${Math.max(0,Math.ceil(t.diff(n,"minutes").minutes))} min left`,color:"#5bd75b"}:{label:`ended ${Math.floor(n.diff(t,"minutes").minutes)} min ago`,color:"#ff8a8a"},at=({trackName:e,talkTitle:t,dateStart:n,dateEnd:r,nextTalkTitle:o})=>{const[,s]=b.useState(0);b.useEffect(()=>{const u=setInterval(()=>s(d=>d+1),3e4);return()=>clearInterval(u)},[]);const l=$.fromISO(n),i=$.fromISO(r),a=Math.round(i.diff(l,"minutes").minutes),c=it(l,i,$.now());return T(V,{direction:"row",spacing:1.5,alignItems:"center",useFlexGap:!0,flexWrap:"wrap",sx:{minWidth:0,flex:1},children:[p(fe,{label:e,size:"small",sx:{bgcolor:"#1976d2",color:"#fff",fontWeight:700}}),p(L,{sx:{fontWeight:700,fontSize:18,minWidth:0},noWrap:!0,title:t,children:t}),T(V,{direction:"row",spacing:1,alignItems:"center",children:[T(M,{sx:{display:"flex",alignItems:"baseline",gap:.75,px:1.25,py:.25,borderRadius:1,bgcolor:"rgba(255,255,255,0.12)",border:"1px solid rgba(255,255,255,0.25)"},children:[T(L,{sx:{fontWeight:800,fontSize:26,lineHeight:1,fontVariantNumeric:"tabular-nums"},children:[ve(n),"–",ve(r)]}),T(L,{sx:{opacity:.6,fontSize:13},children:[a," min"]})]}),p(fe,{label:c.label,size:"small",sx:{bgcolor:"transparent",color:c.color,border:`1px solid ${c.color}`,fontWeight:600}})]}),o&&p(M,{sx:{opacity:.65,fontSize:13,minWidth:0},children:T(L,{component:"span",sx:{fontSize:13},noWrap:!0,title:o,children:["Next: ",o]})})]})};function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ee(e,t){if(e==null)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}function W(e){var t=b.useRef(e),n=b.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var j=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},F=function(e){return"touches"in e},ae=function(e){return e&&e.ownerDocument.defaultView||self},ye=function(e,t,n){var r=e.getBoundingClientRect(),o=F(t)?function(s,l){for(var i=0;i<s.length;i++)if(s[i].identifier===l)return s[i];return s[0]}(t.touches,n):t;return{left:j((o.pageX-(r.left+ae(e).pageXOffset))/r.width),top:j((o.pageY-(r.top+ae(e).pageYOffset))/r.height)}},be=function(e){!F(e)&&e.preventDefault()},Ne=k.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,o=ee(e,["onMove","onKey","onEnd"]),s=b.useRef(null),l=W(t),i=W(n),a=W(r),c=b.useRef(null),u=b.useRef(!1),d=b.useMemo(function(){var f=function(m){be(m),
11(F(m)?m.touches.length>0:m.buttons>0)&&s.current?l(ye(s.current,m,c.current)):(w(!1),a())},x=function(){w(!1),a()};function w(m){var E=u.current,S=ae(s.current),_=m?S.addEventListener:S.removeEventListener;_(E?"touchmove":"mousemove",f),_(E?"touchend":"mouseup",x)}return[function(m){var E=m.nativeEvent,S=s.current;if(S&&(be(E),!function(O,U){return U&&!F(O)}(E,u.current)&&S)){if(F(E)){u.current=!0;var _=E.changedTouches||[];_.length&&(c.current=_[0].identifier)}S.focus(),l(ye(S,E,c.current)),w(!0)}},function(m){var E=m.which||m.keyCode;E<37||E>40||(m.preventDefault(),i({left:E===39?.05:E===37?-.05:0,top:E===40?.05:E===38?-.05:0}))},function(m){var E=m.which||m.keyCode;E>=37&&E<=40&&a()},w]},[i,l,a]),h=d[0],v=d[1],g=d[2],C=d[3];return b.useEffect(function(){return C},[C]),k.createElement("div",D({},o,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:s,onKeyDown:v,onKeyUp:g,tabIndex:0,role:"slider"}))}),de=function(e){return e.filter(Boolean).join(" ")},Le=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=de(["react-colorful__pointer",e.className]);return k.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},k.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},N=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},ct=function(e){return ft(ce(e))},ce=function(e){return e[0]==="#"&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?N(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?N(parseInt(e.substring(6,8),16)/255,2):1}},lt=function(e){return ht(dt(e))},ut=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:N(e.h),s:N(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:N(o/2),a:N(r,2)}},le=function(e){var t=ut(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},dt=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),l=r*(1-n),i=r*(1-(t-s)*n),a=r*(1-(1-t+s)*n),c=s%6;return{r:N(255*[r,i,l,l,a,r][c]),g:N(255*[a,r,r,i,l,l][c]),b:N(255*[l,l,a,r,r,i][c]),a:N(o,2)}},J=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},ht=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=o<1?J(N(255*o)):"";return"#"+J(t)+J(n)+J(r)+s},ft=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),l=s-Math.min(t,n,r),i=l?s===t?(n-r)/l:s===n?2+(r-t)/l:4+(t-n)/l:0;return{h:N(60*(i<0?i+6:i)),s:N(s?l/s*100:0),v:N(s/255*100),a:o}},pt=k.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,o=de(["react-colorful__hue",e.className]);return k.createElement("div",{className:o},k.createElement(Ne,{onMove:function(s){n({h:360*s.left})},onKey:function(s){n({h:j(t+360*s.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":N(t),"aria-valuemax":"360","aria-valuemin":"0"},k.createElement(Le,{className:"react-colorful__hue-pointer",left:t/360,color:le({h:t,s:100,v:100,a:1})})))}),mt=k.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,o={backgroundColor:le({h:t.h,s:100,v:100,a:1})};return k.createElement("div",{className:"react-colorful__saturation",style:o},k.createElement(Ne,{onMove:function(s){n({s:100*s.left,v:100-100*s.top})},onKey:function(s){n({s:j(t.s+100*s.left,0,100),v:j(t.v-100*s.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+N(t.s)+"%, Brightness "+N(t.v)+"%"},k.createElement(Le,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:le(t)})))}),Oe=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},gt=function(e,t){return e.toLowerCase()===t.toLowerCase()||Oe(ce(e),ce(t))};function vt(e,t,n,r){var o=W(n),s=W(r),l=b.useState(function(){return e.toHsva(t)}),i=l[0],a=l[1],c=b.useRef({color:t,hsva:i}),u=b.useRef(!1);b.useEffect(function(){if(!e.equal(t,c.current.color)){var v=e.toHsva(t);c.current={hsva:v,color:t},a(v),u.current=!1}},[t,e]),b.useEffect(function(){var v;Oe(i,c.current.hsva)||e.equal(v=e.fromHsva(i),c.current.color)||(c.current={hsva:i,color:v},o(v),u.current=!0)},[i,e,o]);var d=b.useCallback(function(v){a(function(g){return Object.assign({},g,v)})},[]),h=b.useCallback(function(){u.current&&(u.current=!1,s(c.current.color))},[s]);return[i,d,h]}var yt=typeof window<"u"?b.useLayoutEffect:b.useEffect,bt=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},we=new Map,wt=function(e){yt(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!we.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;
11width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,we.set(t,n);var r=bt();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},Ct=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,l=e.onChangeEnd,i=ee(e,["className","colorModel","color","onChange","onChangeEnd"]),a=b.useRef(null);wt(a);var c=vt(n,o,s,l),u=c[0],d=c[1],h=c[2],v=de(["react-colorful",t]);return k.createElement("div",D({},i,{ref:a,className:v}),k.createElement(mt,{hsva:u,onChange:d,onChangeEnd:h}),k.createElement(pt,{hue:u.h,onChange:d,onChangeEnd:h,className:"react-colorful__last-control"}))},xt={defaultColor:"000",toHsva:ct,fromHsva:function(e){return lt({h:e.h,s:e.s,v:e.v,a:1})},equal:gt},St=function(e){return k.createElement(Ct,D({},e,{colorModel:xt}))},_t=/^#?([0-9A-F]{3,8})$/i,Et=function(e){var t=e.color,n=t===void 0?"":t,r=e.onChange,o=e.onBlur,s=e.escape,l=e.validate,i=e.format,a=e.process,c=ee(e,["color","onChange","onBlur","escape","validate","format","process"]),u=b.useState(function(){return s(n)}),d=u[0],h=u[1],v=W(r),g=W(o),C=b.useCallback(function(x){var w=s(x.target.value);h(w),l(w)&&v(a?a(w):w)},[s,a,l,v]),f=b.useCallback(function(x){l(x.target.value)||h(s(n)),g(x)},[n,s,l,g]);return b.useEffect(function(){h(s(n))},[n,s]),k.createElement("input",D({},c,{value:i?i(d):d,spellCheck:"false",onChange:C,onBlur:f}))},Ce=function(e){return"#"+e},Tt=function(e){var t=e.prefixed,n=e.alpha,r=ee(e,["prefixed","alpha"]),o=b.useCallback(function(l){return l.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),s=b.useCallback(function(l){return function(i,a){var c=_t.exec(i),u=c?c[1].length:0;return u===3||u===6||!!a&&u===4||!!a&&u===8}(l,n)},[n]);return k.createElement(Et,D({},r,{escape:o,format:t?Ce:void 0,process:Ce,validate:s}))};const xe=({label:e,value:t,onChange:n})=>{const[r,o]=b.useState(null),s=se(t);return T(V,{direction:"row",spacing:1,alignItems:"center",children:[p(M,{role:"button","aria-label":e,onClick:l=>o(l.currentTarget),sx:{width:28,height:28,borderRadius:1,cursor:"pointer",backgroundColor:s,border:"1px solid rgba(255,255,255,0.4)",flexShrink:0}}),p(L,{sx:{fontSize:13,opacity:.85},children:e}),p(Fe,{open:!!r,anchorEl:r,onClose:()=>o(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:T(V,{spacing:1,sx:{p:1.5},children:[p(St,{color:s,onChange:l=>n(Z(l))}),p(Tt,{color:s,onChange:l=>n(Z(l)),prefixed:!0,style:{width:"100%",textAlign:"center",textTransform:"uppercase"}})]})})]})},kt=["left","center","right"],At=({settings:e,onChange:t})=>{const n=(o,s)=>t({...e,[o]:s}),r={width:{xs:"calc(50% - 4px)",sm:110}};return T(M,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1,px:2,py:1,bgcolor:"rgba(0,0,0,0.82)",color:"#fff",borderTop:"1px solid rgba(255,255,255,0.12)",backdropFilter:"blur(4px)"},children:[p(I,{size:"small",type:"number",label:"Font size",value:e.fontSize,onChange:o=>n("fontSize",Number(o.target.value)||e.fontSize),sx:r}),p(I,{size:"small",type:"number",label:"Line height",inputProps:{step:.1,min:.5,max:3},value:e.lineHeight,onChange:o=>n("lineHeight",Number(o.target.value)||e.lineHeight),sx:r}),p(I,{size:"small",select:!0,label:"Font",value:e.fontName,onChange:o=>n("fontName",o.target.value),sx:{width:{xs:"100%",sm:150}},children:nt.map(o=>p(pe,{value:o,children:o},o))}),p(I,{size:"small",type:"number",label:"Max lines",inputProps:{min:1,max:10},value:e.maxLines,onChange:o=>n("maxLines",Number(o.target.value)||e.maxLines),sx:r}),p(I,{size:"small",select:!0,label:"Alignment",value:e.alignment,onChange:o=>n("alignment",o.target.value),sx:r,children:kt.map(o=>p(pe,{value:o,children:o},o))}
11),p(xe,{label:"Background",value:e.backgroundColor,onChange:o=>n("backgroundColor",o)}),p(xe,{label:"Text",value:e.textColor,onChange:o=>n("textColor",o)}),p(I,{size:"small",label:"Languages",value:e.languages.join(","),onChange:o=>n("languages",o.target.value.split(",").map(s=>s.trim()).filter(Boolean)),sx:{flex:1,minWidth:{xs:"100%",sm:140}}}),p(I,{size:"small",label:"Vocabulary",value:e.customVocabulary.join(","),onChange:o=>n("customVocabulary",o.target.value.split(",").map(s=>s.trim()).filter(Boolean)),sx:{flex:1,minWidth:{xs:"100%",sm:140}}}),p(I,{size:"small",type:"number",label:"Endpointing (s)",inputProps:{step:.05,min:0},value:e.endpointing,onChange:o=>{const s=Number(o.target.value);n("endpointing",o.target.value===""||Number.isNaN(s)||s<0?e.endpointing:s)},sx:r}),p(P,{variant:"contained",size:"small",onClick:()=>n("hideSettings",!0),sx:{ml:"auto"},children:"Hide settings"})]})};var Se={};function H(e,t){if(e={...e},!t)return e;for(const[n,r]of Object.entries(t))r!=null&&(e[n]&&typeof e[n]=="object"&&typeof r=="object"?e[n]=H(e[n],r):e[n]=r);return e}function Y(e,t){return typeof process>"u"||typeof Se>"u"?t:Se[e]??t}async function q(e){await new Promise(t=>setTimeout(t,e))}function Nt(e){return typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function Lt(e){return Nt(e)?new Uint8Array(e):new Uint8Array(e)}function Ot(e,t){const n=new Uint8Array(((e==null?void 0:e.byteLength)??0)+((t==null?void 0:t.byteLength)??0));return e&&n.set(new Uint8Array(e),0),t&&n.set(new Uint8Array(t),(e==null?void 0:e.byteLength)??0),n}const ne=2147483647;async function Pt(){var e;if(Y("VITEST_WORKER_ID")||!(typeof process<"u"&&((e=process.versions)!=null&&e.node)))return fetch;try{const{Agent:t,setGlobalDispatcher:n}=await Q(()=>import("./sdkNodeStub-FmFgRqLi.js"),[]);return n(new t({connectTimeout:ne,connect:{timeout:ne},headersTimeout:ne,bodyTimeout:0})),fetch}catch{return fetch}}var Pe=class extends Error{constructor({message:t,method:n,id:r,requestId:o,responseBody:s,url:l,status:i,headers:a},c){super(t,c);y(this,"method");y(this,"status");y(this,"url");y(this,"id");y(this,"requestId");y(this,"responseBody");y(this,"responseHeaders");this.name="HttpError",this.method=n,this.url=l,this.status=i,this.id=r,this.requestId=o,this.responseBody=s,this.responseHeaders=a}};async function Rt(e,t,n,r){let o,s,l,i,a;try{l=n.headers.get("x-aipi-call-id")??void 0,a=Object.fromEntries(n.headers.entries()),i=await n.text();try{i=JSON.parse(i),s=i==null?void 0:i.request_id,o=i==null?void 0:i.message}catch{}}catch{}return new Pe({method:e,message:[o||n.statusText||"An error occurred",s||l,n.status.toString(),`${e} ${new URL(t).pathname}`].filter(Boolean).join(" | "),url:t.toString(),status:n.status,id:l,requestId:s,responseBody:i,headers:a},r)}var _e=class extends Error{constructor(t,n,r){super(t,r);y(this,"timeout");this.name="TimeoutError",this.timeout=n}};function Ee(e,t){for(const n of t)if(typeof n=="number"){if(e===n)return!0}else{const[r,o]=n;if(e>=r&&e<=o)return!0}return!1}function It(e){if(!e||typeof e!="object")return!1;if("name"in e&&e.name==="AbortError")return!0;try{if(typeof DOMException<"u"&&e instanceof DOMException&&e.name==="AbortError")return!0}catch{}return!1}var Re=class{constructor(e){y(this,"baseUrl");y(this,"defaultHeaders");y(this,"defaultQueryParams");y(this,"retry");y(this,"timeout");y(this,"fetchPromise");this.baseUrl=e.baseUrl,this.defaultHeaders=e.headers,this.defaultQueryParams=e.queryParams,this.retry=e.retry,this.timeout=e.timeout,this.retry.maxAttempts=Math.max(0,Math.floor(this.retry.maxAttempts)),this.timeout=Math.max(0,Math.floor(this.timeout)),this.fetchPromise=Pt()}async get(e,t={}){return this.request("GET",e,t)}async post(e,t={}){return this.request("POST",e,t)}async put(e,t={}){return this.request("PUT",e,t)}async delete(e,t={}){return this.request("DELETE",e,t)}async request(e,t,n={}){var v;if(t=new URL(t,this.baseUrl),this.defaultQueryParams)for(const[g,C]of Object.entries(this.defaultQueryParams))t.searchParams.has(g)||t.searchParams.set(g,C);const{signal:r,headers:o,rawResponse:s,requestTimeout:l,...i}=n,a=l!==void 0?Math.max(0,Math.floor(l)):this.timeout,c=Date.now(),u=[];let d=0;const h=this.retry.maxAttempts;for(;;){d+=1;const g=new AbortController,C=()=>g.abort(r==null?void 0:r.reason);let f,x=!1;try{if(r){if(r.aborted)throw new Error("Request aborted by the provided AbortSignal",{cause:r.reason});r.addEventListener("abort",C,{once:!0})}a>0&&(f=setTimeout(()=>{x=!0,g.abort(new _e(`Request timed out after ${a}ms`,a))},a));const w=await(await this.fetchPromise)(t,{...i,method:e,headers:this.defaultHeaders?H(this.defaultHeaders,o):o,signal:g.signal});if(f&&clearTimeout(f),r&&r.removeEventListener("abort",C),!w.ok){const m=await Rt(e,t,w);if((h===0||d<h)&&Ee(w.status,this.retry.statusCodes)){u.push(m),await q(this.retry.delay(d));continue}throw m}return s?w:(v=w.headers.get("content-type"))!=null&&v.includes("application/json")?await w.json():w}catch(w){if(f&&clearTimeout(f),r&&r.removeEventListener("abort",C),x){const _=Date.now()-c;throw new _e(`Request timed out after ${a}ms on attempt ${d} (duration=${_}ms) for ${e} ${t}`,a,{cause:w})}if(It(w)||r&&r.aborted){const _=Date.now()-c;throw new Error(`Request aborted by the provided AbortSignal after ${_}ms for ${e} ${t}`,{cause:w})}const m=w instanceof Error?w:new Error(String(w));if(m instanceof Pe){if(Ee(m.status,this.retry.statusCodes)&&(h===0||d<h)){u.push(m),await q(this.retry.delay(d));continue}if(u.length>0){u.push(m);const _=Date.now()-c,O=new AggregateError(u,"All retry attempts failed");throw new Error(`HTTP request failed after ${d} attempts over ${_}ms for ${e} ${t}`,{cause:O})}throw m}if(h===0||d<h){u.push(m),await q(this.retry.delay(d));continue}u.push(m);const E=Date.now()-c,S=new AggregateError(u,"All retry attempts failed");throw new Error(`HTTP request failed after ${d} attempts over ${E}ms for ${e} ${t}`,{cause:S})}}}};const A={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3};function Mt(){if(typeof WebSocket<"u")return WebSocket;if(typeof global<"u"&&typeof global.WebSocket<"u")return global.WebSocket;if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return globalThis.WebSocket;if(typeof window<"u"&&typeof window.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u")return window.WebSocket;if(typeof self<"u"&&typeof self.WebSocket<"u")return self.WebSocket}async function $t(e){let t;try{t=Mt()??(await Q(()=>import("./sdkNodeStub-FmFgRqLi.js"),[])).WebSocket}catch{}if(!t)throw new Error("WebSocket is not supported in this environment and the `ws` package is not installed");return new t(e)}function Ut(e,t){for(const n of t)if(typeof n=="number"){if(e===n)return!0}else{const[r,o]=n;if(e>=r&&e<=o)return!0}return!1}function X(e){e&&(e.onopen=null,e.onerror=null,e.onmessage=null,e.onclose=null)}var Ht=class{constructor(e){y(this,"baseUrl");y(this,"retry");y(this,"timeout");this.baseUrl=e.baseUrl,this.retry=e.retry,this.timeout=e.timeout,this.retry.maxAttemptsPerConnection=Math.max(0,Math.floor(this.retry.maxAttemptsPerConnection)),this.retry.maxConnections=Math.max(0,Math.floor(this.retry.maxConnections)),this.timeout=Math.max(0,Math.floor(this.timeout))}createSession(e){return new Wt({retry:this.retry,timeout:this.timeout,url:new URL(e,this.baseUrl)})}},Wt=class{constructor({retry:e,timeout:t,url:n}){y(this,"onconnecting",null);y(this,"onopen",null);y(this,"onerror",null);y(this,"onclose",null);y(this,"onmessage",null);y(this,"_readyState",A.CONNECTING);y(this,"_url");y(this,"retry");y(this,"timeout");y(this,"ws",null);y(this,"connectionCount",0);y(this,"connectionAttempt",0);y(this,"connectionTimeoutId");this._url=n.toString(),this.retry=e,this.timeout=t,this.connect().catch(()=>{})}get readyState(){return this._readyState}get url(){return this._url}send(e){if(this.readyState===A.OPEN){if(!this.ws)throw new Error("readyState is open but ws is not initialized");this.ws.send(e)}else throw new Error("WebSocket is not open")}close(e=1e3,t=""){var n;this.readyState===A.CLOSING||this.readyState===A.CLOSED||(this.clearConnectionTimeout(),this._readyState=A.CLOSING,((n=this.ws)==null?void 0:n.readyState)===A.OPEN?this.ws.close(e):this.onWsClose(e,t))}onWsClose(e=1e3,t=""){var n;this.clearConnectionTimeout(),this.readyState!==A.CLOSED&&(this._readyState=A.CLOSED,(n=this.onclose)==null||n.call(this,{code:e,reason:t}
11)),this.onconnecting=null,this.onopen=null,this.onclose=null,this.onerror=null,this.onmessage=null,X(this.ws),this.ws=null}async connect(e=!1){var r;this.clearConnectionTimeout(),e||(this.connectionCount+=1,this.connectionAttempt=0),this.connectionAttempt+=1,this._readyState=A.CONNECTING,(r=this.onconnecting)==null||r.call(this,{connection:this.connectionCount,attempt:this.connectionAttempt}),this.timeout>0&&(this.connectionTimeoutId=setTimeout(()=>{this.close(3008,"WebSocket connection timeout")},this.timeout));const t=async(o,s)=>{var l;if(this.clearConnectionTimeout(),X(o),this.readyState===A.CONNECTING){if(this.retry.maxAttemptsPerConnection>0&&this.connectionAttempt>=this.retry.maxAttemptsPerConnection){(l=this.onerror)==null||l.call(this,new Error("WebSocket connection error",{cause:s})),this.close(1006,"WebSocket connection error");return}await q(this.retry.delay(this.connectionAttempt)),this.readyState===A.CONNECTING&&this.connect(!0)}};let n;try{n=await $t(this.url)}catch(o){t(null,o instanceof Error?o:new Error(String(o)));return}if(this.readyState!==A.CONNECTING){n.close(1001);return}n.onerror=()=>t(n),n.onopen=()=>{var o;if(this.clearConnectionTimeout(),X(n),this.readyState!==A.CONNECTING){n.close(1001);return}n.onmessage=s=>{var l;(l=this.onmessage)==null||l.call(this,s)},n.onclose=s=>{if(X(n),this.ws===n){if(this.ws=null,this.readyState===A.CLOSING){this.onWsClose(s.code,s.reason||"");return}if(this.retry.maxConnections>0&&this.connectionCount>=this.retry.maxConnections||!Ut(s.code,this.retry.closeCodes)){this.close(s.code,s.reason||"");return}this.connect()}},this.ws=n,this._readyState=A.OPEN,(o=this.onopen)==null||o.call(this,{connection:this.connectionCount,attempt:this.connectionAttempt})}}clearConnectionTimeout(){this.connectionTimeoutId&&(clearTimeout(this.connectionTimeoutId),this.connectionTimeoutId=void 0)}},Ie={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function o(a,c,u){this.fn=a,this.context=c,this.once=u||!1}function s(a,c,u,d,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var v=new o(u,d||a,h),g=n?n+c:c;return a._events[g]?a._events[g].fn?a._events[g]=[a._events[g],v]:a._events[g].push(v):(a._events[g]=v,a._eventsCount++),a}function l(a,c){--a._eventsCount===0?a._events=new r:delete a._events[c]}function i(){this._events=new r,this._eventsCount=0}i.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)t.call(u,d)&&c.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},i.prototype.listeners=function(c){var u=n?n+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,v=d.length,g=new Array(v);h<v;h++)g[h]=d[h].fn;return g},i.prototype.listenerCount=function(c){var u=n?n+c:c,d=this._events[u];return d?d.fn?1:d.length:0},i.prototype.emit=function(c,u,d,h,v,g){var C=n?n+c:c;if(!this._events[C])return!1;var f=this._events[C],x=arguments.length,w,m;if(f.fn){switch(f.once&&this.removeListener(c,f.fn,void 0,!0),x){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,u),!0;case 3:return f.fn.call(f.context,u,d),!0;case 4:return f.fn.call(f.context,u,d,h),!0;case 5:return f.fn.call(f.context,u,d,h,v),!0;case 6:return f.fn.call(f.context,u,d,h,v,g),!0}for(m=1,w=new Array(x-1);m<x;m++)w[m-1]=arguments[m];f.fn.apply(f.context,w)}else{var E=f.length,S;for(m=0;m<E;m++)switch(f[m].once&&this.removeListener(c,f[m].fn,void 0,!0),x){case 1:f[m].fn.call(f[m].context);break;case 2:f[m].fn.call(f[m].context,u);break;case 3:f[m].fn.call(f[m].context,u,d);break;case 4:f[m].fn.call(f[m].context,u,d,h);break;default:if(!w)for(S=1,w=new Array(x-1);S<x;S++)w[S-1]=arguments[S];f[m].fn.apply(f[m].context,w)}}return!0},i.prototype.on=function(c,u,d){return s(this,c,u,d,!1)},i.prototype.once=function(c,u,d){return s(this,c,u,d,!0)},i.prototype.removeListener=function(c,u,d,h){var v=n?n+c:c;if(!this._events[v])return this;if(!u)return l(this,v),this;var g=this._events[v];if(g.fn)g.fn===u&&(!h||g.once)&&(!d||g.context===d)&&l(this,v);else{for(var C=0,f=[],x=g.length;C<x;C++)(g[C].fn!==u||h&&!g[C].once||d&&g[C].context!==d)&&f.push(g[C]);f.length?this._events[v]=f.length===1?f[0]:f:l(this,v)}return this},i.prototype.removeAllListeners=function(c){var u;return c?(u=n?n+c:c,this._events[u]&&l(this,u)):(this._events=new r,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=n,i.EventEmitter=i,e.exports=i})(Ie);var Dt=Ie.exports;const Bt=qe(Dt);var Te=class{constructor({options:e,existingSession:t,httpClient:n,webSocketClient:r}){y(this,"sessionOptions");y(this,"httpClient");y(this,"webSocketClient");y(this,"abortController",new AbortController);y(this,"initSessionPromise");y(this,"initSessionResponse",null);y(this,"webSocketSession",null);y(this,"eventEmitter",new Bt);y(this,"bytesSent",0);y(this,"audioBuffer",null);y(this,"_status","starting");this.sessionOptions=e,this.httpClient=n,this.webSocketClient=r,this.abortController=new AbortController,this.initSessionPromise=t?Promise.resolve(t):this.initSession(),this.startSession()}async getSessionId(){const{id:e}=await this.initSessionPromise;return e}get sessionId(){var e;return((e=this.initSessionResponse)==null?void 0:e.id)??null}get status(){return this._status}sendAudio(e){var n,r;if(this._status==="ended"||this._status==="ending")return;const t=Lt(e);this.audioBuffer=Ot(this.audioBuffer,t),((n=this.webSocketSession)==null?void 0:n.readyState)===A.OPEN&&((r=this.webSocketSession)==null||r.send(t))}stopRecording(){this.doStop(1e3)}endSession(){this.doDestroy(1e3,"Session ended by user")}async initSession(){try{return await this.httpClient.post("/v2/live",{signal:this.abortController.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.sessionOptions,messages_config:{...this.sessionOptions.messages_config,receive_acknowledgments:!0}})})}
11catch(e){throw this.abortController.signal.aborted||(this.emit("error",e instanceof Error?e:new Error(`Error creating session: ${e}`,{cause:e})),this.doDestroy(1006,"Couldn't start a new session")),e}}async startSession(){var t;const e=await this.initSessionPromise;if(this.initSessionResponse=e,!this.abortController.signal.aborted){if(this._status==="starting"&&(this._status="started",this.emit("started",e)),(t=this.sessionOptions.messages_config)!=null&&t.receive_lifecycle_events){const n={type:"start_session",session_id:e.id,created_at:e.created_at};this.emit("message",n)}this.connectToWebSocket(e)}}connectToWebSocket(e){if(this.abortController.signal.aborted)return;const t=this.webSocketClient.createSession(e.url);this.abortController.signal.addEventListener("abort",()=>{this.webSocketSession=null,t.onconnecting=null,t.onopen=null,t.onmessage=null,t.onclose=null,t.onerror=null,t.close(1001,"Aborted")}),this.webSocketSession=t,this.webSocketSession.onconnecting=({connection:n})=>{this._status="connecting",this.emit("connecting",{attempt:n})},this.webSocketSession.onopen=({connection:n})=>{var r;if((r=this.audioBuffer)!=null&&r.byteLength)for(let s=0;s<this.audioBuffer.byteLength;s+=524288)t.send(this.audioBuffer.subarray(s,s+524288));if(this.status==="ending"){t.send(JSON.stringify({type:"stop_recording"}));return}this._status="connected",this.emit("connected",{attempt:n})},this.webSocketSession.onmessage=n=>{var o;const r=this.parseMessage(n.data.toString());if((!this.sessionOptions.messages_config||this.sessionOptions.messages_config.receive_acknowledgments||!("acknowledged"in r))&&this.emit("message",r),r.type==="audio_chunk"&&r.acknowledged&&r.data){const s=r.data.byte_range[1],l=(o=this.audioBuffer)==null?void 0:o.slice(s-this.bytesSent);this.audioBuffer=l!=null&&l.byteLength?l:null,this.bytesSent=s}},this.webSocketSession.onclose=({code:n,reason:r})=>{this.doDestroy(n,r)},this.webSocketSession.onerror=n=>{this.emit("error",n)}}parseMessage(e){let t;try{t=JSON.parse(e)}catch(n){throw new Error(`Invalid message received: ${e}`,{cause:n})}if(!t||typeof t!="object"||!("type"in t))throw new Error(`Invalid message received: ${e}`);return t}doStop(e=1006,t){var n,r;this._status!=="ended"&&this._status!=="ending"&&(this._status="ending",this.emit("ending",{code:e,reason:t}),((n=this.webSocketSession)==null?void 0:n.readyState)===A.OPEN&&((r=this.webSocketSession)==null||r.send(JSON.stringify({type:"stop_recording"}))))}doDestroy(e=1006,t){this._status!=="ended"&&(this.doStop(e,t),this._status="ended",this.emit("ended",{code:e,reason:t}),this.abortController.abort(),this.audioBuffer=null,this.removeAllListeners(),this.eventEmitter=null)}on(e,t){var n;(n=this.eventEmitter)==null||n.on(e,t)}once(e,t){var n;(n=this.eventEmitter)==null||n.once(e,t)}off(e,t){var n;(n=this.eventEmitter)==null||n.off(e,t)}addListener(e,t){var n;(n=this.eventEmitter)==null||n.addListener(e,t)}removeListener(e,t){var n;(n=this.eventEmitter)==null||n.removeListener(e,t)}removeAllListeners(e){var t;(t=this.eventEmitter)==null||t.removeAllListeners(e)}emit(e,...t){var n;(n=this.eventEmitter)==null||n.emit(e,...t)}},zt=class{constructor(e){y(this,"httpClient");y(this,"webSocketClient");y(this,"liveTimeouts");const t=new URL(e.apiUrl);t.protocol=t.protocol.replace(/^ws/,"http"),this.liveTimeouts=e.liveTimeouts,this.httpClient=new Re({baseUrl:t,headers:e.httpHeaders,...e.region?{queryParams:{region:e.region}}:{},retry:e.httpRetry,timeout:e.httpTimeout});const n=new URL(e.apiUrl);n.protocol=n.protocol.replace(/^http/,"ws"),this.webSocketClient=new Ht({baseUrl:n,retry:e.wsRetry,timeout:e.wsTimeout})}startSession(e){return new Te({options:e,httpClient:this.httpClient,webSocketClient:this.webSocketClient})}connectSession(e){const t={id:e.id,url:e.url,created_at:e.created_at??""};return new Te({options:{messages_config:e.messages_config},existingSession:t,httpClient:this.httpClient,webSocketClient:this.webSocketClient})}async get(e){return this.httpClient.get(`/v2/live/${e}`,{requestTimeout:this.liveTimeouts.get})}async delete(e){return(await this.httpClient.delete(`/v2/live/${e}`,{rawResponse:!0,requestTimeout:this.liveTimeouts.delete})).status===202}async getFile(e){return(await this.httpClient.get(`/v2/live/${e}/file`,{rawResponse:!0,requestTimeout:this.liveTimeouts.getFile})).arrayBuffer()}};function re(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function B(e,t){return e===null?null:e!==void 0?e:t}var Ft=class{constructor(e){y(this,"httpClient");y(this,"prerecordedTimeouts");const t=new URL(e.apiUrl);t.protocol=t.protocol.replace(/^ws/,"http"),this.prerecordedTimeouts=e.prerecordedTimeouts,this.httpClient=new Re({baseUrl:t,headers:e.httpHeaders,...e.region?{queryParams:{region:e.region}}:{},retry:e.httpRetry,timeout:e.httpTimeout})}async uploadFile(e){var n;if(typeof e=="string"&&re(e))throw new Error("Expected a file path; URLs are not accepted by uploadFile. Use a local file path, File, or Blob.");const t=new FormData;if(typeof e=="string"){if(typeof process>"u"||!((n=process.versions)!=null&&n.node))throw new Error("Upload by file path is only supported in Node.js. In the browser, use a File or Blob.");const{readFileSync:r}=await Q(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(a=>a._),[]),{basename:o}=await Q(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(a=>a._),[]),s=r(e),l=o(e),i=new Blob([s],{type:"application/octet-stream"});t.append("audio",i,l)}else t.append("audio",e);return this.httpClient.post("/v2/upload",{body:t,requestTimeout:this.prerecordedTimeouts.uploadFile})}async create(e){return this.httpClient.post("/v2/pre-recorded",{body:JSON.stringify(e),headers:{"content-type":"application/json"},requestTimeout:this.prerecordedTimeouts.create})}async createUntyped(e){return this.httpClient.post("/v2/pre-recorded",{body:JSON.stringify(e),headers:{"content-type":"application/json"},requestTimeout:this.prerecordedTimeouts.create})}async get(e){return this.httpClient.get(`/v2/pre-recorded/${e}`,{requestTimeout:this.prerecordedTimeouts.get})}async delete(e){return(await this.httpClient.delete(`/v2/pre-recorded/${e}`,{rawResponse:!0,requestTimeout:this.prerecordedTimeouts.delete})).status===202}async getFile(e){return(await this.httpClient.get(`/v2/pre-recorded/${e}/file`,{requestTimeout:this.prerecordedTimeouts.getFile})).arrayBuffer()}async poll(e,{interval:t=3e3,timeout:n}={}){const r=Date.now(),o=B(n,this.prerecordedTimeouts.poll);for(;;){const s=await this.get(e);if(s.status==="done")return s;if(s.status==="error")throw new Error(`Pre-recorded job ${e} failed with error code: ${s.error_code}`);if(o!==null&&Date.now()-r>=o)throw new Error(`Pre-recorded job ${e} did not complete within ${o}ms`);await q(t)}}async createAndPoll(e,{interval:t=3e3,timeout:n}={}){const r=await this.create(e);return this.poll(r.id,{interval:t,timeout:B(n,this.prerecordedTimeouts.createAndPoll)})}async createAndPollUntyped(e,{interval:t=3e3,timeout:n}={}){const r=await this.createUntyped(e);return this.poll(r.id,{interval:t,timeout:B(n,this.prerecordedTimeouts.createAndPoll)})}async transcribe(e,t,{interval:n=3e3,timeout:r}={}){const o=typeof e=="string"&&re(e)?e:await this.uploadFile(e),s=typeof o=="str
11ing"?o:o.audio_url;return this.createAndPoll({...t??{},audio_url:s},{interval:n,timeout:B(r,this.prerecordedTimeouts.transcribe)})}async transcribeUntyped(e,t,{interval:n=3e3,timeout:r}={}){const o=typeof e=="string"&&re(e)?e:await this.uploadFile(e),s=typeof o=="string"?o:o.audio_url;return this.createAndPollUntyped({...t??{},audio_url:s},{interval:n,timeout:B(r,this.prerecordedTimeouts.transcribe)})}};const qt="1.0.7";function oe(e){const t=Array.isArray(e)?e:Object.entries(e);return Object.fromEntries(t.map(([n,r])=>{const o=n.toLowerCase();return[o.startsWith("x-gladia-")?o:n,r]}))}function ke(e){let t;try{t=new URL(e.apiUrl)}catch{throw new Error(`Invalid url: "${e.apiUrl}".`)}if(!(e!=null&&e.apiKey)&&t.hostname.endsWith(".gladia.io"))throw new Error('You have to set your "apiKey" or define a proxy "apiUrl".');if(!["https:","http:","wss:","ws:"].includes(t.protocol))throw new Error(`Only HTTP and WebSocket protocols are supported for apiUrl (received: ${t.protocol}).`)}const Vt=e=>Math.min(.3*2**(e-1)*1e3,1e4),jt=e=>Math.min(.3*2**(e-1)*1e3,2e3),z=`SdkJavascript/${qt}`,Gt={apiKey:Y("GLADIA_API_KEY"),apiUrl:Y("GLADIA_API_URL","https://api.gladia.io"),region:Y("GLADIA_REGION"),httpHeaders:{"x-gladia-version":z},httpRetry:{maxAttempts:2,statusCodes:[408,413,429,[500,599]],delay:Vt},httpTimeout:1e4,wsRetry:{maxAttemptsPerConnection:5,closeCodes:[[1002,4399],[4500,9999]],delay:jt,maxConnections:0},wsTimeout:1e4,prerecordedTimeouts:{transcribe:72e5,poll:72e5,createAndPoll:72e5,uploadFile:3e5,getFile:3e5,create:6e4,delete:6e4,get:1e4},liveTimeouts:{get:1e4,delete:6e4,getFile:3e5}};var Kt=class{constructor(e){y(this,"options");y(this,"preRecorded",this.preRecordedV2);y(this,"live",this.liveV2);e!=null&&e.httpHeaders&&(e.httpHeaders=oe(e.httpHeaders)),this.options=H(Gt,e)}preRecordedV2(e){e!=null&&e.httpHeaders&&(e.httpHeaders=oe(e.httpHeaders));const t=H(this.options,e);return t.apiKey&&(t.httpHeaders=H(t.httpHeaders,{"x-gladia-key":t.apiKey})),t.httpHeaders["x-gladia-version"]!==z&&(t.httpHeaders["x-gladia-version"]=`${t.httpHeaders["x-gladia-version"].trim()} ${z}`.trim()),ke(t),new Ft(t)}liveV2(e){e!=null&&e.httpHeaders&&(e.httpHeaders=oe(e.httpHeaders));const t=H(this.options,e);return t.apiKey&&(t.httpHeaders=H(t.httpHeaders,{"x-gladia-key":t.apiKey})),t.httpHeaders["x-gladia-version"]!==z&&(t.httpHeaders["x-gladia-version"]=`${t.httpHeaders["x-gladia-version"].trim()} ${z}`.trim()),ke(t),new zt(t)}};const Jt=`
12class PcmDownsampler extends AudioWorkletProcessor {
13    constructor(options) {
14        super()
15        this._ratio = sampleRate / options.processorOptions.targetSampleRate
16        this._pos = 0
17    }
18    process(inputs) {
19        const channel = inputs[0] && inputs[0][0]
20        if (!channel) return true
21        const out = []
22        let pos = this._pos
23        while (pos < channel.length) {
24            const s = Math.max(-1, Math.min(1, channel[pos | 0]))
25            out.push(s < 0 ? s * 0x8000 : s * 0x7fff)
26            pos += this._ratio
27        }
28        // Carry the fractional read position into the next block so we don't drift.
29        this._pos = pos - channel.length
30        if (out.length) {
31            const buffer = new Int16Array(out).buffer
32            this.port.postMessage(buffer, [buffer])
33        }
34        return true
35    }
36}
37registerProcessor('pcm-downsampler', PcmDownsampler)
38`,Xt=async(e,t=16e3)=>{const n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}),r=new AudioContext,o=URL.createObjectURL(new Blob([Jt],{type:"application/javascript"}));try{await r.audioWorklet.addModule(o)}finally{URL.revokeObjectURL(o)}const s=r.createMediaStreamSource(n),l=new AudioWorkletNode(r,"pcm-downsampler",{processorOptions:{targetSampleRate:t}});l.port.onmessage=a=>e(a.data);const i=r.createGain();return i.gain.value=0,s.connect(l),l.connect(i),i.connect(r.destination),{stop:()=>{l.port.onmessage=null,s.disconnect(),l.disconnect(),i.disconnect(),n.getTracks().forEach(a=>a.stop()),r.close()}}},Ae=16e3,Yt=(e,t,n)=>{const[r,o]=b.useState([]),[s,l]=b.useState(""),[i,a]=b.useState("idle"),[c,u]=b.useState(null),d=t.languages.join(","),h=t.customVocabulary.join(","),v=b.useRef(t);return v.current=t,b.useEffect(()=>{if(!e){a("idle");return}const g=v.current;let C=!1,f=!1,x=null,w=null;return o([]),l(""),u(null),a("connecting"),(async()=>{x=new Kt({apiKey:e}).liveV2().startSession({encoding:"wav/pcm",bit_depth:16,sample_rate:Ae,channels:1,endpointing:g.endpointing,maximum_duration_without_endpointing:5,language_config:{languages:g.languages,code_switching:!0},realtime_processing:g.customVocabulary.length?{custom_vocabulary:!0,custom_vocabulary_config:{vocabulary:g.customVocabulary}}:void 0,messages_config:{receive_partial_transcripts:!0,receive_final_transcripts:!0}}),x.once("started",()=>{f=!0,C||a("live")}),x.on("message",S=>{if(C||S.type!=="transcript")return;const{is_final:_,utterance:O}=S.data,U=O.text.trim();U&&(_?(o(he=>[...he,{id:`${O.start}-${O.end}-${he.length}`,text:U}]),l("")):l(U))}),x.on("error",S=>{C||(u((S==null?void 0:S.message)||String(S)),a("error"))}),x.once("ended",()=>{C||a("ended")});try{w=await Xt(S=>{!C&&f&&(x==null||x.sendAudio(S))},Ae)}catch(S){C||(u("Microphone access failed: "+(S instanceof Error?S.message:String(S))),a("error"))}})(),()=>{C=!0,w==null||w.stop(),x==null||x.endSession()}},[e,n,d,h,t.endpointing]),{lines:r,partial:s,status:i,error:c}},Qt=({apiKey:e,sessionKey:t,trackName:n,talkTitle:r,dateStart:o,dateEnd:s,nextTalkTitle:l,onNext:i,onClear:a})=>{const[c,u]=b.useState(()=>ot(window.location.search)),[d,h]=b.useState(0),{lines:v,partial:g,status:C,error:f}=Yt(e,c,`${t}-${d}`),x=w=>u(w);return T(M,{sx:{position:"absolute",inset:0,backgroundColor:"#000"},children:[!e&&p(L,{sx:{color:"red",p:2},children:"Missing Gladia API key."}),C==="connecting"&&p(L,{sx:{color:"white",p:2},children:"Connecting to Gladia…"}),C==="error"&&T(L,{sx:{color:"red",p:2},children:["Error: ",f]}),p(st,{lines:v,partial:g,settings:c}),T(M,{sx:{position:"fixed",bottom:0,left:0,right:0,zIndex:999},children:[!c.hideSettings&&p(At,{settings:c,onChange:x}),T(M,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,py:1,bgcolor:"rgba(0,0,0,0.82)",color:"#fff",borderTop:c.hideSettings?"1px solid rgba(255,255,255,0.12)":"none",backdropFilter:"blur(4px)"},children:[p(at,{trackName:n,talkTitle:r,dateStart:o,dateEnd:s,nextTalkTitle:l}),T(V,{direction:"row",spacing:1,sx:{ml:"auto",flexShrink:0},children:[p(P,{variant:"contained",size:"small",onClick:i,disabled:!l,children:"Next talk ▸"}),p(P,{variant:"outlined",size:"small",color:"inherit",onClick:a,children:"Clear"}),p(P,{variant:"contained",size:"small",color:"warning",onClick:()=>h(w=>w+1),children:"Restart"}),c.hideSettings&&p(P,{variant:"contained",size:"small",onClick:()=>x({...c,hideSettings:!1}),children:"Show settings"})]})]})]})]})},Zt=()=>{const e=b.useRef(null);b.useEffect(()=>{if(!("wakeLock"in navigator)){console.log("useWakeLock: Screen Wake Lock API is not supported in this browser.");return}const t=async()=>{try{e.current=await navigator.wakeLock.request("screen")}catch{}},n=()=>{document.visibilityState==="visible"&&t()};
38return t(),document.addEventListener("visibilitychange",n),()=>{var r;document.removeEventListener("visibilitychange",n),(r=e.current)==null||r.release(),e.current=null}},[])},un=({eventId:e})=>{var S;const[t,n]=me("pagePassword",""),[r,o]=me("selectedTrack",""),[s,l]=b.useState("");Zt();const{reply:i,eventData:a,isLoading:c,error:u}=Qe(e,t),d=i==null?void 0:i.gladiaAPIKey,[h,v,g,C]=je(r,a),f=b.useCallback(()=>{if(!h)return;const _=v.findIndex(U=>U.id===h.id),O=v[_+1];O&&C(O)},[h,v,C]);tt(h==null?void 0:h.dateEnd,f);const x=(_,O)=>{o(O),n(_),O.length===0&&_===""&&g()};if(!t||t.length===0)return T(G,{maxWidth:"xl",sx:{mt:"90vh",mb:4},children:[p(I,{label:"Page password",variant:"filled",fullWidth:!0,value:s,onChange:_=>l(_.target.value)}),p(P,{variant:"contained",onClick:()=>{s.length>0&&x(s.trim(),r)},children:"Save password and load"})]});if(c||u||!a){const _=a?c?"Loading...":"Error: "+(u==null?void 0:u.toString()):"No event data found";return T(G,{maxWidth:"xl",sx:{mt:4,mb:4},children:[p(L,{variant:"h1",children:"Transcription"}),p(L,{children:_}),p(P,{variant:"contained",onClick:()=>x("",""),children:"Clear password/track"})]})}if(!r||r==="")return T(G,{maxWidth:"xl",sx:{mt:4,mb:4},children:[p(L,{variant:"h1",children:"Transcription"}),p(L,{children:"Select a track"}),a==null?void 0:a.event.tracks.map(_=>T(P,{variant:"contained",onClick:()=>{o(_.id)},children:[_.name," (",_.id,")"]},_.id)),p("br",{}),p("br",{}),p(P,{variant:"contained",onClick:()=>x("",""),children:"Clear password & track"})]});if(!h)return T(G,{maxWidth:"xl",sx:{mt:4,mb:4},children:[p(L,{variant:"h1",children:"Transcription"}),p(L,{children:"Select a talk first..."}),p(P,{variant:"contained",onClick:()=>{o("")},children:"Change track"}),p(P,{variant:"contained",onClick:()=>{C({id:"no-preconfigured-talk"+Date.now(),title:"No preconfigured talk",dateStart:$.now().toISO(),dateEnd:$.now().plus({hours:1}).toISO(),abstract:[],showInFeedback:!0,speakersIds:[],trackId:r})},children:"Use without talk"}),p(P,{variant:"contained",onClick:()=>x("",""),children:"Clear password & track"})]});const w=v.findIndex(_=>_.id===(h==null?void 0:h.id)),m=v[w+1],E=((S=a.event.tracks.find(_=>_.id===r))==null?void 0:S.name)??r;return p(M,{children:p(Qt,{apiKey:d,sessionKey:(h==null?void 0:h.id)??"",trackName:E,talkTitle:h.title,dateStart:h.dateStart,dateEnd:h.dateEnd,nextTalkTitle:m==null?void 0:m.title,onNext:()=>m&&C(m),onClear:()=>x("","")})})};export{un as TranscriptionApp};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.