@omniloy/sofia-sdk 0.0.1 → 0.0.2

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.
@@ -7,8 +7,6 @@ declare enum LanguageCode {
7
7
  id = "id"
8
8
  }
9
9
 
10
- export declare const OmniscribeElement: CustomElementConstructor;
11
-
12
10
  export declare interface OmniscribeProps {
13
11
  baseurl: string;
14
12
  wssurl: string;
@@ -38,6 +36,8 @@ export declare interface OmniscribeProps {
38
36
  setGetLastReport?: (fn: () => Promise<object | undefined>) => void;
39
37
  }
40
38
 
39
+ export declare const SofiaSDK: CustomElementConstructor;
40
+
41
41
  declare enum ToastVariation {
42
42
  default = "default",
43
43
  danger = "danger"
@@ -89607,7 +89607,7 @@ hm.prototype.processKebabCaseAttributes = function() {
89607
89607
  };
89608
89608
  function Axe() {
89609
89609
  window.omniscribeHandleReport = function(e) {
89610
- const t = document.querySelectorAll("omniscribe-component"), n = new CustomEvent("handle-report", {
89610
+ const t = document.querySelectorAll("sofia-sdk"), n = new CustomEvent("handle-report", {
89611
89611
  detail: e,
89612
89612
  bubbles: !0,
89613
89613
  composed: !0
@@ -89617,7 +89617,7 @@ function Axe() {
89617
89617
  a.dispatchEvent(n);
89618
89618
  }), console.log("Global omniscribeHandleReport called:", e);
89619
89619
  }, window.omniscribeSetIsOpen = function(e) {
89620
- const t = document.querySelectorAll("omniscribe-component"), n = new CustomEvent("set-is-open", {
89620
+ const t = document.querySelectorAll("sofia-sdk"), n = new CustomEvent("set-is-open", {
89621
89621
  detail: e,
89622
89622
  bubbles: !0,
89623
89623
  composed: !0
@@ -89627,7 +89627,7 @@ function Axe() {
89627
89627
  a.dispatchEvent(n);
89628
89628
  }), console.log("Global omniscribeSetIsOpen called:", e);
89629
89629
  }, window.omniscribeSetGetLastReport = async function() {
89630
- const e = document.querySelectorAll("omniscribe-component"), t = [];
89630
+ const e = document.querySelectorAll("sofia-sdk"), t = [];
89631
89631
  return e.forEach((n) => {
89632
89632
  const a = new CustomEvent("set-get-last-report", {
89633
89633
  detail: null,
@@ -89638,7 +89638,7 @@ function Axe() {
89638
89638
  }), console.log("Global omniscribeSetGetLastReport called"), t;
89639
89639
  };
89640
89640
  }
89641
- typeof window < "u" && typeof customElements < "u" && (customElements.get("omniscribe-component") || (customElements.define("omniscribe-component", hm), console.log("Registered omniscribe-component")), Axe(), window.omniscribe = window.omniscribe || {}, window.omniscribe.injectStyles = lH);
89641
+ typeof window < "u" && typeof customElements < "u" && (customElements.get("sofia-sdk") || (customElements.define("sofia-sdk", hm), console.log("Registered sofia-sdk")), Axe(), window.sofia = window.sofia || {}, window.sofia.injectStyles = lH);
89642
89642
  var cH = nhe();
89643
89643
  const Rxe = /* @__PURE__ */ Y(cH), Cxe = /* @__PURE__ */ X({
89644
89644
  __proto__: null,
@@ -95022,6 +95022,6 @@ const zRe = /* @__PURE__ */ Y(fV), PRe = /* @__PURE__ */ X({
95022
95022
  default: BRe
95023
95023
  }, Symbol.toStringTag, { value: "Module" }));
95024
95024
  export {
95025
- hm as OmniscribeElement
95025
+ hm as SofiaSDK
95026
95026
  };
95027
95027
  //# sourceMappingURL=webcomponents.es.js.map
@@ -642,7 +642,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
642
642
  `,children:_.jsx(uu,{className:`omniscribe_thread-stick-to-bottom ${n?"omniscribe_container-size-decrease":""} `,children:_.jsx(nme,{className:`scrollbar-pretty omniscribe_thread-stick-to-bottom-content ${n?"omniscribe_container-size-decrease":""}`,contentClassName:`omniscribe_thread-stick-to-bottom-content-class ${n?"omniscribe_container-size-decrease":""}`,content:_.jsxs(_.Fragment,{children:[_.jsx(Rhe,{handleSubmit:D,messages:v?.length}),V.useMemo(()=>{const N=v.filter(M=>!M.id?.startsWith(SD)),Q=N.map((M,pe)=>M.type==="human"?pe:-1).filter(M=>M!==-1).pop(),ne=N.map((M,pe)=>M.type==="ai"?pe:-1).filter(M=>M!==-1).pop();return N.map((M,pe)=>{const Ee=M.type==="human"&&pe===Q,_e=M.type==="ai"&&pe===ne;return M.type==="human"?_.jsx(fhe,{message:M,isLoading:S,isLastHumanMessage:Ee},M.id||`${M.type}-${pe}`):_.jsx(che,{message:M,isLoading:S,handleRegenerate:L,isLastAiMessage:_e,firstTokenReceived:E},M.id||`${M.type}-${pe}`)})},[v,S,E,L])]}),footer:_.jsxs("div",{className:`omniscribe_thread-footer-container ${n?"omniscribe_footer-size-decrease":""}`,children:[_.jsx(rme,{className:"omniscribe_thread-footer-scroll-to-bottom"}),_.jsx("div",{className:"omniscribe_thread-footer-form-container",children:_.jsx("form",{onSubmit:D,className:"omniscribe_thread-footer-form",children:_.jsxs("div",{className:"omniscribe_thread-footer-form-content",children:[_.jsxs("div",{className:"omniscribe_thread-footer-form-left-btns",children:[a.length?_.jsx(ug,{message:s({id:"See list of sources"}),side:"top",children:_.jsx(rn,{variant:"ghost",onClick:()=>P(!0),disabled:!a.length,style:{marginInline:"4px"},children:_.jsx(OD,{width:16,height:16,stroke:B?"#105bdb":"#2b303aff"})})}):_.jsx("div",{}),_.jsx("textarea",{ref:T,rows:1,value:p.value,onChange:ie,onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&!N.metaKey&&(N.preventDefault(),N.target?.closest("form")?.requestSubmit())},maxLength:u,className:`omniscribe_thread-footer-textarea omniscribe_textarea-general omniscribe_textarea-secondary no-scrollbar ${n?"omniscribe_footer-size-decrease":""}`,placeholder:s({id:"Write your question..."})})]}),_.jsxs("div",{className:"omniscribe_thread-footer-btns-container",children:[_.jsx(Khe,{onTextUpdate:fe}),h.isLoading?_.jsx(rn,{onClick:()=>h.stop(),children:_.jsx(The,{})},"stop"):_.jsx(rn,{type:"submit",size:"sm",className:"omniscribe_thread-footer-form-btn",disabled:i||S||!p.value.length||!U,children:s({id:"Send"})})]})]})})}),_.jsx("div",{className:"omniscribe_thread-footer-info",children:s({id:"SofIA may make mistakes. Consider checking important information."})})]})})})}),!!a.length&&_.jsx(Mhe,{setModalVisible:P,isOpen:R,onClose:()=>P(!1),sources:a,selectedSources:H,onToggleSource:ue,onSave:se})]})},ome=()=>_.jsx(ame,{}),ime=()=>{const{message:e,visible:t,setToastState:n,title:a,variation:i,duration:s}=es(),[c,u]=V.useState(!1);return V.useEffect(()=>{if(t){setTimeout(()=>u(!0),10);const p=setTimeout(()=>{u(!1),setTimeout(()=>n(iQ),300)},s);return()=>clearTimeout(p)}},[t]),_.jsx("div",{className:`omniscribe_toast-container ${i===tl.danger?"omniscribe_toast-container-danger":"omniscribe_toast-container-black"} ${c?"omniscribe_toast-container-show":"omniscribe_toast-container-hide"}`,children:_.jsxs("div",{className:"omniscribe_toast-subcontainer",children:[_.jsx("span",{className:"tomniscribe_toast-title",children:a}),_.jsx("span",{className:"omniscribe_toast-msg",children:e})]})})},sme=(e,t=44100)=>{const n=new Float32Array(e),a=Math.round(n.length*(16e3/t)),i=new Float32Array(a),s=(n.length-1)/(a-1);i[0]=n[0],i[a-1]=n[n.length-1];for(let c=1;c<a-1;c++){const u=c*s,p=Math.floor(u),f=Math.ceil(u),h=u-p;i[c]=n[p]+(n[f]-n[p])*h}return i};function lme(){let e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const a=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(n==="x"?a:a&3|8).toString(16)})}const cme=(e,t,n,a)=>{for(let i=0;i<5;i++){const s=Math.floor(e/t),c=i*s,u=(i+1)*s;let p=0,f=0;for(let b=c;b<u;b++)b<n.length&&(p+=n[b],f++);const h=f>0?p/(f*255):0,g=4;a[i]=Math.min(1,h*g)}for(let i=5;i<7;i++){const s=Math.floor(e/t),c=i*s,u=(i+1)*s;let p=0,f=0;for(let b=c;b<u;b++)b<n.length&&(p+=n[b],f++);const h=f>0?p/(f*255):0,g=8;a[i]=Math.min(1,h*g)}for(let i=8;i<12;i++){const s=Math.floor(e/t),c=i*s,u=(i+1)*s;let p=0,f=0;for(let b=c;b<u;b++)b<n.length&&(p+=n[b],f++);const h=f>0?p/(f*255):0,g=12;a[i]=Math.min(1,h*g)}for(let i=12;i<14;i++){const s=Math.floor(e/t),c=i*s,u=(i+1)*s;let p=0,f=0;for(let b=c;b<u;b++)b<n.length&&(p+=n[b],f++);const h=f>0?p/(f*255):0,g=8;a[i]=Math.min(1,h*g)}for(let i=14;i<t;i++){const s=Math.floor(e/t),c=i*s,u=(i+1)*s;let p=0,f=0;for(let b=c;b<u;b++)b<n.length&&(p+=n[b],f++);const h=f>0?p/(f*255):0,g=4;a[i]=Math.min(1,h*g)}},ume=({stream:e,setAudioContext:t,setAnimationFrameId:n,socket:a,isServerReady:i})=>{const{enabled:s,connectionLoading:c}=qa(),u=V.useRef(null),p=V.useRef(null),f=V.useRef(null),h=V.useRef(null),g=V.useRef(null),b=V.useRef(null),v=V.useRef(null),S=V.useRef(s),E=15,[k,A]=V.useState(()=>Array(E).fill(0));V.useEffect(()=>{S.current=s,(!s||c)&&A(Array(E).fill(0))},[s,c,E]);const T=V.useCallback(()=>{if(!S.current||c)return;if(!f.current||!h.current){A(Array(E).fill(0)),p.current=requestAnimationFrame(T),n(p.current);return}const R=f.current,P=h.current;R.getByteFrequencyData(P);const B=E,O=R.frequencyBinCount,U=Math.floor(O*.6);let K=!1;for(let q=0;q<Math.min(50,P.length);q++)if(P[q]>10){K=!0;break}if(!K||!e){A(Array(B).fill(0)),p.current=requestAnimationFrame(T),n(p.current);return}const H=Array(B).fill(0);cme(U,B,P,H),A(H),S.current&&!c&&(p.current=requestAnimationFrame(T),n(p.current))},[n,e,E,c]);return V.useEffect(()=>{if(b.current&&(b.current.disconnect(),b.current=null),g.current&&(g.current.disconnect(),g.current=null),v.current){try{v.current.state!=="closed"&&v.current.close()}catch(R){console.log("Audio context already closed",R)}v.current=null}if(e)try{const R=new AudioContext;v.current=R,t(R);const P=R.createMediaStreamSource(e);b.current=P;const B=R.createAnalyser();B.fftSize=2048,B.minDecibels=-90,B.maxDecibels=-25,B.smoothingTimeConstant=.2,f.current=B;const O=new Uint8Array(B.frequencyBinCount);h.current=O,P.connect(B);const U=R.createScriptProcessor(4096,1,1);g.current=U,U.onaudioprocess=H=>{if(!i||!a)return;const q=H.inputBuffer.getChannelData(0);if(a.readyState===WebSocket.OPEN){const J=sme(q,R.sampleRate);a.send(J)}},P.connect(U),U.connect(R.destination);const K=R.createGain();K.gain.value=.001,B.connect(K),K.connect(R.destination)}catch(R){console.error("Error setting up audio context:",R)}},[e,i,a,t]),V.useEffect(()=>{const R=()=>{s&&!p.current&&!c&&(p.current=requestAnimationFrame(T),n(p.current))},P=()=>{p.current&&(cancelAnimationFrame(p.current),p.current=null,n(null))};return s&&!c?R():P(),()=>{P()}},[s,c,T,n]),_.jsx("div",{ref:u,className:"omniscribe_audio-visualizer-container",children:_.jsx("div",{className:"omniscribe_audio-visualizer-subcontainer",children:k.map((R,P)=>{const K=.5+(1-Math.abs((P-k.length/2)/(k.length/2)))*.5,H=4+36*Math.pow(R,.7)*K,q=Math.round(H/3);return _.jsx("div",{className:"omniscribe_audio-visualizer-item-container",children:Array.from({length:q}).map((J,ue)=>_.jsx("div",{className:"omniscribe_audio-visualizer-item"},ue))},P)})})})},dme=({microEnabled:e,reset:t,seconds:n,setSeconds:a})=>{const i=()=>{if(n){const s=String(Math.floor(n/60)).padStart(2,"0"),c=String(n%60).padStart(2,"0");return`${s}:${c}`}return"00:00"};return V.useEffect(()=>{const s=setInterval(()=>{e&&a(c=>c+1)},1e3);return t&&clearInterval(s),()=>clearInterval(s)},[e,t]),V.useEffect(()=>{t&&a(0)},[t]),_.jsx("div",{id:"recordingTimer",className:"omniscribe_audio-recorder-timer",children:i()})},pme=({stroke:e="currentColor",width:t=24,height:n=24,strokeWidth:a=2,fill:i="none"})=>_.jsxs("svg",{width:t,height:n,fill:i,stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:a,viewBox:"0 0 24 24",children:[_.jsx("path",{d:"m2 2 20 20M18.89 13.23A7.12 7.12 0 0 0 19 12v-2M5 10v2a7 7 0 0 0 12 5M15 9.34V5a3 3 0 0 0-5.68-1.33"}),_.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M12 19v3"})]});var fu=(e=>(e.Disconnected="disconnected",e.Connecting="connecting",e.Connected="connected",e.Reconnecting="reconnecting",e.SignalReconnecting="signalReconnecting",e))(fu||{});const zD=(e,t)=>{let n=e;return t?.length?(t?.forEach(a=>{const i=a.misspelled.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=a.correct.toLowerCase().startsWith(a.misspelled.toLowerCase())?a.correct.substring(a.misspelled.length).trim():"";if(!s){const p=new RegExp(`\\b(${i}|${i.charAt(0).toUpperCase()+i.slice(1)})\\b`,"g");n=n.replace(p,f=>f.charAt(0)===f.charAt(0).toUpperCase()?a.correct.charAt(0).toUpperCase()+a.correct.slice(1):a.correct);return}const c=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=new RegExp(`\\b(${i}|${i.charAt(0).toUpperCase()+i.slice(1)})(?!\\s*${c}\\b)`,"g");n=n.replace(u,p=>p.charAt(0)===p.charAt(0).toUpperCase()?a.correct.charAt(0).toUpperCase()+a.correct.slice(1):a.correct)}),n):e},hu=(e,t)=>({...e,text:e.text.map(n=>({...n,text:zD(n.text,t)}))});var Hn=(e=>(e.dayData="omniscribe_day_data",e))(Hn||{});async function PD(e,t){const n=new TextEncoder,a=await window.crypto.subtle.importKey("raw",n.encode(e),{name:"PBKDF2"},!1,["deriveKey"]);return window.crypto.subtle.deriveKey({name:"PBKDF2",salt:t,iterations:1e5,hash:"SHA-256"},a,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}const fme=async e=>{try{const t="sofia",n=navigator.userAgent.slice(0,50),a=`${t}-${n}`,s=new TextEncoder().encode(e),c=new Uint8Array(16),u=new Uint8Array(12);window.crypto.getRandomValues(c),window.crypto.getRandomValues(u);const p=await PD(a,c),f=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:u},p,s),h=new Uint8Array(c.length+u.length+f.byteLength);h.set(c,0),h.set(u,c.length),h.set(new Uint8Array(f),c.length+u.length);const g=Array.from(h);return btoa(String.fromCharCode(...g))}catch(t){throw console.error("Encryption error:",t),new Error("Failed to encrypt data")}},hme=async e=>{try{const t="sofia",n=navigator.userAgent.slice(0,50),a=`${t}-${n}`,i=new Uint8Array(atob(e).split("").map(g=>g.charCodeAt(0))),s=i.slice(0,16),c=i.slice(16,28),u=i.slice(28),p=await PD(a,s),f=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:c},p,u);return new TextDecoder("utf-8").decode(f)}catch(t){console.error("Decryption error:",t)}},mme=e=>{const n=new Date().toLocaleDateString().split("/")?.[0],a=e?.split("/")?.[0];return n!==a},yl=async(e,t,n,a,i)=>{if(!e){console.error("provide a key to store the value");return}const s={value:t,meta:{expiresAt:n??null,patientId:null,doctorId:null}};try{const c=await fme(JSON.stringify(s));localStorage.setItem(e,c)}catch(c){console.error("Error storing encrypted data:",c)}},BD=e=>{localStorage.removeItem(e)},ro=async(e,t,n)=>{const a=localStorage.getItem(e);if(!a)return null;try{const i=await hme(a),s=i?JSON.parse(i):null;return!s||s.meta?.expiresAt&&mme(s.meta?.expiresAt)||t&&n&&(t!==s.meta?.patientId||n!==s.meta?.doctorId)?(BD(e),null):s.value}catch(i){return console.error("Error decrypting storage item",i),BD(e),null}},bf=async e=>{const{patientId:t,doctorId:n,report:a,transcript:i,runId:s,recordingSeconds:c,transcriptionId:u,clinicalNoteId:p}=e,f=await ro(Hn.dayData)??[],h=f?.find(b=>b.patientId===t&&b.doctorId===n),g=[{patientId:t,doctorId:n,date:new Date().toLocaleDateString(),report:a||[],transcript:i?.length?i:[],clinicalNoteId:p!==void 0?p:void 0,transcriptionId:u!==void 0?u:void 0,reportRunIds:s?[s]:[],recordingSeconds:c!==void 0?c:0}];if(!f?.length)await yl(Hn.dayData,g,new Date().toLocaleDateString());else if(!h)await yl(Hn.dayData,f.concat(g),new Date().toLocaleDateString());else{const b=f.map(v=>{if(v.patientId===t&&v.doctorId===n){const S=s?[...v.reportRunIds??[],s]:v.reportRunIds;return{...v,report:a||v.report,transcript:i!==void 0?i:v.transcript,clinicalNoteId:p!==void 0?p:v.clinicalNoteId,transcriptionId:u!==void 0?u:v.transcriptionId,reportRunIds:S,recordingSeconds:c!==void 0?c:v.recordingSeconds}}return v});await yl(Hn.dayData,b,f[0].date)}},gme=async(e,t)=>{const n=await ro(Hn.dayData)??[];if(n?.filter(i=>i.patientId===e&&i.doctorId===t)?.[0]){const i=n?.map(s=>s.patientId===e&&s.doctorId===t?{...s,report:[],transcript:[],transcriptionId:void 0,clinicalNoteId:void 0,reportRunIds:[],recordingSeconds:0}:s);await yl(Hn.dayData,i,n[0].date)}},bme=async e=>{const t=await ro(Hn.dayData)??[],n=t?.map(a=>a?.transcript?.length&&e?.length?{...a,transcript:a.transcript.map(i=>({...i,text:i.text.map(s=>({...s,text:zD(s.text,e)}))}))}:a);n?.length&&await yl(Hn.dayData,n,t[0].date)},FD=async(e,t,n)=>(await ro(Hn.dayData)??[])?.find(s=>s.patientId===e&&s.doctorId===t)?.[n],yme=async(e,t)=>await FD(e,t,"recordingSeconds")??0,vme=async(e,t)=>await FD(e,t,"clinicalNoteId"),Sme={updateClinicalNote:async(e,t)=>{try{return await Wa.patch(`/clinical-notes/${e}`,t)}catch(n){throw console.error("Clinical note update error:",n),n}}},Eme=async(e,t,n,a,i,s)=>{try{const c=await ro(Hn.dayData);if(!c||c.length===0){console.warn("No storage data found in localStorage");return}const u=c?.find(f=>f.patientId===e&&f.doctorId===t);if(!u?.clinicalNoteId){console.warn("No clinical note ID found in localStorage");return}const p=u.reportRunIds?[...u.reportRunIds,s]:[s];await Sme.updateClinicalNote(u.clinicalNoteId,{template:JSON.stringify(a),ai_generated_content:n,report_thread_id:i,report_run_id:p})}catch(c){throw console.error("Failed to update clinical note in database:",c),c}},wme=e=>(Array.isArray(e),e),xme=e=>e.replace(/```json|```/g,"").trim(),kme=e=>{try{const t=e.match(/\[\s*{[\s\S]*}\s*\]/);return t?JSON.parse(t[0]):(console.log("No valid JSON array found."),[])}catch(t){return console.warn("Failed to clean/parse segment:",t),[]}},mu=e=>{const t=xme(e);return kme(t)},c4={processTranscriptionMessages:async(e,t,n,a,i,s,c,u)=>{try{const p=t;let f="";p.forEach(v=>{const S=wme(v.text);Array.isArray(S)&&S.forEach(E=>{f+=E.speaker+": "+E.text+`;
643
643
  `})});const g={input:{transcription:f,json_schema:i,configure:n.trim()||void 0,target_language:s,doctor_id:u,current_datetime:LD()},streamMode:["messages"]},b=await e.runs.create(a,"",g);if(b){const S=(await e.runs.join(a,b.run_id)).extracted_fields;if(S){if(c&&u){bf({patientId:c,doctorId:u,report:S,runId:b.run_id});try{Eme(c,u,S,i,a,b.run_id)}catch(E){console.error("Failed to update clinical note:",E)}}return S}else return console.warn("No se encontró ningún resultado en la salida del run."),{error:{error:void 0,title:"No se encontró ningún resultado en la salida del run.",message:"Hubo algunos problemas al generar las notas. Por favor, inténtelo de nuevo."}}}else return console.warn("No se encontró run."),{error:{error:void 0,title:"No se encontró run.",message:"Hubo algunos problemas al generar las notas. Por favor, inténtelo de nuevo."}}}catch(p){return{error:{error:p,title:void 0,message:"Error al procesar los mensajes de transcripción. Por favor, intenta nuevamente."}}}},record:(e,t,n)=>{e.onopen=function(){e.send(JSON.stringify({uid:t,language:n,task:"transcribe",model:"medium",medical_practice:"medical",use_vad:!0}))}},recordFinal:e=>{e.send(JSON.stringify({type:"final_request"}))},gracefulDisconnect:(e,t)=>{e.send(JSON.stringify({type:"graceful_disconnect",uid:t}))}},_me=e=>{const t=e.filter(i=>i.source==="whisper"),n=e.filter(i=>i.source!=="whisper");if(t.length===0)return e;const a=new Map;return t.forEach(i=>{const s=`${i.uuid}-${i.start}`,c=a.get(s);(!c||parseFloat(i.end)>parseFloat(c.end))&&a.set(s,i)}),[...n,...Array.from(a.values())]},UD=(e,t)=>{const n=e||[];if(!Ame(t))return n;const a=[...n,...t],i=_me(a),s=Tme(i),c=s.filter(g=>g.source==="gemini"),u={};c.forEach(g=>{g.uuid&&(u[g.uuid]=parseFloat(g.end))});const p=s.filter(g=>{if(g.source!=="whisper")return!0;const b=u[g.uuid];return b===void 0?!0:parseFloat(g.end)>b}),f=p.filter(g=>g.source==="whisper").sort((g,b)=>parseFloat(g.start)-parseFloat(b.start));return[...p.filter(g=>g.source==="gemini"),...f]},Tme=e=>{const t=new Set;return e.filter(n=>{if(n.source!=="gemini")return!0;const a=`${n.uuid}-${n.start}-${n.end}`;return t.has(a)?!1:(t.add(a),!0)})},yf=async(e,t,n,a,i)=>{const s=ND(),c=await HD(n,a);t(u=>{const p=u.segments.concat(e),f=UD(c,p),h=f.filter(b=>b.source==="gemini");return n&&a&&h.length>0&&bf({patientId:n,doctorId:a,transcript:h}),{...u,userTranscriptions:(i?h:f).map(b=>hu(b,s)),segments:p.map(b=>hu(b,s))}})},HD=async(e,t)=>{const a=(await ro(Hn.dayData))?.filter(s=>s.patientId===e&&s.doctorId===t)?.[0];return a?.transcript?.length?a?.transcript:[]},Ame=e=>Array.isArray(e)&&e.length>0,$D=(e,t)=>{if(e?.source!=="gemini"||!e?.segments?.length)return;const n=[];return e.segments.forEach((a,i)=>{const s=mu(a.text);if(!s||s.length===0){console.warn(`Failed to parse segment at index ${i}:`,a.text);return}const c=s[0],u=s[s.length-1];if(!c.start||!u.end){console.warn(`Invalid start/end times for segment at index ${i}:`,{firstText:c,lastText:u});return}n.push({...a,end:u.end,start:c.start,text:s,id:`${Date.now()}-${i}`,uuid:t,source:e.source})}),n.length>0?n:void 0},Rme=async(e,t,n)=>{const a=await HD(t,n),i=UD(a,e),s=i.filter(g=>g.source==="gemini"),c=i.filter(g=>g.source==="whisper");if(c.length===0)return i;const u=s[s.length-1]||null,p=[];let f=parseFloat(u?.end??"0.000");return c.forEach((g,b)=>{const v=parseFloat(g.start),E=parseFloat(g.end)-v,k=f,A=k+E,T=g.text.map(O=>({speaker:O.speaker,speaker_id:O.speaker_id,text:O.text})),P=`${Date.now()}-${b}`,B={start:k.toFixed(3),end:A.toFixed(3),text:T,completed:!0,source:"gemini",id:P,uuid:g.uuid};p.push(B),f=A}),[...s,...p]},Cme=async(e,t,n,a)=>{const i=ND();t(c=>({...c,userTranscriptions:e.map(u=>hu(u,i))}));const s=e.filter(c=>c.source==="gemini");n&&a&&s.length>0&&bf({patientId:n,doctorId:a,transcript:s})},u4={createTranscription:async e=>{try{return await Wa.post("/transcriptions/create",e)}catch(t){throw console.error("Transcription creation error:",t),t}},updateTranscription:async(e,t)=>{try{return await Wa.patch(`/transcriptions/update/${e}`,t)}catch(n){throw console.error("Transcription update error:",n),n}}},Nme=async(e,t,n,a="en")=>{try{const i=await ro(Hn.dayData);if(!i||i.length===0)throw new Error("No storage data found in localStorage");const s=i?.find(f=>f.patientId===e&&f.doctorId===t);if(!s?.transcript?.length)throw new Error("No transcript data found for patient in localStorage");const c=JSON.stringify(s.transcript),u={duration_seconds:n,language_used:a,original_transcript:c};let p;return s.transcriptionId?(p=await u4.updateTranscription(s.transcriptionId,u),{transcriptionId:p.transcription.id}):(p=await u4.createTranscription(u),{transcriptionId:p.transcription.id,clinicalNoteId:p.clinical_note_id})}catch(i){throw console.error("Failed to save transcription to database:",i),i}},Ome=({reset:e})=>{const{setToastState:t}=es(),{appointmentData:n}=Br(),{permission:a,selectedDevice:i,enabled:s,connectionLoading:c,segments:u,generating:p,chatMicrophoneActive:f,setState:h}=qa(),{wssUrl:g,disableAllActions:b,chatApp:v}=Pr(),{language:S}=Oa(),[E,k]=V.useState(null),[A,T]=V.useState(null),[R,P]=V.useState(null),[B,O]=V.useState(null),[U,K]=V.useState(!1),[H,q]=V.useState(0),{formatMessage:J}=At(),ue=J({id:"Please enable the microphone or reset the permissions"}),[fe,ie]=V.useState("");V.useEffect(()=>{(async()=>{if(n?.patientId&&n?.doctorId){const M=await yme(n.patientId,n.doctorId);q(M)}})()},[n?.patientId,n?.doctorId]);const se=async ne=>{const M=lme();ie(M);let pe=await jhe()||S;if(!ne)return;h(_e=>({..._e,enabled:!0,connectionLoading:!0}));const Ee=new WebSocket(g);Ee.binaryType="arraybuffer",O(Ee),c4.record(Ee,M,pe),Ee.onmessage=async _e=>{try{const Pe=JSON.parse(_e.data);if(Pe.uid!==M){console.log("Ignoring message for different UUID");return}if(Pe.status==="WAIT"){console.log("wait"),L();return}if(Pe.status==="SERVER_READY"){K(!0),h(Be=>({...Be,roomState:fu.Connected})),h(Be=>({...Be,connectionLoading:!1})),console.log("Server is ready to receive audio");return}if(pe===null){pe=Pe.language;return}if(Pe.message==="DISCONNECT"){h(Be=>({...Be,roomState:fu.Disconnected})),L();return}if(Pe.segments?.length>0){const Be=$D(Pe,M);if(Be?.length)yf(Be,h,n?.patientId,n?.doctorId);else{const Ke=Pe.segments.map(Me=>({...Me,uuid:M,source:Pe.source,uid:Pe.uid,text:mu(Me.text),start:mu(Me.text)?.[0].start,end:mu(Me.text)?.[mu(Me.text)?.length-1].end}));yf(Ke,h,n?.patientId,n?.doctorId)}}}catch(Pe){console.log(`Non-JSON message received: ${Pe}`,_e.data)}},Ee.onclose=_e=>{console.warn(`WebSocket closed: code=${_e.code}, reason=${_e.reason}`),_e.code!==1e3&&_e.code!==1005?L():(h(Pe=>({...Pe,enabled:!1,connectionLoading:!1})),K(!1))},Ee.onerror=_e=>console.error("WebSocket error:",_e)},D=async()=>new Promise(ne=>{let M=!1;const pe=async Pe=>{if(!M)try{const Be=JSON.parse(Pe.data);console.log("cleanup data",Be);const Ke=$D(Be,fe)??[];Ke?.length&&(yf(Ke,h,n?.patientId,n?.doctorId,!0),M=!0,B?.removeEventListener("message",pe),_e(!0))}catch(Be){console.warn("Error parsing cleanup message:",Be)}};B?.addEventListener("message",pe);const Ee=setTimeout(()=>{M||(console.log("Cleanup timeout reached (10s) - resolving anyway"),M=!0,B?.removeEventListener("message",pe),_e(!1))},15e3),_e=Pe=>{clearTimeout(Ee),ne(Pe)}}),L=V.useCallback(async()=>{h(M=>({...M,connectionLoading:!0})),B&&B.readyState===WebSocket.OPEN&&c4.gracefulDisconnect(B,fe);const ne=await D();if(E&&(E.getTracks().forEach(M=>M.stop()),k(null)),A&&A.state!=="closed"){try{await A.close()}catch(M){console.warn("Error closing AudioContext:",M)}T(null)}if(B&&(B.close(),O(null)),h(M=>({...M,roomState:fu.Disconnected})),R&&cancelAnimationFrame(R),h(M=>({...M,enabled:!1,connectionLoading:!1})),K(!1),!ne){const M=await Rme(u,n?.patientId,n?.doctorId);Cme(M,h,n?.patientId,n?.doctorId)}if(await du(600),n?.patientId&&n?.doctorId)try{const{transcriptionId:M,clinicalNoteId:pe}=await Nme(n.patientId,n.doctorId,H);await bf({patientId:n.patientId,doctorId:n.doctorId,recordingSeconds:H,transcriptionId:M,clinicalNoteId:pe})}catch(M){console.error("Failed to save transcription:",M)}h(M=>({...M,segments:[]}))},[u,n,B,fe,E,A,R]),F=async ne=>{ID(h),se(ne)},ee=async ne=>{if(p)return null;hf(a,h,()=>F(ne),t,ue)},N=async()=>{if(E&&s)L();else try{const ne=await DD(i);k(ne),ee(ne)}catch(ne){bl(t,ue),console.error("Microphone access denied",ne)}},Q=()=>{if(s&&!c)return"omniscribe_record-button-enabled";if(!s&&!c)return"omniscribe_record-button-not-enabled";if(c||b)return"omniscribe_record-button-disabled"};return V.useEffect(()=>{v&&s&&L()},[v,s]),_.jsxs("div",{title:"toggle-record",className:"omniscribe_record-button-container",children:[_.jsx(rn,{title:"toggle-record-btn",onClick:N,disabled:c||b||f,variant:"icon",className:"omniscribe_record-button-classname",children:_.jsxs("div",{className:`omniscribe_record-button
644
644
  ${Q()}`,children:[_.jsx("div",{className:s&&!c?"omniscribe_record-enabled":""}),s?_.jsx(_r,{width:24,height:24,stroke:"#fff"}):_.jsx(pme,{width:24,height:24,stroke:"#fff"})]})}),_.jsx(dme,{microEnabled:s&&!c,reset:e,seconds:H,setSeconds:q}),_.jsx(ume,{stream:E,setAudioContext:T,setAnimationFrameId:P,socket:B,isServerReady:U})]})},jD={createThread:async e=>{try{return{threadId:(await e.client.threads.create()).thread_id}}catch(t){return console.error("Error initializing Langgraph:",t),{error:"Error initializing Langgraph:"}}},searchThreads:async e=>await e.threads.search({limit:100})};function Ime(e,t,n,a){return new ng({apiUrl:e,defaultHeaders:{Authorization:`Bearer ${t}`,IS_CHAT:"true",doctor:n,patient:a}})}function Mme(e,t,n,a){return new ng({apiUrl:e,defaultHeaders:{Authorization:`Bearer ${t}`,doctor:n,patient:a}})}const qD=async(e,t)=>{const a=(await ro(Hn.dayData))?.filter(s=>s.patientId===e&&t===s.doctorId)?.[0]?.report??void 0;return typeof a=="object"&&!Array.isArray(a)&&a!==null?a:void 0},Dme=({isLoading:e,message:t="Please wait while we generate the report"})=>{const{formatMessage:n}=At();return e?_.jsx("div",{className:"omniscribe_loading-modal-container",children:_.jsxs("div",{className:"omniscribe_loading-modal-subcontainer",children:[_.jsx("div",{className:"omniscribe_loading-modal-msg",children:n({id:t})}),_.jsx("div",{className:"omniscribe_loading-modal-spin"})]})}):null},Lme=({onFillClick:e})=>{const{userTranscriptions:t,modalTextAreaInstructions:n,transcriptorLoader:a,enabled:i,connectionLoading:s,generating:c,setState:u}=qa(),{threadId:p,report:f,appointmentData:h,handleReport:g,handleFill:b,setLangGraphState:v}=Br(),{langGraphBaseUrl:S,apiKey:E,disableAllActions:k,disableGenerate:A}=Pr(),{language:T,getMixedToolArgs:R}=Oa(),P=Uc(),B=async()=>{const D=await s4(T);U(D)},[O,U]=V.useState(cs),[K,H]=V.useState(!1),{formatMessage:q}=At(),J=async D=>{u(L=>({...L,generating:!0}));try{const L=Mme(S,E,h?.doctorId,h?.patientId),F=await c4.processTranscriptionMessages(L,t,n,D,R()||{},O?.name,h?.patientId,h?.doctorId);"error"in F?console.log(F.error):(v(ee=>({...ee,report:F})),g?.(F))}catch(L){console.log(L)}finally{u(L=>({...L,generating:!1}))}},ue=D=>{const L=async()=>{if(p)J(p);else try{const F=await jD.createThread(P);F?.threadId?(v(ee=>({...ee,threadId:F?.threadId})),J(F?.threadId)):console.error("Error initializing thread id:",F.error)}catch(F){console.error("LangGraph error:",F)}};return _.jsx(rn,{variant:"primary",size:"sm",isLoading:c,className:"omniscribe_regenerate-button-width",disabled:k||c||i||s||A,onClick:L,children:D??q({id:"Generate report"})})},fe=()=>{if(b){const D=async()=>{H(!0),await b(),H(!1),e?.()};return _.jsx(rn,{variant:"report",type:"submit",size:"sm",isLoading:!1,className:"omniscribe_report-button-width",disabled:k||c||i||s||A,onClick:D,children:q({id:"Fill out report"})})}},ie=async()=>{const D=await qD(h?.patientId,h?.doctorId);v(L=>({...L,report:D}))};V.useEffect(()=>{B()},[T]),V.useEffect(()=>{ie()},[h?.patientId]);const se=()=>!c&&f&&b&&t?.length?_.jsxs(_.Fragment,{children:[ue(q({id:"Regenerate report"})),fe()]}):!c&&f&&t?.length?ue(q({id:"Regenerate report"})):t?.length&&t[t?.length-1].end?ue():null;return _.jsxs("div",{className:"omniscribe_report-button-container",children:[se(),_.jsx(Dme,{isLoading:a||c||K,message:K?"Por favor espera mientras rellenamos con el reporte":void 0})]})},vf=({options:e,onChange:t,selectedNumber:n=0})=>{const a=V.useRef(null),[i,s]=V.useState(e[n]),[c,u]=V.useState(!1),[p,f]=V.useState(!1),{formatMessage:h}=At(),g=async(v,S)=>{f(!0),S.stopPropagation(),s(v),t&&t(v.value),await du(100),u(!1),await du(200),f(!1)},b=v=>{p||a.current&&!a.current.contains(v.target)&&u(!1)};return V.useEffect(()=>(document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}),[p]),V.useEffect(()=>{s(e[n])},[n,e]),_.jsxs("div",{ref:a,className:"omniscribe_select-container",children:[_.jsxs("button",{className:"omniscribe_select-button text-p",onClick:()=>u(!c),children:[_.jsxs("span",{className:"omniscribe_select-text",children:[i.icon,h({id:i.label,defaultMessage:i.label})]}),_.jsx(w2,{style:{height:"calc(var(--spacing) * 5)",color:"var(--color-gray-900)",marginLeft:"calc(var(--spacing) * 2)"}})]}),c&&_.jsx("div",{className:"omniscribe_select-content-container",children:_.jsx("ul",{className:"omniscribe_select-content-ul scrollbar-pretty",children:e.map(v=>_.jsxs("li",{onMouseDown:S=>{S.stopPropagation(),S.preventDefault()},onClick:S=>g(v,S),className:"omniscribe_select-content-li",children:[_.jsxs("span",{className:"omniscribe_select-content-li-span",children:[v.icon??null,h({id:v.label,defaultMessage:v.label})]}),i.value===v.value&&_.jsx(l7,{className:"omniscribe_select-check-icon"})]},String(v.value)))})})]})};function zme(e){const{isAtBottom:t,scrollToBottom:n}=df(),{formatMessage:a}=At();return t?null:_.jsxs(rn,{variant:"outline",className:e.className,onClick:()=>n("smooth"),children:[_.jsx(_D,{className:"omniscribe_transcription-down-btn"}),_.jsx("span",{children:a({id:"Scroll down"})})]})}const Pme=()=>{const{selectedData:e,userTranscriptions:t}=qa(),{language:n}=Oa(),{report:a,renderReportContent:i}=Br(),{formatMessage:s}=At(),c=()=>{if(t&&t.length)return t?.map(f=>f.text.map((h,g)=>_.jsxs("div",{className:"omniscribe_audio-content-messages",style:{textAlign:n===gl.ar?"right":"left"},children:[_.jsxs("span",{className:h.speaker==="Paciente"?"omniscribe_patient":h.speaker==="Doctor"?"omniscribe_doctor":"omniscribe_speaker",style:{paddingLeft:n===gl.ar?"0.5rem":"0"},children:[s({id:h.speaker}),":"]}),_.jsx("span",{className:"omniscribe_transcription text-p",children:h.text})]},`${f.id}-${f.uuid}-${g}`)))},u=()=>{if(a&&i)return i(a,e);if(a)return _.jsx("div",{className:"omniscribe_audio-content-render",children:JSON.stringify(a?.[e])})},p=()=>e&&a&&a?.[e]?u():c();return _.jsxs(uu,{className:"omniscribe_audio-content-container",initial:"smooth",resize:"smooth",children:[_.jsx(uu.Content,{children:p()}),_.jsx("div",{className:"omniscribe_transcription-footer-container",children:_.jsx(zme,{})})]})},Bme=({className:e,width:t=16,height:n=16,strokeWidth:a=2,stroke:i="currentColor"})=>_.jsxs("svg",{fill:"none",width:t,height:n,viewBox:"0 0 24 24",stroke:i,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:a,className:e,children:[_.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),_.jsx("path",{d:"M21 3v5h-5"}),_.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),_.jsx("path",{d:"M8 16H3v5"})]}),Fme=({className:e,width:t=16,height:n=16,strokeWidth:a=2,fill:i="none"})=>_.jsx("svg",{fill:i,width:t,height:n,viewBox:"0 0 24 24",stroke:"#FFC107",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:a,className:e,children:_.jsx("path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"})}),Ume=({relatedId:e})=>{const{formatMessage:t}=At(),{submitFeedback:n,showConfirmation:a}=f5(),[i,s]=V.useState(0),[c,u]=V.useState(!1),[p,f]=V.useState(!1),h=v=>{p||(s(v),u(!0))},g=async v=>{await n({type:Ag.CLINICAL_NOTE,rating:i,comment:v,related_id:e})&&(u(!1),f(!0))},b=()=>{u(!1),s(0)};return _.jsxs("div",{className:"omniscribe_audio-recorder-audio-star-container",children:[_.jsxs("span",{className:"omniscribe_audio-recorder-audio-star-icons",children:[[...Array(5)].map((v,S)=>_.jsx("span",{className:"omniscribe_audio-recorder-star-icon",onClick:()=>h(S+1),children:_.jsx(Fme,{fill:S<i?"#FFC107":"none",stroke:"#FFC107"})},S)),_.jsx("span",{className:"omniscribe_audio-recorder-audio-feedback",children:t({id:"Evaluate this clinical note"})})]}),_.jsx(pg,{isOpen:c,placeholder:t({id:"What did you like?"}),onClose:b,onSend:g,showSentConfirmation:a,position:"right"})]})},Hme=({isChat:e})=>{const{userTranscriptions:t,selectValues:n,enabled:a,connectionLoading:i,generating:s,setState:c}=qa(),{disableAllActions:u}=Pr(),{appointmentData:p,report:f,handleFill:h,setLangGraphState:g}=Br(),{formatMessage:b}=At(),[v,S]=V.useState(!1),[E,k]=V.useState(!1),[A,T]=V.useState(void 0),R=n;V.useEffect(()=>{(async()=>{if(p?.patientId&&p?.doctorId){const K=await vme(p.patientId,p.doctorId);T(K)}})()},[p?.patientId,p?.doctorId,f]);const P=()=>{S(!0),k(!1),c(U=>({...U,userTranscriptions:[],segments:[]})),g(U=>({...U,report:void 0})),p?.patientId&&p?.doctorId&&gme(p?.patientId,p?.doctorId)},B=U=>c(K=>({...K,selectedData:U}));V.useEffect(()=>{a&&S(!1)},[a]),V.useEffect(()=>{yf([],c,p?.patientId,p?.doctorId)},[]);const O=e?"omniscribe_hidden":"omniscribe_visible";return _.jsx("div",{className:O,children:_.jsxs("div",{className:"omniscribe_audio-recorder",children:[_.jsxs("div",{className:"omniscribe_audio-recorder-container",children:[_.jsx("div",{className:"omniscribe_audio-recorder-audio-container",children:_.jsx(Ome,{reset:v})}),_.jsx(rn,{variant:"icon",size:"sm",id:"startOver",title:"refrescar",className:`omniscribe_audio-recorder-refresh-btn ${t?.[0]&&!u&&!s?"omniscribe_audio-recorder-refresh-btn-enabled":"omniscribe_audio-recorder-refresh-btn-disabled"}`,disabled:u||s||a||i,onClick:P,children:_.jsx(Bme,{className:"omniscribe_audio-recorder-refresh-icon",strokeWidth:1.5})})]}),_.jsxs("div",{className:"omniscribe_audio-recorder-audio-content-container",children:[_.jsx(vf,{options:R,onChange:B}),_.jsx(Pme,{})]}),_.jsxs("div",{className:"omniscribe_audio-recorder-footer",children:[_.jsxs("div",{className:"omniscribe_audio-recorder-audio-info",children:[(!!(!s&&f&&t?.length&&!h)||!!(t?.length&&E))&&_.jsx(Ume,{relatedId:A}),(!E&&!!h||!f)&&b({id:"Medical terminology will be corrected when filling out the report."})]}),_.jsx(Lme,{onFillClick:()=>k(!0)})]})]})})},$me=({className:e,width:t=16,height:n=16,strokeColor:a="#4A5364"})=>_.jsxs("svg",{width:t,height:n,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[_.jsx("path",{d:"M8.00033 3.33335L12.667 8.00002L8.00033 12.6667",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M3.33366 8L12.667 8",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"})]}),jme=({title:e,description:t,icon:n,onClick:a,onKeyDown:i})=>_.jsxs("div",{className:"omniscribe_config-item",onClick:a,role:"button",tabIndex:0,onKeyDown:s=>i(s,a),children:[_.jsx("div",{className:"omniscribe_config-item-icon",children:n}),_.jsxs("div",{className:"omniscribe_config-item-content",children:[_.jsx("h3",{className:"omniscribe_config-item-title",children:e}),_.jsx("p",{className:"omniscribe_config-item-description",children:t})]}),_.jsx("div",{className:"omniscribe_config-item-arrow",children:_.jsx($me,{})})]}),GD=[{id:"microphone",titleId:"Microphone",descriptionId:"Select the input microphone to ensure proper functioning of SofIA Scribe",IconComponent:({className:e,width:t=16,height:n=16,stroke:a="#4A5364"})=>_.jsxs("svg",{width:t,height:n,className:e,viewBox:"0 0 16 16",fill:"none",stroke:a,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("path",{d:"M8 1.33a2 2 0 0 0-2 2v4a2 2 0 0 0 4 0v-4a2 2 0 0 0-2-2Z"}),_.jsx("path",{d:"M12.67 6.67v0.66a4.67 4.67 0 0 1-9.34 0v-0.66"}),_.jsx("path",{d:"M8 12v2.67"}),_.jsx("path",{d:"M5.33 14.67h5.34"})]}),isImplemented:!0},{id:"language",titleId:"Language options",descriptionId:"Select the interface language and the language in which the clinical note is generated in addition to the language for transcription",IconComponent:({className:e,width:t=16,height:n=17,stroke:a="#4A5364"})=>_.jsxs("svg",{width:t,height:n,className:e,viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_.jsx("path",{d:"M7.99967 15.1667C11.6816 15.1667 14.6663 12.1819 14.6663 8.50004C14.6663 4.81814 11.6816 1.83337 7.99967 1.83337C4.31778 1.83337 1.33301 4.81814 1.33301 8.50004C1.33301 12.1819 4.31778 15.1667 7.99967 15.1667Z",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M7.99967 1.83337C6.28783 3.63081 5.33301 6.01787 5.33301 8.50004C5.33301 10.9822 6.28783 13.3693 7.99967 15.1667C9.71152 13.3693 10.6663 10.9822 10.6663 8.50004C10.6663 6.01787 9.71152 3.63081 7.99967 1.83337Z",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M1.33301 8.5H14.6663",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"})]}),isImplemented:!0},{id:"template",titleId:"Clinical note template",descriptionId:"Customize the clinical note by indicating to the AI how to write and organize consultation information in each field",IconComponent:({className:e,width:t=16,height:n=17,stroke:a="#252A32"})=>_.jsxs("svg",{width:t,height:n,className:e,viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_.jsx("path",{d:"M13.3333 2.5H2.66667C2.29848 2.5 2 2.79848 2 3.16667V6.5C2 6.86819 2.29848 7.16667 2.66667 7.16667H13.3333C13.7015 7.16667 14 6.86819 14 6.5V3.16667C14 2.79848 13.7015 2.5 13.3333 2.5Z",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M6 9.83337H2.66667C2.29848 9.83337 2 10.1319 2 10.5V13.8334C2 14.2016 2.29848 14.5 2.66667 14.5H6C6.36819 14.5 6.66667 14.2016 6.66667 13.8334V10.5C6.66667 10.1319 6.36819 9.83337 6 9.83337Z",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M13.333 9.83337H9.99967C9.63148 9.83337 9.33301 10.1319 9.33301 10.5V13.8334C9.33301 14.2016 9.63148 14.5 9.99967 14.5H13.333C13.7012 14.5 13.9997 14.2016 13.9997 13.8334V10.5C13.9997 10.1319 13.7012 9.83337 13.333 9.83337Z",stroke:a,strokeLinecap:"round",strokeLinejoin:"round"})]}),isImplemented:!0},{id:"dictionary",titleId:"Clinical dictionary",descriptionId:"Customize clinical language and medication format",IconComponent:OD,isImplemented:!0}],qme={ICON_CLASS:"omniscribe_config-icon"},Gme=()=>{const{formatMessage:e}=At(),{chatApp:t}=Pr(),[n,a]=V.useState("main"),i=V.useCallback(()=>{a("main")},[]),s=V.useCallback((u,p)=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),p())},[]),c=V.useMemo(()=>(t?GD.filter(p=>p.id!=="dictionary"&&p.id!=="template"):GD).map(p=>{const f=p.IconComponent;return{id:p.id,isImplemented:p.isImplemented,title:e({id:p.titleId}),description:e({id:p.descriptionId}),icon:V.createElement(f,{className:qme.ICON_CLASS}),onClick:()=>a(p.id)}}),[e,t]);return{currentScreen:n,setCurrentScreen:a,handleBackToMain:i,handleKeyDown:s,configOptions:c}},Vme=({onChange:e})=>{const[t,n]=V.useState(null),[a,i]=V.useState([]),{permission:s,selectedDevice:c,setState:u}=qa(),{preferredMicrophone:p,language:f,updatePreferredMicrophone:h}=Oa(),{setToastState:g}=es(),{formatMessage:b}=At(),v=b({id:"You must grant microphone permissions"}),S=b({id:"Error searching for devices"}),E=b({id:"No microphone devices found"}),k=b({id:"Please enable the microphone or reset the permissions"}),[A,T]=V.useState([{value:"no-permission",label:v,icon:_.jsx(_r,{})}]),R=V.useCallback(H=>{if(H.length>0){const q=H.map(J=>({value:J.deviceId,label:J.label||`${b({id:"Microphone"})} (${J.deviceId.slice(0,5)}...)`,icon:_.jsx(_r,{})}));if(T(q),!c&&H.length>0){let J=null;p&&(J=H.find(ue=>ue.deviceId===p.deviceId)),J||(J=H[0]),u(ue=>({...ue,selectedDevice:J.deviceId,devices:H})),e&&e(J.deviceId)}else u(J=>({...J,devices:H}))}else T([{value:"no-devices",label:b({id:"No microphone devices found"}),icon:_.jsx(_r,{})}])},[c,u,e]),P=V.useCallback(async(H,q,J,ue)=>{Yhe(H,q,J,ue,S)},[R,f]);V.useEffect(()=>{const H=()=>{t&&P(i,T,_.jsx(_r,{}),R)};return navigator.mediaDevices?.addEventListener("devicechange",H),()=>{navigator.mediaDevices?.removeEventListener("devicechange",H)}},[t,P]),V.useEffect(()=>{(async()=>{try{if(navigator.permissions&&navigator.permissions.query){const q=await navigator.permissions.query({name:"microphone"});q.state==="granted"?(n(!0),await P(i,T,_.jsx(_r,{}),R)):q.state==="denied"?(n(!1),T([{value:"no-permission",label:b({id:"You must grant microphone permissions"}),icon:_.jsx(_r,{})}])):n(null),q.addEventListener("change",async()=>{q.state==="granted"?(n(!0),await P(i,T,_.jsx(_r,{}),R)):q.state==="denied"&&(n(!1),T([{value:"no-permission",label:b({id:"You must grant microphone permissions"}),icon:_.jsx(_r,{})}]))})}else n(null)}catch(q){console.error("Error checking permissions:",q),n(null)}})()},[P]),V.useEffect(()=>{p&&!c&&a.length>0&&a.some(q=>q.deviceId===p.deviceId)&&u(q=>({...q,selectedDevice:p.deviceId}))},[p,c,a,u]);const B=async H=>{if(t===null||t===!1)try{await hf(s,u,async()=>{await MD(n,T,i,_.jsx(_r,{}),g,v,E,S,k),await P(i,T,_.jsx(_r,{}),R)},g,k)}catch{bl(g,k);return}const q=a.find(J=>J.deviceId===H);if(q){u(J=>({...J,selectedDevice:H}));try{const J={deviceId:q.deviceId,label:q.label||`Microphone (${q.deviceId.slice(0,8)}...)`};await h(J)}catch(J){console.error("❌ CustomMicrophoneSelector: Error saving preferred microphone:",J)}e&&e(H)}},O=async()=>{if(t===null||t===!1)try{await hf(s,u,async()=>{await MD(n,T,i,_.jsx(_r,{}),g,v,E,S,k),await P(i,T,_.jsx(_r,{}),R)},g,k)}catch{bl(g,k)}},U=V.useMemo(()=>{const H=c||(p?p.deviceId:null);if(!H)return 0;const q=A.findIndex(J=>J.value===H);return q>=0?q:0},[c,p,A]),K=()=>_.jsx("div",{onClick:O,className:"w-full","data-testid":"custom-microphone-selector",children:_.jsx(vf,{options:A,onChange:B,selectedNumber:U,className:"w-full"})});return _.jsx(K,{})},Sf=({title:e,onBack:t})=>{const{formatMessage:n}=At();return _.jsxs("div",{className:"omniscribe_config-subscreen-header",children:[_.jsx("button",{className:"omniscribe_config-back-btn",onClick:t,"aria-label":n({id:"Back"}),children:_.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_.jsx("path",{d:"M7.99967 12.6667L3.33301 8.00002L7.99967 3.33335",stroke:"#4A5364",strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M12.6663 8L3.33301 8",stroke:"#4A5364",strokeLinecap:"round",strokeLinejoin:"round"})]})}),_.jsx("h2",{className:"omniscribe_config-subscreen-title",children:e})]})},Wme=({onBack:e})=>{const{formatMessage:t}=At();return _.jsxs("div",{className:"omniscribe_config-content",children:[_.jsx(Sf,{title:t({id:"Microphone options"}),onBack:e}),_.jsxs("div",{className:"omniscribe_config-subscreen-content",children:[_.jsx("p",{className:"omniscribe_config-subscreen-description",children:t({id:"Select the input microphone"})}),_.jsx(Vme,{})]})]})},Yme=()=>{const{updateLanguage:e,language:t}=Oa(),n=t,a=ff.map(c=>({value:c.code,label:c.name})),i=nt.useMemo(()=>ff.findIndex(c=>c.code===n),[n]),s=async c=>{const{code:u}=await s4(c);await e(u)};return _.jsx("div",{className:"w-full","data-testid":"language-selector",children:_.jsx(vf,{options:a,onChange:s,selectedNumber:i,className:"w-full"})})},Xme=()=>{const{updateTranscriptionLanguage:e,transcriptionLanguage:t}=Oa(),n=t||bi.multilingual,a=Uhe,i=nt.useMemo(()=>{const c=a.findIndex(u=>u.value===n);return c>=0?c:0},[n,a]),s=async c=>{try{await e(c)}catch(u){console.error("Error updating transcription language:",u)}};return _.jsx("div",{className:"w-full","data-testid":"transcription-language-selector",children:_.jsx(vf,{options:a,onChange:s,selectedNumber:i,className:"w-full"})})},Ef=({description:e,children:t,className:n=""})=>_.jsxs("div",{className:`omniscribe_config-language-section ${n}`.trim(),children:[e&&_.jsx("p",{className:"omniscribe_config-subscreen-description",children:e}),t]}),Kme=({onBack:e})=>{const{formatMessage:t}=At(),{chatApp:n}=Pr();return _.jsxs("div",{className:"omniscribe_config-content",children:[_.jsx(Sf,{title:t({id:"Language options"}),onBack:e}),_.jsxs("div",{className:"omniscribe_config-subscreen-content",children:[_.jsx(Ef,{description:t({id:"Select the interface language and the language in which the clinical note is generated"}),children:_.jsx(Yme,{})}),!n&&_.jsx(Ef,{description:t({id:"Select the language for audio transcription"}),children:_.jsx(Xme,{})})]})]})};function VD({className:e="omniscribe_input",type:t="text",error:n,showError:a=!0,errorClassName:i="omniscribe_input-error",isValid:s=!0,...c}){const u=`${e} ${!s&&n?"invalid":""}`.trim();return _.jsxs("div",{className:"omniscribe_input-container",children:[_.jsx("input",{type:t,"data-slot":"input",className:u,"aria-invalid":!s,"aria-describedby":n&&a?`${c.id}-error`:void 0,...c}),a&&n&&_.jsx("span",{id:`${c.id}-error`,className:i,role:"alert","aria-live":"polite",children:n})]})}const Zme=({className:e,width:t=16,height:n=16,strokeColor:a="currentColor",strokeWidth:i=2})=>_.jsx("svg",{width:t,height:n,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":"true",children:_.jsx("path",{d:"M8 1V15M1 8H15",stroke:a,strokeWidth:i,strokeLinecap:"round",strokeLinejoin:"round"})}),Qme=({misspelled:e,correct:t,duplicateError:n,onAdd:a})=>{const{formatMessage:i}=At(),s=!e.value.length||!t.value.length||!t.isValid||!e.isValid||!!n;return _.jsx("div",{className:"omniscribe_config-dictionary-add-section",children:_.jsxs("div",{className:"omniscribe_config-dictionary-input-row",children:[_.jsx(VD,{onChange:e.onChange,value:e.value,id:"misspelled",className:`omniscribe_config-dictionary-input ${!e.isValid||n?"error":""}`,type:"text",placeholder:i({id:"Word or phrase (e.g: ibuprofeno)"}),"aria-label":i({id:"Wrong Word"}),showError:!0,error:e.error||n}),_.jsx(VD,{onChange:t.onChange,value:t.value,id:"correct",className:`omniscribe_config-dictionary-input ${t.isValid?"":"error"}`,type:"text",placeholder:i({id:"Custom version"}),"aria-label":i({id:"Right Word"}),showError:!0,error:t.error}),_.jsx(rn,{id:"addButton",onClick:a,className:"omniscribe_config-dictionary-add-btn",disabled:s,children:_.jsx(Zme,{})})]})})},Jme=({className:e,width:t=24,height:n=24})=>_.jsx("svg",{width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,className:e,children:_.jsx("path",{d:"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6"})}),e0e=({word:e,index:t,onDelete:n})=>{const{formatMessage:a}=At();return _.jsxs("div",{className:"omniscribe_config-dictionary-row",children:[_.jsx("div",{className:"omniscribe_config-dictionary-cell",children:e.misspelled}),_.jsx("div",{className:"omniscribe_config-dictionary-arrow",children:"→"}),_.jsx("div",{className:"omniscribe_config-dictionary-cell",children:e.correct}),_.jsx("button",{type:"button","aria-label":a({id:"Delete"}),className:"omniscribe_config-dictionary-delete-btn",onClick:()=>n(t),children:_.jsx(Jme,{width:16,height:16})})]})},t0e=({words:e,onDelete:t})=>{const{formatMessage:n}=At();return e.length===0?_.jsx("div",{className:"omniscribe_config-dictionary-empty",children:n({id:"No custom words added yet"})}):_.jsx("div",{className:"omniscribe_config-dictionary-list",children:e.map((a,i)=>_.jsx(e0e,{word:a,index:i,onDelete:t},`${a.misspelled}-${a.correct}`))})},n0e=()=>{const e=l4("",{maxLength:100}),t=l4("",{maxLength:100}),[n,a]=V.useState(null),[i,s]=V.useState(!1),[c,u]=V.useState(null),{setState:p}=qa(),{formatMessage:f}=At(),{dictionary:h,updateDictionary:g}=Oa(),b=h;V.useEffect(()=>{c&&b.some(k=>k.misspelled===c.misspelled&&k.correct===c.correct)&&(e.clear(),t.clear(),u(null),s(!1))},[b,c,e,t]);const v=V.useCallback(k=>b.some(A=>A.misspelled.toLowerCase()===k.toLowerCase()),[b]),S=V.useCallback(async()=>{if(!i)try{s(!0);const k=e.validate(),A=t.validate();if(a(null),!e.value||!t.value||!k.isValid||!A.isValid){s(!1);return}if(v(e.value)){a(f({id:"The word already exists in the dictionary"},{word:e.value})),s(!1);return}if(t.value.length&&e.value.length){const T={misspelled:e.value,correct:t.value},R=[...b,T];u(T),await g(R),p(P=>({...P,userTranscriptions:P.userTranscriptions.map(B=>hu(B,R)),segments:P.segments.map(B=>hu(B,R))})),bme(R)}else s(!1)}catch{a(f({id:"An error occurred while adding the word"})),s(!1),u(null)}},[e,t,v,f,p,b,g,i]),E=V.useCallback(async k=>{const A=b.filter((T,R)=>k!==R);await g(A),a(null)},[b,g]);return V.useEffect(()=>{n&&e.value&&(v(e.value)||a(null))},[e.value,n,v]),{misspelled:e,correct:t,changedWords:b,duplicateError:n,handleAdd:S,handleDelete:E,checkForDuplicate:v}},r0e=({onBack:e})=>{const{formatMessage:t}=At(),{misspelled:n,correct:a,changedWords:i,duplicateError:s,handleAdd:c,handleDelete:u}=n0e();return _.jsxs("div",{className:"omniscribe_config-content",children:[_.jsx(Sf,{title:t({id:"Clinical dictionary"}),onBack:e}),_.jsx("div",{className:"omniscribe_config-subscreen-content no-border",children:_.jsxs(Ef,{children:[_.jsx(Qme,{misspelled:n,correct:a,duplicateError:s,onAdd:c}),_.jsx(t0e,{words:i,onDelete:u})]})})]})},a0e=({className:e,width:t=12,height:n=12,strokeColor:a="currentColor",strokeWidth:i=1})=>_.jsx("svg",{width:t,height:n,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":"true",children:_.jsx("path",{d:"M4.5 9L7.5 6L4.5 3",stroke:a,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:i})}),WD={expanded:!1,content:""},o0e=e=>{const{toolArgs:t}=Br(),{templateCustomizations:n,customTemplate:a,updateSettings:i,refreshSettings:s,getMixedToolArgs:c}=Oa(),{formatMessage:u}=At(),[p,f]=V.useState(!1),h=V.useMemo(()=>{if(a?.template){let O;const U=a.template;if(typeof U=="object"&&U.template)O=U.template;else if(typeof U=="string")O=U;else return null;return RD(O)}return null},[a]),g=V.useMemo(()=>c(),[h,c]),b=V.useMemo(()=>{const O=g,U=O?.title||O?.name;return U?U.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().replace(/^./,H=>H.toUpperCase()):u({id:"Clinical note template"})},[g,u]),v=V.useCallback(O=>O.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().replace(/^./,U=>U.toUpperCase()),[]),S=V.useCallback(O=>{const U=v(O).toLowerCase();return u({id:"Customize how to generate section"},{sectionName:U})},[v,u]),E=V.useMemo(()=>{const U=t?.properties;if(!U)return[];const K=[];return Object.keys(U).forEach(H=>{const q=U[H];q&&typeof q=="object"&&q.description&&K.push({id:H,label:v(H),placeholder:S(H),description:q.description||"",expanded:!1})}),K},[v,S]),[k,A]=V.useState({});V.useEffect(()=>{A(O=>{const U={},K=[...E].sort((q,J)=>q.id.localeCompare(J.id));let H=!1;return K.forEach(q=>{const J=O[q.id],ue=n[q.id]||"";let fe="";h?fe=h.properties?.[q.id]?.description||"":fe=ue,J?fe&&J.content!==fe?(U[q.id]={...J,content:fe},H=!0):U[q.id]=J:(U[q.id]={expanded:q.expanded,content:fe},H=!0)}),Object.keys(O).length!==K.length&&(H=!0),H?U:O})},[E,n,h]);const T=V.useCallback(O=>{A(U=>({...U,[O]:{...U[O]||WD,expanded:!U[O]?.expanded}}))},[]),R=V.useCallback((O,U)=>{A(K=>({...K,[O]:{...K[O]||WD,content:U}}))},[]),P=V.useCallback(async()=>{if(!p)try{f(!0);const U=JSON.parse(JSON.stringify(t));U.properties&&Object.keys(U.properties).forEach(J=>{const ue=k[J];ue?U.properties[J].description=ue.content.trim():U.properties[J].description=""});const K=JSON.stringify(U);let H=a?.hash;!H&&a?.template&&typeof a.template=="object"&&(H=a.template?.hash),H||(H=await TD(t));const q={template:K};H&&(q.templateHash=H),await i(q),e(),await s()}catch(O){console.error("Error saving template:",O)}finally{f(!1)}},[k,t,a,i,s,e,p]),B=V.useCallback(()=>{e()},[e]);return{templateTitle:b,templateFields:E,fieldStates:k,toggleField:T,updateFieldContent:R,handleSave:P,handleCancel:B,isSaving:p}},i0e=({onBack:e})=>{const{formatMessage:t}=At(),{templateTitle:n,templateFields:a,fieldStates:i,toggleField:s,updateFieldContent:c,handleSave:u,handleCancel:p,isSaving:f}=o0e(e);return _.jsxs("div",{className:"omniscribe_config-content",children:[_.jsx(Sf,{title:n,onBack:e}),_.jsx("div",{className:"omniscribe_config-subscreen-content omniscribe_config-subscreen-content-template",children:_.jsx(Ef,{description:t({id:"Clinical note sections"}),children:_.jsx("div",{className:"omniscribe_template-fields",children:a.map(h=>{const g=i[h.id];return g?_.jsxs("div",{className:"omniscribe_template-field",children:[_.jsxs("div",{className:"omniscribe_template-field-header",onClick:()=>s(h.id),children:[_.jsx("span",{className:`omniscribe_template-field-icon ${g.expanded?"expanded":""}`,children:_.jsx(a0e,{})}),_.jsx("span",{className:"omniscribe_template-field-label",children:h.label})]}),g.expanded&&_.jsxs("div",{className:"omniscribe_template-field-content",children:[_.jsx("textarea",{className:"omniscribe_template-textarea",placeholder:h.placeholder,value:g.content,onChange:b=>c(h.id,b.target.value),rows:4,maxLength:800}),_.jsx("div",{className:"omniscribe_template-character-count",children:t({id:"{count} characters"},{count:`${g.content.length}/800`})})]})]},h.id):null})})})}),_.jsxs("div",{className:"omniscribe_template-actions",children:[_.jsx(rn,{variant:"secondary",onClick:p,disabled:f,children:t({id:"Cancel"})}),_.jsx(rn,{variant:"primary",onClick:u,disabled:f,children:t(f?{id:"Saving"}:{id:"Save changes"})})]})]})},s0e=e=>{const t=V.useMemo(()=>({microphone:()=>_.jsx(Wme,{onBack:e}),language:()=>_.jsx(Kme,{onBack:e}),template:()=>_.jsx(i0e,{onBack:e}),dictionary:()=>_.jsx(r0e,{onBack:e})}),[e]);return{renderScreen:V.useCallback(a=>{if(a==="main")return null;const i=t[a];return i?i():null},[t])}},l0e=()=>{const{currentScreen:e,handleBackToMain:t,handleKeyDown:n,configOptions:a}=Gme(),{renderScreen:i}=s0e(t),s=i(e);return s||_.jsx("div",{className:"omniscribe_config-content",children:_.jsx("div",{className:"omniscribe_config-list",children:a.map(c=>_.jsx(jme,{title:c.title,description:c.description,icon:c.icon,onClick:c.onClick,onKeyDown:n},c.id))})})},c0e=({width:e,height:t,title:n})=>{const{chatApp:a}=Pr(),i=es(),[s,c]=V.useState(a),[u,p]=V.useState(!1),f=a||s,h=()=>u?_.jsx(l0e,{}):_.jsxs(_.Fragment,{children:[_.jsx(Hme,{isChat:f}),_.jsx("div",{className:f?"omniscribe_visible":"omniscribe_hidden",children:_.jsx(ome,{})})]});return _.jsx($V,{width:e,height:t,children:_.jsxs(jV,{isChat:u?!1:s,isConfig:u,children:[_.jsx(HV,{title:n}),_.jsx(SY,{isChat:s,setIsChat:c,showConfig:u,setShowConfig:p}),h(),i?.visible&&_.jsx(ime,{})]})})},u0e=({toast:e,children:t})=>{const[{duration:n,visible:a,title:i,message:s,variation:c},u]=V.useState({title:"",message:"",visible:!1,variation:tl.default,duration:3e3});return V.useEffect(()=>{if(e){const p=typeof e=="string"?JSON.parse(e):e;u({title:p.title,message:p.message,visible:p.visible,variation:p.variation,duration:p.duration??3e3})}},[e]),_.jsx(p5.Provider,{value:{visible:a,title:i,message:s,variation:c,duration:n,setToastState:u},children:t})},d0e=({transcriptorSelectValues:e,screenLoader:t,children:n})=>{const[{segments:a,userTranscriptions:i,roomState:s,modalTextAreaInstructions:c,selectValues:u,selectedData:p,devices:f,selectedDevice:h,permission:g,transcriptorLoader:b,enabled:v,connectionLoading:S,generating:E,chatMicrophoneActive:k},A]=V.useState({userTranscriptions:[],segments:[],roomState:fu.Disconnected,modalTextAreaInstructions:"",selectValues:e??[{value:"transcipcion",label:"Transcription"}],selectedData:"transcripcion",devices:[],selectedDevice:null,permission:"prompt",transcriptorLoader:t??!1,enabled:!1,connectionLoading:!1,generating:!1,chatMicrophoneActive:!1});return V.useEffect(()=>{console.log(s)},[s]),V.useEffect(()=>{e&&A(T=>({...T,selectValues:e}))},[e]),V.useEffect(()=>{t!==void 0&&A(T=>({...T,transcriptorLoader:t}))},[t]),_.jsx($3.Provider,{value:{userTranscriptions:i,segments:a,roomState:s,modalTextAreaInstructions:c,selectValues:u,selectedData:p,devices:f,selectedDevice:h,permission:g,transcriptorLoader:b,setState:A,enabled:v,connectionLoading:S,generating:E,chatMicrophoneActive:k},children:n})},p0e=e=>{if(e==null)return null;if(typeof e=="string")try{const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:null}catch(t){return console.error("Failed to parse JSON string:",t),null}return typeof e=="object"&&e!==null?e:null},d4=e=>p0e(e)||{},f0e=({children:e,propsUserId:t,propsPatientId:n,propsPatientData:a,propsSources:i,propsHandleReport:s,propsRenderReportContent:c,propsHandleFill:u})=>{const{getMixedToolArgs:p}=Oa(),f=s,h=u,g=c;V.useEffect(()=>{n&&O(U=>({...U,appointmentData:{patientData:a??void 0,patientId:n??void 0,doctorId:t??void 0},toolArgs:d4(p()),handleReport:s??void 0,handleFill:u??void 0}))},[n,a,t,p,s,u]);const[{threadId:b,report:v,chatThreadId:S,chatHistoryOpen:E,chatStarted:k,runId:A,chatAssistantId:T,appointmentData:R,toolArgs:P,sources:B},O]=V.useState({threadId:void 0,runId:void 0,report:void 0,chatThreadId:null,chatHistoryOpen:!1,chatStarted:!1,chatAssistantId:void 0,sources:[],appointmentData:{patientData:a??void 0,patientId:n??void 0,doctorId:t??void 0},toolArgs:d4(p())});return V.useEffect(()=>{n&&O(U=>({...U,appointmentData:{patientData:a??void 0,patientId:n??void 0,doctorId:t??void 0},handleReport:s??void 0,handleFill:u??void 0}))},[n,a,t,s,u]),V.useEffect(()=>{O(U=>({...U,toolArgs:d4(p())}))},[p]),V.useEffect(()=>{if(i){const U=typeof i=="string"?JSON.parse(i):i,K=new Set(U),H=Dhe.filter(q=>K.has(q.title));O(q=>({...q,sources:H}))}},[i]),_.jsx(j3.Provider,{value:{threadId:b,report:v,chatThreadId:S,chatHistoryOpen:E,chatStarted:k,runId:A,chatAssistantId:T,appointmentData:R,toolArgs:P,sources:B,handleReport:f,handleFill:h,renderReportContent:g,setLangGraphState:O},children:e})};function h0e({children:e}){const{langGraphBaseUrl:t,apiKey:n}=Pr(),a=t,[i,s]=V.useState([]),[c,u]=V.useState(!1),{appointmentData:p}=Br(),h={getThreads:V.useCallback(async()=>{if(!a)return[];const g=Ime(a,n,p?.doctorId,p?.patientId);return jD.searchThreads(g)},[n,a,p?.doctorId,p?.patientId]),threads:i,setThreads:s,threadsLoading:c,setThreadsLoading:u};return _.jsx(xD.Provider,{value:h,children:e})}function m0e(e){return v2(e)}const g0e=({children:e,apiUrl:t,assistantId:n})=>{const{chatThreadId:a,appointmentData:i,setLangGraphState:s}=Br(),c=gf(),{apiKey:u}=Pr(),{getThreads:p,setThreads:f}=kD(),h={Authorization:`Bearer ${u}`,IS_CHAT:"true",doctor:i?.doctorId,patient:i?.patientId},g=m0e({apiUrl:t,assistantId:n,defaultHeaders:h,threadId:a??null,onCustomEvent:(b,v)=>{v.mutate(S=>{const E=wK(S.ui??[],b);return{...S,ui:E}})},onThreadId:b=>{s(v=>({...v,chatThreadId:b})),du(9e3).then(()=>p().then(f).catch(console.error))},onMetadataEvent:b=>{b?.run_id&&s(v=>({...v,runId:b.run_id}))}});return V.useEffect(()=>{c.checkGraphStatus().then(b=>{b||console.log("Error",`Please ensure your graph is running at ${t} and
645
- your API key is correctly set (if connecting to a deployed graph).`)})},[t]),_.jsx(m5.Provider,{value:g,children:e})},b0e=({children:e})=>{const{langGraphBaseUrl:t,baseUrl:n}=Pr(),a=t,{setLangGraphState:i,chatAssistantId:s,appointmentData:c}=Br(),[u,p]=V.useState(void 0),f=gf();if(V.useEffect(()=>{n!==""&&!s&&f.getChatAssistant().then(h=>{h&&h.chatAssistant&&(i(g=>({...g,chatAssistantId:h.chatAssistant})),p(h.chatAssistant)),(!h||!h.chatAssistant)&&console.log("Error","Error getting chat assistant")})},[a,n,c?.patientId]),u)return _.jsx(g0e,{apiUrl:a,assistantId:u,children:e})},y0e=({children:e,clientBaseUrl:t,clientWssUrl:n,clientApiKey:a,isOpen:i,setIsOpen:s,disableActions:c,onlyChat:u,disableGen:p})=>{const[{baseUrl:f,langGraphBaseUrl:h,apiKey:g,disableAllActions:b,wssUrl:v,chatApp:S,disableGenerate:E},k]=V.useState({baseUrl:t,wssUrl:n,langGraphBaseUrl:t+"/lang-graph/",apiKey:a,disableAllActions:c??!1,chatApp:u??!1,disableGenerate:p??!1}),[A,T]=V.useState(!0),R=s??T,P=i??A,B=async()=>{k({baseUrl:t,wssUrl:n,langGraphBaseUrl:t+"/lang-graph/",apiKey:a,disableAllActions:c??!1,chatApp:u??!1,disableGenerate:p??!1})};return V.useEffect(()=>{t&&a&&B()},[a,t,n]),V.useEffect(()=>{c!==void 0&&k(O=>({...O,disableAllActions:c}))},[c]),V.useEffect(()=>{p!==void 0&&k(O=>({...O,disableGenerate:p}))},[p]),V.useEffect(()=>{u!==void 0&&k(O=>({...O,chatApp:u}))},[u]),_.jsx(ZT.Provider,{value:{baseUrl:f,wssUrl:v,langGraphBaseUrl:h,apiKey:g,isOmniOpen:P,disableAllActions:b,chatApp:S,disableGenerate:E,setConfig:k,setIsOmniOpen:R},children:e})},v0e=({children:e})=>{const{language:t}=Oa(),[n,a]=V.useState(),[i,s]=V.useState(gl.es),c=async()=>{const u=t,{translations:p,code:f}=await s4(u);a(p),s(f)};if(V.useEffect(()=>{c()},[t]),i)return _.jsx(vY,{messages:n,locale:i,defaultLocale:Do.defaultLanguageCode,onError:u=>{u.code},children:e})},S0e=e=>{if(!e||e.length===0)return 0;const t=e.map(a=>parseFloat(a.end)).filter(a=>!isNaN(a)&&isFinite(a));if(t.length===0)return 0;const n=Math.max(...t);return Math.ceil(n)},E0e=async(e,t)=>{try{const n=await ro(Hn.dayData)??[],a=n.findIndex(s=>s.patientId===e&&s.doctorId===t);if(a===-1)return;const i=n[a];if(i?.transcript&&i.transcript.length>0&&!i.transcriptionId){console.log("Found orphaned transcript, creating transcription in database...");const s=JSON.stringify(i.transcript),c=i.recordingSeconds??S0e(i.transcript),u=await u4.createTranscription({duration_seconds:c,original_transcript:s});if(!u?.transcription?.id){console.error("Invalid transcription response: missing transcription.id",u);return}const p=await ro(Hn.dayData)??[],f=p.findIndex(h=>h.patientId===e&&h.doctorId===t);f!==-1&&(p[f]={...p[f],transcriptionId:u.transcription.id,clinicalNoteId:u.clinical_note_id||p[f].clinicalNoteId},await yl(Hn.dayData,p,p[f]?.date||i.date||new Date().toLocaleDateString()))}}catch(n){console.error("Failed to check/create orphaned transcripts:",n)}},w0e=({baseurl:e,wssurl:t,apikey:n,userid:a,patientid:i,toolsargs:s,isopen:c,setIsOpen:u,patientdata:p,transcriptorselectvalues:f,handleReport:h,renderReportContent:g,handleFill:b,handleAngular:v="handle-report",toast:S,width:E,height:k,title:A,language:T,isscreenloading:R,disableactions:P,onlychat:B,disablegenerate:O,chatsources:U,setGetLastReport:K})=>{const H=h??v,q=typeof f=="string"?JSON.parse(f):f,J=typeof p=="string"?JSON.parse(p):p,[ue,fe]=V.useState(i),[ie,se]=V.useState(a),[D,L]=V.useState(0);return V.useEffect(()=>{K&&K(async()=>await qD(i,a))},[K,i,a]),V.useEffect(()=>{i!==ue&&(console.log("Patient ID changed from",ue,"to",i),fe(i),L(F=>F+1))},[i,ue]),V.useEffect(()=>{a!==ie&&(console.log("User ID changed from",ie,"to",a),se(a),L(F=>F+1))},[a,ie]),V.useEffect(()=>{aQ(n,e,a,i)},[n,e,a,i]),V.useEffect(()=>{i&&a&&E0e(i,a)},[i,a]),_.jsx(y0e,{clientApiKey:n,clientBaseUrl:e,clientWssUrl:t,isOpen:c,disableActions:P,disableGen:O,setIsOpen:u,language:T,onlyChat:B,children:_.jsx(Whe,{predefinedLanguage:void 0,toolArgs:s,children:_.jsx(v0e,{children:_.jsx(d0e,{screenLoader:R,transcriptorSelectValues:q,children:_.jsx(f0e,{propsUserId:a,propsPatientId:i,propsPatientData:J,propsHandleReport:H??void 0,propsHandleFill:b,propsRenderReportContent:g??void 0,propsSources:U,children:_.jsx(h0e,{children:_.jsx(b0e,{children:_.jsx(u0e,{toast:S,children:_.jsx(c0e,{width:E??"650px",height:k??"665px",title:A})})})})})})})})},D)};let p4=null;async function x0e(){return p4||(p4=(await Promise.resolve().then(()=>Nve)).default),p4}const f4={handleReport:{reactProp:"handleReport",type:"function"},handlereport:{reactProp:"handleReport",type:"function"},"handle-report":{reactProp:"handleReport",type:"function"},setIsOpen:{reactProp:"setIsOpen",type:"function"},setisopen:{reactProp:"setIsOpen",type:"function"},"set-is-open":{reactProp:"setIsOpen",type:"function"},renderReportContent:{reactProp:"renderReportContent",type:"function"},renderreportcontent:{reactProp:"renderReportContent",type:"function"},"render-report-content":{reactProp:"renderReportContent",type:"function"},setGetLastReport:{reactProp:"setGetLastReport",type:"function"},setgetlastreport:{reactProp:"setGetLastReport",type:"function"},"set-get-last-report":{reactProp:"setGetLastReport",type:"function"},toast:{reactProp:"toast",type:"json"},patientId:{reactProp:"patientId",type:"string"},patientid:{reactProp:"patientId",type:"string"},"patient-id":{reactProp:"patientId",type:"string"},apiKey:{reactProp:"apiKey",type:"string"},apikey:{reactProp:"apiKey",type:"string"},"api-key":{reactProp:"apiKey",type:"string"},baseUrl:{reactProp:"baseUrl",type:"string"},baseurl:{reactProp:"baseUrl",type:"string"},"base-url":{reactProp:"baseUrl",type:"string"},wssUrl:{reactProp:"wssUrl",type:"string"},wssurl:{reactProp:"wssUrl",type:"string"},"wss-url":{reactProp:"wssUrl",type:"string"},userId:{reactProp:"userId",type:"string"},userid:{reactProp:"userId",type:"string"},"user-id":{reactProp:"userId",type:"string"},language:{reactProp:"language",type:"string"},isOpen:{reactProp:"isOpen",type:"boolean"},isopen:{reactProp:"isOpen",type:"boolean"},"is-open":{reactProp:"isOpen",type:"boolean"},isScreenLoading:{reactProp:"isScreenLoading",type:"boolean"},isscreenloading:{reactProp:"isScreenLoading",type:"boolean"},"is-screen-loading":{reactProp:"isScreenLoading",type:"boolean"},disableActions:{reactProp:"disableActions",type:"boolean"},disableactions:{reactProp:"disableActions",type:"boolean"},"disable-actions":{reactProp:"disableActions",type:"boolean"},onlyChat:{reactProp:"onlyChat",type:"boolean"},onlychat:{reactProp:"onlyChat",type:"boolean"},"only-chat":{reactProp:"onlyChat",type:"boolean"},disableGenerate:{reactProp:"disableGenerate",type:"boolean"},disablegenerate:{reactProp:"disableGenerate",type:"boolean"},"disable-generate":{reactProp:"disableGenerate",type:"boolean"},patientData:{reactProp:"patientData",type:"json"},patientdata:{reactProp:"patientData",type:"json"},"patient-data":{reactProp:"patientData",type:"json"},toolsArgs:{reactProp:"toolsArgs",type:"json"},toolsargs:{reactProp:"toolsArgs",type:"json"},"tools-args":{reactProp:"toolsArgs",type:"json"},chatSources:{reactProp:"chatSources",type:"json"},chatsources:{reactProp:"chatSources",type:"json"},transcriptorSelectValues:{reactProp:"transcriptorSelectValues",type:"json"},transcriptorselectvalues:{reactProp:"transcriptorSelectValues",type:"json"},"transcriptor-select-values":{reactProp:"transcriptorSelectValues",type:"json"},width:{reactProp:"width",type:"string"},height:{reactProp:"height",type:"string"},title:{reactProp:"height",type:"string"}},YD={};Object.entries(f4).forEach(([e,t])=>{YD[e]=t.type});const XD={};Object.entries(f4).forEach(([e,t])=>{XD[e]=t.reactProp});const gu=zV(w0e,{props:YD,shadow:"open"});async function KD(e){if(!e||e.querySelector("style[data-omniscribe-styles]"))return;const t=await x0e(),n=document.createElement("style");n.setAttribute("data-omniscribe-styles",""),n.textContent=t,e.prepend(n)}const ZD=gu.prototype.connectedCallback;gu.prototype.connectedCallback=function(){ZD&&ZD.call(this),this.shadowRoot&&KD(this.shadowRoot),this.processKebabCaseAttributes()},gu.prototype.processKebabCaseAttributes=function(){Object.entries(XD).forEach(([e,t])=>{if(this.hasAttribute(e)){const n=this.getAttribute(e);if(f4[e].type==="function"&&(n===""||n==="()"||n&&n.startsWith("("))){const i=n?n.replace(/[()]/g,"").trim():"";i&&window[i]&&typeof window[i]=="function"&&(this[t]=window[i])}}})};function k0e(){window.omniscribeHandleReport=function(e){const t=document.querySelectorAll("omniscribe-component"),n=new CustomEvent("handle-report",{detail:e,bubbles:!0,composed:!0});t.forEach(a=>{a.dispatchEvent(n)}),console.log("Global omniscribeHandleReport called:",e)},window.omniscribeSetIsOpen=function(e){const t=document.querySelectorAll("omniscribe-component"),n=new CustomEvent("set-is-open",{detail:e,bubbles:!0,composed:!0});t.forEach(a=>{a.dispatchEvent(n)}),console.log("Global omniscribeSetIsOpen called:",e)},window.omniscribeSetGetLastReport=async function(){const e=document.querySelectorAll("omniscribe-component"),t=[];return e.forEach(n=>{const a=new CustomEvent("set-get-last-report",{detail:null,bubbles:!0,composed:!0});n.dispatchEvent(a)}),console.log("Global omniscribeSetGetLastReport called"),t}}typeof window<"u"&&typeof customElements<"u"&&(customElements.get("omniscribe-component")||(customElements.define("omniscribe-component",gu),console.log("Registered omniscribe-component")),k0e(),window.omniscribe=window.omniscribe||{},window.omniscribe.injectStyles=KD);var QD=ble();const _0e=X({__proto__:null,default:Y(QD)},[QD]);var JD=yle();const T0e=X({__proto__:null,default:Y(JD)},[JD]);var eL=vle();const A0e=X({__proto__:null,default:Y(eL)},[eL]);var tL=Sle();const R0e=X({__proto__:null,default:Y(tL)},[tL]);var nL=Ele();const C0e=X({__proto__:null,default:Y(nL)},[nL]);var rL=wle();const N0e=X({__proto__:null,default:Y(rL)},[rL]);var aL=xle();const O0e=X({__proto__:null,default:Y(aL)},[aL]);var oL=kle();const I0e=X({__proto__:null,default:Y(oL)},[oL]);var iL=_le();const M0e=X({__proto__:null,default:Y(iL)},[iL]);var sL=Tle();const D0e=X({__proto__:null,default:Y(sL)},[sL]);var lL=Ale();const L0e=X({__proto__:null,default:Y(lL)},[lL]);var cL=Rle();const z0e=X({__proto__:null,default:Y(cL)},[cL]);var uL=Cle();const P0e=X({__proto__:null,default:Y(uL)},[uL]);var dL=Nle();const B0e=X({__proto__:null,default:Y(dL)},[dL]);var pL=Ole();const F0e=X({__proto__:null,default:Y(pL)},[pL]);var fL=Ile();const U0e=X({__proto__:null,default:Y(fL)},[fL]);var hL=Mle();const H0e=X({__proto__:null,default:Y(hL)},[hL]);var mL=Dle();const $0e=X({__proto__:null,default:Y(mL)},[mL]);var gL=Lle();const j0e=X({__proto__:null,default:Y(gL)},[gL]);var bL=zle();const q0e=X({__proto__:null,default:Y(bL)},[bL]);var yL=Ple();const G0e=X({__proto__:null,default:Y(yL)},[yL]);var vL=Ble();const V0e=X({__proto__:null,default:Y(vL)},[vL]);var SL=U8();const W0e=X({__proto__:null,default:Y(SL)},[SL]);var EL=$8();const Y0e=X({__proto__:null,default:Y(EL)},[EL]);var wL=Fle();const X0e=X({__proto__:null,default:Y(wL)},[wL]);var xL=Ule();const K0e=X({__proto__:null,default:Y(xL)},[xL]);var kL=Hle();const Z0e=X({__proto__:null,default:Y(kL)},[kL]);var _L=$le();const Q0e=X({__proto__:null,default:Y(_L)},[_L]);var TL=jle();const J0e=X({__proto__:null,default:Y(TL)},[TL]);var AL=qle();const ege=X({__proto__:null,default:Y(AL)},[AL]);var RL=Gle();const tge=X({__proto__:null,default:Y(RL)},[RL]);var CL=Vle();const nge=X({__proto__:null,default:Y(CL)},[CL]);var NL=Wle();const rge=X({__proto__:null,default:Y(NL)},[NL]);var OL=Yle();const age=X({__proto__:null,default:Y(OL)},[OL]);var IL=ls();const oge=X({__proto__:null,default:Y(IL)},[IL]);var ML=Xle();const ige=X({__proto__:null,default:Y(ML)},[ML]);var DL=Kle();const sge=X({__proto__:null,default:Y(DL)},[DL]);var LL=Zle();const lge=X({__proto__:null,default:Y(LL)},[LL]);var zL=l8();const cge=X({__proto__:null,default:Y(zL)},[zL]);var PL=Qle();const uge=X({__proto__:null,default:Y(PL)},[PL]);var BL=Jle();const dge=X({__proto__:null,default:Y(BL)},[BL]);var FL=ece();const pge=X({__proto__:null,default:Y(FL)},[FL]);var UL=tce();const fge=X({__proto__:null,default:Y(UL)},[UL]);var HL=nce();const hge=X({__proto__:null,default:Y(HL)},[HL]);var $L=rce();const mge=X({__proto__:null,default:Y($L)},[$L]);var jL=gy();const gge=X({__proto__:null,default:Y(jL)},[jL]);var qL=ace();const bge=X({__proto__:null,default:Y(qL)},[qL]);var GL=of();const yge=X({__proto__:null,default:Y(GL)},[GL]);var VL=oce();const vge=X({__proto__:null,default:Y(VL)},[VL]);var WL=ice();const Sge=X({__proto__:null,default:Y(WL)},[WL]);var YL=sce();const Ege=X({__proto__:null,default:Y(YL)},[YL]);var XL=i8();const wge=X({__proto__:null,default:Y(XL)},[XL]);var KL=lce();const xge=X({__proto__:null,default:Y(KL)},[KL]);var ZL=cce();const kge=X({__proto__:null,default:Y(ZL)},[ZL]);var QL=uce();const _ge=X({__proto__:null,default:Y(QL)},[QL]);var JL=dce();const Tge=X({__proto__:null,default:Y(JL)},[JL]);var ez=pce();const Age=X({__proto__:null,default:Y(ez)},[ez]);var tz=fce();const Rge=X({__proto__:null,default:Y(tz)},[tz]);var nz=hce();const Cge=X({__proto__:null,default:Y(nz)},[nz]);var rz=mce();const Nge=X({__proto__:null,default:Y(rz)},[rz]);var az=gce();const Oge=X({__proto__:null,default:Y(az)},[az]);var oz=bce();const Ige=X({__proto__:null,default:Y(oz)},[oz]);var iz=yce();const Mge=X({__proto__:null,default:Y(iz)},[iz]);var sz=vce();const Dge=X({__proto__:null,default:Y(sz)},[sz]);var lz=Sce();const Lge=X({__proto__:null,default:Y(lz)},[lz]);var cz=Ece();const zge=X({__proto__:null,default:Y(cz)},[cz]);var uz=wce();const Pge=X({__proto__:null,default:Y(uz)},[uz]);var dz=xce();const Bge=X({__proto__:null,default:Y(dz)},[dz]);var pz=kce();const Fge=X({__proto__:null,default:Y(pz)},[pz]);var fz=_ce();const Uge=X({__proto__:null,default:Y(fz)},[fz]);var hz=Tce();const Hge=X({__proto__:null,default:Y(hz)},[hz]);var mz=Ace();const $ge=X({__proto__:null,default:Y(mz)},[mz]);var gz=Rce();const jge=X({__proto__:null,default:Y(gz)},[gz]);var bz=Cce();const qge=X({__proto__:null,default:Y(bz)},[bz]);var yz=Nce();const Gge=X({__proto__:null,default:Y(yz)},[yz]);var vz=Oce();const Vge=X({__proto__:null,default:Y(vz)},[vz]);var Sz=Ice();const Wge=X({__proto__:null,default:Y(Sz)},[Sz]);var Ez=Mce();const Yge=X({__proto__:null,default:Y(Ez)},[Ez]);var wz=Dce();const Xge=X({__proto__:null,default:Y(wz)},[wz]);var xz=Lce();const Kge=X({__proto__:null,default:Y(xz)},[xz]);var kz=zce();const Zge=X({__proto__:null,default:Y(kz)},[kz]);var _z=Pce();const Qge=X({__proto__:null,default:Y(_z)},[_z]);var Tz=Bce();const Jge=X({__proto__:null,default:Y(Tz)},[Tz]);var Az=Fce();const ebe=X({__proto__:null,default:Y(Az)},[Az]);var Rz=Uce();const tbe=X({__proto__:null,default:Y(Rz)},[Rz]);var Cz=Hce();const nbe=X({__proto__:null,default:Y(Cz)},[Cz]);var Nz=$ce();const rbe=X({__proto__:null,default:Y(Nz)},[Nz]);var Oz=jce();const abe=X({__proto__:null,default:Y(Oz)},[Oz]);var Iz=qce();const obe=X({__proto__:null,default:Y(Iz)},[Iz]);var Mz=Gce();const ibe=X({__proto__:null,default:Y(Mz)},[Mz]);var Dz=Vce();const sbe=X({__proto__:null,default:Y(Dz)},[Dz]);var Lz=Wce();const lbe=X({__proto__:null,default:Y(Lz)},[Lz]);var zz=Yce();const cbe=X({__proto__:null,default:Y(zz)},[zz]);var Pz=Xce();const ube=X({__proto__:null,default:Y(Pz)},[Pz]);var Bz=Kce();const dbe=X({__proto__:null,default:Y(Bz)},[Bz]);var Fz=Zce();const pbe=X({__proto__:null,default:Y(Fz)},[Fz]);var Uz=Wv();const fbe=X({__proto__:null,default:Y(Uz)},[Uz]);var Hz=Qce();const hbe=X({__proto__:null,default:Y(Hz)},[Hz]);var $z=Jce();const mbe=X({__proto__:null,default:Y($z)},[$z]);var jz=eue();const gbe=X({__proto__:null,default:Y(jz)},[jz]);var qz=tue();const bbe=X({__proto__:null,default:Y(qz)},[qz]);var Gz=nue();const ybe=X({__proto__:null,default:Y(Gz)},[Gz]);var Vz=rue();const vbe=X({__proto__:null,default:Y(Vz)},[Vz]);var Wz=aue();const Sbe=X({__proto__:null,default:Y(Wz)},[Wz]);var Yz=oue();const Ebe=X({__proto__:null,default:Y(Yz)},[Yz]);var Xz=iue();const wbe=X({__proto__:null,default:Y(Xz)},[Xz]);var Kz=sue();const xbe=X({__proto__:null,default:Y(Kz)},[Kz]);var Zz=lue();const kbe=X({__proto__:null,default:Y(Zz)},[Zz]);var Qz=cue();const _be=X({__proto__:null,default:Y(Qz)},[Qz]);var Jz=uue();const Tbe=X({__proto__:null,default:Y(Jz)},[Jz]);var eP=due();const Abe=X({__proto__:null,default:Y(eP)},[eP]);var tP=pue();const Rbe=X({__proto__:null,default:Y(tP)},[tP]);var nP=fue();const Cbe=X({__proto__:null,default:Y(nP)},[nP]);var rP=hue();const Nbe=X({__proto__:null,default:Y(rP)},[rP]);var aP=pS();const Obe=X({__proto__:null,default:Y(aP)},[aP]);var oP=mue();const Ibe=X({__proto__:null,default:Y(oP)},[oP]);var iP=lf();const Mbe=X({__proto__:null,default:Y(iP)},[iP]);var sP=u8();const Dbe=X({__proto__:null,default:Y(sP)},[sP]);var lP=gue();const Lbe=X({__proto__:null,default:Y(lP)},[lP]);var cP=bue();const zbe=X({__proto__:null,default:Y(cP)},[cP]);var uP=yue();const Pbe=X({__proto__:null,default:Y(uP)},[uP]);var dP=vue();const Bbe=X({__proto__:null,default:Y(dP)},[dP]);var pP=Sue();const Fbe=X({__proto__:null,default:Y(pP)},[pP]);var fP=Eue();const Ube=X({__proto__:null,default:Y(fP)},[fP]);var hP=wue();const Hbe=X({__proto__:null,default:Y(hP)},[hP]);var mP=_S();const $be=X({__proto__:null,default:Y(mP)},[mP]);var gP=xue();const jbe=X({__proto__:null,default:Y(gP)},[gP]);var bP=kue();const qbe=X({__proto__:null,default:Y(bP)},[bP]);var yP=_ue();const Gbe=X({__proto__:null,default:Y(yP)},[yP]);var vP=UO();const Vbe=X({__proto__:null,default:Y(vP)},[vP]);var SP=Tue();const Wbe=X({__proto__:null,default:Y(SP)},[SP]);var EP=Aue();const Ybe=X({__proto__:null,default:Y(EP)},[EP]);var wP=Rue();const Xbe=X({__proto__:null,default:Y(wP)},[wP]);var xP=Cue();const Kbe=X({__proto__:null,default:Y(xP)},[xP]);var kP=Nue();const Zbe=X({__proto__:null,default:Y(kP)},[kP]);var _P=Oue();const Qbe=X({__proto__:null,default:Y(_P)},[_P]);var TP=Iue();const Jbe=X({__proto__:null,default:Y(TP)},[TP]);var AP=Mue();const e1e=X({__proto__:null,default:Y(AP)},[AP]);var RP=Due();const t1e=X({__proto__:null,default:Y(RP)},[RP]);var CP=Lue();const n1e=X({__proto__:null,default:Y(CP)},[CP]);var NP=zue();const r1e=X({__proto__:null,default:Y(NP)},[NP]);var OP=Pue();const a1e=X({__proto__:null,default:Y(OP)},[OP]);var IP=Bue();const o1e=X({__proto__:null,default:Y(IP)},[IP]);var MP=Fue();const i1e=X({__proto__:null,default:Y(MP)},[MP]);var DP=Uue();const s1e=X({__proto__:null,default:Y(DP)},[DP]);var LP=Hue();const l1e=X({__proto__:null,default:Y(LP)},[LP]);var zP=LN();const c1e=X({__proto__:null,default:Y(zP)},[zP]);var PP=$ue();const u1e=X({__proto__:null,default:Y(PP)},[PP]);var BP=jue();const d1e=X({__proto__:null,default:Y(BP)},[BP]);var FP=que();const p1e=X({__proto__:null,default:Y(FP)},[FP]);var UP=kr();const f1e=X({__proto__:null,default:Y(UP)},[UP]);var HP=a8();const h1e=X({__proto__:null,default:Y(HP)},[HP]);var $P=Gue();const m1e=X({__proto__:null,default:Y($P)},[$P]);var jP=Vue();const g1e=X({__proto__:null,default:Y(jP)},[jP]);var qP=Wue();const b1e=X({__proto__:null,default:Y(qP)},[qP]);var GP=Yue();const y1e=X({__proto__:null,default:Y(GP)},[GP]);var VP=Xue();const v1e=X({__proto__:null,default:Y(VP)},[VP]);var WP=Kue();const S1e=X({__proto__:null,default:Y(WP)},[WP]);var YP=Zue();const E1e=X({__proto__:null,default:Y(YP)},[YP]);var XP=Que();const w1e=X({__proto__:null,default:Y(XP)},[XP]);var KP=Jue();const x1e=X({__proto__:null,default:Y(KP)},[KP]);var ZP=ede();const k1e=X({__proto__:null,default:Y(ZP)},[ZP]);var QP=tde();const _1e=X({__proto__:null,default:Y(QP)},[QP]);var JP=nde();const T1e=X({__proto__:null,default:Y(JP)},[JP]);var eB=rde();const A1e=X({__proto__:null,default:Y(eB)},[eB]);var tB=ade();const R1e=X({__proto__:null,default:Y(tB)},[tB]);var nB=ode();const C1e=X({__proto__:null,default:Y(nB)},[nB]);var rB=ide();const N1e=X({__proto__:null,default:Y(rB)},[rB]);var aB=sde();const O1e=X({__proto__:null,default:Y(aB)},[aB]);var oB=lde();const I1e=X({__proto__:null,default:Y(oB)},[oB]);var iB=cde();const M1e=X({__proto__:null,default:Y(iB)},[iB]);var sB=ude();const D1e=X({__proto__:null,default:Y(sB)},[sB]);var lB=dde();const L1e=X({__proto__:null,default:Y(lB)},[lB]);var cB=pde();const z1e=X({__proto__:null,default:Y(cB)},[cB]);var uB=fde();const P1e=X({__proto__:null,default:Y(uB)},[uB]);var dB=hde();const B1e=X({__proto__:null,default:Y(dB)},[dB]);var pB=mde();const F1e=X({__proto__:null,default:Y(pB)},[pB]);var fB=gde();const U1e=X({__proto__:null,default:Y(fB)},[fB]);var hB=bde();const H1e=X({__proto__:null,default:Y(hB)},[hB]);var mB=yde();const $1e=X({__proto__:null,default:Y(mB)},[mB]);var gB=vde();const j1e=X({__proto__:null,default:Y(gB)},[gB]);var bB=Sde();const q1e=X({__proto__:null,default:Y(bB)},[bB]);var yB=Ede();const G1e=X({__proto__:null,default:Y(yB)},[yB]);var vB=wde();const V1e=X({__proto__:null,default:Y(vB)},[vB]);var SB=cf();const W1e=X({__proto__:null,default:Y(SB)},[SB]);var EB=xde();const Y1e=X({__proto__:null,default:Y(EB)},[EB]);var wB=kde();const X1e=X({__proto__:null,default:Y(wB)},[wB]);var xB=_de();const K1e=X({__proto__:null,default:Y(xB)},[xB]);var kB=Tde();const Z1e=X({__proto__:null,default:Y(kB)},[kB]);var _B=Ade();const Q1e=X({__proto__:null,default:Y(_B)},[_B]);var TB=Rde();const J1e=X({__proto__:null,default:Y(TB)},[TB]);var AB=Cde();const eye=X({__proto__:null,default:Y(AB)},[AB]);var RB=Nde();const tye=X({__proto__:null,default:Y(RB)},[RB]);var CB=Ode();const nye=X({__proto__:null,default:Y(CB)},[CB]);var NB=Ide();const rye=X({__proto__:null,default:Y(NB)},[NB]);var OB=Mde();const aye=X({__proto__:null,default:Y(OB)},[OB]);var IB=Dde();const oye=X({__proto__:null,default:Y(IB)},[IB]);var MB=Lde();const iye=X({__proto__:null,default:Y(MB)},[MB]);var DB=zde();const sye=X({__proto__:null,default:Y(DB)},[DB]);var LB=Pde();const lye=X({__proto__:null,default:Y(LB)},[LB]);var zB=Fde();const cye=X({__proto__:null,default:Y(zB)},[zB]);var PB=Ude();const uye=X({__proto__:null,default:Y(PB)},[PB]);var BB=Hde();const dye=X({__proto__:null,default:Y(BB)},[BB]);var FB=$de();const pye=X({__proto__:null,default:Y(FB)},[FB]);var UB=jde();const fye=X({__proto__:null,default:Y(UB)},[UB]);var HB=qde();const hye=X({__proto__:null,default:Y(HB)},[HB]);var $B=Gde();const mye=X({__proto__:null,default:Y($B)},[$B]);var jB=Vde();const gye=X({__proto__:null,default:Y(jB)},[jB]);var qB=Wde();const bye=X({__proto__:null,default:Y(qB)},[qB]);var GB=Yde();const yye=X({__proto__:null,default:Y(GB)},[GB]);var VB=Xde();const vye=X({__proto__:null,default:Y(VB)},[VB]);var WB=Kde();const Sye=X({__proto__:null,default:Y(WB)},[WB]);var YB=Zde();const Eye=X({__proto__:null,default:Y(YB)},[YB]);var XB=Qde();const wye=X({__proto__:null,default:Y(XB)},[XB]);var KB=sf();const xye=X({__proto__:null,default:Y(KB)},[KB]);var ZB=Jde();const kye=X({__proto__:null,default:Y(ZB)},[ZB]);var QB=epe();const _ye=X({__proto__:null,default:Y(QB)},[QB]);var JB=tpe();const Tye=X({__proto__:null,default:Y(JB)},[JB]);var eF=npe();const Aye=X({__proto__:null,default:Y(eF)},[eF]);var tF=HS();const Rye=X({__proto__:null,default:Y(tF)},[tF]);var nF=rpe();const Cye=X({__proto__:null,default:Y(nF)},[nF]);var rF=ape();const Nye=X({__proto__:null,default:Y(rF)},[rF]);var aF=ope();const Oye=X({__proto__:null,default:Y(aF)},[aF]);var oF=ipe();const Iye=X({__proto__:null,default:Y(oF)},[oF]);var iF=spe();const Mye=X({__proto__:null,default:Y(iF)},[iF]);var sF=lpe();const Dye=X({__proto__:null,default:Y(sF)},[sF]);var lF=cpe();const Lye=X({__proto__:null,default:Y(lF)},[lF]);var cF=upe();const zye=X({__proto__:null,default:Y(cF)},[cF]);var uF=dpe();const Pye=X({__proto__:null,default:Y(uF)},[uF]);var dF=ppe();const Bye=X({__proto__:null,default:Y(dF)},[dF]);var pF=fpe();const Fye=X({__proto__:null,default:Y(pF)},[pF]);var fF=hpe();const Uye=X({__proto__:null,default:Y(fF)},[fF]);var hF=cy();const Hye=X({__proto__:null,default:Y(hF)},[hF]);var mF=mpe();const $ye=X({__proto__:null,default:Y(mF)},[mF]);var gF=gpe();const jye=X({__proto__:null,default:Y(gF)},[gF]);var bF=bpe();const qye=X({__proto__:null,default:Y(bF)},[bF]);var yF=ype();const Gye=X({__proto__:null,default:Y(yF)},[yF]);var vF=vpe();const Vye=X({__proto__:null,default:Y(vF)},[vF]);var SF=Spe();const Wye=X({__proto__:null,default:Y(SF)},[SF]);var EF=Cw();const Yye=X({__proto__:null,default:Y(EF)},[EF]);var wF=Epe();const Xye=X({__proto__:null,default:Y(wF)},[wF]);var xF=wpe();const Kye=X({__proto__:null,default:Y(xF)},[xF]);var kF=xpe();const Zye=X({__proto__:null,default:Y(kF)},[kF]);var _F=kpe();const Qye=X({__proto__:null,default:Y(_F)},[_F]);var TF=_pe();const Jye=X({__proto__:null,default:Y(TF)},[TF]);var AF=Tpe();const eve=X({__proto__:null,default:Y(AF)},[AF]);var RF=Rpe();const tve=X({__proto__:null,default:Y(RF)},[RF]);var CF=NI();const nve=X({__proto__:null,default:Y(CF)},[CF]);var NF=Cpe();const rve=X({__proto__:null,default:Y(NF)},[NF]);var OF=wS();const ave=X({__proto__:null,default:Y(OF)},[OF]);var IF=Npe();const ove=X({__proto__:null,default:Y(IF)},[IF]);var MF=Ope();const ive=X({__proto__:null,default:Y(MF)},[MF]);var DF=Ipe();const sve=X({__proto__:null,default:Y(DF)},[DF]);var LF=Mpe();const lve=X({__proto__:null,default:Y(LF)},[LF]);var zF=Dpe();const cve=X({__proto__:null,default:Y(zF)},[zF]);var PF=Lpe();const uve=X({__proto__:null,default:Y(PF)},[PF]);var BF=$I();const dve=X({__proto__:null,default:Y(BF)},[BF]);var FF=zpe();const pve=X({__proto__:null,default:Y(FF)},[FF]);var UF=Ppe();const fve=X({__proto__:null,default:Y(UF)},[UF]);var HF=Bpe();const hve=X({__proto__:null,default:Y(HF)},[HF]);var $F=Fpe();const mve=X({__proto__:null,default:Y($F)},[$F]);var jF=Upe();const gve=X({__proto__:null,default:Y(jF)},[jF]);var qF=Hpe();const bve=X({__proto__:null,default:Y(qF)},[qF]);var GF=$pe();const yve=X({__proto__:null,default:Y(GF)},[GF]);var VF=jpe();const vve=X({__proto__:null,default:Y(VF)},[VF]);var WF=qpe();const Sve=X({__proto__:null,default:Y(WF)},[WF]);var YF=Gpe();const Eve=X({__proto__:null,default:Y(YF)},[YF]);var XF=Vpe();const wve=X({__proto__:null,default:Y(XF)},[XF]);var KF=Wpe();const xve=X({__proto__:null,default:Y(KF)},[KF]);var ZF=Ype();const kve=X({__proto__:null,default:Y(ZF)},[ZF]);var QF=Xpe();const _ve=X({__proto__:null,default:Y(QF)},[QF]);var JF=Kpe();const Tve=X({__proto__:null,default:Y(JF)},[JF]);var eU=GI();const Ave=X({__proto__:null,default:Y(eU)},[eU]);var tU=Zpe();const Rve=X({__proto__:null,default:Y(tU)},[tU]);var nU=Qpe();const Cve=X({__proto__:null,default:Y(nU)},[nU]),Nve=Object.freeze(Object.defineProperty({__proto__:null,default:`/* Source: index.css */
645
+ your API key is correctly set (if connecting to a deployed graph).`)})},[t]),_.jsx(m5.Provider,{value:g,children:e})},b0e=({children:e})=>{const{langGraphBaseUrl:t,baseUrl:n}=Pr(),a=t,{setLangGraphState:i,chatAssistantId:s,appointmentData:c}=Br(),[u,p]=V.useState(void 0),f=gf();if(V.useEffect(()=>{n!==""&&!s&&f.getChatAssistant().then(h=>{h&&h.chatAssistant&&(i(g=>({...g,chatAssistantId:h.chatAssistant})),p(h.chatAssistant)),(!h||!h.chatAssistant)&&console.log("Error","Error getting chat assistant")})},[a,n,c?.patientId]),u)return _.jsx(g0e,{apiUrl:a,assistantId:u,children:e})},y0e=({children:e,clientBaseUrl:t,clientWssUrl:n,clientApiKey:a,isOpen:i,setIsOpen:s,disableActions:c,onlyChat:u,disableGen:p})=>{const[{baseUrl:f,langGraphBaseUrl:h,apiKey:g,disableAllActions:b,wssUrl:v,chatApp:S,disableGenerate:E},k]=V.useState({baseUrl:t,wssUrl:n,langGraphBaseUrl:t+"/lang-graph/",apiKey:a,disableAllActions:c??!1,chatApp:u??!1,disableGenerate:p??!1}),[A,T]=V.useState(!0),R=s??T,P=i??A,B=async()=>{k({baseUrl:t,wssUrl:n,langGraphBaseUrl:t+"/lang-graph/",apiKey:a,disableAllActions:c??!1,chatApp:u??!1,disableGenerate:p??!1})};return V.useEffect(()=>{t&&a&&B()},[a,t,n]),V.useEffect(()=>{c!==void 0&&k(O=>({...O,disableAllActions:c}))},[c]),V.useEffect(()=>{p!==void 0&&k(O=>({...O,disableGenerate:p}))},[p]),V.useEffect(()=>{u!==void 0&&k(O=>({...O,chatApp:u}))},[u]),_.jsx(ZT.Provider,{value:{baseUrl:f,wssUrl:v,langGraphBaseUrl:h,apiKey:g,isOmniOpen:P,disableAllActions:b,chatApp:S,disableGenerate:E,setConfig:k,setIsOmniOpen:R},children:e})},v0e=({children:e})=>{const{language:t}=Oa(),[n,a]=V.useState(),[i,s]=V.useState(gl.es),c=async()=>{const u=t,{translations:p,code:f}=await s4(u);a(p),s(f)};if(V.useEffect(()=>{c()},[t]),i)return _.jsx(vY,{messages:n,locale:i,defaultLocale:Do.defaultLanguageCode,onError:u=>{u.code},children:e})},S0e=e=>{if(!e||e.length===0)return 0;const t=e.map(a=>parseFloat(a.end)).filter(a=>!isNaN(a)&&isFinite(a));if(t.length===0)return 0;const n=Math.max(...t);return Math.ceil(n)},E0e=async(e,t)=>{try{const n=await ro(Hn.dayData)??[],a=n.findIndex(s=>s.patientId===e&&s.doctorId===t);if(a===-1)return;const i=n[a];if(i?.transcript&&i.transcript.length>0&&!i.transcriptionId){console.log("Found orphaned transcript, creating transcription in database...");const s=JSON.stringify(i.transcript),c=i.recordingSeconds??S0e(i.transcript),u=await u4.createTranscription({duration_seconds:c,original_transcript:s});if(!u?.transcription?.id){console.error("Invalid transcription response: missing transcription.id",u);return}const p=await ro(Hn.dayData)??[],f=p.findIndex(h=>h.patientId===e&&h.doctorId===t);f!==-1&&(p[f]={...p[f],transcriptionId:u.transcription.id,clinicalNoteId:u.clinical_note_id||p[f].clinicalNoteId},await yl(Hn.dayData,p,p[f]?.date||i.date||new Date().toLocaleDateString()))}}catch(n){console.error("Failed to check/create orphaned transcripts:",n)}},w0e=({baseurl:e,wssurl:t,apikey:n,userid:a,patientid:i,toolsargs:s,isopen:c,setIsOpen:u,patientdata:p,transcriptorselectvalues:f,handleReport:h,renderReportContent:g,handleFill:b,handleAngular:v="handle-report",toast:S,width:E,height:k,title:A,language:T,isscreenloading:R,disableactions:P,onlychat:B,disablegenerate:O,chatsources:U,setGetLastReport:K})=>{const H=h??v,q=typeof f=="string"?JSON.parse(f):f,J=typeof p=="string"?JSON.parse(p):p,[ue,fe]=V.useState(i),[ie,se]=V.useState(a),[D,L]=V.useState(0);return V.useEffect(()=>{K&&K(async()=>await qD(i,a))},[K,i,a]),V.useEffect(()=>{i!==ue&&(console.log("Patient ID changed from",ue,"to",i),fe(i),L(F=>F+1))},[i,ue]),V.useEffect(()=>{a!==ie&&(console.log("User ID changed from",ie,"to",a),se(a),L(F=>F+1))},[a,ie]),V.useEffect(()=>{aQ(n,e,a,i)},[n,e,a,i]),V.useEffect(()=>{i&&a&&E0e(i,a)},[i,a]),_.jsx(y0e,{clientApiKey:n,clientBaseUrl:e,clientWssUrl:t,isOpen:c,disableActions:P,disableGen:O,setIsOpen:u,language:T,onlyChat:B,children:_.jsx(Whe,{predefinedLanguage:void 0,toolArgs:s,children:_.jsx(v0e,{children:_.jsx(d0e,{screenLoader:R,transcriptorSelectValues:q,children:_.jsx(f0e,{propsUserId:a,propsPatientId:i,propsPatientData:J,propsHandleReport:H??void 0,propsHandleFill:b,propsRenderReportContent:g??void 0,propsSources:U,children:_.jsx(h0e,{children:_.jsx(b0e,{children:_.jsx(u0e,{toast:S,children:_.jsx(c0e,{width:E??"650px",height:k??"665px",title:A})})})})})})})})},D)};let p4=null;async function x0e(){return p4||(p4=(await Promise.resolve().then(()=>Nve)).default),p4}const f4={handleReport:{reactProp:"handleReport",type:"function"},handlereport:{reactProp:"handleReport",type:"function"},"handle-report":{reactProp:"handleReport",type:"function"},setIsOpen:{reactProp:"setIsOpen",type:"function"},setisopen:{reactProp:"setIsOpen",type:"function"},"set-is-open":{reactProp:"setIsOpen",type:"function"},renderReportContent:{reactProp:"renderReportContent",type:"function"},renderreportcontent:{reactProp:"renderReportContent",type:"function"},"render-report-content":{reactProp:"renderReportContent",type:"function"},setGetLastReport:{reactProp:"setGetLastReport",type:"function"},setgetlastreport:{reactProp:"setGetLastReport",type:"function"},"set-get-last-report":{reactProp:"setGetLastReport",type:"function"},toast:{reactProp:"toast",type:"json"},patientId:{reactProp:"patientId",type:"string"},patientid:{reactProp:"patientId",type:"string"},"patient-id":{reactProp:"patientId",type:"string"},apiKey:{reactProp:"apiKey",type:"string"},apikey:{reactProp:"apiKey",type:"string"},"api-key":{reactProp:"apiKey",type:"string"},baseUrl:{reactProp:"baseUrl",type:"string"},baseurl:{reactProp:"baseUrl",type:"string"},"base-url":{reactProp:"baseUrl",type:"string"},wssUrl:{reactProp:"wssUrl",type:"string"},wssurl:{reactProp:"wssUrl",type:"string"},"wss-url":{reactProp:"wssUrl",type:"string"},userId:{reactProp:"userId",type:"string"},userid:{reactProp:"userId",type:"string"},"user-id":{reactProp:"userId",type:"string"},language:{reactProp:"language",type:"string"},isOpen:{reactProp:"isOpen",type:"boolean"},isopen:{reactProp:"isOpen",type:"boolean"},"is-open":{reactProp:"isOpen",type:"boolean"},isScreenLoading:{reactProp:"isScreenLoading",type:"boolean"},isscreenloading:{reactProp:"isScreenLoading",type:"boolean"},"is-screen-loading":{reactProp:"isScreenLoading",type:"boolean"},disableActions:{reactProp:"disableActions",type:"boolean"},disableactions:{reactProp:"disableActions",type:"boolean"},"disable-actions":{reactProp:"disableActions",type:"boolean"},onlyChat:{reactProp:"onlyChat",type:"boolean"},onlychat:{reactProp:"onlyChat",type:"boolean"},"only-chat":{reactProp:"onlyChat",type:"boolean"},disableGenerate:{reactProp:"disableGenerate",type:"boolean"},disablegenerate:{reactProp:"disableGenerate",type:"boolean"},"disable-generate":{reactProp:"disableGenerate",type:"boolean"},patientData:{reactProp:"patientData",type:"json"},patientdata:{reactProp:"patientData",type:"json"},"patient-data":{reactProp:"patientData",type:"json"},toolsArgs:{reactProp:"toolsArgs",type:"json"},toolsargs:{reactProp:"toolsArgs",type:"json"},"tools-args":{reactProp:"toolsArgs",type:"json"},chatSources:{reactProp:"chatSources",type:"json"},chatsources:{reactProp:"chatSources",type:"json"},transcriptorSelectValues:{reactProp:"transcriptorSelectValues",type:"json"},transcriptorselectvalues:{reactProp:"transcriptorSelectValues",type:"json"},"transcriptor-select-values":{reactProp:"transcriptorSelectValues",type:"json"},width:{reactProp:"width",type:"string"},height:{reactProp:"height",type:"string"},title:{reactProp:"height",type:"string"}},YD={};Object.entries(f4).forEach(([e,t])=>{YD[e]=t.type});const XD={};Object.entries(f4).forEach(([e,t])=>{XD[e]=t.reactProp});const gu=zV(w0e,{props:YD,shadow:"open"});async function KD(e){if(!e||e.querySelector("style[data-omniscribe-styles]"))return;const t=await x0e(),n=document.createElement("style");n.setAttribute("data-omniscribe-styles",""),n.textContent=t,e.prepend(n)}const ZD=gu.prototype.connectedCallback;gu.prototype.connectedCallback=function(){ZD&&ZD.call(this),this.shadowRoot&&KD(this.shadowRoot),this.processKebabCaseAttributes()},gu.prototype.processKebabCaseAttributes=function(){Object.entries(XD).forEach(([e,t])=>{if(this.hasAttribute(e)){const n=this.getAttribute(e);if(f4[e].type==="function"&&(n===""||n==="()"||n&&n.startsWith("("))){const i=n?n.replace(/[()]/g,"").trim():"";i&&window[i]&&typeof window[i]=="function"&&(this[t]=window[i])}}})};function k0e(){window.omniscribeHandleReport=function(e){const t=document.querySelectorAll("sofia-sdk"),n=new CustomEvent("handle-report",{detail:e,bubbles:!0,composed:!0});t.forEach(a=>{a.dispatchEvent(n)}),console.log("Global omniscribeHandleReport called:",e)},window.omniscribeSetIsOpen=function(e){const t=document.querySelectorAll("sofia-sdk"),n=new CustomEvent("set-is-open",{detail:e,bubbles:!0,composed:!0});t.forEach(a=>{a.dispatchEvent(n)}),console.log("Global omniscribeSetIsOpen called:",e)},window.omniscribeSetGetLastReport=async function(){const e=document.querySelectorAll("sofia-sdk"),t=[];return e.forEach(n=>{const a=new CustomEvent("set-get-last-report",{detail:null,bubbles:!0,composed:!0});n.dispatchEvent(a)}),console.log("Global omniscribeSetGetLastReport called"),t}}typeof window<"u"&&typeof customElements<"u"&&(customElements.get("sofia-sdk")||(customElements.define("sofia-sdk",gu),console.log("Registered sofia-sdk")),k0e(),window.sofia=window.sofia||{},window.sofia.injectStyles=KD);var QD=ble();const _0e=X({__proto__:null,default:Y(QD)},[QD]);var JD=yle();const T0e=X({__proto__:null,default:Y(JD)},[JD]);var eL=vle();const A0e=X({__proto__:null,default:Y(eL)},[eL]);var tL=Sle();const R0e=X({__proto__:null,default:Y(tL)},[tL]);var nL=Ele();const C0e=X({__proto__:null,default:Y(nL)},[nL]);var rL=wle();const N0e=X({__proto__:null,default:Y(rL)},[rL]);var aL=xle();const O0e=X({__proto__:null,default:Y(aL)},[aL]);var oL=kle();const I0e=X({__proto__:null,default:Y(oL)},[oL]);var iL=_le();const M0e=X({__proto__:null,default:Y(iL)},[iL]);var sL=Tle();const D0e=X({__proto__:null,default:Y(sL)},[sL]);var lL=Ale();const L0e=X({__proto__:null,default:Y(lL)},[lL]);var cL=Rle();const z0e=X({__proto__:null,default:Y(cL)},[cL]);var uL=Cle();const P0e=X({__proto__:null,default:Y(uL)},[uL]);var dL=Nle();const B0e=X({__proto__:null,default:Y(dL)},[dL]);var pL=Ole();const F0e=X({__proto__:null,default:Y(pL)},[pL]);var fL=Ile();const U0e=X({__proto__:null,default:Y(fL)},[fL]);var hL=Mle();const H0e=X({__proto__:null,default:Y(hL)},[hL]);var mL=Dle();const $0e=X({__proto__:null,default:Y(mL)},[mL]);var gL=Lle();const j0e=X({__proto__:null,default:Y(gL)},[gL]);var bL=zle();const q0e=X({__proto__:null,default:Y(bL)},[bL]);var yL=Ple();const G0e=X({__proto__:null,default:Y(yL)},[yL]);var vL=Ble();const V0e=X({__proto__:null,default:Y(vL)},[vL]);var SL=U8();const W0e=X({__proto__:null,default:Y(SL)},[SL]);var EL=$8();const Y0e=X({__proto__:null,default:Y(EL)},[EL]);var wL=Fle();const X0e=X({__proto__:null,default:Y(wL)},[wL]);var xL=Ule();const K0e=X({__proto__:null,default:Y(xL)},[xL]);var kL=Hle();const Z0e=X({__proto__:null,default:Y(kL)},[kL]);var _L=$le();const Q0e=X({__proto__:null,default:Y(_L)},[_L]);var TL=jle();const J0e=X({__proto__:null,default:Y(TL)},[TL]);var AL=qle();const ege=X({__proto__:null,default:Y(AL)},[AL]);var RL=Gle();const tge=X({__proto__:null,default:Y(RL)},[RL]);var CL=Vle();const nge=X({__proto__:null,default:Y(CL)},[CL]);var NL=Wle();const rge=X({__proto__:null,default:Y(NL)},[NL]);var OL=Yle();const age=X({__proto__:null,default:Y(OL)},[OL]);var IL=ls();const oge=X({__proto__:null,default:Y(IL)},[IL]);var ML=Xle();const ige=X({__proto__:null,default:Y(ML)},[ML]);var DL=Kle();const sge=X({__proto__:null,default:Y(DL)},[DL]);var LL=Zle();const lge=X({__proto__:null,default:Y(LL)},[LL]);var zL=l8();const cge=X({__proto__:null,default:Y(zL)},[zL]);var PL=Qle();const uge=X({__proto__:null,default:Y(PL)},[PL]);var BL=Jle();const dge=X({__proto__:null,default:Y(BL)},[BL]);var FL=ece();const pge=X({__proto__:null,default:Y(FL)},[FL]);var UL=tce();const fge=X({__proto__:null,default:Y(UL)},[UL]);var HL=nce();const hge=X({__proto__:null,default:Y(HL)},[HL]);var $L=rce();const mge=X({__proto__:null,default:Y($L)},[$L]);var jL=gy();const gge=X({__proto__:null,default:Y(jL)},[jL]);var qL=ace();const bge=X({__proto__:null,default:Y(qL)},[qL]);var GL=of();const yge=X({__proto__:null,default:Y(GL)},[GL]);var VL=oce();const vge=X({__proto__:null,default:Y(VL)},[VL]);var WL=ice();const Sge=X({__proto__:null,default:Y(WL)},[WL]);var YL=sce();const Ege=X({__proto__:null,default:Y(YL)},[YL]);var XL=i8();const wge=X({__proto__:null,default:Y(XL)},[XL]);var KL=lce();const xge=X({__proto__:null,default:Y(KL)},[KL]);var ZL=cce();const kge=X({__proto__:null,default:Y(ZL)},[ZL]);var QL=uce();const _ge=X({__proto__:null,default:Y(QL)},[QL]);var JL=dce();const Tge=X({__proto__:null,default:Y(JL)},[JL]);var ez=pce();const Age=X({__proto__:null,default:Y(ez)},[ez]);var tz=fce();const Rge=X({__proto__:null,default:Y(tz)},[tz]);var nz=hce();const Cge=X({__proto__:null,default:Y(nz)},[nz]);var rz=mce();const Nge=X({__proto__:null,default:Y(rz)},[rz]);var az=gce();const Oge=X({__proto__:null,default:Y(az)},[az]);var oz=bce();const Ige=X({__proto__:null,default:Y(oz)},[oz]);var iz=yce();const Mge=X({__proto__:null,default:Y(iz)},[iz]);var sz=vce();const Dge=X({__proto__:null,default:Y(sz)},[sz]);var lz=Sce();const Lge=X({__proto__:null,default:Y(lz)},[lz]);var cz=Ece();const zge=X({__proto__:null,default:Y(cz)},[cz]);var uz=wce();const Pge=X({__proto__:null,default:Y(uz)},[uz]);var dz=xce();const Bge=X({__proto__:null,default:Y(dz)},[dz]);var pz=kce();const Fge=X({__proto__:null,default:Y(pz)},[pz]);var fz=_ce();const Uge=X({__proto__:null,default:Y(fz)},[fz]);var hz=Tce();const Hge=X({__proto__:null,default:Y(hz)},[hz]);var mz=Ace();const $ge=X({__proto__:null,default:Y(mz)},[mz]);var gz=Rce();const jge=X({__proto__:null,default:Y(gz)},[gz]);var bz=Cce();const qge=X({__proto__:null,default:Y(bz)},[bz]);var yz=Nce();const Gge=X({__proto__:null,default:Y(yz)},[yz]);var vz=Oce();const Vge=X({__proto__:null,default:Y(vz)},[vz]);var Sz=Ice();const Wge=X({__proto__:null,default:Y(Sz)},[Sz]);var Ez=Mce();const Yge=X({__proto__:null,default:Y(Ez)},[Ez]);var wz=Dce();const Xge=X({__proto__:null,default:Y(wz)},[wz]);var xz=Lce();const Kge=X({__proto__:null,default:Y(xz)},[xz]);var kz=zce();const Zge=X({__proto__:null,default:Y(kz)},[kz]);var _z=Pce();const Qge=X({__proto__:null,default:Y(_z)},[_z]);var Tz=Bce();const Jge=X({__proto__:null,default:Y(Tz)},[Tz]);var Az=Fce();const ebe=X({__proto__:null,default:Y(Az)},[Az]);var Rz=Uce();const tbe=X({__proto__:null,default:Y(Rz)},[Rz]);var Cz=Hce();const nbe=X({__proto__:null,default:Y(Cz)},[Cz]);var Nz=$ce();const rbe=X({__proto__:null,default:Y(Nz)},[Nz]);var Oz=jce();const abe=X({__proto__:null,default:Y(Oz)},[Oz]);var Iz=qce();const obe=X({__proto__:null,default:Y(Iz)},[Iz]);var Mz=Gce();const ibe=X({__proto__:null,default:Y(Mz)},[Mz]);var Dz=Vce();const sbe=X({__proto__:null,default:Y(Dz)},[Dz]);var Lz=Wce();const lbe=X({__proto__:null,default:Y(Lz)},[Lz]);var zz=Yce();const cbe=X({__proto__:null,default:Y(zz)},[zz]);var Pz=Xce();const ube=X({__proto__:null,default:Y(Pz)},[Pz]);var Bz=Kce();const dbe=X({__proto__:null,default:Y(Bz)},[Bz]);var Fz=Zce();const pbe=X({__proto__:null,default:Y(Fz)},[Fz]);var Uz=Wv();const fbe=X({__proto__:null,default:Y(Uz)},[Uz]);var Hz=Qce();const hbe=X({__proto__:null,default:Y(Hz)},[Hz]);var $z=Jce();const mbe=X({__proto__:null,default:Y($z)},[$z]);var jz=eue();const gbe=X({__proto__:null,default:Y(jz)},[jz]);var qz=tue();const bbe=X({__proto__:null,default:Y(qz)},[qz]);var Gz=nue();const ybe=X({__proto__:null,default:Y(Gz)},[Gz]);var Vz=rue();const vbe=X({__proto__:null,default:Y(Vz)},[Vz]);var Wz=aue();const Sbe=X({__proto__:null,default:Y(Wz)},[Wz]);var Yz=oue();const Ebe=X({__proto__:null,default:Y(Yz)},[Yz]);var Xz=iue();const wbe=X({__proto__:null,default:Y(Xz)},[Xz]);var Kz=sue();const xbe=X({__proto__:null,default:Y(Kz)},[Kz]);var Zz=lue();const kbe=X({__proto__:null,default:Y(Zz)},[Zz]);var Qz=cue();const _be=X({__proto__:null,default:Y(Qz)},[Qz]);var Jz=uue();const Tbe=X({__proto__:null,default:Y(Jz)},[Jz]);var eP=due();const Abe=X({__proto__:null,default:Y(eP)},[eP]);var tP=pue();const Rbe=X({__proto__:null,default:Y(tP)},[tP]);var nP=fue();const Cbe=X({__proto__:null,default:Y(nP)},[nP]);var rP=hue();const Nbe=X({__proto__:null,default:Y(rP)},[rP]);var aP=pS();const Obe=X({__proto__:null,default:Y(aP)},[aP]);var oP=mue();const Ibe=X({__proto__:null,default:Y(oP)},[oP]);var iP=lf();const Mbe=X({__proto__:null,default:Y(iP)},[iP]);var sP=u8();const Dbe=X({__proto__:null,default:Y(sP)},[sP]);var lP=gue();const Lbe=X({__proto__:null,default:Y(lP)},[lP]);var cP=bue();const zbe=X({__proto__:null,default:Y(cP)},[cP]);var uP=yue();const Pbe=X({__proto__:null,default:Y(uP)},[uP]);var dP=vue();const Bbe=X({__proto__:null,default:Y(dP)},[dP]);var pP=Sue();const Fbe=X({__proto__:null,default:Y(pP)},[pP]);var fP=Eue();const Ube=X({__proto__:null,default:Y(fP)},[fP]);var hP=wue();const Hbe=X({__proto__:null,default:Y(hP)},[hP]);var mP=_S();const $be=X({__proto__:null,default:Y(mP)},[mP]);var gP=xue();const jbe=X({__proto__:null,default:Y(gP)},[gP]);var bP=kue();const qbe=X({__proto__:null,default:Y(bP)},[bP]);var yP=_ue();const Gbe=X({__proto__:null,default:Y(yP)},[yP]);var vP=UO();const Vbe=X({__proto__:null,default:Y(vP)},[vP]);var SP=Tue();const Wbe=X({__proto__:null,default:Y(SP)},[SP]);var EP=Aue();const Ybe=X({__proto__:null,default:Y(EP)},[EP]);var wP=Rue();const Xbe=X({__proto__:null,default:Y(wP)},[wP]);var xP=Cue();const Kbe=X({__proto__:null,default:Y(xP)},[xP]);var kP=Nue();const Zbe=X({__proto__:null,default:Y(kP)},[kP]);var _P=Oue();const Qbe=X({__proto__:null,default:Y(_P)},[_P]);var TP=Iue();const Jbe=X({__proto__:null,default:Y(TP)},[TP]);var AP=Mue();const e1e=X({__proto__:null,default:Y(AP)},[AP]);var RP=Due();const t1e=X({__proto__:null,default:Y(RP)},[RP]);var CP=Lue();const n1e=X({__proto__:null,default:Y(CP)},[CP]);var NP=zue();const r1e=X({__proto__:null,default:Y(NP)},[NP]);var OP=Pue();const a1e=X({__proto__:null,default:Y(OP)},[OP]);var IP=Bue();const o1e=X({__proto__:null,default:Y(IP)},[IP]);var MP=Fue();const i1e=X({__proto__:null,default:Y(MP)},[MP]);var DP=Uue();const s1e=X({__proto__:null,default:Y(DP)},[DP]);var LP=Hue();const l1e=X({__proto__:null,default:Y(LP)},[LP]);var zP=LN();const c1e=X({__proto__:null,default:Y(zP)},[zP]);var PP=$ue();const u1e=X({__proto__:null,default:Y(PP)},[PP]);var BP=jue();const d1e=X({__proto__:null,default:Y(BP)},[BP]);var FP=que();const p1e=X({__proto__:null,default:Y(FP)},[FP]);var UP=kr();const f1e=X({__proto__:null,default:Y(UP)},[UP]);var HP=a8();const h1e=X({__proto__:null,default:Y(HP)},[HP]);var $P=Gue();const m1e=X({__proto__:null,default:Y($P)},[$P]);var jP=Vue();const g1e=X({__proto__:null,default:Y(jP)},[jP]);var qP=Wue();const b1e=X({__proto__:null,default:Y(qP)},[qP]);var GP=Yue();const y1e=X({__proto__:null,default:Y(GP)},[GP]);var VP=Xue();const v1e=X({__proto__:null,default:Y(VP)},[VP]);var WP=Kue();const S1e=X({__proto__:null,default:Y(WP)},[WP]);var YP=Zue();const E1e=X({__proto__:null,default:Y(YP)},[YP]);var XP=Que();const w1e=X({__proto__:null,default:Y(XP)},[XP]);var KP=Jue();const x1e=X({__proto__:null,default:Y(KP)},[KP]);var ZP=ede();const k1e=X({__proto__:null,default:Y(ZP)},[ZP]);var QP=tde();const _1e=X({__proto__:null,default:Y(QP)},[QP]);var JP=nde();const T1e=X({__proto__:null,default:Y(JP)},[JP]);var eB=rde();const A1e=X({__proto__:null,default:Y(eB)},[eB]);var tB=ade();const R1e=X({__proto__:null,default:Y(tB)},[tB]);var nB=ode();const C1e=X({__proto__:null,default:Y(nB)},[nB]);var rB=ide();const N1e=X({__proto__:null,default:Y(rB)},[rB]);var aB=sde();const O1e=X({__proto__:null,default:Y(aB)},[aB]);var oB=lde();const I1e=X({__proto__:null,default:Y(oB)},[oB]);var iB=cde();const M1e=X({__proto__:null,default:Y(iB)},[iB]);var sB=ude();const D1e=X({__proto__:null,default:Y(sB)},[sB]);var lB=dde();const L1e=X({__proto__:null,default:Y(lB)},[lB]);var cB=pde();const z1e=X({__proto__:null,default:Y(cB)},[cB]);var uB=fde();const P1e=X({__proto__:null,default:Y(uB)},[uB]);var dB=hde();const B1e=X({__proto__:null,default:Y(dB)},[dB]);var pB=mde();const F1e=X({__proto__:null,default:Y(pB)},[pB]);var fB=gde();const U1e=X({__proto__:null,default:Y(fB)},[fB]);var hB=bde();const H1e=X({__proto__:null,default:Y(hB)},[hB]);var mB=yde();const $1e=X({__proto__:null,default:Y(mB)},[mB]);var gB=vde();const j1e=X({__proto__:null,default:Y(gB)},[gB]);var bB=Sde();const q1e=X({__proto__:null,default:Y(bB)},[bB]);var yB=Ede();const G1e=X({__proto__:null,default:Y(yB)},[yB]);var vB=wde();const V1e=X({__proto__:null,default:Y(vB)},[vB]);var SB=cf();const W1e=X({__proto__:null,default:Y(SB)},[SB]);var EB=xde();const Y1e=X({__proto__:null,default:Y(EB)},[EB]);var wB=kde();const X1e=X({__proto__:null,default:Y(wB)},[wB]);var xB=_de();const K1e=X({__proto__:null,default:Y(xB)},[xB]);var kB=Tde();const Z1e=X({__proto__:null,default:Y(kB)},[kB]);var _B=Ade();const Q1e=X({__proto__:null,default:Y(_B)},[_B]);var TB=Rde();const J1e=X({__proto__:null,default:Y(TB)},[TB]);var AB=Cde();const eye=X({__proto__:null,default:Y(AB)},[AB]);var RB=Nde();const tye=X({__proto__:null,default:Y(RB)},[RB]);var CB=Ode();const nye=X({__proto__:null,default:Y(CB)},[CB]);var NB=Ide();const rye=X({__proto__:null,default:Y(NB)},[NB]);var OB=Mde();const aye=X({__proto__:null,default:Y(OB)},[OB]);var IB=Dde();const oye=X({__proto__:null,default:Y(IB)},[IB]);var MB=Lde();const iye=X({__proto__:null,default:Y(MB)},[MB]);var DB=zde();const sye=X({__proto__:null,default:Y(DB)},[DB]);var LB=Pde();const lye=X({__proto__:null,default:Y(LB)},[LB]);var zB=Fde();const cye=X({__proto__:null,default:Y(zB)},[zB]);var PB=Ude();const uye=X({__proto__:null,default:Y(PB)},[PB]);var BB=Hde();const dye=X({__proto__:null,default:Y(BB)},[BB]);var FB=$de();const pye=X({__proto__:null,default:Y(FB)},[FB]);var UB=jde();const fye=X({__proto__:null,default:Y(UB)},[UB]);var HB=qde();const hye=X({__proto__:null,default:Y(HB)},[HB]);var $B=Gde();const mye=X({__proto__:null,default:Y($B)},[$B]);var jB=Vde();const gye=X({__proto__:null,default:Y(jB)},[jB]);var qB=Wde();const bye=X({__proto__:null,default:Y(qB)},[qB]);var GB=Yde();const yye=X({__proto__:null,default:Y(GB)},[GB]);var VB=Xde();const vye=X({__proto__:null,default:Y(VB)},[VB]);var WB=Kde();const Sye=X({__proto__:null,default:Y(WB)},[WB]);var YB=Zde();const Eye=X({__proto__:null,default:Y(YB)},[YB]);var XB=Qde();const wye=X({__proto__:null,default:Y(XB)},[XB]);var KB=sf();const xye=X({__proto__:null,default:Y(KB)},[KB]);var ZB=Jde();const kye=X({__proto__:null,default:Y(ZB)},[ZB]);var QB=epe();const _ye=X({__proto__:null,default:Y(QB)},[QB]);var JB=tpe();const Tye=X({__proto__:null,default:Y(JB)},[JB]);var eF=npe();const Aye=X({__proto__:null,default:Y(eF)},[eF]);var tF=HS();const Rye=X({__proto__:null,default:Y(tF)},[tF]);var nF=rpe();const Cye=X({__proto__:null,default:Y(nF)},[nF]);var rF=ape();const Nye=X({__proto__:null,default:Y(rF)},[rF]);var aF=ope();const Oye=X({__proto__:null,default:Y(aF)},[aF]);var oF=ipe();const Iye=X({__proto__:null,default:Y(oF)},[oF]);var iF=spe();const Mye=X({__proto__:null,default:Y(iF)},[iF]);var sF=lpe();const Dye=X({__proto__:null,default:Y(sF)},[sF]);var lF=cpe();const Lye=X({__proto__:null,default:Y(lF)},[lF]);var cF=upe();const zye=X({__proto__:null,default:Y(cF)},[cF]);var uF=dpe();const Pye=X({__proto__:null,default:Y(uF)},[uF]);var dF=ppe();const Bye=X({__proto__:null,default:Y(dF)},[dF]);var pF=fpe();const Fye=X({__proto__:null,default:Y(pF)},[pF]);var fF=hpe();const Uye=X({__proto__:null,default:Y(fF)},[fF]);var hF=cy();const Hye=X({__proto__:null,default:Y(hF)},[hF]);var mF=mpe();const $ye=X({__proto__:null,default:Y(mF)},[mF]);var gF=gpe();const jye=X({__proto__:null,default:Y(gF)},[gF]);var bF=bpe();const qye=X({__proto__:null,default:Y(bF)},[bF]);var yF=ype();const Gye=X({__proto__:null,default:Y(yF)},[yF]);var vF=vpe();const Vye=X({__proto__:null,default:Y(vF)},[vF]);var SF=Spe();const Wye=X({__proto__:null,default:Y(SF)},[SF]);var EF=Cw();const Yye=X({__proto__:null,default:Y(EF)},[EF]);var wF=Epe();const Xye=X({__proto__:null,default:Y(wF)},[wF]);var xF=wpe();const Kye=X({__proto__:null,default:Y(xF)},[xF]);var kF=xpe();const Zye=X({__proto__:null,default:Y(kF)},[kF]);var _F=kpe();const Qye=X({__proto__:null,default:Y(_F)},[_F]);var TF=_pe();const Jye=X({__proto__:null,default:Y(TF)},[TF]);var AF=Tpe();const eve=X({__proto__:null,default:Y(AF)},[AF]);var RF=Rpe();const tve=X({__proto__:null,default:Y(RF)},[RF]);var CF=NI();const nve=X({__proto__:null,default:Y(CF)},[CF]);var NF=Cpe();const rve=X({__proto__:null,default:Y(NF)},[NF]);var OF=wS();const ave=X({__proto__:null,default:Y(OF)},[OF]);var IF=Npe();const ove=X({__proto__:null,default:Y(IF)},[IF]);var MF=Ope();const ive=X({__proto__:null,default:Y(MF)},[MF]);var DF=Ipe();const sve=X({__proto__:null,default:Y(DF)},[DF]);var LF=Mpe();const lve=X({__proto__:null,default:Y(LF)},[LF]);var zF=Dpe();const cve=X({__proto__:null,default:Y(zF)},[zF]);var PF=Lpe();const uve=X({__proto__:null,default:Y(PF)},[PF]);var BF=$I();const dve=X({__proto__:null,default:Y(BF)},[BF]);var FF=zpe();const pve=X({__proto__:null,default:Y(FF)},[FF]);var UF=Ppe();const fve=X({__proto__:null,default:Y(UF)},[UF]);var HF=Bpe();const hve=X({__proto__:null,default:Y(HF)},[HF]);var $F=Fpe();const mve=X({__proto__:null,default:Y($F)},[$F]);var jF=Upe();const gve=X({__proto__:null,default:Y(jF)},[jF]);var qF=Hpe();const bve=X({__proto__:null,default:Y(qF)},[qF]);var GF=$pe();const yve=X({__proto__:null,default:Y(GF)},[GF]);var VF=jpe();const vve=X({__proto__:null,default:Y(VF)},[VF]);var WF=qpe();const Sve=X({__proto__:null,default:Y(WF)},[WF]);var YF=Gpe();const Eve=X({__proto__:null,default:Y(YF)},[YF]);var XF=Vpe();const wve=X({__proto__:null,default:Y(XF)},[XF]);var KF=Wpe();const xve=X({__proto__:null,default:Y(KF)},[KF]);var ZF=Ype();const kve=X({__proto__:null,default:Y(ZF)},[ZF]);var QF=Xpe();const _ve=X({__proto__:null,default:Y(QF)},[QF]);var JF=Kpe();const Tve=X({__proto__:null,default:Y(JF)},[JF]);var eU=GI();const Ave=X({__proto__:null,default:Y(eU)},[eU]);var tU=Zpe();const Rve=X({__proto__:null,default:Y(tU)},[tU]);var nU=Qpe();const Cve=X({__proto__:null,default:Y(nU)},[nU]),Nve=Object.freeze(Object.defineProperty({__proto__:null,default:`/* Source: index.css */
646
646
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@700&family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap');
647
647
 
648
648
  #Omniscribe {
@@ -4646,5 +4646,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4646
4646
  transition: none;
4647
4647
  }
4648
4648
  }
4649
- `},Symbol.toStringTag,{value:"Module"}));Vs.OmniscribeElement=gu,Object.defineProperty(Vs,Symbol.toStringTag,{value:"Module"})}));
4649
+ `},Symbol.toStringTag,{value:"Module"}));Vs.SofiaSDK=gu,Object.defineProperty(Vs,Symbol.toStringTag,{value:"Module"})}));
4650
4650
  //# sourceMappingURL=webcomponents.umd.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniloy/sofia-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Sofia SDK - AI-powered medical assistant web component for healthcare applications",
5
5
  "keywords": [
6
6
  "webcomponent",
@@ -1 +0,0 @@
1
- export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";export default "";{}
@@ -1,61 +0,0 @@
1
- import * as React_2 from 'react';
2
-
3
- declare enum LanguageCode {
4
- ar = "ar",
5
- en = "en",
6
- es = "es",
7
- id = "id"
8
- }
9
-
10
- export declare const OmniscribeElement: CustomElementConstructor;
11
-
12
- export declare interface OmniscribeProps {
13
- baseurl: string;
14
- wssurl: string;
15
- apikey: string;
16
- userid: string;
17
- toolsargs: object;
18
- patientid: string;
19
- isopen?: boolean;
20
- setIsOpen?: React_2.Dispatch<React_2.SetStateAction<boolean>>;
21
- patientdata?: object;
22
- transcriptorselectvalues?: TTranscriptorSelect;
23
- handleReport: (report: object) => void | undefined;
24
- 'handle-report'?: (report: object) => void | undefined;
25
- handleAngular?: (report: object) => void | undefined;
26
- handleFill?: () => Promise<void>;
27
- renderReportContent: TRenderReport | undefined;
28
- toast?: TToastState;
29
- width?: string;
30
- height?: string;
31
- title?: string;
32
- language?: LanguageCode;
33
- isscreenloading?: boolean;
34
- disableactions?: boolean;
35
- onlychat?: boolean;
36
- disablegenerate?: boolean;
37
- chatsources?: string[];
38
- setGetLastReport?: (fn: () => Promise<object | undefined>) => void;
39
- }
40
-
41
- declare enum ToastVariation {
42
- default = "default",
43
- danger = "danger"
44
- }
45
-
46
- declare type TRenderReport = (report: object, selected: string) => React_2.JSX.Element[] | React_2.JSX.Element;
47
-
48
- declare type TToastState = {
49
- title: string;
50
- message: string;
51
- visible: boolean;
52
- variation: ToastVariation;
53
- duration?: number;
54
- };
55
-
56
- declare type TTranscriptorSelect = {
57
- value: string;
58
- label: string;
59
- }[];
60
-
61
- export { }