PageSourceSearch

https://ns.com/_next/static/chunks/28569-c571b70998852f27.js?dpl=dpl_A2U8huRzNx8u8wiWUaMiGooTUTPW

js ns.com collected 2026-10-02 04:48:42 UTC 98,660 bytes, 2 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2c26a6eb-0c34-473b-8e4d-eb738ff4e68c",e._sentryDebugIdIdentifier="sentry-dbid-2c26a6eb-0c34-473b-8e4d-eb738ff4e68c")}()}catch(e){}!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];if(null!=r)for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:ns-web":!0})}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28569],{2198:(e,t,r)=>{function n(e,t){var r=e[0],n=e[1],a=e[2],c=e[3];r=i(r,n,a,c,t[0],7,-0x28955b88),c=i(c,r,n,a,t[1],12,-0x173848aa),a=i(a,c,r,n,t[2],17,0x242070db),n=i(n,a,c,r,t[3],22,-0x3e423112),r=i(r,n,a,c,t[4],7,-0xa83f051),c=i(c,r,n,a,t[5],12,0x4787c62a),a=i(a,c,r,n,t[6],17,-0x57cfb9ed),n=i(n,a,c,r,t[7],22,-0x2b96aff),r=i(r,n,a,c,t[8],7,0x698098d8),c=i(c,r,n,a,t[9],12,-0x74bb0851),a=i(a,c,r,n,t[10],17,-42063),n=i(n,a,c,r,t[11],22,-0x76a32842),r=i(r,n,a,c,t[12],7,0x6b901122),c=i(c,r,n,a,t[13],12,-0x2678e6d),a=i(a,c,r,n,t[14],17,-0x5986bc72),n=i(n,a,c,r,t[15],22,0x49b40821),r=s(r,n,a,c,t[1],5,-0x9e1da9e),c=s(c,r,n,a,t[6],9,-0x3fbf4cc0),a=s(a,c,r,n,t[11],14,0x265e5a51),n=s(n,a,c,r,t[0],20,-0x16493856),r=s(r,n,a,c,t[5],5,-0x29d0efa3),c=s(c,r,n,a,t[10],9,0x2441453),a=s(a,c,r,n,t[15],14,-0x275e197f),n=s(n,a,c,r,t[4],20,-0x182c0438),r=s(r,n,a,c,t[9],5,0x21e1cde6),c=s(c,r,n,a,t[14],9,-0x3cc8f82a),a=s(a,c,r,n,t[3],14,-0xb2af279),n=s(n,a,c,r,t[8],20,0x455a14ed),r=s(r,n,a,c,t[13],5,-0x561c16fb),c=s(c,r,n,a,t[2],9,-0x3105c08),a=s(a,c,r,n,t[7],14,0x676f02d9),n=s(n,a,c,r,t[12],20,-0x72d5b376),r=o(r,n,a,c,t[5],4,-378558),c=o(c,r,n,a,t[8],11,-0x788e097f),a=o(a,c,r,n,t[11],16,0x6d9d6122),n=o(n,a,c,r,t[14],23,-0x21ac7f4),r=o(r,n,a,c,t[1],4,-0x5b4115bc),c=o(c,r,n,a,t[4],11,0x4bdecfa9),a=o(a,c,r,n,t[7],16,-0x944b4a0),n=o(n,a,c,r,t[10],23,-0x41404390),r=o(r,n,a,c,t[13],4,0x289b7ec6),c=o(c,r,n,a,t[0],11,-0x155ed806),a=o(a,c,r,n,t[3],16,-0x2b10cf7b),n=o(n,a,c,r,t[6],23,0x4881d05),r=o(r,n,a,c,t[9],4,-0x262b2fc7),c=o(c,r,n,a,t[12],11,-0x1924661b),a=o(a,c,r,n,t[15],16,0x1fa27cf8),n=o(n,a,c,r,t[2],23,-0x3b53a99b),r=l(r,n,a,c,t[0],6,-0xbd6ddbc),c=l(c,r,n,a,t[7],10,0x432aff97),a=l(a,c,r,n,t[14],15,-0x546bdc59),n=l(n,a,c,r,t[5],21,-0x36c5fc7),r=l(r,n,a,c,t[12],6,0x655b59c3),c=l(c,r,n,a,t[3],10,-0x70f3336e),a=l(a,c,r,n,t[10],15,-1051523),n=l(n,a,c,r,t[1],21,-0x7a7ba22f),r=l(r,n,a,c,t[8],6,0x6fa87e4f),c=l(c,r,n,a,t[15],10,-0x1d31920),a=l(a,c,r,n,t[6],15,-0x5cfebcec),n=l(n,a,c,r,t[13],21,0x4e0811a1),r=l(r,n,a,c,t[4],6,-0x8ac817e),c=l(c,r,n,a,t[11],10,-0x42c50dcb),a=l(a,c,r,n,t[2],15,0x2ad7d2bb),n=l(n,a,c,r,t[9],21,-0x14792c6f),e[0]=r+e[0]|0,e[1]=n+e[1]|0,e[2]=a+e[2]|0,e[3]=c+e[3]|0}function a(e,t,r,n,a,i){return((t=(t+e|0)+(n+i|0)|0)<<a|t>>>32-a)+r|0}function i(e,t,r,n,i,s,o){return a(t&r|~t&n,e,t,i,s,o)}function s(e,t,r,n,i,s,o){return a(t&n|r&~n,e,t,i,s,o)}function o(e,t,r,n,i,s,o){return a(t^r^n,e,t,i,s,o)}function l(e,t,r,n,i,s,o){return a(r^(t|~n),e,t,i,s,o)}r.d(t,{F:()=>u});var c="0123456789abcdef".split("");function u(e){for(var t=function(e){var t,r=e.length,a=[0x67452301,-0x10325477,-0x67452302,0x10325476];for(t=64;t<=e.length;t+=64)n(a,function(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}(e.substring(t-64,t)));e=e.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(a,i),t=0;t<16;t++)i[t]=0;return i[14]=8*r,n(a,i),a}(e),r=0;r<t.length;r++)t[r]=function(e){for(var t="",r=0;r<4;r++)t+=c[e>>8*r+4&15]+c[e>>8*r&15];return t}(t[r]);return t.join("")}},2204:(e,t,r)=>{r.d(t,{D:()=>a});var n=r(13356);function a(e){var t=(0,n.useRef)(null);return null===t.current&&(t.current=e),(0,n.useLayoutEffect)(()=>{t.current=e},[e]),(0,n.useCallback)(function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,t.current)(...r)},[t])}},8342:(e,t,r)=>{r.d(t,{l:()=>p});var n=r(29152),a=r(65992),i=r(84025),s=r(39646),o=r(2604),l=r(13356),c=r(53988),u=r(55906),d=(e,t)=>{switch(t){case"request":return"requested";
1case"callback-close":case"close":if("inactive"===e||"requested"===e)return e;return"closing";case"callback-open":switch(e){case"inactive":case"active":return"inactive";case"requested":return"active";default:return e}case"focused":return"inactive"}};function p(e){var{"exercise-id":t,language:r,languages:p,framework:f,slots:h}=e,v=(0,l.useRef)(null),[m,b]=(0,l.useReducer)(d,"inactive"),g=(0,i.m)({exerciseId:t,languages:[r].concat(null!=p?p:[]),frameworks:f?[f]:[],slots:h}),x=(0,u.yj)(),y=(0,c.g7)(),_=(0,l.useCallback)(()=>{b("request"),x(g.current)},[x,g]),w=(0,l.useCallback)(e=>{b("close"),y()},[y]);return(0,u.uW)(()=>{b("callback-open")}),(0,u.fT)(()=>{b("callback-open")}),(0,u.UP)("*",()=>{b("callback-open")}),(0,c.BT)(e=>{"inactive"!==m&&"close"===e&&b("callback-close")}),(0,l.useEffect)(()=>{"closing"===m&&requestAnimationFrame(()=>{var e;null==(e=v.current)||e.focus(),b("focused")})},[m]),(0,n.jsxs)("react-ns-playground",{className:"relative my-8 block w-full",children:[(0,n.jsx)("span",{hidden:!0,className:"absolute right-0 top-0 rounded-bl-md bg-gray-200 p-1 text-xs text-iron-700 shadow-sm",children:f?"".concat(r," +").concat(f):r}),(0,n.jsxs)(a.A8,{ref:v,type:"button",onClick:"active"===m?w:_,display:"medium",variant:"inactive"!==m?"secondary":"primary",buttonColor:"inactive"!==m?void 0:"#155EEF",PrefixIcon:"inactive"!==m?s.A:o.A,prefixIconProps:{className:"text-[--text-color]"},pending:"requested"===m||"closing"==m,pendingLabel:"Opening playground...",children:["active"===m?"Close"
1:"Open"," playground"]})]})}},10709:(e,t,r)=>{r.d(t,{R:()=>c});var n=r(85468),a=r(81463),i=r(97320),s=r(62839),o=r(29152),l=r(13356);function c(e){var{type:t="terminal"}=e,r=(0,s._)(e,["type"]);return(0,o.jsx)(d,(0,a._)({Console:f,type:t},r))}var u={env:["HOME=/root","USER=root","SHELL=/bin/bash","EDITOR=vim","LANG=en_US.UTF-8","LC_ALL=C","TERM=xterm","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],cwd:"/root",uid:0,gid:0};class d extends l.PureComponent{get deviceUrl(){var e;return null!=(e=this.props.deviceUrl)?e:"https://learn-vms.ns-assets.com/debian-bookworm-pytest-i386.img"}get deviceName(){var e;return null!=(e=this.props.deviceName)?e:"terminal"}componentDidMount(){this.boot()}componentDidUpdate(e,t,r){(e.deviceName!==this.props.deviceName||e.deviceUrl!==this.props.deviceUrl)&&this.reboot(),t.booted!==this.state.booted&&this.state.booted&&this.runCommand({onProgress:this.props.onProgress})}componentWillUnmount(){this.shutdown()}boot(){var e=new AbortController,t=this.deviceUrl,r=this.deviceName,s=(function(e){return(0,n._)(function*(e){var{deviceName:t,deviceUrl:r,onMounting:n,signal:a}=e,i=window;if(!i.CheerpX)throw new DOMException("Expected CheerpX to be available on Window");var s=i.CheerpX;if(null==a?void 0:a.aborted)return null;var o=r.startsWith("/")||r.startsWith("https://"),l={},c=yield o?s.HttpBytesDevice.create(r):s.CloudDevice.create(r);if(l[o?"~http":"~cloud"]=c,null==a?void 0:a.aborted)return Object.values(l).forEach(e=>{}),null;var u=yield s.IDBDevice.create("".concat(t,"-overlay"));if(l["~idb"]=u,null==a?void 0:a.aborted)return Object.values(l).forEach(e=>{}),null;var d=yield s.OverlayDevice.create(c,u);if(l["~overlay"]=d,null==a?void 0:a.aborted)return Object.values(l).forEach(e=>{}),null;var p=[{type:"ext2",path:"/",dev:d},{type:"devs",path:"/dev"},{type:"devpts",path:"/dev/pts"},{type:"proc",path:"/proc"},{type:"sys",path:"/sys"},...n?yield n(s):[]];p.forEach(e=>{"dev"in e&&(l[e.path]=e.dev)});var f=yield s.Linux.create({mounts:p});return(l["~linux"]=f,null==a?void 0:a.aborted)?(Object.values(l).forEach(e=>{}),null):{devices:l,linuxDevice:f}}).apply(this,arguments)})({deviceName:r,deviceUrl:t,signal:e.signal,onMounting:e=>(0,n._)(function*(){return[{type:"dir",path:"/ephemeral",dev:yield e.DataDevice.create()},{type:"dir",path:"/idb",dev:yield e.IDBDevice.create("".concat(r,"-files"))}]})()}).then(t=>{if(!t||!t.linuxDevice||e.signal.aborted)return null;t.linuxDevice.registerCallback("cpuActivity",this.onCpuActivity),t.linuxDevice.registerCallback("diskActivity",this.onDiskActivity),this.props.activityTarget&&this.props.activityTarget.style.setProperty("--activity-color","var(--cpu-active-color, var(--disk-active-color, rgba(255, 255, 255, 0.5)))");var r=[];if(this.props.fileListener){var s=this.props.fileListener((e,r,a)=>(0,n._)(function*(){if(e=e||"__","/"===r||"/"===r.at(r.length-1))throw Error("Illegal path ".concat(r));var n=this.state.linuxDevice;if(!n)throw Error("Expected linux device to be available");var i="/".concat(Math.random().toString(36).substring(2),".tmp"),s="/ephemeral".concat(i),o="/idb/terminal-runner/".concat(e).concat(r),l=t.devices["/ephemeral"];yield l.writeFile(i,null!=a?a:"");var c=o.split("/").slice(0,-1).join("/");if(c.includes(".."))throw Error("Illegal path (".concat(c,") for ").concat(r));yield n.run("/usr/bin/mkdir",["-p","".concat(c,"/")],u),yield n.run("/bin/bash",["-c",'cat "'.concat(s,'" > "').concat(o,'"')],u),yield n.run("/usr/bin/unlink",[s],u).catch(e=>console.warn("[terminal-runner] failed to clear temporary file ".concat(s," (").concat(r,")"),e))}).call(this));r.push(s)}if(this.props.runListener){var o=this.props.runListener((e,t)=>this.runPreparedCommand(e,t,this.props.onProgress));r.push(o)}return this.setState(e=>(0,i._)((0,a._)({},e),{booted:!0,devices:(0,a._)({},e.devices,t.devices),linuxDevice:t.linuxDevice,cleanup:[...e.cleanup,...r]})),t}).catch(e=>(console.error("[terminal] error during boot",e),this.shutdown(),null));s.deviceUrl=t,s.deviceName=r,s.abortController=e,this.bootSequence=s}onCpuActivity(e){"ready"===e?document.body.style.removeProperty("--cpu-active-color"):document.body.style.setProperty("--cpu-active-color","rgb(255, 127, 127)")}onDiskActivity(e){"ready"===e?document.body.style.removeProperty("--disk-active-color"):document.body.style.setProperty("--disk-active-color","rgb(255, 255, 127)")}
1reboot(){this.shutdown(),this.boot()}shutdown(){if(this.bootSequence){this.state.cleanup.forEach(e=>e());var e,t,r,n=(0,a._)({},this.state.devices);null==(e=this.bootSequence.abortController)||e.abort("Shutdown"),this.bootSequence=void 0,Object.keys(n).forEach(e=>{n[e].delete()}),null==(t=this.state.linuxDevice)||t.unregisterCallback("cpuActivity",this.onCpuActivity),null==(r=this.state.linuxDevice)||r.unregisterCallback("diskActivity",this.onDiskActivity),this.setState(e=>(0,i._)((0,a._)({},e),{booted:!1,cleanup:[],devices:Object.entries(e.devices).filter(e=>{var[t,r]=e;return n[t]!==r}).reduce((e,t)=>{var[r,n]=t;return e[r]=n,e},{}),linuxDevice:e.linuxDevice&&n["~linux"]!==e.linuxDevice?e.linuxDevice:void 0}))}}render(){var e=this.props.Console;return(0,o.jsx)(e,{device:this.state.linuxDevice,onConsoleWrite:this.props.onConsoleWrite,onRegister:this.props.onRegister,onReset:this.props.onReset})}runCommand(){return(0,n._)(function*(){var{onProgress:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.state.linuxDevice;if(!t)throw Error("Expected linux device to exist");switch(this.props.type){case"terminal":e&&e("Connecting",3),yield t.run("/bin/bash",["--login"],u).then(e=>{var{status:t}=e;return p(t,"login")});return;case"python-test-runner":var r="/version.txt",n="/idb".concat(r);yield t.run("/usr/bin/touch",[n],u).then(e=>{var{status:t}=e;return p(t,"touch")}),yield t.run("/usr/bin/truncate",["-s","0",n],u).then(e=>{var{status:t}=e;return p(t,"truncate")}),e&&e("Preparing",15),yield t.run("/bin/bash",["-c",'/usr/bin/pytest --version > "'.concat(n,'"')],u).then(e=>{var{status:t}=e;return p(t,"pytest --version")}),(yield this.state.devices["/idb"].readFileAsBlob(r))||console.warn("[terminal-runner] failed to prep")}}).apply(this,arguments)}runPreparedCommand(e,t,r){return(0,n._)(function*(){var n=this.state.linuxDevice;if(!n)throw Error("Expected linux device to exist");if("pytest"===e){r&&r("Testing",15),t=t||"__";var s="/terminal-runner/".concat(t),o="/terminal-runner/".concat(t,"/output.txt"),l="/terminal-runner/".concat(t,"/files.txt"),c="/idb".concat(s),d="/idb".concat(o),f="/idb".concat(l);yield n.run("/bin/bash",["-c",'/usr/bin/pytest --no-header -rp > "'.concat(d,'"')],(0,i._)((0,a._)({},u),{cwd:c})).then(e=>{var{status:t}=e;return p(t,"pytest")}),yield n.run("/bin/bash",["-c","{ find -name '*_test.py'; find -name 'test_*.py'; } > \"".concat(f,'"')],(0,i._)((0,a._)({},u),{cwd:c})).then(e=>{var{status:t}=e;return p(t,"find")});var h=this.state.devices["/idb"],[v,m]=yield Promise.all([h.readFileAsBlob(o),h.readFileAsBlob(l)]);if(v&&m){var[b,g]=yield Promise.all([v.text(),m.text()]);return function(e,t){if(!e)return{version:1,message:"No output available. The tests failed to run to completion.",status:"error",tests:[]};var r,[n,a]=e.split("short test summary info"),[,i]=n.split("ERRORS");if(!a||i)return{version:1,message:(i||"").split("\n").filter(e=>"E"===e[0]&&" "===e[1]).map(e=>e.substring(1).trim()).join("\n")||"No errors or summary found",status:"error",tests:[]};var[,s]=n.split("FAILURES");if(!s){var o,l,c,u=[],d={},p=/@pytest.mark.task\(taskno=(\d+)\)/g;return t.forEach(e=>{[...e.matchAll(p)].forEach(e=>{var t=Number(e[1]);d[t]||(d[t]=!0,u.push({name:"",task_id:t,message:"",status:"pass",test_code:"",output:null}))})}),{version:3,message:a&&null!=(c=null==(l=a.trimEnd().split("\n").slice(-1).shift())?void 0:l.replace(/=+/g,""))?c:"No summary found",status:"pass",tests:u}}for(var f=s.split("\n"),h=[],v={},m=0;m<f.length;){var b=f[m];if("_"===b[0]&&("_"===b[1]||" "===b[1])&&"_"===b[b.length-1]){for(var g,x=b.split(" ")[1]||"(unknown test name)",y=m+1;y<f.length&&!f[y].trim().includes("@pytest.mark.task(taskno=");)y+=1;var _=y!==f.length?null==(g=f[y].split("=").pop())?void 0:g.split(")").shift():null,w=_?Number(_):void 0;if(y<f.length?m=y:m++,w&&v[w])continue;for(var k="",j="";m<f.length;){var A=f[m].trim();if(">"===A[0]&&" "===A[1]&&(k=A.substring(1).trimStart()),"E"===A[0]&&" "===A[1]){j=A.substring(1).trimStart();break}if("_"===A[0]&&("_"===A[1]||" "===A[1])&&"_"===A[A.length-1])break;m++}w&&(v[w]=!0),h.push({name:x,task_id:w,status:"fail",message:j||"No failure message collected",test_code:k,output:null})}m++}var C=/@pytest.mark.task\(taskno=(\d+)\)/g;
1return t.forEach(e=>{[...e.matchAll(C)].forEach(e=>{var t=Number(e[1]);v[t]||(v[t]=!0,h.push({name:"",task_id:t,message:"",status:"pass",test_code:"",output:null}))})}),{version:3,message:[a&&null!=(r=null==(o=a.trimEnd().split("\n").slice(-1).shift())?void 0:o.replace(/=+/g,""))?r:"No summary found",h.filter(e=>"pass"!==e.status).map(e=>e.message).filter(Boolean).at(0)].join("\n\n"),status:"fail",tests:h}}(b,(yield Promise.all(g.split("\n").map(e=>e.trim().replace(".",s)).map(e=>h.readFileAsBlob(e).then(e=>{var t;return null!=(t=null==e?void 0:e.text())?t:""}).catch(()=>"")))).filter(Boolean))}return m?(console.warn("[terminal-runner] failed to run to completion"),null):(console.warn("[terminal-runner] failed to run to completion or find tests"),null)}}).call(this)}constructor(e){super(e),this.onCpuActivity=this.onCpuActivity.bind(this),this.onDiskActivity=this.onDiskActivity.bind(this),this.state={booted:!1,devices:{},linuxDevice:void 0,cleanup:[]}}}function p(e,t){}class f extends l.PureComponent{componentDidMount(){if(this.onUnregister=this.props.onRegister({onRunnerReceive:this.onMessage}),this.props.device)return void this.connectToDevice(this.props.device)}onMessage(e){if("string"==typeof e.data){var t=function(e){try{return JSON.parse(e)}catch(e){return{}}}(e.data);switch(t._type){case"com.ns.contextual-ui.terminal.runner.attached":var{cols:r,rows:n}=t;return this.setState(e=>(0,i._)((0,a._)({},e),{cols:Number(r),rows:Number(n)}));case"com.ns.contextual-ui.terminal.runner.command":for(var{command:s}=t,o=0;o<s.length;o++)this.state.send(s.charCodeAt(o));return}}}componentDidUpdate(e,t,r){(this.props.device!==e.device||this.state.cols!==t.cols||this.state.rows!==t.rows)&&(this.disconnectFromDevice(),this.props.device&&this.connectToDevice(this.props.device))}componentDidCatch(e,t){this.setState(t=>(0,i._)((0,a._)({},t),{error:e}))}componentWillUnmount(){this.disconnectFromDevice(),this.onUnregister&&(this.onUnregister(),this.onUnregister=void 0)}connectToDevice(e){this.props.onReset();var t=e.setCustomConsole(this.props.onConsoleWrite,this.state.cols,this.state.rows);this.setState(e=>(0,i._)((0,a._)({},e),{connected:!0,send:t}))}disconnectFromDevice(){this.setState(e=>(0,i._)((0,a._)({},e),{connected:!1,send:()=>{console.warn("send called but it was not attached")}}))}render(){return this.state.error?(0,o.jsx)("div",{children:this.state.error.message}):(0,o.jsx)("div",{})}constructor(e){super(e),this.onMessage=this.onMessage.bind(this),this.state={connected:!1,cols:80,rows:10,send:()=>{console.warn("send called but it was not attached")}}}}},16225:(e,t,r)=>{r.d(t,{C:()=>v});var n=r(81463),a=r(97320),i=r(62839),s=r(29152),o=r(65992),l=r(84025),c=r(39646),u=r(39144),d=r(13356),p=r(53988),f=r(55906),h=(e,t)=>{switch(t){case"request":return"requested";case"callback-close":case"close":if("inactive"===e||"requested"===e)return e;return"closing";case"callback-open":switch(e){case"inactive":case"active":return"inactive";case"requested":return"active";default:return e}case"focused":return"inactive"}};function v(e){var{languages:t,frameworks:r=[],slots:v,readonly:m=!1,"file-url":b,"exercise-id":g,"interactivity-config":x,className:y}=e,_=(0,i._)(e,["languages","frameworks","slots","readonly","file-url","exercise-id","interactivity-config","className"]),w=(0,d.useRef)(null),[k,j]=(0,d.useReducer)(h,"inactive"),A=(0,l.m)({exerciseId:g,languages:null!=t?t:[],frameworks:null!=r?r:[],slots:v,fileUrl:b,readonly:m}),C=(0,f.PM)(),N=(0,p.g7)(),E=(0,d.useCallback)(()=>{j("request"),C(A.current)},[C,A]),S=(0,d.useCallback)(e=>{j("close"),N()},[N]);return(0,f.fT)(()=>{j("callback-open")}),(0,f.uW)(()=>{j("callback-open")}),(0,f.UP)("*",()=>{j("callback-open")}),(0,p.BT)(e=>{"inactive"!==k&&"close"===e&&j("callback-close")}),(0,d.useEffect)(()=>{if("closing"===k){var e=requestAnimationFrame(()=>{var e;null==(e=w.current)||e.focus(),j("focused")});return()=>{cancelAnimationFrame(e)}}},[k]),(0,s.jsx)("react-ns-terminal",(0,a._)((0,n._)({},_),{className:"relative my-8 block w-full ".concat(null!=y?y:""),children:(0,s.jsxs)(o.A8,{ref:w,type:"button",onClick:"active"===k?S:E,display:"medium",variant:"inactive"!==k?"secondary":"primary",PrefixIcon:"inactive"!==k?c.A:u.A,prefixIconProps:{className:"text-[--text-color]"},pending:"requested"===k||"closing"===k,pendingLabel:"requested"===k?"Opening terminal...":"Closing terminal...",children:["active"===k?"Close":"Open"," terminal"]})}))}},28547:(e,t,r)=>{r.d(t,{B:()=>b});var n=r(29152),a=r(89779);r(39639);var i=r(84551),s=r(13356),o=r(53988),l=r(63267),c=r(39943),u=r(39958),d=r(68563),p=r(41809),f=r(38021),h=r(28705),v={enableSizeReports:!0,pixelLimit:0x1000000,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7};function m(e){var t,r,a,{onConnect:i,onTerminalResponse:o,className:l,injectStyle:m}=e,b=(0,s.useRef)(null);t=b,r=i,a=o,(0,s.useLayoutEffect)(()=>{var{current:e}=t;if(e){var n=new h.B({convertEol:!0});n.open(e),n.loadAddon(new u.W(v)),n.loadAddon(new f.c);var i=new d.i;n.loadAddon(i);var s=new p.n;n.loadAddon(s);var o=new c.Y;n.loadAddon(o),o.fit();var l=()=>{o.fit()},m=[];window.addEventListener("resize",l);var b=r({onTerminalReceive:e=>{if("string"!=typeof e.data){e.data instanceof Uint8Array&&n.write(e.data);return}var t=function(e){try{return JSON.parse(e)}catch(e){return{}}}(e.data)._type,r=e.source;if(!r)return console.warn("[twindow] message received without source"),null==s||s.dispose(),null==i||i.dispose(),n.dispose(),null;switch(t){case"com.ns.contextual-ui.terminal.runner.register":a(r,JSON.stringify({_type:"com.ns.contextual-ui.terminal.runner.attached",cols:n.cols,rows:n.rows}
1)),m.forEach(e=>e.dispose()),m.splice(0,m.length),m.push(n.onData(e=>{a(r,JSON.stringify({_type:"com.ns.contextual-ui.terminal.runner.command",command:e}))}));break;case"com.ns.contextual-ui.terminal.runner.reset":return void n.reset()}}});return()=>{null==s||s.dispose(),null==i||i.dispose(),n.dispose(),m.forEach(e=>e.dispose()),m.splice(0,m.length),window.removeEventListener("resize",l),b()}}},[t,r,a]);var g=(0,s.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{id:g,ref:b,className:l}),m?(0,n.jsx)("style",{children:"#".concat(g," .xterm {\n        ").concat(m,"\n      }")}):null]})}function b(e){var{className:t,withMobileCloseButton:r=!0}=e,a=(0,s.useRef)(null),i=(0,s.useRef)(null),o=(0,s.useCallback)(e=>{var{onTerminalReceive:t}=e;return i.current=t,()=>{i.current=null}},[]),c=(0,s.useCallback)((e,t)=>{var{current:r}=a;if(!r)return void console.warn("[term] received terminal response but not connected");r(new MessageEvent("message",{data:t,source:e}))},[]),u=(0,s.useCallback)(e=>{var{onRunnerReceive:t}=e,{current:r}=i;return r?(a.current=t,r(new MessageEvent("message",{data:JSON.stringify({_type:"com.ns.contextual-ui.terminal.runner.register"})})),()=>{a.current=null}):(console.warn("[term] received register but not connected"),()=>{})},[a,i]),d=(0,s.useCallback)(()=>{var{current:e}=i;if(!e)return void console.warn("[term] received reset but not connected");e(new MessageEvent("message",{data:JSON.stringify({_type:"com.ns.contextual-ui.terminal.runner.reset"})}))},[]),p=(0,s.useCallback)(e=>{var t=new Uint8Array(e),{current:r}=i;if(!r)return void console.warn("[term] received console write but not connected");r(new MessageEvent("message",{data:t}))},[i]);return(0,n.jsxs)("div",{className:"bg-black ".concat(null!=t?t:""),children:[(0,n.jsx)(m,{onConnect:o,onTerminalResponse:c,className:"h-full max-h-[calc(100dvh-50px)] min-h-0",injectStyle:"padding-left: 1.5rem;"}),(0,n.jsx)(l.V,{type:"terminal",onConsoleWrite:p,onRegister:u,onReset:d}),r?(0,n.jsx)(g,{}):null]})}function g(){var e=(0,o.g7)();return(0,n.jsx)("div",{className:"flex flex-row gap-3",children:(0,n.jsx)(a.h,{Icon:i.A,iconLabel:"Close terminal",className:"absolute bottom-[calc(100%+1.25rem)] left-5 lg:hidden",display:"large",variant:"secondary",type:"button",onClick:e})})}},32534:(e,t,r)=>{r.d(t,{f:()=>c});var n=r(62839),a=r(29152),i=r(89779),s=r(84551),o=r(62856),l=r(13356);function c(e){var{slides:t}=e;(0,n._)(e,["slides"]);var[r,c]=(0,l.useState)(0),u=(0,l.useCallback)(()=>{c(e=>e-1)},[c]),d=(0,l.useCallback)(()=>{c(e=>e+1)},[c]),p=(0,l.useRef)(null),f=t.length;return(0,l.useLayoutEffect)(()=>{var{current:e}=p;if(e){var t=e=>{switch(e.key){case"Home":c(0),e.preventDefault();return;case"End":c(f-1),e.preventDefault();return;case"ArrowLeft":c(e=>(e-1+f)%f),e.preventDefault();return;case"ArrowRight":c(e=>(e+1+f)%f),e.preventDefault();return;default:["1","2","3","4","5","6","7","8","9"].includes(e.key)&&(c(Math.min(Number(e.key),f)-1),e.preventDefault())}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}},[p,f]),(0,a.jsxs)("react-ns-image-gallery",{children:[(0,a.jsx)("style",{children:".hypermedia.--learn react-ns-image-gallery {\n        display: block;\n        margin-top: calc(2 * var(--spacing, 1.5rem));\n        margin-bottom: calc(2 * var(--spacing, 1.5rem));\n\n        & .ns-image-gallery__highlight {\n          margin-bottom: calc(0.5 * var(--spacing, 1.5rem));\n\n          & figcaption {\n            color: var(--iron-500, #70707B);\n            font-family: var(--font-inter, var(--font-sans));\n            font-size: 16px;\n            font-style: normal;\n            font-weight: 400;\n            line-height: 170%;\n\n            & + *, * + & {\n              margin-top: calc(0.5 * var(--spacing, 1.5rem));\n            }\n          }\n\n          & figure  {\n            margin: 0; padding: 0;\n\n            & img, & video, & iframe {\n              overflow: hidden;\n              aspect-ratio: var(--aspect-ratio, 16/10);\n              background: rgb(250 250 250);\n              border-radius: 12px;\n              border: 1px solid rgba(0, 0, 0, 0.1);\n              width: 100%;\n              max-width: 100%;\n              object-fit: contain;\n            }\n          }\n        }\n\n        & > .grid {\n          & > .slide {\n            & > figure {\n              margin: 0;\n              padding: 0;\n              overflow: hidden;\n              aspect-ratio: var(--aspect-ratio, 16/10);\n              background: rgb(250 250 250);\n              border-radius: 12px;\n              border: 1px solid rgba(0, 0, 0, 0.1);\n              width: 100%;\n              max-width: 100%;\n            }\n            & > figure img, & > figure video, & > figure iframe { object-fit: cover; }\n            & > figcaption { display: none; }\n          }\n        }\n      }"}),(0,a.jsxs)("div",{className:"ns-image-gallery__highlight relative",children:[t[r],(0,a.jsxs)("div",{className:"absolute left-6 top-6 rounded-lg bg-white px-3 py-1.5 text-base font-semibold text-gray-iron-500 [font-family:--font-inter]",children:["Step ",r+1]}),(0,a.jsx)("div",{className:"absolute left-6 top-1/2 -translate-y-1/2",children:(0,a.jsx)(i.h,{Icon:s.A,iconLabel:"Highlight previous step",type:"button",display:"small",variant:"secondary",onClick:u,disabled:0===r})}),(0,a.jsx)("div",{className:"absolute right-6 top-1/2 -translate-y-1/2",children:(0,a.jsx)(i.h,{Icon:o.A,iconLabel:"Highlight next step",type:"button",display:"small",variant:"secondary",onClick:d,disabled:r===f-1})})]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-3 md:grid-cols-4",ref:p,children:t.map((e,t)=>(0,a.jsxs)("button",{className:"slide relative rounded-xl transition focus:outline-none ".concat(t===r?"ring-4 ring-utility-blue-dark-100 ring-offset-2 ring-offset-utility-blue-dark-500":""),"aria-current":t===r?"step":void 0,type:"button",onClick:()=>c(t),tabIndex:t===r?0:-1,children:[e,(0,a.jsx)("div",{className:"absolute left-2 top-2 rounded-lg bg-white px-2 py-0.5 text-xs font-semibold text-gray-iron-500 [font-family:--font-inter]",children:t+1})]},"slide-".concat(t)))})]})}},33077:(e,t,r)=>{r.d(t,{w8:()=>g,tp:()=>b,BV:()=>m,g1:()=>h,uQ:()=>f,zD:()=>v});
1var n=r(81463),a=r(97320),i=r(62839),s=r(29189),o=r(94450),l=r(46119),c=r(58967);let u=(0,c.createServerReference)("60afcd0b8d985550e64084f48eed114fb580c1167d",c.callServer,void 0,c.findSourceMapURL,"fetchGrantCollectionByPosition"),d=(0,c.createServerReference)("702416dd4cd46838e0cf687f3c64e779a7f4a11fd8",c.callServer,void 0,c.findSourceMapURL,"fetchGrantCollectionByPastExam");var p=r(72748);function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,{enabled:o=!0}=t,c=(0,i._)(t,["enabled"]),{data:d,error:f}=(0,p.r)({enabled:!!o},r);return(0,s.useQuery)((0,a._)((0,n._)({queryKey:l.B.grantCollectionForPosition(d,e),queryFn:t=>{var{}=t;return u(e)}},c),{enabled:!!o}),r)}function h(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0,{enabled:c=!0}=r,u=(0,i._)(r,["enabled"]),{data:f,error:h}=(0,p.r)({enabled:!!c},o);return(0,s.useQuery)((0,a._)((0,n._)({queryKey:l.B.grantCollectionForPastExam(f,e,t),queryFn:r=>{var{}=r;return d(e,t)}},u),{enabled:!!c}),o)}function v(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0,{select:o}=r,l=(0,i._)(r,["select"]);return f(e,(0,a._)((0,n._)({},l),{select:e=>{var{grants:r}=e,n=r.filter(e=>"topic"===e.type?e._links.self.href===t||e._links.self.href.endsWith("/".concat(t))||e._links.self.href.endsWith("/".concat(t,"/")):"topic"in e._links&&(e._links.topic.href===t||e._links.topic.href.endsWith("/".concat(t))||e._links.topic.href.endsWith("/".concat(t,"/"))));return o?o(n):n}}),s)}function m(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0,{select:l}=r,c=(0,i._)(r,["select"]);return f(e,(0,a._)((0,n._)({},c),{select:e=>{var r,{grants:n}=e,a=null!=(r=n.filter(o.dr).find(e=>e._links.self.href===t||e._links.self.href.endsWith("/".concat(t))||e._links.self.href.endsWith("/".concat(t,"/"))))?r:null;return l?l(a):a}}),s)}function b(e){switch(e.type){case"position":return e.title;case"topic":return String(e.topic_index);case"sub-topic":return[e.topic_index,e.sub_topic_index].join(".");case"exercise":return[e.topic_index,e.sub_topic_index,e.exercise_index].join(".");default:return"(unknown)"}}function g(e){switch(e.type){case"position":return"position-".concat(e._links.self.href.split("/").filter(Boolean).pop());case"topic":return"topic-".concat(e._links.self.href.split("/").filter(Boolean).pop());case"sub-topic":return"subtopic-".concat(e._links.topic.href.split("/").filter(Boolean).pop(),"-").concat(e._links.self.href.split("/").filter(Boolean).pop());case"exercise":return"exercise-".concat(e._links.self.href.split("/").filter(Boolean).pop());default:return null}}},33459:(e,t,r)=>{r.d(t,{N8:()=>q,UG:()=>F,cv:()=>T});var n=r(85468),a=r(81463),i=r(97320),s=r(62839),o=r(29152),l=r(65992),c=r(89779),u=r(42096),d=r(2204),p=r(84551),f=r(4323),h=r(35823),v=r(2604),m=r(85919),b=r(66733),g=r(63095),x=r(39646),y=r(93035),_=r(13356),w=r(55906),k=r(54044),j=r(53988),A=r(95326),C=r(58967);let N=(0,C.createServerReference)("60bbf72649b0d6d5361bb1c6a00b4502a78d24bf06",C.callServer,void 0,C.findSourceMapURL,"transpileEcmaScriptLike");var E=r(69494),S=r(77425);class R extends Error{constructor(e,t){super("Failed to format ".concat(e,": ").concat(t.message)),this.filename=e,this.cause=t,this.name=this.constructor.name,Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack}}class D extends Error{constructor(e,t){super("Failed to transpile ".concat(e,": ").concat(t.message)),this.filename=e,this.cause=t,this.name=this.constructor.name,Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack}}var L={state:"none",passedCount:0,totalCount:0,message:""},P=()=>Promise.reject(Error("Expected nativeRun to be available but it is not"));function T(e){var t=(0,_.useRef)(null),r=(0,_.useRef)(null),a=(0,d.D)(e=>(t.current=e,()=>{t.current=null}));return{fileListener:a,runListener:(0,d.D)(e=>(r.current=e,()=>{r.current=null})),onNativeRun:(0,d.D)(a=>(0,n._)(function*(){if("crossOriginIsolated"in window&&!window.crossOriginIsolated){var n=window.location.href;if(n.includes("?r")||n.includes("&r"));else{var i=[n,"r=1"].join(n.includes("?")?"&":"?");throw window.location.href=i,Error("Reloading page for cross-origin isolation")}}if(!t.current)throw Error("No write available");var{current:s}=t;if(yield Promise.all(a.map(t=>{var[r,n]=t;return s(e,"/".concat(r),n.contents.toString()).catch(e=>{throw Error("[test-runner] failed to write file (".concat(n.contentType,") to /").concat(r),{cause:e})})})),!r.current)throw Error("No run available");var o=yield r.current("pytest",e);return o?"string"==typeof o?{version:1,message:o,status:"error",tests:[]}:o:{version:1,message:"No test output was generated. Tests failed to run to completion.",status:"error",tests:[]}})())}}function F(e){var t,{inputs:u,exerciseId:g,fileUrl:x,persist:y=!0,showCloseEditorAlways:C=!1,showInstructionsButtonAlways:S=!1,nativeRun:T=P}=e,F=(0,k.Md)(),q=(0,w.lu)(),[z,W]=(0,_.useReducer)(()=>!0,!1),[U,O]=(0,_.useState)(()=>({})),[H,V]=(0,_.useState)(null),[$,G]=(0,_.useState)(L),K=(0,_.useCallback)(()=>G(L),[]),[Q,X]=(0,_.useState)(!1),J=(0,_.useRef)(null),[Y,Z]=(0,_.useState)(!1),[ee,et]=(0,_.useState)(!1),er=!1!==Y,en=(0,d.D)(()=>{(0,n._)(function*(){null==(e=J.current)||e.abort("Running tests");
1var e,t=J.current=new AbortController;if(Z("Saving"),et([0,Object.keys(U).length]),G(L),y&&(yield Promise.all(Object.entries(U).map(e=>{var[,r]=e;if(r.fileUrl)return F(r.fileUrl,r).finally(()=>{t.signal.aborted||et(e=>!1!==e&&[e[0]+1,e[1]])})}))),et(!1),t.signal.aborted){var s=t.signal.reason;throw s instanceof Error?s:Error(s)}Z("Transpiling");var o=yield Promise.all(Object.entries(U).map(e=>{var[t,r]=e;return(0,n._)(function*(){return r.binary||!r.transpile?[t,r]:N(r.contents,t).then(e=>[t,(0,i._)((0,a._)({},r),{contents:e||""})]).catch(e=>{throw new D(t,e)})})()}));if(t.signal.aborted){var l=t.signal.reason;throw l instanceof Error?l:Error(l)}var c=yield Promise.all([r.e(31433),r.e(61015)]).then(r.bind(r,61015)).then(e=>{var{format:t}=e;return t});Z("Formatting");var u=yield Promise.all(o.map(e=>{var[t,r]=e;return(0,n._)(function*(){return r.binary||!r.prettify?[t,r]:c(r.contents,{parser:r.prettify,filepath:"".concat(t)}).then(e=>[t,(0,i._)((0,a._)({},r),{contents:e||""})]).catch(e=>{throw new R(t,e)})})()}));if(t.signal.aborted){var d=t.signal.reason;throw d instanceof Error?d:Error(d)}if(!u.some(e=>{var[t]=e;return"pytest.ini"===t})&&u.some(e=>{var[t]=e;return t.endsWith("_test.py")||t.endsWith(".py")&&t.startsWith("test_")})&&u.push(["pytest.ini",{transpile:!1,prettify:!1,binary:!1,contentType:"text/plain",contents:"\n[pytest]\naddopts =\n        --color=no\nnorecursedirs =\n        .git .github example* traceback-styles*\ncache_dir =\n        /tmp/python_cache_dir\nmarkers =\n        task: A concept exercise task.\nconsole_output_style =\n        classic\n".trimStart()}]),!u.some(e=>{var[t]=e;return".meta/config.json"===t})){var p=u.map(e=>{var[t]=e;return t});u.push([".meta/config.json",(0,a._)({transpile:!1,prettify:!1,binary:!1,contentType:"application/json",contents:JSON.stringify({authors:["derk-jan-ns","maxnetworkstate"],contributors:[],files:{solution:p.filter(e=>!e.includes(".spec")&&!e.includes(".test")),test:p.filter(e=>e.includes(".spec")||e.includes(".test")),editor:[],exemplar:[]},blurb:"",custom:{"version.tests.compatibility":"jest-27","flag.tests.task-per-describe":!0,"flag.tests.may-run-long":!1,"flag.tests.includes-optional":!1,"flag.tests.fail-fast":!1}})},H)])}Z("Testing");var f=yield ec({formattedEntries:u,signal:t.signal});if(Z(!1),f){var h=f.tests.map(e=>e.task_id).filter((e,t,r)=>r.indexOf(e)===t),v=0===h.length||1==h.length&&!h[0],m=v?f.tests.length:h.length,b=v?f.tests.filter(e=>"pass"===e.status).length:h.length-f.tests.filter(e=>"pass"!==e.status).map(e=>e.task_id).filter((e,t,r)=>r.indexOf(e)===t).length;if(f.message)G({state:"pass"===f.status?"passed":"failed",passedCount:b,totalCount:m,message:f.message}),X("pass"===f.status);else if("pass"===f.status)G({state:"passed",passedCount:b,totalCount:m,message:""}),X(!0);else{var _=f.tests.find(e=>"pass"!==e.status);G({state:"failed",passedCount:b,totalCount:m,message:_?"Test: ".concat(_.name,"\n").concat(_.message):"Tests failed, try again"}),X(!1)}q({exerciseId:g,fileUrl:x,result:f})}})().catch(e=>{var t;null==(t=J.current)||t.abort("An error occurred"),Z(!1),et(!1),e instanceof R||e instanceof D?(G({state:"failed",passedCount:0,totalCount:-1,message:e.message}),q({exerciseId:g,fileUrl:x,result:{status:"error",message:e.message,version:1,tests:[]}})):console.error(e)})});(0,k.x)(u,e=>{var t=A.M.parserFor(e.detail.contentType);switch(e.detail.contentType){case"application/javascript":case"text/html":case"text/css":case"application/json":var r=String(e.detail.contents),n=B(e.detail.url),s={fileUrl:e.detail.url,contents:r,contentType:e.detail.contentType,prettify:t,transpile:!1,binary:!1};if(e.detail.url.endsWith(".meta/config.json")){V(s),O(e=>(0,i._)((0,a._)({},e),{".meta/config.json":s}));return}O(e=>(0,i._)((0,a._)({},e),{[n]:s}));break;case"text/jsx":case"text/tsx":case"text/typescript-jsx":case"application/typerscript":var o=String(e.detail.contents),l=B(e.detail.url),c={fileUrl:e.detail.url,contents:o,contentType:e.detail.contentType,prettify:t,transpile:!0,binary:!1};O(e=>(0,i._)((0,a._)({},e),{[l]:c}));break;case"text/x-python":var u=String(e.detail.contents),d=B(e.detail.url),p={fileUrl:e.detail.url,contents:u,contentType:e.detail.contentType,prettify:t,transpile:!1,binary:!1};W(),O(e=>(0,i._)((0,a._)({},e),{[d]:p}));break;default:console.warn("unhandled",e.detail.contentType)}});var ea=(0,w.$H)(g,"format",":active"),ei=(0,w.$H)(g,"reset","*"),es=(0,j.g7)(),eo=(0,w.bx)(),el=(0,_.useCallback)(()=>{eo({exerciseId:g})},[eo,g]),ec=(t=!0===z&&T,(0,_.useCallback)(e=>{var{formattedEntries:r,signal:s}=e;return(0,n._)(function*(){if(t)return t(r);var e,n=(e=globalThis).__exercism||(e.__exercism={});return n.workers||(n.workers={}),n.workers.javascript="/learn/output/javascript-browser-test-runner-worker.mjs",yield import("/learn/output/javascript-test-runner.mjs").then(e=>{var t,{runTests:n}=e;if(null==s||!s.aborted){var o=JSON.parse((null==(t=r.find(e=>{var[t]=e;return".meta/config.json"===t}))?void 0:t[1].contents.toString())||JSON.stringify({files:{solution:["#missing-configuration#"]}})).files.solution;return n("ns",r.reduce((e,t)=>
1{var[r,n]=t;return(0,i._)((0,a._)({},e),{[r]:n.contents})},{}),o,s)}})})()},[t]));return(0,o.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 z-[1] flex flex-col border-t bg-white px-6 py-5",children:[(0,o.jsx)(M,{output:$,onClearOutput:K}),(0,o.jsxs)("div",{className:"flex flex-row gap-3",children:[Q?null:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(c.h,{Icon:p.A,iconLabel:"Close editor",className:"absolute bottom-[calc(100%+1.25rem)] left-5 lg:hidden",display:"large",variant:"secondary",type:"button",onClick:es}),(0,o.jsxs)("div",{className:"absolute bottom-[calc(100%+1.25rem)] right-5 flex space-x-4 md:hidden",children:[(0,o.jsx)(c.h,{display:"large",variant:"secondary",type:"button",onClick:ea,disabled:er,Icon:f.A,iconLabel:"Format file"}),(0,o.jsx)(c.h,{display:"large",variant:"secondary",type:"button",onClick:ei,disabled:Q||er,Icon:h.A,iconLabel:"Reset file",className:"sm:hidden"})]})]}),Q?(0,o.jsx)(l.A8,{display:"medium",variant:"primary",type:"button",onClick:es,className:"shrink-0 self-start whitespace-nowrap",PrefixIcon:p.A,children:"Close editor"}):(0,o.jsx)(l.A8,{display:"medium",variant:"primary",type:"button",onClick:en,className:"shrink-0 self-start whitespace-nowrap",PrefixIcon:ee?function(e){var[t,r]=e;return function(e){var{className:n,size:c}=e,u=(0,s._)(e,["className","size"]);return(0,o.jsx)(l.R6,{label:"Saving files...",children:(0,o.jsx)("svg",(0,i._)((0,a._)({xmlns:"http://www.w3.org/2000/svg",width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin duration-1000"},u),{children:(0,o.jsx)("circle",{cx:"12",cy:"12",fill:"none",r:"10",strokeDasharray:"".concat((t+1)/(Math.max(1,r)+1)*Math.ceil(2*Math.PI*10)," ").concat(Math.ceil(2*Math.PI*10)),className:"transition-all"})}))})}}(ee):!1===Y?v.A:I,prefixIconProps:{className:"text-current"},children:ee?"Saving... (".concat(ee[0]+1," / ").concat(ee[1],")"):!1===Y?"Run tests":"".concat(Y,"...")}),(0,o.jsx)(l.A8,{display:"medium",variant:"secondary",type:"button",onClick:el,className:"shrink-0 self-start whitespace-nowrap ".concat(S?"":"lg:hidden"),PrefixIcon:m.A,prefixIconProps:{className:"text-current"},children:"Exercise"}),(0,o.jsx)(l.A8,{display:"medium",variant:"secondary",type:"button",onClick:ea,className:"hidden shrink-0 self-start whitespace-nowrap md:flex",disabled:Q||er,PrefixIcon:f.A,prefixIconProps:{className:"text-current"},children:"Format file"}),(0,o.jsx)(l.A8,{display:"medium",variant:"secondary",type:"button",onClick:ei,className:"ml-auto hidden shrink-0 self-end sm:flex md:!pl-8 xl:!pl-5 ".concat(C?"lg:self-start":""),disabled:Q||er,PrefixIcon:h.A,prefixIconProps:{className:"text-current"},children:(0,o.jsx)("span",{className:"md:sr-only xl:not-sr-only",children:"Reset"})}),C&&!Q?(0,o.jsx)(l.A8,{display:"medium",variant:"secondary",type:"button",onClick:es,className:"hidden shrink-0 self-start whitespace-nowrap lg:flex",PrefixIcon:b.A,prefixIconProps:E.x,children:"Back to question"}):null]})]})}function M(e){var{output:{state:t,passedCount:r,totalCount:n,message:a},onClearOutput:i}=e;return"none"===t?null:"passed"===t?(0,o.jsxs)("div",{className:"relative flex w-full flex-row gap-[14px] pb-5 pr-12",children:[(0,o.jsx)("div",{className:"flex aspect-square size-12 items-center justify-center rounded-lg bg-utility-green-50 p-2.5",children:(0,o.jsx)(g.A,{size:24,className:"text-utility-green-500"})}),(0,o.jsxs)("div",{className:"flex flex-col gap-1 text-iron-900",children:[(0,o.jsx)("h3",{className:"!mt-0 !text-base !font-bold",children:"Tests passed"}),(0,o.jsxs)("p",{className:"!mt-0 !text-base",children:[n>0?(0,o.jsxs)("span",{children:[n," of ",n," task",n>1?"s":""]}):(0,o.jsx)("span",{children:"All tasks"})," ","completed successfully"]})]}),(0,o.jsx)(c.h,{Icon:x.A,variant:"tertiary",display:"medium",type:"button",onClick:i,iconLabel:"Clear last test output and results",className:"absolute -right-4 -top-4"})]}):(0,o.jsx)(S.lG,{open:!0,onOpenChange:e=>{e||i()},children:(0,o.jsxs)(S.Cf,{hideCloseButton:!0,className:"sm:!max-w-[90vw]",children:[(0,o.jsx)(S.L3,{className:"sr-only",children:"Tests failed"}),(0,o.jsxs)("div",{className:"flex w-full min-w-0 max-w-full flex-col gap-5 pb-5",children:[(0,o.jsxs)("div",{className:"relative flex w-full flex-row gap-[14px] pr-12",children:[(0,o.jsx)("div",{className:"flex aspect-square size-12 items-center justify-center rounded-lg bg-error-primary-50 p-2.5",children:(0,o.jsx)(y.A,{size:24,className:"text-error-primary-500"})}),(0,o.jsxs)("div",{className:"flex flex-col gap-1 text-iron-900",children:[(0,o.jsx)("h3",{className:"font-bold",children:"Tests failed"}),(0,o.jsxs)("p",{children:[n>0?(0,o.jsxs)("span",{children:[r," of ",n," task",n>1?"s":""," completed successfully"]}):(0,o.jsx)("span",{children:"A problem occurred when running the tests"})," "]})]}),(0,o.jsx)(S.HM,{asChild:!0,children:(0,o.jsx)(c.h,{Icon:x.A,variant:"tertiary",display:"large",type:"button",onClick:i,iconLabel:"Clear last test output and results",className:"absolute -right-4 -top-4"})})]}),(0,o.jsx)("output",{className:"h-full w-full min-w-0 max-w-full overflow-auto whitespace-pre font-mono text-xs",children:a})]})]})})}function I(e){var{size:t,role:r,"aria-hidden":n}=e;return(0,o.jsx)(l.R6,{label:"Running tests...",children:(0,o.jsx)(u.c7,{size:t,"aria-hidden":n,role:r})})}function B(e){return new URL(e).pathname.split("/").pop()||"file"}function q(){var e=(0,j.g7)();return(0,o.jsx)("div",{className:"absolute bottom-0 left-0 right-0 z-[1] flex flex-col border-t bg-white px-6 py-5",children:(0,o.jsx)(l.A8,{display:"medium",variant:"primary",type:"button",onClick:e,className:"shrink-0 self-start whitespace-nowrap",PrefixIcon:p.A,children:"Close editor"})})}},37203:(e,t,r)=>{r.d(t,{x:()=>a});var n="vnd-ns-frontend://";function a(e,t){var r=e.startsWith(n)?"/"+e.slice(n.length):e;if(!t)return r;var a=r.indexOf("?"),i=-1===a?r:r.slice(0,a),s=new URLSearchParams(-1===a?"":r.slice(a+1));t.forEach((e,t)=>s.set(t,e));var o=s.toString();return o?"".concat(i,"?").concat(o):i}},42458:(e,t,r)=>{r.d(t,{z:()=>c});var n=r(29152),a=r(6805),i=r(62688),s=r(2198),o=r(88328),l=(0,r(13356).cache)(i.Yz);function c(e){var{children:t,language:r,startAt:i,"start-at":c=i}=e,{data:u}=(0,a.useSuspenseQuery)({queryKey:["code","language",(0,s.F)(null!=t?t:"")],staleTime:1/0,queryFn:()=>l(null!=t?t:"",{lang:null!=r?r:"text",theme:"light-plus"})});return(0,n.jsx)(o.a,{highlighted:!0,"start-at":c,language:r,children:(0,n.jsx)("div",{className:"ns-code-block__code",dangerouslySetInnerHTML:{__html:u}})})}},46119:(e,t,r)=>{function n(e){return e?"string"==typeof e?e:e.id:e}r.d(t,{B:()=>a});var a={lottie:(e,t)=>["lotttie",e,t],entrypoint:()=>["learn"],profile:e=>["learn","profile",null!=e?e:"-"],exercise:e=>""===e?["learn","exercises"]:["learn","exercises",e],exercisesForPositionTopic:(e,t)=>["learn","positions",e.split("/").pop(),"topics",t.split("/").pop(),"exercises"],grant:(e,t)=>
1["learn","profile",n(e),"grants",t.split("/").pop()],grantCollectionForPosition:(e,t)=>["learn","profile",n(e),"positions",t.split("/").pop(),"progress"],grantCollectionForPastExam:(e,t,r)=>["learn","profile",n(e),"exam",t,"positions",r.split("/").pop(),"grants"],position:e=>["learn","positions",e.split("/").pop()],positions:e=>["learn",e,"positions"],subTopic:e=>["learn","sub-topics",e],subTopicsForPosition:e=>["learn","positions",e.split("/").pop(),"sub-topics"],topic:e=>["learn","topics",e],topicsForPosition:e=>["learn","positions",e.split("/").pop(),"topics"],myExam:e=>["learn","@".concat("string"==typeof e?e:e.id),"exam"],pastExam:(e,t)=>["learn","@".concat("string"==typeof e?e:e.id),"exam",t]}},46237:(e,t,r)=>{r.d(t,{AV:()=>i,Bw:()=>s,Nr:()=>o});var n=r(81463),a=r(97320);class i extends Event{get consumed(){return this._consumed}consume(){this._consumed=!0}serialize(){return(0,a._)((0,n._)({},this.detail),{_type:this.type})}constructor(e,t){if(!e.startsWith("com.ns."))throw Error("Expected name '".concat(e,"' to start with com.ns."));super(e),this.detail=t,this._consumed=!1}}class s extends i{matches(e){return this.detail.tab===e}static deserialize(e){return new s(e)}static type(){return"com.ns.contextual-ui.navigate"}constructor(e){super(s.type(),e)}}class o extends i{matches(e){return this.detail.tab===e}behaviour(){return this.detail.animate?"matchMedia"in window?window.matchMedia("(prefers-reduced-motion: no-preference)").matches?"smooth":"instant":"smooth":"instant"}static deserialize(e){return new o(e)}static type(){return"com.ns.contextual-ui.exercise.scroll"}constructor(e){super(o.type(),e)}}},51466:(e,t,r)=>{r.d(t,{CB:()=>h,VI:()=>f,jo:()=>v});var n=r(85468),a=r(81463),i=r(97320),s=r(62839),o=r(85477),l=r(29189),c=r(79508),u=r(94450),d=r(46119),p=r(33077);function f(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0,{select:i}=r,o=(0,s._)(r,["select"]),{data:c}=(0,p.zD)(e,t,o);return(0,l.useQuery)({queryKey:d.B.exercisesForPositionTopic(e,t),queryFn:e=>{var{}=e;return(0,n._)(function*(){return yield Promise.all(c.filter(u.dr).map(e=>m(e._public_links.self.href,{})))})()},enabled:!!(c&&("boolean"!=typeof o.enabled||o.enabled))},a)}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,{select:i,enabled:o=!0,serveContext:c}=t,u=(0,s._)(t,["select","enabled","serveContext"]);return(0,l.useQuery)((0,a._)({queryKey:d.B.exercise(e),queryFn:t=>{var{}=t;return(0,n._)(function*(){return m(e,{fetchOptions:c?{headers:{"x-ns-serve-context":c}}:void 0})})()},enabled:!!(e&&o)},u),r)}function v(e,t){var{data:r}=(0,p.BV)(e,t);return r?(0,p.tp)(r):"(unknown)"}function m(e){return(0,n._)(function*(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{signal:r,fetchOptions:{next:n}={}}=t,l=(0,s._)(t.fetchOptions,["next"]),{headers:u}=l,d=(0,s._)(l,["headers"]),p=yield(0,o.A)(fetch,e,(0,i._)((0,a._)({method:"GET",signal:r},d),{headers:(0,a._)({accept:"application/vnd.network-school.exercise.v1+json, application/problem+json; q=0.1"},u),next:(0,a._)({revalidate:60},n)}),{feature:"learn_exercise",operation:"fetch_public_exercise"}),[f]=(p.headers.get("content-type")||"").split(";");if(!p.ok){if("application/problem+json"===f)throw new c.AF(p.url,p.status,(yield p.json()));throw new c.fk(p.url,p.status,(yield p.text()))}if(!(0,c.qG)("application/vnd.network-school.exercise.v1+json",f||""))throw Error('Expected "application/vnd.network-school.exercise.v1+json, actual: '.concat(f));return yield p.json()}).apply(this,arguments)}},52915:(e,t,r)=>{r.d(t,{H4:()=>p,U3:()=>d,WR:()=>f,sj:()=>c});var n=r(29152),a=r(79263),i=r(13356),s=r(48407),o=r(6978),l=(0,i.createContext)(null);function c(e){var{knownContextualId:t,children:r}=e,a=function(e){var[t,r]=(0,i.useState)(e);return(0,i.useEffect)(()=>{if(e)return void r(e);var[t,n]=function(){try{var e=sessionStorage.getItem(h);if(e)return[e,"storage"]}catch(e){}return(0,s.A)(window.name)?[window.name,"window"]:[(0,o.A)(),"generated"]}();"storage"!==n&&function(e,t){if("storage"!==t)try{sessionStorage.setItem(h,e)}catch(e){}"window"!==t&&(window.name=e)}(t,n),r(t)},[e]),null!=e?e:t}(t),[c,u]=(0,i.useState)();return((0,i.useLayoutEffect)(()=>
1{if(a){var e=new BroadcastChannel("com.ns.learn.contextual-ui.".concat(a));return u({contextualId:a,windowBroadcastChannel:e}),()=>{e.close()}}},[a]),c)?(0,n.jsxs)(l.Provider,{value:c,children:[r,null]},null!=a?a:"cui-window-context-nil"):null}function u(){var e=(0,i.useContext)(l);if(null===e)throw Error("Missing CuiWindowContext. Wrap the (sub)tree with <Cui.Window>.");return e}function d(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],{windowBroadcastChannel:n}=u();return(0,a.ML)(n,e,t,r)}function p(e){var{windowBroadcastChannel:t}=u();return(0,a.Fr)(t,e)}function f(){return u().contextualId}var h="com.ns.learn.contextual-ui.contextual-id"},53988:(e,t,r)=>{r.d(t,{A1:()=>P,BT:()=>L,Fp:()=>D,G3:()=>g,L8:()=>k,MC:()=>_,OF:()=>E,SX:()=>v,Yf:()=>b,ZG:()=>N,ZJ:()=>x,_G:()=>A,fF:()=>m,g:()=>y,g7:()=>R,g9:()=>h,h5:()=>w,it:()=>j,jy:()=>T,rn:()=>C,sl:()=>S,v2:()=>d});var n=r(29152),a=r(79263),i=r(2204),s=r(13356),o=r(60619),l=r(46237),c=r(52915),u=(0,s.createContext)(null);function d(e){var{tab:t,className:r,children:a,paneProps:i}=e,l=(0,c.WR)(),[d,f]=(0,s.useState)(),{hidden:h,inert:v}=function(e){var[t,r]=(0,s.useState)(()=>{var t;return!!e&&("boolean"==typeof e.hidden?e.hidden:null==(t=e.hidden)?void 0:t.matches)}),[n,a]=(0,s.useState)(()=>{var t;return!!e&&("boolean"==typeof e.inert?e.inert:null==(t=e.inert)?void 0:t.matches)});return(0,s.useLayoutEffect)(()=>{var t=[],n=null==e?void 0:e.hidden,i=null==e?void 0:e.inert;if(void 0!==n)if("boolean"==typeof n)r(n);else{var s=e=>r(e.matches);n.addEventListener("change",s),t.push(()=>{n.removeEventListener("change",s)}),r(n.matches)}else r(!1);if(void 0!==i)if("boolean"==typeof i)a(i);else{var o=e=>a(e.matches);i.addEventListener("change",o),t.push(()=>{i.removeEventListener("change",o)}),a(i.matches)}else a(!1);if(0!==t.length)return()=>t.forEach(e=>e())},[null==e?void 0:e.hidden,null==e?void 0:e.inert]),{hidden:t,inert:n}}(i);return((0,s.useLayoutEffect)(()=>{var e,r=(e=l||o.A,new BroadcastChannel("com.ns.learn.contextual-ui.".concat(e||o.A,".tabs.").concat(t)));return f({contextualId:l,tab:t,tabBroadcastChannel:r}),()=>{r.close()}},[l,t]),d)?(0,n.jsxs)(u.Provider,{value:d,children:[(0,n.jsx)(p,{className:r,inert:v,hidden:h,children:a}),null,(0,n.jsx)(F,{tab:t})]},"".concat(l,"-").concat(t)):null}function p(e){var t,r,a,{className:o,children:u,inert:d,hidden:p}=e,f=(0,s.useRef)(null),v=h();return t=v,r=(0,s.useCallback)((e,t)=>{if(f.current){var r=f.current.querySelector("#".concat(e));null==r||r.scrollIntoView({behavior:t?"smooth":"instant"})}},[f]),a=(0,i.D)(r),(0,c.U3)(l.Nr,(0,s.useCallback)((e,r)=>{if("tab"in e&&e.tab===t){var{fragment:n,animate:i}=e;a(String(n),!!i)}},[t,a])),(0,n.jsx)("div",{ref:f,className:o,"data-tab":v,"data-cui":"tab.scroll",inert:d,hidden:p,children:u})}function f(){var e=(0,s.useContext)(u);if(null===e)throw Error("Missing CuiTabContext. Wrap the (sub)tree with <Cui.Tab>.");return e}function h(){return f().tab}var v=h;function m(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],{tabBroadcastChannel:n}=f();return(0,a.ML)(n,e,t,r)}function b(e){var{tabBroadcastChannel:t}=f();return(0,a.Fr)(t,e)}function g(){var e=(0,c.H4)(l.Nr);return(0,s.useCallback)(t=>{var{tab:r,fragment:n,animate:a}=t;e({tab:r,fragment:n,animate:a})},[e])}function x(e){var{exerciseId:t,fileUrl:r,fileName:n,readonly:a,invisible:i,language:s}=e;if(!r)throw Error("fileUrl is required for a code tab");var o=new URLSearchParams;return o.set("exercise-id",t),o.set("language",s),o.set("file-url",r),n&&o.set("file-name",n),a&&o.set("readonly","1"),i&&o.set("hidden","1"),"vnd-ns-frontend://tabs/code?".concat(o.toString())}function y(e){var t=e.searchParams;return{exerciseId:t.get("exercise-id"),language:t.get("language"),fileUrl:t.get("file-url"),fileName:t.has("file-name")&&t.get("file-name")||void 0,readonly:t.has("readonly"),invisible:t.has("hidden")}}function _(e){var{exerciseId:t,frameworks:r,slots:n,fileUrl:a,readonly:i}=e;if(!a)throw Error("fileUrl is required for a terminal tab");var s=new URLSearchParams;return s.set("exercise-id",t),s.set("slots",n.join(",")),s.set("file-url",a),r&&r.length>0&&s.set("frameworks",r.join(",")),i&&s.set("readonly","1"),"vnd-ns-frontend://tabs/terminal?".concat(s.toString())}function w(e){return C(e)}function k(e){var{exerciseId:t,fileUrl:r,fileName:n,readonly:a,invisible:i,language:s}=e;if(!r)throw Error("fileUrl is required for an instructions tab");var o=new URLSearchParams;return o.set("exercise-id",t),o.set("language",s),r&&o.set("file-url",r),n&&o.set("file-name",n),a&&o.set("readonly","1"),i&&o.set("hidden","1"),"vnd-ns-frontend://tabs/instructions?".concat(o.toString())}function j(e){return y(e)}function A(e){var{exerciseId:t,frameworks:r,slots:n,fileUrl:a,readonly:i}=e,s=new URLSearchParams;return s.set("exercise-id",t),s.set("slots",n.join(",")),s.set("file-url",a),r&&r.length>0&&s.set("frameworks",r.join(",")),i&&s.set("readonly","1"),"vnd-ns-frontend://tabs/test-runner?".concat(s.toString())}function C(e){var t,r=e.searchParams;return{exerciseId:r.get("exercise-id"),slots:r.get("slots").split(",").filter(
1Boolean),frameworks:r.has("frameworks")&&(null==(t=r.get("frameworks"))?void 0:t.split(",").filter(Boolean))||[],fileUrl:r.get("file-url"),readonly:r.has("readonly")}}function N(e){var{exerciseId:t,frameworks:r,slots:n}=e,a=new URLSearchParams;return a.set("exercise-id",t),a.set("slots",n.join(",")),r&&r.length>0&&a.set("frameworks",r.join(",")),"vnd-ns-frontend://tabs/preview?".concat(a.toString())}function E(e){return C(e)}function S(){var e=(0,c.H4)(l.Bw),t=(0,i.D)(e);return(0,s.useCallback)(t,[t])}function R(){var e=(0,c.H4)(l.Bw),t=(0,i.D)(e);return(0,s.useCallback)(()=>{t({tab:"sheet",href:"about:blank",meta:{reason:"close"}})},[t])}function D(e){var t=(0,c.H4)(l.Bw),r=(0,i.D)(t);return(0,s.useCallback)(()=>{r({tab:"sheet",href:"about:blank",meta:{reason:e}})},[r,e])}function L(e){var t,r,n;return t="sheet",r=(t,r)=>{"about:blank"===t&&e((null==r?void 0:r.reason)?String(r.reason):void 0)},n=(0,i.D)(r),void(0,c.U3)(l.Bw,(0,s.useCallback)((e,r)=>{if("tab"in e&&e.tab===t){var{href:a,meta:i}=e;n(String(a),i)}},[t,n]))}class P extends l.AV{matches(e){return this.detail.tab===e}static deserialize(e){return new P(e)}static type(){return"com.ns.contextual-ui.tab.mounted"}constructor(e){super(P.type(),e)}}class T extends l.AV{matches(e){return this.detail.tab===e}static deserialize(e){return new T(e)}static type(){return"com.ns.contextual-ui.tab.unmounted"}constructor(e){super(T.type(),e)}}function F(e){var{tab:t}=e,r=(0,c.H4)(P),n=(0,c.H4)(T);return(0,s.useEffect)(()=>(r({tab:t}),()=>{n({tab:t})}),[t,r,n]),null}},54044:(e,t,r)=>{r.d(t,{Av:()=>y,Gf:()=>b,Md:()=>_,Rd:()=>v,d0:()=>x,jo:()=>w,og:()=>f,x:()=>g,yA:()=>m});var n=r(85468),a=r(29152),i=r(85477),s=r(2204),o=r(13356),l=r(79508),c=r(37203),u=r(46237),d=r(52915),p=(0,o.createContext)(null);function f(){var e={},t=new Map;return{listeners:e,onChanged:(t,r)=>{if(!t.startsWith("file://")&&!t.startsWith("vnd-ns-frontend://api/learn/my/files/"))throw Error("file '".concat(t,"' must be a 'file://...' or 'vnd-ns-frontend://api/learn/my/files/...' url"));e[t]||(e[t]=[]);var n=e[t];return n.push(r),()=>{var e=n.indexOf(r);e>-1&&n.splice(e,1)}},retrieveFile:(e,r)=>(0,n._)(function*(){var a,s,o,l,u=(a=e,s=null==r?void 0:r.params,(0,c.x)(a,s)),d=t.get(u);if(d&&h(d,null==r?void 0:r.accepts))return d;var p=yield(o=e,l=r,(0,n._)(function*(){if(!o.startsWith("vnd-ns-frontend://api/learn/my/files/"))throw Error("fileUrl '".concat(o,"' must be a 'vnd-ns-frontend://api/learn/my/files/...' url"));var e,t=null!=(e=null==l?void 0:l.accepts)?e:[{mediaType:"text/*"},{mediaType:"*/*",quality:.5}],r=yield(0,i.A)(fetch,(0,c.x)(o,null==l?void 0:l.params),{signal:null==l?void 0:l.signal,headers:{accept:t.map(e=>e.quality?"".concat(e.mediaType,"; q=").concat(e.quality):e.mediaType).join(", ")},credentials:"same-origin"},{feature:"learn_exam",operation:"retrieve_answer_file"}),n=(r.headers.get("content-type")||"").split(";").shift()||"";return!!t.some(e=>e.mediaType===n)&&(!(n.startsWith("text/")||n.endsWith("+json")||"application/json"===n||n.endsWith("+xml"))&&"application/javascript"!==n&&"application/typescript"!==n&&(n.startsWith("image/")||n.startsWith("video/")||n.startsWith("audio/"),1)?{contentType:n,contents:yield r.arrayBuffer(),binary:!0}:{contentType:n,contents:yield r.text(),binary:!1})})());return p&&h(p,null==r?void 0:r.accepts)&&t.set(u,p),p})(),persistFile:(e,r,a,s)=>(0,n._)(function*(){var o,u,d,p=(o=e,u=null==a?void 0:a.params,(0,c.x)(o,u)),f=t.get(p);(null==a||null==(d=a.signal)?void 0:d.aborted)||t.set(p,r);try{return yield function e(t,r,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return(0,n._)(function*(){if(!t.startsWith("vnd-ns-frontend://api/learn/my/files/"))throw Error("fileUrl '".concat(t,"' must be a 'vnd-ns-frontend://api/learn/my/files/...' url"));if(null==a||null==(u=a.signal)?void 0:u.aborted){if(a.signal.reason instanceof DOMException)throw a.signal.reason;throw new DOMException(String(a.signal.reason),"AbortError")}var n=(0,i.A)(fetch,(0,c.x)(t,null==a?void 0:a.params),{method:"PUT",body:r.contents,headers:{accept:"text/plain, application/problem+json; q=0.1","content-type":r.contentType},credentials:"same-origin"},{feature:"learn_exam",operation:"persist_answer_file"});try{var o=yield n;if(!o.ok){if(s>0&&o.status>=500)return e(t,r,a,s-1);var u,d,p,[f]=null!=(p=null==(d=o.headers.get("content-type"))?void 0:d.split(";"))?p:[];if("application/problem+json"===f)throw new l.AF(o.url,o.status,(yield o.json()));throw Error("Failed to persist file: ".concat(o.status))}return o}catch(n){if((!n||!(n instanceof DOMException))&&s>0)return e(t,r,a,s-1);throw n}})()}(e,r,a,s)}catch(e){throw e instanceof DOMException||(f?t.set(p,f):t.delete(p)),e}}
1)()}}function h(e,t){return(null!=t?t:[{mediaType:"text/*"},{mediaType:"*/*",quality:.5}]).some(t=>t.mediaType===e.contentType)}function v(e){var{children:t}=e,[r]=(0,o.useState)(f);return(0,a.jsxs)(p.Provider,{value:r,children:[t,(0,a.jsx)(w,{})]})}function m(e){var{provider:t,children:r}=e;return(0,a.jsx)(p.Provider,{value:t,children:r})}function b(e,t){var{onChanged:r}=(0,o.useContext)(p),n=(0,s.D)(t);(0,o.useEffect)(()=>{if(e)return r(e,n)},[e,r,n])}function g(e,t){var{onChanged:r}=(0,o.useContext)(p),n=(0,s.D)(t);(0,o.useEffect)(()=>{var t=e.filter(Boolean).map(e=>r(e,n));return()=>{t.forEach(e=>e())}},[e,r,n])}function x(){return(0,d.H4)(k)}function y(){var{retrieveFile:e}=(0,o.useContext)(p);return(0,s.D)(e)}function _(){var{persistFile:e}=(0,o.useContext)(p);return(0,s.D)(e)}function w(){var e=(0,o.useContext)(p);return(0,d.U3)(k,(t,r)=>{var n=e.listeners[t.url];if(n){var a=k.deserialize(t);n.forEach(e=>e(a))}}),null}class k extends u.AV{matches(e){return this.detail.url===e}static deserialize(e){return new k(e)}static type(){return"com.ns.contextual-ui.exercise.file.changed"}constructor(e){super(k.type(),e)}}},55074:(e,t,r)=>{r.d(t,{b:()=>a});var n=r(13356);function a(e){return(0,n.useMemo)(()=>e?"string"==typeof e?e:"detail"in e&&"string"==typeof e.detail?e.detail:"error"in e&&"string"==typeof e.error?e.error:e.message:"",[e])}},55906:(e,t,r)=>{r.d(t,{$4:()=>_,$H:()=>C,FL:()=>l,IL:()=>b,N1:()=>j,PM:()=>h,UP:()=>g,Vv:()=>N,W$:()=>c,bx:()=>k,fT:()=>v,lu:()=>y,uW:()=>p,yj:()=>d});var n=r(2204),a=r(13356),i=r(46237),s=r(53988),o=r(52915);class l extends i.AV{matches(e){return this.detail.exerciseRef===e}static deserialize(e){return new l(e)}static type(){return"com.ns.contextual-ui.exercise.mounted"}constructor(e){super(l.type(),e)}}function c(e){var{exerciseRef:t,fragment:r}=e,n=(0,s.Yf)(l),i=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{i.current||(i.current=!0,n({exerciseRef:t,fragment:r}))},[t,r,n]),null}class u extends i.AV{static deserialize(e){return new u(e)}static type(){return"com.ns.contextual-ui.playground.open"}constructor(e){super(u.type(),e)}}function d(){return(0,s.Yf)(u)}function p(e){var t=(0,n.D)((t,r)=>{e(t,r)});return(0,s.fF)(u,t)}class f extends i.AV{static deserialize(e){return new f(e)}static type(){return"com.ns.contextual-ui.terminal.open"}constructor(e){super(f.type(),e)}}function h(){return(0,s.Yf)(f)}function v(e){var t=(0,n.D)((t,r)=>{e(t,r)});return(0,s.fF)(f,t)}class m extends i.AV{static deserialize(e){return new m(e)}static type(){return"com.ns.contextual-ui.exercise.code.open"}constructor(e){super(m.type(),e)}}function b(){return(0,s.Yf)(m)}function g(e,t){var r=(0,n.D)((r,n)=>{("*"===e||e===r.exerciseId)&&t(r,n)});return(0,s.fF)(m,r)}class x extends i.AV{static deserialize(e){return new x(e)}static type(){return"com.ns.contextual-ui.exercise.code.results"}constructor(e){super(x.type(),e)}}function y(){return(0,o.H4)(x)}function _(e,t){var r=(0,n.D)((r,n)=>{r.exerciseId===e&&t(r,n)});return(0,o.U3)(x,r)}class w extends i.AV{static deserialize(e){return new w(e)}static type(){return"com.ns.contextual-ui.exercise.code.information"}constructor(e){super(w.type(),e)}}function k(){return(0,o.H4)(w)}function j(e,t){var r=(0,n.D)((r,n)=>{r.exerciseId===e&&t(r,n)});return(0,o.U3)(w,r)}class A extends i.AV{static deserialize(e){return new A(e)}static type(){return"com.ns.contextual-ui.exercise.code.action"}constructor(e){super(A.type(),e)}}function C(e,t,r){var a=(0,o.H4)(A);return(0,n.D)(()=>{a({exerciseId:e,action:t,filter:r})})}function N(e,t){var r=(0,n.D)((r,n)=>{("*"===e||e===r.exerciseId)&&t(r,n)});return(0,o.U3)(A,r)}},61346:(e,t,r)=>{r.d(t,{f:()=>u});var n=r(29152),a=r(89779),i=r(84551),s=r(13356),o=r(54044),l=r(53988),c='<!doctype html>\n<html lang="en">\n  <head>\n    <title>Preview</title>\n    <style>'.concat("/* 1. Use a more-intuitive box-sizing model */\n*, *::before, *::after {\n  box-sizing: border-box;\n}\n\n/* 2. Remove default margin */\n*:not(dialog) {\n  margin: 0;\n}\n\n/* 3. Enable keyword animations */\n@media (prefers-reduced-motion: no-preference) {\n  html {\n    interpolate-size: allow-keywords;\n  }\n}\n\nbody {\n  /* 4. Add accessible line-height */\n  line-height: 1.5;\n  /* 5. Improve text rendering */\n  -webkit-font-smoothing: antialiased;\n}\n\n/* 6. Improve media defaults */\nimg, picture, video, canvas, svg {\n  display: block;\n  max-width: 100%;\n}\n\n/* 7. Inherit fonts for form controls */\ninput, button, textarea, select {\n  font: inherit;\n}\n\n/* 8. Avoid text overflows */\np, h1, h2, h3, h4, h5, h6 {\n  overflow-wrap: break-word;\n}\n\n/* 9. Improve line wrapping */\np {\n  text-wrap: pretty;\n}\nh1, h2, h3, h4, h5, h6 {\n  text-wrap: balance;\n}\n\n/*\n  10. Create a root stacking context\n*/\n#root, #__next {\n  isolation: isolate;\n}",'</style>\n    <style>{defaultCss}</style>\n    <style>{css}</style>\n\n    {babelImports}\n  </head>\n  <body>\n    {body}\n    <script type="module">\n      const targetEl = document.querySelector(\'output#console\');\n      const targetHistoryEl = document.querySelector(\'output#console-history\');\n\n      const originalLog = console.log\n      console.log = function log(...args) {\n        targetHistoryEl.textContent = [targetEl.textContent, targetHistoryEl.textContent].join("\\n");\n        targetEl.textContent = args.join(\' \');
1\n        originalLog(...args);\n      }\n\n      {script}\n    <\/script>\n    <script type="text/babel" data-presets="env,react,typescript">\n      {babelScript}\n    <\/script>\n    <script>\n      document.addEventListener(\'click\', (event) => {\n        // Capture link clicks\n        if (event.target instanceof HTMLAnchorElement) {\n          event.preventDefault();\n          window.parent.postMessage({\n              _type: \'com.ns.contextual-ui.playground.message\',\n              message: `Clicked \'${event.target.textContent}\' (${event.target.href})`\n            },\n            "{origin}"\n          );\n        }\n      });\n    <\/script>\n    <output id="console" style="display: block;"></output>\n    <output id="console-history" style="opacity: 0.7;"></output>\n  </body>\n</html>\n');function u(e){var{inputs:t,frameworks:r,defaultCss:u="\nbody { padding: 20px 24px }\noutput { white-space: pre; font-family: monospace; }".trimStart()}=e,d=(0,s.useRef)(null),[p,f]=(0,s.useState)(()=>c),[h,v]=(0,s.useState)(""),[m,b]=(0,s.useState)(""),[g,x]=(0,s.use
1State)(""),[y,_]=(0,s.useState)("");(0,o.x)(t,e=>{switch(e.detail.contentType){case"text/html":var t=String(e.detail.contents);t.startsWith("<!doctype html>")?f(t):f(c.replace("{body}",t));break;case"text/css":v(String(e.detail.contents));break;case"application/javascript":b(String(e.detail.contents));break;case"text/jsx":case"text/tsx":case"text/typescript-jsx":case"application/typerscript":x(String(e.detail.contents))}}),(0,s.useEffect)(()=>{var{current:e}=d;e&&(_(""),e.srcdoc=p.replace("{body}",g?'<div id="app"></div>':"").replace("{css}",h).replace("{script}",m).replace("{babelScript}",g.replace("export default ","const App = ").replace("import {","const {").replace("from 'react'"," = React")+'\nconst domNode = document.getElementById("app");\nconst root = ReactDOM.createRoot(domNode);\nroot.render(<App />);').replace("{babelImports}",g?'\n  <script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"><\/script>\n  <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"><\/script>\n  <script src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>\n':"").replace("{defaultCss}",u).replace("</head>",'<base href="about:srcdoc"></head>').replace("{origin}","*"))},[p,h,m,g,u]),(0,s.useEffect)(()=>{var e=e=>{"null"===e.origin&&"object"==typeof e.data&&e.data&&"_type"in e.data&&"com.ns.contextual-ui.playground.message"===e.data._type&&_(e.data.message)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[]);var w=(0,l.g7)();return(0,n.jsxs)("div",{className:"relative flex h-full w-full flex-col","data-component":"code-playground-preview",children:[(0,n.jsxs)("div",{className:"relative flex w-full shrink grow bg-gray-iron-100",children:[(0,n.jsx)("iframe",{className:"flex w-full shrink grow bg-gray-iron-100 ".concat(y?"mb-5":"mb-20"),ref:d,allow:"none",sandbox:"allow-scripts",title:"Code Playground",credentialless:""}),(0,n.jsx)(a.h,{Icon:i.A,iconLabel:"Close playground",className:"absolute bottom-5 left-5 lg:hidden",display:"large",variant:"secondary",type:"button",onClick:w})]}),y?(0,n.jsx)("output",{className:"w-full shrink-0 grow-0 border-t bg-white/50 px-6 py-5 font-mono text-xs",children:y}):null]})}},63267:(e,t,r)=>{r.d(t,{V:()=>c});var n=r(29152),a=r(24926),i=r(77040),s=r(13356),o=r(10709),l=r(50996);function c(e){var t,{type:r,runListener:a,fileListener:i,onRegister:c,onConsoleWrite:d,onReset:p}=e,[f,h]=(0,s.useReducer)(()=>!0,!1),v=(0,s.useRef)(null);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u,{onReady:h}),(0,n.jsx)("div",{ref:v,className:"absolute right-2 top-2 p-3",children:(0,n.jsx)(l.A,{size:24,className:"text-[var(--activity-color,_rgb(25,99,255))]"})}),f?(0,n.jsx)(o.R,{type:r,onRegister:c,onConsoleWrite:d,onReset:p,activityTarget:null!=(t=v.current)?t:void 0,runListener:a,fileListener:i}):null]})}function u(e){var{onReady:t}=e;return(0,n.jsx)(i.default,{id:"cx-script","data-cx-target":"script",src:"https://cxrtnc.leaningtech.com/1.2.10/cx.js",integrity:"sha384-hDrrVXQZ9piChidrduWgHwfKgTqd+7tjlVRPv++04B5opcWdXVaf8Af/YKndoDpD",nonce:(0,a.d)(),onReady:t,crossOrigin:"anonymous"})}},68349:(e,t,r)=>{r.d(t,{s:()=>f});var n=r(54044),a=r(53988),i=r(52915),s=r(81463),o=r(97320),l=r(62839),c=r(29152),u=r(13356);function d(e){var{orientation:t,hidden:r}=e;return(0,c.jsx)("div",{role:"separator","aria-orientation":t,hidden:r,className:"shrink-0 grow-0 basis-[2px] bg-gray-iron-200"})}var p=r(81187),f=Object.freeze({Window:i.sj,Tab:a.v2,Tabs:p.c,FileSystem:n.Rd,BareFileSystem:n.yA,SubRectangle:function(e){var{id:t,weight:r,children:n,style:a}=e,i=(0,l._)(e,["id","weight","children","style"]),[d,p]=(0,u.useState)(r);return(0,c.jsx)("div",(0,o._)((0,s._)({id:t,style:(0,o._)((0,s._)({},a),{flex:d}),"data-cui-id":t,"data-cui":"sub-rectangle"},i),{children:n}))},Pane:function(e){var{className:t,orientation:r,children:n}=e,a=(0,l._)(e,["className","orientation","children"]),i=u.Children.map(n,(e,t)=>e?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(d,{orientation:function(e){switch(e){case"horizontal":return"vertical";case"vertical":return"horizontal"}}(r),hidden:0===t}),e]}):e);return(0,c.jsx)("div",(0,o._)((0,s._)({className:"flex ".concat("horizontal"===r?"w-full flex-row":"h-full flex-col"," ").concat(null!=t?t:""," "),"aria-orientation":r,"data-cui":"pane"},a),{children:i}))}})},69494:(e,t,r)=>{r.d(t,{D:()=>n,x:()=>a});var n={className:"text-white"},a={className:"text-current"}},72748:(e,t,r)=>{r.d(t,{r:()=>p});var n=r(85468),a=r(81463),i=r(62839),s=r(85477),o=r(29189),l=r(50785),c=r(2198),u=r(46119),d=r(74497);function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,{enabled:r=!0}=e,p=(0,i._)(e,["enabled"]),{data:f}=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return(0,o.useQuery)((0,a._)({queryKey:["privy","token"],queryFn:()=>(0,n._)(function*(){var e;return null!=(e=yield(0,l.Ne)())?e:null})()},e),t)}(),{data:h}=(0,d.M)({},t),v=(0,c.F)(f||"");return(0,o.useQuery)((0,a._)({queryKey:u.B.profile(f),queryFn:()=>(0,n._)(function*(){var e=h._public_links["my-learn-profile"].href,t=[e,"v=".concat(v)].join(e.includes("?")?"&":"?"),r=yield(0,s.A)(fetch,t,{method:"GET",headers:{accept:"text/plain"},credentials:"include"},{feature:"learn_profile",operation:"fetch_profile"});return r.ok?r.text():Promise.reject()})(),enabled:!!h},p))}},74497:(e,t,r)=>{r.d(t,{M:()=>l});var n=r(81463),a=r(29189),i=r(46119),s=r(58967);let o=(0,s.createServerReference)("4039e964868c04db8fa6349795295cc440990c5fb2",s.callServer,void 0,s.findSourceMapURL,"fetchEntrypoint");function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return(0,a.useQuery)((0,n._)({queryKey:i.B.entrypoint(),queryFn:e=>{var{}=e;return o({})},staleTime:1/0},e),t)}},74777:(e,t,r)=>{r.d(t,{h:()=>a});var n=r(29152);function a(e){var{required:t,displayAs:r}=e;if("symbol"===r)if(t)return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"*"}),(0,n.jsx)("span",{className:"sr-only",children:"(required)"})]});else return null;return t?"(required)":"(optional)"}},76006:(e,t,r)=>{r.d(t,{G:()=>h});var n=r(81463),a=r(97320),i=r(29152),s=r(62839),o=r(13356);function l(e){var{label:t,display:r,className:a,state:l="unchecked",hidden:c}=e,u=(0,s._)(e,["label","display","className","state","hidden"]),d=(0,o.useId)(),p=(0,o.useId)();return(0,i.jsxs)("div",{hidden:c,className:"ns-checkbox --".concat(r," --passive ").concat(null!=a?a:""),children:[(0,i.jsx)("div",(0,n._)({id:d,className:"ns-input","aria-labelledby":p,"data-state":l},u)),(0,i.jsxs)("label",{id:p,className:"ns-input__label",children:[t," "]})]})}var c=r(18144),u=r(42458),d=["h1","ns-checkboxes","ns-code-block","ns-fill-in-the-blank","ns-multiple-choice","ns-url-input","input","button","ns-code-exercise","ns-playground","ns-image-gallery","label","select","textarea"];
1function p(e){return f(e)||3===e.nodeType}function f(e){return 1===e.nodeType&&"tagName"in e}var h=(0,o.memo)(function(e){var t,{html:r,exerciseId:s,stateFor:h}=e,v={replace(e){var t=e.tagName;if(t){if(d.includes(t))return(0,i.jsx)(i.Fragment,{});var r=!1;if((e.attribs.class||e.attribs.style)&&(delete e.attribs.name,delete e.attribs.class,e.attribs.class="--has-styling",r=!0),"ns-admonition"===t)return e.attribs.class=[e.attribs.class,"ns-admonition"].filter(Boolean).join(" "),(0,o.createElement)("ns-admonition",(0,c.$5)(e.attribs),(0,c.zd)(e.children.filter(p),v));if("img"===t){var m,b=e.attribs.src,g=b.match(/\/static\/learn\/(.+)$/);g&&(b="/learn/assets/".concat(g[1]));var x=e.attribs.alt,y=!!g,_=b.startsWith("https://")||b.startsWith("http://"),w=!b;return(0,o.createElement)("img",(0,a._)((0,n._)({},(0,c.$5)(e.attribs)),{src:b,loading:"lazy",alt:null!=(m=e.attribs.alt)?m:"",className:"ns-image ".concat(x?"":"--missing-alt"," ").concat(y?"--static-src":_?"--remote-src":w?"--missing-src":"")}))}if("pre"===t){var k=e.children.filter(e=>"tagName"in e&&"code"===e.tagName);if(1===k.length){var j=k[0];return e.attribs.language&&!j.attribs.language&&(j.attribs.language=e.attribs.language,j.attribs.class=[j.attribs.class,"--missing-language"].filter(Boolean).join(" ")),(0,o.createElement)(o.Suspense,{},(0,o.createElement)(u.z,(0,c.$5)(j.attribs),String((0,c.zd)(j.children,v))))}if(1===e.children.filter(e=>"tagName"in e&&"samp"===e.tagName).length){var A=e.children.filter(p);return e.attribs.class=[e.attribs.class,"ns-output","--block"].filter(Boolean).join(" "),(0,o.createElement)(t,(0,c.$5)(e.attribs),A.length?(0,c.zd)(A,v):void 0)}}if("code"===t){if(e.parentNode&&"tagName"in e.parentNode&&"pre"===e.parentNode.tagName)return;e.attribs.class=[e.attribs.class,"ns-code","--inline"].filter(Boolean).join(" ");var C=e.children.filter(p);return(0,o.createElement)(t,(0,c.$5)(e.attribs),C.length?(0,c.zd)(C,v):void 0)}if("samp"===t||"output"===t){if(e.parentNode&&"tagName"in e.parentNode&&"pre"===e.parentNode.tagName)return;e.attribs.class=[e.attribs.class,"ns-output","--inline"].filter(Boolean).join(" ");var N=e.children.filter(p);return(0,o.createElement)(t,(0,c.$5)(e.attribs),N.length?(0,c.zd)(N,v):void 0)}if("table"===t){var E=e.children.filter(p);return(0,o.createElement)("ns-table",(0,c.$5)({class:"ns-table"}),(0,o.createElement)(t,(0,c.$5)(e.attribs),E.length?(0,c.zd)(E,v):void 0))}if("ol"===t)return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("h3",{className:"ns-code-exercise__tasks-header",children:"Tasks to complete:"},"tasks-header"),(0,o.createElement)(t,(0,n._)({key:"tasks-list",className:"ns-code-exercise__tasks"},(0,c.$5)(e.attribs)),e.childNodes.filter(f).map((e,t)=>(0,i.jsx)("li",{className:"ns-code-exercise__tasks-task","data-task":t+1,children:(0,i.jsx)(l,{label:(0,c.zd)(e.childNodes.filter(p),v),name:"exercise-".concat(s,"-task-[").
1concat(t+1,"]"),display:"small",state:h(t+1)})},"item-".concat(t))))]});if(r){var S=e.children.filter(p);return(0,o.createElement)(t,(0,c.$5)(e.attribs),S.length?(0,c.zd)(S,v):void 0)}}}};return(0,c.Ay)(null!=r?r:(t=s,'<div class="min-h-8 outline-double outline-8 outline-purple-600">\n    <h3>{id}</h3>\n    <p class="text-red-800">No content in HTML, check instructions document.</p>\n  </div>'.replace("{id}",t)),v)})},77655:(e,t,r)=>{r.d(t,{N:()=>d});var n=r(81463),a=r(97320),i=r(62839),s=r(29152),o=r(55074),l=r(84213),c=r(13356),u=r(74777);function d(e){var{type:t="text",className:r,error:d,label:f,labelVisuallyHidden:h=!1,description:v,display:m,required:b,requiredVisualType:g="symbol","aria-describedby":x,leading:y,trailing:_,PrefixIcon:w,disabled:k,hidden:j,autoSubmit:A="Enter",onSubmit:C,onBlur:N,onKeyDown:E}=e,S=(0,i._)(e,["type","className","error","label","labelVisuallyHidden","description","display","required","requiredVisualType","aria-describedby","leading","trailing","PrefixIcon","disabled","hidden","autoSubmit","onSubmit","onBlur","onKeyDown"]),R=(0,c.useMemo)(()=>{var e=null!=t?t:"text";return"search"===e||"url"===e||"tel"===e||"email"===e?e:"text"},[t]),D=(0,o.b)(d),L=(0,c.useId)(),P=(0,c.useId)(),T=(0,c.useId)(),F=(0,c.useId)(),M=(0,c.useCallback)(e=>{N&&N(e),!e.isPropagationStopped()&&"blur"===A&&C&&C(e)},[N,A,C]),I=(0,c.useCallback)(e=>{E&&E(e),!e.isPropagationStopped()&&"Enter"===A&&C&&"Enter"===e.key&&C(e)},[E,A,C]);return(0,s.jsxs)("div",{hidden:j,className:"ns-input__field --text-field --".concat(m," --").concat(t," ").concat(k?"--disabled":""," ").concat(D?"--error":""," ").concat(null!=r?r:""),children:[(0,s.jsxs)("label",{id:P,htmlFor:L,className:"ns-input__label ".concat(h?"sr-only":""),children:[f,"\xa0",(0,s.jsx)(u.h,{required:b,displayAs:g})]}),(0,s.jsxs)("div",{className:"ns-input__group",children:[y?(0,s.jsx)(p,{className:"ns-input__leading",children:y}):null,w?(0,s.jsx)(w,{className:"ns-input__icon --prefix",size:"large"===m?24:20}):null,(0,s.jsx)("input",(0,a._)((0,n._)({id:L,type:t,inputMode:R,className:"ns-input",required:b,disabled:k,"aria-labelledby":P,"aria-describedby":[v&&!D?T:void 0,x].filter(Boolean).join(" ")||void 0,"aria-invalid":D?"true":void 0,"aria-errormessage":D?F:void 0},S),{onBlur:"blur"===A?M:N,onKeyDown:"Enter"===A?I:E,onSubmit:C})),D?(0,s.jsx)(l.A,{className:"ns-input__icon --suffix stroke-error",size:"large"===m?20:"medium"===m?18:16}):null,_?(0,s.jsx)(p,{className:"ns-input__trailing",children:_}):null]}),D?(0,s.jsx)("div",{id:F,className:"ns-input__error",children:D}):null,!D&&v?(0,s.jsx)("div",{id:T,className:"ns-input__description",children:v}):null]})}function p(e){var{className:t,children:r}=e;return(0,s.jsx)("div",{className:t,children:(0,s.jsx)("div",{className:"ns-input__attachment",children:r})})}},79263:(e,t,r)=>{r.d(t,{Fr:()=>o,ML:()=>s}),r(46237);var n=r(13356),a=r(2204),i=r(84025);function s(e,t,r){var i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],s=(0,a.D)(r);(0,n.useLayoutEffect)(()=>{if(e){var r=e.name,n=e=>{if("object"==typeof e.data&&e.data&&"_type"in e.data&&"event"in e.data){var{_type:r,event:n}=e.data;("*"===t||r===t.type())&&s(n,r)}},a=e=>{"object"==typeof e.data&&e.data&&"_channel"in e.data&&e.data._channel===r&&n(e)};return i&&e.addEventListener("message",n),window.addEventListener("message",a),()=>{i&&e.removeEventListener("message",n),window.removeEventListener("message",a)}}},[e,t,s,i])}function o(e,t){var r=(0,i.m)(t);return(0,n.useCallback)(t=>{if(!e)return void console.warn("[broadcast] cannot broadcast without channel");var{current:n}=r,a=e.name,i=new n(t).serialize();window.postMessage({_channel:a,_type:i._type,event:i});try{e.postMessage({_type:i._type,event:i})}catch(e){}return i},[e,r])}},81187:(e,t,r)=>{r.d(t,{P:()=>o,c:()=>l});var n=r(29152),a=r(84025),i=r(13356),s=(0,i.createContext)({tabs:[],activeTab:"",activateTab:()=>{}});function o(){return(0,i.useContext)(s).activeTab}function l(e){var{tabs:t,tabClassName:r="",tabPanelClassName:o="",tabListClassName:l="",renderTab:c,renderTabPanel:u}=e,d=(0,i.useRef)(null),[p,f]=(0,i.useState)(()=>t[0].tab),h=(0,i.useCallback)(e=>{f(e)},[]);(0,i.useEffect)(()=>{f(e=>{var r;return t.find(t=>t.tab===e)?e:null==(r=t.filter(e=>!("invisible"in e)||!e.invisible)[0])?void 0:r.tab})},[t]);var v=(0,a.m)(t),m=(0,i.useId)();return(0,i.useLayoutEffect)(()=>{var e=d.current;if(e)return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t);function t(e){var t=v.current.filter(e=>!("invisible"in e)||!e.invisible);if(!(t.length<=1))switch(e.key){case"ArrowLeft":return e.preventDefault(),h(e=>{var r=t.findIndex(t=>t.tab===e);return -1===r?t[0].tab:t[(r-1+t.length)%t.length].tab});case"ArrowRight":return e.preventDefault(),h(e=>{var r=t.findIndex(t=>t.tab===e);return -1===r?t[0].tab:t[(r+1)%t.length].tab});case"Home":return e.preventDefault(),h(t[0].tab);case"End":return e.preventDefault(),h(t[t.length-1].tab)}}},[d,h]),(0,n.jsxs)(s.Provider,{value:(0,i.useMemo)(()=>({tabs:t.map(e=>{var{tab:t}=e;return t}),activeTab:p,activateTab:h}),[p,t,h]),children:[(0,n.jsx)("div",{id:[m,"tablist"].join("-"),role:"tablist",className:l,ref:d,children:t.filter(e=>!("invisible"in e)||!e.invisible).map(e=>(0,n.jsx)("button",{id:[m,"tab",e.tab].join("-"),role:"tab","aria-controls":[m,"tabpanel",e.tab].join("-"),type:"button",onClick:()=>h(e.tab),tabIndex:p===e.tab?0:-1,className:"".concat(null!=r?r:""," focusable focus-visible:ring-2 focus-visible:ring-blue-500"),children:c(e,p===e.tab)},"tab-".concat(e.tab)))}),t.map(e=>(0,n.jsx)("div",{id:[m,"tabpanel",e.tab].join("-"),role:"tabpanel","aria-labelledby":[m,"tab",e.tab].join("-"),hidden:p!==e.tab||!!("invisible"in e&&e.
1invisible),tabIndex:p===e.tab?0:void 0,className:"".concat(null!=o?o:""," focusable focus:outline-none"),children:u(e)},"tabpanel-".concat(e.tab)))]})}},82452:(e,t,r)=>{r.d(t,{P:()=>o});var n=r(29152),a=r(1850);r(99041);var i=(0,a.default)(()=>Promise.all([r.e(40532),r.e(78679)]).then(r.t.bind(r,78679,23)).then(e=>e.BlockMath),{loadableGenerated:{webpack:()=>[78679]},ssr:!1,loading:()=>(0,n.jsx)("div",{className:"h-6"})}),s=(0,a.default)(()=>Promise.all([r.e(40532),r.e(78679)]).then(r.t.bind(r,78679,23)).then(e=>e.InlineMath),{loadableGenerated:{webpack:()=>[78679]},ssr:!1,loading:()=>(0,n.jsx)("span",{})});function o(e){var{children:t,block:r=!1}=e;return r?(0,n.jsx)(i,{math:t}):(0,n.jsx)(s,{math:t})}},84025:(e,t,r)=>{r.d(t,{m:()=>a});var n=r(13356);function a(e){var t=(0,n.useRef)(null);return null===t.current&&null!==e&&(t.current=e),(0,n.useLayoutEffect)(()=>{null!==e&&(t.current=e)},[e]),t}},85477:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(85468),a=r(81463),i=r(97320),s=r(87753),o=r(57453),l=r(81973),c=new Set([401,403]);function u(e){return e.reason instanceof DOMException?e.reason:new DOMException(String(e.reason),"AbortError")}function d(e,t,r){return(0,n._)(function*(e,t,r){var n,d,p,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},h=yield e(t,r);if(!c.has(h.status))return h;var v=(null==r?void 0:r.signal)instanceof AbortSignal?r.signal:void 0;if(null==v?void 0:v.aborted)throw u(v);var m={feature:null!=(n=f.feature)?n:"auth_refresh",operation:null!=(d=f.operation)?d:"fetch",method:null!=(p=null==r?void 0:r.method)?p:"GET",status:h.status};o.v.warn("Request not authorized; refreshing auth token before retry",(0,i._)((0,a._)({},m),{event:"auth_refresh_retry_started"}));var b=!1;try{b=(yield(0,s.X)())!==null}catch(e){return o.v.error("Auth access token lookup failed before request retry",e,(0,i._)((0,a._)({},m),{event:"auth_refresh_retry_access_token_lookup_failed"})),h}if(!b)return o.v.warn("Auth token refresh unavailable because session is missing",(0,i._)((0,a._)({},m),{event:"auth_refresh_retry_session_missing"})),h;var g=!1;try{g=yield(0,l.ensureAccessTokenSingleFlight)(s.X,void 0,{force:!0})}catch(e){return o.v.error("Auth token refresh failed before request retry",e,(0,i._)((0,a._)({},m),{event:"auth_refresh_retry_refresh_failed"})),h}if(!g)return o.v.warn("Auth token refresh did not produce a usable session",(0,i._)((0,a._)({},m),{event:"auth_refresh_retry_unavailable"})),h;if(null==v?void 0:v.aborted)throw u(v);var x=yield e(t,r);return c.has(x.status)&&o.v.warn("Request still not authorized after auth token refresh",(0,i._)((0,a._)({},m),{event:"auth_refresh_retry_still_unauthorized",retryStatus:x.status})),x}).apply(this,arguments)}},88328:(e,t,r)=>{r.d(t,{a:()=>o});var n=r(29152),a=r(13356),i=r(58967);let s=(0,i.createServerReference)("7fe987ec206c7da2eab3936b022bcbe832e48de8ea",i.callServer,void 0,i.findSourceMapURL,"highlight");function o(e){var{children:t,language:r,startAt:i,"start-at":o=i,highlighted:l}=e,[c,u]=(0,a.useState)();(0,a.useLayoutEffect)(()=>{if(t&&!l){var e=!0;return s(t,null!=r?r:"text").then(t=>{e&&u(t)}),()=>{e=!1}}},[r,t,l]);var d=!!(c&&!l);return(0,n.jsxs)("react-ns-code-block",{className:"ns-code-block",style:{"--start-at":null!=o?o:"0"},children:[(0,n.jsx)("span",{className:"ns-code-block__language",children:r?"".concat(r):"(detect)"}),(0,n.jsxs)("div",{className:"ns-code-block__content",children:[(0,n.jsx)("div",{className:"ns-code-block__spacer",children:(0,n.jsx)("div",{})}),(0,n.jsxs)("div",{className:"ns-code-block__inner",children:[(0,n.jsx)("div",{className:"ns-code-block__line-number-placeholder",hidden:d||l}),l?t:(0,n.jsx)("div",{className:"ns-code-block__code ".concat(d?"":"whitespace-pre"),children:null!=c?c:t})]}),(0,n.jsx)("div",{className:"ns-code-block__spacer",children:(0,n.jsx)("div",{})})]})]})}},94450:(e,t,r)=>{function n(e){return"exercise"===e.type}function a(e){return"sub-topic"===e.type}function i(e){return"topic"===e.type}function s(e){return"position"===e.type}r.d(t,{UG:()=>a,dr:()=>n,i:()=>s,sY:()=>i})},95326:(e,t,r)=>{r.d(t,{B:()=>ec,M:()=>el});var n=r(85468),a=r(81463),i=r(97320),s=r(29152),o=r(2204),l=r(84025),c=r(19451),u=r(68485),d=r(53755),p=r(58494),f=r(29189),h=r(13356),v=r(54044),m=r(52915),b=r(33238),g=r(71089),x=r(25391),y=r(23277),_=r(9267),w=r(72767),k={fontSize:"14px",fontFamily:"JetBrains Mono, Consolas, monospace",lineHeight:"1.6"},j={insertedTextDecoration:"none",deletedTextDecoration:"line-through",insertedLinePadding:"1px 3px",borderRadious:"3px"},A={border:"none",paddingRight:"8px",fontSize:"0.9em",fontWeight:"500",lineHeight:"1.78"},C={border:"none",borderRadius:"4px",padding:"2px 10px"},N={borderRadius:"2px"},E={borderRadius:"4px",padding:"0 5px",margin:"0 2px"},S={width:"12px",height:"12px",borderRadius:"6px"},R={borderRadius:"4px",padding:"2px 6px"},D={borderRadius:"4px",borderRadiusSelected:"3px",lineHeight:"1.3",padding:"4px 8px",paddingRight:"8px"},L="#ffffff",P="#24292e",T="#BBDFFF",F="#6e7781",M="#FCFCFC",I="#6a737d",B="#6f42c1",q="#005cc5",z="#d73a49",W="#032f62",U="#22863a",O="#e36209",H="#e1e4e8",V="#cb2431",$="#f8f9fa",G="#b08800",K="#79b8ff40",Q="#0969da",X="#e6ffec80",J="#ffebe980",Y="#0f6d31",Z="#cf222e",ee=d.Lz.theme({"&":{color:P,backgroundColor:L,fontSize:k.fontSize,fontFamily:k.fontFamily},".cm-content":{caretColor:P,lineHeight:k.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:P,borderLeftWidth:"2px"},".cm-fat-cursor":{backgroundColor:"".concat(P,"99"),color:L},"&.cm-focused > .cm-scroller >
1 .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:T,color:P},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:"#daebff",outline:"1px solid ".concat(q),color:P,borderRadius:R.borderRadius,"& span":{color:P}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#79b8ff",color:L,padding:R.padding,"& span":{color:L}},".cm-search.cm-panel.cm-textfield":{color:P,borderRadius:R.borderRadius,padding:R.padding},".cm-panels":{backgroundColor:M,color:F,borderRadius:"0 0 4px 4px"},".cm-panels.cm-panels-top":{borderBottom:"1px solid ".concat(H)},".cm-panels.cm-panels-bottom":{borderTop:"1px solid ".concat(H)},".cm-panel button":{backgroundColor:L,color:P,border:C.border,borderRadius:C.borderRadius,padding:C.padding},".cm-panel button:hover":{backgroundColor:"#f5f5f5"},".cm-activeLine":{backgroundColor:"#BBDFFF20",borderRadius:"2px",zIndex:1},".cm-gutters":{backgroundColor:M,color:"#70707B",border:A.border,borderRight:"1px solid ".concat(H),paddingRight:A.paddingRight},".cm-activeLineGutter":{backgroundColor:"#f1f8ff",color:P,fontWeight:A.fontWeight},".cm-lineNumbers":{fontSize:A.fontSize,lineHeight:A.lineHeight},".cm-foldGutter":{fontSize:A.fontSize,lineHeight:A.lineHeight},".cm-foldGutter .cm-gutterElement":{color:F,cursor:"pointer"},".cm-foldGutter .cm-gutterElement:hover":{color:P},".cm-insertedLine":{textDecoration:j.insertedTextDecoration,backgroundColor:X,color:Y,padding:j.insertedLinePadding,borderRadius:j.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:j.insertedTextDecoration,backgroundColor:"".concat(X," !important"),color:Y,padding:j.insertedLinePadding,borderRadius:j.borderRadious,border:"1px solid ".concat(Y,"30")},"ins.cm-insertedLine .cm-changedText":{background:"transparent !important"},".cm-deletedLine":{textDecoration:j.deletedTextDecoration,backgroundColor:J,color:Z,padding:j.insertedLinePadding,borderRadius:j.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:j.deletedTextDecoration,backgroundColor:"".concat(J," !important"),color:Z,padding:j.insertedLinePadding,borderRadius:j.borderRadious,border:"1px solid ".concat(Z,"30")},"del .cm-deletedText, del .cm-changedText":{background:"transparent !important"},".cm-tooltip":{backgroundColor:$,border:"1px solid ".concat(H),borderRadius:D.borderRadius,padding:D.padding,boxShadow:"0 1px 5px rgba(0, 0, 0, 0.1)"},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:$,border:"none"},"& > ul > li":{padding:D.padding,lineHeight:D.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:"#0366d630",color:P,borderRadius:D.borderRadiusSelected},"& > ul > li:hover":{backgroundColor:"#0366d615"},"& > ul > li > span.cm-completionIcon":{color:F,paddingRight:D.paddingRight},"& > ul > li > span.cm-completionDetail":{color:F,fontStyle:"italic"}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:$,borderBottomColor:$},".cm-diagnostic":{"&-error":{borderLeft:"3px solid ".concat(V)},"&-warning":{borderLeft:"3px solid ".concat(G)},"&-info":{borderLeft:"3px solid ".concat(Q)}},".cm-lintPoint-error":{borderBottom:"2px wavy ".concat(V)},".cm-lintPoint-warning":{borderBottom:"2px wavy ".concat(G)},".cm-matchingBracket":{backgroundColor:"#e8f0fe",outline:"1px solid ".concat("#0366d6","80"),borderRadius:N.borderRadius},".cm-nonmatchingBracket":{backgroundColor:"#ffeef080",outline:"1px solid ".concat(V),borderRadius:N.borderRadius},".cm-selectionMatch":{backgroundColor:K,outline:"1px solid ".concat(T,"50"),borderRadius:N.borderRadius},".cm-foldPlaceholder":{backgroundColor:K,color:F,border:"1px dotted ".concat(H,"70"),borderRadius:E.borderRadius,padding:E.padding,margin:E.margin},"&.cm-focused":{outline:"none",boxShadow:"0 0 0 2px ".concat(L,", 0 0 0 3px ").concat(Q,"40")},"& .cm-scroller::-webkit-scrollbar":{width:S.width,height:S.height},"& .cm-scroller::-webkit-scrollbar-track":{background:H},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:P,borderRadius:S.borderRadius,border:"3px solid ".concat(H)},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:I},".cm-ghostText":{opacity:"0.5",color:"#959da5"}},{dark:!1}
1),et=x.cr.define([{tag:w._A.keyword,color:z,fontWeight:"bold"},{tag:w._A.controlKeyword,color:z,fontWeight:"bold"},{tag:w._A.moduleKeyword,color:z,fontWeight:"bold"},{tag:[w._A.name,w._A.deleted,w._A.character,w._A.macroName],color:q},{tag:[w._A.variableName],color:q},{tag:[w._A.propertyName],color:B,fontStyle:"normal"},{tag:[w._A.typeName],color:z},{tag:[w._A.className],color:B,fontStyle:"italic"},{tag:[w._A.namespace],color:q,fontStyle:"italic"},{tag:[w._A.operator,w._A.operatorKeyword],color:P},{tag:[w._A.bracket],color:I},{tag:[w._A.brace],color:I},{tag:[w._A.punctuation],color:I},{tag:[w._A.function(w._A.variableName),w._A.labelName],color:U},{tag:[w._A.definition(w._A.variableName)],color:q},{tag:w._A.number,color:O},{tag:w._A.changed,color:O},{tag:w._A.annotation,color:V,fontStyle:"italic"},{tag:w._A.modifier,color:O,fontStyle:"italic"},{tag:w._A.self,color:O},{tag:[w._A.color,w._A.constant(w._A.name),w._A.standard(w._A.name)],color:O},{tag:[w._A.atom,w._A.bool,w._A.special(w._A.variableName)],color:O},{tag:[w._A.processingInstruction,w._A.inserted],color:U},{tag:[w._A.special(w._A.string),w._A.regexp],color:W},{tag:w._A.string,color:W},{tag:w._A.definition(w._A.typeName),color:z,fontWeight:"bold"},{tag:w._A.meta,color:I},{tag:w._A.comment,fontStyle:"italic",color:I},{tag:w._A.docComment,fontStyle:"italic",color:I},{tag:[w._A.tagName],color:"#116329"},{tag:[w._A.attributeName],color:B},{tag:[w._A.heading],fontWeight:"bold",color:q},{tag:[w._A.strong],fontWeight:"bold",color:q},{tag:[w._A.emphasis],fontStyle:"italic",color:W},{tag:[w._A.link],color:"#8250df",fontWeight:"500",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[w._A.url],color:Q,textDecoration:"underline",textUnderlineOffset:"2px"},{tag:[w._A.invalid],color:P,textDecoration:"underline wavy",borderBottom:"1px wavy ".concat(V)},{tag:[w._A.strikethrough],color:V,textDecoration:"line-through"},{tag:w._A.constant(w._A.name),color:O},{tag:w._A.deleted,color:V},{tag:w._A.squareBracket,color:I},{tag:w._A.angleBracket,color:I},{tag:w._A.monospace,color:P},{tag:[w._A.contentSeparator],color:q},{tag:w._A.quote,color:I}]),er=[ee,(0,x.y9)(et)],en=r(55906),ea=r(81187),ei=r(53988),es={html:()=>(0,n._)(function*(){return(0,c.qy)()})(),markdown:()=>(0,n._)(function*(){return(0,c.qy)()})(),javascript:()=>Promise.resolve().then(r.bind(r,96194)).then(e=>{var{javascript:t}=e,r=t();return es.javascript=()=>Promise.resolve(r),r}),jsx:()=>Promise.resolve().then(r.bind(r,96194)).then(e=>{var{javascript:t}=e,r=t({jsx:!0});return es.jsx=()=>Promise.resolve(r),r}),typescript:()=>Promise.resolve().then(r.bind(r,96194)).then(e=>{var{javascript:t}=e,r=t({typescript:!0});return es.typescript=()=>Promise.resolve(r),r}),tsx:()=>Promise.resolve().then(r.bind(r,96194)).then(e=>{var{javascript:t}=e,r=t({typescript:!0,jsx:!0});return es.tsx=()=>Promise.resolve(r),r}),css:()=>Promise.resolve().then(r.bind(r,29289)).then(e=>{var{css:t}=e,r=t();return es.css=()=>Promise.resolve(r),r}),python:()=>r.e(46867).then(r.bind(r,46867)).then(e=>{var{python:t}=e,r=t();return es.python=()=>Promise.resolve(r),r}),json:()=>r.e(51712).then(r.bind(r,51712)).then(e=>{var{json:t}=e,r=t();return Array.isArray(r.extension)&&(r.extension=r.extension.filter(e=>!Array.isArray(e)||e.length>0)),es.json=()=>Promise.resolve(r),r})},eo=()=>{};function el(e){var{fileUrl:t,fileType:o,fileContentFallback:c,renderAction:u,retrieveOnMount:d=!0,persistOnChange:b=!1,className:g}=e,x=(0,m.WR)(),y=(0,p.useQueryClient)(),_=(0,v.Av)(),w=(0,v.Md)(),[k,j]=(0,h.useReducer)(e=>e+1,0),A=(0,l.m)(d),C=(0,l.m)(b),{data:N,isPending:E}=(0,f.useQuery)({queryKey:[x,t],queryFn:e=>{var{signal:r}=e;return(0,n._)(function*(){if(!t||!A.current)return{binary:!1,contentType:o||"text/plain",contents:c||""};var e=yield _(t,{accepts:[{mediaType:o||"*/*"}],signal:r}).then(e=>{if(e)return e}).catch(()=>{});return e||{binary:!1,contentType:o||"text/plain",contents:c||""}})()},refetchOnWindowFocus:!1,refetchOnReconnect:!1}),S=(0,ea.P)(),R=(0,ei.SX)(),D=(0,l.m)(null!=N&&N),L=(0,v.d0)(),P=(0,h.useCallback)(e=>{var r=D.current,n={contents:e,contentType:r?r.contentType:o||"text/plain",binary:!!r&&r.binary};y.setQueryData([x,t],n),L((0,i._)((0,a._)({},n),{url:t})),C.current&&w(t,n)},[D,o,y,x,t,L,C,w]),T=N&&!N.binary?N.contents:c||"";return((0,en.Vv)("*",e=>{var{action:t,filter:a}=e;if((":active"!==a||S===R)&&("*"===a||":active"===a||a===R))switch(t){case"reset":P(null!=c?c:""),j();return;case"format":(0,n._)(function*(){var e=D.current&&D.current.contentType;if(e){var t=yield Promise.all([r.e(31433),r.e(61015)]).then(r.bind(r,61015)).then(e=>{var{format:t}=e;return t}),n=el.parserFor(e);if(n)return t(T,{parser:n})}return T})().then(e=>{P(e),j()})}}),E)?(0,s.jsx)("div",{className:"".concat(null!=g?g:""," flex items-center justify-center"),children:(0,s.jsx)("p",{className:"text-sm text-opacity-70",children:"Retrieving..."})}):(0,s.jsx)("div",{className:null!=g?g:"",children:u({editorKey:"mount-editor-".concat(k),initialContent:T,onChanged:P})},"mount-".concat(k))}el.parserFor=function(e){switch(e){case"application/javascript":case"text/html":case"text/css":case"application/json":return"application/javascript"===e?"typescript":e.split("/").pop();case"text/jsx":case"text/tsx":case"text/typescript-jsx":case"application/typerscript":return"typescript";default:return!1}},el.fileTypeOf=function(e){switch(e){case"html":return"text/html";case"jsx":return"text/jsx";case"javascript":return"application/javascript";
1case"tsx":return"text/typescript-jsx";case"typescript":return"application/typescript";case"css":return"text/css";case"python":return"text/x-python";case"json":return"application/json";default:return"text/plain"}};var ec=function(e){var{className:t="",language:r,initialDocument:n,onChanged:a,readonly:i,invisible:l}=e,p=(0,h.useRef)(null),f=(0,h.useRef)(n),v=(0,h.useRef)(null),m=(0,h.useRef)(void 0),w=(0,o.D)(null!=a?a:eo),k=(0,h.useRef)(null);null===k.current&&(k.current=new u.xx);var j=(0,h.useRef)(null);return null===j.current&&(j.current=new u.xx),(0,h.useEffect)(()=>{if(p.current){var e,t=d.Lz.updateListener.of(e=>{if(e.docChanged){var t=e.state.doc.toString();clearTimeout(m.current),m.current=setTimeout(()=>w(t),500)}}),r=u.$t.create({doc:null!=(e=f.current)?e:"",extensions:[(0,d.$K)(),(0,x.Lv)(),(0,d.N$)(),(0,g.b6)(),(0,d.VH)(),(0,d.A)(),u.$t.allowMultipleSelections.of(!0),(0,x.WD)(),(0,x.y9)(x.Zt),(0,x.SG)(),(0,b.wm)(),(0,b.yU)(),(0,d.D4)(),(0,d.HJ)(),(0,d.dz)(),(0,d.Wu)(),(0,_.gN)(),d.w4.of([...b.Bc,...g.pw,..._.Eo,...g.cL,...x.f7,...b.OO,...y.$w])].concat([k.current.of((0,c.qy)()),er,t,j.current.of(u.$t.readOnly.of(!1))])}),n=new d.Lz({state:r,parent:p.current});return v.current=n,requestAnimationFrame(()=>{var e;n.requestMeasure(),w(null!=(e=f.current)?e:"")}),()=>{f.current=n.state.doc.toString(),n.destroy()}}},[w]),(0,h.useEffect)(()=>{var e=!0;return es[r]().then(t=>{var r=v.current,n=k.current;e&&r&&n&&r.dispatch({effects:n.reconfigure(t)})}).catch(e=>console.error("[code editor] failed to fetch language support ".concat(r),e)),()=>{e=!1}},[r]),(0,h.useEffect)(()=>{var e=v.current,t=j.current;e&&t&&e.dispatch({effects:t.reconfigure(u.$t.readOnly.of(null!=i&&i))})},[i]),(0,s.jsx)("div",{ref:p,className:t,hidden:l})}},97675:(e,t,r)=>{r.d(t,{r:()=>c});var n=r(81463),a=r(29189),i=r(46119),s=r(58967);let o=(0,s.createServerReference)("70a9554e8073effeac2d566fde8a77a7bb9f74398f",s.callServer,void 0,s.findSourceMapURL,"fetchPositionBySlug");var l=r(74497);function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,{data:s}=(0,l.M)({enabled:!!(e&&("boolean"!=typeof t.enabled||t.enabled))},r);return(0,a.useQuery)((0,n._)({queryKey:i.B.position(e),queryFn:t=>{var{}=t;return o(s,e,{})},enabled:!!(e&&("boolean"!=typeof t.enabled||t.enabled))},t),r)}},99329:(e,t,r)=>{r.d(t,{FA:()=>a,ZO:()=>s});var n=[{arabic:1e3,roman:"M"},{arabic:900,roman:"CM"},{arabic:500,roman:"D"},{arabic:400,roman:"CD"},{arabic:100,roman:"C"},{arabic:90,roman:"XC"},{arabic:50,roman:"L"},{arabic:40,roman:"XL"},{arabic:10,roman:"X"},{arabic:9,roman:"IX"},{arabic:5,roman:"V"},{arabic:4,roman:"IV"},{arabic:1,roman:"I"}];function a(e){var t="";return n.forEach(r=>{for(;e>=r.arabic;)t+=r.roman,e-=r.arabic}),t}var i=["th","st","nd","rd"];function s(e){var t=e%100;return e+(i[(t-20)%10]||i[t]||i[0])}}}]);
2//# sourceMappingURL=28569-c571b70998852f27.js.map

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.