"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9162],{21617:function(e,t,s){s.d(t,{X:function(){return w},O:function(){return m}});var n=s(85893),r=s(22548),i=s(16554),o=(0,r.m)("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});o.displayName="Center";var l={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};(0,i.G)(function(e,t){let{axis:s="both",...i}=e;return(0,n.jsx)(r.m.div,{ref:t,__css:l[s],...i,position:"absolute"})});var c=s(48783),u=s(65028),a=s(93717),d=s(14225),p=s(22757),x=s(67294),h=s(50845);function f(e){let{question:t,cycleStatus:s}=e;switch(t.type){case"singleChoice":return(0,n.jsx)(h.sy,{cycleStatus:s,...t});case"multiChoice":return(0,n.jsx)(h.oS,{cycleStatus:s,...t});case"input":return(0,n.jsx)(h.Dm,{cycleStatus:s,...t});default:throw Error("Unexpected type: ".concat(t.type))}}function m(e){return e.map(e=>{if("input"===e.type)return e;let t=function(e){let t=e.length,s;for(;0!=t;)s=Math.floor(Math.random()*t),t--,[e[t],e[s]]=[e[s],e[t]];return e}(e.options);return{...e,options:t}})}function w(e){let{questions:t}=e,[s,r]=(0,x.useState)(0),[i,l]=(0,x.useState)("inProgress"),[h,m]=(0,x.useState)("displayQuestions");switch(i){case"inProgress":return(0,n.jsx)(o,{py:4,children:(0,n.jsxs)(c.g,{h:"md",maxW:"xl",w:"full",p:4,boxShadow:"md",children:[(0,n.jsx)(f,{question:t[s],cycleStatus:h}),(0,n.jsx)(u.L,{}),(0,n.jsx)(a.k,{w:"full",justifyContent:"flex-end",children:(0,n.jsx)(d.z,{onClick:()=>"displayQuestions"===h?m("displayAnswer"):t[s+1]?(r(s+1),m("displayQuestions")):l("complete"),colorScheme:"gray",children:"displayQuestions"===h?"Submit":"Next question"})})]})});case"complete":return(0,n.jsx)(o,{py:4,children:(0,n.jsxs)(c.g,{h:"md",maxW:"xl",w:"full",p:4,boxShadow:"md",children:[(0,n.jsx)(p.X,{fontSize:"lg",mb:4,children:"Quiz complete!"}),(0,n.jsx)(d.z,{onClick:()=>{r(0),l("inProgress"),m("displayQuestions")},colorScheme:"gray",children:"Take again"})]})});default:throw Error("Invalid quiz status: ".concat(i))}}},50845:function(e,t,s){s.d(t,{Dm:function(){return m},oS:function(){return p},Xn:function(){return n.X},sy:function(){return x},OP:function(){return n.O}});var n=s(21617),r=s(85893),i=s(48783),o=s(22757),l=s(71293),c=s(14225),u=s(67294);function a(e,t){switch(!0){case"displayQuestions"===e:return"blue";case"displayAnswer"===e&&t:return"green";default:return"red"}}function d(e,t,s){return!0!=("displayQuestions"===e)||s===t}function p(e){let{question:t,options:s,cycleStatus:n}=e,[p,x]=(0,u.useState)([]);(0,u.useEffect)(()=>{"displayQuestions"===n&&x([])},[n]);let h=e=>{p.some(t=>t===e)?x(p.filter(t=>t!==e)):x([...p,e])};return(0,r.jsxs)(i.g,{spacing:2,mb:4,w:"full",children:[(0,r.jsx)(o.X,{size:"md",children:t.text}),(0,r.jsx)(l.x,{mb:8,color:"gray",children:"Select one or more answers"}),s.map(e=>{let{text:t,isAnswer:s}=e;return(0,r.jsx)(c.z,{w:"full",colorScheme:a(n,s),variant:"outline",isActive:p.some(e=>d(n,t,e)),onClick:()=>h(t),_hover:{bgColor:"displayAnswer"===n?a(n,s):void 0},_disabled:{opacity:1,cursor:"not-allowed"},isDisabled:"displayAnswer"===n,children:t},t)})]})}function x(e){let{question:t,options:s,cycleStatus:n}=e,[p,x]=(0,u.useState)(void 0);return(0,u.useEffect)(()=>{"displayQuestions"===n&&x(void 0)},[n]),(0,r.jsxs)(i.g,{spacing:2,mb:4,w:"full",children:[(0,r.jsx)(o.X,{size:"md",children:t.text}),t.description&&(0,r.jsx)(l.x,{fontStyle:"italic",children:t.description}),(0,r.jsx)(l.x,{mb:4,color:"gray",children:"Select one answer"}),s.map(e=>{let{text:t,isAnswer:s}=e;return(0,r.jsx)(c.z,{w:"full",colorScheme:a(n,s),_hover:{bgColor:"displayAnswer"===n?a(n,s):void 0},_disabled:{opacity:1,cursor:"not-allowed"},isDisabled:"displayAnswer"===n,variant:"outline",isActive:d(n,t,p),onClick:()=>x(t),children:t},t)})]})}var h=s(33090),f=s(57747);function m(e){let{question:t,options:s,cycleStatus:n}=e;return(0,r.jsxs)(i.g,{spacing:2,mb:4,w:"full",children:[(0,r.jsx)(o.X,{size:"md",mb:4,children:t.text}),(0,r.jsx)(h.I,{placeholder:"Your answer",disabled:"displayAnswer"===n}),(0,r.jsx)(f.xu,{p:2,w:"full",textAlign:"left",children:"displayAnswer"===n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.x,{size:"xs",color:"gray",mb:2,children:"Provided answer"}),s.map(e=>{let{text:t}=e;return(0,r.jsx)(l.x,{children:t},t)})]})})]})}},9162:function(e,t,s){s.r(t),s.d(t,{K8sControlPlaneQuiz:function(){return o}});var n=s(85893),r=s(50845);s(67294);let i=[{type:"multiChoice",question:{text:"What does the Kubernetes Control Plane consist of?"},options:[{text:"etcd",isAnswer:!0},{text:"Kube scheduler",isAnswer:!0},{text:"Kube API Server",isAnswer:!0},{text:"Kubernetes Dashboard",isAnswer:!1},{text:"kubectl",isAnswer:!0}]},{type:"singleChoice",question:{text:"What does etcd do?"},options:[{text:"Key-value store for critical cluster info ",isAnswer:!0},{text:"Puts containers to proper nodes",isAnswer:!1},{text:"Ensures proper state of cluster components",isAnswer:!1},{text:"An exposed server that lets you communicate with the cluster",isAnswer:!1}]},{type:"singleChoice",question:{text:"What does the Kube scheduler do?"},options:[{text:"Key-value store for critical cluster info ",isAnswer:!1},{text:"Puts containers to proper nodes",isAnswer:!0},{text:"Ensures proper state of cluster components",isAnswer:!1},{text:"An exposed server that lets you communicate with the cluster",isAnswer:!1}]},{type:"singleChoice",question:{text:"What does kubectl manager do?"},options:[{text:"Key-value store for critical cluster info ",isAnswer:!1},{text:"Puts containers to proper nodes",isAnswer:!1},{text:"Ensures proper state of cluster components",isAnswer:!0},{text:"An exposed server that lets you communicate with the cluster",isAnswer:!1}]},{type:"singleChoice",question:{text:"What does the Kube API Server do?"},options:[{text:"Key-value store for critical cluster info ",isAnswer:!1},{text:"Puts containers to proper nodes",isAnswer:!1},{text:"Ensures proper state of cluster components",isAnswer:!1},{text:"An exposed server that lets you communicate with the cluster",isAnswer:!0}]}],o=()=>(0,n.jsx)(r.Xn,{questions:(0,r.OP)(i)})},33090:function(e,t,s){s.d(t,{I:function(){return a}});var n=s(35159),r=s(16554),i=s(77030),o=s(33179),l=s(22548),c=s(25432),u=s(85893),a=(0,r.G)(function(e,t){let{htmlSize:s,...r}=e,a=(0,i.jC)("Input",r),d=(0,o.Lr)(r),p=(0,n.Y)(d),x=(0,c.cx)("chakra-input",e.className);return(0,u.jsx)(l.m.input,{size:s,...p,__css:a.field,ref:t,className:x})});a.displayName="Input",a.id="Input"}}]);