@glydeunity/voice-sdk 1.5.3 → 1.5.4
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/dist/glyde-chat.umd.js +2 -2
- package/dist/glyde-chat.umd.js.map +1 -1
- package/dist/index.d.ts +30 -2
- package/dist/voice-sdk.es.js +30 -10
- package/dist/voice-sdk.es.js.map +1 -1
- package/package.json +1 -1
package/dist/glyde-chat.umd.js
CHANGED
|
@@ -143,7 +143,7 @@ ${K}`),await this.initializeAudio();let D="wss://agent.deepgram.com/v1/agent/con
|
|
|
143
143
|
<p>Context: ${this.config.contextType}</p>
|
|
144
144
|
<button onclick="this.closest('div').remove()">Close</button>
|
|
145
145
|
</div>
|
|
146
|
-
`)}async handleFunctionCallRequest(f){for(const g of f.functions){console.log("[GlydeVoice] Function call request:",g.name,g.arguments);let o={};try{o=g.arguments?JSON.parse(g.arguments):{}}catch(N){console.warn("[GlydeVoice] Failed to parse function arguments:",N)}let O;try{g.name==="end_conversation"?O=await this.handleEndConversation(o):O=await this.executeVoiceFunction(g.name,g.id,o)}catch(N){console.error("[GlydeVoice] Function call error:",N),O=JSON.stringify({error:"Function execution failed",details:N instanceof Error?N.message:String(N)})}const C={type:"FunctionCallResponse",id:g.id,name:g.name,content:O};this.ws&&this.ws.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify(C)),console.log("[GlydeVoice] Function response sent:",g.name)):console.error("[GlydeVoice] Cannot send function response - WebSocket not open")}}async executeVoiceFunction(f,g,o){console.log("[GlydeVoice] Executing voice function via Unity API:",f);try{const O=await fetch(`${this.unityUrl}/api/unity/voice/function`,{method:"POST",headers:this.getAuthHeaders(),body:JSON.stringify({function_name:f,function_call_id:g,input:o,context:{context_id:this.sessionContext.contextId,context_type:this.sessionContext.contextType,current_job_uuid:this.sessionContext.currentJobUuid}})});if(!O.ok){const N=await O.json().catch(()=>({}));throw new Error(N.error?.message||`Function call failed: ${O.status}`)}const C=await O.json();if(C.success&&C.data?.output)return typeof C.data.output=="string"?C.data.output:JSON.stringify(C.data.output);throw new Error("Invalid response from voice function endpoint")}catch(O){return console.error("[GlydeVoice] Voice function error:",O),JSON.stringify({success:!1,error:O instanceof Error?O.message:"Function execution failed",fallback_message:"I apologize, but I'm having trouble with that request right now. Is there something else I can help you with?"})}}async handleEndConversation(f){const g=f.item||"user request";return console.log(`[GlydeVoice] End conversation triggered by: ${g}`),setTimeout(()=>{this.stop()},2e3),JSON.stringify({success:!0,message:"Conversation ending. Say goodbye to the user.",trigger_phrase:g})}setSessionContext(f){this.sessionContext={...this.sessionContext,...f},console.log("[GlydeVoice] Session context updated:",{hasContextId:!!f.contextId,contextType:f.contextType,hasJobUuid:!!f.currentJobUuid})}}class Df{config;unityUrl;history=[];isTyping=!1;initialized=!1;constructor(f){this.config=f,this.unityUrl=f.unityBaseUrl||"https://api.glydeunity.com",!f.publishableKey&&!f.apiKey&&!f.authToken&&console.warn("[GlydeText] No authentication method provided. One of publishableKey, apiKey, or authToken is required.")}getAuthHeaders(){const f={"Content-Type":"application/json"};return this.config.publishableKey&&(f["x-publishable-key"]=this.config.publishableKey),this.config.apiKey&&(f["x-api-key"]=this.config.apiKey),this.config.authToken&&(f.Authorization=`Bearer ${this.config.authToken}`),f}emit(f){this.config.onEvent&&this.config.onEvent(f)}setTyping(f){this.isTyping=f,this.config.onTyping&&this.config.onTyping(f)}async initialize(){if(!this.config.contextId)throw new Error("contextId is required for text chat initialization");this.setTyping(!0);try{const f=await fetch(`${this.unityUrl}/api/unity/screening/start`,{method:"POST",headers:this.getAuthHeaders(),body:JSON.stringify({application_uuid:this.config.contextId})});if(!f.ok){const o=await f.json().catch(()=>({}));throw new Error(o.error?.message||o.message||"Failed to initialize chat")}const g=await f.json();return g.messages&&(this.history=g.messages),this.initialized=!0,this.emit({type:"ready"}),this.emit({type:"history_loaded",payload:this.history}),this.history}catch(f){throw console.error("[GlydeText] Initialization error:",f),this.emit({type:"error",payload:f}),f}finally{this.setTyping(!1)}}async sendMessage(f){if(!this.config.contextId)throw new Error("contextId is required for sending messages");if(!f.trim())throw new Error("Message cannot be empty");this.initialized||await this.initialize();const g={role:"user",content:f.trim(),created:new Date().toISOString()};this.history.push(g),this.config.onMessage&&this.config.onMessage(g),this.emit({type:"message",payload:g}),this.setTyping(!0);try{const o=await fetch(`${this.unityUrl}/api/unity/screening/chat`,{method:"POST",headers:this.getAuthHeaders(),body:JSON.stringify({application_uuid:this.config.contextId,message:f.trim()})});if(!o.ok){const K=await o.json().catch(()=>({}));throw new Error(K.error?.message||K.message||"Failed to send message")}const O=await o.json();O.history?.messages&&(this.history=O.history.messages);const C=[...this.history].reverse().find(K=>K.role==="assistant");return C?(this.config.onMessage&&this.config.onMessage(C),this.emit({type:"message",payload:C}),C):{role:"assistant",content:O.response||"I received your message.",created:new Date().toISOString()}}catch(o){throw console.error("[GlydeText] Send message error:",o),this.emit({type:"error",payload:o}),o}finally{this.setTyping(!1)}}getHistory(){return[...this.history]}clearHistory(){this.history=[],this.initialized=!1}getIsTyping(){return this.isTyping}getIsInitialized(){return this.initialized}}function uh(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var Iu={exports:{}},Z={};var jf;function ih(){if(jf)return Z;jf=1;var h=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),N=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),G=Symbol.iterator;function w(d){return d===null||typeof d!="object"?null:(d=G&&d[G]||d["@@iterator"],typeof d=="function"?d:null)}var ft={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F=Object.assign,I={};function it(d,M,U){this.props=d,this.context=M,this.refs=I,this.updater=U||ft}it.prototype.isReactComponent={},it.prototype.setState=function(d,M){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,M,"setState")},it.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Mt(){}Mt.prototype=it.prototype;function nt(d,M,U){this.props=d,this.context=M,this.refs=I,this.updater=U||ft}var Rt=nt.prototype=new Mt;Rt.constructor=nt,F(Rt,it.prototype),Rt.isPureReactComponent=!0;var Q=Array.isArray;function xt(){}var W={H:null,A:null,T:null,S:null},wt=Object.prototype.hasOwnProperty;function Ot(d,M,U){var B=U.ref;return{$$typeof:h,type:d,key:M,ref:B!==void 0?B:null,props:U}}function je(d,M){return Ot(d.type,M,d.props)}function ie(d){return typeof d=="object"&&d!==null&&d.$$typeof===h}function Nt(d){var M={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(U){return M[U]})}var ve=/\/+/g;function $t(d,M){return typeof d=="object"&&d!==null&&d.key!=null?Nt(""+d.key):M.toString(36)}function Wt(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(xt,xt):(d.status="pending",d.then(function(M){d.status==="pending"&&(d.status="fulfilled",d.value=M)},function(M){d.status==="pending"&&(d.status="rejected",d.reason=M)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function A(d,M,U,B,J){var P=typeof d;(P==="undefined"||P==="boolean")&&(d=null);var ht=!1;if(d===null)ht=!0;else switch(P){case"bigint":case"string":case"number":ht=!0;break;case"object":switch(d.$$typeof){case h:case f:ht=!0;break;case q:return ht=d._init,A(ht(d._payload),M,U,B,J)}}if(ht)return J=J(d),ht=B===""?"."+$t(d,0):B,Q(J)?(U="",ht!=null&&(U=ht.replace(ve,"$&/")+"/"),A(J,M,U,"",function(Ya){return Ya})):J!=null&&(ie(J)&&(J=je(J,U+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(ve,"$&/")+"/")+ht)),M.push(J)),1;ht=0;var Ft=B===""?".":B+":";if(Q(d))for(var Dt=0;Dt<d.length;Dt++)B=d[Dt],P=Ft+$t(B,Dt),ht+=A(B,M,U,P,J);else if(Dt=w(d),typeof Dt=="function")for(d=Dt.call(d),Dt=0;!(B=d.next()).done;)B=B.value,P=Ft+$t(B,Dt++),ht+=A(B,M,U,P,J);else if(P==="object"){if(typeof d.then=="function")return A(Wt(d),M,U,B,J);throw M=String(d),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return ht}function j(d,M,U){if(d==null)return d;var B=[],J=0;return A(d,B,"","",function(P){return M.call(U,P,J++)}),B}function H(d){if(d._status===-1){var M=d._result;M=M(),M.then(function(U){(d._status===0||d._status===-1)&&(d._status=1,d._result=U)},function(U){(d._status===0||d._status===-1)&&(d._status=2,d._result=U)}),d._status===-1&&(d._status=0,d._result=M)}if(d._status===1)return d._result.default;throw d._result}var dt=typeof reportError=="function"?reportError:function(d){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof d=="object"&&d!==null&&typeof d.message=="string"?String(d.message):String(d),error:d});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",d);return}console.error(d)},bt={map:j,forEach:function(d,M,U){j(d,function(){M.apply(this,arguments)},U)},count:function(d){var M=0;return j(d,function(){M++}),M},toArray:function(d){return j(d,function(M){return M})||[]},only:function(d){if(!ie(d))throw Error("React.Children.only expected to receive a single React element child.");return d}};return Z.Activity=_,Z.Children=bt,Z.Component=it,Z.Fragment=g,Z.Profiler=O,Z.PureComponent=nt,Z.StrictMode=o,Z.Suspense=D,Z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,Z.__COMPILER_RUNTIME={__proto__:null,c:function(d){return W.H.useMemoCache(d)}},Z.cache=function(d){return function(){return d.apply(null,arguments)}},Z.cacheSignal=function(){return null},Z.cloneElement=function(d,M,U){if(d==null)throw Error("The argument must be a React element, but you passed "+d+".");var B=F({},d.props),J=d.key;if(M!=null)for(P in M.key!==void 0&&(J=""+M.key),M)!wt.call(M,P)||P==="key"||P==="__self"||P==="__source"||P==="ref"&&M.ref===void 0||(B[P]=M[P]);var P=arguments.length-2;if(P===1)B.children=U;else if(1<P){for(var ht=Array(P),Ft=0;Ft<P;Ft++)ht[Ft]=arguments[Ft+2];B.children=ht}return Ot(d.type,J,B)},Z.createContext=function(d){return d={$$typeof:N,_currentValue:d,_currentValue2:d,_threadCount:0,Provider:null,Consumer:null},d.Provider=d,d.Consumer={$$typeof:C,_context:d},d},Z.createElement=function(d,M,U){var B,J={},P=null;if(M!=null)for(B in M.key!==void 0&&(P=""+M.key),M)wt.call(M,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(J[B]=M[B]);var ht=arguments.length-2;if(ht===1)J.children=U;else if(1<ht){for(var Ft=Array(ht),Dt=0;Dt<ht;Dt++)Ft[Dt]=arguments[Dt+2];J.children=Ft}if(d&&d.defaultProps)for(B in ht=d.defaultProps,ht)J[B]===void 0&&(J[B]=ht[B]);return Ot(d,P,J)},Z.createRef=function(){return{current:null}},Z.forwardRef=function(d){return{$$typeof:K,render:d}},Z.isValidElement=ie,Z.lazy=function(d){return{$$typeof:q,_payload:{_status:-1,_result:d},_init:H}},Z.memo=function(d,M){return{$$typeof:S,type:d,compare:M===void 0?null:M}},Z.startTransition=function(d){var M=W.T,U={};W.T=U;try{var B=d(),J=W.S;J!==null&&J(U,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(xt,dt)}catch(P){dt(P)}finally{M!==null&&U.types!==null&&(M.types=U.types),W.T=M}},Z.unstable_useCacheRefresh=function(){return W.H.useCacheRefresh()},Z.use=function(d){return W.H.use(d)},Z.useActionState=function(d,M,U){return W.H.useActionState(d,M,U)},Z.useCallback=function(d,M){return W.H.useCallback(d,M)},Z.useContext=function(d){return W.H.useContext(d)},Z.useDebugValue=function(){},Z.useDeferredValue=function(d,M){return W.H.useDeferredValue(d,M)},Z.useEffect=function(d,M){return W.H.useEffect(d,M)},Z.useEffectEvent=function(d){return W.H.useEffectEvent(d)},Z.useId=function(){return W.H.useId()},Z.useImperativeHandle=function(d,M,U){return W.H.useImperativeHandle(d,M,U)},Z.useInsertionEffect=function(d,M){return W.H.useInsertionEffect(d,M)},Z.useLayoutEffect=function(d,M){return W.H.useLayoutEffect(d,M)},Z.useMemo=function(d,M){return W.H.useMemo(d,M)},Z.useOptimistic=function(d,M){return W.H.useOptimistic(d,M)},Z.useReducer=function(d,M,U){return W.H.useReducer(d,M,U)},Z.useRef=function(d){return W.H.useRef(d)},Z.useState=function(d){return W.H.useState(d)},Z.useSyncExternalStore=function(d,M,U){return W.H.useSyncExternalStore(d,M,U)},Z.useTransition=function(){return W.H.useTransition()},Z.version="19.2.4",Z}var Uf;function Pu(){return Uf||(Uf=1,Iu.exports=ih()),Iu.exports}var V=Pu();const Un=uh(V);function Rf(h){const[f,g]=V.useState("idle"),[o,O]=V.useState([]),[C,N]=V.useState(!1),[K,D]=V.useState(!1),[S,q]=V.useState(!1),[_,G]=V.useState(null),w=V.useRef(null),ft=V.useCallback(Q=>{switch(Q.type){case"ready":g("active");break;case"close":g("idle"),N(!1),D(!1);break;case"error":g("error"),G(typeof Q.payload=="object"&&Q.payload!==null&&"message"in Q.payload?String(Q.payload.message):"Connection error");break;case"user_speaking":N(!!Q.payload);break;case"agent_speaking":D(!!Q.payload);break}},[]),F=V.useCallback((Q,xt)=>{O(W=>[...W,{role:xt,content:Q,timestamp:new Date}])},[]),I=V.useCallback(async()=>{g("connecting"),G(null);try{const Q=new Of({...h,onEvent:ft,onTranscript:F});w.current=Q,await Q.start()}catch(Q){console.error("[useVoiceAgent] Failed to start:",Q),g("error"),G(Q instanceof Error?Q.message:"Failed to connect")}},[h,ft,F]),it=V.useCallback(()=>{w.current?.stop(),w.current=null,g("idle"),N(!1),D(!1)},[]),Mt=V.useCallback(()=>{const Q=!S;q(Q),w.current?.setMuted(Q)},[S]),nt=V.useCallback(Q=>{q(Q),w.current?.setMuted(Q)},[]),Rt=V.useCallback(()=>{O([])},[]);return V.useEffect(()=>()=>{w.current?.stop()},[]),V.useEffect(()=>{h.autoStart&&f==="idle"&&I()},[h.autoStart,f,I]),{status:f,transcripts:o,isUserSpeaking:C,isAgentSpeaking:K,isMuted:S,errorMessage:_,start:I,stop:it,toggleMute:Mt,setMuted:nt,clearTranscripts:Rt,voiceAgent:w.current}}function Nf(h){const[f,g]=V.useState("idle"),[o,O]=V.useState([]),[C,N]=V.useState(!1),[K,D]=V.useState(null),S=V.useRef(null),q=V.useRef(!1),_=V.useCallback(()=>(S.current||(S.current=new Df({...h,onTyping:N})),S.current),[h]),G=V.useCallback(async()=>{if(!q.current){g("loading"),D(null);try{const I=await _().initialize();O(I),g("ready"),q.current=!0}catch(F){console.error("[useTextChat] Initialization error:",F),g("error"),D(F instanceof Error?F.message:"Failed to initialize chat")}}},[_]),w=V.useCallback(async F=>{if(F.trim()){D(null);try{const I=_(),it={role:"user",content:F.trim(),created:new Date().toISOString()};O(nt=>[...nt,it]),await I.sendMessage(F);const Mt=I.getHistory();O(Mt),f!=="ready"&&(g("ready"),q.current=!0)}catch(I){console.error("[useTextChat] Send message error:",I),D(I instanceof Error?I.message:"Failed to send message")}}},[_,f]),ft=V.useCallback(()=>{S.current?.clearHistory(),O([]),q.current=!1,g("idle")},[]);return V.useEffect(()=>{h.autoInit&&!q.current&&h.contextId&&G()},[h.autoInit,h.contextId,G]),V.useEffect(()=>()=>{S.current=null},[]),{status:f,messages:o,isLoading:C,errorMessage:K,initialize:G,sendMessage:w,clearHistory:ft,textChat:S.current}}var ti={exports:{}},Ua={};var Hf;function ch(){if(Hf)return Ua;Hf=1;var h=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function g(o,O,C){var N=null;if(C!==void 0&&(N=""+C),O.key!==void 0&&(N=""+O.key),"key"in O){C={};for(var K in O)K!=="key"&&(C[K]=O[K])}else C=O;return O=C.ref,{$$typeof:h,type:o,key:N,ref:O!==void 0?O:null,props:C}}return Ua.Fragment=f,Ua.jsx=g,Ua.jsxs=g,Ua}var Bf;function fh(){return Bf||(Bf=1,ti.exports=ch()),ti.exports}var p=fh();const Ra=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),p.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),p.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),sh=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"}),p.jsx("path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"}),p.jsx("path",{d:"M5 10v2a7 7 0 0 0 12 5"}),p.jsx("path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}),p.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}),p.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),oh=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:p.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),qf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"}),p.jsx("line",{x1:"22",x2:"2",y1:"2",y2:"22"})]}),Rn=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:p.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),Yf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("line",{x1:"22",x2:"11",y1:"2",y2:"13"}),p.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]}),Gf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),p.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),wf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M12 8V4H8"}),p.jsx("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),p.jsx("path",{d:"M2 14h2"}),p.jsx("path",{d:"M20 14h2"}),p.jsx("path",{d:"M15 13v2"}),p.jsx("path",{d:"M9 13v2"})]}),Xf=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:p.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),Lf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),p.jsx("line",{x1:"22",x2:"16",y1:"9",y2:"15"}),p.jsx("line",{x1:"16",x2:"22",y1:"9",y2:"15"})]}),Qf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),p.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]}),Vf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),p.jsx("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),p.jsx("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),p.jsx("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]}),rh=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,style:{animation:"spin 1s linear infinite"},children:p.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),Zf={light:{primary:"#c026d3",primaryHover:"#a21caf",primaryLight:"#fdf4ff",primaryText:"#ffffff",secondary:"#0284c7",secondaryHover:"#0369a1",secondaryLight:"#f0f9ff",secondaryText:"#ffffff",success:"#059669",successLight:"#dcfce7",successText:"#166534",error:"#ef4444",errorHover:"#dc2626",errorLight:"#fef2f2",errorText:"#b91c1c",background:"#ffffff",surface:"#f9fafb",border:"#e5e7eb",borderLight:"#f3f4f6",text:"#1f2937",textSecondary:"#6b7280",textMuted:"#9ca3af"},dark:{primary:"#d946ef",primaryHover:"#c026d3",primaryLight:"#3b0764",primaryText:"#ffffff",secondary:"#38bdf8",secondaryHover:"#0ea5e9",secondaryLight:"#0c4a6e",secondaryText:"#ffffff",success:"#34d399",successLight:"#064e3b",successText:"#a7f3d0",error:"#f87171",errorHover:"#ef4444",errorLight:"#450a0a",errorText:"#fecaca",background:"#111827",surface:"#1f2937",border:"#374151",borderLight:"#4b5563",text:"#f9fafb",textSecondary:"#d1d5db",textMuted:"#9ca3af"}};function ei(h){const f=Zf[h];return`
|
|
146
|
+
`)}async handleFunctionCallRequest(f){for(const g of f.functions){console.log("[GlydeVoice] Function call request:",g.name,g.arguments);let o={};try{o=g.arguments?JSON.parse(g.arguments):{}}catch(N){console.warn("[GlydeVoice] Failed to parse function arguments:",N)}let O;try{g.name==="end_conversation"?O=await this.handleEndConversation(o):O=await this.executeVoiceFunction(g.name,g.id,o)}catch(N){console.error("[GlydeVoice] Function call error:",N),O=JSON.stringify({error:"Function execution failed",details:N instanceof Error?N.message:String(N)})}const C={type:"FunctionCallResponse",id:g.id,name:g.name,content:O};this.ws&&this.ws.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify(C)),console.log("[GlydeVoice] Function response sent:",g.name)):console.error("[GlydeVoice] Cannot send function response - WebSocket not open")}}async executeVoiceFunction(f,g,o){console.log("[GlydeVoice] Executing voice function via Unity API:",f);try{const O=await fetch(`${this.unityUrl}/api/unity/voice/function`,{method:"POST",headers:this.getAuthHeaders(),body:JSON.stringify({function_name:f,function_call_id:g,input:o,context:{context_id:this.sessionContext.contextId,context_type:this.sessionContext.contextType,current_job_uuid:this.sessionContext.currentJobUuid}})});if(!O.ok){const N=await O.json().catch(()=>({}));throw new Error(N.error?.message||`Function call failed: ${O.status}`)}const C=await O.json();if(C.success&&C.data?.output)return typeof C.data.output=="string"?C.data.output:JSON.stringify(C.data.output);throw new Error("Invalid response from voice function endpoint")}catch(O){return console.error("[GlydeVoice] Voice function error:",O),JSON.stringify({success:!1,error:O instanceof Error?O.message:"Function execution failed",fallback_message:"I apologize, but I'm having trouble with that request right now. Is there something else I can help you with?"})}}async handleEndConversation(f){const g=f.item||"user request";return console.log(`[GlydeVoice] End conversation triggered by: ${g}`),setTimeout(()=>{this.stop()},2e3),JSON.stringify({success:!0,message:"Conversation ending. Say goodbye to the user.",trigger_phrase:g})}setSessionContext(f){this.sessionContext={...this.sessionContext,...f},console.log("[GlydeVoice] Session context updated:",{hasContextId:!!f.contextId,contextType:f.contextType,hasJobUuid:!!f.currentJobUuid})}}class Df{config;unityUrl;history=[];isTyping=!1;initialized=!1;conversationSummary=null;constructor(f){this.config=f,this.unityUrl=f.unityBaseUrl||"https://api.glydeunity.com",!f.publishableKey&&!f.apiKey&&!f.authToken&&console.warn("[GlydeText] No authentication method provided. One of publishableKey, apiKey, or authToken is required.")}getAuthHeaders(){const f={"Content-Type":"application/json"};return this.config.publishableKey&&(f["x-publishable-key"]=this.config.publishableKey),this.config.apiKey&&(f["x-api-key"]=this.config.apiKey),this.config.authToken&&(f.Authorization=`Bearer ${this.config.authToken}`),f}emit(f){this.config.onEvent&&this.config.onEvent(f)}setTyping(f){this.isTyping=f,this.config.onTyping&&this.config.onTyping(f)}async initialize(){if(!this.config.contextId)throw new Error("contextId is required for text chat initialization");this.setTyping(!0);try{const f=await fetch(`${this.unityUrl}/api/unity/screening/summary/${this.config.contextId}`,{method:"GET",headers:this.getAuthHeaders()});if(!f.ok){const O=await f.json().catch(()=>({}));throw new Error(O.error?.message||O.message||"Failed to initialize chat")}const g=await f.json();this.conversationSummary=g;const o={role:"assistant",content:g.greeting,created:new Date().toISOString()};return this.history=[o],this.initialized=!0,this.emit({type:"ready"}),this.emit({type:"history_loaded",payload:this.history}),this.history}catch(f){throw console.error("[GlydeText] Initialization error:",f),this.emit({type:"error",payload:f}),f}finally{this.setTyping(!1)}}getSummary(){return this.conversationSummary}async sendMessage(f){if(!this.config.contextId)throw new Error("contextId is required for sending messages");if(!f.trim())throw new Error("Message cannot be empty");this.initialized||await this.initialize();const g={role:"user",content:f.trim(),created:new Date().toISOString()};this.history.push(g),this.config.onMessage&&this.config.onMessage(g),this.emit({type:"message",payload:g}),this.setTyping(!0);try{const o=await fetch(`${this.unityUrl}/api/unity/screening/chat`,{method:"POST",headers:this.getAuthHeaders(),body:JSON.stringify({application_uuid:this.config.contextId,message:f.trim()})});if(!o.ok){const K=await o.json().catch(()=>({}));throw new Error(K.error?.message||K.message||"Failed to send message")}const O=await o.json();O.history?.messages&&(this.history=O.history.messages);const C=[...this.history].reverse().find(K=>K.role==="assistant");return C?(this.config.onMessage&&this.config.onMessage(C),this.emit({type:"message",payload:C}),C):{role:"assistant",content:O.response||"I received your message.",created:new Date().toISOString()}}catch(o){throw console.error("[GlydeText] Send message error:",o),this.emit({type:"error",payload:o}),o}finally{this.setTyping(!1)}}getHistory(){return[...this.history]}clearHistory(){this.history=[],this.initialized=!1}getIsTyping(){return this.isTyping}getIsInitialized(){return this.initialized}}function uh(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var Iu={exports:{}},Z={};var jf;function ih(){if(jf)return Z;jf=1;var h=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),N=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),G=Symbol.iterator;function w(d){return d===null||typeof d!="object"?null:(d=G&&d[G]||d["@@iterator"],typeof d=="function"?d:null)}var ft={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F=Object.assign,I={};function it(d,M,U){this.props=d,this.context=M,this.refs=I,this.updater=U||ft}it.prototype.isReactComponent={},it.prototype.setState=function(d,M){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,M,"setState")},it.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Mt(){}Mt.prototype=it.prototype;function nt(d,M,U){this.props=d,this.context=M,this.refs=I,this.updater=U||ft}var Rt=nt.prototype=new Mt;Rt.constructor=nt,F(Rt,it.prototype),Rt.isPureReactComponent=!0;var Q=Array.isArray;function xt(){}var W={H:null,A:null,T:null,S:null},wt=Object.prototype.hasOwnProperty;function Ot(d,M,U){var B=U.ref;return{$$typeof:h,type:d,key:M,ref:B!==void 0?B:null,props:U}}function je(d,M){return Ot(d.type,M,d.props)}function ie(d){return typeof d=="object"&&d!==null&&d.$$typeof===h}function Nt(d){var M={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(U){return M[U]})}var ve=/\/+/g;function $t(d,M){return typeof d=="object"&&d!==null&&d.key!=null?Nt(""+d.key):M.toString(36)}function Wt(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(xt,xt):(d.status="pending",d.then(function(M){d.status==="pending"&&(d.status="fulfilled",d.value=M)},function(M){d.status==="pending"&&(d.status="rejected",d.reason=M)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function A(d,M,U,B,J){var P=typeof d;(P==="undefined"||P==="boolean")&&(d=null);var ht=!1;if(d===null)ht=!0;else switch(P){case"bigint":case"string":case"number":ht=!0;break;case"object":switch(d.$$typeof){case h:case f:ht=!0;break;case q:return ht=d._init,A(ht(d._payload),M,U,B,J)}}if(ht)return J=J(d),ht=B===""?"."+$t(d,0):B,Q(J)?(U="",ht!=null&&(U=ht.replace(ve,"$&/")+"/"),A(J,M,U,"",function(Ya){return Ya})):J!=null&&(ie(J)&&(J=je(J,U+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(ve,"$&/")+"/")+ht)),M.push(J)),1;ht=0;var Ft=B===""?".":B+":";if(Q(d))for(var Dt=0;Dt<d.length;Dt++)B=d[Dt],P=Ft+$t(B,Dt),ht+=A(B,M,U,P,J);else if(Dt=w(d),typeof Dt=="function")for(d=Dt.call(d),Dt=0;!(B=d.next()).done;)B=B.value,P=Ft+$t(B,Dt++),ht+=A(B,M,U,P,J);else if(P==="object"){if(typeof d.then=="function")return A(Wt(d),M,U,B,J);throw M=String(d),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return ht}function j(d,M,U){if(d==null)return d;var B=[],J=0;return A(d,B,"","",function(P){return M.call(U,P,J++)}),B}function H(d){if(d._status===-1){var M=d._result;M=M(),M.then(function(U){(d._status===0||d._status===-1)&&(d._status=1,d._result=U)},function(U){(d._status===0||d._status===-1)&&(d._status=2,d._result=U)}),d._status===-1&&(d._status=0,d._result=M)}if(d._status===1)return d._result.default;throw d._result}var dt=typeof reportError=="function"?reportError:function(d){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof d=="object"&&d!==null&&typeof d.message=="string"?String(d.message):String(d),error:d});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",d);return}console.error(d)},bt={map:j,forEach:function(d,M,U){j(d,function(){M.apply(this,arguments)},U)},count:function(d){var M=0;return j(d,function(){M++}),M},toArray:function(d){return j(d,function(M){return M})||[]},only:function(d){if(!ie(d))throw Error("React.Children.only expected to receive a single React element child.");return d}};return Z.Activity=_,Z.Children=bt,Z.Component=it,Z.Fragment=g,Z.Profiler=O,Z.PureComponent=nt,Z.StrictMode=o,Z.Suspense=D,Z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,Z.__COMPILER_RUNTIME={__proto__:null,c:function(d){return W.H.useMemoCache(d)}},Z.cache=function(d){return function(){return d.apply(null,arguments)}},Z.cacheSignal=function(){return null},Z.cloneElement=function(d,M,U){if(d==null)throw Error("The argument must be a React element, but you passed "+d+".");var B=F({},d.props),J=d.key;if(M!=null)for(P in M.key!==void 0&&(J=""+M.key),M)!wt.call(M,P)||P==="key"||P==="__self"||P==="__source"||P==="ref"&&M.ref===void 0||(B[P]=M[P]);var P=arguments.length-2;if(P===1)B.children=U;else if(1<P){for(var ht=Array(P),Ft=0;Ft<P;Ft++)ht[Ft]=arguments[Ft+2];B.children=ht}return Ot(d.type,J,B)},Z.createContext=function(d){return d={$$typeof:N,_currentValue:d,_currentValue2:d,_threadCount:0,Provider:null,Consumer:null},d.Provider=d,d.Consumer={$$typeof:C,_context:d},d},Z.createElement=function(d,M,U){var B,J={},P=null;if(M!=null)for(B in M.key!==void 0&&(P=""+M.key),M)wt.call(M,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(J[B]=M[B]);var ht=arguments.length-2;if(ht===1)J.children=U;else if(1<ht){for(var Ft=Array(ht),Dt=0;Dt<ht;Dt++)Ft[Dt]=arguments[Dt+2];J.children=Ft}if(d&&d.defaultProps)for(B in ht=d.defaultProps,ht)J[B]===void 0&&(J[B]=ht[B]);return Ot(d,P,J)},Z.createRef=function(){return{current:null}},Z.forwardRef=function(d){return{$$typeof:K,render:d}},Z.isValidElement=ie,Z.lazy=function(d){return{$$typeof:q,_payload:{_status:-1,_result:d},_init:H}},Z.memo=function(d,M){return{$$typeof:S,type:d,compare:M===void 0?null:M}},Z.startTransition=function(d){var M=W.T,U={};W.T=U;try{var B=d(),J=W.S;J!==null&&J(U,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(xt,dt)}catch(P){dt(P)}finally{M!==null&&U.types!==null&&(M.types=U.types),W.T=M}},Z.unstable_useCacheRefresh=function(){return W.H.useCacheRefresh()},Z.use=function(d){return W.H.use(d)},Z.useActionState=function(d,M,U){return W.H.useActionState(d,M,U)},Z.useCallback=function(d,M){return W.H.useCallback(d,M)},Z.useContext=function(d){return W.H.useContext(d)},Z.useDebugValue=function(){},Z.useDeferredValue=function(d,M){return W.H.useDeferredValue(d,M)},Z.useEffect=function(d,M){return W.H.useEffect(d,M)},Z.useEffectEvent=function(d){return W.H.useEffectEvent(d)},Z.useId=function(){return W.H.useId()},Z.useImperativeHandle=function(d,M,U){return W.H.useImperativeHandle(d,M,U)},Z.useInsertionEffect=function(d,M){return W.H.useInsertionEffect(d,M)},Z.useLayoutEffect=function(d,M){return W.H.useLayoutEffect(d,M)},Z.useMemo=function(d,M){return W.H.useMemo(d,M)},Z.useOptimistic=function(d,M){return W.H.useOptimistic(d,M)},Z.useReducer=function(d,M,U){return W.H.useReducer(d,M,U)},Z.useRef=function(d){return W.H.useRef(d)},Z.useState=function(d){return W.H.useState(d)},Z.useSyncExternalStore=function(d,M,U){return W.H.useSyncExternalStore(d,M,U)},Z.useTransition=function(){return W.H.useTransition()},Z.version="19.2.4",Z}var Uf;function Pu(){return Uf||(Uf=1,Iu.exports=ih()),Iu.exports}var V=Pu();const Un=uh(V);function Rf(h){const[f,g]=V.useState("idle"),[o,O]=V.useState([]),[C,N]=V.useState(!1),[K,D]=V.useState(!1),[S,q]=V.useState(!1),[_,G]=V.useState(null),w=V.useRef(null),ft=V.useCallback(Q=>{switch(Q.type){case"ready":g("active");break;case"close":g("idle"),N(!1),D(!1);break;case"error":g("error"),G(typeof Q.payload=="object"&&Q.payload!==null&&"message"in Q.payload?String(Q.payload.message):"Connection error");break;case"user_speaking":N(!!Q.payload);break;case"agent_speaking":D(!!Q.payload);break}},[]),F=V.useCallback((Q,xt)=>{O(W=>[...W,{role:xt,content:Q,timestamp:new Date}])},[]),I=V.useCallback(async()=>{g("connecting"),G(null);try{const Q=new Of({...h,onEvent:ft,onTranscript:F});w.current=Q,await Q.start()}catch(Q){console.error("[useVoiceAgent] Failed to start:",Q),g("error"),G(Q instanceof Error?Q.message:"Failed to connect")}},[h,ft,F]),it=V.useCallback(()=>{w.current?.stop(),w.current=null,g("idle"),N(!1),D(!1)},[]),Mt=V.useCallback(()=>{const Q=!S;q(Q),w.current?.setMuted(Q)},[S]),nt=V.useCallback(Q=>{q(Q),w.current?.setMuted(Q)},[]),Rt=V.useCallback(()=>{O([])},[]);return V.useEffect(()=>()=>{w.current?.stop()},[]),V.useEffect(()=>{h.autoStart&&f==="idle"&&I()},[h.autoStart,f,I]),{status:f,transcripts:o,isUserSpeaking:C,isAgentSpeaking:K,isMuted:S,errorMessage:_,start:I,stop:it,toggleMute:Mt,setMuted:nt,clearTranscripts:Rt,voiceAgent:w.current}}function Nf(h){const[f,g]=V.useState("idle"),[o,O]=V.useState([]),[C,N]=V.useState(!1),[K,D]=V.useState(null),S=V.useRef(null),q=V.useRef(!1),_=V.useCallback(()=>(S.current||(S.current=new Df({...h,onTyping:N})),S.current),[h]),G=V.useCallback(async()=>{if(!q.current){g("loading"),D(null);try{const I=await _().initialize();O(I),g("ready"),q.current=!0}catch(F){console.error("[useTextChat] Initialization error:",F),g("error"),D(F instanceof Error?F.message:"Failed to initialize chat")}}},[_]),w=V.useCallback(async F=>{if(F.trim()){D(null);try{const I=_(),it={role:"user",content:F.trim(),created:new Date().toISOString()};O(nt=>[...nt,it]),await I.sendMessage(F);const Mt=I.getHistory();O(Mt),f!=="ready"&&(g("ready"),q.current=!0)}catch(I){console.error("[useTextChat] Send message error:",I),D(I instanceof Error?I.message:"Failed to send message")}}},[_,f]),ft=V.useCallback(()=>{S.current?.clearHistory(),O([]),q.current=!1,g("idle")},[]);return V.useEffect(()=>{h.autoInit&&!q.current&&h.contextId&&G()},[h.autoInit,h.contextId,G]),V.useEffect(()=>()=>{S.current=null},[]),{status:f,messages:o,isLoading:C,errorMessage:K,initialize:G,sendMessage:w,clearHistory:ft,textChat:S.current}}var ti={exports:{}},Ua={};var Hf;function ch(){if(Hf)return Ua;Hf=1;var h=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function g(o,O,C){var N=null;if(C!==void 0&&(N=""+C),O.key!==void 0&&(N=""+O.key),"key"in O){C={};for(var K in O)K!=="key"&&(C[K]=O[K])}else C=O;return O=C.ref,{$$typeof:h,type:o,key:N,ref:O!==void 0?O:null,props:C}}return Ua.Fragment=f,Ua.jsx=g,Ua.jsxs=g,Ua}var Bf;function fh(){return Bf||(Bf=1,ti.exports=ch()),ti.exports}var p=fh();const Ra=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),p.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),p.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),sh=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"}),p.jsx("path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"}),p.jsx("path",{d:"M5 10v2a7 7 0 0 0 12 5"}),p.jsx("path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}),p.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}),p.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),oh=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:p.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),qf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"}),p.jsx("line",{x1:"22",x2:"2",y1:"2",y2:"22"})]}),Rn=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:p.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),Yf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("line",{x1:"22",x2:"11",y1:"2",y2:"13"}),p.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]}),Gf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),p.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),wf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M12 8V4H8"}),p.jsx("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),p.jsx("path",{d:"M2 14h2"}),p.jsx("path",{d:"M20 14h2"}),p.jsx("path",{d:"M15 13v2"}),p.jsx("path",{d:"M9 13v2"})]}),Xf=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:p.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),Lf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),p.jsx("line",{x1:"22",x2:"16",y1:"9",y2:"15"}),p.jsx("line",{x1:"16",x2:"22",y1:"9",y2:"15"})]}),Qf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),p.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]}),Vf=({size:h=24,color:f="currentColor",className:g})=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,children:[p.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),p.jsx("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),p.jsx("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),p.jsx("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]}),rh=({size:h=24,color:f="currentColor",className:g})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g,style:{animation:"spin 1s linear infinite"},children:p.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),Zf={light:{primary:"#c026d3",primaryHover:"#a21caf",primaryLight:"#fdf4ff",primaryText:"#ffffff",secondary:"#0284c7",secondaryHover:"#0369a1",secondaryLight:"#f0f9ff",secondaryText:"#ffffff",success:"#059669",successLight:"#dcfce7",successText:"#166534",error:"#ef4444",errorHover:"#dc2626",errorLight:"#fef2f2",errorText:"#b91c1c",background:"#ffffff",surface:"#f9fafb",border:"#e5e7eb",borderLight:"#f3f4f6",text:"#1f2937",textSecondary:"#6b7280",textMuted:"#9ca3af"},dark:{primary:"#d946ef",primaryHover:"#c026d3",primaryLight:"#3b0764",primaryText:"#ffffff",secondary:"#38bdf8",secondaryHover:"#0ea5e9",secondaryLight:"#0c4a6e",secondaryText:"#ffffff",success:"#34d399",successLight:"#064e3b",successText:"#a7f3d0",error:"#f87171",errorHover:"#ef4444",errorLight:"#450a0a",errorText:"#fecaca",background:"#111827",surface:"#1f2937",border:"#374151",borderLight:"#4b5563",text:"#f9fafb",textSecondary:"#d1d5db",textMuted:"#9ca3af"}};function ei(h){const f=Zf[h];return`
|
|
147
147
|
--glyde-primary: ${f.primary};
|
|
148
148
|
--glyde-primary-hover: ${f.primaryHover};
|
|
149
149
|
--glyde-primary-light: ${f.primaryLight};
|
|
@@ -289,7 +289,7 @@ ${K}`),await this.initializeAudio();let D="wss://agent.deepgram.com/v1/agent/con
|
|
|
289
289
|
0%, 60%, 100% { opacity: 0.3; }
|
|
290
290
|
30% { opacity: 1; }
|
|
291
291
|
}
|
|
292
|
-
`})]})},gh=({message:h})=>{const f=h.role==="user";return p.jsxs("div",{style:{display:"flex",gap:"10px",flexDirection:f?"row-reverse":"row",alignItems:"flex-start"},children:[p.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:f?"var(--glyde-primary-light, #e0e7ff)":"var(--glyde-secondary-light, #f0f9ff)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:f?p.jsx(Gf,{size:18,color:"var(--glyde-primary, #4338ca)"}):p.jsx(wf,{size:18,color:"var(--glyde-secondary, #0284c7)"})}),p.jsx("div",{style:{padding:"12px 16px",borderRadius:"12px",background:f?"var(--glyde-primary, #4338ca)":"var(--glyde-surface, #f1f5f9)",color:f?"white":"var(--glyde-text, #1e293b)",maxWidth:"70%",borderTopRightRadius:f?"4px":"12px",borderTopLeftRadius:f?"12px":"4px",lineHeight:1.5},children:h.content})]})},mh=()=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("span",{children:"Typing"}),p.jsx("span",{style:{display:"flex",gap:"2px"},children:[0,1,2].map(h=>p.jsx("span",{style:{width:"4px",height:"4px",borderRadius:"50%",background:"var(--glyde-text-muted, #94a3b8)",animation:"typing-dot 1.4s infinite",animationDelay:`${h*.2}s`}},h))})]}),vh={floating:{width:380,height:520},modal:{width:480,height:600,maxWidth:"95vw",maxHeight:"90vh"},inline:{width:"100%",height:600}},Ha=({publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O="https://api.glydeunity.com",contextType:C="screening",defaultMode:N="voice",position:K="bottom-right",theme:D="light",allowModeSwitch:S=!0,container:q,displayMode:_="floating",dimensions:G,showHeader:w=!0,allowClose:ft=!0,onReady:F,onModeChange:I,onTranscript:it,onError:Mt,onClose:nt,initialExpanded:Rt=!1})=>{const[Q,xt]=V.useState(_==="floating"?Rt:!0),[W,wt]=V.useState(!0),[Ot,je]=V.useState(N||"voice");V.useEffect(()=>{const H=D==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":D;Na(H)},[D]),V.useEffect(()=>{F?.()},[F]);const ie=Kf(K),Nt=H=>{je(H),I?.(H)},ve=(H,dt)=>{it?.(H,dt)},$t=H=>{Mt?.(H)},Wt=()=>{_==="floating"?xt(!1):(wt(!1),nt?.())},A={...vh[_],...G},j=H=>{if(H!==void 0)return typeof H=="number"?`${H}px`:H};return W?q?p.jsx(ui,{publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:Ot,allowModeSwitch:S,showHeader:w,allowClose:ft,dimensions:A,onModeChange:Nt,onTranscript:ve,onError:$t,onClose:Wt}):_==="modal"?p.jsx(ph,{publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:Ot,allowModeSwitch:S,showHeader:w,allowClose:ft,dimensions:A,onModeChange:Nt,onTranscript:ve,onError:$t,onClose:Wt}):_==="inline"?p.jsx("div",{className:"glyde-widget-root",style:{width:j(A.width),height:j(A.height),maxWidth:j(A.maxWidth),maxHeight:j(A.maxHeight),minHeight:"500px"},children:p.jsx(ui,{publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:Ot,allowModeSwitch:S,showHeader:w,allowClose:ft,dimensions:A,onModeChange:Nt,onTranscript:ve,onError:$t,onClose:Wt})}):p.jsxs("div",{className:"glyde-widget-root",children:[!Q&&p.jsx("button",{onClick:()=>xt(!0),style:{...Et.floatingButton,...ie.button,background:"linear-gradient(135deg, var(--glyde-primary, #c026d3) 0%, var(--glyde-secondary, #7c3aed) 100%)"},"aria-label":"Open chat",children:p.jsx(Ra,{size:28,color:"white"})}),Q&&p.jsxs("div",{style:{...Et.widgetPanel,...ie.panel,background:"var(--glyde-background, white)"},className:"glyde-slide-up",children:[p.jsx(Jf,{contextType:C,showMinimize:!0,showClose:!0,onMinimize:()=>xt(!1),onClose:Wt}),S&&p.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--glyde-border, #e5e7eb)"},children:p.jsx(kf,{mode:Ot,onModeChange:Nt})}),p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:Ot==="voice"?p.jsx(ai,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,contextType:C,height:"100%",onTranscript:ve,onError:$t,onSwitchToText:S?()=>Nt("text"):void 0}):p.jsx(ni,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,height:"100%",title:"Text Chat",onError:$t})})]})]}):null},Jf=({contextType:h,showMinimize:f,showClose:g,onMinimize:o,onClose:O})=>p.jsxs("div",{style:{...Et.header,background:"linear-gradient(135deg, var(--glyde-primary, #c026d3) 0%, var(--glyde-secondary, #7c3aed) 100%)",color:"white",borderTopLeftRadius:"16px",borderTopRightRadius:"16px"},children:[p.jsxs("div",{children:[p.jsx("h3",{style:{margin:0,fontSize:"1rem",fontWeight:600},children:"GLYDE Assistant"}),p.jsx("small",{style:{opacity:.8,fontSize:"0.75rem"},children:h==="screening"?"Candidate Screening":"AI Assistant"})]}),p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[f&&o&&p.jsx("button",{onClick:o,style:{...Et.iconButton,background:"rgba(255,255,255,0.2)",width:"32px",height:"32px"},"aria-label":"Minimize",children:p.jsx(Vf,{size:16,color:"white"})}),g&&O&&p.jsx("button",{onClick:O,style:{...Et.iconButton,background:"rgba(255,255,255,0.2)",width:"32px",height:"32px"},"aria-label":"Close",children:p.jsx(Qf,{size:16,color:"white"})})]})]}),kf=({mode:h,onModeChange:f})=>p.jsxs("div",{style:Et.modeSelector,children:[p.jsxs("button",{onClick:()=>f("voice"),style:{...Et.modeSelectorButton,background:h==="voice"?"var(--glyde-primary, #c026d3)":"transparent",color:h==="voice"?"white":"var(--glyde-text, #1f2937)"},children:[p.jsx(Ra,{size:16})," Voice"]}),p.jsxs("button",{onClick:()=>f("text"),style:{...Et.modeSelectorButton,background:h==="text"?"var(--glyde-secondary, #0284c7)":"transparent",color:h==="text"?"white":"var(--glyde-text, #1f2937)"},children:[p.jsx(Rn,{size:16})," Text"]})]}),ui=({publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:N,allowModeSwitch:K,showHeader:D=!0,allowClose:S=!0,dimensions:q,onModeChange:_,onTranscript:G,onError:w,onClose:ft})=>{const[F,I]=V.useState(N);V.useEffect(()=>{I(N)},[N]);const it=nt=>{I(nt),_(nt)},Mt=nt=>{if(nt!==void 0)return typeof nt=="number"?`${nt}px`:nt};return p.jsxs("div",{className:"glyde-widget-root",style:{height:Mt(q?.height)||"100%",width:Mt(q?.width)||"100%",maxWidth:Mt(q?.maxWidth),maxHeight:Mt(q?.maxHeight),minHeight:"500px",display:"flex",flexDirection:"column",borderRadius:"16px",overflow:"hidden",boxShadow:"0 4px 20px rgba(0,0,0,0.15)",border:"1px solid var(--glyde-border, #e5e7eb)",background:"var(--glyde-background, white)"},children:[D&&p.jsx(Jf,{contextType:C,showMinimize:!1,showClose:S,onClose:ft}),K&&p.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--glyde-border, #e5e7eb)",background:"var(--glyde-background, white)"},children:p.jsx(kf,{mode:F,onModeChange:it})}),p.jsx("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},children:F==="voice"?p.jsx(ai,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,contextType:C,height:"100%",onTranscript:G,onSwitchToText:K?()=>it("text"):void 0,onError:w}):p.jsx(ni,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,height:"100%",title:"Text Chat",onError:w})})]})},ph=h=>{const{dimensions:f,onClose:g}=h,o=C=>{if(C!==void 0)return typeof C=="number"?`${C}px`:C},O=C=>{C.target===C.currentTarget&&h.allowClose&&g?.()};return V.useEffect(()=>{const C=N=>{N.key==="Escape"&&h.allowClose&&g?.()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[g,h.allowClose]),p.jsx("div",{className:"glyde-modal-backdrop",onClick:O,style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,padding:"20px"},children:p.jsx("div",{className:"glyde-modal-content glyde-fade-in",style:{width:o(f?.width)||"480px",height:o(f?.height)||"600px",maxWidth:o(f?.maxWidth)||"95vw",maxHeight:o(f?.maxHeight)||"90vh"},children:p.jsx(ui,{...h})})})};var ii={exports:{}},Ba={},ci={exports:{}},fi={};var Wf;function bh(){return Wf||(Wf=1,(function(h){function f(A,j){var H=A.length;A.push(j);t:for(;0<H;){var dt=H-1>>>1,bt=A[dt];if(0<O(bt,j))A[dt]=j,A[H]=bt,H=dt;else break t}}function g(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var j=A[0],H=A.pop();if(H!==j){A[0]=H;t:for(var dt=0,bt=A.length,d=bt>>>1;dt<d;){var M=2*(dt+1)-1,U=A[M],B=M+1,J=A[B];if(0>O(U,H))B<bt&&0>O(J,U)?(A[dt]=J,A[B]=H,dt=B):(A[dt]=U,A[M]=H,dt=M);else if(B<bt&&0>O(J,H))A[dt]=J,A[B]=H,dt=B;else break t}}return j}function O(A,j){var H=A.sortIndex-j.sortIndex;return H!==0?H:A.id-j.id}if(h.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var C=performance;h.unstable_now=function(){return C.now()}}else{var N=Date,K=N.now();h.unstable_now=function(){return N.now()-K}}var D=[],S=[],q=1,_=null,G=3,w=!1,ft=!1,F=!1,I=!1,it=typeof setTimeout=="function"?setTimeout:null,Mt=typeof clearTimeout=="function"?clearTimeout:null,nt=typeof setImmediate<"u"?setImmediate:null;function Rt(A){for(var j=g(S);j!==null;){if(j.callback===null)o(S);else if(j.startTime<=A)o(S),j.sortIndex=j.expirationTime,f(D,j);else break;j=g(S)}}function Q(A){if(F=!1,Rt(A),!ft)if(g(D)!==null)ft=!0,xt||(xt=!0,Nt());else{var j=g(S);j!==null&&Wt(Q,j.startTime-A)}}var xt=!1,W=-1,wt=5,Ot=-1;function je(){return I?!0:!(h.unstable_now()-Ot<wt)}function ie(){if(I=!1,xt){var A=h.unstable_now();Ot=A;var j=!0;try{t:{ft=!1,F&&(F=!1,Mt(W),W=-1),w=!0;var H=G;try{e:{for(Rt(A),_=g(D);_!==null&&!(_.expirationTime>A&&je());){var dt=_.callback;if(typeof dt=="function"){_.callback=null,G=_.priorityLevel;var bt=dt(_.expirationTime<=A);if(A=h.unstable_now(),typeof bt=="function"){_.callback=bt,Rt(A),j=!0;break e}_===g(D)&&o(D),Rt(A)}else o(D);_=g(D)}if(_!==null)j=!0;else{var d=g(S);d!==null&&Wt(Q,d.startTime-A),j=!1}}break t}finally{_=null,G=H,w=!1}j=void 0}}finally{j?Nt():xt=!1}}}var Nt;if(typeof nt=="function")Nt=function(){nt(ie)};else if(typeof MessageChannel<"u"){var ve=new MessageChannel,$t=ve.port2;ve.port1.onmessage=ie,Nt=function(){$t.postMessage(null)}}else Nt=function(){it(ie,0)};function Wt(A,j){W=it(function(){A(h.unstable_now())},j)}h.unstable_IdlePriority=5,h.unstable_ImmediatePriority=1,h.unstable_LowPriority=4,h.unstable_NormalPriority=3,h.unstable_Profiling=null,h.unstable_UserBlockingPriority=2,h.unstable_cancelCallback=function(A){A.callback=null},h.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):wt=0<A?Math.floor(1e3/A):5},h.unstable_getCurrentPriorityLevel=function(){return G},h.unstable_next=function(A){switch(G){case 1:case 2:case 3:var j=3;break;default:j=G}var H=G;G=j;try{return A()}finally{G=H}},h.unstable_requestPaint=function(){I=!0},h.unstable_runWithPriority=function(A,j){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var H=G;G=A;try{return j()}finally{G=H}},h.unstable_scheduleCallback=function(A,j,H){var dt=h.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?dt+H:dt):H=dt,A){case 1:var bt=-1;break;case 2:bt=250;break;case 5:bt=1073741823;break;case 4:bt=1e4;break;default:bt=5e3}return bt=H+bt,A={id:q++,callback:j,priorityLevel:A,startTime:H,expirationTime:bt,sortIndex:-1},H>dt?(A.sortIndex=H,f(S,A),g(D)===null&&A===g(S)&&(F?(Mt(W),W=-1):F=!0,Wt(Q,H-dt))):(A.sortIndex=bt,f(D,A),ft||w||(ft=!0,xt||(xt=!0,Nt()))),A},h.unstable_shouldYield=je,h.unstable_wrapCallback=function(A){var j=G;return function(){var H=G;G=j;try{return A.apply(this,arguments)}finally{G=H}}}})(fi)),fi}var $f;function Sh(){return $f||($f=1,ci.exports=bh()),ci.exports}var si={exports:{}},kt={};var Ff;function xh(){if(Ff)return kt;Ff=1;var h=Pu();function f(D){var S="https://react.dev/errors/"+D;if(1<arguments.length){S+="?args[]="+encodeURIComponent(arguments[1]);for(var q=2;q<arguments.length;q++)S+="&args[]="+encodeURIComponent(arguments[q])}return"Minified React error #"+D+"; visit "+S+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function g(){}var o={d:{f:g,r:function(){throw Error(f(522))},D:g,C:g,L:g,m:g,X:g,S:g,M:g},p:0,findDOMNode:null},O=Symbol.for("react.portal");function C(D,S,q){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:_==null?null:""+_,children:D,containerInfo:S,implementation:q}}var N=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function K(D,S){if(D==="font")return"";if(typeof S=="string")return S==="use-credentials"?S:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,kt.createPortal=function(D,S){var q=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!S||S.nodeType!==1&&S.nodeType!==9&&S.nodeType!==11)throw Error(f(299));return C(D,S,null,q)},kt.flushSync=function(D){var S=N.T,q=o.p;try{if(N.T=null,o.p=2,D)return D()}finally{N.T=S,o.p=q,o.d.f()}},kt.preconnect=function(D,S){typeof D=="string"&&(S?(S=S.crossOrigin,S=typeof S=="string"?S==="use-credentials"?S:"":void 0):S=null,o.d.C(D,S))},kt.prefetchDNS=function(D){typeof D=="string"&&o.d.D(D)},kt.preinit=function(D,S){if(typeof D=="string"&&S&&typeof S.as=="string"){var q=S.as,_=K(q,S.crossOrigin),G=typeof S.integrity=="string"?S.integrity:void 0,w=typeof S.fetchPriority=="string"?S.fetchPriority:void 0;q==="style"?o.d.S(D,typeof S.precedence=="string"?S.precedence:void 0,{crossOrigin:_,integrity:G,fetchPriority:w}):q==="script"&&o.d.X(D,{crossOrigin:_,integrity:G,fetchPriority:w,nonce:typeof S.nonce=="string"?S.nonce:void 0})}},kt.preinitModule=function(D,S){if(typeof D=="string")if(typeof S=="object"&&S!==null){if(S.as==null||S.as==="script"){var q=K(S.as,S.crossOrigin);o.d.M(D,{crossOrigin:q,integrity:typeof S.integrity=="string"?S.integrity:void 0,nonce:typeof S.nonce=="string"?S.nonce:void 0})}}else S==null&&o.d.M(D)},kt.preload=function(D,S){if(typeof D=="string"&&typeof S=="object"&&S!==null&&typeof S.as=="string"){var q=S.as,_=K(q,S.crossOrigin);o.d.L(D,q,{crossOrigin:_,integrity:typeof S.integrity=="string"?S.integrity:void 0,nonce:typeof S.nonce=="string"?S.nonce:void 0,type:typeof S.type=="string"?S.type:void 0,fetchPriority:typeof S.fetchPriority=="string"?S.fetchPriority:void 0,referrerPolicy:typeof S.referrerPolicy=="string"?S.referrerPolicy:void 0,imageSrcSet:typeof S.imageSrcSet=="string"?S.imageSrcSet:void 0,imageSizes:typeof S.imageSizes=="string"?S.imageSizes:void 0,media:typeof S.media=="string"?S.media:void 0})}},kt.preloadModule=function(D,S){if(typeof D=="string")if(S){var q=K(S.as,S.crossOrigin);o.d.m(D,{as:typeof S.as=="string"&&S.as!=="script"?S.as:void 0,crossOrigin:q,integrity:typeof S.integrity=="string"?S.integrity:void 0})}else o.d.m(D)},kt.requestFormReset=function(D){o.d.r(D)},kt.unstable_batchedUpdates=function(D,S){return D(S)},kt.useFormState=function(D,S,q){return N.H.useFormState(D,S,q)},kt.useFormStatus=function(){return N.H.useHostTransitionStatus()},kt.version="19.2.4",kt}var If;function Ah(){if(If)return si.exports;If=1;function h(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h)}catch(f){console.error(f)}}return h(),si.exports=xh(),si.exports}var Pf;function Th(){if(Pf)return Ba;Pf=1;var h=Sh(),f=Pu(),g=Ah();function o(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)e+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function O(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function C(t){var e=t,l=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(l=e.return),t=e.return;while(t)}return e.tag===3?l:null}function N(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function K(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function D(t){if(C(t)!==t)throw Error(o(188))}function S(t){var e=t.alternate;if(!e){if(e=C(t),e===null)throw Error(o(188));return e!==t?null:t}for(var l=t,a=e;;){var n=l.return;if(n===null)break;var u=n.alternate;if(u===null){if(a=n.return,a!==null){l=a;continue}break}if(n.child===u.child){for(u=n.child;u;){if(u===l)return D(n),t;if(u===a)return D(n),e;u=u.sibling}throw Error(o(188))}if(l.return!==a.return)l=n,a=u;else{for(var i=!1,c=n.child;c;){if(c===l){i=!0,l=n,a=u;break}if(c===a){i=!0,a=n,l=u;break}c=c.sibling}if(!i){for(c=u.child;c;){if(c===l){i=!0,l=u,a=n;break}if(c===a){i=!0,a=u,l=n;break}c=c.sibling}if(!i)throw Error(o(189))}}if(l.alternate!==a)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?t:e}function q(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=q(t),e!==null)return e;t=t.sibling}return null}var _=Object.assign,G=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),ft=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),it=Symbol.for("react.profiler"),Mt=Symbol.for("react.consumer"),nt=Symbol.for("react.context"),Rt=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),xt=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),wt=Symbol.for("react.lazy"),Ot=Symbol.for("react.activity"),je=Symbol.for("react.memo_cache_sentinel"),ie=Symbol.iterator;function Nt(t){return t===null||typeof t!="object"?null:(t=ie&&t[ie]||t["@@iterator"],typeof t=="function"?t:null)}var ve=Symbol.for("react.client.reference");function $t(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ve?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case F:return"Fragment";case it:return"Profiler";case I:return"StrictMode";case Q:return"Suspense";case xt:return"SuspenseList";case Ot:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case ft:return"Portal";case nt:return t.displayName||"Context";case Mt:return(t._context.displayName||"Context")+".Consumer";case Rt:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case W:return e=t.displayName||null,e!==null?e:$t(t.type)||"Memo";case wt:e=t._payload,t=t._init;try{return $t(t(e))}catch{}}return null}var Wt=Array.isArray,A=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=g.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},dt=[],bt=-1;function d(t){return{current:t}}function M(t){0>bt||(t.current=dt[bt],dt[bt]=null,bt--)}function U(t,e){bt++,dt[bt]=t.current,t.current=e}var B=d(null),J=d(null),P=d(null),ht=d(null);function Ft(t,e){switch(U(P,e),U(J,t),U(B,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?_d(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=_d(e),t=Cd(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}M(B),U(B,t)}function Dt(){M(B),M(J),M(P)}function Ya(t){t.memoizedState!==null&&U(ht,t);var e=B.current,l=Cd(e,t.type);e!==l&&(U(J,t),U(B,l))}function Nn(t){J.current===t&&(M(B),M(J)),ht.current===t&&(M(ht),Cn._currentValue=H)}var oi,ls;function Cl(t){if(oi===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);oi=e&&e[1]||"",ls=-1<l.stack.indexOf(`
|
|
292
|
+
`})]})},gh=({message:h})=>{const f=h.role==="user";return h.role==="system"?null:p.jsxs("div",{style:{display:"flex",gap:"10px",flexDirection:f?"row-reverse":"row",alignItems:"flex-start"},children:[p.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:f?"var(--glyde-primary-light, #e0e7ff)":"var(--glyde-secondary-light, #f0f9ff)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:f?p.jsx(Gf,{size:18,color:"var(--glyde-primary, #4338ca)"}):p.jsx(wf,{size:18,color:"var(--glyde-secondary, #0284c7)"})}),p.jsx("div",{style:{padding:"12px 16px",borderRadius:"12px",background:f?"var(--glyde-primary, #4338ca)":"var(--glyde-surface, #f1f5f9)",color:f?"white":"var(--glyde-text, #1e293b)",maxWidth:"70%",borderTopRightRadius:f?"4px":"12px",borderTopLeftRadius:f?"12px":"4px",lineHeight:1.5},children:h.content})]})},mh=()=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("span",{children:"Typing"}),p.jsx("span",{style:{display:"flex",gap:"2px"},children:[0,1,2].map(h=>p.jsx("span",{style:{width:"4px",height:"4px",borderRadius:"50%",background:"var(--glyde-text-muted, #94a3b8)",animation:"typing-dot 1.4s infinite",animationDelay:`${h*.2}s`}},h))})]}),vh={floating:{width:380,height:520},modal:{width:480,height:600,maxWidth:"95vw",maxHeight:"90vh"},inline:{width:"100%",height:600}},Ha=({publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O="https://api.glydeunity.com",contextType:C="screening",defaultMode:N="voice",position:K="bottom-right",theme:D="light",allowModeSwitch:S=!0,container:q,displayMode:_="floating",dimensions:G,showHeader:w=!0,allowClose:ft=!0,onReady:F,onModeChange:I,onTranscript:it,onError:Mt,onClose:nt,initialExpanded:Rt=!1})=>{const[Q,xt]=V.useState(_==="floating"?Rt:!0),[W,wt]=V.useState(!0),[Ot,je]=V.useState(N||"voice");V.useEffect(()=>{const H=D==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":D;Na(H)},[D]),V.useEffect(()=>{F?.()},[F]);const ie=Kf(K),Nt=H=>{je(H),I?.(H)},ve=(H,dt)=>{it?.(H,dt)},$t=H=>{Mt?.(H)},Wt=()=>{_==="floating"?xt(!1):(wt(!1),nt?.())},A={...vh[_],...G},j=H=>{if(H!==void 0)return typeof H=="number"?`${H}px`:H};return W?q?p.jsx(ui,{publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:Ot,allowModeSwitch:S,showHeader:w,allowClose:ft,dimensions:A,onModeChange:Nt,onTranscript:ve,onError:$t,onClose:Wt}):_==="modal"?p.jsx(ph,{publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:Ot,allowModeSwitch:S,showHeader:w,allowClose:ft,dimensions:A,onModeChange:Nt,onTranscript:ve,onError:$t,onClose:Wt}):_==="inline"?p.jsx("div",{className:"glyde-widget-root",style:{width:j(A.width),height:j(A.height),maxWidth:j(A.maxWidth),maxHeight:j(A.maxHeight),minHeight:"500px"},children:p.jsx(ui,{publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:Ot,allowModeSwitch:S,showHeader:w,allowClose:ft,dimensions:A,onModeChange:Nt,onTranscript:ve,onError:$t,onClose:Wt})}):p.jsxs("div",{className:"glyde-widget-root",children:[!Q&&p.jsx("button",{onClick:()=>xt(!0),style:{...Et.floatingButton,...ie.button,background:"linear-gradient(135deg, var(--glyde-primary, #c026d3) 0%, var(--glyde-secondary, #7c3aed) 100%)"},"aria-label":"Open chat",children:p.jsx(Ra,{size:28,color:"white"})}),Q&&p.jsxs("div",{style:{...Et.widgetPanel,...ie.panel,background:"var(--glyde-background, white)"},className:"glyde-slide-up",children:[p.jsx(Jf,{contextType:C,showMinimize:!0,showClose:!0,onMinimize:()=>xt(!1),onClose:Wt}),S&&p.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--glyde-border, #e5e7eb)"},children:p.jsx(kf,{mode:Ot,onModeChange:Nt})}),p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:Ot==="voice"?p.jsx(ai,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,contextType:C,height:"100%",onTranscript:ve,onError:$t,onSwitchToText:S?()=>Nt("text"):void 0}):p.jsx(ni,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,height:"100%",title:"Text Chat",onError:$t})})]})]}):null},Jf=({contextType:h,showMinimize:f,showClose:g,onMinimize:o,onClose:O})=>p.jsxs("div",{style:{...Et.header,background:"linear-gradient(135deg, var(--glyde-primary, #c026d3) 0%, var(--glyde-secondary, #7c3aed) 100%)",color:"white",borderTopLeftRadius:"16px",borderTopRightRadius:"16px"},children:[p.jsxs("div",{children:[p.jsx("h3",{style:{margin:0,fontSize:"1rem",fontWeight:600},children:"GLYDE Assistant"}),p.jsx("small",{style:{opacity:.8,fontSize:"0.75rem"},children:h==="screening"?"Candidate Screening":"AI Assistant"})]}),p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[f&&o&&p.jsx("button",{onClick:o,style:{...Et.iconButton,background:"rgba(255,255,255,0.2)",width:"32px",height:"32px"},"aria-label":"Minimize",children:p.jsx(Vf,{size:16,color:"white"})}),g&&O&&p.jsx("button",{onClick:O,style:{...Et.iconButton,background:"rgba(255,255,255,0.2)",width:"32px",height:"32px"},"aria-label":"Close",children:p.jsx(Qf,{size:16,color:"white"})})]})]}),kf=({mode:h,onModeChange:f})=>p.jsxs("div",{style:Et.modeSelector,children:[p.jsxs("button",{onClick:()=>f("voice"),style:{...Et.modeSelectorButton,background:h==="voice"?"var(--glyde-primary, #c026d3)":"transparent",color:h==="voice"?"white":"var(--glyde-text, #1f2937)"},children:[p.jsx(Ra,{size:16})," Voice"]}),p.jsxs("button",{onClick:()=>f("text"),style:{...Et.modeSelectorButton,background:h==="text"?"var(--glyde-secondary, #0284c7)":"transparent",color:h==="text"?"white":"var(--glyde-text, #1f2937)"},children:[p.jsx(Rn,{size:16})," Text"]})]}),ui=({publishableKey:h,apiKey:f,authToken:g,contextId:o,unityBaseUrl:O,contextType:C,mode:N,allowModeSwitch:K,showHeader:D=!0,allowClose:S=!0,dimensions:q,onModeChange:_,onTranscript:G,onError:w,onClose:ft})=>{const[F,I]=V.useState(N);V.useEffect(()=>{I(N)},[N]);const it=nt=>{I(nt),_(nt)},Mt=nt=>{if(nt!==void 0)return typeof nt=="number"?`${nt}px`:nt};return p.jsxs("div",{className:"glyde-widget-root",style:{height:Mt(q?.height)||"100%",width:Mt(q?.width)||"100%",maxWidth:Mt(q?.maxWidth),maxHeight:Mt(q?.maxHeight),minHeight:"500px",display:"flex",flexDirection:"column",borderRadius:"16px",overflow:"hidden",boxShadow:"0 4px 20px rgba(0,0,0,0.15)",border:"1px solid var(--glyde-border, #e5e7eb)",background:"var(--glyde-background, white)"},children:[D&&p.jsx(Jf,{contextType:C,showMinimize:!1,showClose:S,onClose:ft}),K&&p.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--glyde-border, #e5e7eb)",background:"var(--glyde-background, white)"},children:p.jsx(kf,{mode:F,onModeChange:it})}),p.jsx("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},children:F==="voice"?p.jsx(ai,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,contextType:C,height:"100%",onTranscript:G,onSwitchToText:K?()=>it("text"):void 0,onError:w}):p.jsx(ni,{publishableKey:h,apiKey:f,authToken:g,contextId:o||"",unityApiUrl:O,height:"100%",title:"Text Chat",onError:w})})]})},ph=h=>{const{dimensions:f,onClose:g}=h,o=C=>{if(C!==void 0)return typeof C=="number"?`${C}px`:C},O=C=>{C.target===C.currentTarget&&h.allowClose&&g?.()};return V.useEffect(()=>{const C=N=>{N.key==="Escape"&&h.allowClose&&g?.()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[g,h.allowClose]),p.jsx("div",{className:"glyde-modal-backdrop",onClick:O,style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,padding:"20px"},children:p.jsx("div",{className:"glyde-modal-content glyde-fade-in",style:{width:o(f?.width)||"480px",height:o(f?.height)||"600px",maxWidth:o(f?.maxWidth)||"95vw",maxHeight:o(f?.maxHeight)||"90vh"},children:p.jsx(ui,{...h})})})};var ii={exports:{}},Ba={},ci={exports:{}},fi={};var Wf;function bh(){return Wf||(Wf=1,(function(h){function f(A,j){var H=A.length;A.push(j);t:for(;0<H;){var dt=H-1>>>1,bt=A[dt];if(0<O(bt,j))A[dt]=j,A[H]=bt,H=dt;else break t}}function g(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var j=A[0],H=A.pop();if(H!==j){A[0]=H;t:for(var dt=0,bt=A.length,d=bt>>>1;dt<d;){var M=2*(dt+1)-1,U=A[M],B=M+1,J=A[B];if(0>O(U,H))B<bt&&0>O(J,U)?(A[dt]=J,A[B]=H,dt=B):(A[dt]=U,A[M]=H,dt=M);else if(B<bt&&0>O(J,H))A[dt]=J,A[B]=H,dt=B;else break t}}return j}function O(A,j){var H=A.sortIndex-j.sortIndex;return H!==0?H:A.id-j.id}if(h.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var C=performance;h.unstable_now=function(){return C.now()}}else{var N=Date,K=N.now();h.unstable_now=function(){return N.now()-K}}var D=[],S=[],q=1,_=null,G=3,w=!1,ft=!1,F=!1,I=!1,it=typeof setTimeout=="function"?setTimeout:null,Mt=typeof clearTimeout=="function"?clearTimeout:null,nt=typeof setImmediate<"u"?setImmediate:null;function Rt(A){for(var j=g(S);j!==null;){if(j.callback===null)o(S);else if(j.startTime<=A)o(S),j.sortIndex=j.expirationTime,f(D,j);else break;j=g(S)}}function Q(A){if(F=!1,Rt(A),!ft)if(g(D)!==null)ft=!0,xt||(xt=!0,Nt());else{var j=g(S);j!==null&&Wt(Q,j.startTime-A)}}var xt=!1,W=-1,wt=5,Ot=-1;function je(){return I?!0:!(h.unstable_now()-Ot<wt)}function ie(){if(I=!1,xt){var A=h.unstable_now();Ot=A;var j=!0;try{t:{ft=!1,F&&(F=!1,Mt(W),W=-1),w=!0;var H=G;try{e:{for(Rt(A),_=g(D);_!==null&&!(_.expirationTime>A&&je());){var dt=_.callback;if(typeof dt=="function"){_.callback=null,G=_.priorityLevel;var bt=dt(_.expirationTime<=A);if(A=h.unstable_now(),typeof bt=="function"){_.callback=bt,Rt(A),j=!0;break e}_===g(D)&&o(D),Rt(A)}else o(D);_=g(D)}if(_!==null)j=!0;else{var d=g(S);d!==null&&Wt(Q,d.startTime-A),j=!1}}break t}finally{_=null,G=H,w=!1}j=void 0}}finally{j?Nt():xt=!1}}}var Nt;if(typeof nt=="function")Nt=function(){nt(ie)};else if(typeof MessageChannel<"u"){var ve=new MessageChannel,$t=ve.port2;ve.port1.onmessage=ie,Nt=function(){$t.postMessage(null)}}else Nt=function(){it(ie,0)};function Wt(A,j){W=it(function(){A(h.unstable_now())},j)}h.unstable_IdlePriority=5,h.unstable_ImmediatePriority=1,h.unstable_LowPriority=4,h.unstable_NormalPriority=3,h.unstable_Profiling=null,h.unstable_UserBlockingPriority=2,h.unstable_cancelCallback=function(A){A.callback=null},h.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):wt=0<A?Math.floor(1e3/A):5},h.unstable_getCurrentPriorityLevel=function(){return G},h.unstable_next=function(A){switch(G){case 1:case 2:case 3:var j=3;break;default:j=G}var H=G;G=j;try{return A()}finally{G=H}},h.unstable_requestPaint=function(){I=!0},h.unstable_runWithPriority=function(A,j){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var H=G;G=A;try{return j()}finally{G=H}},h.unstable_scheduleCallback=function(A,j,H){var dt=h.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?dt+H:dt):H=dt,A){case 1:var bt=-1;break;case 2:bt=250;break;case 5:bt=1073741823;break;case 4:bt=1e4;break;default:bt=5e3}return bt=H+bt,A={id:q++,callback:j,priorityLevel:A,startTime:H,expirationTime:bt,sortIndex:-1},H>dt?(A.sortIndex=H,f(S,A),g(D)===null&&A===g(S)&&(F?(Mt(W),W=-1):F=!0,Wt(Q,H-dt))):(A.sortIndex=bt,f(D,A),ft||w||(ft=!0,xt||(xt=!0,Nt()))),A},h.unstable_shouldYield=je,h.unstable_wrapCallback=function(A){var j=G;return function(){var H=G;G=j;try{return A.apply(this,arguments)}finally{G=H}}}})(fi)),fi}var $f;function Sh(){return $f||($f=1,ci.exports=bh()),ci.exports}var si={exports:{}},kt={};var Ff;function xh(){if(Ff)return kt;Ff=1;var h=Pu();function f(D){var S="https://react.dev/errors/"+D;if(1<arguments.length){S+="?args[]="+encodeURIComponent(arguments[1]);for(var q=2;q<arguments.length;q++)S+="&args[]="+encodeURIComponent(arguments[q])}return"Minified React error #"+D+"; visit "+S+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function g(){}var o={d:{f:g,r:function(){throw Error(f(522))},D:g,C:g,L:g,m:g,X:g,S:g,M:g},p:0,findDOMNode:null},O=Symbol.for("react.portal");function C(D,S,q){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:_==null?null:""+_,children:D,containerInfo:S,implementation:q}}var N=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function K(D,S){if(D==="font")return"";if(typeof S=="string")return S==="use-credentials"?S:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,kt.createPortal=function(D,S){var q=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!S||S.nodeType!==1&&S.nodeType!==9&&S.nodeType!==11)throw Error(f(299));return C(D,S,null,q)},kt.flushSync=function(D){var S=N.T,q=o.p;try{if(N.T=null,o.p=2,D)return D()}finally{N.T=S,o.p=q,o.d.f()}},kt.preconnect=function(D,S){typeof D=="string"&&(S?(S=S.crossOrigin,S=typeof S=="string"?S==="use-credentials"?S:"":void 0):S=null,o.d.C(D,S))},kt.prefetchDNS=function(D){typeof D=="string"&&o.d.D(D)},kt.preinit=function(D,S){if(typeof D=="string"&&S&&typeof S.as=="string"){var q=S.as,_=K(q,S.crossOrigin),G=typeof S.integrity=="string"?S.integrity:void 0,w=typeof S.fetchPriority=="string"?S.fetchPriority:void 0;q==="style"?o.d.S(D,typeof S.precedence=="string"?S.precedence:void 0,{crossOrigin:_,integrity:G,fetchPriority:w}):q==="script"&&o.d.X(D,{crossOrigin:_,integrity:G,fetchPriority:w,nonce:typeof S.nonce=="string"?S.nonce:void 0})}},kt.preinitModule=function(D,S){if(typeof D=="string")if(typeof S=="object"&&S!==null){if(S.as==null||S.as==="script"){var q=K(S.as,S.crossOrigin);o.d.M(D,{crossOrigin:q,integrity:typeof S.integrity=="string"?S.integrity:void 0,nonce:typeof S.nonce=="string"?S.nonce:void 0})}}else S==null&&o.d.M(D)},kt.preload=function(D,S){if(typeof D=="string"&&typeof S=="object"&&S!==null&&typeof S.as=="string"){var q=S.as,_=K(q,S.crossOrigin);o.d.L(D,q,{crossOrigin:_,integrity:typeof S.integrity=="string"?S.integrity:void 0,nonce:typeof S.nonce=="string"?S.nonce:void 0,type:typeof S.type=="string"?S.type:void 0,fetchPriority:typeof S.fetchPriority=="string"?S.fetchPriority:void 0,referrerPolicy:typeof S.referrerPolicy=="string"?S.referrerPolicy:void 0,imageSrcSet:typeof S.imageSrcSet=="string"?S.imageSrcSet:void 0,imageSizes:typeof S.imageSizes=="string"?S.imageSizes:void 0,media:typeof S.media=="string"?S.media:void 0})}},kt.preloadModule=function(D,S){if(typeof D=="string")if(S){var q=K(S.as,S.crossOrigin);o.d.m(D,{as:typeof S.as=="string"&&S.as!=="script"?S.as:void 0,crossOrigin:q,integrity:typeof S.integrity=="string"?S.integrity:void 0})}else o.d.m(D)},kt.requestFormReset=function(D){o.d.r(D)},kt.unstable_batchedUpdates=function(D,S){return D(S)},kt.useFormState=function(D,S,q){return N.H.useFormState(D,S,q)},kt.useFormStatus=function(){return N.H.useHostTransitionStatus()},kt.version="19.2.4",kt}var If;function Ah(){if(If)return si.exports;If=1;function h(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h)}catch(f){console.error(f)}}return h(),si.exports=xh(),si.exports}var Pf;function Th(){if(Pf)return Ba;Pf=1;var h=Sh(),f=Pu(),g=Ah();function o(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)e+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function O(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function C(t){var e=t,l=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(l=e.return),t=e.return;while(t)}return e.tag===3?l:null}function N(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function K(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function D(t){if(C(t)!==t)throw Error(o(188))}function S(t){var e=t.alternate;if(!e){if(e=C(t),e===null)throw Error(o(188));return e!==t?null:t}for(var l=t,a=e;;){var n=l.return;if(n===null)break;var u=n.alternate;if(u===null){if(a=n.return,a!==null){l=a;continue}break}if(n.child===u.child){for(u=n.child;u;){if(u===l)return D(n),t;if(u===a)return D(n),e;u=u.sibling}throw Error(o(188))}if(l.return!==a.return)l=n,a=u;else{for(var i=!1,c=n.child;c;){if(c===l){i=!0,l=n,a=u;break}if(c===a){i=!0,a=n,l=u;break}c=c.sibling}if(!i){for(c=u.child;c;){if(c===l){i=!0,l=u,a=n;break}if(c===a){i=!0,a=u,l=n;break}c=c.sibling}if(!i)throw Error(o(189))}}if(l.alternate!==a)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?t:e}function q(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=q(t),e!==null)return e;t=t.sibling}return null}var _=Object.assign,G=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),ft=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),it=Symbol.for("react.profiler"),Mt=Symbol.for("react.consumer"),nt=Symbol.for("react.context"),Rt=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),xt=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),wt=Symbol.for("react.lazy"),Ot=Symbol.for("react.activity"),je=Symbol.for("react.memo_cache_sentinel"),ie=Symbol.iterator;function Nt(t){return t===null||typeof t!="object"?null:(t=ie&&t[ie]||t["@@iterator"],typeof t=="function"?t:null)}var ve=Symbol.for("react.client.reference");function $t(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ve?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case F:return"Fragment";case it:return"Profiler";case I:return"StrictMode";case Q:return"Suspense";case xt:return"SuspenseList";case Ot:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case ft:return"Portal";case nt:return t.displayName||"Context";case Mt:return(t._context.displayName||"Context")+".Consumer";case Rt:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case W:return e=t.displayName||null,e!==null?e:$t(t.type)||"Memo";case wt:e=t._payload,t=t._init;try{return $t(t(e))}catch{}}return null}var Wt=Array.isArray,A=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=g.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},dt=[],bt=-1;function d(t){return{current:t}}function M(t){0>bt||(t.current=dt[bt],dt[bt]=null,bt--)}function U(t,e){bt++,dt[bt]=t.current,t.current=e}var B=d(null),J=d(null),P=d(null),ht=d(null);function Ft(t,e){switch(U(P,e),U(J,t),U(B,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?_d(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=_d(e),t=Cd(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}M(B),U(B,t)}function Dt(){M(B),M(J),M(P)}function Ya(t){t.memoizedState!==null&&U(ht,t);var e=B.current,l=Cd(e,t.type);e!==l&&(U(J,t),U(B,l))}function Nn(t){J.current===t&&(M(B),M(J)),ht.current===t&&(M(ht),Cn._currentValue=H)}var oi,ls;function Cl(t){if(oi===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);oi=e&&e[1]||"",ls=-1<l.stack.indexOf(`
|
|
293
293
|
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
294
294
|
`+oi+t+ls}var ri=!1;function di(t,e){if(!t||ri)return"";ri=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(e){var E=function(){throw Error()};if(Object.defineProperty(E.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(E,[])}catch(x){var b=x}Reflect.construct(t,[],E)}else{try{E.call()}catch(x){b=x}t.call(E.prototype)}}else{try{throw Error()}catch(x){b=x}(E=t())&&typeof E.catch=="function"&&E.catch(function(){})}}catch(x){if(x&&b&&typeof x.stack=="string")return[x.stack,b.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=a.DetermineComponentFrameRoot(),i=u[0],c=u[1];if(i&&c){var s=i.split(`
|
|
295
295
|
`),v=c.split(`
|