From 28f3515887a6f154d258f457df8df9f3c3be32bc Mon Sep 17 00:00:00 2001 From: Softjey Date: Tue, 11 Jun 2024 14:52:05 +0200 Subject: [PATCH] Updates --- assets/{index-TbaCBTwo.js => index-BJ20VCno.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-TbaCBTwo.js => index-BJ20VCno.js} (98%) diff --git a/assets/index-TbaCBTwo.js b/assets/index-BJ20VCno.js similarity index 98% rename from assets/index-TbaCBTwo.js rename to assets/index-BJ20VCno.js index 7166447..c50ccda 100644 --- a/assets/index-TbaCBTwo.js +++ b/assets/index-BJ20VCno.js @@ -134,4 +134,4 @@ Error generating stack: `+i.message+` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[k0]=this[k0]={accessors:{}}).accessors,o=this.prototype;function i(l){const a=ol(l);r[a]||(uN(o,l),r[a]=!0)}return U.isArray(t)?t.forEach(i):i(t),this}}Zu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);U.reduceDescriptors(Zu.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});U.freezeMethods(Zu);const Qn=Zu;function dd(e,t){const n=this||tm,r=t||n,o=Qn.from(r.headers);let i=r.data;return U.forEach(e,function(a){i=a.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function QS(e){return!!(e&&e.__CANCEL__)}function ca(e,t,n){ye.call(this,e??"canceled",ye.ERR_CANCELED,t,n),this.name="CanceledError"}U.inherits(ca,ye,{__CANCEL__:!0});function cN(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new ye("Request failed with status code "+n.status,[ye.ERR_BAD_REQUEST,ye.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const dN=Rn.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const l=[e+"="+encodeURIComponent(t)];U.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),U.isString(r)&&l.push("path="+r),U.isString(o)&&l.push("domain="+o),i===!0&&l.push("secure"),document.cookie=l.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function fN(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function pN(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function JS(e,t){return e&&!fN(t)?pN(e,t):t}const hN=Rn.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(i){let l=i;return t&&(n.setAttribute("href",l),l=n.href),n.setAttribute("href",l),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(l){const a=U.isString(l)?o(l):l;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function mN(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function gN(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,l;return t=t!==void 0?t:1e3,function(s){const u=Date.now(),c=r[i];l||(l=u),n[o]=s,r[o]=u;let d=i,f=0;for(;d!==o;)f+=n[d++],d=d%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-l{const i=o.loaded,l=o.lengthComputable?o.total:void 0,a=i-n,s=r(a),u=i<=l;n=i;const c={loaded:i,total:l,progress:l?i/l:void 0,bytes:a,rate:s||void 0,estimated:s&&l&&u?(l-i)/s:void 0,event:o};c[t?"download":"upload"]=!0,e(c)}}const vN=typeof XMLHttpRequest<"u",yN=vN&&function(e){return new Promise(function(n,r){let o=e.data;const i=Qn.from(e.headers).normalize();let{responseType:l,withXSRFToken:a}=e,s;function u(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}let c;if(U.isFormData(o)){if(Rn.hasStandardBrowserEnv||Rn.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if((c=i.getContentType())!==!1){const[g,...x]=c?c.split(";").map(v=>v.trim()).filter(Boolean):[];i.setContentType([g||"multipart/form-data",...x].join("; "))}}let d=new XMLHttpRequest;if(e.auth){const g=e.auth.username||"",x=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(g+":"+x))}const f=JS(e.baseURL,e.url);d.open(e.method.toUpperCase(),GS(f,e.params,e.paramsSerializer),!0),d.timeout=e.timeout;function p(){if(!d)return;const g=Qn.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:g,config:e,request:d};cN(function(b){n(b),u()},function(b){r(b),u()},v),d=null}if("onloadend"in d?d.onloadend=p:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(p)},d.onabort=function(){d&&(r(new ye("Request aborted",ye.ECONNABORTED,e,d)),d=null)},d.onerror=function(){r(new ye("Network Error",ye.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const v=e.transitional||qS;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),r(new ye(x,v.clarifyTimeoutError?ye.ETIMEDOUT:ye.ECONNABORTED,e,d)),d=null},Rn.hasStandardBrowserEnv&&(a&&U.isFunction(a)&&(a=a(e)),a||a!==!1&&hN(f))){const g=e.xsrfHeaderName&&e.xsrfCookieName&&dN.read(e.xsrfCookieName);g&&i.set(e.xsrfHeaderName,g)}o===void 0&&i.setContentType(null),"setRequestHeader"in d&&U.forEach(i.toJSON(),function(x,v){d.setRequestHeader(v,x)}),U.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),l&&l!=="json"&&(d.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&d.addEventListener("progress",T0(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",T0(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=g=>{d&&(r(!g||g.type?new ca(null,e,d):g),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const m=mN(f);if(m&&Rn.protocols.indexOf(m)===-1){r(new ye("Unsupported protocol "+m+":",ye.ERR_BAD_REQUEST,e));return}d.send(o||null)})},np={http:KA,xhr:yN};U.forEach(np,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const D0=e=>`- ${e}`,bN=e=>U.isFunction(e)||e===null||e===!1,ZS={getAdapter:e=>{e=U.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i`adapter ${a} `+(s===!1?"is not supported by the environment":"is not available in the build"));let l=t?i.length>1?`since : `+i.map(D0).join(` `):" "+D0(i[0]):"as no adapter specified";throw new ye("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return r},adapters:np};function fd(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ca(null,e)}function M0(e){return fd(e),e.headers=Qn.from(e.headers),e.data=dd.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ZS.getAdapter(e.adapter||tm.adapter)(e).then(function(r){return fd(e),r.data=dd.call(e,e.transformResponse,r),r.headers=Qn.from(r.headers),r},function(r){return QS(r)||(fd(e),r&&r.response&&(r.response.data=dd.call(e,e.transformResponse,r.response),r.response.headers=Qn.from(r.response.headers))),Promise.reject(r)})}const R0=e=>e instanceof Qn?{...e}:e;function Pi(e,t){t=t||{};const n={};function r(u,c,d){return U.isPlainObject(u)&&U.isPlainObject(c)?U.merge.call({caseless:d},u,c):U.isPlainObject(c)?U.merge({},c):U.isArray(c)?c.slice():c}function o(u,c,d){if(U.isUndefined(c)){if(!U.isUndefined(u))return r(void 0,u,d)}else return r(u,c,d)}function i(u,c){if(!U.isUndefined(c))return r(void 0,c)}function l(u,c){if(U.isUndefined(c)){if(!U.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function a(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const s={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:a,headers:(u,c)=>o(R0(u),R0(c),!0)};return U.forEach(Object.keys(Object.assign({},e,t)),function(c){const d=s[c]||o,f=d(e[c],t[c],c);U.isUndefined(f)&&d!==a||(n[c]=f)}),n}const e$="1.6.8",nm={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{nm[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const A0={};nm.transitional=function(t,n,r){function o(i,l){return"[Axios v"+e$+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,a)=>{if(t===!1)throw new ye(o(l," has been removed"+(n?" in "+n:"")),ye.ERR_DEPRECATED);return n&&!A0[l]&&(A0[l]=!0,console.warn(o(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,l,a):!0}};function xN(e,t,n){if(typeof e!="object")throw new ye("options must be an object",ye.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],l=t[i];if(l){const a=e[i],s=a===void 0||l(a,i,e);if(s!==!0)throw new ye("option "+i+" must be "+s,ye.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ye("Unknown option "+i,ye.ERR_BAD_OPTION)}}const rp={assertOptions:xN,validators:nm},sr=rp.validators;class fu{constructor(t){this.defaults=t,this.interceptors={request:new P0,response:new P0}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Pi(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&rp.assertOptions(r,{silentJSONParsing:sr.transitional(sr.boolean),forcedJSONParsing:sr.transitional(sr.boolean),clarifyTimeoutError:sr.transitional(sr.boolean)},!1),o!=null&&(U.isFunction(o)?n.paramsSerializer={serialize:o}:rp.assertOptions(o,{encode:sr.function,serialize:sr.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&U.merge(i.common,i[n.method]);i&&U.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=Qn.concat(l,i);const a=[];let s=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(s=s&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let c,d=0,f;if(!s){const m=[M0.bind(this),void 0];for(m.unshift.apply(m,a),m.push.apply(m,u),f=m.length,c=Promise.resolve(n);d{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const l=new Promise(a=>{r.subscribe(a),i=a}).then(o);return l.cancel=function(){r.unsubscribe(i)},l},t(function(i,l,a){r.reason||(r.reason=new ca(i,l,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new rm(function(o){t=o}),cancel:t}}}const wN=rm;function SN(e){return function(n){return e.apply(null,n)}}function $N(e){return U.isObject(e)&&e.isAxiosError===!0}const op={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(op).forEach(([e,t])=>{op[t]=e});const CN=op;function t$(e){const t=new gs(e),n=FS(gs.prototype.request,t);return U.extend(n,gs.prototype,t,{allOwnKeys:!0}),U.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return t$(Pi(e,o))},n}const Ge=t$(tm);Ge.Axios=gs;Ge.CanceledError=ca;Ge.CancelToken=wN;Ge.isCancel=QS;Ge.VERSION=e$;Ge.toFormData=Ju;Ge.AxiosError=ye;Ge.Cancel=Ge.CanceledError;Ge.all=function(t){return Promise.all(t)};Ge.spread=SN;Ge.isAxiosError=$N;Ge.mergeConfig=Pi;Ge.AxiosHeaders=Qn;Ge.formToJSON=e=>XS(U.isHTMLForm(e)?new FormData(e):e);Ge.getAdapter=ZS.getAdapter;Ge.HttpStatusCode=CN;Ge.default=Ge;const om="https://hackathon-production-ec4e.up.railway.app",EN=async e=>{const t=await Ge.post(`${om}/consultation/start`,{patientComplaint:e});return localStorage.setItem("consultationId",t.data.consultationId),t.data},PN=async e=>{console.log(e);const t=localStorage.getItem("consultationId");return(await Ge.post(`${om}/consultation/answer`,{answers:e,consultationId:t})).data},kN=async()=>{const e=localStorage.getItem("consultationId"),{data:t}=await Ge.get(`${om}/consultation/result?consultationId=${e}`);return t},TN=e=>C.jsx(Fn,{...e,isIconOnly:!0,children:C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}),N0=({inputValue:e,setInputValue:t,setValue:n})=>C.jsxs("div",{className:"flex gap-2",children:[C.jsx(Uf,{value:e,onChange:r=>t(r.currentTarget.value),type:"text",placeholder:"Add yours"}),C.jsx(TN,{onClick:()=>{e!==""&&(n(r=>[...r,e]),t(""))}})]}),DN=({initialDiagnoses:e,initialDoctors:t})=>{const[n,r]=h.useState(e),[o,i]=h.useState(t),[l,a]=h.useState(""),[s,u]=h.useState("");return C.jsx(lw,{children:C.jsxs(rw,{className:"flex flex-row justify-evenly suggestions-card-body",children:[C.jsxs(Ov,{label:"Possible diagnoses",children:[n.map(c=>C.jsx(_v,{value:c,children:c})),C.jsx(N0,{inputValue:l,setInputValue:a,setValue:r})]}),C.jsxs(Ov,{label:"Doctor suggestions",children:[o.map(c=>C.jsx(_v,{value:c,children:c})),C.jsx(N0,{inputValue:s,setInputValue:u,setValue:i})]})]})})},MN=({results:e})=>{const{user:t}=h.useContext(Qh);return C.jsxs(wM,{topContent:C.jsxs("span",{children:[(t==null?void 0:t.name)??"Your consultation results",":"]}),"aria-label":"Results of diagnoses",isStriped:!0,hideHeader:!0,className:"text-black text-left results-table",children:[C.jsxs(DM,{children:[C.jsx(t0,{children:"Name"}),C.jsx(t0,{children:t==null?void 0:t.name})]}),C.jsx(EM,{children:Object.entries(e.results).map(([n,r])=>C.jsxs($M,{children:[C.jsx(e0,{children:n}),C.jsx(e0,{children:r})]},n))})]})},n$=({children:e,...t})=>{const[n,r]=h.useState(!1),o=se.Children.map(e,i=>se.cloneElement(i,{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1)}));return C.jsxs(L8,{isOpen:n,onOpenChange:r,color:"warning",showArrow:!0,...t,children:[C.jsx(F8,{children:C.jsx("div",{children:o})}),C.jsx(I8,{children:C.jsx("div",{className:"px-1 py-2",children:C.jsx("div",{className:"text-tiny",children:"This feature will be available soon"})})})]})},RN=()=>{const[e,t]=h.useState(null);return h.useEffect(()=>{kN().then(t)},[]),e?C.jsxs(C.Fragment,{children:[C.jsx(du,{}),C.jsx("div",{className:"flex flex-col gap-5 mt-10 min-w-[50vw] max-w-[1000px]",children:C.jsxs(C.Fragment,{children:[C.jsx("h1",{className:"text-primary font-medium",style:{fontSize:"clamp(3rem, 10vw ,6rem)"},children:"Results"}),C.jsx(MN,{results:e}),C.jsx(DN,{initialDiagnoses:e.diagnosis,initialDoctors:e.doctors}),C.jsxs("div",{className:"flex justify-around",children:[C.jsx(Fn,{as:eA,to:"/",children:"Go to home"}),C.jsx(n$,{children:C.jsx(Fn,{color:"success",children:"Send results to the doctor"})})]})]})})]}):C.jsxs(C.Fragment,{children:[C.jsx(du,{}),C.jsx(bw,{size:"lg"})]})};function AN(){const e=sa();return C.jsxs("div",{className:"flex flex-col items-center justify-center h-screen text-center",children:[C.jsx("h1",{className:"text-6xl font-bold",children:"404"}),C.jsx("h2",{className:"text-4xl text-gray-600",children:"Page Not Found"}),C.jsx("p",{className:"mb-5 mt-5 text-gray-800",children:"The page you're looking for doesn't exist."}),C.jsx(Fn,{color:"default",className:"mt-4",onClick:()=>e("/"),children:"Go Home"})]})}const NN=e=>C.jsx(Fn,{color:"secondary",isIconOnly:!0,...e,children:C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:C.jsx("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})})}),IN=h.forwardRef((e,t)=>C.jsx(Fn,{color:"primary",isIconOnly:!0,ref:t,...e,children:C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:[C.jsx("path",{d:"M8.25 4.5a3.75 3.75 0 1 1 7.5 0v8.25a3.75 3.75 0 1 1-7.5 0V4.5Z"}),C.jsx("path",{d:"M6 10.5a.75.75 0 0 1 .75.75v1.5a5.25 5.25 0 1 0 10.5 0v-1.5a.75.75 0 0 1 1.5 0v1.5a6.751 6.751 0 0 1-6 6.709v2.291h3a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1 0-1.5h3v-2.291a6.751 6.751 0 0 1-6-6.709v-1.5A.75.75 0 0 1 6 10.5Z"})]})})),FN=({classnames:e,disabled:t,value:n,setValue:r,onSubmit:o,isInvalid:i,errorMessage:l})=>{const a=`flex justify-center items-end gap-3 relative ${e??""}`;return C.jsxs("div",{className:a,children:[C.jsx(GD,{color:i?"danger":"default",isDisabled:t,onChange:s=>r(s.currentTarget.value),placeholder:i?l:"Try to be more precise",minRows:1,value:n,onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),o())}}),C.jsx(n$,{placement:"bottom",children:C.jsx(IN,{})}),C.jsx(NN,{isDisabled:t,onClick:o})]})},LN=({questionText:e})=>C.jsxs(lw,{shadow:"none",className:"mb-3 bg-zinc-100 pdb-[15px] text-[#000000a4]",children:[C.jsx(eD,{className:"pb-0",children:"Question"}),C.jsx(rw,{className:"pb-8 px-8",children:C.jsx("p",{style:{fontSize:"clamp(1.25rem, 5vw, 1.875rem)"},className:"text-center max-w-[600px]",children:e})})]});function BN(){const[e,t]=h.useState(!1),[n,r]=h.useState("");function o(i){return t(!0),r(""),i.catch(l=>{var a;throw r(((a=l==null?void 0:l.response)==null?void 0:a.data.message)||"An error occurred"),new Error(l)}).finally(()=>t(!1))}return[o,e,n]}const ON=()=>{const[e,t,n]=BN(),[r,o]=h.useState(""),[i,l]=h.useState([]),[a,s]=h.useState(0),[u,c]=h.useState([]),[d,f]=h.useState(!0),p=sa(),m=()=>{const x=EN(r).then(({questions:v})=>{l(v),f(!1),o("")});e(x)},g=()=>{const x=r.trim(),v=i[a].id,y=[...u,{answer:x,questionId:v}];if(a+1$+1),c(y),o("");return}const b=PN(y).then(({questions:$,status:E})=>{E==="ended"&&p("/results"),l($),c([]),s(0),o("")});e(b)};return C.jsxs(C.Fragment,{children:[C.jsx(du,{}),C.jsxs("div",{className:"flex flex-col consultation-container w-full",children:[t&&C.jsx("div",{className:"flex justify-center mb-20",children:C.jsx(bw,{size:"lg"})}),!t&&d&&C.jsx("h1",{style:{fontSize:"clamp(1.5rem, 5vw, 3.75rem)"},className:"font-medium mb-6 text-wrap",children:"Describe your problem"}),!t&&!d&&C.jsx(LN,{questionText:i[a].text}),C.jsx(FN,{errorMessage:`Error: ${n}`,isInvalid:!!n,classnames:"input-bar",disabled:t,onSubmit:d?m:g,value:r,setValue:x=>o(x)})]})]})},_N=jR([{path:"",element:C.jsx(oA,{})},{path:"login",element:C.jsx(sA,{})},{path:"consultation",element:C.jsx(ON,{})},{path:"results",element:C.jsx(RN,{})},{path:"*",element:C.jsx(AN,{})}]);pd.createRoot(document.getElementById("root")).render(C.jsx(se.StrictMode,{children:C.jsx(bP,{children:C.jsx(lA,{children:C.jsx(XR,{router:_N})})})})); +`+i):r.stack=i}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Pi(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&rp.assertOptions(r,{silentJSONParsing:sr.transitional(sr.boolean),forcedJSONParsing:sr.transitional(sr.boolean),clarifyTimeoutError:sr.transitional(sr.boolean)},!1),o!=null&&(U.isFunction(o)?n.paramsSerializer={serialize:o}:rp.assertOptions(o,{encode:sr.function,serialize:sr.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&U.merge(i.common,i[n.method]);i&&U.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=Qn.concat(l,i);const a=[];let s=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(s=s&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let c,d=0,f;if(!s){const m=[M0.bind(this),void 0];for(m.unshift.apply(m,a),m.push.apply(m,u),f=m.length,c=Promise.resolve(n);d{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const l=new Promise(a=>{r.subscribe(a),i=a}).then(o);return l.cancel=function(){r.unsubscribe(i)},l},t(function(i,l,a){r.reason||(r.reason=new ca(i,l,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new rm(function(o){t=o}),cancel:t}}}const wN=rm;function SN(e){return function(n){return e.apply(null,n)}}function $N(e){return U.isObject(e)&&e.isAxiosError===!0}const op={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(op).forEach(([e,t])=>{op[t]=e});const CN=op;function t$(e){const t=new gs(e),n=FS(gs.prototype.request,t);return U.extend(n,gs.prototype,t,{allOwnKeys:!0}),U.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return t$(Pi(e,o))},n}const Ge=t$(tm);Ge.Axios=gs;Ge.CanceledError=ca;Ge.CancelToken=wN;Ge.isCancel=QS;Ge.VERSION=e$;Ge.toFormData=Ju;Ge.AxiosError=ye;Ge.Cancel=Ge.CanceledError;Ge.all=function(t){return Promise.all(t)};Ge.spread=SN;Ge.isAxiosError=$N;Ge.mergeConfig=Pi;Ge.AxiosHeaders=Qn;Ge.formToJSON=e=>XS(U.isHTMLForm(e)?new FormData(e):e);Ge.getAdapter=ZS.getAdapter;Ge.HttpStatusCode=CN;Ge.default=Ge;const om="https://hackathon-production-ec4e.up.railway.app",EN=async e=>{const t=await Ge.post(`${om}/consultation/start`,{patientComplaint:e});return localStorage.setItem("consultationId",t.data.consultationId),t.data},PN=async e=>{const t=localStorage.getItem("consultationId");return(await Ge.post(`${om}/consultation/answer`,{answers:e,consultationId:t})).data},kN=async()=>{const e=localStorage.getItem("consultationId"),{data:t}=await Ge.get(`${om}/consultation/result?consultationId=${e}`);return t},TN=e=>C.jsx(Fn,{...e,isIconOnly:!0,children:C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}),N0=({inputValue:e,setInputValue:t,setValue:n})=>C.jsxs("div",{className:"flex gap-2",children:[C.jsx(Uf,{value:e,onChange:r=>t(r.currentTarget.value),type:"text",placeholder:"Add yours"}),C.jsx(TN,{onClick:()=>{e!==""&&(n(r=>[...r,e]),t(""))}})]}),DN=({initialDiagnoses:e,initialDoctors:t})=>{const[n,r]=h.useState(e),[o,i]=h.useState(t),[l,a]=h.useState(""),[s,u]=h.useState("");return C.jsx(lw,{children:C.jsxs(rw,{className:"flex flex-row justify-evenly suggestions-card-body",children:[C.jsxs(Ov,{label:"Possible diagnoses",children:[n.map(c=>C.jsx(_v,{value:c,children:c})),C.jsx(N0,{inputValue:l,setInputValue:a,setValue:r})]}),C.jsxs(Ov,{label:"Doctor suggestions",children:[o.map(c=>C.jsx(_v,{value:c,children:c})),C.jsx(N0,{inputValue:s,setInputValue:u,setValue:i})]})]})})},MN=({results:e})=>{const{user:t}=h.useContext(Qh);return C.jsxs(wM,{topContent:C.jsxs("span",{children:[(t==null?void 0:t.name)??"Your consultation results",":"]}),"aria-label":"Results of diagnoses",isStriped:!0,hideHeader:!0,className:"text-black text-left results-table",children:[C.jsxs(DM,{children:[C.jsx(t0,{children:"Name"}),C.jsx(t0,{children:t==null?void 0:t.name})]}),C.jsx(EM,{children:Object.entries(e.results).map(([n,r])=>C.jsxs($M,{children:[C.jsx(e0,{children:n}),C.jsx(e0,{children:r})]},n))})]})},n$=({children:e,...t})=>{const[n,r]=h.useState(!1),o=se.Children.map(e,i=>se.cloneElement(i,{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1)}));return C.jsxs(L8,{isOpen:n,onOpenChange:r,color:"warning",showArrow:!0,...t,children:[C.jsx(F8,{children:C.jsx("div",{children:o})}),C.jsx(I8,{children:C.jsx("div",{className:"px-1 py-2",children:C.jsx("div",{className:"text-tiny",children:"This feature will be available soon"})})})]})},RN=()=>{const[e,t]=h.useState(null);return h.useEffect(()=>{kN().then(t)},[]),e?C.jsxs(C.Fragment,{children:[C.jsx(du,{}),C.jsx("div",{className:"flex flex-col gap-5 mt-10 min-w-[50vw] max-w-[1000px]",children:C.jsxs(C.Fragment,{children:[C.jsx("h1",{className:"text-primary font-medium",style:{fontSize:"clamp(3rem, 10vw ,6rem)"},children:"Results"}),C.jsx(MN,{results:e}),C.jsx(DN,{initialDiagnoses:e.diagnosis,initialDoctors:e.doctors}),C.jsxs("div",{className:"flex justify-around",children:[C.jsx(Fn,{as:eA,to:"/",children:"Go to home"}),C.jsx(n$,{children:C.jsx(Fn,{color:"success",children:"Send results to the doctor"})})]})]})})]}):C.jsxs(C.Fragment,{children:[C.jsx(du,{}),C.jsx(bw,{size:"lg"})]})};function AN(){const e=sa();return C.jsxs("div",{className:"flex flex-col items-center justify-center h-screen text-center",children:[C.jsx("h1",{className:"text-6xl font-bold",children:"404"}),C.jsx("h2",{className:"text-4xl text-gray-600",children:"Page Not Found"}),C.jsx("p",{className:"mb-5 mt-5 text-gray-800",children:"The page you're looking for doesn't exist."}),C.jsx(Fn,{color:"default",className:"mt-4",onClick:()=>e("/"),children:"Go Home"})]})}const NN=e=>C.jsx(Fn,{color:"secondary",isIconOnly:!0,...e,children:C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:C.jsx("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})})}),IN=h.forwardRef((e,t)=>C.jsx(Fn,{color:"primary",isIconOnly:!0,ref:t,...e,children:C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:[C.jsx("path",{d:"M8.25 4.5a3.75 3.75 0 1 1 7.5 0v8.25a3.75 3.75 0 1 1-7.5 0V4.5Z"}),C.jsx("path",{d:"M6 10.5a.75.75 0 0 1 .75.75v1.5a5.25 5.25 0 1 0 10.5 0v-1.5a.75.75 0 0 1 1.5 0v1.5a6.751 6.751 0 0 1-6 6.709v2.291h3a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1 0-1.5h3v-2.291a6.751 6.751 0 0 1-6-6.709v-1.5A.75.75 0 0 1 6 10.5Z"})]})})),FN=({classnames:e,disabled:t,value:n,setValue:r,onSubmit:o,isInvalid:i,errorMessage:l})=>{const a=`flex justify-center items-end gap-3 relative ${e??""}`;return C.jsxs("div",{className:a,children:[C.jsx(GD,{color:i?"danger":"default",isDisabled:t,onChange:s=>r(s.currentTarget.value),placeholder:i?l:"Try to be more precise",minRows:1,value:n,onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),o())}}),C.jsx(n$,{placement:"bottom",children:C.jsx(IN,{})}),C.jsx(NN,{isDisabled:t,onClick:o})]})},LN=({questionText:e})=>C.jsxs(lw,{shadow:"none",className:"mb-3 bg-zinc-100 pdb-[15px] text-[#000000a4]",children:[C.jsx(eD,{className:"pb-0",children:"Question"}),C.jsx(rw,{className:"pb-8 px-8",children:C.jsx("p",{style:{fontSize:"clamp(1.25rem, 5vw, 1.875rem)"},className:"text-center max-w-[600px]",children:e})})]});function BN(){const[e,t]=h.useState(!1),[n,r]=h.useState("");function o(i){return t(!0),r(""),i.catch(l=>{var a;throw r(((a=l==null?void 0:l.response)==null?void 0:a.data.message)||"An error occurred"),new Error(l)}).finally(()=>t(!1))}return[o,e,n]}const ON=()=>{const[e,t,n]=BN(),[r,o]=h.useState(""),[i,l]=h.useState([]),[a,s]=h.useState(0),[u,c]=h.useState([]),[d,f]=h.useState(!0),p=sa(),m=()=>{const x=EN(r).then(({questions:v})=>{l(v),f(!1),o("")});e(x)},g=()=>{const x=r.trim(),v=i[a].id,y=[...u,{answer:x,questionId:v}];if(a+1$+1),c(y),o("");return}const b=PN(y).then(({questions:$,status:E})=>{E==="ended"&&p("/results"),l($),c([]),s(0),o("")});e(b)};return C.jsxs(C.Fragment,{children:[C.jsx(du,{}),C.jsxs("div",{className:"flex flex-col consultation-container w-full",children:[t&&C.jsx("div",{className:"flex justify-center mb-20",children:C.jsx(bw,{size:"lg"})}),!t&&d&&C.jsx("h1",{style:{fontSize:"clamp(1.5rem, 5vw, 3.75rem)"},className:"font-medium mb-6 text-wrap",children:"Describe your problem"}),!t&&!d&&C.jsx(LN,{questionText:i[a].text}),C.jsx(FN,{errorMessage:`Error: ${n}`,isInvalid:!!n,classnames:"input-bar",disabled:t,onSubmit:d?m:g,value:r,setValue:x=>o(x)})]})]})},_N=jR([{path:"",element:C.jsx(oA,{})},{path:"login",element:C.jsx(sA,{})},{path:"consultation",element:C.jsx(ON,{})},{path:"results",element:C.jsx(RN,{})},{path:"*",element:C.jsx(AN,{})}]);pd.createRoot(document.getElementById("root")).render(C.jsx(se.StrictMode,{children:C.jsx(bP,{children:C.jsx(lA,{children:C.jsx(XR,{router:_N})})})})); diff --git a/index.html b/index.html index e8cc2e4..b38423f 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ DiAIgnosis - +