1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,47811,(e,t,r)=>{t.exports={i18n:{locales:["en","es"],defaultLocale:"en",localeDetection:!0,localePath:"/public/locales",ns:["common","errors","toast","testimonials","tutorial"]}}},92468,e=>{"use strict";var t=e.i(8529);e.s(["doc",()=>t.a9])},61592,(e,t,r)=>{"use strict";e.i(50461),Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"LoadableContext",{enumerable:!0,get:function(){return i}});let i=e.r(41705)._(e.r(91788)).default.createContext(null)},52414,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return h}});let i=e.r(41705)._(e.r(91788)),n=e.r(61592),a=[],s=[],o=!1;function u(e){let t=e(),r={loading:!0,loaded:null,error:null};return r.promise=t.then(e=>(r.loading=!1,r.loaded=e,e)).catch(e=>{throw r.loading=!1,r.error=e,e}),r}class l{constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}}function c(t){return function(t,r){let u=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},r),c=null;function d(){if(!c){let e=new l(t,u);c={getCurrentValue:e.getCurrentValue.bind(e),subscribe:e.subscribe.bind(e),retry:e.retry.bind(e),promise:e.promise.bind(e)}}return c.promise()}if("u"<typeof window&&a.push(d),!o&&"u">typeof window){let t=u.webpack&&"function"==typeof e.t.resolveWeak?u.webpack():u.modules;t&&s.push(e=>{for(let r of t)if(e.includes(r))return d()})}function h(e,t){let r;d(),(r=i.default.useContext(n.LoadableContext))&&Array.isArray(u.modules)&&u.modules.forEach(e=>{r(e)});let a=i.default.useSyncExternalStore(c.subscribe,c.getCurrentValue,c.getCurrentValue);return i.default.useImperativeHandle(t,()=>({retry:c.retry}),[]),i.default.useMemo(()=>{var t;return a.loading||a.error?i.default.createElement(u.loading,{isLoading:a.loading,pastDelay:a.pastDelay,timedOut:a.timedOut,error:a.error,retry:c.retry}):a.loaded?i.default.createElement((t=a.loaded)&&t.default?t.default:t,e):null},[e,a])}return h.preload=()=>d(),h.displayName="LoadableComponent",i.default.forwardRef(h)}(u,t)}function d(e,t){let r=[];for(;e.length;){let i=e.pop();r.push(i(t))}return Promise.all(r).then(()=>{if(e.length)return d(e,t)})}c.preloadAll=()=>new Promise((e,t)=>{d(a).then(e,t)}),c.preloadReady=(e=[])=>new Promise(t=>{let r=()=>(o=!0,t());d(s,e).then(r,r)}),"u">typeof window&&(window.__NEXT_PRELOADREADY=c.preloadReady);let h=c},25167,(e,t,r)=>{"use strict";e.i(50461),Object.defineProperty(r,"__esModule",{value:!0});var i={default:function(){return d},noSSR:function(){return c}};for(var n in i)Object.defineProperty(r,n,{enumerable:!0,get:i[n]});let a=e.r(41705),s=e.r(91398);e.r(91788);let o=a._(e.r(52414)),u="u"<typeof window;function l(e){return{default:e?.default||e}}function c(e,t){if(delete t.webpack,delete t.modules,!u)return e(t);let r=t.loading;return()=>(0,s.jsx)(r,{error:null,isLoading:!0,pastDelay:!1,timedOut:!1})}function d(e,t){let r=o.default,i={loading:({error:e,isLoading:t,pastDelay:r})=>null};e instanceof Promise?i.loader=()=>e:"function"==typeof e?i.loader=e:"object"==typeof e&&(i={...i,...e});let n=(i={...i,...t}).loader;return(i.loadableGenerated&&(i={...i,...i.loadableGenerated},delete i.loadableGenerated),"boolean"!=typeof i.ssr||i.ssr)?r({...i,loader:()=>null!=n?n().then(l):Promise.resolve(l(()=>null))}):(delete i.webpack,delete i.modules,c(r,i))}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esMo
1dule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},68489,(e,t,r)=>{t.exports=e.r(25167)},5205,(e,t,r)=>{t.exports=e.r(80963)},94182,(e,t,r)=>{t.exports=e.r(61457)},32136,e=>{e.q("/_next/static/immutable/media/pdf.worker.min.29c8bynsajz7h.mjs")},14386,e=>{"use strict";var t=e.i(91398),r=e.i(91788);let i=[[20,250],[250,500],[500,2e3],[2e3,4e3],[4e3,12e3]],n=[.18,.34,.5,.66,.82],a=[.25,.5,.75],s=[.34,.42,.5,.58,.66],o=[.25,.5,.75];e.s(["default",0,function({analyserRef:e,isPaused:u=!1,width:l=200,height:c=100,className:d="",fluid:h=!1,bandCount:f=i.length,sensitivity:m=1}){let p=Math.max(1,Math.min(i.length,Math.floor(f))),y=(0,r.useMemo)(()=>i.slice(0,p),[p]),b=(0,r.useMemo)(()=>3===p?a:n.slice(0,p),[p]),g=(0,r.useMemo)(()=>3===p?o:s.slice(0,p),[p]),_=(0,r.useRef)(null),v=(0,r.useRef)(null),E=(0,r.useRef)(Array(p).fill(0)),w=(0,r.useRef)(Array(p).fill(0)),C=(0,r.useRef)(Array(p).fill(null)),T=(0,r.useRef)(y.map(()=>[])),S=(0,r.useRef)(null),x=(0,r.useRef)(null),A=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let t,r,i=_.current,n=i?.getContext("2d");if(!i||!n)return;let a=l,s=c,o=null;function d(){let e=i.getBoundingClientRect();a=h?Math.max(1,e.width):l,s=h?Math.max(1,e.height):c;let t=window.devicePixelRatio||1;i.width=Math.round(a*t),i.height=Math.round(s*t),n.setTransform(t,0,0,t,0,0)}return d(),h&&"u">typeof ResizeObserver&&(r=new ResizeObserver(d)).observe(i),t=requestAnimationFrame(function r(i){if(t=requestAnimationFrame(r),document.hidden)return;let l=e?.current;if(l!==o&&(o=l,v.current=null,E.current.fill(0),w.current.fill(0),C.current.fill(null),T.current=y.map(()=>[]),S.current=null,x.current=null,A.current=null),null===S.current||i-S.current>=40){let e;(e=!!(l&&!u))&&(v.current&&v.current.length===l.frequencyBinCount||(v.current=new Float32Array(l.frequencyBinCount)),l.getFloatFrequencyData(v.current)),y.forEach((t,r)=>{let i=0;if(e&&v.current){let e=function(e,t,[r,i]){let n=(t.context?.sampleRate||48e3)/(2*e.length),a=Math.max(1,Math.ceil(r/n)),s=Math.min(e.length-1,Math.floor(i/n)),o=0,u=0;if(a>s)return null;for(let t=a;t<=s;t+=1){let r=e[t];Number.isFinite(r)&&(o+=10**(r/10),u+=1)}return u?10*Math.log10(o/u):null}(v.current,l,t),n=C.current[r];if(null===e)i=0;else if(null===n)C.current[r]=Math.max(e,-80);else{let t=n;e<n?t+=(e-n)*.12:e<=n+6&&(t+=(e-n)*.015),C.current[r]=t,i=Math.min(1,Math.max(0,e-t-6)*m/36)}}E.current[r]=i}),S.current=i}let c=x.current??i,d=Math.min(50,Math.max(0,i-c));x.current=i,w.current.forEach((e,t)=>{let r=E.current[t],i=1-Math.exp(-d/(r>e?260:650));w.current[t]=e+(r-e)*i}),(null===A.current||i-A.current>=50)&&(w.current.forEach((e,t)=>{let r=T.current[t];r.push({time:i,value:e});let n=i-(a*b[t]/110+.5)*1e3;for(;r.length&&r[0].time<n;)r.shift()}),A.current=i),n.clearRect(0,0,a,s);let h=getComputedStyle(document.documentElement),f=[h.getPropertyValue("--primary").trim()||"#3b82f6",h.getPropertyValue("--accent").trim()||"#48ddc4",h.getPropertyValue("--secondary").trim()||"#4cdd7f",h.getPropertyValue("--warning").trim()||"#b45309",h.getPropertyValue("--success").trim()||"#168a4b"];n.lineCap="round",n.lineJoin="round",n.lineWidth=1.6,w.current.forEach((e,t)=>{let r=s*g[t],o=.24*s;n.strokeStyle=f[t],n.globalAlpha=[.16,.2,.25,.2,.15][t],function(e,t,r,i,n,a,s,o){let u=i*s,l=[{x:0,y:n}];t.forEach((e,i)=>{let s=r-e.time,o=u-s/1e3*110;if(o<0||o>u)return;let c=Math.min(1,Math.max(0,(u-o)/u)),d=function(e,t,r){let i=Math.max(0,t-r),n=Math.min(e.length-1,t+r),a=0;for(let t=i;t<=n;t+=1)a+=e[t].value;return a/(n-i+1)}(t,i,Math.floor(10*c)),h=Math.exp(-s/3e3);l.push({x:o,y:n-d*a*h*(1-c)**1.25})}),l.push({x:u,y:n-o*a});let c=Math.min(i-u,.3*i);for(let e=1;e<=16;e+=1){let t=e/16,r=(.5+.5*Math.cos(Math.PI*t))**1.5;l.push({x:u+c*t,y:n-o*a*r})}u+c<i&&l.push({x:i,y:n}),e.beginPath(),e.moveTo(l[0].x,l[0].y);for(let t=1;t<l.length-1;t+=1){let r=l[t],i=l[t+1];e.quadraticCurveTo(r.x,r.y,(r.x+i.x)/2,(r.y+i.y)/2)}let d=l[l.length-1];e.lineTo(d.x,d.y),e.stroke()}(n,T.current[t],i,a,r,o,b[t],e)}),n.globalAlpha=1}),()=>{cancelAnimationFrame(t),r?.disconnect()}},[e,g,b,y,h,c,u,m,l]),(0,t.jsx)("canvas",{ref:_,style:h?{height:"100%",width:"100%"}:{height:`${c}px`,width:`${l}px`},className:d,"aria-hidden":"true"})}])},1877,36880,e=>{"use strict";var t=e.i(91398),r=e.i(62129);e.i(64376);var i=e.i(67853),i=i,n=i,a=e.i(66111);function s(e){return Array.isArray(e)?[...e]:e&&"object"==typeof e?{...e}:{}}function o(e,t){let r=s(e);return Object.entries(t||{}
1).forEach(([e,t])=>{if(!e)return;let i=e.split("."),n=r;i.forEach((e,r)=>{if(r===i.length-1){n[e]=t;return}n[e]=s(n[e]),n=n[e]})}),r}function u(e,t){return Object.fromEntries(Object.entries(t||{}).filter(([t,r])=>(function(e,t){if(e&&t)return t.split(".").reduce((e,t)=>{if(null!=e)return e[t]},e)})(e,t)!==r))}e.i(81516);let l="scribe_v1";function c(e){let t={tutorials:{[l]:{status:null,version:1,startedAt:null,completedAt:null,dismissedAt:null,lastShownAt:null,lastStepId:null,timesShown:0}}},r=e&&"object"==typeof e?e:{},i=r.tutorials&&"object"==typeof r.tutorials?r.tutorials:{},n=i[l]&&"object"==typeof i[l]?i[l]:{};return{...t,...r,tutorials:{...i,[l]:{...t.tutorials[l],...n,version:1}}}}function d(e){return c(e?.behaviour).tutorials[l]}e.s(["SCRIBE_TUTORIAL_KEY",0,l,"SCRIBE_TUTORIAL_VERSION",0,1,"buildScribeTutorialFieldUpdates",0,function(e){return Object.fromEntries(Object.entries(e||{}).map(([e,t])=>[`behaviour.tutorials.${l}.${e}`,t]))},"getScribeTutorialState",0,d,"normalizeDoctorBehaviour",0,c,"shouldAutoStartScribeTutorial",0,function(e,t){let r;return"/dashboard"===t&&!(r=d(e)).completedAt&&!r.dismissedAt}],36880);var h=e.i(92468),f=e.i(7742);function m(e){return(0,h.doc)(a.db,"doctors",e)}async function p({userId:e,docRef:t,docData:r,fieldUpdates:i}){if(!e||!i||0===Object.keys(i).length)return{docRef:t,docData:r};let n=t||m(e),a=u(r,i);return 0===Object.keys(a).length?{docRef:n,docData:r}:(await (0,f.updateDoc)(n,a),{docRef:n,docData:o(r||{},a)})}var y=e.i(3828),b=e.i(91788);let g=(0,b.createContext)();function _(){let e=(0,b.useContext)(g);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}e.s(["AuthProvider",0,function({children:e}){let[s,d]=(0,b.useState)(null),[h,y]=(0,b.useState)(!0),[_,v]=(0,b.useState)(null),[E,w]=(0,b.useState)(null),C=!!s?.isAnonymous,T=(0,r.isRegisteredFirebaseUser)(s),S=(0,b.useCallback)(async e=>{let t=await p({userId:s?.uid,docRef:_,docData:E,fieldUpdates:e});v(t.docRef),w(t.docData)},[E,_,s?.uid]);return(0,b.useEffect)(()=>{let e=(0,i.z)(a.auth,async e=>{e?(await (0,r.setupAuthToken)(e),d(e),(0,r.isRegisteredFirebaseUser)(e)||(v(null),w(null))):((0,r.clearAuthToken)(),d(null),v(null),w(null)),y(!1)}),t=(0,n.x)(a.auth,async e=>{e&&await (0,r.setupAuthToken)(e)});return()=>{e(),t()}},[]),(0,b.useEffect)(()=>{var e,t,r;let i;if(!s?.uid||!T){v(null),w(null);return}v(m(s.uid)),w(null);let n=(e=s.uid,t=e=>{v(e.docRef),w(e.docData)},r=e=>{console.error("Error subscribing to doctor document:",e)},i=m(e),(0,f.onSnapshot)(i,async e=>{var r;let n,a,s,d;if(!e.exists())return void t({docRef:i,docData:null});let h=(n=c((r=e.data()).behaviour),a=r.behaviour?.tutorials?.[l]||{},s={},Object.entries(n.tutorials[l]).forEach(([e,t])=>{a[e]!==t&&(s[`behaviour.tutorials.${l}.${e}`]=t)}),d=u(r,s),{docData:o(r,d),changedFieldUpdates:d});Object.keys(h.changedFieldUpdates).length>0&&await (0,f.updateDoc)(i,h.changedFieldUpdates),t({docRef:i,docData:h.docData})},r));return()=>{n()}},[T,s?.uid]),(0,t.jsx)(g.Provider,{value:{user:s,loading:h,docRef:_,docData:E,updateDoctorFields:S,isAnonymous:C,isRegistered:T},children:e})},"useAuth",0,_,"useRequireAuth",0,function(){let{user:e,loading:t,docRef:r,docData:i,updateDoctorFields:n,isAnonymous:a,isRegistered:s}=_(),o=(0,y.useRouter)();return(0,b.useEffect)(()=>{t||e&&!a||"/login"===o.pathname?s&&i&&"/dashboard"!==o.pathname&&("/"===o.pathname||"/login"===o.pathname||"/payment"===o.pathname)&&o.push("/dashboard"):o.push("/login")},[i,a,s,t,o,e]),{user:e,loading:t,docRef:r,docData:i,updateDoctorFields:n,isAnonymous:a,isRegistered:s}}],1877)},96887,5412,e=>{"use strict";var t=e.i(91398),r=e.i(51591),i=e.i(19172);async function n({mentions:e=[],onDelta:t,onDone:a,onResponseComplete:s,onError:o,onArtifact:u,onStart:l,onStatus:c,signal:d,text:h,threadId:f=null,usePubmed:m=!1,mode:p,orgId:y}){let b=await (0,r.authPostToFunctionRaw)("copilotStream",{mentions:e,mode:p,orgId:y,text:h,threadId:f,usePubmed:m});if(!b.body)throw Error("COPILOT_STREAM_EMPTY_BODY");let g=b.body.getReader(),_=new TextDecoder,v="",E=({event:e,data:r})=>{"start"===e?l?.(r):"delta"===e?t?.(r):"status"===e?c?.(r):"artifact"===e?u?.(r):"response_complete"===e?s?.(r):"done"===e?a?.(r):"error"===e&&o?.(r)};for(;;){if(d?.aborted)return void await g.cancel();let{done:e,value:t}=await g.read();if(e)break;v+=_.decode(t,{stream:!0}),v=(0,i.flushSseBuffer)(v,E)}(v+=_.decode()).trim()&&(0,i.flushSseBuffer)(`${v} 2 3`,E)}var a=e.i(1877),s=e.i(90293),o=e.i(8236),u=e.i(66111);e.i(81516);var l=e.i(52856),c=e.i(92468),d=e.i(7742);let h=["active","completed","error","archived"],f=["user","assistant","system","tool"];function m(e){return e?"object"==typeof e&&null!==e&&"toDate"in e?e.toDate().toISOString():e instanceof Date?e.toISOString():"string"==typeof e?e:null:null}function p(e,t,r){let i=h.includes(e?.status)?e.status:"active",n=f.includes(e?.lastRole)?e.lastRole:null;return{thread_id:t||e?.threadId||"",doctor_id:r||e?.doctorId||"",title:"string"==typeof e?.title?e.title:null,summary:"string"==typeof e?.summary?e.summary:null,status:i,scope:e?.scope&&"object"==typeof e.scope?{mode:"string"==typeof e.scope.mode?e.scope.mode:"",org_id:"string"==typeof e.scope.orgId?e.scope.orgId:null}:null,created_at:m(e?.createdAt),updated_at:m(e?.updatedAt),last_item_at:m(e?.lastItemAt),last_item_id:"string"==typeof e?.lastItemId?e.lastItemId:null,last_role:n,item_count:Number(e?.itemCount||0),user_message_count:Number(e?.userMessageCount||0),assistant_message_count:Number(e?.assistantMessageCount||0),artifact_count:Number(e?.artifactCount||0),last_error:"string"==typeof e?.lastError?e.lastError:null,metadata:e?.metadata&&"object"==typeof e.metadata?e.metadata:{}}}function y({role:e,content:t,metadata:r={},sequenceNumber:i=null}){return{id:`${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`,role:e,content:t,metadata:r,createdAt:new Date().toISOString(),sequenceNumber:i}}function b(e){return"number"==typeof e?.sequenceNumber?e.sequenceNumber:null}
3function g(e,t,r,i){let n=String(e||"").trim(),a=String(t||"").trim();if(!n||!a)return r(null),()=>{};let s=(0,c.doc)(u.db,"doctors",n,"copilotThreads",a);return(0,d.onSnapshot)(s,e=>{e.exists()?r(p(e.data()||{},e.id,n)):r(null)},i)}async function _(e){let t=String(e||"").trim();if(!t)return null;let r=(0,d.query)((0,l.collection)(u.db,"doctors",t,"copilotThreads"),(0,d.orderBy)("updatedAt","desc"),(0,d.limit)(1)),i=(await (0,d.getDocs)(r)).docs[0];return i?p(i.data()||{},i.id,t):null}async function v(e,t,{beforeSequenceNumber:r=null,pageSize:i=40}={}){var n;let a,s=String(e||"").trim(),c=String(t||"").trim();if(!s||!c)return{messages:[],hasMore:!1};let h=[(0,d.orderBy)("sequenceNumber","asc")];null!==r&&h.push((0,d.endBefore)(r)),h.push((0,d.limitToLast)(Math.max(1,i)));let f=(0,d.query)((0,l.collection)(u.db,"doctors",s,"copilotThreads",c,"items"),...h),m=await (0,d.getDocs)(f),p=b(m.docs[0]?.data?.()||{});return{messages:(n=m.docs,a=[],n.forEach(e=>{let t=e.data()||{},r=function(e){if(e?.kind!=="message"||e?.role!=="user"&&e?.role!=="assistant")return null;let t="string"==typeof e?.text&&e.text.trim()?e.text:(0,o.flattenContentBlocksText)(e?.contentBlocks);return t?y({role:e.role,content:t,metadata:{artifacts:Array.isArray(e?.metadata?.artifacts)?e.metadata.artifacts:[],mentions:Array.isArray(e?.mentions)?e.mentions:[],status:e?.
3status==="streaming"?"streaming":"done",threadId:"string"==typeof e?.threadId?e.threadId:null},sequenceNumber:"number"==typeof e?.sequenceNumber?e.sequenceNumber:null}):null}(t);if(r)return void a.push(r);let i=t?.kind!=="artifact"||t?.role!=="assistant"?null:t?.artifact&&"object"==typeof t.artifact?t.artifact:null;if(!i)return;let n=a.at(-1);if(n?.role==="assistant"){n.metadata={...n.metadata,artifacts:[...n.metadata?.artifacts||[],i]};return}a.push(y({role:"assistant",content:"",metadata:{artifacts:[i],status:"done",threadId:"string"==typeof t?.threadId?t.threadId:null},sequenceNumber:b(t)}))}),a),hasMore:"number"==typeof p&&p>1}}e.s(["loadCopilotThreadMessagePage",0,v,"loadMostRecentCopilotThread",0,_,"subscribeCopilotThread",0,g,"subscribeCopilotThreads",0,function(e,t,r){let i=String(e||"").trim();if(!i)return t([]),()=>{};let n=(0,d.query)((0,l.collection)(u.db,"doctors",i,"copilotThreads"),(0,d.orderBy)("updatedAt","desc"));return(0,d.onSnapshot)(n,e=>{t(e.docs.map(e=>{let t=e.data()||{};return{id:e.id,title:"string"==typeof t.title?t.title.trim():"",updatedAt:t.updatedAt||null}}))},r)}],5412);var E=e.i(91788),w=e.i(3828);e.i(64157);var C=e.i(71179);let T=(0,E.createContext)(null),S=(0,E.createContext)(null),x=(0,E.createContext)(null);function A({role:e,content:t,metadata:r={}}){return{id:`${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`,role:e,content:t,metadata:r,createdAt:new Date().toISOString()}}function O(e,t,r){return e.map(e=>e.id===t?{...e,content:"function"==typeof r?r(e.content||""):r}:e)}function R(e,t,r){return e.map(e=>e.id===t?{...e,metadata:{...e.metadata,...r}}:e)}function I(){let e=(0,E.useContext)(T);if(!e)throw Error("useCopilot must be used within a CopilotProvider");return e}e.s(["CopilotProvider",0,function({children:e}){let[r,i]=(0,E.useState)(!1),[n,a]=(0,E.useState)(!1),s=(0,E.useCallback)(()=>{i(!0)},[]),o=(0,E.useCallback)(()=>{i(!1)},[]),u=(0,E.useCallback)(()=>{i(!1),a(!0)},[]),l=(0,E.useCallback)(()=>{a(!1)},[]),c=(0,E.useMemo)(()=>({launcherOpen:r,panelOpen:n,openLauncher:s,closeLauncher:o,openPanel:u,closePanel:l}),[r,n,s,o,u,l]);return(0,t.jsx)(T.Provider,{value:c,children:e})},"CopilotSessionProvider",0,function({children:e}){let{user:r}=(0,a.useAuth)(),{t:i}=(0,C.useTranslation)(),{closeLauncher:o,openPanel:u}=I(),l=(0,E.useRef)(null),{hasOlderMessages:c,isLoadingOlderMessages:d,isRequestInFlight:h,currentThreadId:f,currentThread:m,messages:p,loadOlderMessages:y,openMostRecentThread:b,setCurrentThreadId:T,setIsRequestInFlight:M,setMessages:P,startNewChat:D,selectThread:N}=function({userId:e,closeLauncher:t,openPanel:r}){let[i,n]=(0,E.useState)(!1),[a,s]=(0,E.useState)(!1),[o,u]=(0,E.useState)(!1),[l,c]=(0,E.useState)([]),[d,h]=(0,E.useState)(null),[f,m]=(0,E.useState)(null),p=(0,w.useRouter)(),y=(0,E.useCallback)(()=>{if(h(null),m(null),c([]),n(!1),s(!1),u(!1),r(),t(),p?.pathname==="/chat"&&p.query.threadId){let{pathname:e,query:t}=p,r={...t};delete r.threadId,p.push({pathname:e,query:r},void 0,{shallow:!0})}},[t,r,p]);(0,E.useEffect)(()=>e&&d?g(e,d,e=>{m(e)},e=>{console.error("Error subscribing to copilot thread:",e),m(null)}):void m(null),[d,e]);let b=(0,E.useCallback)(async i=>{let a=String(i||"").trim();if(e&&a)try{let{messages:i,hasMore:s}=await v(e,a);(0,E.startTransition)(()=>{h(a),c(i),n(s),u(!1),r(),t()}),p?.pathname==="/chat"&&p.query.threadId!==a&&p.push({pathname:"/chat",query:{...p.query,threadId:a}},void 0,{shallow:!0})}catch(e){console.error("Error loading copilot thread items:",e)}},[t,r,e,p]),C=(0,E.useCallback)(async()=>{if(!e||!d||a||!i)return;let t=l.find(e=>"number"==typeof e.sequenceNumber)?.sequenceNumber;if("number"!=typeof t)return void n(!1);s(!0);try{let{messages:r,hasMore:i}=await v(e,d,{beforeSequenceNumber:t});(0,E.startTransition)(()=>{c(e=>[...r,...e]),n(i)})}catch(e){console.error("Error loading older copilot thread items:",e)}finally{s(!1)}},[d,i,a,l,e]);return{hasOlderMessages:i,isLoadingOlderMessages:a,isRequestInFlight:o,currentThreadId:d,currentThread:f,messages:l,loadOlderMessages:C,openMostRecentThread:(0,E.useCallback)(async()=>
3{if(e)try{let t=await _(e);if(!t?.thread_id)return void y();await b(t.thread_id)}catch(e){console.error("Error opening most recent copilot thread:",e),y()}},[b,y,e]),setCurrentThreadId:(0,E.useCallback)(e=>{if(h(e),p?.pathname==="/chat"&&p.query.threadId!==e){let{pathname:t,query:r}=p;p.replace({pathname:t,query:{...r,threadId:e}},void 0,{shallow:!0})}},[p]),setCurrentThread:m,setMessages:c,setIsRequestInFlight:u,startNewChat:y,selectThread:b}}({userId:r?.uid,closeLauncher:o,openPanel:u}),j=(0,E.useCallback)(async(e,t={})=>{let r=e.trim();if(!r)return;let a=t||{},o=!1!==a.openPanel,c=a.threadId||f||null,d=A({role:"assistant",content:"",metadata:{status:"streaming",threadId:c,type:"copilot-response"}});o&&u(),M(!0);let h=A({role:"user",content:r,metadata:{...a,threadId:c}});P(e=>[...e,h,d]);let m="",p=()=>{if(l.current=null,!m)return;let e=m;m="",P(t=>O(t,d.id,t=>t+e))};try{let e=(0,s.resolveAccessScope)();await n({mentions:a.mentions,onDelta:({text:e})=>{e&&(m+=e,null===l.current&&(l.current=window.requestAnimationFrame(p)))},onStart:({threadId:e})=>{e&&(T(e),P(t=>R(R(t,h.id,{threadId:e}),d.id,{threadId:e})))},onArtifact:e=>{P(t=>{var r;return r=d.id,t.map(t=>t.id===r?{...t,metadata:{...t.metadata,artifacts:[...t.metadata?.artifacts||[],e]}}:t)})},onResponseComplete:()=>{null!==l.current&&(window.cancelAnimationFrame(l.current),p()),M(!1),P(e=>e.map(e=>e.id===d.id?{...e,content:e.content||i("copilot.empty_response"),metadata:{...e.metadata,status:"done",statusMessage:""}}:e))},onDone:()=>{},onError:({error:e})=>{throw null!==l.current&&(window.cancelAnimationFrame(l.current),p()),M(!1),Error(e||"COPILOT_STREAM_FAILED")},onStatus:({message:e,phase:t,tool:r})=>{P(n=>R(n,d.id,{phase:t,status:"streaming",statusMessage:function(e,{message:t,phase:r,tool:i}){return"tool"===r?e("copilot.status.using_tool",{tool:e(`copilot.tools.${i}`,{defaultValue:i||e("copilot.tools.unknown")})}):"Reviewing tool results..."===t?e("copilot.status.reviewing_tool_results"):"Preparing final answer..."===t?e("copilot.status.preparing_final_answer"):t||""}(i,{message:e,phase:t,tool:r}),tool:r}))},text:r,threadId:c,usePubmed:!!a.usePubmed,...e})}catch(e){P(t=>{let r;return R(O(t,d.id,"COPILOT_STREAM_EMPTY_BODY"===(r=e instanceof Error?e.message:"")?i("copilot.errors.stream_empty_body"):"COPILOT_STREAM_FAILED"===r?i("copilot.errors.stream_failed"):i("copilot.errors.request_failed")),d.id,{status:"error",statusMessage:""})})}finally{null!==l.current&&(window.cancelAnimationFrame(l.current),l.current=null),M(!1)}},[o,f,u,T,M,P,i]),q=(0,E.useMemo)(()=>({messages:p,isResponding:h,hasOlderMessages:c,isLoadingOlderMessages:d,currentThreadId:f,currentThread:m}),[p,h,c,d,f,m]),k=(0,E.useMemo)(()=>({loadOlderMessages:y,openMostRecentThread:b,startNewChat:D,selectThread:N,sendMessage:j}),[y,b,D,N,j]);return(0,t.jsx)(x.Provider,{value:k,children:(0,t.jsx)(S.Provider,{value:q,children:e})})},"useCopilot",0,I,"useCopilotSessionActions",0,function(){let e=(0,E.useContext)(x);if(!e)throw Error("useCopilotSessionActions must be used within a CopilotSessionProvider");return e},"useCopilotSessionState",0,function(){let e=(0,E.useContext)(S);if(!e)throw Error("useCopilotSessionState must be used within a CopilotSessionProvider");return e}],96887)},26880,e=>{"use strict";var t=e.i(91398),r=e.i(21534);e.i(64157);var i=e.i(71179),n=e.i(91788);function a(e,t,r){return Math.min(Math.max(e,t),r)}function s({step:e,onClose:o}){let{t:u}=(0,i.useTranslation)("tutorial"),[l,c]=(0,n.useState)(null),[d,h]=(0,n.useState)(220),f=(0,n.useRef)(null),m=!!e?.selector;if((0,n.useEffect)(()=>{if(!e?.selector)return void c(null);let t=null,r=null,i=!1,n=!1,a=()=>{let t=document.querySelector(e.selector);return!!t&&(c(t.getBoundingClientRect()),!n&&t?.scrollIntoView&&(n=!0,t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})),!0)},s=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>{a()})},o=()=>{i||a()||(t=requestAnimationFrame(o))};return o(),(r=new MutationObserver(()=>{i||a()})).observe(document.body,{childList:!0,subtree:!0,attributes:!0}),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{i=!0,cancelAnimationFrame(t),r&&r.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[e]),(0,n.useLayoutEffect)(()=>{f.current&&h(f.current.getBoundingClientRect().height||220)},[e,l,u]),!e)return null;let p=window.innerWidth,y=window.innerHeight,b=m&&!!l,g=!m,_=Math.max((p-360)/2,16),v=Math.max((y-d)/2,16);if(b){let t=p-l.right-16,r=l.left-16,i=y-l.bottom-16,n={top:l.top-16>=d+18,bottom:i>=d+18,left:r>=378,right:t>=378},s=e.preferredPlacement,o=["right","left","bottom","top"],u=function(e,t,r,i,n){switch(e){case"right":return{left:t.right+18,top:a(t.to
3p+t.height/2-r/2,16,n-r-16)};case"left":return{left:t.left-360-18,top:a(t.top+t.height/2-r/2,16,n-r-16)};case"bottom":return{top:t.bottom+18,left:a(t.left+t.width/2-180,16,i-360-16)};default:return{top:t.top-r-18,left:a(t.left+t.width/2-180,16,i-360-16)}}}((s?[s,...o.filter(e=>e!==s)]:o).find(e=>n[e])||"top",l,d,p,y);_=a(u.left,16,p-360-16),v=a(u.top,16,y-d-16),Number.isFinite(_)&&Number.isFinite(v)||(_=a(l.left+l.width/2-180,16,p-360-16),v=a(l.top-d-18,16,y-d-16))}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:`pointer-events-none fixed inset-0 z-40 ${g?"bg-foreground/40 backdrop-blur-sm":""}`}),b&&(0,t.jsx)("div",{className:"pointer-events-none fixed z-50 rounded-2xl border-2 mix-blend-difference shadow-md transition-all duration-300",style:{top:l.top-6,left:l.left-6,width:l.width+12,height:l.height+12}}),(0,t.jsxs)("div",{ref:f,className:"fixed z-[60] w-[360px] max-w-[calc(100vw-2rem)] rounded-2xl bg-card p-5 shadow-2xl",style:{top:v,left:_},children:[(0,t.jsxs)("div",{className:"mb-3 flex items-start justify-between gap-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-foreground",children:u(e.titleKey)}),(0,t.jsx)("button",{onClick:o,className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground transition-colors hover:text-foreground",children:u(e.isTerminal?"common.close":"common.skip")})]}),(0,t.jsx)("p",{className:"text-sm leading-6 text-muted-foreground",children:u(e.bodyKey)}),e.showSampleScript&&(0,t.jsxs)("div",{className:"mt-4 rounded-xl bg-muted p-3",children:[(0,t.jsx)("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u("scribe.sample_script_label")}),(0,t.jsx)("div",{className:"text-sm leading-6 text-foreground",children:u("scribe.sample_script_value")})]}),!e.isTerminal&&e.continueEventType&&(0,t.jsx)("div",{className:"mt-4 flex justify-end",children:(0,t.jsx)("button",{onClick:()=>(0,r.emitTutorialEvent)(e.continueEventType),className:"button-secondary",children:u(e.continueLabelKey||"common.next")})})]})]})}let o="welcome",u="dashboard_record",l="template",c="prescription",d="start_recording",h="notes",f="recording_details",m="patient_review",p="generated_document_tab",y="view_document",b="document_preview",g="go_to_submit_stage",_="submit_stage",v="insurance_teaser",E=[{id:o,titleKey:"scribe.welcome_title",bodyKey:"scribe.welcome_body",continueEventType:r.TUTORIAL_EVENTS.SCRIBE_WELCOME_CONTINUE,continueLabelKey:"common.next",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_WELCOME_CONTINUE]},{id:u,titleKey:"scribe.dashboard_record_title",bodyKey:"scribe.dashboard_record_body",selector:"#tutorial-dashboard-record-new-patient",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_DASHBOARD_RECORD_NEW_PATIENT]},{id:l,titleKey:"scribe.template_title",bodyKey:"scribe.template_body",selector:"#clinical-template-selector",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_TEMPLATE_SELECTED]},{id:c,titleKey:"scribe.prescription_title",bodyKey:"scribe.prescription_body",selector:"#tutorial-generate-prescription-toggle",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_PRESCRIPTION_DECIDED]},{id:d,titleKey:"scribe.start_recording_title",bodyKey:"scribe.start_recording_body",selector:"#tutorial-start-recording-button",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_RECORDING_STARTED],showSampleScript:!1},{id:h,titleKey:"scribe.notes_title",bodyKey:"scribe.notes_body",selector:"#tutorial-recorder-notes",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_NOTES_INTERACTED],advanceWhen:e=>e.secondsElapsed>=20},{id:f,titleKey:"scribe.patient_details_title",bodyKey:"scribe.patient_details_body",selector:"#tutorial-recorder",preferredPlacement:"top",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_FINISH_RECORDING],showSampleScript:!0},{id:m,titleKey:"scribe.patient_review_title",bodyKey:"scribe.patient_review_body",selector:"#tutorial-recorder-tab-patient",preferredPlacement:"top",continueEventType:r.TUTORIAL_EVENTS.SCRIBE_PATIENT_REVIEW_CONTINUE,continueLabelKey:"common.next",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_PATIENT_REVIEW_CONTINUE]},{id:p,titleKey:"scribe.generated_document_tab_title",bodyKey:"scribe.generated_document_tab_body",selector:"#tutorial-recorder-tab-documents",preferredPlacement:"top",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_DOCUMENTS_TAB_OPENED]},{id:y,titleKey:"scribe.view_document_title",bodyKey:"scribe.view_document_body",selector:"#tutorial-view-document-button",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_DOCUMENT_OPENED]},{id:b,titleKey:"scribe.document_preview_title",bodyKey:"scribe.document_preview_body",selector:"#tutorial-close-full-document-preview",preferredPlacement:"bottom",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_DOCUMENT_PREVIEW_CLOSED]},{id:g,titleKey:"scribe.go_to_submit_stage_title",bodyKey:"scribe.go_to_submit_stage_body",selector:"#tutorial-after-recording-next",advanceOnEvent:[r.TUTORIAL_EVENTS.SCRIBE_AFT
3ER_RECORDING_NEXT]},{id:_,titleKey:"scribe.submit_stage_title",bodyKey:"scribe.submit_stage_body",selector:"#tutorial-submit-document-stage",advanceWhen:e=>"/dashboard"===e.pathname&&!e.displayScribe},{id:v,titleKey:"scribe.insurance_teaser_title",bodyKey:"scribe.insurance_teaser_body",selector:"#tutorial-dashboard-fill-insurance",isTerminal:!0}];var w=e.i(37194),C=e.i(36880),T=e.i(3828);e.i(15426);var S=e.i(86855),x=e.i(1877);let A=(0,n.createContext)({isActive:!1,startScribeTutorial:()=>{},closeTutorial:()=>{}});e.s(["TutorialProvider",0,function({children:e}){let i=(0,T.useRouter)(),a=(0,w.useIsMobile)(),{docData:O,updateDoctorFields:R}=(0,x.useAuth)(),{displayScribe:I,scribePhase:M,targetPatient:P,patientDraft:D,fileToUpload:N,uploadState:j,secondsElapsed:q}=(0,S.useScribe)(),[k,L]=(0,n.useState)(null),[K,B]=(0,n.useState)(0),[F,Q]=(0,n.useState)(null),U=(0,n.useMemo)(()=>({pathname:i.pathname,displayScribe:I,scribePhase:M,targetPatient:P,patientDraft:D,fileToUpload:N,uploadState:j,secondsElapsed:q}),[I,N,D,M,i.pathname,q,P,j]),V="scribe"===k?E:[],G=V[K]||null,$=!!G&&function(e,t){let{pathname:r,displayScribe:i,scribePhase:n,targetPatient:a,patientDraft:s,fileToUpload:E,uploadState:w}=t;switch(e){case o:case u:return"/dashboard"===r&&!i;case l:case c:case d:return"/dashboard"===r&&i&&"BeforeRecording"===n&&null===a;case h:case f:return"/dashboard"===r&&i&&"DuringRecording"===n;case m:return"/dashboard"===r&&i&&"AfterRecording"===n&&!!s;case p:case y:case g:return"/dashboard"===r&&i&&"AfterRecording"===n&&"Generated Document"===w&&!!E;case b:return"/dashboard"===r&&i&&!!E;case _:return"/dashboard"===r&&i&&"Submit Document"===n;case v:return"/dashboard"===r&&!i;default:return!1}}(G.id,U),W=(0,n.useCallback)(e=>{if("function"!=typeof e||!R)return;let t=new Date().toISOString(),r=(0,C.getScribeTutorialState)(O),i={...r,...e(r,t),version:C.SCRIBE_TUTORIAL_VERSION};R((0,C.buildScribeTutorialFieldUpdates)(i))},[O,R]),H=(0,n.useCallback)(()=>{if("scribe"===k){let e=!!G?.isTerminal;W((t,r)=>"complete"!==t.status||e?{status:e?"complete":"dismissed",completedAt:e?r:t.completedAt,dismissedAt:e?null:r,lastStepId:G?.id||t.lastStepId}:{lastStepId:G?.id||t.lastStepId})}L(null),B(0),Q(null)},[k,G?.id,G?.isTerminal,W]),z=(0,n.useCallback)(()=>{a||(W((e,t)=>({status:"complete"===e.status?"complete":"in_progress",startedAt:e.startedAt||t,dismissedAt:"complete"===e.status?e.dismissedAt:null,lastShownAt:t,lastStepId:E[0]?.id||e.lastStepId,timesShown:(e.timesShown||0)+1})),L("scribe"),B(0),Q(null))},[a,W]);(0,n.useEffect)(()=>{let e=0,t=t=>{e+=1,Q({type:t.detail?.type||"",sequence:e})};return window.addEventListener(r.TUTORIAL_EVENT_NAME,t),()=>{window.removeEventListener(r.TUTORIAL_EVENT_NAME,t)}},[]),(0,n.useEffect)(()=>{G&&!G.isTerminal&&G&&(F&&Array.isArray(G.advanceOnEvent)&&G.advanceOnEvent.includes(F.type)||"function"==typeof G.advanceWhen&&G.advanceWhen(U))&&(Q(null),B(e=>{let t=e+1;return t>=V.length?e:t}))},[G,F,V.length,U]),(0,n.useEffect)(()=>{"scribe"===k&&G&&W(e=>({lastStepId:G.id,status:"complete"===e.status?"complete":"in_progress"}))},[k,G,W]);let X=(0,n.useMemo)(()=>({isActive:!!k,startScribeTutorial:z,closeTutorial:H,emitTutorialEvent:r.emitTutorialEvent}),[k,H,z]);return(0,t.jsxs)(A.Provider,{value:X,children:[e,!!k&&$&&(0,t.jsx)(s,{step:G,onClose:H})]})},"useTutorial",0,function(){return(0,n.useContext)(A)}],26880)},62302,e=>{"use strict";var t=e.i(50461),r=e.i(91398);e.i(15426);var i=e.i(86855),n=e.i(1877),a=e.i(62129),s=e.i(37194),o=e.i(18660),u=e.i(3828),l=e.i(91788);let c=["keydown","mousedown","pointerdown","scroll","touchstart"],d=new Set(["/login","/signup","/forgot-password","/auth/action","/terms-consent","/insurance","/embed/session-expired"]);function h(){let{isRegistered:e,loading:t,user:r}=(0,n.useAuth)(),h=(0,s.useIsMobile)(),{isRecoveringTranscription:f,scribePhase:m,uploadState:p}=(0,i.useScribe)(),y=(0,u.useRouter)(),b=(0,l.useRef)(Date.now()),g=(0,l.useRef)(!1),_=(0,l.useRef)(null),v=(0,l.useRef)(!1),E=(0,l.useMemo)(()=>!!(m===o.RECORDING_STATES.DURING_RECORDING||p===o.UPLOAD_STATES.TRANSCRIBING||p===o.UPLOAD_STATES.GENERATING_DOCUMENT||f),[f,m,p]),w=(0,l.useMemo)(()=>!h&&!t&&e&&!d.has(y.pathname),[h,e,t,y.pathname]),C=(0,l.useCallback)(()=>{null!==_.current&&(window.clearTimeout(_.current),_.current=null)},[]),T=(0,l.useCallback)(async()=>
3{if(!g.current){g.current=!0,C();try{await (0,a.logout)()}catch(e){console.error("Failed to log out after inactivity:",e)}finally{if(y.pathname.startsWith("/embed/")){window.parent!==window&&window.parent.postMessage({source:"kadu",type:"kadu.session.expired",payload:{reason:"inactive"}},"*"),"/embed/session-expired"!==y.pathname&&await y.replace("/embed/session-expired?reason=inactive");return}"/login"!==y.pathname&&await y.replace("/login?reason=inactive")}}},[C,y]),S=(0,l.useCallback)(()=>{if(C(),!w||g.current)return;let e=Math.max(18e5-(Date.now()-b.current),0);_.current=window.setTimeout(()=>{E||T()},e)},[C,w,E,T]);return(0,l.useEffect)(()=>{if(!w){v.current=!1,g.current=!1,b.current=Date.now(),C();return}v.current||(b.current=Date.now(),g.current=!1,v.current=!0)},[C,w]),(0,l.useEffect)(()=>{if(!w)return;let e=()=>{b.current=Date.now(),S()};return c.forEach(t=>{window.addEventListener(t,e,{passive:!0})}),S(),()=>{c.forEach(t=>{window.removeEventListener(t,e)}),C()}},[C,w,S]),(0,l.useEffect)(()=>{if(!w||g.current)return;let e=Date.now()-b.current;!E&&e>=18e5?T():S()},[E,w,T,S]),null}var f=e.i(99358),m=e.i(16139),p=e.i(74274),p=p,y=p,b=e.i(94182);function g({GA_MEASUREMENT_ID:e,GOOGLE_ADS_ID:t}){let i=e||t;return i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.default,{strategy:"afterInteractive",src:`https://www.googletagmanager.com/gtag/js?id=${i}`}),(0,r.jsx)(b.default,{id:"google-analytics",strategy:"afterInteractive",dangerouslySetInnerHTML:{__html:` 4 window.dataLayer = window.dataLayer || []; 5 function gtag(){dataLayer.push(arguments);} 6 gtag('js', new Date()); 7 ${e?`gtag('config', '${e}', { 8 page_title: document.title, 9 page_location: window.location.href, 10 });`:""} 11 ${t?`gtag('config', '${t}');`:""} 12 `}})]}):null}var _=e.i(61560),v=e.i(96887),E=e.i(26880),w=e.i(48214),C=e.i(68489);e.i(64157);var T=e.i(88644),S=e.i(47811),x=e.i(5205),A=e.i(69796),O=e.i(77507),R=e.i(36880),I=e.i(71179);function M({children:e}){let{user:t,docData:r}=(0,n.useAuth)(),i=(0,s.useIsMobile)(),{t:a}=(0,I.useTranslation)(),o=(0,u.useRouter)(),c=(0,l.useCallback)(()=>{O.toast.info(a("toast:complete_profile_noti"),{toastId:"completeProfile-pending",autoClose:!1,closeOnClick:!1,onClick:()=>o.push("/settings/profile")})},[o,a]);return(0,l.useEffect)(()=>{if(!t||i||!r)return void O.toast.dismiss("completeProfile-pending");let{firstName:e,lastName:n,plan:a}=r;(0,R.shouldAutoStartScribeTutorial)(r,"/dashboard")||e&&n||!a?O.toast.dismiss("completeProfile-pending"):c()},[r,i,c,t]),e}var P=e.i(69479),D=e.i(56298),N=e.i(79971),j=e.i(65235),q=e.i(90140),k=e.i(95564),L=e.i(51415),K=e.i(71585),B=class extends K.Removable{#e;#t;#r;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#i?.continue()??("pending"===this.state.status?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#n({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},i=this.#i=(0,L.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#n({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)}),n="pending"===this.state.status,a=!i.canStart();try{if(n)t();else{this.#n({type:"pending",variables:e,isPaused:a}),this.#r.config.onMutate&&await this.#r.config.onMutate(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#n({type:"pending",context:t,variables:e,isPaused:a})}let s=await i.start();return await this.#r.config.onSuccess?.(s,e,this.state.context,this,r),await this.options.onSuccess?.(s,e,this.state.context,r),await this.#r.config.onSettled?.(s,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(s,null,e,this.state.context,r),this.#n({type:"success",data:s}),s}catch(t){try{await this.#r.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#n({type:"error",error:t}),t}finally{this.#i===i&&(this.#i=void 0),this.#r.runNext(this)}}#n(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};
vendor: 1,406 bytes, line 12
12case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),j.notifyManager.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}},F=class extends k.Subscribable{#a;#s;#o;constructor(e={}){super(),this.config=e,this.#a=new Set,this.#s=new Map,this.#o=0}build(e,t,r){let i=new B({client:e,mutationCache:this,mutationId:++this.#o,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){this.#a.add(e);let t=Q(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#a.delete(e)){let t=Q(e);if("string"==typeof t){let r=this.#s.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=Q(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t)?.find(e=>"pending"===e.state.status);return!r||r===e}}runNext(e){let t=Q(e);return"string"==typeof t?this.#s.get(t)?.find(t=>
12t!==e&&t.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){j.notifyManager.batch(()=>{this.#a.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#a.clear(),this.#s.clear()})}getAll(){return Array.from(this.#a)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,D.matchMutation)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,D.matchMutation)(e,t))}notify(e){j.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return j.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(D.noop))))}};function Q(e){return e.options.scope?.id}var U=k,V=e.i(84813),G=class extends U.Subscribable{#u;constructor(e={}){super(),this.config=e,this.#u=new Map}build(e,t,r){let i=t.queryKey,n=t.queryHash??(0,D.hashQueryKeyByOptions)(i,t),a=this.get(n);return a||(a=new V.Query({client:e,queryKey:i,queryHash:n,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){this.#u.has(e.queryHash)||(this.#u.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#u.get(e.queryHash);t&&(e.destroy(),t===e&&this.#u.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){j.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#u.get(e)}getAll(){return[...this.#u.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,D.matchQuery)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,D.matchQuery)(e,t)):t}notify(e){j.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){j.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){j.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$=class{#l;#r;#c;#d;#h;#f;#m;#p;constructor(e={}){this.#l=e.queryCache||new G,this.#r=e.mutationCache||new F,this.#c=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=N.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onFocus())}),this.#p=q.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#l.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#l.build(this,t),i=r.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,D.resolveQueryValue)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#l.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let i=this.defaultQueryOptions({queryKey:e}),n=this.#l.get(i.queryHash)?.state.data,a=(0,D.functionalUpdate)(t,n);if(void 0!==a)return this.#l.build(this,i).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return j.notifyManager.batch(()=>this.#l.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state}removeQueries(e){let t=this.#l;j.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#l;return j.notifyManager.batch(()=>{let i=r.findAll(e),n=new Set(i);return i.forEach(e=>{e.reset()}),this.refetchQueries({type:"active",predicate:e=>n.has(e)},t)})}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(j.notifyManager.batch(()=>this.#l.findAll(e).map(e=>e.cancel(r)))).then(D.noop).catch(D.noop)}invalidateQueries(e,t={}){return j.notifyManager.batch(()=>(this.#l.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(j.notifyManager.batch(()=>this.#l.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(D.noop)),"paused"===e.state.fetchStatus?Promise.resolve():t}
12))).then(D.noop)}async query(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t),i=r.isStaleByTime((0,D.resolveQueryValue)(t.staleTime,r))?await r.fetch(t):r.state.data,n=t.select;return n?n(i):i}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t);return r.isStaleByTime((0,D.resolveQueryValue)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(D.noop).catch(D.noop)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(D.noop).catch(D.noop)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return q.onlineManager.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#l}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,D.hashKey)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,D.partialMatchKey)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,D.hashKey)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,D.partialMatchKey)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,D.hashQueryKeyByOptions)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===D.skipToken&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#l.clear(),this.#r.clear()}},W=e.i(85700);let H=(0,C.default)(()=>e.A(37690),{loadableGenerated:{modules:[17900]},ssr:!1,loading:()=>null}),z="true"!==t.default.env.NEXT_PUBLIC_DISABLE_SESSION_TIMEOUT,X=new $;w.default.register(y.SCRIBE_SETUP_MODAL_ID,p.default);let Y=(0,T.appWithTranslation)(function({Component:e,pageProps:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.default,{children:(0,r.jsx)("title",{children:"Kadu Care"})}),(0,r.jsx)(g,{GA_MEASUREMENT_ID:t.default.env.NEXT_PUBLIC_GA_ID,GOOGLE_ADS_ID:"AW-18074898310"}),(0,r.jsx)(A.SkeletonTheme,{baseColor:"var(--muted)",highlightColor:"var(--card)",children:(0,r.jsx)(W.QueryClientProvider,{client:X,children:(0,r.jsx)(n.AuthProvider,{children:(0,r.jsx)(_.AccessProvider,{children:(0,r.jsx)(v.CopilotProvider,{children:(0,r.jsxs)(f.ScribeProvider,{children:[(0,r.jsx)(m.ScribePrewarmer,{}),(0,r.jsxs)(E.TutorialProvider,{children:[z&&(0,r.jsx)(h,{}),(0,r.jsx)(M,{}),(0,r.jsx)(O.ToastContainer,{autoClose:1e3,hideProgressBar:!0,limit:1,transition:O.Zoom}),(0,r.jsx)(P.TooltipProvider,{children:(0,r.jsxs)(w.default.Provider,{children:[(0,r.jsx)(e,{...i}),(0,r.jsx)(H,{})]})})]})]})})})})})})]})},S.default);e.s(["default",0,Y],62302)},88709,(e,t,r)=>{let i="/_app";(window.__NEXT_P=window.__NEXT_P||[]).push([i,()=>e.r(62302)]),t.hot&&t.hot.dispose(function(){window.__NEXT_P.push([i])})}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.