PageSourceSearch

https://www.educative.io/static/_next/static/chunks/581215-cbc7b90d951fb4e1.js

js educative.io collected 2026-09-24 08:40:05 UTC 73,416 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[581215],{688045:function(e,t,n){"use strict";var r,o=n(44194);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return o.createElement("svg",s({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),r||(r=o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 3l1 1H19v2H5V4h3.5l1-1h5zM6 19c0 1.1.9 2 2 2h8a2 2 0 002-2V7H6v12zM8 9h8v10H8V9z",fill:"current"})))}},118434:function(e,t,n){"use strict";var r,o=n(44194);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return o.createElement("svg",s({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"cursor-move text-gray-L400 dark:text-gray-L500 fill-current"},e),r||(r=o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 4a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm-2 8c0-1.1.9-2 2-2a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2zm2 8a2 2 0 002-2 2 2 0 00-2-2 2 2 0 00-2 2c0 1.1.9 2 2 2zm8-14a2 2 0 01-2 2 2 2 0 01-2-2c0-1.1.9-2 2-2a2 2 0 012 2zm-2 4a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm-2 8c0-1.1.9-2 2-2a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2z",fill:"current"})))}},650264:function(e,t,n){"use strict";var r,o,s=n(44194);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return s.createElement("svg",i({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-trash"},e),r||(r=s.createElement("polyline",{points:"3 6 5 6 21 6"})),o||(o=s.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})))}},777743:function(e,t,n){"use strict";var r,o,s=n(44194);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return s.createElement("svg",i({xmlns:"http://www.w3.org/2000/svg",height:24,viewBox:"0 0 24 24",width:24},e),r||(r=s.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),o||(o=s.createElement("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})))}},271256:function(e,t,n){"use strict";var r,o=n(44194);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return o.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"currentColor",viewBox:"0 0 20 20"},e),r||(r=o.createElement("path",{fillRule:"evenodd",d:"M12.5 1.67H5c-.7 0-1.28.41-1.53 1.01L.95 8.56c-.07.19-.12.39-.12.6v1.67c0 .92.75 1.67 1.67 1.67h5.26l-.8 3.8-.02.27c0 .35.14.66.37.89l.88.87 5.5-5.49c.3-.3.48-.71.48-1.17V3.33c0-.91-.75-1.66-1.67-1.66Zm0 10-3.62 3.61L10 10.83H2.5V9.17L5 3.33h7.5v8.34Zm6.67-10h-3.34v10h3.34v-10Z",clipRule:"evenodd"})))}},353157:function(e,t,n){"use strict";var r,o=n(44194);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return o.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"currentColor",viewBox:"0 0 20 20"},e),r||(r=o.createElement("path",{fillRule:"evenodd",d:"M17.5 7.5h-5.26l.8-3.8.02-.28c0-.34-.14-.65-.37-.88l-.88-.87-5.48 5.49c-.31.3-.5.71-.5 1.17v8.34c0 .91.75 1.66 1.67 1.66H15c.7 0 1.28-.41 1.53-1.01l2.52-5.88c.07-.19.12-.39.12-.6V9.16c0-.92-.75-1.67-1.67-1.67Zm0 3.33L15 16.67H7.5V8.33l3.62-3.61-.93 4.45h7.31v1.66ZM4.17 8.33H.83v10h3.34v-10Z",clipRule:"evenodd"})))}},556406:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r,o=n(931549),s=n(44194);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}var a=function(e){return s.createElement("svg",i({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-check"},e),r||(r=s.createElement("polyline",{points:"20 6 9 17 4 12"})))},l=n(173656);let d=e=>{let{label:t,forwardedRef:n,disabled:r,checked:s,className:i="",dimensions:d="w-4 h-4",border:c="border",checkedClasse
1s:u="border-none bg-indigo-500 text-white group-hover:bg-indigo-700 dark:group-hover:bg-indigo-400 dark:group-hover:text-black",unCheckedClasses:h="border-gray-L500 text-transparent",ariaLabel:m="",...p}=e,f=m||t,g=(0,o.jsxs)("div",{id:l.env.REACT_APP_STANDALONE?"selenium-checkbox":null,className:"group relative flex items-end justify-center ".concat(i),children:[(0,o.jsx)("input",{type:"checkbox",ref:n,className:"absolute cursor-pointer opacity-0 ".concat(d),checked:s,disabled:r,...f&&{"aria-label":f},...p}),(0,o.jsx)(a,{className:"".concat(d," ").concat(c," pointer-events-none rounded-sm border-solid duration-200 ").concat(r?s?"border-none bg-gray-L300 text-white dark:bg-gray-D900 dark:text-gray-D600 dark:group-hover:text-black":"rounded-sm border-gray-L200 bg-gray-D200 text-transparent dark:border-gray-D800":s?u:h)})]});return t?(0,o.jsxs)("label",{className:"inline-flex items-center rounded-sm border-4 border-solid border-transparent bg-transparent p-2 hover:bg-gray-buttonHover ".concat(r?"cursor-not-allowed":"cursor-pointer"),children:[g,(0,o.jsx)("span",{className:"mx-5 text-sm font-normal leading-normal tracking-normal ".concat(r?"text-gray-L500":""),children:t})]}):g},c=s.forwardRef((e,t)=>(0,o.jsx)(d,{...e,forwardedRef:t}));c.displayName="CheckboxWithRef";var u=c},303833:function(e,t,n){"use strict";var r,o;n.d(t,{T:function(){return r}}),(o=r||(r={}))[o.SEARCH_ASSISTANT_AGENT=1002]="SEARCH_ASSISTANT_AGENT",o[o.ASK_AGENT_LESSON_PAGE=1003]="ASK_AGENT_LESSON_PAGE",o[o.SEARCH_ADVISOR_AGENT=1004]="SEARCH_ADVISOR_AGENT",o[o.AUDIO_PLAYER_AGENT=1005]="AUDIO_PLAYER_AGENT",o[o.CLOUD_LAB_ASSISTANT_AGENT=1006]="CLOUD_LAB_ASSISTANT_AGENT"},134645:function(e,t,n){"use strict";n.d(t,{n:function(){return r}});let r=14},242837:function(e,t,n){"use strict";n.d(t,{J:function(){return r}});let r=10},240743:function(e,t,n){"use strict";n.d(t,{A:function(){return r}});let r=n(134645).n+9},772181:function(e,t,n){"use strict";n.d(t,{F:function(){return r}});let r=25},798738:function(e,t,n){"use strict";n.d(t,{V:function(){return r}});let r=1},424261:function(e,t,n){"use strict";n.d(t,{f:function(){return s}});var r=n(931549),o=n(551276);let s=e=>{Promise.all([n.e(222926),n.e(145804)]).then(n.bind(n,145804)).then(t=>{let n=t.default;(0,o.K)((0,r.jsx)(n,{params:e}))})}},308292:function(e,t,n){"use strict";n.d(t,{dR:function(){return g},H8:function(){return N},uf:function(){return w},jE:function(){return y},Z$:function(){return b},oQ:function(){return x},md:function(){return k},LB:function(){return C},NM:function(){return f}});var r=n(917144),o=n(881762),s=n(303833),i=n(227595),a=n(10482),l=n(810343),d=n(262270),c=n(332936),u=n(108111),h=n(989648),m=n(878459);let p=e=>{var t,n,r,o;let{pathname:s,resolvedPath:i}=e;return(null==s?void 0:s.startsWith("/courses/"))&&!i||(null===(t=i||s)||void 0===t?void 0:t.startsWith("/pal/"))&&!(null===(n=i||s)||void 0===n?void 0:n.startsWith("/pal/p/"))||(null==s?void 0:s.startsWith("/coursesv2/"))&&!i||(null===(r=i||s)||void 0===r?void 0:r.startsWith("/interview-prep/"))&&!(null===(o=i||s)||void 0===o?void 0:o.startsWith("/interview-prep/coding"))||(null==s?void 0:s.startsWith("/path/"))||(null==s?void 0:s.startsWith("/module/page/"))||(null==s?void 0:s.startsWith("/cloudlab/"))||(null==s?void 0:s.startsWith("/cloudlabs/"))},f=()=>{let{data:e}=(0,d.Pc)(),t=!!(null==e?void 0:e.user_id),n=(0,c.usePathname)(),r=(0,h.Z)(),o=(0,m.h)(e=>{var t;return null===(t=e.userConfig.data)||void 0===t?void 0:t.constants}),{userHaveLimits:s,askAIAgentFreeTriesConsumed:i,userAskAIFreeTriesLimit:a,showUpgradeModalOnAskAgentCTAClick:l,hideFreeTriesLimitInfo:f,subscriptionPlansLoading:g,incrementAskAgentFreeTriesConsumed:v,incrementAIConceptsFreeTriesConsumed:x}=(0,u.Z)(e,o),w=p({pathname:n,resolvedPath:r});return{showChatComponent:w,shouldShowSignupModal:!t&&w,userHaveLimits:s,askAIAgentFreeTriesConsumed:i,userAskAIFreeTriesLimit:a,showUpgradeModalOnAskAgentCTAClick:l,hideFreeTriesLimitInfo:f,subscriptionPlansLoading:g,incrementAskAgentFreeTriesConsumed:v,incrementAIConceptsFreeTriesConsumed:x}},g=[{type:a.oK.AI_MESSAGE,content:"What would you like to understand in this lesson?",hidden:!1}],v=e=>{let t=e.trim();for(;t.startsWith('"')||t.startsWith(",");)t=t.slice(1);for(;t.endsWith('"')||t.endsWith(",");)t=t.slice(0,-1);return t.trim()},x=(e,t,n,r,i,a,l)=>(0,o.Z)({url:"/api/ai/agent/feedback",type:"POST",data:{message_index:e,ai_message:t,reaction:n?1:0,feedback_category:a,feedback_message:r,session_id:i,agent_id:s.T.ASK_AGENT_LESSON_PAGE,page_ref:l}}),w=()=>(0,o.Z)({url:"/api/ai/agent/".concat(s.T.ASK_AGENT_LESSON_PAGE,"/session"),type:"GET"}),y=e=>{let t=e.indexOf('"reply"');if(-1!==t){let n=e.indexOf(":",t)+1,r=e.indexOf('"continueChat"',n)-1,o=-1!==r?r:e.length;
1return v(e.slice(n,o).replace(/\\"/g,'"').replace(/\\n/g,"\n"))}return""},b=e=>(e=>{try{let t=JSON.parse(e.trim());if(!t||"object"!=typeof t)return null;return t}catch(e){return null}})(e),C=e=>{let t=!!e,n=async()=>{try{var t;let n=await (0,o.Z)({url:"/api/ai/ask-agent-chat?session_id=".concat(e),type:"GET"}),r=n?JSON.parse(n):{};return(null===(t=r.chat_messages)||void 0===t?void 0:t.length)?r.chat_messages:g}catch(e){return(0,l.u)(Error("Error fetching Ask Agent chat messages: ".concat(JSON.stringify((null==e?void 0:e.message)?e.message:e)))),g}},{data:s,error:i,isLoading:a,mutate:d}=(0,r.ZP)(t?["ask-agent-chat",e]:null,n);return{chat:null!=s?s:g,isLoading:a,error:i,mutate:d}},N=async e=>{try{await (0,o.Z)({url:"/api/ai/ask-agent-chat?session_id=".concat(e),type:"DELETE"})}catch(e){(0,l.u)(Error("Error deleting Ask Agent chat messages: ".concat(JSON.stringify((null==e?void 0:e.message)?e.message:e))))}},k=async e=>{let{session_id:t,user_id:n,chat:r}=e;try{await (0,i.le)({endpoint:"ai/ask-agent/content-page/update-chat",method:"POST",body:JSON.stringify({session_id:t,user_id:n,chat:r})})}catch(e){(0,l.u)(Error("Error updating Ask AI chat messages: ".concat(JSON.stringify((null==e?void 0:e.message)?e.message:e))))}}},581215:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var r=n(931549),o=n(449529),s=n(44194);n(870873);var i=n(2307);let a=/```[a-zA-Z0-9+#]*\n([\s\S]*?)```/,l=/```([a-zA-Z0-9+#]*)/,d=/Passed Test Cases:\s*(\d+)\s*\/\s*(\d+)/,c=(e,t)=>{let n=e.match(a);if(!n)return{language:t,code:e};let r=e.match(l),o=n[1].match(d),s=(o?n[1].slice(0,o.index):n[1]).trim();return{language:(null==r?void 0:r[1])||t,code:s}};var u=n(796566),h=n(456753),m=n(231354),p=n(501582),f=n(480333),g=n(300417),v=e=>{var t;let{mcqStatement:n,updateContentState:o,mcqWidgetState:a,onSendClick:l,setMcqRendered:d,renderLatexToHTML:c,viewOnly:u=!1}=e,[h,m]=s.useState(!1),p=h?e=>{}:o;return s.useEffect(()=>{d(!h)},[h]),(0,r.jsxs)("div",{className:"my-4 w-full rounded border-2 border-solid border-gray-L200 bg-white dark:border-gray-D1300 dark:bg-gray-D1300",children:[(0,r.jsx)("div",{className:"my-6 px-4 sm:px-10",children:(0,r.jsx)("div",{className:"mt-5 ",children:(0,r.jsx)("div",{className:"markdownViewer markdown-default  markdown-table markdown-viewer markdown-viewer-slate markdown-viewer-skill-assessment select-text",children:(0,r.jsx)(f.default,{mdHtml:(0,i.c)({markdownText:c(n)}),customStyles:"markdownViewer markdown-default  markdown-table markdown-viewer markdown-viewer-slate markdown-viewer-skill-assessment select-text"})})})}),(0,r.jsx)("div",{className:"w-full bg-gray-L50 dark:bg-gray-D1300",children:(0,r.jsx)("div",{className:"flex w-full flex-col whitespace-pre-wrap px-4 pb-4 pt-8 sm:px-10",children:(0,r.jsx)(g.default,{updateContentState:p,data:{...a},mode:"view",getComponentDefault:g.default.getComponentDefault,validateWidgetContent:g.default.validateWidgetContent})})}),!u&&(0,r.jsx)("div",{className:"my-6 flex w-full justify-end px-10",children:(0,r.jsx)("button",{className:"outlined-primary navigation-text rounded-sm ",onClick:()=>{var e;m(!0),l(!1,!1,!0,a.content.statements[0][null==a?void 0:null===(e=a.protectedContent)||void 0===e?void 0:e.answers[0]].text)},disabled:(null==a?void 0:null===(t=a.protectedContent)||void 0===t?void 0:t.answers[0])===void 0||h,children:"Submit Answer"})})]})},x=n(710042);let w=e=>e?e.replace(/\\\[(.*?)\\\]|\\\((.*?)\\\)/g,(e,t,n)=>{let r=!!t;try{return o.Z.renderToString(t||n,{displayMode:r})}catch(t){return console.error("Error rendering ".concat(r?"block":"inline"," LaTeX:"),t),e}}):"",y=(e,t)=>{let n={content:"",mcqStatement:"",options:[],containsMCQ:!1};if(!t)return n.content=e,n;let r=e.split("MCQ Formatted");if(r.length<2)return n.content=e,n;n.content=r[0].trim(),n.containsMCQ=!0;let o=r[1].trim().split("Options Formatted");if(o.length<2)return n.mcqStatement=r[1].trim(),n;n.mcqStatement=o[0].trim();let s=o[1].trim().split(/\n/);return n.options=s.filter(e=>/^[A-D]\.\s/.test(e)).map(e=>e.trim()),n};var b=e=>{let{review:t,language:n=null,isCodeReview:o=!1,isAiSearch:a=!1,textClasses:l="",L2CLandingPage:d=!1,onSendClick:g=()=>{},useQuizWidget:b=!1,setMcqRendered:C=()=>{},image:N=null,isHumanResponse:k=!1,isCodeSubmission:E=!1,disableExplainAI:j=!1,viewOnly:_=!1,customClassName:S="",isDemoPage:A=!1}=e,T=!!n,O=(0,x.Z)(),L=E?c(t,n||"python"):null,[D,I]=s.useState({content:{statements:[[{text:"",mdHtml:"<p></p>"},{text:"",mdHtml:"<p></p>"},{text:"",mdHtml:"<p></p>"},{text:"",mdHtml:"<p></p>"}]],isMulti:!1},protectedContent:{answers:[]}}),P=!T&&(0,u.tZ)(t),R=y(t,b),Z=R.options[3]||R.options[2]||R.options[1]||R.options[0];s.useEffect(()=>{var e,t,n,r;I({content:{statements:[[{text:null!==(e=R.options[0])&&void 0!==e?e:"",mdHtml:R.options[0]?(0,i.c)({markdownText:w(R.options[0])}):"<p></p>"},{text:null!==(t=R.options[1])&&void 0!==t?t:"",mdHtml:R.options[1]?(0,i.c)({markdownText:w(R.options[1])}):"<p></p>"},{text:null!==(n=R.options[2])&&void 0!==n?n:"",mdHtml:R.options[2]?(0,i.c)({markdownText:w(R.options[2])}):"<p></p>"},{text:null!==(r=R.options[3])&&void 0!==r?r:"",mdHtml:R.options[3]?(0,i.c)({markdownText:w(R.options[3])}):"<p></p>"}]],isMulti:!1},protectedContent:{answers:[]}})},[Z]);let M=(0,u.GC)(R.content).split("```"),H=0,F=N&&(0,u.W6)(N);return(0,r.jsxs)("div",{className:"flex w-full flex-grow flex-col ".concat(S),children:[L?(0,r.jsxs)("div",{className:"relative w-full",children:[(0,r.jsx)(m.default,{codeContent:{language:L.language.toLowerCase(),content:L.code,theme:O?p.OP.vsDark:p.OP.vsLight},onEditorChange:(e,t)=>
1{},readOnly:!0,maxLines:17,disableExplainAI:j}),(0,r.jsx)(h.Z,{codeToCopy:L.code})]}):M.map((e,t)=>t%2==0?A?(0,r.jsx)("span",{children:e}):(0,r.jsx)(f.default,{mdHtml:(0,i.c)({markdownText:w(e),disableMarkdown:k}),customStyles:l||(d?"text-gray-D200":o?"markdown-viewer-code-review":a?"markdown-viewer-ai-search":"")}):(0,r.jsxs)("div",{className:"relative w-full",children:[(0,r.jsx)(m.default,{codeContent:{language:T?"".concat(n).toLowerCase():(P[H++]||"python").toLowerCase(),content:e.trim()},onEditorChange:(e,t)=>{},readOnly:!0,maxLines:17,disableExplainAI:j}),(0,r.jsx)(h.Z,{codeToCopy:e})]})),F&&(0,r.jsx)("div",{className:"svg-wrapper flex h-auto w-full flex-col items-start justify-start",children:(0,r.jsx)("img",{className:"svg-container h-auto",src:F,alt:"PNG"})}),R.containsMCQ&&(0,r.jsx)(v,{mcqStatement:R.mcqStatement,updateContentState:I,mcqWidgetState:D,onSendClick:g,setMcqRendered:C,renderLatexToHTML:w,viewOnly:_})]})}},796566:function(e,t,n){"use strict";n.d(t,{g4:function(){return k},Vn:function(){return L},W6:function(){return A},pn:function(){return E},I4:function(){return O},FV:function(){return C},tZ:function(){return _},Ov:function(){return N},IK:function(){return j},GC:function(){return S},xQ:function(){return y},FF:function(){return b},mn:function(){return T}});var r=n(931549),o=n(881762);n(44194);var s=n(520649),i=n(161514),a=n(626119),l=n(959495),d=n.n(l),c=n(227595),u=n(680799),h=n(344428),m=n(989648),p=n(487054),f=n(710042),g=n(441244),v=n(206001),x=n(853224),w=n(424261);let y=async function(e,t,n,r,o,i,a,l,d,u,h,m,p){let f=arguments.length>13&&void 0!==arguments[13]?arguments[13]:g.sZ,x=arguments.length>14?arguments[14]:void 0,w={author_id:e,work_id:t,page_id:n,comp_id:r,prompt_id:o,user_id:i,system_prompt:a,user_prompt:l,is_draft:d,path_author_id:h===s.dL.COLLECTION?null:m,path_id:h===s.dL.COLLECTION?null:p,...x&&{code_feedback_context:JSON.stringify({type_of_error:x.error?"TRUE":"FALSE",error_description:x.error||"",failed_test_case:x.error||x.input?"inputs: ".concat(x.input,"\nexpected output: ").concat(x.expected_output,"\nmy output:").concat(x.actual_output,"\n"):"No failed test case found"})}};await (0,c.le)({endpoint:f,method:"POST",body:JSON.stringify(w)}).then(async e=>{if(!e.ok)throw Error();await (0,v.D)(e,u)}).catch(()=>{throw Error()})},b=()=>(0,x.P)("enable_code_feedback_agent",!0)||(0,p.hN)()?g.Be:g.sZ,C=(e,t,n,r,s)=>(0,o.Z)({url:"/api/code/review",type:"POST",data:{author_id:e,work_id:t,system_prompt:n,user_prompt:r,is_draft_page:s}}),N=(e,t,n,r,s,i)=>(0,o.Z)({url:"/api/codetest/review",type:"POST",data:{author_id:e,work_id:t,page_id:n,comp_id:r,prompt_id:s,user_prompt:i}}),k=e=>{let{children:t,className:n}=e,o=(0,f.Z)();return(0,r.jsx)("p",{className:"m-0 p-0 ".concat(o?d()["loading-dark"]:d().loading).concat(n?" ".concat(n):""),children:t})},E=(e,t,n,r,o,s)=>"failure"===r&&o?e.replace("TYPE_OF_ERROR",s.error?"TRUE":"FALSE").replace("ERROR_DESCRIPTION",s.error).replace("FAILED_TEST_CASE","inputs: ".concat(s.input,"\nexpected output: ").concat(s.expected_output,"\nmy output:").concat(s.actual_output,"\n")).replace("USER_CODE",t):e+"\ncode:\n"+t+"\n"+n,j=e=>e.split("```").map(e=>e.trim()+"\n").reduce((e,t,n)=>e+(n%2==1?"```"+t+"```":t),""),_=e=>e.split("```").map((e,t)=>t%2==1?e.trim().split("\n")[0]:"").filter(e=>""!==e),S=e=>e.split("```").map((e,t)=>t%2==1?e.split("\n").slice(1).join("\n"):e).join("```"),A=e=>"image/png"===e.type?URL.createObjectURL(e):null,T=()=>{let e=(0,a.t)();return()=>(0,w.f)({styleType:"leftAligned",title:"Evaluate your code with AI",description:"Get Educative Unlimited to unlock AI-powered feedback <br /> on your code. <ul><li> Get feedback on your code</li><li>Debug your code</li></ul>",confirmText:"Get Educative Unlimited",cancelText:"Cancel",onConfirm:()=>{(0,i.Z)("CODETEST_WIDGET","Clicked_GetEducativeSub_Button","AI"),e.push("/unlimited")}})},O=e=>e.filter(e=>{let{text:t,displayText:n}=e;return t&&n}),L=e=>{var t,n;let{onUserFeedback:o,authorId:s,workId:i,pageId:l,compId:d,code:p,appendCode:f,redesignedCodeTest:g=!1,promptMessage:v="Did you find this helpful?",source:x=""}=e,w=(0,a.t)(),{result:y,resultsCache:b,submitted:C,setSubmitted:N,hideToast:k,setHideToast:E,animationComplete:j,setAnimationComplete:_}=(0,h.R)(),{id:S,displayText:A}=null!==(n=y.prompt)&&void 0!==n?n:{id:""},T=!y.loading&&y.loaded,O=(0,m.Z)(),L=e=>N(t=>({...t,[S]:e}));return T&&!k[S]&&(0,r.jsx)(u.Z,{shouldRenderThumbs:!C[S]&&!(null===(t=b.current[S])||void 0===t?void 0:t.userFeedback),submitted:C[S],animationComplete:j[S],handleThumbClick:e=>{o(e,A),(0,c.WG)(w,s,i,l,d,y.review,A,e,"code: \n"+p+"\n"+f,()=>{L(!0),b.current={...b.current,[S]:{...b.current[S],userFeedback:!0}}},"CodeTest",x,O)},handleHideToast:e=>E(t=>({...t,[S]:e})),handleAnimationComplete:e=>_(t=>({...t,[S]:e})),redesignedCodeTest:g,promptMessage:v})}},400721:function(e,t){"use strict";t.Z={CATEGORY:"category",ARTICLE:"article",CHOICE:"choice"}},140459:function(e,t,n){"use strict";n.d(t,{E:function(){return o}});var r=n(931549);let o=e=>{let{innerCircleClasses:t,innerCircleRadius:n,outerCircleClasses:o,...s}=e;return(0,r.jsxs)("svg",{fill:"transparent",height:"24",viewBox:"0 0 24 24",width:"24",...s,children:[(0,r.jsx)("circle",{className:o,cx:"12",cy:"12",r:"10"}),(0,r.jsx)("circle",{className:t,cx:"12",cy:"12",r:n,strokeWidth:0})]})}},216184:function(e,t,n){"use strict";n.d(t,{Ej:function(){return a},Su:function(){return l},pG:function(){return c}});var r=n(881762),o=n(405358),s=n(227595),i=n(206001);let a=e=>e.map(e=>"".concat(e.type,": ").concat(e.content)).join("\n")||"",l=e=>{let{sender_message:t,is_helpful:n,author_id:o,work_id:s,page_id:i,chat:l,source:d,iteration:c=0}=e;return(0,r.Z)({url:"/api/ai/chat/feedback",type:"POST",data:{author_id:o,work_id:s,page_id:i,sender_message:t,is_helpful:n,chat:a(l),source:d,iteration:c}})},d=(e,t)=>{throw t(e=>{let t=[...e];return t[t.length-1].content="Something went wrong. Please try again.",t}),Error(e)},c=async(e,t,n,r,o,a,l,c,h,m)=>{await (0,s.le)({endpoint:"ai/assistant",method:"POST",body:JSON.stringify({prompt_messages:n,content:u(r),author_id:e,collection_id:t,page_id:o,user_id:a,page_title:l})}).then(async e=>{if(!e.ok){d(e,c);return}await (0,i.D)(e,h,m)}).catch(e=>{d(e,c)})},u=e=>{let t="",n={[o.L.MARKDOWN]:"mdHtml",SlateHTML:"html",[o.L.CODE]:"content"},r={[o.L.CODE]:h};for(let o of e)if(o.type in n){let e=o.content[n[o.type]];if(o.type in r)t+=e+r[o.type](o);else try{let n=new DOMParser().parseFromString(e,"text/html");
1for(let e of["script","style"])n.querySelectorAll(e).forEach(e=>e.remove());t+=n.body.textContent||""}catch(e){}}return t},h=e=>{let t="\n";for(let n of e.content.additionalContent||[])t+="File name:"+(null==n?void 0:n.fileName)+"\nCode:"+(null==n?void 0:n.content)+"\n";return t}},735689:function(e,t,n){"use strict";n.d(t,{e:function(){return d}});var r=n(931549),o=n(44194),s=n(764412),i=n(667054),a=n(10482),l=n(710042);let d={type:a.oK.HUMAN_MESSAGE,content:"Ask AI Mentor"};t.Z=e=>{let{messages:t,preprocess:n,postprocess:a}=e,d=(0,l.Z)(),c=(0,s.a)("sm"),u=(0,o.useId)();return(0,r.jsx)("div",{className:"flex",style:{background:"linear-gradient(to right, #64E4D0, #2563EB)",padding:"1px",borderRadius:"40px"},children:(0,r.jsxs)("button",{className:"content-default bg-neutral-secondary flex h-8 rounded text-sm font-medium sm:h-10 sm:text-base",style:{background:d?"":"linear-gradient(to bottom, #FFFFFF, #EEEEFF)",borderRadius:"40px"},onClick:()=>{null==n||n();let e=new CustomEvent("explain-with-ai-chat-history",{detail:{messages:t}});window.dispatchEvent(e),null==a||a()},children:[(0,r.jsx)(i.Z,{gradientId:u,className:"mr-1.5 h-6 w-6 "}),c?"Ask":"Ask Follow-up"]})})}},426828:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return S}});var r=n(931549),o=n(881762),s=n(44194),i=n(222617),a=n(161514),l=n(487054),d=n(626119),c=n(810343),u=n(308292),h=n(216184),m=n(667054),p=e=>{let{text:t,className:n="w-24"}=e;return(0,r.jsx)("div",{className:"flex",children:(0,r.jsxs)("div",{className:"flex items-center ".concat(n),children:[(0,r.jsx)(m.Z,{className:"h-6 w-6"}),(0,r.jsx)("span",{className:"content-emphasis whitespace-nowrap pl-2 text-lg font-medium",children:t})]})})},f=n(285232),g=n(764412),v=n(522283),x=n(551276);let w=e=>{Promise.all([n.e(222926),n.e(855310),n.e(265978)]).then(n.bind(n,265978)).then(t=>{let n=t.default;(0,x.K)((0,r.jsx)(n,{params:e}))})};var y=n(10482),b=n(97713),C=n(395124),N=n(158169),k=n(657768),E=n(853224),j=n(735689),_=e=>{let{children:t,isInterviewPrep:n}=e,[o,i]=(0,s.useState)(!1),[a,l]=(0,s.useState)({x:0,y:0}),d=(0,s.useRef)(null),c=(0,g.a)("sm");return(0,s.useEffect)(()=>{d.current&&(d.current.style.transform="translate(".concat(a.x,"px, ").concat(a.y,"px)"))},[a]),(0,s.useEffect)(()=>{if((c||n)&&d.current){d.current.style.position="fixed";let e="100px";c&&(e="10px"),d.current.style.top=e,d.current.style.left="-20px"}},[c,n]),(0,r.jsx)("div",{className:"flex cursor-move items-center justify-center",ref:d,onMouseMove:e=>{o&&l({x:a.x+e.movementX,y:a.y+e.movementY})},onMouseDown:()=>i(!0),onMouseUp:()=>i(!1),children:t})},S=e=>{var t;let{closeWindow:n,getSelectedText:m,mdHtml:x="",codeContent:S="",hideTellMeMoreButton:A}=e,{userInfoState:T}=(0,C.su)(),O=(null===(t=T.data)||void 0===t?void 0:t.organization_id)||null,L=(0,d.t)(),{author_id:D,collection_id:I,page_id:P,courseUrlSlug:R,pageUrlSlug:Z,pathUrlSlug:M}=(null==L?void 0:L.query)||{}
1,[H,F]=(0,s.useState)(""),[G,W]=(0,s.useState)(!1),[B,V]=(0,s.useState)(""),[z,U]=(0,s.useState)(0),[q,J]=(0,s.useState)([]),K=new DOMParser,Q=s.useRef(K.parseFromString(x,"text/html").body.textContent),[Y,X]=(0,s.useState)(!1),$=(0,b.$)(L),ee=(0,N.Y)(null==L?void 0:L.asPath),et=(0,g.a)("sm"),en=(0,g.a)("md"),{showChatComponent:er,userHaveLimits:eo,subscriptionPlansLoading:es,incrementAIConceptsFreeTriesConsumed:ei}=(0,u.NM)(),ea=(0,E.P)(i.Z,!0)||(0,l.hN)(),el=(0,f.EV)(et,en),ed=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];await (0,f.Xn)(W,m,q,F,z,J,Q.current,V,U,O,e,ei,S,ea)};(0,s.useEffect)(()=>{if(et)return document.documentElement.classList.add("overflow-hidden"),()=>document.documentElement.classList.remove("overflow-hidden")},[et]),(0,s.useEffect)(()=>{0!==z||es||ed(eo)},[eo,es]);let ec=async e=>await (0,o.Z)({url:"/api/ai/chat/feedback",type:"POST",data:{author_id:D,work_id:I,page_id:P,course_url_slug:R,path_slug:M,page_url_slug:Z,is_helpful:e,chat:(0,h.Ej)(q),source:y.gp.AI_CONCEPTS,iteration:z,page_type:ee?"cloudlab_task":void 0}}),eu=e=>{n(),w({title:et?"Help us improve":"Help us improve your learning experience",subtitle:"Your feedback helps us make AI explanations clearer, accurate and more helpful. ☀️",placeholder:"Please share what made the explanation unhelpful...",buttonText:"Submit Feedback",showSuccessIcon:!0,executeAsynchronously:!0,successTitle:"Thank you for your feedback",characterLimit:1024,url:"/api/ai/chat/feedback",type:"POST",data:{author_id:D,work_id:I,page_id:P,course_url_slug:R,page_url_slug:Z,path_slug:M,is_helpful:e,chat:(0,h.Ej)(q),source:y.gp.AI_CONCEPTS,iteration:z,page_type:ee?"cloudlab_task":void 0}})},eh=async()=>{if((0,a.Z)("ADAPTIVE_AI",{1:"Clicked_Explain_AI_Further",2:"Clicked_Explain_AI_Didnt_Understand"}[z],z),1===z&&ec(!1).catch(e=>{(0,c.u)(Error("AI Concepts Feedback submission failed with error: ".concat(JSON.stringify(e))))}),2===z){X(!0),eu(!1);return}ed()},em=G&&!H;return(0,r.jsx)(_,{isInterviewPrep:$,children:(0,r.jsx)("div",{className:et?"fixed inset-0 flex select-none":"",style:et?{top:"calc(var(--header-height) + var(--site-wide-banner-height))",backdropFilter:"brightness(30%)"}:{},children:(0,r.jsx)("div",{className:"flex select-none rounded bg-white shadow-lg dark:bg-gray-D1200 ".concat(et?"fixed inset-0 mx-9 my-6":"relative"),style:$?{height:"".concat(el.PARENT_CONTAINER.HEIGHT,"px"),width:"".concat(el.PARENT_CONTAINER.WIDTH,"px"),paddingLeft:"8px"}:{width:"".concat(el.PARENT_CONTAINER.WIDTH,"px"),height:"".concat(el.PARENT_CONTAINER.HEIGHT,"px")},children:Y||B?(0,r.jsx)(r.Fragment,{children:B?(0,r.jsxs)("div",{className:"relative flex h-full w-full flex-col pt-6",children:[(0,r.jsx)(p,{text:"AI Explanation",className:"mx-4 h-7 w-full sm:mx-6"}),(0,r.jsx)("div",{className:"flex flex-col px-4 py-6 sm:p-6",children:(0,r.jsx)("div",{className:"bg-danger-light flex h-full max-h-40 w-full items-start justify-center rounded-md",children:(0,r.jsxs)("span",{className:"content-default w-full px-4 py-3 font-sans text-base font-normal",children:["That didn't go as planned. \uD83D\uDE48",(0,r.jsx)("br",{}),(0,r.jsx)("br",{}),"We couldn't generate an explanation right now. Your prompt is safe - please try again in a moment."]})})}),(0,r.jsx)("div",{className:"bg-neutral-secondary s-gray-disabled relative mt-auto flex w-full gap-x-4 border border-x-0  border-b-0 border-solid py-4 sm:items-center sm:justify-center",children:(0,r.jsx)("div",{className:"flex w-full justify-end",children:(0,r.jsx)("div",{className:"mr-6 flex w-full justify-end",children:(0,r.jsx)("button",{className:"navigation-text contained-primary h-8 cursor-pointer rounded text-sm font-medium sm:h-10 sm:text-base",onClick:e=>{e.preventDefault(),n()},children:"Try Again Later"})})})})]}):(0,r.jsx)(r.Fragment,{})}):em?(0,r.jsxs)("div",{className:"relative flex h-full w-full flex-col gap-y-2 pt-6",children:[(0,r.jsx)(p,{text:"AI Explanation",className:"mx-4 h-7 w-full sm:mx-6"}),(0,r.jsx)("div",{className:"relative flex h-full w-full flex-col overflow-x-hidden overflow-y-scroll overscroll-contain",children:(0,r.jsx)("div",{className:"flex h-full overflow-y-scroll overscroll-y-contain text-base dark:text-white sm:h-full sm:w-full",children:(0,r.jsxs)("div",{className:"mt-6 flex w-full flex-col",children:[(0,r.jsxs)("div",{className:"flex w-full  flex-col px-4 sm:px-6",children:[(0,r.jsx)("div",{className:"bg-neutral-tertiary flex h-4 w-full animate-pulse rounded-md group-even:bg-white dark:group-even:bg-gray-D1000"}),(0,r.jsx)("div",{className:"bg-neutral-tertiary mt-3 flex h-4 w-full animate-pulse rounded-md group-even:bg-white dark:group-even:bg-gray-D1000"}),(0,r.jsx)("div",{className:"bg-neutral-tertiary mt-3 flex h-4 w-full animate-pulse rounded-md group-even:bg-white dark:group-even:bg-gray-D1000"}),(0,r.jsx)("div",{className:"bg-neutral-tertiary mt-3 flex h-4 w-full animate-pulse rounded-md group-even:bg-white dark:group-even:bg-gray-D1000"})]}),(0,r.jsx)("div",{className:"bg-neutral-tertiary s-gray-disabled mt-auto flex h-18 w-full animate-pulse items-end justify-end border border-solid group-even:bg-white dark:group-even:bg-gray-D1000"})]})})})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"relative flex h-full w-full flex-col gap-y-2 pt-6",children:[(0,r.jsx)(p,{text:"AI Explanation",className:"mx-4 h-7 w-full sm:mx-6"}),(0,r.jsxs)("div",{className:"relative flex flex-col items-center justify-center overflow-x-hidden overflow-y-scroll overscroll-contain ".concat(et?"h-full w-full":""),children:[(0,r.jsx)("div",{className:"mt-6 flex overflow-y-scroll overscroll-y-contain text-base dark:text-white ".concat(et?"h-full w-full px-4":""),style:et?{}:{height:em?"100%":"".concat(el.RESPONSE_CONTAINER.HEIGHT,"px"),width:em?"100%":"".concat(el.RESPONSE_CONTAINER.WIDTH,"px")},children:(0,r.jsx)("span",{className:"content-default text-base font-normal",style:{overflowWrap:"anywhere",curs
1or:"text",userSelect:"text"},onMouseDown:e=>{e.stopPropagation()},dangerouslySetInnerHTML:{__html:(0,k.markdownToHtml)(B||H)}})}),!G&&z>0&&(0,r.jsx)("div",{className:"bg-neutral-secondary s-gray-disabled relative flex w-full gap-x-4 border border-t sm:items-center sm:justify-center ".concat(et||en?"flex-wrap gap-y-2 py-4":"w-full py-4"),children:(0,r.jsxs)("div",{className:"flex w-full justify-between",children:[(0,r.jsx)("div",{className:"ml-6 flex w-full",children:er&&(0,r.jsx)(j.Z,{messages:q,preprocess:()=>(0,a.Z)("ADAPTIVE_AI","Clicked_Explain_AI_Ask_Follow_Up",z),postprocess:()=>n()})}),(0,r.jsxs)("div",{className:"ml-2 mr-6 flex w-full justify-end gap-x-2",children:[!(1===z&&A)&&(0,r.jsx)("button",{className:"Not helpful"===f.IL[z]?"outlined-primary content-primary-default h-8 rounded border border-solid bg-transparent text-sm font-medium  hover:bg-red-50 dark:hover:bg-red-100 sm:h-10 sm:text-base":"outlined-primary content-primary-default flex h-8 rounded text-sm font-medium sm:h-10 sm:text-base",onClick:e=>{e.preventDefault(),eh()},children:f.IL[z]}),(0,r.jsx)("button",{className:"navigation-text contained-primary h-8 rounded text-sm font-medium sm:h-10 sm:text-base",onClick:e=>{(0,a.Z)("ADAPTIVE_AI","Clicked_Explain_AI_Got_It",z),e.preventDefault(),ec(!0).catch(e=>{(0,c.u)(Error("AI Concepts Feedback submission failed with error: ".concat(JSON.stringify(e))))}).finally(()=>n())},children:et?(0,r.jsx)(v.Z,{className:"content-onbold-neutral-rest h-5 w-5"}):2===z?"Makes Sense":"Got it"})]})]})})]})]})})})})})}},285232:function(e,t,n){"use strict";n.d(t,{EV:function(){return g},IL:function(){return c},Vo:function(){return o},Xn:function(){return m}});var r,o,s=n(161514),i=n(810343),a=n(10482),l=n(206001),d=n(227595);let c={1:"Explain Further",2:"Not helpful"},u={1:"Explain this concept in further details",2:"Can you explain it with the help of an Example"},h=new Set(["able","about","above","abroad","according","accordingly","across","actually","adj","after","afterwards","again","against","ago","ahead","ain't","all","allow","allows","almost","alone","along","alongside","already","also","although","always","am","amid","amidst","among","amongst","an","and","another","any","anybody","anyhow","anyone","anything","anyway","anyways","anywhere","apart","appear","appreciate","appropriate","are","aren't","around","as","a's","aside","ask","asking","associated","at","available","away","awfully","back","backward","backwards","be","became","because","become","becomes","becoming","been","before","beforehand","begin","behind","being","believe","below","beside","besides","best","better","between","beyond","both","brief","but","by","came","can","cannot","cant","can't","caption","cause","causes","certain","certainly","changes","clearly","c'mon","co","co.","com","come","comes","concerning","consequently","consider","considering","contain","containing","contains","corresponding","could","couldn't","course","c's","currently","dare","daren't","definitely","described","despite","did","didn't","different","directly","do","does","doesn't","doing","done","don't","down","downwards","during","each","edu","eg","eight","eighty","either","else","elsewhere","end","ending","enough","entirely","especially","et","etc","even","ever","evermore","every","everybody","everyone","everything","everywhere","ex","exactly","example","except","fairly","far","farther","few","fewer","fifth","first","five","followed","following","follows","for","forever","former","formerly","forth","forward","found","four","from","further","furthermore","get","gets","getting","given","gives","go","goes","going","gone","got","gotten","greetings","had","hadn't","half","happens","hardly","has","hasn't","have","haven't","having","he","he'd","he'll","hello","help","hence","her","here","hereafter","hereby","herein","here's","hereupon","hers","herself","he's","hi","him","himself","his","hither","hopefully","how","howbeit","however","hundred","i'd","ie","if","ignored","i'll","i'm","immediate","in","inasmuch","inc","inc.","indeed","indicate","indicated","indicates","inner","inside","insofar","instead","into","inward","is","isn't","it","it'd","it'll","its","it's","itself","i've","just","k","keep","keeps","kept","know","known","knows","last","lately","later","latter","latterly","least","less","lest","let","let's","like","liked","likely","likewise","little","look","looking","looks","low","lower","ltd","made","mainly","make","makes","many","may","maybe","mayn't","me","mean","meantime","meanwhile","merely","might","mightn't","mine","minus","miss","more","moreover","most","mostly","mr","mrs","much","must","mustn't","my","myself","name","namely","nd","near","nearly","necessary","need","needn't","needs","neither","never","neverf","neverless","nevertheless","new","next","nine","ninety","no","nobody","non","none","nonetheless","noone","no-one","nor","normally","not","nothing","notwithstanding","novel","now","nowhere","obviously","of","off","often","oh","ok","okay","old","on","once","one","one
1s","one's","only","onto","opposite","or","other","others","otherwise","ought","oughtn't","our","ours","ourselves","out","outside","over","overall","own","particular","particularly","past","per","perhaps","placed","please","plus","possible","presumably","probably","provided","provides","que","quite","qv","rather","rd","re","really","reasonably","recent","recently","regarding","regardless","regards","relatively","respectively","right","round","said","same","saw","say","saying","says","second","secondly","see","seeing","seem","seemed","seeming","seems","seen","self","selves","sensible","sent","serious","seriously","seven","several","shall","shan't","she","she'd","she'll","she's","should","shouldn't","since","six","so","some","somebody","someday","somehow","someone","something","sometime","sometimes","somewhat","somewhere","soon","sorry","specified","specify","specifying","still","sub","such","sup","sure","take","taken","taking","tell","tends","th","than","thank","thanks","thanx","that","that'll","thats","that's","that've","the","their","theirs","them","themselves","then","thence","there","thereafter","thereby","there'd","therefore","therein","there'll","there're","theres","there's","thereupon","there've","these","they","they'd","they'll","they're","they've","thing","things","think","third","thirty","this","thorough","thoroughly","those","though","three","through","throughout","thru","thus","till","to","together","too","took","toward","towards","tried","tries","truly","try","trying","t's","twice","two","un","under","underneath","undoing","unfortunately","unless","unlike","unlikely","until","unto","up","upon","upwards","us","use","used","useful","uses","using","usually","v","value","various","versus","very","via","viz","vs","want","wants","was","wasn't","way","we","we'd","welcome","well","we'll","went","were","we're","weren't","we've","what","whatever","what'll","what's","what've","when","whence","whenever","where","whereafter","whereas","whereby","wherein","where's","whereupon","wherever","whether","which","whichever","while","whilst","whither","who","who'd","whoever","whole","who'll","whom","whomever","who's","whose","why","will","willing","wish","with","within","without","wonder","won't","would","wouldn't","yes","yet","you","you'd","you'll","your","you're","yours","yourself","yourselves","you've","zero","a","how's","i","when's","why's","b","c","d","e","f","g","h","j","l","m","n","o","p","q","r","s","t","u","uucp","w","x","y","z","I","www","amount","bill","bottom","call","computer","con","couldnt","cry","de","describe","detail","due","eleven","empty","fifteen","fifty","fill","find","fire","forty","front","full","give","hasnt","herse","himse","interest","itse”","mill","move","myse”","part","put","show","side","sincere","sixty","system","ten","thick","thin","top","twelve","twenty","abst","accordance","act","added","adopted","affected","affecting","affects","ah","announce","anymore","apparently","approximately","aren","arent","arise","auth","beginning","beginnings","begins","biol","briefly","ca","date","ed","effect","et-al","ff","fix","gave","giving","heres","hes","hid","home","id","im","immediately","importance","important","index","information","invention","itd","keys","kg","km","largely","lets","line","'ll","means","mg","million","ml","mug","na","nay","necessarily","nos","noted","obtain","obtained","omitted","ord","owing","page","pages","poorly","possibly","potentially","pp","predominantly","present","previously","primarily","promptly","proud","quickly","ran","readily","ref","refs","related","research","resulted","resulting","results","run","sec","section","shed","shes","showed","shown","showns","shows","significant","significantly","similar","similarly","slightly","somethan","specifically","state","states","stop","strongly","substantially","successfully","sufficiently","suggest","thered","thereof","therere","thereto","theyd","theyre","thou","thoughh","thousand","throug","til","tip","ts","ups","usefully","usefulness","'ve","vol","vols","wed","whats","wheres","whim","whod","whos","widely","words","world","youd","youre"]);(r=o||(o={}))[r.NONE=0]="NONE",r[r.QUIZ=1]="QUIZ";let m=async function(e,t,n,r,o,c,m,p,f,g){let v=arguments.length>10&&void 0!==arguments[10]&&arguments[10],x=arguments.length>11?arguments[11]:void 0,w=arguments.length>12?arguments[12]:void 0,y=arguments.length>13&&void 0!==arguments[13]&&arguments[13],b=arguments.length>14&&void 0!==arguments[14]?arguments[14]:0,C=arguments.length>15?arguments[15]:void 0,N=arguments.length>16?arguments[16]:void 0,k=arguments.length>17?arguments[17]:void 0,E=arguments.length>18?arguments[18]:void 0;e(!0);let j=t(),_=j.split(" ");if(0===b&&_.length<6&&_.every(e=>h.has(e.toLowerCase()))){e(!1),p("There is nothing specific to explain here.");return}p("");let S=[...n,{type:a.oK.HUMAN_MESSAGE,content:1===b?j:0===o?"".concat(_.length>=30?"Summarize":"Explain",' "').concat(j,'"'):u[o],feedback:0}];c(S);let A=y?{prompt_messages:S,markdownContent:m,organizationId:g,codeContent:w,widgetType:b,isSecondIteration:1===o,authorId:C,collectionId:N,pageId:k,compId:E}:{messages:S,markdownContent:m,userAIConceptsFreeTryConsumed:0===o&&v,organizationId:g,codeContent:w,widgetType:b,isSecondIteration:1===o,authorId:C,collectionId:N,pageId:k,compId:E},T=[...S,{content:"",feedback:0,type:a.oK.AI_MESSAGE}];r(""),await (0,d.le)({endpoint:y?"ai/config-agent/ai-concepts":"ai/concept",method:"POST",body:JSON.stringify(A)}).then(async t=>{if(!t.ok){p("Something went wrong. Our engineers are on it and will resolve the problem as soon as possible."),e(!1);return}await (0,l.D)(t,e=>{r(t=>t+=e),T[T.length-1].content+=e,c([...T])}),e(!1),(0===o||y)&&v&&x(),f(o+1)}).catch(t=>{(0,i.u)("".concat(1===b?"Explain with AI for Quiz Widget":"AI Concepts"," Response failed with error: "),t),0===b&&(0,s.Z)("ADAPTIVE_AI","AI_CONCEPTS_RESPONSE_FAILED"),p("Something went wrong. Our engineers are on it and will resolve the problem as soon as possible."),e(!1)})},p={MOBILE:{HEIGHT:500,WIDTH:343},TABLET:{HEIGHT:460,WIDTH:568},DESKTOP:{HEIGHT:400,WIDTH:613}},f={MOBILE:{HEIGHT:345,WIDTH:311},TABLET:{HEIGHT:252,WIDTH:520},DESKTOP:{HEIGHT:252,WIDTH:566}},g=(e,t)=>{let n=e?"MOBILE":t?"TABLET":"DESKTOP";return{PARENT_CONTAINER:p[n],RESPONSE_CONTAINER:f[n]}}},680799:function(e,t,n){"use strict";var r=n(931549),o=n(44194),s=n(558444),i=n(271256),a=n(353157);t.Z=e=>{let{shouldRenderThumbs:t,animationComplete:n,submitted:l,handleThumbClick:d,handleAnimationComplete:c,handleHideToast:u,shouldRenderCrossButton:h=!1,redesignedCodeTest:m=!1,promptMessage:p="Did you find this helpful?",isSplitView:f=!1,thumbsOnly:g=!1}=e;if((0,o.useEffect)(()=>{l&&setTimeout(()=>u(!0),2e3)},[l]),g)return(0,r.jsx)("div",{className:"flex w-full flex-shrink-0 items-center gap-2",children:t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{className:"fill-secondary h-4 w-4 cursor-pointer",onClick:()=>d(!0)}),(0,r.jsx)(i.Z,{className:"fill-secondary h-4 w-4 cursor-pointer",onClick:()=>d(!1)})]}):(0,r.jsx)("span",{className:"content-secondary text-xs",children:"Thank y
1ou for your feedback!"})});let v=m||f,x=v?"h-4 w-4 text-indigo-500 cursor-pointer dark:text-indigo-300":"fill-current text-indigo-700 cursor-pointer dark:text-indigo-50",w=v?"text-xs":"body-small text-indigo-900 dark:text-indigo-50";return(0,r.jsx)("div",{className:v?"flex justify-start sm:justify-end ".concat(f?"w-full":""):"sticky bottom-4 my-2 rounded-full border border-solid border-indigo-50 bg-indigo-50 shadow dark:border-indigo-500 dark:bg-indigo-500",children:t?(0,r.jsxs)("div",{className:v?"flex items-center gap-x-2":"mx-6 my-2 flex items-center gap-x-3",children:[h&&(0,r.jsx)(s.Z,{className:"h-4 w-4 cursor-pointer fill-current text-indigo-700 dark:text-indigo-50",onClick:()=>u(!0)}),(0,r.jsx)("span",{className:w,children:p}),(0,r.jsx)(a.Z,{className:x,onClick:()=>d(!0)}),(0,r.jsx)(i.Z,{className:x,onClick:()=>d(!1)})]}):(0,r.jsx)("div",{className:"".concat(v?"mx-0":"mx-5"," my-0.5 flex h-9 items-center"),children:(0,r.jsx)("span",{className:"".concat(w," ").concat(v?"order-1":""),children:"Thank you for your feedback!"})})})}},601369:function(e,t,n){"use strict";var r=n(931549),o=n(927976),s=n(937374);t.Z=e=>{var t;let{onChange:n,label:i=null,height:a=40,width:l=85,offColor:d,onColor:c,checkedText:u="",unCheckedText:h="",isChecked:m=!1,id:p="icon-switch",disableAccessibilityContainer:f=!1,disabled:g=!1,offHandleColor:v,onHandleColor:x,direction:w,togglePadding:y=0}=e,b=48-a,C=!f&&(b>0?(0,r.jsx)("div",{className:"cursor-pointer",style:{paddingTop:"".concat(b/2,"px")},onClick:e=>{e.preventDefault(),e.stopPropagation(),n(!m)}}):null);return(0,r.jsxs)("label",{htmlFor:p,className:w?"flex ".concat(w," items-center"):"",children:[i&&(0,r.jsx)("span",{className:null!==(t=({"flex-row":"mr-2","flex-row-reverse":"ml-2"})[w])&&void 0!==t?t:"",children:i}),C,(0,r.jsx)(o.Z,{height:a,width:l,handleDiameter:a-4-y,offColor:d||s.colors.gray.L600,onColor:g?s.colors.gray.L600:c||s.colors.green[500],checked:m,onChange:n,checkedIcon:(0,r.jsx)("div",{className:"flex h-full items-center justify-center pt-px text-white",children:(0,r.jsx)("span",{className:"font-normal",children:u})}),uncheckedIcon:(0,r.jsx)("div",{className:"flex h-full items-center justify-center pt-px text-white",children:(0,r.jsx)("span",{className:"font-normal",children:h})}),offHandleColor:v||s.colors.white,onHandleColor:x||s.colors.white,id:p,disabled:g,"aria-label":"Toggle Button"}),C]})}},152764:function(e,t,n){"use strict";n.d(t,{$u:function(){return i},EJ:function(){return a},ao:function(){return r},bW:function(){return s}});let r=e=>!!(null==e?void 0:e.toLowerCase().endsWith(".csv")),o=e=>{let t=[],n="",r=!1;for(let o=0;o<e.length;o++){let s=e[o];'"'===s?r&&'"'===e[o+1]?(n+='"',o++):r=!r:","!==s||r?n+=s:(t.push(n.trim()),n="")}return t.push(n.trim()),t},s=e=>{var t;if(!(null==e?void 0:e.trim()))return{rows:[[""]]};let n=e.split("\n").filter(e=>e.trim());if(!n.length)return{rows:[[""]]};let r=n.map(o);return(null===(t=r[r.length-1])||void 0===t?void 0:t.every(e=>!(null==e?void 0:e.trim())))||r.push([""]),{rows:r}},i=e=>{if(!e.rows.length)return"";let t=e=>/[,"\n]/.test(e)?'"'.concat(e.replace(/"/g,'""'),'"'):e,n=-1;for(let t=e.rows.length-1;t>=0;t--)if(e.rows[t].some(e=>null==e?void 0:e.trim())){n=t;break}return -1===n?"":e.rows.slice(0,n+1).map(e=>e.map(t).join(",")).join("\n")},a=(e,t,n)=>{let r={rows:e.rows.map(e=>[...e])};for(;r.rows.length<=t;)r.rows.push([""]);for(;r.rows[t].length<=n;)r.rows[t].push("");return r}},231354:function(e,t,n){"use strict";n.r(t),n.d(t,{CollaborativeCodeEditor:function(){return l}});var r=n(931549),o=n(91557),s=n(508310),i=n(262603);let a=e=>(0,r.jsx)(o.Z,{...e,dirtyBit:(0,i.ix)(e=>e.widgets.dirty)});t.default=a;let l=(0,s.J)(a)},91557:function(e,t,n){"use strict";n.d(t,{B:function(){return P},Z:function(){return I}});var r=n(931549),o=n(44194),s=n(134645),i=n(242837),a=n(240743),l=n(772181),d=n(798738),c=n(158641),u=n(227595),h=n(156321),m=n(203346),p=n(221456),f=n(561819),g=n(161514),v=n(108111),x=n(426828),w=n(667054),y=n(395124),b=n(878459);let C=(e,t)=>({top:t.top+t.height/2-e.height/2,left:t.left+t.width/2-e.width/2}),N=(e,t,n,r,o,s,i)=>{if(!s||!i)return{top:0,left:0};let l="start"===t?e.start:e.end,d={top:0,left:0,height:s.height,width:s.width,bottom:()=>d.top+s.height,right:()=>d.left+s.width},c={top:0,left:0,height:i.height,width:i.width,bottom:()=>c.top+i.height,right:()=>c.left+i.width};return d.top=Math.max(0,l.row-n-("start"===t?1.8:-1))*a.A,d.left=60+Math.max(0,l.column-Math.floor(r/o))*o,d.right()>c.right()-10&&(d.top+=a.A,d.left=c.right()-d.width-10),d.bottom()>
1c.bottom()-10&&(d.top=c.bottom()-d.height-10),{top:d.top,left:d.left}},k=e=>{var t,n,s,i,a,l,d,c,u,k,E,j,_,S;let{editor:A,children:T}=e,O=(0,o.useRef)(null),L=(0,o.useRef)(null),[D,I]=(0,o.useState)(!1),[P,R]=(0,o.useState)({top:0,left:0}),[Z,M]=(0,o.useState)(!1),H=(0,o.useRef)(!1),[F,G]=(0,o.useState)({top:0,left:0}),W=(0,o.useRef)(""),B=(0,o.useId)(),{userInfoState:V}=(0,y.su)(),{userConfig:z}=(0,b.h)(e=>e),{userHaveLimits:U,aiConceptsFreeTriesConsumed:q,userAIConceptsFreeTriesLimit:J,hideFreeTriesLimitInfo:K,isValidating:Q}=(0,v.Z)(V.data,null===(t=z.data)||void 0===t?void 0:t.constants),Y=parseInt(null!==(_=null===(s=z.data)||void 0===s?void 0:null===(n=s.constants)||void 0===n?void 0:n[p.Z])&&void 0!==_?_:"0"),X=parseInt(null!==(S=null===(a=z.data)||void 0===a?void 0:null===(i=a.constants)||void 0===i?void 0:i.explain_with_ai_ace)&&void 0!==S?S:"0"),$=Y===f.C.LEARNER_FF_L4_FULL_B2C||Y===f.C.LEARNER_FF_L2_FULL_INTERNAL&&(null===(d=V.data)||void 0===d?void 0:null===(l=d.email)||void 0===l?void 0:l.endsWith("@educative.io")),ee=X===f.C.LEARNER_FF_L4_FULL_B2C||X===f.C.LEARNER_FF_L2_FULL_INTERNAL&&(null===(u=V.data)||void 0===u?void 0:null===(c=u.email)||void 0===c?void 0:c.endsWith("@educative.io")),et=J-q,en=()=>{M(!0),H.current=!0},er=()=>{M(!1),H.current=!1};return(0,o.useEffect)(()=>{if(!A)return;let e=()=>{let e=A.renderer.characterWidth,t=A.renderer.scrollLeft,n=A.renderer.getFirstFullyVisibleRow(),r=A.getSelectedText();if(r.trim().length>3){var o,s;W.current=r;let i=A.getSelectionRange();R(N(i,(null==i?void 0:null===(o=i.start)||void 0===o?void 0:o.row)-n>2?"start":"end",n,t,e,null===(s=O.current)||void 0===s?void 0:s.getBoundingClientRect(),A.renderer.container.getBoundingClientRect())),I(!0)}else I(!1),er()},t=e=>{var t,n;let r=e.target;(null===(t=O.current)||void 0===t?void 0:t.contains(r))||(null===(n=L.current)||void 0===n?void 0:n.contains(r))||(I(!1),er())},n=e=>{var t,n;(null===(n=e.command)||void 0===n?void 0:null===(t=n.name)||void 0===t?void 0:t.startsWith("select"))||(I(!1),er())},r=e=>{I(!1)};return A.addEventListener("changeSelection",e),A.addEventListener("mousedown",t),document.addEventListener("mousedown",t),A.addEventListener("keyboardActivity",n),A.addEventListener("mousewheel",r),()=>{A.removeEventListener("changeSelection",e),A.removeEventListener("mousedown",t),document.removeEventListener("mousedown",t),A.removeEventListener("keyboardActivity",n),A.removeEventListener("mousewheel",r)}},[A]),(0,o.useEffect)(()=>{if(Z){var e;let{top:t,left:n}=C(null===(e=L.current)||void 0===e?void 0:e.getBoundingClientRect(),A.renderer.container.getBoundingClientRect());G({top:t,left:n})}else G({top:0,left:0})},[Z]),A&&!V.loading&&!z.loading&&ee&&$?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{ref:O,className:"absolute transition-transform duration-300 ease-in-out",style:{top:"".concat(P.top,"px"),left:"".concat(P.left,"px"),zIndex:D?1e3:-1,visibility:D?"visible":"hidden",pointerEvents:D?"auto":"none"},children:Z?(0,h.createPortal)((0,r.jsx)("div",{ref:L,className:"fixed transition-opacity duration-300 ease-in-out",style:{opacity:F.left&&F.top?1:0,zIndex:1e3,top:"".concat(F.top,"px"),left:"".concat(F.left,"px")},children:(0,r.jsx)(x.default,{getSelectedText:()=>W.current,closeWindow:()=>{M(!1),I(!1)},codeContent:A.session.getValue(),hideTellMeMoreButton:U&&J-q<=1})}),document.body):(0,r.jsx)("button",{className:"mr-1 flex cursor-pointer",style:{background:"linear-gradient(to right, #64E4D0, #2563EB)",padding:"1px",borderRadius:"7px"},onClick:()=>{if(J-q<=0&&U){(0,m.B)(),(0,g.Z)("ADAPTIVE_AI","Clicked_Explain_AI_Upsell");return}(0,g.Z)("ADAPTIVE_AI","Clicked_Explain_AI_In_Code_Editor"),en()},disabled:(null===(k=W.current)||void 0===k?void 0:k.length)>2500,children:(0,r.jsxs)("div",{className:"content-default bg-neutral-secondary disabled:bg-neutral-disabled flex w-auto items-center gap-x-2 rounded-md p-2 disabled:cursor-not-allowed",children:[(0,r.jsx)(w.Z,{gradientId:B}),(0,r.jsx)("span",{className:"content-default text-base font-bold",children:"Explain"}),U&&!K&&!((null===(E=W.current)||void 0===E?void 0:E.length)>2500)&&(0,r.jsxs)("span",{className:"content-secondary text-xs",style:{opacity:Q?0:1},children:[Math.max(et,0)," /"," ",J]}),(null===(j=W.current)||void 0===j?void 0:j.length)>2500&&(0,r.jsx)("span",{className:"content-secondary text-xs",children:"Selection too large"})]})})}),T]}):(0,r.jsx)(r.Fragment,{children:T})};var E=n(501582),j=n(508310),_=n(610345),S=e=>{let{isGridView:t,onToggleView:n}=e;return(0,r.jsx)("div",{className:"flex items-center gap-2 p-2",children:(0,r.jsx)("label",{className:"flex cursor-pointer select-none items-center",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:"checkbox",checked:t,onChange:n,className:"sr-only","data-testid":"csv-view-toggle"}),(0,r.jsxs)("div",{className:"relative h-14 w-5 rounded-full transition-colors ".concat(t?"bg-indigo-500":"bg-gray-D400"),children:[!t&&(0,r.jsx)("span",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 transform pb-1 text-xs font-medium text-white",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:"Text"}),t&&(0,r.jsx)("span",{className:"absolute left-1/2 top-1 -translate-x-1/2 transform pt-1 text-xs font-medium text-white",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:"Grid"})]}),(0,r.jsx)("div",{className:"absolute left-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-white transition-transform ".concat(t?"top-2 translate-y-7":"top-1 translate-y-0")})]})})})},A=n(152764);let T=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],[t,n]=(0,o.useState)(e);return{isCSVGridView:t,setIsCSVGridView:n,toggleCSVView:()=>n(e=>!e)}},O=o.lazy(()=>Promise.all([n.e(943995),n.e(989634),n.e(331040),n.e(298261),n.e(449515),n.e(315227)]).then(n.bind(n,449515))),L=o.lazy(()=>n.e(651961).then(n.bind(n,651961))),D=e=>{var t,n,h;let{inView:m=!0,...p}=e,{isCSVGridView:f,toggleCSVView:g}=T(),v=((null===E.OP||void 0===E.OP?void 0:E.OP[null==p?void 0:null===(t=p.codeContent)||void 0===t?void 0:t.theme])||E.OP.vsDark)===E.OP.vsDark,x=(0,u.Ab)(),w=(0,_.ET)(),y=p.forcedHeight||p.placeholderHeight||Math.min(Math.max("string"==typeof p.codeContent.content&&(null===(h=p.codeContent.content)||void 0===h?void 0:h.split("\n").length)||d.V,(null==p?void 0:p.minLines)||d.V),p.maxLines||l.F)*a.A+i.J,b=(0,r.jsx)("div",{"data-clarity-mask":"true",className:"h-full",children:(0,r.jsx)("pre",{className:"overflow-scroll border-none pl-0",style:{height:"".concat("number"==typeof y?"".concat(y+2,"px"):y),...v?{background:"#282830",color:"#e9e9e9"}:{}},children:"string"==typeof p.codeContent.content?null===(n=p.codeContent.content)||void 0===n?void 0:n.split("\n").map((e,t)=>(0,r.jsx)("div",{style:{height:"21px",marginLeft:"45px",fontSize:"".concat(s.n,"px")},children:e},t)):p.codeContent.content})}),C=(0,r.jsx)("div",{className:"h-8 w-full border border-l-0 border-solid p-1 ".concat(v?"border-gray-D900 bg-gray-D1200":"border-gray-L200 bg-gray-L50")}),N=(0,r.jsx)("div",{className:"h-full ".concat(v?"bg-gray-D1300":"bg-gray-L50"),style:{height:y},children:(0,r.jsxs)("div",{className:"flex animate-pulse flex-col",children:[(0,r.jsxs)("div",{className:"flex",children:[C,C]}),(0,r.jsxs)("div",{className:"flex",children:[C,C]})]})}),j=(0,c._e)(p.codeContent),D=(0,A.ao)(j);if(x||!m)return D&&f?N:b;let I=p.disableExplainAI?[]:[k],P=()=>D&&f?(0,r.jsx)(o.Suspense,{fallback:N,children:(0,r.jsx)(L,{...p})}):(0,r.jsx)(o.Suspense,{fallback:b,children:(0,r.jsx)(O,{...p,readerPreferences:w,PrependPlugins:I})});return D?(0,r.jsxs)("div",{className:"relative flex h-full flex-col",children:[(0,r.jsx)("div",{className:"absolute bottom-0 right-0 z-10",children:(0,r.jsx)(S,{isGridView:f,onToggleView:g})}),P()]}):P()};var I=D;let P=(0,j.J)(D)},508310:function(e,t,n){"use strict";n.d(t,{J:function(){return i}});var r=n(931549),o=n(44194),s=n(321345);let i=e=>t=>{let[n,i]=(0,o.useState)(!1),a=window.screen.width<=s.M.int;return(0,o.useEffect)(()=>{a||i(!0)},[t.codeContent]),a?(0,r.jsx)(e,{...t}):(0,r.jsx)(e,{...t,onEditorChange:function(){for(var e,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];i(!1),null===(e=t.onEditorChange)||void 0===e||e.call(t,...r)},onlyCodeChanged:!n})}},456753:function(e,t,n){"use strict";n.d(t,{Z:function(){return g}});var r=n(931549),o=n(315445),s=n.n(o),i=n(44194),a=n(221726),l=n(248392),d=n(579948),c=n(915343),u=n(777743),h=n(297278),m=n(810343);let p="w-7 h-7 hover:text-indigo-500 dark:hover:text-indigo-400 focus:text-indigo-500 dark:focus:text-indigo-400 p-2",f=[".jpg",".jpeg",".png"];class g extends i.Component{componentDidMount(){document.addEventListener("mousedown",this.handleClickOutside)}componentWillUnmount(){document.removeEventListener("mousedown",this.handleClickOutside)}render(){let{codeToCopy:e,allowDownload:t,CopySvg:n,copySvgClasses:o,checkSvgClasses:s,showMobileDropdown:i}=this.props,{isDownloading:h,isDropdownOpen:m}=this.state,f=!1;try{new Blob,f=!0}catch(e){f=!1}let g=n||d.Z;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"tailwind-hidden sm:inline ".concat(this.props.isProjectViewer?"absolute top-0 w-full":""),children:(0,r.jsx)("div",{className:this.props.outerClassName,children:(0,r.jsxs)("div",{"aria-label":"copy-code-button",role:"button",className:this.props.innerClassname,children:[e&&(this.state.isCopied?(0,r.jsx)(l.Z,{title:"Copied!","aria-hidden":"true",color:"green",className:"".concat(p," ").concat(s," bg-duration-200")}):(0,r.jsx)(g,{title:"Copy To Clipboard","aria-hidden":"true",onClick:this.onCopy,className:"".concat(o," duration-200")})),t&&f&&(h?(0,r.jsx)(a.Z,{size:15}):(0,r.jsx)(c.Z,{onClick:this.onDownload,className:"".concat(this.props.copyDownloadButtonClasse
1s||p," duration-200")}))]})})}),i&&(0,r.jsxs)("div",{ref:this.dropdownRef,className:"relative sm:hidden",children:[(0,r.jsx)("button",{"aria-label":"more options",className:this.props.dropdownButtonClassName,onClick:()=>this.setState(e=>({isDropdownOpen:!e.isDropdownOpen})),children:(0,r.jsx)(u.Z,{className:"h-5 w-5 rotate-90 fill-current"})}),m&&(0,r.jsxs)("div",{className:"absolute ".concat(this.props.dropdownMenuClassName),children:[e&&(0,r.jsxs)("button",{className:this.props.dropdownMenuTileClassName,onClick:()=>{this.onCopy()},children:[this.state.isCopied?(0,r.jsx)(l.Z,{title:"Copied!","aria-hidden":"true",color:"green",className:"".concat(p," ").concat(s," bg-duration-200")}):(0,r.jsx)(g,{title:"Copy To Clipboard","aria-hidden":"true",className:"".concat(o," duration-200")}),this.state.isCopied?"Copied!":"Copy code"]}),t&&f&&(0,r.jsxs)("button",{className:this.props.dropdownMenuTileClassName,onClick:()=>{this.onDownload()},children:[h?(0,r.jsx)(a.Z,{size:15}):(0,r.jsx)(c.Z,{className:"".concat(this.props.copyDownloadButtonClasses||p," -ml-1 mr-1 duration-200")}),"Download"]})]})]})]})}constructor(...e){super(...e),this.state={isDownloading:!1,isCopied:!1,isDropdownOpen:!1},this.dropdownRef=i.createRef(),this.FileSaver=null,this.handleClickOutside=e=>{this.dropdownRef.current&&!this.dropdownRef.current.contains(e.target)&&this.setState({isDropdownOpen:!1})},this.imageToBlob=(e,t)=>{let n=e.split(",")[1];try{let e=atob(n),t=Array(e.length).fill(void 0).map((t,n)=>e.charCodeAt(n));return new Blob([new Uint8Array(t)])}catch(e){return(0,m.u)("SPA Download: Failed conversion to blob. Corrupt File. ".concat(t,"}")),new Blob([n])}},this.getBlobFromFile=(e,t)=>e&&f.some(e=>t.endsWith(e))?this.imageToBlob("data:image/*;base64,"+e.content,t):new Blob([e],{type:"text/plain;charset=utf-8"}),this.downloadFilesAsZip=async e=>{let t=await (0,h.Z)(()=>n.e(783410).then(n.t.bind(n,783410,23))),r="educative-code-widget-files",o=new t.default;o.folder(r),Object.keys(e).forEach(t=>{let n=this.getBlobFromFile(e[t],t);o.file("".concat(r,"/").concat(t),n)});try{o.generateAsync({type:"blob"}).then(e=>{this.FileSaver.saveAs(e,"educative-code-widget.zip")})}catch(e){console.log(e)}},this.onDownload=async()=>{let{files:e}=this.props;this.setState({isDownloading:!0}),this.FileSaver=(await (0,h.Z)(()=>n.e(12887).then(n.t.bind(n,12887,23)))).default;let t=Object.keys(e);if(this.FileSaver&&t.length){if(1===t.length){let n=t[0],r=e[n],o=this.getBlobFromFile(r,n);this.FileSaver.saveAs(o,n)}else await this.downloadFilesAsZip(e);this.setState({isDownloading:!1})}},this.onCopy=()=>{this.state.isCopied||(s()(this.props.codeToCopy),this.setState({isCopied:!0}),setTimeout(()=>this.setState({isCopied:!1}),2e3))}}}g.defaultProps={allowDownload:!1,files:{},isProjectViewer:!1,outerClassName:"z-9 absolute right-3.5 top-1 flex cursor-pointer",innerClassname:"flex h-6 items-center justify-center rounded border-none bg-white text-black opacity-30 shadow-md duration-200 hover:opacity-100 hover:shadow-lg focus:opacity-100 focus:shadow-lg dark:bg-gray-D1300 dark:text-gray-D200",copySvgClasses:p,checkSvgClasses:"",dropdownButtonClassName:"s-gray-rest flex h-9 items-center rounded border border-solid bg-transparent px-3 py-2",dropdownMenuClassName:"bottom-full left-0 mb-1 flex w-fit flex-col overflow-hidden rounded bg-gray-D1400 shadow-md",dropdownMenuTileClassName:"flex items-center gap-x-2 bg-transparent px-3 py-2 text-sm text-gray-D600 hover:text-indigo-300"}},300417:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return P}});var r=n(931549),o=n(128839),s=n(556406),i=n(44194),a=n(930286),l=n(35346),d=n(786057),c=n(71837),u=n(853284),h=n(791127),m=n(629099),p=n(520649),f=n(970179),g=n(763548),v=n(937374),x=n(400721),w=n(305490),y=n(601369),b=n(480333),C=n(688045),N=n(118434),k=n(650264),E=n(140459),j=n(150533),_=n(193312),S=n(508438),A=n(395124),T=n(262603),O=n(173656);let L=e=>{let{dispatch:t,optionLetter:n,isCorrect:o,onRemoveOptionLocal:s,onStatementChangeLocal:l,onSelectionChange:u,index:p,option:b,incrementCounter:k}=e,T=(0,S.Vo)(),[{dragNDrop:O},L]=(0,i.useState)({dragNDrop:!0}),[,D]=(0,d.c)({collect:e=>({index:p,isDragging:e.isDragging()}
1),item:{index:p},type:x.Z.CHOICE}),[{canDrop:I,index:P},R]=(0,c.L)({accept:x.Z.CHOICE,collect:e=>({canDrop:e.canDrop(),index:p}),drop:(e,t)=>{let n=t.getItem().index;I&&n!==P&&((0,_.Dm)(n,P,T.moveChoices),k(),t.getItem().index=P)}}),[Z,M]=(0,i.useState)(!1),[H]=(0,a.Z)(["theme","use_system_preference"]),{userInfoState:F}=(0,A.su)(),G=F.data,W=F.loaded,B=(0,w.$)({cookies:H,userInfo:G,userInfoLoaded:W})===g.g.DARK_MODE;return(0,r.jsxs)("div",{"data-testid":"mcq-minimal-choice",draggable:!0,onFocus:()=>L({dragNDrop:!1}),onBlur:()=>L({dragNDrop:!0}),ref:e=>{O&&(D(e),R(e))},className:"mb-4 rounded",children:[(0,r.jsxs)("div",{className:"border border-b-0 border-solid ".concat(o?"border-teal-700 bg-teal-25":"border-gray-L200 bg-white dark:border-gray-D1200"," flex h-12 w-full items-center justify-between rounded-t p-4 dark:bg-gray-D1400"),children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(N.Z,{className:"mr-2 h-6 w-6 cursor-move fill-current dark:text-gray-D400"}),(0,r.jsxs)("span",{className:"body-medium mr-4 font-bold",children:["Option ",n]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("div",{className:"mr-6 flex cursor-pointer items-center",onClick:()=>u(),children:[(0,r.jsx)(E.E,{innerCircleClasses:o?"fill-indigo-500":"fill-none",innerCircleRadius:6,outerCircleClasses:o?"stroke-indigo-500":"stroke-gray-L400"}),(0,r.jsx)("span",{className:"ml-2",children:"Mark as Correct"})]}),(0,r.jsx)(m.default,{position:h.YS,backgroundColor:"bg-gray-L1000 border-gray-L1000",overlayParentTextColorClasses:"text-white",overlay:"Delete Option",children:(0,r.jsx)(C.Z,{className:"cursor-pointer fill-current text-gray-L500 hover:text-red-500 dark:text-gray-D400 dark:hover:text-red-400",onClick:()=>s()})}),(0,r.jsx)(m.default,{position:h.YS,backgroundColor:"bg-gray-L1000 border-gray-L1000",overlayParentTextColorClasses:"text-white",overlay:"Preview Markdown",children:(0,r.jsxs)("div",{className:"ml-6 flex h-5 cursor-pointer items-center",onClick:()=>{M(!Z)},children:[(0,r.jsx)(y.Z,{height:16,width:34,onColor:v.colors.indigo[500],offColor:B?v.colors.gray.L400:v.colors.gray.L900,offHandleColor:B&&v.colors.gray.L800,onChange:()=>{},isChecked:Z}),(0,r.jsx)("span",{className:"ml-2 text-sm font-normal",children:"Preview"})]})})]})]}),(0,r.jsx)(j.default,{mode:"edit",content:b.mdHtml?b:{text:b,mdHtml:"<p>".concat(b,"</p>")},placeholder:"Type an answer here",updateContentState:e=>l(e,p),fullScreen:!1,fullscreenIconToggle:()=>{},dispatch:t,config:{pageType:f.q.ASSESSMENT,inEditor:!0},showPreview:Z,focusOnMount:!1,minimalMode:!0,isHighlighted:o})]})};var D=e=>{let{selected:t,options:n,index:s,onSelectionChange:a,onStatementChange:d,onRemoveOption:c,mode:h,isMulti:m,isSkillAssessment:g=!1,minimalMode:v=!1}=e,[x,w]=(0,i.useState)(0),y=(e,t)=>{d(s,(0,o.ZP)(n,n=>{let{text:r,mdHtml:o}=e;n[t]=o?{text:r,mdHtml:o}:e}))},C=e=>{N(),c(s,e)},N=()=>{w(x+1)},E=e=>String.fromCharCode(e+65),_=(0,T.TL)();return(0,r.jsx)(l.W,{backend:u.PD,context:window,children:(0,r.jsxs)("div",{className:"flex w-full flex-col whitespace-pre-wrap ".concat(g?"px-4 pb-4 pt-8 sm:px-10":""," ").concat(v?"mt-6":""),children:[n.map((e,n)=>{let o=!(!m&&t!==n||m&&-1===(t||[]).indexOf(n));return v?(0,r.jsx)(L,{dispatch:_,optionLetter:E(n),isCorrect:o,onRemoveOptionLocal:()=>C(n),onSelectionChange:()=>a(s,n),onStatementChangeLocal:y,index:n,option:e,incrementCounter:N},n+26*x):(0,r.jsxs)("div",{className:"mb-4 flex w-full cursor-pointer border-2 border-solid ".concat(o?"border-indigo-500 bg-indigo-200 dark:border-indigo-400 dark:bg-gray-D1300":"border-gray-L200 bg-white dark:bg-gray-D1400 ".concat(g?"dark:border-gray-D600 dark:hover:border-gray-D300":"hover:border-indigo-500 dark:border-gray-D1200 dark:hover:border-indigo-400")," ").concat(g?"rounded hover:shadow-md":"rounded"),onClick:()=>"edit"!==h?a(s,n):void 0,children:["edit"===h&&(0,r.jsx)("div",{id:O.env.REACT_APP_STANDALONE?"selenium-mcq-option-".concat(n):null,className:"min-w-16 flex items-center justify-center border-0 border-r border-solid px-4 hover:border-indigo-500\n                   ".concat(o?"border-indigo-500 dark:border-indigo-400":"border-gray-L300 dark:border-gray-D1200"),onClick:()=>"edit"===h&&a(s,n),children:(0,r.jsx)("h4",{className:"heading-four",children:E(n)})}),(0,r.jsxs)("div",{className:"flex flex-grow items-center ".concat(g&&"edit"!==h?"bg-white py-3 dark:bg-gray-D1200 dark:hover:bg-gray-D1000":g?"px-4":"px-4 py-1"),children:["edit"===h&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(j.default,{mode:"edit",content:e.mdHtml?e:{text:e,mdHtml:"<p>".concat(e,"</p>")},placeholder:"Write statement here...",updateContentState:e=>y(e,n),fullScreen:!1,fullscreenIconToggle:()=>{},dispatch:_,config:{pageType:f.q.ASSESSMENT,inEditor:!0,title:"Statement"},focusOnMount:!1})}),"edit"!==h&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(b.default,{mdHtml:e.mdHtml?e.mdHtml:"<p>".concat(e,"</p>"),alignCenter:!0,collectionType:g?p.dL.SKILL_ASSESSMENT:p.dL.COLLECTION,isAssessment:!0})})]}),"edit"===h&&(0,r.jsx)("div",{className:"items-center p-4",children:(0,r.jsx)("button",{className:"icon-default",onClick:()=>C(n),onMouseDown:e=>e.preventDefault(),children:(0,r.jsx)(k.Z,{className:"h-4 w-4"})})})]},n+26*x)}),"edit"===h&&n.length<26&&(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:"h-9 rounded-sm border border-solid border-gray-L300 bg-white text-base text-black hover:border-gray-L1000 hover:bg-gray-L200 dark:border-gray-D200 dark:bg-gray-D1500 dark:text-gray-D200 dark:hover:border-gray-D200 dark:hover:bg-gray-D1000",onClick:()=>{d(s,(0,o.ZP)(n,e=>{e.push({text:"",mdHtml:"<p></p>"})}))},children:"Add an Option"})})]})})};let I=e=>{let{updateContentState:t,data:n,mode:i,isSkillAssessment:a=!1,minimalMode:l=!1}=e,d=e=>"number"==typeof e&&!isNaN(e),c=e=>{t((0,o.ZP)(e,e=>{var t;
1(null===(t=e.protectedContent)||void 0===t?void 0:t.answers)&&(e.protectedContent.answers=e.content.isMulti?e.protectedContent.answers.map(e=>e.filter(e=>d(e))):e.protectedContent.answers.filter(e=>d(e)))}))},u=(e,t)=>{c((0,o.ZP)(n,n=>{var r;if((null===(r=n.protectedContent)||void 0===r?void 0:r.answers)||(n.protectedContent={answers:Array(n.content.statements.length).fill(void 0).map(()=>n.content.isMulti?[]:void 0)}),n.content.isMulti){let r=n.protectedContent.answers[e].indexOf(t);-1!==r?n.protectedContent.answers[e].splice(r,1):n.protectedContent.answers[e].push(t)}else n.protectedContent.answers[e]=t}))},h=e=>{c((0,o.ZP)(n,t=>{var n;t.content.isMulti=!t.content.isMulti,(null===(n=t.protectedContent)||void 0===n?void 0:n.answers)?t.protectedContent.answers[e]=t.content.isMulti?[t.protectedContent.answers[e]]:t.protectedContent.answers[e].filter(e=>void 0!==e)[0]:t.protectedContent={answers:Array(t.content.statements.length).fill(void 0).map(()=>t.content.isMulti?[]:void 0)}}))},m=(e,t)=>{c((0,o.ZP)(n,n=>{let r=n.protectedContent.answers[e];n.content.statements[e].splice(t,1),n.protectedContent.answers[e]=n.content.isMulti?[]:r===t?void 0:r>t?r-1:r}))},p=(e,t)=>{c((0,o.ZP)(n,n=>{n.content.statements[e]=t}))};return(0,r.jsx)("div",{className:"w-full",children:n.content.statements.map((e,t)=>{var o;return(0,r.jsxs)("div",{children:[!l&&(0,r.jsx)("div",{className:"flex w-full justify-between",children:"edit"===i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h4",{className:"heading-four mb-4",children:"Multiple Choice Question:"}),(0,r.jsx)(s.Z,{checked:!!n.content.isMulti,onClick:()=>h(t),label:"Allow multiple answers"})]})}),(0,r.jsx)(D,{options:e,selected:null===(o=n.protectedContent)||void 0===o?void 0:o.answers[t],index:t,onSelectionChange:u,onStatementChange:p,onRemoveOption:m,mode:i,isMulti:n.content.isMulti,isSkillAssessment:a,minimalMode:l},t)]},t)})})};I.getComponentDefault=()=>({content:{statements:[[""]],isMulti:!1},protectedContent:{answers:[]}}),I.validateWidgetContent=e=>{let t=Array.isArray(e.protected_content.answers)&&!!e.protected_content.answers.filter(e=>"number"==typeof e).length,n=Array.isArray(e.protected_content.answers)&&!!e.protected_content.answers.filter(e=>Array.isArray(e)&&e.filter(e=>"number"==typeof e).length).length,r=Array.isArray(e.content.widgetContent.content.statements)&&e.content.widgetContent.content.statements.reduce((e,t)=>t.reduce((e,t)=>{var n;return e&&!!((null===(n=t.text)||void 0===n?void 0:n.length)||t.length)},e),!0);return(t||e.content.widgetContent.content.isMulti)&&(n||!e.content.widgetContent.content.isMulti)?r?void 0:"Please fill all option statements!":"Please Select The Correct Answer"};var P=I},344428:function(e,t,n){"use strict";n.d(t,{R:function(){return i},w:function(){return a}});var r=n(931549),o=n(44194);let s=(0,o.createContext)({result:{loading:!1,loaded:!1,prompt:null,review:null,error:null},setResult:()=>{},resultsCache:{current:{}},submitted:{},setSubmitted:()=>{},hideToast:{},setHideToast:()=>{},animationComplete:{},setAnimationComplete:()=>{}}),i=()=>(0,o.useContext)(s),a=e=>{let{children:t}=e,n=o.useRef({}),[i,a]=o.useState({loading:!1,loaded:!1,prompt:null,review:null,error:null}),[l,d]=o.useState({}),[c,u]=o.useState({}),[h,m]=o.useState({});return(0,r.jsx)(s.Provider,{value:{result:i,setResult:a,resultsCache:n,submitted:l,setSubmitted:d,hideToast:c,setHideToast:u,animationComplete:h,setAnimationComplete:m},children:t})}},10482:function(e,t,n){"use strict";n.d(t,{Eo:function(){return s},gp:function(){return i},oK:function(){return r},qf:function(){return a},zv:function(){return o}});let r={SYSTEM_MESSAGE:"system",HUMAN_MESSAGE:"human",AI_MESSAGE:"ai"},o={IMAGE:"image",TEXT:"text"},s={POSITIVE:1,NEUTRAL:0,NEGATIVE:-1},i={AI_ASSISTANT:"AI_ASSISTANT",AI_CONCEPTS:"AI_CONCEPTS",AI_COPILOT:"AI_COPILOT"},a="detailed_chat_analysis_on_board"},321345:function(e,t,n){"use strict";n.d(t,{M:function(){return o}});class r{constructor(e){this.int=e,this.pixels="".concat(e,"px")}}let o=new r(780)},193312:function(e,t,n){"use strict";n.d(t,{Dm:function(){return i},d$:function(){return s},lb:function(){return a}});var r=n(794218),o=n(468045);let s=e=>{var t,n,r;return!e||!e.length||1===e.length&&(null===(t=e[0])||void 0===t?void 0:t.type)==="SlateHTML"&&(null===(r=e[0])||void 0===r?void 0:null===(n=r.content)||void 0===n?void 0:n.html)==="<p></p>"},i=function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r.Q.REGULAR;
1n({from:e,to:t,assessmentType:o})},a=(e,t)=>{if(!e)return"";if(t){let t=e.split("-");if(1===t.length)return(0,o.LF)(e);let n=[...t];return n.splice(0,1),n.join("-")}return e}},441244:function(e,t,n){"use strict";n.d(t,{Be:function(){return o},av:function(){return s},sZ:function(){return r}});let r="ai/code/feedback",o="ai/config-agent/code-feedback",s="ai/config-agent/ai-mentor"},206001:function(e,t,n){"use strict";n.d(t,{D:function(){return o},V:function(){return s}});var r=n(810343);let o=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0,i=e.body.getReader(),a=new TextDecoder,l=!!n;s||(s={current:!1});try{let e=await i.read();for(;!s.current&&!e.done;){let r=a.decode(e.value,{stream:!0});l?(n(r,o),l=!1):t(r),e=await i.read()}}catch(t){let e=t instanceof Error?t.message:String(t);throw(0,r.u)("Error in magicbox stream: ".concat(e)),t}},s=async e=>{let t=e.body.getReader(),n=new TextDecoder,r=await t.read();return JSON.parse(n.decode(r.value,{stream:!0}))}},297278:function(e,t){"use strict";let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return new Promise((o,s)=>{e().then(o).catch(i=>{setTimeout(()=>{if(1===t){s(i);return}n(e,t-1,r).then(o,s)},r)})})};t.Z=n},959495:function(e){e.exports={loading:"CodeReviewComponent_loading__Dy5uf",dots:"CodeReviewComponent_dots__VQ7Ho","loading-dark":"CodeReviewComponent_loading-dark__wgy7l","dots-dark":"CodeReviewComponent_dots-dark__eja8A"}}}]);

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.