1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46227],{17919:function(e,t,n){n.r(t);var a=n(85893),r=n(41664),s=n.n(r),i=n(25675),l=n.n(i),o=n(94055),c=n(63750),u=n(11163);t.default=e=>{let t=(0,u.useRouter)();return(0,a.jsxs)("div",{className:"eduapp-breadcrumb d-flex flex-wrap align-items-center",children:[!e.hideBackButton&&(0,a.jsx)(s(),{className:"eduapp-breadcrumb--back",href:e.url?e.url:"#",onClick:n=>{e.onBack?(n.preventDefault(),e.onBack()):(null==e?void 0:e.type)==="activity-back"?null==e||e.handleBack():(null==e?void 0:e.type)==="activity"&&t.back()},children:(0,a.jsx)("span",{className:"icon",children:(0,a.jsx)(l(),{src:"/images/icons/arrow-left.svg",width:24,height:24,alt:"back arrow"})})}),(0,a.jsx)("h4",{className:"eduapp-breadcrumb--title",children:e.title}),(null==e?void 0:e.title)=="Study section summary"&&(0,a.jsx)(o.default,{title:"Please note that the study section summary happens once a week.",children:(0,a.jsx)("span",{children:(0,a.jsx)(c.BsInfoCircleFill,{})})})]})}},48859:function(e,t,n){n.r(t);var a=n(85893),r=n(59324);n(21518),t.default=e=>{let{variant:t}=e;return(0,a.jsx)(r.Z,{variant:"inner-pages"})}},76961:function(e,t,n){n.r(t);var a=n(85893),r=n(33491),s=n(73192),i=n(38538),l=n(9473),o=n(83573);t.default=()=>{let{t:e}=(0,o.$G)("teacher.chat"),t=(0,l.I0)(),n=(0,l.v9)(e=>e.theme.chatTheme);return(0,a.jsx)("div",{className:"eduapp-theme-switch",children:(0,a.jsxs)(i.Z,{className:"eduapp-tab-switch d-inline-flex flex-wrap",activeKey:n,onSelect:e=>{"dark"===e?t((0,r.j)("dark")):t((0,r.j)("light"))},children:[(0,a.jsx)(s.Z,{eventKey:"light",title:e("light")}),(0,a.jsx)(s.Z,{eventKey:"dark",title:e("dark")})]})})}},33491:function(e,t,n){n.d(t,{j:function(){return a}});let a=e=>({type:"UPDATE_CHAT_THEME",payload:e})},10962:function(e,t,n){var a=n(85893),r=n(93292),s=n(67294);t.Z=e=>{let{subscriptionDetails:t,monthlySubscription:n,yearlySubscription:i,session:l,parentPagePath:o}=e,[c,u]=(0,s.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"eduapp-chatbotfeature--unlimited-chats",children:(0,a.jsxs)("div",{className:"eduapp-chat-pricing-card d-flex flex-wrap align-items-center justify-content-between",children:[(0,a.jsxs)("div",{className:"eduapp-chat-pricing-card--left",children:[(0,a.jsx)("h4",{className:"title",children:"Subscribe to academic premium for unlimited chats."}),(0,a.jsx)("div",{className:"description",children:"Premium features starts at â¹".concat((null==n?void 0:n.amount)?null==n?void 0:n.amount:"","!")})]}),(0,a.jsx)("div",{className:"eduapp-chat-pricing-card--right",children:(0,a.jsx)("button",{onClick:()=>{u(!0)},className:"eduapp--btn eduapp--btn--blue",children:"Get Premium"})})]})}),(0,a.jsx)(r.Z,{session:l,show:c,close:()=>u(!1),subscriptionDetails:t,monthlySubscription:n,yearlySubscription:i})]})}},6727:function(e,t,n){var a=n(85893),r=n(58353),s=n(74207),i=n(13365),l=n(5499),o=n(68665),c=n(97538),u=n(51024),d=n(89552),p=n(11187),h=n(58718),f=n(33299),m=n(25675),v=n.n(m),g=n(67294),x=n(37106),b=n(9473),y=n(10962),k=n(23109),w=n(98536),j=n(68377),Z=n(42248),N=n(16749),D=n(27908),S=n(64170),C=n(74672),E=n(83573);let{TextArea:I}=u.default;t.Z=e=>{let{firebaseDatabase:t,welcomeMsg:n,featureName:u,parentPagePath:m}=e,{t:F}=(0,E.$G)("teacher.chat"),{data:T,status:P}=(0,f.useSession)(),[$,A]=(0,g.useState)(""),[O,M]=(0,g.useState)(!1),[W,L]=(0,g.useState)(!1),[R,_]=(0,g.useState)(!1),[q,B]=(0,g.useState)([]),[H,z]=(0,g.useState)(!1),[U,K]=(0,g.useState)(),[G,X]=(0,g.useState)(!1),[J,Y]=(0,g.useState)(null),[Q,V]=(0,g.useState)(null),[ee,et]=(0,g.useState)(!1),[en,ea]=(0,g.useState)(1),[er,es]=(0,g.useState)(10),[ei,el]=(0,g.useState)(0),eo=()=>L(!1),ec=()=>L(!0),eu=()=>_(!1),ed=()=>_(!0),ep=(0,g.useRef)(null),[eh,ef]=(0,g.useState)(!1),[em,ev]=(0,g.useState)(!1),[eg,ex]=(0,g.useState)(!1),[eb,ey]=(0,g.useState)(!1),[ek,ew]=(0,g.useState)(!0),[ej,eZ]=(0,g.useState)([]),[eN,eD]=(0,g.useState)({}),[eS,eC]=(0,g.useState)(null),[eE,eI]=(0,g.useState)(null),eF=(0,b.v9)(e=>e.theme.chatTheme),[eT]=c.Z.useForm(),eP=()=>window.scrollTo(0,document.body.scrollHeight),e$=()=>{let e=document.body.scrollHeight;window.scrollY+window.innerHeight+80>e?X(!1):X(!0)};(0,g.useEffect)(()=>{let e=document.body.scrollHeight;window.scrollY+window.innerHeight+.1*e>e?q.length&&eP():eg&&(q.length&&eP(),ex(!1)),window.addEventListener("scroll",e$)},[q]),(0,g.useEffect)(()=>{(null==T?void 0:T.userId)&&e_()},[T]);let eA=async e=>{await i.httpClient.get("/user/".concat(e)).then(e=>{var t,n,a,r,s,i,l,o;let c=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.data;K(c={_id:null===(n=c)||void 0===n?void 0:n._id,college:null===(r=c)||void 0===r?void 0:null===(a=r.college)||void 0===a?void 0:a.firstName,semester:null===(i=c)||void 0===i?void 0:null===(s=i.semester)||void 0===s?void 0:s.semName,course:null===(o=c)||void 0===o?void 0:null===(l=o.course)||void 0===l?void 0:l.name})}).catch(function(e){})},eO=async()=>{var e,t,n,a;ey(null!=T&&null!==(t=T.userData)&&void 0!==t&&null!==(e=t.academicSubscription)&&void 0!==e&&!!e.isPremiumUser||null!=T&&null!==(a=T.userData)&&void 0!==a&&null!==(n=a.academicSubscription)&&void 0!==n&&!!n.isCollegePremium),ew(!1)},eM=async()=>{await i.httpClient.get("/purchase/allSubscriptionPlans").then(e=>{var t;let{data:n}=e;
1eZ(n.data),null===(t=n.data)||void 0===t||t.forEach(e=>{"monthly"==e.billingFrequency&&"academic"==e.category?eC(e):"yearly"==e.billingFrequency&&"academic"==e.category&&eI(e)})}).catch(function(e){console.error(e)})};(0,g.useEffect)(()=>{en>1&&eW()},[en]);let eW=async()=>{let e="".concat(null==T?void 0:T.userId);ef(!0);let n=(0,h.query)((0,h.collection)(l.default,t,e,"chat"),(0,h.orderBy)("sendAt","desc"),(0,h.limit)(er*en));(0,h.onSnapshot)(n,e=>{let t=[];e.docs.forEach(e=>{t.push({...e.data(),messageId:e.id})}),B(t=t.reverse()),el(e.size),e.docs.length<er*en?ev(!1):ev(!0)}),ef(!1)},[eL,eR]=(0,g.useState)(null),e_=async()=>{var e,n;i.httpClient.defaults.headers.common.Authorization="Bearer "+(null==T?void 0:T.accessToken),await i.httpClient.post("/activity/getChatConfigurationData/".concat(null==T?void 0:null===(n=T.userData)||void 0===n?void 0:null===(e=n.userType)||void 0===e?void 0:e.toLowerCase(),"/").concat(null==T?void 0:T.userId),{...U,chatType:t.endsWith("-dev")?t.slice(0,-4):t}).then(e=>{let{data:t}=e;200==t.statusCode&&eR(t.data)}).catch(function(e){}).finally(()=>{})},eq=async()=>{var e;if(eb&&(M(!0),U&&(null==T?void 0:T.userId)&&$)){let n="".concat(null==T?void 0:T.userId),a=await (0,o.Me)(t,n),r=(0,o.nw)($,n,"user");a?a&&(await (0,h.updateDoc)((0,h.doc)(l.default,t,n),{updatedAt:new Date().toISOString(),key:n,lastMessageTime:new Date().toISOString(),lastMessage:$}),await (0,h.addDoc)((0,h.collection)(l.default,t,n,"chat"),{...r})):(await (0,h.setDoc)((0,h.doc)(l.default,t,n),{key:n,updatedAt:new Date().toISOString(),user:null==T?void 0:T.userId,userType:null==T?void 0:null===(e=T.userData)||void 0===e?void 0:e.userType}),await (0,h.addDoc)((0,h.collection)(l.default,t,n,"chat"),{...r}),await (0,h.updateDoc)((0,h.doc)(l.default,t,n),{updatedAt:new Date().toISOString(),key:n,lastMessageTime:new Date().toISOString(),lastMessage:$})),A(""),z(!0)}},[eB,eH]=(0,g.useState)(!1),[ez,eU]=(0,g.useState)("");(0,g.useEffect)(()=>{q.length&&!eB&&eL&&"user"==q[q.length-1].role&&eK()},[q]);let eK=async()=>{var e,n,a,r,s,i,o,c,u,d,p,f,m,v,g,x,b;let y="https://".concat(null==eL?void 0:null===(e=eL.chatDeplyomentInstance)||void 0===e?void 0:e.AOAIEndPoint_chat,".openai.azure.com/"),k=null==eL?void 0:null===(n=eL.chatDeplyomentInstance)||void 0===n?void 0:n.AOAIkey,w=null==eL?void 0:null===(a=eL.chatDeplyomentInstance)||void 0===a?void 0:a.AOAIDeploymentId_chat,j=new Z.D(y,new N.s5(k)),S=await (0,C.W)(q);null==S||S.unshift({content:null==eL?void 0:eL.systemMessage,role:"system"});for(let e=0;e<S.length;e++)null===(r=S[e])||void 0===r||delete r.docKey,null===(s=S[e])||void 0===s||delete s.user,null===(i=S[e])||void 0===i||delete i.messageId,null===(o=S[e])||void 0===o||delete o.notInRetrivedData,null===(c=S[e])||void 0===c||delete c.read,null===(u=S[e])||void 0===u||delete u.resourceFileDetails,null===(d=S[e])||void 0===d||delete d.sendAt,null===(p=S[e])||void 0===p||delete p.type,null===(f=S[e])||void 0===f||delete f.usedFileReference,null===(m=S[e])||void 0===m||delete m.event,null===(v=S[e])||void 0===v||delete v.feedbackDetails;let E="";eH(!0);try{let e=await j.streamChatCompletions(w,S,{temperature:.7,frequencyPenalty:0,presencePenalty:0,topP:.95,stop:null,maxTokens:800}),n=null,a={content:"",read:!1,sendAt:new Date().toISOString(),type:"TEXT",user:null==T?void 0:null===(x=T.userId)||void 0===x?void 0:null===(g=x.split("_"))||void 0===g?void 0:g[0],docKey:null==T?void 0:T.userId,role:"assistant"};z(!1);let r=[...q];for await(let s of e){for(let e of s.choices){let i=null===(b=e.delta)||void 0===b?void 0:b.content;void 0!==i&&(E+=i),a.content=E,eU(E),n?n==(null==s?void 0:s.id)&&(r[r.length-1]=a):r.push(a),B(r),"stop"==e.finishReason&&((0,h.updateDoc)((0,h.doc)(l.default,t,null==T?void 0:T.userId),{updatedAt:new Date().toISOString(),key:null==T?void 0:T.userId,lastMessageTime:new Date().toISOString(),lastMessage:$}),(0,h.addDoc)((0,h.collection)(l.default,t,null==T?void 0:T.userId,"chat"),{...a})),eP(),z(!1),M(!1)}n=null==s?void 0:s.id}M(!1),eH(!1)}catch(e){console.error("Error:",e),(0,D.Z)(e)}finally{M(!1),z(!1),eH(!1)}};(0,g.useEffect)(()=>{"unauthenticated"!=P&&"loading"!=P&&(null==T?void 0:T.userId)&&(ey("TEACHER"==T.userData.userType),i.httpClient.defaults.headers.common.Authorization="Bearer "+(null==T?void 0:T.accessToken),"STUDENT"==T.userData.userType&&(ew(!0),eO(),eM()),eA(null==T?void 0:T.userId),ex(!0),eW())},[T]);let eG=(e,t,n)=>{"like"==e?ec():ed(),Y({chatId:t.docKey,messageId:t.messageId,message:t.content}),V(n)},eX=e=>{et(!0),i.httpClient.defaults.headers.common.Authorization="Bearer "+(null==T?void 0:T.accessToken),i.httpClient.post("/chat-feedback/add",{...J,...eJ(e),chatDB:t}).then(async n=>{let{data:a}=n;200==a.statusCode&&(await (0,h.updateDoc)((0,h.doc)(l.default,t,J.chatId,"chat",J.messageId),{feedbackDetail
1s:eJ(e)}),q[Q]={...q[Q],feedbackDetails:e},et(!1),Y(null),V(null),eT.resetFields(),p.ZP.success("Thank you for sharing your valuable feedback."),eo(),eu())}).catch(function(e){et(!1),Y(null),V(null),eo(),eu()})},eJ=e=>Object.keys(e).reduce((t,n)=>(void 0!==e[n]&&(t[n]=e[n]),t),{}),eY=async()=>{ea(e=>e+1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"eduapp-chatbotfeature",children:(0,a.jsxs)("div",{className:"eduapp-card eduapp-chat-card d-flex",children:[(null==q?void 0:q.length)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"eduapp-chatbotfeature--generate-area--icon",children:(0,a.jsx)(v(),{src:"/images/icons/chatbot.svg",width:51,height:56,alt:"chatbot"})}),(0,a.jsx)("div",{className:"eduapp-chatbotfeature--fetch-old",children:!eh&&em?(0,a.jsxs)("button",{className:"d-inline-flex flex-wrap align-items-center fetch-btn eduapp--btn eduapp--btn--white",onClick:()=>eY(),children:[(0,a.jsx)(x.iIz,{size:"1.25rem"}),F("fetch-older-messages")]}):en>1&&em?(0,a.jsx)(d.default,{}):null}),(0,a.jsx)("div",{className:"eduapp-chatbotfeature--generate-area",children:(0,a.jsxs)("div",{className:"eduapp-chatbotfeature--generate-area--box",ref:ep,children:[null==q?void 0:q.map((e,t)=>{var n,r,s,i,l,o,c,u,d;let p=null==e?void 0:null===(n=e.content)||void 0===n?void 0:n.replaceAll("\\n","\n"),h=/```/gi;if(null===(r=p)||void 0===r?void 0:r.match(h)){let e=0,t=['\n <div \n class="code-block" \n style="\n background-color: black;\n border-radius: 0.375rem;\n color: currentColor;\n font-size: .875em;\n font-weight: 400;\n line-height: 1.7142857;\n margin: 0;\n overflow-x: auto;\n padding: 10px;"\n ><code style="color: white;">',"</code></div>"],n=null===(d=p)||void 0===d?void 0:d.replace(h,()=>{let n=e%2;return e++,t[n]});p=n}return(0,a.jsxs)("div",{className:"request-response-wrap",children:[(null==e?void 0:e.user)==(null==T?void 0:T.userId)&&(null==e?void 0:e.role)=="user"&&(0,a.jsxs)("div",{className:"request d-flex flex-wrap",children:[(0,a.jsx)("span",{className:"user-icon d-inline-flex align-items-center justify-content-center",children:(null==T?void 0:null===(i=T.user)||void 0===i?void 0:null===(s=i.name)||void 0===s?void 0:s.substring(0,1))?null==T?void 0:null===(o=T.user)||void 0===o?void 0:null===(l=o.name)||void 0===l?void 0:l.substring(0,1):0}),(0,a.jsx)("h4",{children:null==e?void 0:e.content})]}),(null==e?void 0:e.role)=="assistant"&&(0,a.jsxs)("div",{className:"response",children:[(0,a.jsxs)("div",{className:"feedback-group d-flex align-items-center justify-content-end",children:[(null==e?void 0:e.feedbackDetails)&&(null==e?void 0:null===(c=e.feedbackDetails)||void 0===c?void 0:c.impression)=="like"?(0,a.jsx)("span",{className:"thumb up",children:(0,a.jsx)(v(),{src:"dark"===eF?"/images/icons/thumb-up-fill-white.svg":"/images/icons/thumb-up-fill.svg",width:18,height:24,alt:"thumbs"})}):(0,a.jsx)("span",{className:"thumb up",onClick:()=>eG("like",e,t),children:(0,a.jsx)(v(),{src:"dark"===eF?"/images/icons/thumb-up-dark.svg":"/images/icons/thumb-up.svg",width:18,height:24,alt:"thumbs"})}),(null==e?void 0:e.feedbackDetails)&&(null==e?void 0:null===(u=e.feedbackDetails)||void 0===u?void 0:u.impression)=="dislike"?(0,a.jsx)("span",{className:"thumb down",children:(0,a.jsx)(v(),{src:"dark"===eF?"/images/icons/thumb-down-fill-white.svg":"/images/icons/thumb-down-fill.svg",width:18,height:18,alt:"thumbs"})}):(0,a.jsx)("span",{className:"thumb down",onClick:()=>eG("dislike",e,t),children:(0,a.jsx)(v(),{src:"dark"===eF?"/images/icons/thumb-down-dark.svg":"/images/icons/thumb-down.svg",width:18,height:18,alt:"thumbs"})})]}),(0,a.jsxs)("div",{className:"response-wrap d-flex flex-wrap",children:[(0,a.jsx)("span",{className:"bot-icon",children:(0,a.jsx)(v(),{src:"/images/icons/chatbot.svg",width:30,height:30,alt:"chatbot"})}),(0,a.jsx)("p",{dangerouslySetInnerHTML:{__html:(0,j.Od)((0,S.U)(p))}})]})]})]},t)}),(null==q?void 0:q.length)&&H&&(0,a.jsx)("div",{className:"request-response-wrap",children:(0,a.jsx)(k.Z,{})})]})}),!0===G&&(0,a.jsx)("div",{className:"eduapp-scroll-to-bottom",children:(0,a.jsx)("span",{onClick:eP,className:"eduapp-scroll-to-bottom--icon d-inline-flex align-items-center justify-content-center",children:(0,a.jsx)(v(),{src:"/images/icons/arrow-down.svg",width:24,height:24,alt:"icon"})})})]}):(0,a.jsx)(w.Z,{description:n||F("default-chat-message")}),(0,a.jsxs)("div",{className:"eduapp-chatbotfeature--footer",children:[eb||ek?null:(0,a.jsx)(y.Z,{parentPagePath:m,subscriptionDetail
1s:ej,monthlySubscription:eS,yearlySubscription:eE,session:T}),(0,a.jsxs)("div",{className:"eduapp-chatbotfeature--footer--actions",children:[(0,a.jsx)("div",{className:"button-groups d-flex flex-wrap align-items-center"}),(0,a.jsxs)("div",{className:"generate-field d-flex flex-wrap",children:[(0,a.jsx)(I,{disabled:!eb,placeholder:F("send-a-message"),value:$,onKeyUp:e=>"Enter"===e.key&&!O&&eq(),onChange:e=>{var t,n;return A((null==e?void 0:null===(n=e.target)||void 0===n?void 0:null===(t=n.value)||void 0===t?void 0:t.trim())==""?"":e.target.value)}}),(0,a.jsx)("button",{className:"send d-inline-flex flex-wrap align-items-center justify-content-center",onClick:()=>null!==eL&&!O&&eq(),disabled:!$||!eb,children:(0,a.jsx)("span",{className:"icon"})})]})]})]})]})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Z,{show:W,close:eo,submitMessageFeedback:eX,loading:ee,form:eT}),(0,a.jsx)(r.Z,{show:R,close:eu,submitMessageFeedback:eX,loading:ee,form:eT})]})]})}},23109:function(e,t,n){var a=n(85893),r=n(25675),s=n.n(r);t.Z=e=>{let{message:t}=e;return(0,a.jsx)("div",{className:"response",children:(0,a.jsxs)("div",{className:"response-wrap d-flex flex-wrap align-items-center gap-2",children:[(0,a.jsx)("span",{className:"bot-icon",children:(0,a.jsx)(s(),{src:"/images/icons/chatbot.svg",width:30,height:30,alt:"chatbot"})}),(0,a.jsxs)("span",{className:"response-loader d-inline-flex align-items-center justify-content-center",children:[(0,a.jsx)("span",{className:"response-loader--dots"}),(0,a.jsx)("span",{className:"response-loader--dots"}),(0,a.jsx)("span",{className:"response-loader--dots"})]}),t?(0,a.jsx)("span",{className:"response-loader--message",children:t}):null]})})}},98536:function(e,t,n){var a=n(85893),r=n(25675),s=n.n(r),i=n(83573);t.Z=e=>{let{t}=(0,i.$G)("teacher.chat");return(0,a.jsxs)("div",{className:"eduapp-chatbotfeature--welcome",children:[(0,a.jsx)("div",{className:"eduapp-chatbotfeature--welcome--image",children:(0,a.jsx)(s(),{src:"/images/icons/chatbot.svg",width:51,height:56,alt:"chatbot"})}),(0,a.jsxs)("div",{className:"eduapp-chatbotfeature--welcome--heading",children:[(0,a.jsx)("h4",{className:"title",children:t("hi-there")}),(0,a.jsx)("div",{className:"description",children:e.description})]})]})}},58353:function(e,t,n){var a=n(85893),r=n(65530),s=n(25675),i=n.n(s),l=n(97538),o=n(51024),c=n(31059),u=n(36968);let{TextArea:d}=o.default;t.Z=e=>{let{show:t,close:n,loading:s,submitMessageFeedback:o,form:p}=e;return(0,a.jsxs)(r.Z,{centered:!0,className:"eduapp-modal eduapp-feedback-modal",show:t,onHide:n,children:[(0,a.jsx)(r.Z.Header,{closeButton:!0,children:(0,a.jsxs)(r.Z.Title,{className:"d-flex flex-wrap align-items-center",children:[(0,a.jsx)("span",{className:"icon",children:(0,a.jsx)(i(),{src:"/images/icons/feedback-thumbs-down.svg",width:32,height:32,alt:"thumbs down"})}),(0,a.jsx)("span",{className:"title",children:"Provide additional feedback"})]})}),(0,a.jsxs)(l.Z,{className:"eduapp-feedback-form",form:p,onFinish:e=>{o({...e,impression:"dislike"})},children:[(0,a.jsx)(r.Z.Body,{children:(0,a.jsx)(l.Z.Item,{name:"feedback",children:(0,a.jsx)(d,{className:"ant-textarea",placeholder:"What do you like about the response?"})})}),(0,a.jsxs)(r.Z.Footer,{className:"d-flex flex-wrap align-items-end justify-content-between column-footer",children:[(0,a.jsx)("div",{className:"eduapp-feedback-options",children:(0,a.jsx)(l.Z.Item,{name:"reason",children:(0,a.jsx)(c.default.Group,{children:(0,a.jsxs)("ul",{className:"eduapp-checkbox-list",children:[(0,a.jsx)("li",{children:(0,a.jsx)(c.default,{className:"eduapp-checkbox d-flex align-items-center",value:"This is harmful / unsafe",children:"This is harmful / unsafe"})}),(0,a.jsx)("li",{children:(0,a.jsx)(c.default,{className:"eduapp-checkbox d-flex align-items-center",value:"This isnât true",children:"This isnât true"})}),(0,a.jsx)("li",{children:(0,a.jsx)(c.default,{className:"eduapp-checkbox d-flex align-items-center",value:"This isnât helpful",children:"This isnât helpful"})})]})})})}),(0,a.jsxs)("div",{className:"eduapp-feedback-actions d-flex flex-wrap justify-content-end",children:[(0,a.jsx)("button",{htmlType:"button",className:"eduapp--btn eduapp--btn--white",onClick:n,children:"Cancel"}),(0,a.jsxs)("button",{htmlType:"submit",className:"eduapp--btn eduapp--btn--blue",children:[s?(0,a.jsx)(u.Z,{size:"sm"}):null,"Send feedback"]})]})]})]})]})}},74207:function(e,t,n){var a=n(85893),r=n(65530),s=n(25675),i=n.n(s),l=n(97538),o=n(51024),c=n(36968);let{TextArea:u}=o.default;t.Z=e=>{let{show:t,close:n,submitMessageFeedback:s,loading:o,form:d}=e;return(0,a.jsxs)(r.Z,{centered:!0,className:"eduapp-modal eduapp-feedback-modal",show:t,onHide:n,children:[(0,a.jsx)(r.Z.Header,{closeButton:!0,children:(0,a.jsxs)(r.Z.Title,{className:"d-flex flex-wrap align-items-center",children:[(0,a.jsx)("span",{className:"icon",children:(0,a.jsx)(i(),{src:"/images/icons/feedback-thumbs-up.svg",width:32,height:32,alt:"Picture of the author"})}),(0,a.jsx)("span",{className:"title",children:"Provide additional feedback"})]})}),(0,a.jsxs)(l.Z,{className:"eduapp-feedback-form",form:d,onFinish:e=>{s({...e,impression:"like",reason:null})},children:[(0,a.jsx)(r.Z.Body,{children:(0,a.jsx)(l.Z.Item,{name:"feedback",children:(0,a.jsx)(u,{className:"ant-textarea",placeholder:"What do you like about the response?"})})}),(0,a.jsx)(r.Z.Footer,{children:(0,a.jsxs)("div",{className:"eduapp-feedback-actions d-flex flex-wrap justify-content-end",children:[(0,a.jsx)("button",{htmlType:"button",className:"eduapp--btn eduapp--btn--white",onClick:n,children:"Cancel"}),(0,a.jsxs)("button",{htmlType:"submit",className:"eduapp--btn eduapp--btn--blue",children:[o?(0,a.jsx)(c.Z,{size:"sm"}):null,"Send feedback"]})]})})]})]})}},27908:function(e,t,n){let{message:a}=n(27958);t.Z=(e,t)=>{try{var n,r,s,i,l,o,c,u,d,p,h;if(null==e?void 0:null===(n=e.message)||void 0===n?void 0:n.includes("Error message: ")){let t=null==e?void 0:null===(r=e.message)||void 0===r?void 0:r.split("Error message: ")[1];t=null===(s=t)||void 0===s?void 0:s.replace(/\bNone\b/g,"null"),t=null===(i=t)||void 0===i?void 0:i.replace(/\bFalse\b/g,"fal
1se"),t=null===(l=t)||void 0===l?void 0:l.replace(/\bTrue\b/g,"true"),t=null===(o=t)||void 0===o?void 0:o.replace(/'/g,'"'),t=null===(c=t)||void 0===c?void 0:c.replace(/OpenAI"s/g,"OpenAI's");let n=JSON.parse(t),d=null==n?void 0:null===(u=n.error)||void 0===u?void 0:u.code;"content_filter"===d?a.error("Discussions involving violence, sexual content, self-harm, or hatred are not permitted here. If you need support or are in crisis, consider reaching out to a trusted adult or helpline.",[5]):"openai_limit_error"===d?a.error("Too Many Requests",[5]):"unknown_error"===d?a.error("We're sorry, but something went wrong. Please try again later or contact support if the issue persists.",[5]):a.error("Sorry, Something went wrong!",[5])}else(null==e?void 0:e.message)==="Network Error"?a.error("Please check your internet connection",[5]):(null==e?void 0:null===(p=e.response)||void 0===p?void 0:null===(d=p.data)||void 0===d?void 0:d.message)?(a.error(e.response.data.message,[5]),(null==e?void 0:null===(h=e.response)||void 0===h?void 0:h.data.errorCode)==="session_expired"&&t(!0)):a.error("Unexpected error occurred.",[5])}catch(e){console.error("Failed to parse JSON:",e),a.error("Sorry, something went wrong!",[5])}}},64170:function(e,t,n){n.d(t,{U:function(){return a},g:function(){return r}});let a=e=>{var t,n,a,r,s;let i=null==e?void 0:e.replace(/(\(\[doc\d+\]\)|\[doc\d+\])/g,"");return null==(n=i=null===(t=i)||void 0===t?void 0:t.replace(/(\*\*)(.*?)\1/g,"<strong>$2</strong>"))?void 0:null===(s=n.replace(/^### (.*$)/gim,'<h3 style="margin: 0; font-size: 24px;">$1</h3>'))||void 0===s?void 0:null===(r=s.replace(/^#### (.*$)/gim,'<h4 style="margin: 0; font-size: 20px;">$1</h4>'))||void 0===r?void 0:null===(a=r.replace(/^##### (.*$)/gim,'<h5 style="margin: 0; font-size: 18px;">$1</h5>'))||void 0===a?void 0:a.replace(/^###### (.*$)/gim,'<h6 style="margin: 0; font-size: 16px;">$1</h6>')},r=e=>{let t=e.indexOf("please make sure to strictly format the question in the following template format:"),n=e.indexOf("please make sure to strictly format the case study in the following template format:"),a=Math.min(-1!==t?t:1/0,-1!==n?n:1/0);if(a!==1/0){let t=e.slice(0,a);return t+" based on uploaded template"}return e}},74672:function(e,t,n){n.d(t,{S:function(){return r},W:function(){return a}});let a=e=>{let t=new Date(new Date().getTime()-864e5);return e.filter(e=>{let n=new Date(null==e?void 0:e.sendAt);return(null==e?void 0:e.role)!=="system"&&n>=t}).slice(-10).map(e=>({role:null==e?void 0:e.role,content:null==e?void 0:e.content}))},r=e=>{let t=new Date(new Date().getTime()-864e5);return e.filter(e=>{let n=new Date(null==e?void 0:e.sendAt);return(null==e?void 0:e.role)!=="system"&&n>=t}).map(e=>({role:null==e?void 0:e.role,content:null==e?void 0:e.content}))}},68665:function(e,t,n){n.d(t,{IH:function(){return o},Me:function(){return s},PP:function(){return i},nw:function(){return l},pY:function(){return c}});var a=n(58718);let{default:r}=n(5499),s=async(e,t)=>{let n=await (0,a.getDoc)((0,a.doc)(r,e,t));return!!n.exists()},i=async(e,t,n)=>{let s=n||"chat",i=(0,a.query)((0,a.collection)(r,e,t,s),(0,a.orderBy)("sendAt","asc")),l=await (0,a.getDocs)(i),o=[];return l.docs.forEach(e=>o.push({id:e.id,...e.data()})),o},l=(e,t,n)=>({content:e,read:!1,sendAt:new Date().toISOString(),type:"TEXT",user:t,docKey:t,role:n}),o=(e,t,n,a,r)=>({from:t,to:n,input:a,output:r,sendAt:new Date().toISOString(),user:e,docKey:e}),c=(e,t)=>{if(!e)return()=>{};let n=(0,a.onSnapshot)((0,a.doc)(r,"tasks",e),e=>{var n;let a=null===(n=e.data())||void 0===n?void 0:n.progress;a&&t(a)},e=>{console.error("Error subscribing to task progress:",e)});return n}},68377:function(e,t,n){n.d(t,{Od:function(){return c},on:function(){return l},um:function(){return o}});var a=n(85893),r=n(87617),s=n(8166);let i=e=>null==e?"":"string"==typeof e?e:Array.isArray(e)?e.map(i).filter(Boolean).join("\n"):String(e),l=e=>{var t;e=i(e).replace(/\\ce/g,"");let n=null===(t=e)||void 0===t?void 0:t.split(/(\$\$[^$]*\$\$|\$[^$]*\$)/g);return n.map((e,t)=>e.startsWith("$$")&&e.endsWith("$$")?(0,a.jsx)(r.BlockMath,{children:e.slice(2,-2)},t):e.startsWith("$")&&e.endsWith("$")?(0,a.jsx)(r.InlineMath,{children:e.slice(1,-1)},t):e)},o=e=>{var t;e=i(e).replace(/\\ce/g,"");let n=null===(t=e)||void 0===t?void 0:t.split(/(\\\[.*?\\\]|\\\(.*?\\\)|\$\$.*?\$\$|\$.*?\$)/g);return null==n?void 0:n.map((e,t)=>e?e.startsWith("$$")&&e.endsWith("$$")?(0,a.jsx)(r.InlineMath,{children:e.slice(2,-2)},t):e.startsWith("$")&&e.endsWith("$")?(0,a.jsx)(r.InlineMath,{children:e.slice(1,-1)},t):e.startsWith("\\(")&&e.endsWith("\\)")?(0,a.jsx)(r.InlineMath,{children:e.slice(2,-2)},t):e.startsWith("\\[")&&e.endsWith("\\]")?(0,a.jsx)(r.InlineMath,{children:e.slice(2,-2)},t):(0,a.jsx)("span",{children:e},t):null)},c=e=>{let t=e;for(let{regex:e,displayMode:n}of[{regex:/\$\$\s*([\s\S]+?)\s*\$\$/g,displayMode:!0},{regex:/\$\s*([\s\S]+?)\s*\$/g,displayMode:!1},{regex:/\\\(\s*([\s\S]+?)\s*\\\)/g,displayMode:!1},{regex:/\\\[\s*([\s\S]+?)\s*\\\]/g,displayMode:!0}])t=t.replace(e,(e,t)=>s.default.renderToString(t,{throwOnError:!1,displayMode:n}));return t}},43579:function(e,t,n){n.r(t),n.d(t,{Circle:function(){return N},Line:function(){return p},default:function(){return D}});var a=n(22122),r=n(28991),s=n(81253),i=n(67294),l=n(94184),o=n.n(l),c={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},u=function(){var e=(0,i.useRef)([]),t=(0,i.useRef)(null);return(0,i.useEffect)(function(){var n=Date.now(),a=!1;e.current.forEach(function(e){if(e){a=!0;var r=e.style;r.transitionDuration=".3s, .3s, .3s, .06s",t.current&&n-t.current<100&&(r.transitionDuration="0s, 0s")}}),a&&(t.current=Date.now())}),e.current},d=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"],p=function(e){var t=(0,r.Z)((0,r.Z)({},c),e),n=t.className,l=t.percent,p=t.prefixCls,h=t.strokeColor,f=t.strokeLinecap,m=t.strokeWidth,v=t.style,g=t.trailColor,x=t.trailWidth,b=t.transition,y=(0,s.Z)(t,d);delete y.gapPosition;var k=Array.isArray(l)?l:[l],w=Array.isArray(h)?h:[h],j=u(),Z=m/2,N="M ".concat("round"===f?Z:0,",").concat(Z,"\n L ").concat("round"===f?100-m/2:100,",").concat(Z),D=0;return i.createElement("svg",(0,a.Z)({className:o()("".concat(p,"-line"),n),viewBox:"0 0 100 ".concat(m),preserveAspectRatio:"none",style:v},y),i.createElement("path",{className:"".concat(p,"-line-trail"),d:N,strokeLinecap:f,stroke:g,strokeWidth:x||m,fillOpacity:"0"}),k.map(function(e,t){var n=1;switch(f){case"round":n=1-m/100;break;case"square":n=1-m/2/100;break;default:n=1}var a={strokeDasharray:"".concat(e*n,"px, 100px"),strokeDashoffset:"-".concat(D,"px"),transition:b||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},r=w[t]||w[w.length-1];return D+=e,i.createElement("path",{key:t,className:"".concat(p,"-line-path"),d:N,strokeLinecap:f,stroke:r,strokeWidth:m,fillOpacity:"0",ref:function(e){j[t]=e},style:a})}))},h=n(90484),f=n(72970),m=n(98924),v=0,g=(0,m.Z)(),x=function(e){var t=i.useState(),n=(0,f.Z)(t,2),a=n[0],r=n[1];return i.useEffect(function(){var e;r("rc_progress_".concat((g?(e=v,v+=1):e="TEST_OR_SSR",e)))},[]),e||a},b=function(e){var t=e.bg,n=e.children;return i.createElement("div",{style:{width:"100%",height:"100%",background:t}},n)};function y(e,t){return Object.keys(e).map(function(n){var a=parseFloat(n);return"".concat(e[n]," ").concat("".concat(Math.floor(a*t),"%"))})}var k=i.forwardRef(function(e,t){var n=e.prefixCls,a=e.color,r=e.gradientId,s=e.radius,l=e.style,o=e.ptg,c=e.strokeLinecap,u=e.strokeWidth,d=e.size,p=e.gapDegree,f=a&&"object"===(0,h.Z)(a),m=d/2,v=i.createElement("circle",{className:"".concat(n,"-circle-path"),r:s,cx:m,cy:m,stroke:f?"#FFF":void 0,strokeLinecap:c,strokeWidth:u,opacity:0===o?0:1,style:l,ref:t});if(!f)return v;var g="".concat(r,"-conic"),x=p?"".concat(180+p/2,"deg"):"0deg",k=y(a,(360-p)/360),w=y(a,1),j="conic-gradient(from ".concat(x,", ").concat(k.join(", "),")"),Z="linear-gradient(to ".concat(p?"bottom":"top",", ").concat(w.join(", "),")");return i.createElement(i.Fragment,null,i.createElement("mask",{id:g},v),i.createElement("foreignObject",{x:0,y:0,width:d,height:d,mask:"url(#".concat(g,")")},i.createElement(b,{bg:Z},i.createElement(b,{bg:j}))))}),w=function(e,t,n,a,r,s,i,l,o,c){var u=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,d=(100-a)/100*t;return"round"===o&&100!==a&&(d+=c/2)>=t&&(d=t-.01),{stroke:"string"==typeof l?l:void 0,strokeDasharray:"".concat(t,"px ").concat(e),strokeDashoffset:d+u,transform:"rotate(".concat(r+n/100*360*((360-s)/360)+(0===s?0:({bottom:0,top:180,left:90,right:-90})[i]),"deg)"),transformOrigin:"".concat(50,"px ").concat(50,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},j=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function Z(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}var N=function(e){var t,n,l,d,p=(0,r.Z)((0,r.Z)({},c),e),f=p.id,m=p.prefixCls,v=p.steps,g=p.strokeWidth,b=p.trailWidth,y=p.gapDegree,N=void 0===y?0:y,D=p.gapPosition,S=p.trailColor,C=p.strokeLinecap,E=p.style,I=p.className,F=p.strokeColor,T=p.percent,P=(0,s.Z)(p,j),$=x(f),A="".concat($,"-gradient"),O=50-g/2,M=2*Math.PI*O,W=N>0?90+N/2:-90,L=M*((360-N)/360),R="object"===(0,h.Z)(v)?v:{count:v,gap:2},_=R.count,q=R.gap,B=Z(T),H=Z(F),z=H.find(function(e){return e&&"object"===(0,h.Z)(e)}),U=z&&"object"===(0,h.Z)(z)?"butt":C,K=w(M,L,0,100,W,N,D,S,U,g),G=u();return i.createElement("svg",(0,a.Z)({className:o()("".concat(m,"-circle"),I),viewB
1ox:"0 0 ".concat(100," ").concat(100),style:E,id:f,role:"presentation"},P),!_&&i.createElement("circle",{className:"".concat(m,"-circle-trail"),r:O,cx:50,cy:50,stroke:S,strokeLinecap:U,strokeWidth:b||g,style:K}),_?(t=Math.round(_*(B[0]/100)),n=100/_,l=0,Array(_).fill(null).map(function(e,a){var r=a<=t-1?H[0]:S,s=r&&"object"===(0,h.Z)(r)?"url(#".concat(A,")"):void 0,o=w(M,L,l,n,W,N,D,r,"butt",g,q);return l+=(L-o.strokeDashoffset+q)*100/L,i.createElement("circle",{key:a,className:"".concat(m,"-circle-path"),r:O,cx:50,cy:50,stroke:s,strokeWidth:g,opacity:1,style:o,ref:function(e){G[a]=e}})})):(d=0,B.map(function(e,t){var n=H[t]||H[H.length-1],a=w(M,L,d,e,W,N,D,n,U,g);return d+=e,i.createElement(k,{key:t,color:n,ptg:e,radius:O,prefixCls:m,gradientId:A,style:a,strokeLinecap:U,strokeWidth:g,gapDegree:N,ref:function(e){G[t]=e},size:100})}).reverse()))},D={Line:p,Circle:N}},36356:function(e,t,n){n.r(t),n.d(t,{default:function(){return P}});var a,r=n(22122),s=n(6610),i=n(5991),l=n(63349),o=n(10379),c=n(60446),u=n(96156),d=n(67294),p=n(28991),h=n(81253),f=n(90484),m=n(95857),v=n(92137),g=n(82567),x=n(94184),b=n.n(x),y=n(64217),k=n(80334),w=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(","),a=e.name||"",r=e.type||"",s=r.replace(/\/.*$/,"");return n.some(function(e){var t=e.trim();if(/^\*(\/\*)?$/.test(e))return!0;if("."===t.charAt(0)){var n=a.toLowerCase(),i=t.toLowerCase(),l=[i];return(".jpg"===i||".jpeg"===i)&&(l=[".jpg",".jpeg"]),l.some(function(e){return n.endsWith(e)})}return/\/\*$/.test(t)?s===t.replace(/\/.*$/,""):r===t||!!/^\w+$/.test(t)&&((0,k.ZP)(!1,"Upload takes an invalidate 'accept' type '".concat(t,"'.Skip for check.")),!0)})}return!0};function j(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function Z(e){var t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress(t)});var n=new FormData;e.data&&Object.keys(e.data).forEach(function(t){var a=e.data[t];if(Array.isArray(a)){a.forEach(function(e){n.append("".concat(t,"[]"),e)});return}n.append(t,a)}),e.file instanceof Blob?n.append(e.filename,e.file,e.file.name):n.append(e.filename,e.file),t.onerror=function(t){e.onError(t)},t.onload=function(){if(t.status<200||t.status>=300){var n;return e.onError(((n=Error("cannot ".concat(e.method," ").concat(e.action," ").concat(t.status,"'"))).status=t.status,n.method=e.method,n.url=e.action,n),j(t))}return e.onSuccess(j(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);var a=e.headers||{};return null!==a["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(a).forEach(function(e){null!==a[e]&&t.setRequestHeader(e,a[e])}),t.send(n),{abort:function(){t.abort()}}}var N=(a=(0,v.Z)((0,m.Z)().mark(function e(t,n){var a,r,s,i,l,o;return(0,m.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=function(){return(i=(0,v.Z)((0,m.Z)().mark(function e(t){return(0,m.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e){t.file(function(a){n(a)?(t.fullPath&&!a.webkitRelativePath&&(Object.defineProperties(a,{webkitRelativePath:{writable:!0}}),a.webkitRelativePath=t.fullPath.replace(/^\//,""),Object.defineProperties(a,{webkitRelativePath:{writable:!1}})),e(a)):e(null)})}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)},s=function(){return(s=(0,v.Z)((0,m.Z)().mark(function e(t){var n,a,r,s,i;return(0,m.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.createReader(),a=[];case 2:return e.next=5,new Promise(function(e){n.readEntries(e,function(){return e([])})});case 5:if(s=(r=e.sent).length){e.next=9;break}return e.abrupt("break",12);case 9:for(i=0;i<s;i++)a.push(r[i]);e.next=2;break;case 12:return e.abrupt("return",a);case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)},a=[],r=[],t.forEach(function(e){return r.push(e.webkitGetAsEntry())}),l=function(){var e=(0,v.Z)((0,m.Z)().mark(function e(t,n){var l,o;return(0,m.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:if(t.path=n||"",!t.isFile){e.next=10;break}return e.next=6,function(e){return i.apply(this,arguments)}(t);case 6:(l=e.sent)&&a.push(l),e.next=15;break;case 10:if(!t.isDirectory){e.next=15;break}return e.next=13,function(e){return s.apply(this,arguments)}(t);case 13:o=e.sent,r.push.apply(r,(0,g.Z)(o));case 15:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),o=0;case 9:if(!(o<r.length)){e.next=15;break}return e.next=12,l(r[o]);case 12:o++,e.next=9;break;case 15:return e.abrupt("return",a);case 16:case"end":return e.stop()}},e)})),function(e,t){return a.apply(this,arguments)}),D=+new Date,S=0;function C(){return"rc-upload-".concat(D,"-").concat(++S)}var E=["component","prefixCls","className","classNames","disabled","id","name","style","styles","multiple","accept","capture","children","directory","folder","openFileDialogOnClick","onMouseEnter","onMouseLeave","hasControlInside"],I=function(e){(0,o.Z)(n,e);var t=(0,c.Z)(n);function n(){(0,s.Z)(this,n);for(var e,a,r,i,o,c=arguments.length,d=Array(c),p=0;p<c;p++)d[p]=arguments[p];return e=t.call.apply(t,[this].concat(d)),(0,u.Z)((0,l.Z)(e),"state",{uid:C()}),(0,u.Z)((0,l.Z)(e),"reqs",{}),(0,u.Z)((0,l.Z)(e),"fileInput",void 0),(0,u.Z)((0,l.Z)(e),"_isMounted",void 0),(0,u.Z)((0,l.Z)(e),"onChange",function(t){var n=e.props,a=n.accept,r=n.directory,s=t.target.files,i=(0,g.Z)(s).filter(function(e){return!r||w(e,a)});e.uploadFiles(i),e.reset()}),(0,u.Z)((0,l.Z)(e),"onClick",function(t){var n=e.fileInput;if(n){var a=t.target,r=e.props.onClick;
1a&&"BUTTON"===a.tagName&&(n.parentNode.focus(),a.blur()),n.click(),r&&r(t)}}),(0,u.Z)((0,l.Z)(e),"onKeyDown",function(t){"Enter"===t.key&&e.onClick(t)}),(0,u.Z)((0,l.Z)(e),"onDataTransferFiles",(a=(0,v.Z)((0,m.Z)().mark(function t(n,a){var r,s,i,l,o,c,u;return(0,m.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(s=(r=e.props).multiple,i=r.accept,l=r.directory,o=(0,g.Z)(n.items||[]),((c=(0,g.Z)(n.files||[])).length>0||o.some(function(e){return"file"===e.kind}))&&(null==a||a()),!l){t.next=11;break}return t.next=7,N(Array.prototype.slice.call(o),function(t){return w(t,e.props.accept)});case 7:c=t.sent,e.uploadFiles(c),t.next=14;break;case 11:u=(0,g.Z)(c).filter(function(e){return w(e,i)}),!1===s&&(u=c.slice(0,1)),e.uploadFiles(u);case 14:case"end":return t.stop()}},t)})),function(e,t){return a.apply(this,arguments)})),(0,u.Z)((0,l.Z)(e),"onFilePaste",(r=(0,v.Z)((0,m.Z)().mark(function t(n){var a;return(0,m.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.props.pastable){t.next=3;break}return t.abrupt("return");case 3:if("paste"!==n.type){t.next=6;break}return a=n.clipboardData,t.abrupt("return",e.onDataTransferFiles(a,function(){n.preventDefault()}));case 6:case"end":return t.stop()}},t)})),function(e){return r.apply(this,arguments)})),(0,u.Z)((0,l.Z)(e),"onFileDragOver",function(e){e.preventDefault()}),(0,u.Z)((0,l.Z)(e),"onFileDrop",(i=(0,v.Z)((0,m.Z)().mark(function t(n){var a;return(0,m.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n.preventDefault(),"drop"!==n.type){t.next=4;break}return a=n.dataTransfer,t.abrupt("return",e.onDataTransferFiles(a));case 4:case"end":return t.stop()}},t)})),function(e){return i.apply(this,arguments)})),(0,u.Z)((0,l.Z)(e),"uploadFiles",function(t){var n=(0,g.Z)(t);Promise.all(n.map(function(t){return t.uid=C(),e.processFile(t,n)})).then(function(t){var n=e.props.onBatchStart;null==n||n(t.map(function(e){return{file:e.origin,parsedFile:e.parsedFile}})),t.filter(function(e){return null!==e.parsedFile}).forEach(function(t){e.post(t)})})}),(0,u.Z)((0,l.Z)(e),"processFile",(o=(0,v.Z)((0,m.Z)().mark(function t(n,a){var r,s,i,l,o,c,u,d;return(0,m.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.props.beforeUpload,s=n,!r){t.next=14;break}return t.prev=3,t.next=6,r(n,a);case 6:s=t.sent,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(3),s=!1;case 12:if(!1!==s){t.next=14;break}return t.abrupt("return",{origin:n,parsedFile:null,action:null,data:null});case 14:if("function"!=typeof(i=e.props.action)){t.next=21;break}return t.next=18,i(n);case 18:l=t.sent,t.next=22;break;case 21:l=i;case 22:if("function"!=typeof(o=e.props.data)){t.next=29;break}return t.next=26,o(n);case 26:c=t.sent,t.next=30;break;case 29:c=o;case 30:return(d=(u=("object"===(0,f.Z)(s)||"string"==typeof s)&&s?s:n)instanceof File?u:new File([u],n.name,{type:n.type})).uid=n.uid,t.abrupt("return",{origin:n,data:c,parsedFile:d,action:l});case 35:case"end":return t.stop()}},t,null,[[3,9]])})),function(e,t){return o.apply(this,arguments)})),(0,u.Z)((0,l.Z)(e),"saveFileInput",function(t){e.fileInput=t}),e}return(0,i.Z)(n,[{key:"componentDidMount",value:function(){this._isMounted=!0,this.props.pastable&&document.addEventListener("paste",this.onFilePaste)}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort(),document.removeEventListener("paste",this.onFilePaste)}},{key:"componentDidUpdate",value:function(e){var t=this.props.pastable;t&&!e.pastable?document.addEventListener("paste",this.onFilePaste):!t&&e.pastable&&document.removeEventListener("paste",this.onFilePaste)}},{key:"post",value:function(e){var t=this,n=e.data,a=e.origin,r=e.action,s=e.parsedFile;if(this._isMounted){var i=this.props,l=i.onStart,o=i.customRequest,c=i.name,u=i.headers,d=i.withCredentials,p=i.method,h=a.uid;l(a),this.reqs[h]=(o||Z)({action:r,filename:c,data:n,file:s,headers:u,withCredentials:d,method:p||"post",onProgress:function(e){var n=t.props.onProgress;null==n||n(e,s)},onSuccess:function(e,n){var a=t.props.onSuccess;null==a||a(e,s,n),delete t.reqs[h]},onError:function(e,n){var a=t.props.onError;null==a||a(e,n,s),delete t.reqs[h]}},{defaultRequest:Z})}}},{key:"reset",value:function(){this.setState({uid:C()})}},{key:"abort",value:function(e){var t=this.reqs;if(e){var n=e.uid?e.uid:e;t[n]&&t[n].abort&&t[n].abort(),delete t[n]}else Object.keys(t).forEach(function(e){t[e]&&t[e].abort&&t[e].abort(),delete t[e]})}},{key:"render",value:function(){var e=this.props,t=e.component,n=e.prefixCls,a=e.className,s=e.classNames,i=e.disabled,l=e.id,o=e.name,c=e.style,f=e.styles,m=e.multiple,v=e.accept,g=e.capture,x=e.children,k=e.directory,w=e.folder,j=e.openFileDialogOnClick,Z=e.onMouseEnter,N=e.onMouseLeave,D=e.hasControlInside,S=(0,h.Z)(e,E),C=b()((0,u.Z)((0,u.Z)((0,u.Z)({},n,!0),"".concat(n,"-disabled"),i),a,a)),I=k||w?{directory:"directory",webkitdirectory:"webkitdirectory"}:{},F=i?{}:{onClick:j?this.onClick:function(){},onKeyDown:j?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:N,onDrop:this.onFileDrop,onDragOver:this.onFileDragOver,tabIndex:D?void 0:"0"};return d.createElement(t,(0,r.Z)({},F,{className:C,role:D?void 0:"button",style:c}
1),d.createElement("input",(0,r.Z)({},(0,y.Z)(S,{aria:!0,data:!0}),{id:l,name:o,disabled:i,type:"file",ref:this.saveFileInput,onClick:function(e){return e.stopPropagation()},key:this.state.uid,style:(0,p.Z)({display:"none"},(void 0===f?{}:f).input),className:(void 0===s?{}:s).input,accept:v},I,{multiple:m,onChange:this.onChange},null!=g?{capture:g}:{})),x)}}]),n}(d.Component);function F(){}var T=function(e){(0,o.Z)(n,e);var t=(0,c.Z)(n);function n(){var e;(0,s.Z)(this,n);for(var a=arguments.length,r=Array(a),i=0;i<a;i++)r[i]=arguments[i];return e=t.call.apply(t,[this].concat(r)),(0,u.Z)((0,l.Z)(e),"uploader",void 0),(0,u.Z)((0,l.Z)(e),"saveUploader",function(t){e.uploader=t}),e}return(0,i.Z)(n,[{key:"abort",value:function(e){this.uploader.abort(e)}},{key:"render",value:function(){return d.createElement(I,(0,r.Z)({},this.props,{ref:this.saveUploader}))}}]),n}(d.Component);(0,u.Z)(T,"defaultProps",{component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:F,onError:F,onSuccess:F,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0,hasControlInside:!1});var P=T}}]);
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.