Skip to main content
Glama
e58a7f8f-9475e998f9e8dc00.js127 kB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[193],{5776:(e,t,n)=>{n.d(t,{OZ:()=>rN});var r,o,i,s,a,c,l,d,u,p,f,m,h,v,g,b,x=n(5155),y=n(2115),w=n(2979),j=n(8497),$=n(7192),C=n(6084),k=n(3284),S=n(7454),N=n(802),O=n(1245),E=n(3603),A=n(7288),M=n(61),L=n(943),F=n(7175),R=n(8520),I=n(9105),D=n(9322),T=n(9345),H=n(9457),B=function(){return(B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function P(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function z(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function _(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function U(e,t,n){if(n||2==arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var W=function(e){return(0,x.jsx)("svg",B({fill:"currentColor",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg"},e))},Z=function(){return(0,x.jsxs)(W,{viewBox:"0 0 48 48",children:[(0,x.jsx)("title",{children:"Sign in"}),(0,x.jsx)("path",{d:"M9 42q-1.2 0-2.1-.9Q6 40.2 6 39V9q0-1.2.9-2.1Q7.8 6 9 6h14.55v3H9v30h14.55v3Zm24.3-9.25-2.15-2.15 5.1-5.1h-17.5v-3h17.4l-5.1-5.1 2.15-2.15 8.8 8.8Z"})]})},J=function(){return(0,x.jsxs)(W,{viewBox:"0 0 48 48",children:[(0,x.jsx)("title",{children:"Sign out"}),(0,x.jsx)("path",{d:"M9 42q-1.2 0-2.1-.9Q6 40.2 6 39V9q0-1.2.9-2.1Q7.8 6 9 6h14.55v3H9v30h14.55v3Zm24.3-9.25-2.15-2.15 5.1-5.1h-17.5v-3h17.4l-5.1-5.1 2.15-2.15 8.8 8.8Z"})]})},V=function(){return(0,x.jsxs)(W,{fill:"none",stroke:"currentColor",children:[(0,x.jsx)("title",{children:"Restart script"}),(0,x.jsx)("path",{d:"M8 2C4.68629 2 2 4.68629 2 8C2 10.0946 3.07333 11.9385 4.7 13.0118",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M14.0005 7.9998C14.0005 5.82095 12.8391 3.91335 11.1016 2.8623",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M14.0003 2.3335H11.167C10.8908 2.3335 10.667 2.55735 10.667 2.8335V5.66683",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M1.99967 13.6665L4.83301 13.6665C5.10915 13.6665 5.33301 13.4426 5.33301 13.1665L5.33301 10.3332",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M10 10L12 12L10 14",strokeLinecap:"round",strokeLinejoin:"round"}),(0,x.jsx)("path",{d:"M14.667 14L12.667 14",strokeLinecap:"round",strokeLinejoin:"round"})]})},Y=function(){return(0,x.jsxs)(W,{children:[(0,x.jsx)("title",{children:"Run sandbox"}),(0,x.jsx)("path",{d:"M11.0792 8.1078C11.2793 8.25007 11.27 8.55012 11.0616 8.67981L6.02535 11.8135C5.79638 11.956 5.5 11.7913 5.5 11.5216L5.5 8.40703L5.5 4.80661C5.5 4.52735 5.81537 4.36463 6.04296 4.52647L11.0792 8.1078Z"})]})},q=function(){return(0,x.jsxs)(W,{children:[(0,x.jsx)("title",{children:"Click to go back"}),(0,x.jsx)("path",{d:"M9.64645 12.3536C9.84171 12.5488 10.1583 12.5488 10.3536 12.3536C10.5488 12.1583 10.5488 11.8417 10.3536 11.6464L9.64645 12.3536ZM10.3536 4.35355C10.5488 4.15829 10.5488 3.84171 10.3536 3.64644C10.1583 3.45118 9.84171 3.45118 9.64645 3.64644L10.3536 4.35355ZM6.07072 7.92929L5.71716 7.57573L6.07072 7.92929ZM10.3536 11.6464L6.42427 7.71716L5.71716 8.42426L9.64645 12.3536L10.3536 11.6464ZM6.42427 8.28284L10.3536 4.35355L9.64645 3.64644L5.71716 7.57573L6.42427 8.28284ZM6.42427 7.71716C6.58048 7.87337 6.58048 8.12663 6.42427 8.28284L5.71716 7.57573C5.48285 7.81005 5.48285 8.18995 5.71716 8.42426L6.42427 7.71716Z"})]})},G=function(){return(0,x.jsxs)(W,{children:[(0,x.jsx)("title",{children:"Click to go forward"}),(0,x.jsx)("path",{d:"M6.35355 3.64645C6.15829 3.45118 5.84171 3.45118 5.64645 3.64645C5.45118 3.84171 5.45118 4.15829 5.64645 4.35355L6.35355 3.64645ZM5.64645 11.6464C5.45118 11.8417 5.45118 12.1583 5.64645 12.3536C5.84171 12.5488 6.15829 12.5488 6.35355 12.3536L5.64645 11.6464ZM9.92929 8.07071L10.2828 8.42426L9.92929 8.07071ZM5.64645 4.35355L9.57574 8.28284L10.2828 7.57574L6.35355 3.64645L5.64645 4.35355ZM9.57574 7.71716L5.64645 11.6464L6.35355 12.3536L10.2828 8.42426L9.57574 7.71716ZM9.57574 8.28284C9.41952 8.12663 9.41953 7.87337 9.57574 7.71716L10.2828 8.42426C10.5172 8.18995 10.5172 7.81005 10.2828 7.57574L9.57574 8.28284Z"})]})},X=function(){return(0,x.jsxs)(W,{children:[(0,x.jsx)("title",{children:"Refresh preview"}),(0,x.jsx)("path",{clipRule:"evenodd",d:"M3.83325 7.99992C3.83325 5.69867 5.69853 3.83325 7.99934 3.83325C9.81246 3.83325 11.3563 4.99195 11.9285 6.61097C11.9396 6.6425 11.9536 6.67221 11.97 6.69992H8.80005C8.52391 6.69992 8.30005 6.92378 8.30005 7.19992C8.30005 7.47606 8.52391 7.69992 8.80005 7.69992H12.5667C12.8981 7.69992 13.1667 7.43129 13.1667 7.09992V3.33325C13.1667 3.05711 12.9429 2.83325 12.6667 2.83325C12.3906 2.83325 12.1667 3.05711 12.1667 3.33325V4.94608C11.2268 3.66522 9.7106 2.83325 7.99934 2.83325C5.14613 2.83325 2.83325 5.14651 2.83325 7.99992C2.83325 10.8533 5.14613 13.1666 7.99934 13.1666C9.91218 13.1666 11.5815 12.1266 12.474 10.5836C12.6123 10.3446 12.5306 10.0387 12.2915 9.90044C12.0525 9.76218 11.7466 9.84387 11.6084 10.0829C10.8873 11.3296 9.54072 12.1666 7.99934 12.1666C5.69853 12.1666 3.83325 10.3012 3.83325 7.99992Z",fillRule:"evenodd"})]})},K=function(){return(0,x.jsxs)(W,{fill:"none",stroke:"currentColor",children:[(0,x.jsx)("title",{children:"Clean"}),(0,x.jsx)("circle",{cx:"7.99998",cy:"8.00004",r:"4.66667",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M4.66669 4.66663L11.3334 11.3333"})]})},Q=function(){return(0,x.jsxs)(W,{fill:"none",stroke:"currentColor",children:[(0,x.jsx)("title",{children:"Open on CodeSandbox"}),(0,x.jsx)("path",{d:"M6.66665 3.33337H4.33331C3.78103 3.33337 3.33331 3.78109 3.33331 4.33337V11.6667C3.33331 12.219 3.78103 12.6667 4.33331 12.6667H11.6666C12.2189 12.6667 12.6666 12.219 12.6666 11.6667V9.33337",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M10 3.33337H12.5667C12.6219 3.33337 12.6667 3.37815 12.6667 3.43337V6.00004",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M7.33331 8.66668L12.5333 3.46667",strokeLinecap:"round"})]})},ee=function(){return jsxs(W,{children:[jsx("title",{children:"Directory"}),jsx("path",{d:"M12.5526 12.6667H3.66675C3.2922 12.6667 2.96575 12.4608 2.79442 12.156L3.81072 8.0908C3.92201 7.64563 4.32199 7.33333 4.78086 7.33333H13.386C14.0365 7.33333 14.5139 7.94472 14.3561 8.57587L13.5228 11.9092C13.4115 12.3544 13.0115 12.6667 12.5526 12.6667Z",fill:"currentColor"}),jsx("path",{d:"M13.3334 6.63333V6.33333C13.3334 5.78105 12.8857 5.33333 12.3334 5.33333H8.30286C8.10543 5.33333 7.91242 5.2749 7.74816 5.16538L6.25201 4.16795C6.08774 4.05844 5.89473 4 5.69731 4H3.66675C3.11446 4 2.66675 4.44772 2.66675 5L2.66675 11.6667C2.66675 12.219 3.11446 12.6667 3.66675 12.6667H12.5526C13.0115 12.6667 13.4115 12.3544 13.5228 11.9092L14.3561 8.57587C14.5139 7.94472 14.0365 7.33333 13.386 7.33333H4.78086C4.32199 7.33333 3.92201 7.64563 3.81072 8.0908L2.75008 12.3333",fill:"none",stroke:"currentColor",strokeLinecap:"round"})]})},et=function(){return jsxs(W,{children:[jsx("title",{children:"Directory"}),jsx("path",{d:"M12.3334 12.6667H3.66675C3.11446 12.6667 2.66675 12.219 2.66675 11.6667V5C2.66675 4.44772 3.11446 4 3.66675 4H5.69731C5.89473 4 6.08774 4.05844 6.25201 4.16795L7.74816 5.16538C7.91242 5.2749 8.10543 5.33333 8.30286 5.33333H12.3334C12.8857 5.33333 13.3334 5.78105 13.3334 6.33333V11.6667C13.3334 12.219 12.8857 12.6667 12.3334 12.6667Z",fill:"currentColor",stroke:"currentColor",strokeLinecap:"round"})]})},en=function(){return jsxs(W,{fill:"currentColor",children:[jsx("title",{children:"File"}),jsx("path",{clipRule:"evenodd",d:"M4.5 4.33325C4.5 4.05711 4.72386 3.83325 5 3.83325H8.16675V6.56659C8.16675 6.89795 8.43538 7.16658 8.76675 7.16658H11.5V12.3333C11.5 12.6094 11.2761 12.8333 11 12.8333H5C4.72386 12.8333 4.5 12.6094 4.5 12.3333V4.33325ZM12.5 6.67568C12.5001 6.67265 12.5001 6.66962 12.5001 6.66658C12.5001 6.66355 12.5001 6.66052 12.5 6.65749V6.41413C12.5 6.01631 12.342 5.63478 12.0607 5.35347L9.97978 3.27259C9.69848 2.99129 9.31694 2.83325 8.91912 2.83325H8.66675H5C4.17157 2.83325 3.5 3.50483 3.5 4.33325V12.3333C3.5 13.1617 4.17157 13.8333 5 13.8333H11C11.8284 13.8333 12.5 13.1617 12.5 12.3333V6.67568ZM9.16675 3.89888C9.20518 3.92078 9.24085 3.94787 9.27267 3.9797L11.3536 6.06058C11.3854 6.09243 11.4125 6.12813 11.4344 6.16658H9.16675V3.89888Z",fillRule:"evenodd"})]})},er=function(){return(0,x.jsxs)(W,{stroke:"currentColor",children:[(0,x.jsx)("title",{children:"Close file"}),(0,x.jsx)("path",{d:"M12 4L4 12",strokeLinecap:"round"}),(0,x.jsx)("path",{d:"M4 4L12 12",strokeLinecap:"round"})]})},eo=function(){return(0,x.jsxs)(W,{children:[(0,x.jsx)("title",{children:"Open browser console"}),(0,x.jsx)("path",{d:"M5.65871 3.62037C5.44905 3.44066 5.1334 3.46494 4.95368 3.6746C4.77397 3.88427 4.79825 4.19992 5.00792 4.37963L5.65871 3.62037ZM5.00792 11.6204C4.79825 11.8001 4.77397 12.1157 4.95368 12.3254C5.1334 12.5351 5.44905 12.5593 5.65871 12.3796L5.00792 11.6204ZM9.9114 7.92407L10.2368 7.54445L9.9114 7.92407ZM5.00792 4.37963L9.586 8.3037L10.2368 7.54445L5.65871 3.62037L5.00792 4.37963ZM9.586 7.6963L5.00792 11.6204L5.65871 12.3796L10.2368 8.45555L9.586 7.6963ZM9.586 8.3037C9.39976 8.14407 9.39976 7.85594 9.586 7.6963L10.2368 8.45555C10.5162 8.2161 10.5162 7.7839 10.2368 7.54445L9.586 8.3037Z"}),(0,x.jsx)("path",{d:"M10 11.5C9.72386 11.5 9.5 11.7239 9.5 12C9.5 12.2761 9.72386 12.5 10 12.5V11.5ZM14.6667 12.5C14.9428 12.5 15.1667 12.2761 15.1667 12C15.1667 11.7239 14.9428 11.5 14.6667 11.5V12.5ZM10 12.5H14.6667V11.5H10V12.5Z"})]})},ei={colors:{surface1:"#ffffff",surface2:"#EFEFEF",surface3:"#F3F3F3",disabled:"#C5C5C5",base:"#323232",clickable:"#808080",hover:"#4D4D4D",accent:"#3973E0",error:"#EA3323",errorSurface:"#FCF1F0",warning:"#6A4516",warningSurface:"#FEF2C0"},syntax:{plain:"#151515",comment:{color:"#999",fontStyle:"italic"},keyword:"#7C5AE3",tag:"#0971F1",punctuation:"#3B3B3B",definition:"#85A600",property:"#3B3B3B",static:"#3B3B3B",string:"#2E6BD0"},font:{body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'"Fira Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", Monaco, "Lucida Console", monospace',size:"13px",lineHeight:"20px"}},es={colors:{surface1:"#151515",surface2:"#252525",surface3:"#2F2F2F",disabled:"#4D4D4D",base:"#808080",clickable:"#999999",hover:"#C5C5C5",accent:"#E5E5E5",error:"#FFB4A6",errorSurface:"#690000",warning:"#E7C400",warningSurface:"#3A3000"},syntax:{plain:"#FFFFFF",comment:{color:"#757575",fontStyle:"italic"},keyword:"#77B7D7",tag:"#DFAB5C",punctuation:"#ffffff",definition:"#86D9CA",property:"#77B7D7",static:"#C64640",string:"#977CDC"},font:{body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'"Fira Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", Monaco, "Lucida Console", monospace',size:"13px",lineHeight:"20px"}},ea={light:ei,dark:es,auto:"undefined"!=typeof window&&(null==(r=null==window?void 0:window.matchMedia)?void 0:r.call(window,"(prefers-color-scheme: dark)").matches)?es:ei},ec=function(e){var t=e.lastIndexOf("/");return e.slice(t+1)},el=function(e,t){var n=("/"===e[0]?e.slice(1):e).split("/"),r=[];if(1===n.length)r.unshift(n[0]);else for(var o=0;o<t.length;o++)for(var i=t[o].split("/"),s=1;s<=n.length;s++){var a=n[n.length-s],c=i[i.length-s];if(r.length<s&&r.unshift(a),a!==c)break}return r.length<n.length&&r.unshift(".."),r.join("/")},ed=function(e){var t=0,n=0,r=0;if(e.startsWith("#")){if(e.length<7)return!0;t=parseInt(e.substr(1,2),16),n=parseInt(e.substr(3,2),16),r=parseInt(e.substr(5,2),16)}else{var o=e.replace("rgb(","").replace("rgba(","").replace(")","").split(",");if(o.length<3)return!0;t=parseInt(o[0],10),n=parseInt(o[1],10),r=parseInt(o[2],10)}return(299*t+587*n+114*r)/1e3<128},eu=0,ep=function(){return(+(Date.now().toString(10).substr(0,4)+eu++)).toString(16)},ef=(o=(0,w.GC)({prefix:"sp"})).createTheme,em=o.css,eh=(o.getCssText,o.keyframes),ev={space:Array(11).fill(" ").reduce(function(e,t,n){var r;return B(B({},e),((r={})[n+1]="".concat((n+1)*4,"px"),r))},{}),border:{radius:"4px"},layout:{height:"300px",headerHeight:"40px"},transitions:{default:"150ms ease"},zIndices:{base:"1",overlay:"2",top:"3"}},eg=function(e){var t=Object.entries(e.syntax).reduce(function(e,t){var n,r=t[0],o=t[1],i=((n={})["color-".concat(r)]=o,n);return"object"==typeof o&&(i=Object.entries(o).reduce(function(e,t){var n,o=t[0],i=t[1];return B(B({},e),((n={})["".concat(o,"-").concat(r)]=i,n))},{})),B(B({},e),i)},{});return B(B({},ev),{colors:e.colors,font:e.font,syntax:t})},eb=function(e){if(void 0===e&&(e="light"),"string"==typeof e){var t,n,r,o,i,s=ea[e];if(!s)throw Error("[sandpack-react]: invalid theme '".concat(e,"' provided."));return{theme:s,id:e,mode:ed(s.colors.surface1)?"dark":"light"}}var a=ed(null!=(n=null==(t=null==e?void 0:e.colors)?void 0:t.surface1)?n:ei.colors.surface1)?"dark":"light",c="dark"===a?es:ei,l={colors:B(B({},c.colors),null!=(r=null==e?void 0:e.colors)?r:{}),syntax:B(B({},c.syntax),null!=(o=null==e?void 0:e.syntax)?o:{}),font:B(B({},c.font),null!=(i=null==e?void 0:e.font)?i:{})},d=e?ex(JSON.stringify(l)):"default";return{theme:l,id:"sp-".concat(d),mode:a}},ex=function(e){for(var t=0,n=0;n<e.length;t&=t)t=31*t+e.charCodeAt(n++);return Math.abs(t)},ey=function(){return""};ey.toString=ey;var ew=(0,y.createContext)({}),ej=function(e){var t=e.children,n=e.classes;return(0,x.jsx)(ew.Provider,{value:n||{},children:t})},e$=function(){var e=(0,y.useContext)(ew);return function(t,n){void 0===n&&(n=[]);var r="".concat("sp","-").concat(t);return eC.apply(void 0,U(U([],n,!1),[r,e[r]],!1))}},eC=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(Boolean).join(" ")},ek=em({all:"initial",fontSize:"$font$size",fontFamily:"$font$body",display:"block",boxSizing:"border-box",textRendering:"optimizeLegibility",WebkitTapHighlightColor:"transparent",WebkitFontSmoothing:"subpixel-antialiased",variants:{variant:{dark:{colorScheme:"dark"},light:{colorScheme:"light"}}},"@media screen and (min-resolution: 2dppx)":{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},"*":{boxSizing:"border-box"},".sp-wrapper:focus":{outline:"0"}}),eS=y.createContext({theme:ei,id:"light",mode:"light"}),eN=function(e){var t=e.theme,n=e.children,r=e.className,o=P(e,["theme","children","className"]),i=y.useState(t),s=i[0],a=i[1],c=eb(s),l=c.theme,d=c.id,u=c.mode,p=e$(),f=y.useMemo(function(){return ef(d,eg(l))},[l,d]);return y.useEffect(function(){if("auto"!==t)return void a(t);var e=function(e){a(e.matches?"dark":"light")};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e),function(){window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",e)}},[t]),(0,x.jsx)(eS.Provider,{value:{theme:l,id:d,mode:u},children:(0,x.jsx)("div",B({className:p("wrapper",[f,ek({variant:u}),r])},o,{children:n}))})};eS.Consumer;var eO={"/styles.css":{code:"body {\n font-family: sans-serif;\n -webkit-font-smoothing: auto;\n -moz-font-smoothing: auto;\n -moz-osx-font-smoothing: grayscale;\n font-smoothing: auto;\n text-rendering: optimizeLegibility;\n font-smooth: always;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n}\n\nh1 {\n font-size: 1.5rem;\n}"}},eE={files:{"/src/styles.css":eO["/styles.css"],"/src/pages/index.astro":{code:'---\nimport "../styles.css";\nconst data = "world";\n---\n\n<h1>Hello {data}</h1>\n\n<style>\n h1 {\n font-size: 1.5rem;\n }\n</style>'},".env":{code:'ASTRO_TELEMETRY_DISABLED="1"'},"/package.json":{code:JSON.stringify({dependencies:{astro:"^1.6.12","esbuild-wasm":"^0.15.16"},scripts:{dev:"astro dev",start:"astro dev",build:"astro build",preview:"astro preview",astro:"astro"}})}},main:"/src/pages/index.astro",environment:"node"},eA={files:B(B({},eO),{"/pages/_app.js":{code:"import '../styles.css'\n\nexport default function MyApp({ Component, pageProps }) {\n return <Component {...pageProps} />\n}"},"/pages/index.js":{code:'export default function Home({ data }) {\n return (\n <div>\n <h1>Hello {data}</h1>\n </div>\n );\n}\n \nexport function getServerSideProps() {\n return {\n props: { data: "world" },\n }\n}\n'},"/next.config.js":{code:"/** @type {import('next').NextConfig} */\nconst nextConfig = {\n reactStrictMode: true,\n swcMinify: true,\n}\n\nmodule.exports = nextConfig\n"},"/package.json":{code:JSON.stringify({name:"my-app",version:"0.1.0",private:!0,scripts:{dev:"NEXT_TELEMETRY_DISABLED=1 next dev",build:"next build",start:"next start",lint:"next lint"},dependencies:{next:"12.1.6",react:"18.2.0","react-dom":"18.2.0","@next/swc-wasm-nodejs":"12.1.6"}})}}),main:"/pages/index.js",environment:"node"},eM={files:{"/index.js":{code:"const http = require('http');\n\nconst hostname = '127.0.0.1';\nconst port = 3000;\n\nconst server = http.createServer((req, res) => {\n res.statusCode = 200;\n res.setHeader('Content-Type', 'text/html');\n res.end('Hello world');\n});\n\nserver.listen(port, hostname, () => {\n console.log(`Server running at http://${hostname}:${port}/`);\n});"},"/package.json":{code:JSON.stringify({dependencies:{},scripts:{start:"node index.js"},main:"index.js"})}},main:"/index.js",environment:"node"},eL={files:B(B({},eO),{"/index.js":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n<h1>Hello world</h1>\n`;\n'},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="app"></div>\n <script type="module" src="/index.js"><\/script>\n </body>\n</html>\n'},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},devDependencies:{vite:"4.1.4","esbuild-wasm":"0.17.12"}})}}),main:"/index.js",environment:"node"},eF={files:B(B({},eO),{"/App.jsx":{code:'export default function App() {\n const data = "world"\n\n return <h1>Hello {data}</h1>\n}\n'},"/index.jsx":{code:'import { render } from "preact";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = document.getElementById("root");\nrender(<App />, root);\n'},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="root"></div>\n <script type="module" src="/index.jsx"><\/script>\n </body>\n</html>\n'},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},dependencies:{preact:"^10.16.0"},devDependencies:{"@preact/preset-vite":"^2.5.0",vite:"4.1.4","esbuild-wasm":"0.17.12"}})},"/vite.config.js":{code:"import { defineConfig } from \"vite\";\nimport preact from '@preact/preset-vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [preact()],\n});\n"}}),main:"/App.jsx",environment:"node"},eR={files:B(B({},eO),{"/App.tsx":{code:'export default function App() {\n const data: string = "world"\n\n return <h1>Hello {data}</h1>\n}\n'},"/index.tsx":{code:'import { render } from "preact";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = document.getElementById("root") as HTMLElement;\nrender(<App />, root);\n'},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="root"></div>\n <script type="module" src="/index.tsx"><\/script>\n </body>\n</html>\n'},"/tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"ESNext",useDefineForClassFields:!0,lib:["DOM","DOM.Iterable","ESNext"],allowJs:!1,skipLibCheck:!0,esModuleInterop:!1,allowSyntheticDefaultImports:!0,strict:!0,forceConsistentCasingInFileNames:!0,module:"ESNext",moduleResolution:"Node",resolveJsonModule:!0,isolatedModules:!0,noEmit:!0,jsx:"react-jsx",jsxImportSource:"preact"},include:["src"],references:[{path:"./tsconfig.node.json"}]},null,2)},"/tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node",allowSyntheticDefaultImports:!0},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"tsc && vite build",preview:"vite preview"},dependencies:{preact:"^10.16.0"},devDependencies:{"@preact/preset-vite":"^2.5.0",typescript:"^4.9.5",vite:"4.1.4","esbuild-wasm":"^0.17.12"}},null,2)},"/vite-env.d.ts":{code:'/// <reference types="vite/client" />'},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport preact from '@preact/preset-vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [preact()],\n})\n"}}),main:"/App.tsx",environment:"node"},eI={files:B(B({},eO),{"/App.jsx":{code:'export default function App() {\n const data = "world"\n\n return <h1>Hello {data}</h1>\n}\n'},"/index.jsx":{code:'import { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = createRoot(document.getElementById("root"));\nroot.render(\n <StrictMode>\n <App />\n </StrictMode>\n);'},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="root"></div>\n <script type="module" src="/index.jsx"><\/script>\n </body>\n</html>\n'},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},dependencies:{react:"^18.2.0","react-dom":"^18.2.0"},devDependencies:{"@vitejs/plugin-react":"3.1.0",vite:"4.1.4","esbuild-wasm":"0.17.12"}})},"/vite.config.js":{code:'import { defineConfig } from "vite";\nimport react from "@vitejs/plugin-react";\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [react()],\n});\n'}}),main:"/App.jsx",environment:"node"},eD={files:B(B({},eO),{"/App.tsx":{code:'export default function App() {\n const data: string = "world"\n\n return <h1>Hello {data}</h1>\n}\n'},"/index.tsx":{code:'import { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\nimport React from "react";\n\nconst root = createRoot(document.getElementById("root") as HTMLElement);\nroot.render(\n <StrictMode>\n <App />\n </StrictMode>\n);\n'},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="root"></div>\n <script type="module" src="/index.tsx"><\/script>\n </body>\n</html>\n'},"/tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"ESNext",useDefineForClassFields:!0,lib:["DOM","DOM.Iterable","ESNext"],allowJs:!1,skipLibCheck:!0,esModuleInterop:!1,allowSyntheticDefaultImports:!0,strict:!0,forceConsistentCasingInFileNames:!0,module:"ESNext",moduleResolution:"Node",resolveJsonModule:!0,isolatedModules:!0,noEmit:!0,jsx:"react-jsx"},include:["src"],references:[{path:"./tsconfig.node.json"}]},null,2)},"/tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node",allowSyntheticDefaultImports:!0},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"tsc && vite build",preview:"vite preview"},dependencies:{react:"^19.0.0","react-dom":"^19.0.0"},devDependencies:{"@types/react":"^19.0.8","@types/react-dom":"^19.0.3","@vitejs/plugin-react":"^4.3.4",typescript:"^4.9.5",vite:"4.2.0","esbuild-wasm":"^0.17.12"}},null,2)},"/vite-env.d.ts":{code:'/// <reference types="vite/client" />'},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [react()],\n})\n"}}),main:"/App.tsx",environment:"node"},eT={files:{"/src/styles.css":eO["/styles.css"],"/src/App.svelte":{code:'<script>\nconst data = "world";\n<\/script>\n\n<h1>Hello {data}</h1>\n\n<style>\nh1 {\n font-size: 1.5rem;\n}\n</style>'},"/src/main.js":{code:"import App from './App.svelte'\nimport \"./styles.css\"\n\nconst app = new App({\n target: document.getElementById('app'),\n})\n\nexport default app"},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="app"></div>\n <script type="module" src="/src/main.js"><\/script>\n </body>\n</html>\n'},"/vite.config.js":{code:"import { defineConfig } from 'vite'\nimport { svelte } from '@sveltejs/vite-plugin-svelte'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [svelte()],\n})"},"/package.json":{code:JSON.stringify({type:"module",scripts:{dev:"vite"},devDependencies:{"@sveltejs/vite-plugin-svelte":"^2.0.2",svelte:"^3.55.1",vite:"4.0.4","esbuild-wasm":"^0.17.12"}})}},main:"/src/App.svelte",environment:"node"},eH={files:{"/src/styles.css":eO["/styles.css"],"/src/App.svelte":{code:'<script lang="ts">\nconst data: string = "world";\n<\/script>\n\n<h1>Hello {data}</h1>\n\n<style>\nh1 {\n font-size: 1.5rem;\n}\n</style>'},"/src/main.ts":{code:"import App from './App.svelte'\nimport \"./styles.css\"\n\nconst app = new App({\n target: document.getElementById('app'),\n})\n\nexport default app"},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="app"></div>\n <script type="module" src="/src/main.ts"><\/script>\n </body>\n</html>\n'},"/vite-env.d.ts":{code:'/// <reference types="svelte" />\n/// <reference types="vite/client" />'},"svelte.config.js":{code:"import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'\n\nexport default {\n // Consult https://svelte.dev/docs#compile-time-svelte-preprocess\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n}\n"},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport { svelte } from '@sveltejs/vite-plugin-svelte'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [svelte()],\n})"},"tsconfig.json":{code:JSON.stringify({extends:"@tsconfig/svelte/tsconfig.json",compilerOptions:{target:"ESNext",useDefineForClassFields:!0,module:"ESNext",resolveJsonModule:!0,allowJs:!0,checkJs:!0,isolatedModules:!0},include:["src/**/*.d.ts","src/**/*.ts","src/**/*.js","src/**/*.svelte"],references:[{path:"./tsconfig.node.json"}]},null,2)},"tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node"},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({type:"module",scripts:{dev:"vite"},devDependencies:{"@sveltejs/vite-plugin-svelte":"^2.0.2","@tsconfig/svelte":"^3.0.0",svelte:"^3.55.1","svelte-check":"^2.10.3",tslib:"^2.5.0",vite:"4.1.4","esbuild-wasm":"^0.17.12"}},null,2)}},main:"/src/App.svelte",environment:"node"},eB={files:{"/src/styles.css":eO["/styles.css"],"/src/App.vue":{code:'<script setup>\nimport { ref } from "vue";\n\nconst data = ref("world");\n<\/script>\n\n<template>\n <h1>Hello {{ data }}</h1>\n</template>\n\n<style>\nh1 {\n font-size: 1.5rem;\n}\n</style>'},"/src/main.js":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\"\n \ncreateApp(App).mount('#app') \n"},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="app"></div>\n <script type="module" src="/src/main.js"><\/script>\n </body>\n</html>\n'},"/vite.config.js":{code:"import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [vue()]\n})\n"},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},dependencies:{vue:"^3.2.45"},devDependencies:{"@vitejs/plugin-vue":"3.2.0",vite:"4.1.4","esbuild-wasm":"0.17.12"}})}},main:"/src/App.vue",environment:"node"},eP={files:{"/src/styles.css":eO["/styles.css"],"/src/App.vue":{code:'<script setup lang="ts">\nimport { ref } from "vue";\n\nconst data = ref<string>("world");\n<\/script>\n\n<template>\n <h1>Hello {{ data }}</h1>\n</template>\n\n<style>\nh1 {\n font-size: 1.5rem;\n}\n</style>'},"/src/main.ts":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\"\n\ncreateApp(App).mount('#app')\n"},"/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Vite App</title>\n </head>\n <body>\n <div id="app"></div>\n <script type="module" src="/src/main.ts"><\/script>\n </body>\n</html>\n'},"/vite-env.d.ts":{code:'/// <reference types="vite/client" />'},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [vue()]\n})\n"},"tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"ESNext",useDefineForClassFields:!0,module:"ESNext",moduleResolution:"Node",strict:!0,jsx:"preserve",resolveJsonModule:!0,isolatedModules:!0,esModuleInterop:!0,lib:["ESNext","DOM"],skipLibCheck:!0,noEmit:!0},include:["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue"],references:[{path:"./tsconfig.node.json"}]},null,2)},"tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node",allowSyntheticDefaultImports:!0},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"tsc && vite build",preview:"vite preview"},dependencies:{vue:"^3.2.47"},devDependencies:{"@vitejs/plugin-vue":"^4.0.0",vite:"4.1.4","vue-tsc":"^1.2.0",typescript:"^4.9.5","esbuild-wasm":"^0.17.12"}},null,2)}},main:"/src/App.vue",environment:"node"},ez={files:{"/src/app/app.component.css":eO["/styles.css"],"/src/app/app.component.html":{code:"<div>\n<h1>{{ helloWorld }}</h1>\n</div> \n"},"/src/app/app.component.ts":{code:'import { Component } from "@angular/core";\n\n@Component({\n selector: "app-root",\n templateUrl: "./app.component.html",\n styleUrls: ["./app.component.css"]\n})\nexport class AppComponent {\n helloWorld = "Hello world";\n} \n'},"/src/app/app.module.ts":{code:'import { BrowserModule } from "@angular/platform-browser";\nimport { NgModule } from "@angular/core";\n \nimport { AppComponent } from "./app.component";\n \n@NgModule({\n declarations: [AppComponent],\n imports: [BrowserModule],\n providers: [],\n bootstrap: [AppComponent]\n})\nexport class AppModule {} \n'},"/src/index.html":{code:'<!doctype html>\n<html lang="en">\n \n<head>\n <meta charset="utf-8">\n <title>Angular</title>\n <base href="/">\n \n <meta name="viewport" content="width=device-width, initial-scale=1">\n <link rel="icon" type="image/x-icon" href="favicon.ico">\n</head>\n \n<body>\n <app-root></app-root>\n</body>\n \n</html>\n'},"/src/main.ts":{code:'import { enableProdMode } from "@angular/core";\nimport { platformBrowserDynamic } from "@angular/platform-browser-dynamic";\n \nimport { AppModule } from "./app/app.module"; \n\nplatformBrowserDynamic()\n .bootstrapModule(AppModule)\n .catch(err => console.log(err));\n \n'},"/src/polyfills.ts":{code:'import "core-js/proposals/reflect-metadata"; \n import "zone.js/dist/zone";\n'},"/package.json":{code:JSON.stringify({dependencies:{"@angular/core":"^11.2.0","@angular/platform-browser":"^11.2.0","@angular/platform-browser-dynamic":"^11.2.0","@angular/common":"^11.2.0","@angular/compiler":"^11.2.0","zone.js":"0.11.3","core-js":"3.8.3",rxjs:"6.6.3"},main:"/src/main.ts"})}},main:"/src/app/app.component.ts",environment:"angular-cli"},e_={files:B(B({},eO),{"/App.js":{code:"export default function App() {\n return <h1>Hello world</h1>\n}\n"},"/index.js":{code:'import React, { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = createRoot(document.getElementById("root"));\nroot.render(\n <StrictMode>\n <App />\n </StrictMode>\n);'},"/public/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Document</title>\n </head>\n <body>\n <div id="root"></div>\n </body>\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{react:"^19.0.0","react-dom":"^19.0.0","react-scripts":"^5.0.0"},main:"/index.js"})}}),main:"/App.js",environment:"create-react-app"},eU={files:B(B({},eO),{"tsconfig.json":{code:'{\n "include": [\n "./**/*"\n ],\n "compilerOptions": {\n "strict": true,\n "esModuleInterop": true,\n "lib": [ "dom", "es2015" ],\n "jsx": "react-jsx"\n }\n}'},"/App.tsx":{code:"export default function App(): JSX.Element {\n return <h1>Hello world</h1>\n}\n"},"/index.tsx":{code:'import React, { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = createRoot(document.getElementById("root"));\nroot.render(\n <StrictMode>\n <App />\n </StrictMode>\n);'},"/public/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Document</title>\n </head>\n <body>\n <div id="root"></div>\n </body>\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{react:"^19.0.0","react-dom":"^19.0.0","react-scripts":"^4.0.0"},devDependencies:{"@types/react":"^19.0.0","@types/react-dom":"^19.0.0",typescript:"^4.0.0"},main:"/index.tsx"})}}),main:"/App.tsx",environment:"create-react-app"},eW={files:B(B({},eO),{"/App.tsx":{code:'import { Component } from "solid-js";\n\nconst App: Component = () => {\n return <h1>Hello world</h1>\n};\n\nexport default App;'},"/index.tsx":{code:'import { render } from "solid-js/web";\nimport App from "./App";\n\nimport "./styles.css";\n\nrender(() => <App />, document.getElementById("app"));'},"/index.html":{code:'<html>\n<head>\n <title>Parcel Sandbox</title>\n <meta charset="UTF-8" />\n</head>\n<body>\n <div id="app"></div>\n <script src="src/index.tsx"><\/script>\n</body>\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{"solid-js":"1.3.15"},main:"/index.tsx"})}}),main:"/App.tsx",environment:"solid"},eZ={files:B(B({},eO),{"/App.svelte":{code:"<style>\n h1 {\n font-size: 1.5rem;\n }\n</style>\n\n<script>\n let name = 'world';\n<\/script>\n\n<main>\n <h1>Hello {name}</h1>\n</main>"},"/index.js":{code:'import App from "./App.svelte";\nimport "./styles.css";\n\nconst app = new App({\n target: document.body\n});\n\nexport default app;\n '},"/public/index.html":{code:'<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf8" />\n <meta name="viewport" content="width=device-width" />\n\n <title>Svelte app</title>\n\n <link rel="stylesheet" href="public/bundle.css" />\n </head>\n\n <body>\n <script src="bundle.js"><\/script>\n </body>\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{svelte:"^3.0.0"},main:"/index.js"})}}),main:"/App.svelte",environment:"svelte"},eJ={files:{"tsconfig.json":{code:'{\n "include": [\n "./**/*"\n ],\n "compilerOptions": {\n "strict": true,\n "esModuleInterop": true,\n "lib": [ "dom", "es2015" ],\n "jsx": "react-jsx"\n }\n}'},"/add.ts":{code:"export const add = (a: number, b: number): number => a + b;"},"/add.test.ts":{code:"import { add } from './add';\n\ndescribe('add', () => {\n test('Commutative Law of Addition', () => {\n expect(add(1, 2)).toBe(add(2, 1));\n });\n});"},"package.json":{code:JSON.stringify({dependencies:{},devDependencies:{typescript:"^4.0.0"},main:"/add.ts"})}},main:"/add.test.ts",environment:"parcel",mode:"tests"},eV={files:B(B({},eO),{"/index.js":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n<h1>Hello world</h1>\n`;\n'},"/index.html":{code:'<!DOCTYPE html>\n<html>\n\n<head>\n <title>Parcel Sandbox</title>\n <meta charset="UTF-8" />\n</head>\n\n<body>\n <div id="app"></div>\n\n <script src="index.js">\n <\/script>\n</body>\n\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{},main:"/index.js"})}}),main:"/index.js",environment:"parcel"},eY={files:B(B({},eO),{"tsconfig.json":{code:'{\n "compilerOptions": {\n "strict": true,\n "module": "commonjs",\n "jsx": "preserve",\n "esModuleInterop": true,\n "sourceMap": true,\n "allowJs": true,\n "lib": [\n "es6",\n "dom"\n ],\n "rootDir": "src",\n "moduleResolution": "node"\n }\n}'},"/index.ts":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n<h1>Hello world</h1>\n`;\n'},"/index.html":{code:'<!DOCTYPE html>\n<html>\n\n<head>\n <title>Parcel Sandbox</title>\n <meta charset="UTF-8" />\n</head>\n\n<body>\n <div id="app"></div>\n\n <script src="index.ts">\n <\/script>\n</body>\n\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{},devDependencies:{typescript:"^4.0.0"},main:"/index.ts"})}}),main:"/index.ts",environment:"parcel"},eq={files:{"/src/styles.css":eO["/styles.css"],"/src/App.vue":{code:"<template>\n <h1>Hello {{ msg }}</h1>\n</template>\n\n<script setup>\nimport { ref } from 'vue';\nconst msg = ref('world');\n<\/script>"},"/src/main.js":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\";\n\ncreateApp(App).mount('#app')\n"},"/public/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width,initial-scale=1.0" />\n <title>codesandbox</title>\n </head>\n <body>\n <noscript>\n <strong\n >We\'re sorry but codesandbox doesn\'t work properly without JavaScript\n enabled. Please enable it to continue.</strong\n >\n </noscript>\n <div id="app"></div>\n \x3c!-- built files will be auto injected --\x3e\n </body>\n</html>\n'},"/package.json":{code:JSON.stringify({name:"vue3",version:"0.1.0",private:!0,main:"/src/main.js",scripts:{serve:"vue-cli-service serve",build:"vue-cli-service build"},dependencies:{"core-js":"^3.26.1",vue:"^3.2.45"},devDependencies:{"@vue/cli-plugin-babel":"^5.0.8","@vue/cli-service":"^5.0.8"}})}},main:"/src/App.vue",environment:"vue-cli"},eG={files:{"/src/styles.css":eO["/styles.css"],"/src/App.vue":{code:"<template>\n <h1>Hello {{ msg }}</h1>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nconst msg = ref<string>('world');\n<\/script>"},"/src/main.ts":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\";\n\ncreateApp(App).mount('#app')\n"},"/src/shims-vue.d.ts":'/* eslint-disable */\ndeclare module "*.vue" {\n import type { DefineComponent } from "vue";\n const component: DefineComponent<{}, {}, any>;\n export default component;\n}',"/public/index.html":{code:'<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width,initial-scale=1.0" />\n <title>codesandbox</title>\n </head>\n <body>\n <noscript>\n <strong\n >We\'re sorry but codesandbox doesn\'t work properly without JavaScript\n enabled. Please enable it to continue.</strong\n >\n </noscript>\n <div id="app"></div>\n \x3c!-- built files will be auto injected --\x3e\n </body>\n</html>\n'},"/package.json":{code:JSON.stringify({name:"vue3-ts",version:"0.1.0",private:!0,main:"/src/main.ts",scripts:{serve:"vue-cli-service serve",build:"vue-cli-service build"},dependencies:{"core-js":"^3.26.1",vue:"^3.2.45"},devDependencies:{"@vue/cli-plugin-babel":"^5.0.8","@vue/cli-plugin-typescript":"^5.0.8","@vue/cli-service":"^5.0.8",typescript:"^4.9.3"}})},"/tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"esnext",module:"esnext",strict:!0,jsx:"preserve",moduleResolution:"node",experimentalDecorators:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0,useDefineForClassFields:!0,sourceMap:!1,baseUrl:".",types:["webpack-env"],paths:{"@/*":["src/*"]},lib:["esnext","dom","dom.iterable","scripthost"]},include:["src/**/*.ts","src/**/*.tsx","src/**/*.vue","tests/**/*.ts","tests/**/*.tsx"],exclude:["node_modules"]})}},main:"/src/App.vue",environment:"vue-cli"},eX={static:{files:B(B({},eO),{"/index.html":{code:'<!DOCTYPE html>\n<html>\n\n<head>\n <title>Parcel Sandbox</title>\n <meta charset="UTF-8" />\n <link rel="stylesheet" href="/styles.css" />\n</head>\n\n<body>\n <h1>Hello world</h1>\n</body>\n\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{},main:"/index.html"})}}),main:"/index.html",environment:"static"},angular:ez,react:e_,"react-ts":eU,solid:eW,svelte:eZ,"test-ts":eJ,"vanilla-ts":eY,vanilla:eV,vue:eq,"vue-ts":eG,node:eM,nextjs:eA,vite:eL,"vite-react":eI,"vite-react-ts":eD,"vite-preact":eF,"vite-preact-ts":eR,"vite-vue":eB,"vite-vue-ts":eP,"vite-svelte":eT,"vite-svelte-ts":eH,astro:eE},eK=function(e){var t,n,r,o,i,s,a=(0,$.f)(e.files),c=e0({template:e.template,customSetup:e.customSetup,files:a}),l=(0,$.f)(null!=(n=null==(t=e.options)?void 0:t.visibleFiles)?n:[]),d=(null==(r=e.options)?void 0:r.activeFile)?eQ(null==(o=e.options)?void 0:o.activeFile,c.files):void 0;0===l.length&&a&&Object.keys(a).forEach(function(e){var t=a[e];if("string"==typeof t)return void l.push(e);!d&&t.active&&(d=e,!0===t.hidden&&l.push(e)),t.hidden||l.push(e)}),0===l.length&&(l=[c.main]),c.entry&&!c.files[c.entry]&&(c.entry=eQ(c.entry,c.files)),!d&&c.main&&(d=c.main),d&&c.files[d]||(d=l[0]),l.includes(d)||l.push(d);var u=(0,$.d)(c.files,null!=(i=c.dependencies)?i:{},null!=(s=c.devDependencies)?s:{},c.entry);return{visibleFiles:l.filter(function(e){return u[e]}),activeFile:d,files:u,environment:c.environment,shouldUpdatePreview:!0}},eQ=function(e,t){var n=(0,$.f)(t),r=(0,$.f)(e);if(r in n)return r;if(!e)return null;for(var o=null,i=0,s=[".js",".jsx",".ts",".tsx"];!o&&i<s.length;){var a=r.split(".")[0],c="".concat(a).concat(s[i]);void 0!==n[c]&&(o=c),i++}return o},e0=function(e){var t=e.files,n=e.template,r=e.customSetup;if(!n){if(!r){var o=eX.vanilla;return B(B({},o),{files:B(B({},o.files),e1(t))})}if(!t||0===Object.keys(t).length)throw Error("[sandpack-react]: without a template, you must pass at least one file");return B(B({},r),{files:e1(t)})}var i=eX[n];if(!i)throw Error('[sandpack-react]: invalid template "'.concat(n,'" provided'));return r||t?{files:e1(B(B({},i.files),t)),dependencies:B(B({},i.dependencies),null==r?void 0:r.dependencies),devDependencies:B(B({},i.devDependencies),null==r?void 0:r.devDependencies),entry:(0,$.f)(null==r?void 0:r.entry),main:i.main,environment:(null==r?void 0:r.environment)||i.environment}:i},e1=function(e){return e?Object.keys(e).reduce(function(t,n){return"string"==typeof e[n]?t[n]={code:e[n]}:t[n]=e[n],t},{}):{}},e3=function(e,t){var n=(0,y.useState)({editorState:"pristine"}),r=n[0],o=n[1],i=eK(e),s=(0,j.j)(i.files,t)?"pristine":"dirty";return s!==r.editorState&&o(function(e){return B(B({},e),{editorState:s})}),r},e2=function(e){if("function"!=typeof y.useId)return function(){return e5(ep(),9)};var t=(0,y.useId)();return function(){return z(void 0,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return[4,function(e){return z(this,void 0,void 0,function(){var t,n;return _(this,function(r){switch(r.label){case 0:return t=new TextEncoder().encode(e),[4,crypto.subtle.digest("SHA-256",t)];case 1:return n=Array.from(new Uint8Array(r.sent())),[2,btoa(String.fromCharCode.apply(String,n))]}})})}(Object.entries(e).map(function(e,t){return e+"|"+t}).join("|||")+t+"2.19.8")];case 1:return[2,e5(n.sent().replace(/:/g,"sp").replace(/[^a-zA-Z]/g,""),9)]}})})}};function e5(e,t){return e.length>t?e.slice(0,t):e.padEnd(t,"s")}var e6=function(e,t){var n,r,o,i=e.options,s=e.customSetup,a=e.teamId,c=e.sandboxId;null!=i||(i={}),null!=s||(s={});var l=(null==i?void 0:i.initMode)||"lazy",d=(0,y.useState)({startRoute:null==i?void 0:i.startRoute,bundlerState:void 0,error:null,initMode:l,reactDevTools:void 0,status:null==(n=null==i?void 0:i.autorun)||n?"initial":"idle"}),u=d[0],p=d[1],f=(0,y.useRef)(),m=(0,y.useRef)(null),h=(0,y.useRef)(null),v=(0,y.useRef)({}),g=(0,y.useRef)({}),b=(0,y.useRef)(null),x=(0,y.useRef)({}),w=(0,y.useRef)(),j=(0,y.useRef)({global:{}}),k=(0,y.useRef)(),S=(0,y.useRef)(t.environment),N=e2(t.files),O=(0,y.useCallback)(function(e,n,r){return z(void 0,void 0,void 0,function(){var o,l,d,f,m,h,v,y;return _(this,function($){switch($.label){case 0:return g.current[n]&&g.current[n].destroy(),null!=i||(i={}),null!=s||(s={}),o=null!=(h=null==i?void 0:i.bundlerTimeOut)?h:4e4,b.current&&clearTimeout(b.current),"function"!=typeof w.current&&(b.current=setTimeout(function(){E(),p(function(e){return B(B({},e),{status:"timeout"})})},o)),d=C.Jy,f=[e,{files:t.files,template:t.environment}],m={externalResources:i.externalResources,bundlerURL:i.bundlerURL,startRoute:null!=(v=null==r?void 0:r.startRoute)?v:i.startRoute,fileResolver:i.fileResolver,skipEval:null!=(y=i.skipEval)&&y,logLevel:i.logLevel,showOpenInCodeSandbox:!1,showErrorScreen:!0,showLoadingScreen:!1,reactDevTools:u.reactDevTools,customNpmRegistries:null==s?void 0:s.npmRegistries,teamId:a,experimental_enableServiceWorker:!!(null==i?void 0:i.experimental_enableServiceWorker)},[4,z(void 0,void 0,void 0,function(){var e,t;return _(this,function(n){switch(n.label){case 0:if(!(null==i?void 0:i.experimental_enableStableServiceWorkerId))return[3,3];if(e="SANDPACK_INTERNAL:URL-CONSISTENT-ID",t=localStorage.getItem(e))return[3,2];return[4,N()];case 1:t=n.sent(),localStorage.setItem(e,t),n.label=2;case 2:return[2,t];case 3:return[4,N()];case 4:return[2,n.sent()]}})})];case 1:return[4,d.apply(void 0,f.concat([(m.experimental_stableServiceWorkerId=$.sent(),m.sandboxId=c,m)]))];case 2:return l=$.sent(),"function"!=typeof w.current&&(w.current=l.listen(R)),x.current[n]=x.current[n]||{},j.current[n]&&(Object.keys(j.current[n]).forEach(function(e){var t=j.current[n][e],r=l.listen(t);x.current[n][e]=r}),j.current[n]={}),Object.entries(j.current.global).forEach(function(e){var t=e[0],r=e[1],o=l.listen(r);x.current[n][t]=o}),g.current[n]=l,[2]}})})},[t.environment,t.files,u.reactDevTools]),E=(0,y.useCallback)(function(){Object.keys(g.current).map(F),"function"==typeof w.current&&(w.current(),w.current=void 0)},[]),A=(0,y.useCallback)(function(){return z(void 0,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return[4,Promise.all(Object.entries(v.current).map(function(e){var t=e[0],n=e[1],r=n.iframe,o=n.clientPropsOverride,i=void 0===o?{}:o;return z(void 0,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return[4,O(r,t,i)];case 1:return e.sent(),[2]}})})}))];case 1:return e.sent(),p(function(e){return B(B({},e),{error:null,status:"running"})}),[2]}})})},[O]);f.current=function(e){e.some(function(e){return e.isIntersecting})?A():E()};var M=(0,y.useCallback)(function(){var e,t,n;if(null==(e=null==i?void 0:i.autorun)||e){var r=null!=(t=null==i?void 0:i.initModeObserverOptions)?t:{rootMargin:"1000px 0px"};m.current&&h.current&&(null==(n=m.current)||n.unobserve(h.current)),h.current&&"lazy"===u.initMode?(m.current=new IntersectionObserver(function(e){var t,n;e.some(function(e){return e.isIntersecting})&&e.some(function(e){return e.isIntersecting})&&h.current&&(null==(t=f.current)||t.call(f,e),null==(n=m.current)||n.unobserve(h.current))},r),m.current.observe(h.current)):h.current&&"user-visible"===u.initMode?(m.current=new IntersectionObserver(function(e){var t;null==(t=f.current)||t.call(f,e)},r),m.current.observe(h.current)):A()}},[null==i?void 0:i.autorun,null==i?void 0:i.initModeObserverOptions,A,u.initMode,E]),L=(0,y.useCallback)(function(e,t,n){return z(void 0,void 0,void 0,function(){return _(this,function(r){switch(r.label){case 0:if(v.current[t]={iframe:e,clientPropsOverride:n},"running"!==u.status)return[3,2];return[4,O(e,t,n)];case 1:r.sent(),r.label=2;case 2:return[2]}})})},[O,u.status]),F=function(e){var t,n,r=g.current[e];r?(r.destroy(),null==(t=r.iframe.contentWindow)||t.location.replace("about:blank"),r.iframe.removeAttribute("src"),delete g.current[e]):delete v.current[e],b.current&&clearTimeout(b.current),Object.values(null!=(n=x.current[e])?n:{}).forEach(function(e){Object.values(e).forEach(function(e){return e()})});var o=Object.keys(g.current).length>0?"running":"idle";p(function(e){return B(B({},e),{status:o})})},R=function(e){"start"===e.type?p(function(e){return B(B({},e),{error:null})}):"state"===e.type?p(function(t){return B(B({},t),{bundlerState:e.state})}):("done"!==e.type||e.compilatonError)&&"connected"!==e.type?"action"===e.type&&"show-error"===e.action?(b.current&&clearTimeout(b.current),p(function(t){return B(B({},t),{error:(0,$.e)(e)})})):"action"===e.type&&"notification"===e.action&&"error"===e.notificationType&&p(function(t){return B(B({},t),{error:{message:e.title}})}):(b.current&&clearTimeout(b.current),p(function(e){return B(B({},e),{error:null})}))},I=null!=(r=null==i?void 0:i.recompileMode)?r:"delayed",D=null!=(o=null==i?void 0:i.recompileDelay)?o:200;return(0,y.useEffect)(function(){if("running"===u.status&&t.shouldUpdatePreview){if(S.current!==t.environment&&(S.current=t.environment,Object.entries(g.current).forEach(function(e){var t=e[0];L(e[1].iframe,t)})),"immediate"===I&&Object.values(g.current).forEach(function(e){"done"===e.status&&e.updateSandbox({files:t.files,template:t.environment})}),"delayed"===I){if("undefined"==typeof window)return;window.clearTimeout(k.current),k.current=window.setTimeout(function(){Object.values(g.current).forEach(function(e){"done"===e.status&&e.updateSandbox({files:t.files,template:t.environment})})},D)}return function(){window.clearTimeout(k.current)}}},[t.files,t.environment,t.shouldUpdatePreview,D,I,L,u.status]),(0,y.useEffect)(function(){l!==u.initMode&&(p(function(e){return B(B({},e),{initMode:l})}),M())},[l,M,u.initMode]),(0,y.useEffect)(function(){return function(){"function"==typeof w.current&&w.current(),b.current&&clearTimeout(b.current),k.current&&clearTimeout(k.current),m.current&&m.current.disconnect()}},[]),[u,{clients:g.current,initializeSandpackIframe:M,runSandpack:A,registerBundler:L,unregisterBundler:F,registerReactDevTools:function(e){p(function(t){return B(B({},t),{reactDevTools:e})})},addListener:function(e,t){if(t)if(g.current[t]){var n=g.current[t].listen(e);return n}else{var r=ep();j.current[t]=j.current[t]||{},x.current[t]=x.current[t]||{},j.current[t][r]=e;var n=function(){j.current[t][r]?delete j.current[t][r]:x.current[t][r]&&(x.current[t][r](),delete x.current[t][r])};return n}var o=ep();j.current.global[o]=e;var i=Object.values(g.current).map(function(t){return t.listen(e)}),n=function(){i.forEach(function(e){return e()}),delete j.current.global[o],Object.values(x.current).forEach(function(e){var t;null==(t=null==e?void 0:e[o])||t.call(e)})};return n},dispatchMessage:function(e,t){if("running"!==u.status)return void console.warn("[sandpack-react]: dispatch cannot be called while in idle mode");t?g.current[t].dispatch(e):Object.values(g.current).forEach(function(t){t.dispatch(e)})},lazyAnchorRef:h,unsubscribeClientListenersRef:x,queuedListenersRef:j}]},e4=function(e){var t=eK(e),n=(0,y.useState)(t),r=n[0],o=n[1],i=(0,y.useRef)(!1);(0,y.useEffect)(function(){i.current?o(eK(e)):i.current=!0},[e.files,e.customSetup,e.template]);var s=function(e,t,n){void 0===n&&(n=!0),o(function(r){var o,i=r.files;return"string"==typeof e&&"string"==typeof t?i=B(B({},i),((o={})[e]=B(B({},i[e]),{code:t}),o)):"object"==typeof e&&(i=B(B({},i),e1(e))),B(B({},r),{files:(0,$.f)(i),shouldUpdatePreview:n})})};return[B(B({},r),{visibleFilesFromProps:t.visibleFiles}),{openFile:function(e){o(function(t){var n=t.visibleFiles,r=P(t,["visibleFiles"]),o=n.includes(e)?n:U(U([],n,!0),[e],!1);return B(B({},r),{activeFile:e,visibleFiles:o})})},resetFile:function(e){o(function(n){var r;return B(B({},n),{files:B(B({},n.files),((r={})[e]=t.files[e],r))})})},resetAllFiles:function(){o(function(e){return B(B({},e),{files:t.files})})},setActiveFile:function(e){r.files[e]&&o(function(t){return B(B({},t),{activeFile:e})})},updateCurrentFile:function(e,t){void 0===t&&(t=!0),s(r.activeFile,e,t)},updateFile:s,addFile:s,closeFile:function(e){1!==r.visibleFiles.length&&o(function(t){var n=t.visibleFiles,r=t.activeFile,o=P(t,["visibleFiles","activeFile"]),i=n.indexOf(e),s=n.filter(function(t){return t!==e});return B(B({},o),{activeFile:e===r?0===i?n[1]:n[i-1]:r,visibleFiles:s})})},deleteFile:function(e,t){void 0===t&&(t=!0),o(function(n){var r=n.visibleFiles,o=n.files,i=n.activeFile,s=P(n,["visibleFiles","files","activeFile"]),a=B({},o);delete a[e];var c=r.filter(function(t){return t!==e});if(0===c.length){var l=Object.keys(o)[Object.keys(o).length-1];return B(B({},s),{visibleFiles:[l],activeFile:l,files:a,shouldUpdatePreview:t})}return B(B({},s),{visibleFiles:c,activeFile:e===i?c[c.length-1]:i,files:a,shouldUpdatePreview:t})})}}]},e7=y.createContext(null),e8=function(e){var t,n,r,o=e.children,i=e.options,s=e.style,a=e.className,c=e.theme,l=e4(e),d=l[0],u=l[1],p=e6(e,d),f=p[0],m=p[1],h=m.dispatchMessage,v=m.addListener,g=P(m,["dispatchMessage","addListener"]),b=e3(e,d.files);return y.useEffect(function(){g.initializeSandpackIframe()},[]),(0,x.jsx)(e7.Provider,{value:B(B(B(B(B(B({},d),f),b),u),g),{autoReload:null==(n=null==(t=e.options)?void 0:t.autoReload)||n,teamId:null==e?void 0:e.teamId,exportOptions:null==(r=null==e?void 0:e.customSetup)?void 0:r.exportOptions,listen:v,dispatch:h}),children:(0,x.jsx)(ej,{classes:null==i?void 0:i.classes,children:(0,x.jsx)(eN,{className:a,style:s,theme:c,children:o})})})};function e9(){var e=y.useContext(e7);if(null===e)throw Error('[sandpack-react]: "useSandpack" must be wrapped by a "SandpackProvider"');var t=e.dispatch,n=e.listen,r=P(e,["dispatch","listen"]);return{sandpack:B({},r),dispatch:t,listen:n}}e7.Consumer;var te=function(){var e,t,n,r=e9().sandpack;return{code:null==(e=r.files[r.activeFile])?void 0:e.code,readOnly:null!=(n=null==(t=r.files[r.activeFile])?void 0:t.readOnly)&&n,updateCode:r.updateCurrentFile}},tt=em({svg:{margin:"auto"}}),tn=em(((i={appearance:"none",outline:"none",display:"flex",alignItems:"center",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",transition:"color $default, background $default",cursor:"pointer",color:"$colors$clickable",border:0,textDecoration:"none","&:disabled":{color:"$colors$disabled"},"&:hover:not(:disabled,[data-active='true'])":{color:"$colors$hover"},'&[data-active="true"]':{color:"$colors$accent"},svg:{minWidth:"$space$4",width:"$space$4",height:"$space$4"}})["&.".concat(tt)]={padding:"$space$1",height:"$space$7",display:"flex"},i["&.".concat(tt,"&:not(:has(span))")]={width:"$space$7"},i["&.".concat(tt,"&:has(svg + span)")]={paddingRight:"$space$3",paddingLeft:"$space$2",gap:"$space$1"},i)),tr=em({backgroundColor:"$colors$surface2",borderRadius:"99999px",border:"1px solid $colors$surface3",'&[data-active="true"]':{color:"$colors$surface1",background:"$colors$accent"},"&:hover:not(:disabled,[data-active='true'])":{backgroundColor:"$colors$surface3"}}),to=em({padding:0}),ti=eh({"0%":{opacity:0},"100%":{opacity:1}}),ts=em({position:"absolute",bottom:"0",left:"0",right:"0",top:"0",margin:"0",overflow:"auto",height:"100%",zIndex:"$top"}),ta=em(((s={whiteSpace:"pre-wrap",padding:"$space$10",backgroundColor:"$colors$surface1",display:"flex",gap:"$space$2",flexDirection:"column"})[".".concat(tn)]={width:"auto",gap:"$space$2",padding:"0 $space$3 0 $space$2",marginTop:"$space$1"},s.variants={solidBg:{true:{backgroundColor:"$colors$errorSurface"}}},s)),tc=em(((a={padding:"$space$10",backgroundColor:"$colors$surface1"})[".".concat(tn)]={marginTop:"$space$6",width:"auto",gap:"$space$2",padding:"0 $space$3 0 $space$2"},a)),tl=em({animation:"".concat(ti," 150ms ease"),color:"$colors$error",display:"flex",flexDirection:"column",gap:"$space$3",variants:{errorCode:{true:{fontFamily:"$font$mono"}}},a:{color:"inherit"},p:{margin:0}}),td=em({borderBottom:"1px solid $colors$surface2",background:"$colors$surface1"}),tu=em({padding:"0 $space$2",overflow:"auto",display:"flex",flexWrap:"nowrap",alignItems:"stretch",minHeight:"40px",marginBottom:"-1px"}),tp=em({display:"flex",alignItems:"center",outline:"none",position:"relative",paddingRight:"20px",margin:"1px 0","&:has(button:focus)":{outline:"$colors$accent auto 1px"}}),tf=em({padding:"0 $space$1 0 $space$1",borderRadius:"$border$radius",marginLeft:"$space$1",width:"$space$5",visibility:"hidden",cursor:"pointer",position:"absolute",right:"0px",svg:{width:"$space$3",height:"$space$3",display:"block",position:"relative",top:1}}),tm=em(((c={padding:"0 $space$2",height:"$layout$headerHeight",whiteSpace:"nowrap","&:focus":{outline:"none"}})["&:hover ~ .".concat(tf)]={visibility:"visible"},c)),th=function(e){var t=e.closableTabs,n=e.className,r=e.activeFileUniqueId,o=P(e,["closableTabs","className","activeFileUniqueId"]),i=e9().sandpack,s=e$(),a=i.activeFile,c=i.visibleFiles,l=i.setActiveFile,d=y.useState(null),u=d[0],p=d[1],f=function(e){var t=ec(e),n=c.reduce(function(n,r){return r===e||ec(r)===t&&n.push(r),n},[]);return 0===n.length?t:el(e,n)},m=function(e){var t,n,r,o,i=e.e,s=e.index,a=i.currentTarget;switch(i.key){case"ArrowLeft":var d=a.previousElementSibling;d&&(null==(t=d.querySelector("button"))||t.focus(),l(c[s-1]));break;case"ArrowRight":var u=a.nextElementSibling;u&&(null==(n=u.querySelector("button"))||n.focus(),l(c[s+1]));break;case"Home":null==(r=a.parentElement.firstElementChild.querySelector("button"))||r.focus(),l(c[0]);break;case"End":null==(o=a.parentElement.lastElementChild.querySelector("button"))||o.focus(),l(c[-1])}};return(0,x.jsx)("div",B({className:s("tabs",[td,n]),translate:"no"},o,{children:(0,x.jsx)("div",{"aria-label":"Select active file",className:s("tabs-scrollable-container",[tu]),role:"tablist",children:c.map(function(e,n){return(0,x.jsxs)("div",{"aria-controls":"".concat(e,"-").concat(r,"-tab-panel"),"aria-selected":e===a,className:s("tab-container",[tp]),onKeyDown:function(e){return m({e:e,index:n})},onMouseEnter:function(){return p(n)},onMouseLeave:function(){return p(null)},role:"tab",children:[(0,x.jsx)("button",{className:s("tab-button",[tn,tm]),"data-active":e===a,id:"".concat(e,"-").concat(r,"-tab"),onClick:function(){return l(e)},tabIndex:e===a?0:-1,title:e,type:"button",children:f(e)}),t&&c.length>1&&(0,x.jsx)("span",{className:s("close-button",[tf]),onClick:function(t){t.stopPropagation(),i.closeFile(e)},style:{visibility:e===a||u===n?"visible":"hidden"},tabIndex:e===a?0:-1,children:(0,x.jsx)(er,{})})]},e)})})}))},tv=function(e){var t=e.onClick,n=e.className,r=e.children,o=e$();return(0,x.jsx)("button",{className:o("button",[o("icon-standalone"),tn,tt,tr,n]),onClick:t,type:"button",children:r})},tg=em({position:"absolute",bottom:"$space$2",right:"$space$2",paddingRight:"$space$3"}),tb=function(e){e.className;var t=e.onClick,n=P(e,["className","onClick"]),r=e9().sandpack;return(0,x.jsxs)(tv,B({className:tg.toString(),onClick:function(e){r.runSandpack(),null==t||t(e)}},n,{children:[(0,x.jsx)(Y,{}),(0,x.jsx)("span",{children:"Run"})]}))},tx=em(((l={display:"flex",flexDirection:"column",width:"100%",position:"relative",backgroundColor:"$colors$surface1",gap:1})["&:has(.".concat("sp","-stack)")]={backgroundColor:"$colors$surface2"},l)),ty=function(e){var t=e.className,n=P(e,["className"]),r=e$();return(0,x.jsx)("div",B({className:r("stack",[tx,t])},n))},tw=function(){var e=y.useContext(eS);return{theme:e.theme,themeId:e.id,themeMode:e.mode}},tj=function(e,t){if(e.length!==t.length)return!1;for(var n=!0,r=0;r<e.length;r++)if(e[r]!==t[r]){n=!1;break}return n},t$=function(e,t){var n=t.line,r=t.column;return e.line(n).from+(null!=r?r:0)-1},tC=function(e){return"".concat("sp","-syntax-").concat(e)},tk=function(e,t,n){if(!e&&!t)return"javascript";var r=t;if(!r&&e){var o=e.lastIndexOf(".");r=e.slice(o+1)}for(var i=0;i<n.length;i++){var s=n[i];if(r===s.name||s.extensions.includes(r||""))return s.name}switch(r){case"ts":case"tsx":return"typescript";case"html":case"svelte":case"vue":case"astro":return"html";case"css":case"less":case"scss":return"css";default:return"javascript"}},tS=function(e,t){for(var n={javascript:(0,F.Q2)({jsx:!0,typescript:!1}),typescript:(0,F.Q2)({jsx:!0,typescript:!0}),html:(0,L.qy)(),css:(0,M.AH)()},r=0;r<t.length;r++){var o=t[r];if(e===o.name)return o.language}return n[e]},tN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.useCallback(function(t){return e.forEach(function(e){if(e){if("function"==typeof e)return e(t);e.current=t}})},e)},tO=E.NZ.line({attributes:{class:"cm-errorLine"}}),tE=E.Z9.fromClass(function(){function e(){this.decorations=E.NZ.none}return e.prototype.update=function(e){var t=this;e.transactions.forEach(function(n){var r=n.annotation("show-error");if(void 0!==r){var o=t$(e.view.state.doc,{line:r})+1;t.decorations=E.NZ.set([tO.range(o)])}else n.annotation("remove-errors")&&(t.decorations=E.NZ.none)})},e}(),{decorations:function(e){return e.decorations}}),tA=em({margin:"0",display:"block",fontFamily:"$font$mono",fontSize:"$font$size",color:"$syntax$color$plain",lineHeight:"$font$lineHeight"}),tM=em(["string","plain","comment","keyword","definition","punctuation","property","tag","static"].reduce(function(e,t){var n;return B(B({},e),((n={})[".".concat(tC(t))]={color:"$syntax$color$".concat(t),fontStyle:"$syntax$fontStyle$".concat(t)},n))},{})),tL=em(((d={flex:1,position:"relative",overflow:"auto",background:"$colors$surface1",".cm-scroller":{padding:"$space$4 0"}})[".".concat(tA)]={padding:"$space$4 0"},d["@media screen and (max-width: 768px)"]={"@supports (-webkit-overflow-scrolling: touch)":{".cm-content":{fontSize:"16px"}}},d)),tF=em({margin:"0",outline:"none",height:"100%"}),tR=em(((u={fontFamily:"$font$mono",fontSize:"0.8em",position:"absolute",right:"$space$2",bottom:"$space$2",zIndex:"$top",color:"$colors$clickable",backgroundColor:"$colors$surface2",borderRadius:"99999px",padding:"calc($space$1 / 2) $space$2"})["& + .".concat(tn)]={right:"calc($space$11 * 2)"},u)),tI=function(e){var t=e.langSupport,n=e.highlightTheme,r=e.code,o=void 0===r?"":r,i=t.language.parser.parse(o),s=0,a=[],c=function(e,t){if(e>s){var n=o.slice(s,e);a.push(t?(0,y.createElement)("span",{children:n,className:t,key:"".concat(e).concat(s)}):n),s=e}};return(0,R.DM)(i,n,function(e,t,n){c(e,""),c(t,n)}),s<o.length&&(null==o?void 0:o.includes("\n"))&&a.push("\n\n"),a},tD=y.forwardRef(function(e,t){var n=e.code,r=void 0===n?"":n,o=e.filePath,i=e.fileType,s=e.onCodeUpdate,a=e.showLineNumbers,c=void 0!==a&&a,l=e.showInlineErrors,d=void 0!==l&&l,u=e.wrapContent,p=void 0!==u&&u,f=e.editorState,m=void 0===f?"pristine":f,h=e.readOnly,v=void 0!==h&&h,g=e.showReadOnly,b=e.decorators,w=e.initMode,j=void 0===w?"lazy":w,$=e.extensions,C=void 0===$?[]:$,M=e.extensionsKeymap,L=void 0===M?[]:M,F=e.additionalLanguages,I=void 0===F?[]:F,D=y.useRef(null),T=tN(D,t),H=y.useRef(),P=tw(),z=P.theme,_=P.themeId,W=y.useState(r),Z=W[0],J=W[1],V=y.useState("immediate"===j),Y=V[0],q=V[1],G=e$(),X=e9(),K=X.listen,Q=X.sandpack.autoReload,ee=y.useRef([]),et=y.useRef([]),en=(0,A.A)(D,{rootMargin:"600px 0px",threshold:.2}).isIntersecting;y.useImperativeHandle(t,function(){return{getCodemirror:function(){return H.current}}}),y.useEffect(function(){("lazy"===j||"user-visible"===j)&&en&&q(!0)},[j,en]);var er=tk(o,i,I),eo=tS(er,I),ei=N.cr.define([{tag:R._A.link,textDecoration:"underline"},{tag:R._A.emphasis,fontStyle:"italic"},{tag:R._A.strong,fontWeight:"bold"},{tag:R._A.keyword,class:tC("keyword")},{tag:[R._A.atom,R._A.number,R._A.bool],class:tC("static")},{tag:R._A.variableName,class:tC("plain")},{tag:R._A.standard(R._A.tagName),class:tC("tag")},{tag:[R._A.function(R._A.variableName),R._A.definition(R._A.function(R._A.variableName)),R._A.tagName],class:tC("definition")},{tag:R._A.propertyName,class:tC("property")},{tag:[R._A.literal,R._A.inserted],class:tC(z.syntax.string?"string":"static")},{tag:R._A.punctuation,class:tC("punctuation")},{tag:[R._A.comment,R._A.quote],class:tC("comment")}]),es=tI({langSupport:eo,highlightTheme:ei,code:r}),ea=y.useMemo(function(){return b?b.sort(function(e,t){return e.line-t.line}):b},[b]),el=v&&((null==b?void 0:b.length)===0||void 0===b);y.useEffect(function(){if(D.current&&Y&&!el){var e=D.current,t=e.querySelector(".sp-pre-placeholder");t&&e.removeChild(t);var n=new E.Lz({doc:r,extensions:[],parent:e});return n.contentDOM.setAttribute("data-gramm","false"),n.contentDOM.setAttribute("data-lt-active","false"),n.contentDOM.setAttribute("aria-label",o?"Code Editor for ".concat(ec(o)):"Code Editor"),n.contentDOM.setAttribute("tabIndex","-1"),H.current=n,function(){var e;null==(e=H.current)||e.destroy()}}},[Y,v,el]),y.useEffect(function(){if(!el&&H.current){var e=[{key:"Tab",run:function(e){(0,S.UY)(e);var t,n,r=L.find(function(e){return"Tab"===e.key});return null==(n=null==(t=null==r?void 0:r.run)?void 0:t.call(r,e))||n}},{key:"Shift-Tab",run:function(e){(0,S.Mg)({state:e.state,dispatch:e.dispatch});var t,n,r=L.find(function(e){return"Shift-Tab"===e.key});return null==(n=null==(t=null==r?void 0:r.run)?void 0:t.call(r,e))||n}},{key:"Escape",run:function(){return!!v||(D.current&&D.current.focus(),!0)}},{key:"mod-Backspace",run:S.Ce}],t=U(U([(0,E.N$)(),(0,S.b6)(),(0,k.wm)()],C,!0),[E.w4.of(U(U(U(U(U([],k.Bc,!0),S.pw,!0),S.cL,!0),e,!0),L,!0)),eo,E.Lz.theme({"&":{backgroundColor:"var(--".concat("sp","-colors-surface1)"),color:"var(--".concat("sp","-syntax-color-plain)"),height:"100%"},".cm-matchingBracket, .cm-nonmatchingBracket, &.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{color:"inherit",backgroundColor:"rgba(128,128,128,.25)",backgroundBlendMode:"difference"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-activeLine":{backgroundColor:"transparent"},"&.cm-editor.cm-focused .cm-activeLine":{backgroundColor:"var(--".concat("sp","-colors-surface3)"),borderRadius:"var(--".concat("sp","-border-radius)")},".cm-errorLine":{backgroundColor:"var(--".concat("sp","-colors-errorSurface)"),borderRadius:"var(--".concat("sp","-border-radius)")},".cm-content":{caretColor:"var(--".concat("sp","-colors-accent)"),padding:"0 var(--".concat("sp","-space-4)")},".cm-scroller":{fontFamily:"var(--".concat("sp","-font-mono)"),lineHeight:"var(--".concat("sp","-font-lineHeight)")},".cm-gutters":{backgroundColor:"var(--".concat("sp","-colors-surface1)"),color:"var(--".concat("sp","-colors-disabled)"),border:"none",paddingLeft:"var(--".concat("sp","-space-1)")},".cm-gutter.cm-lineNumbers":{fontSize:".6em"},".cm-lineNumbers .cm-gutterElement":{lineHeight:"var(--".concat("sp","-font-lineHeight)"),minWidth:"var(--".concat("sp","-space-5)")},".cm-content .cm-line":{paddingLeft:"var(--".concat("sp","-space-1)")},".cm-content.cm-readonly .cm-line":{paddingLeft:0}}),(0,N.y9)(ei),E.Lz.updateListener.of(function(e){if(e.docChanged){var t=e.state.doc.toString();J(t),null==s||s(t)}})],!1);v?(t.push(O.$t.readOnly.of(!0)),t.push(E.Lz.editable.of(!1))):(t.push((0,N.SG)()),t.push((0,E.dz)())),ea&&t.push(E.Z9.fromClass(function(){function e(e){this.decorations=this.getDecoration(e)}return e.prototype.update=function(e){},e.prototype.getDecoration=function(e){if(!ea)return E.NZ.none;var t=ea.map(function(t){var n,r,o,i=E.NZ.line({attributes:{class:null!=(n=t.className)?n:""}}),s=E.NZ.mark({class:null!=(r=t.className)?r:"",attributes:null!=(o=t.elementAttributes)?o:void 0}),a=t$(e.state.doc,{line:t.line,column:t.startColumn})+1;if(t.startColumn&&t.endColumn){var c=t$(e.state.doc,{line:t.line,column:t.endColumn})+1;return s.range(a,c)}return i.range(a)});return E.NZ.set(t)},e}(),{decorations:function(e){return e.decorations}})),p&&t.push(E.Lz.lineWrapping),c&&t.push((0,E.$K)()),d&&t.push(tE),H.current.dispatch({effects:O.Pe.reconfigure.of(t)})}},[Y,ea,c,p,_,v,el,Q]),y.useEffect(function(){var e=H.current,t=!tj(C,ee.current)||!tj(L,et.current);e&&t&&(e.dispatch({effects:O.Pe.appendConfig.of(C)}),e.dispatch({effects:O.Pe.appendConfig.of(E.w4.of(U([],L,!0)))}),ee.current=C,et.current=L)},[C,L]),y.useEffect(function(){H.current&&"dirty"===m&&window.matchMedia("(min-width: 768px)").matches&&H.current.contentDOM.focus()},[]),y.useEffect(function(){if(H.current&&"string"==typeof r&&r!==Z){var e=H.current,t=e.state.selection.ranges.some(function(e){var t=e.to,n=e.from;return t>r.length||n>r.length})?O.OF.cursor(r.length):e.state.selection,n={from:0,to:e.state.doc.length,insert:r};e.dispatch({changes:n,selection:t})}},[r]),y.useEffect(function(){if(d){var e=K(function(e){var t=H.current;"success"===e.type?null==t||t.dispatch({annotations:[new O.YH("remove-errors",!0)]}):"action"===e.type&&"show-error"===e.action&&e.path===o&&e.line&&(null==t||t.dispatch({annotations:[new O.YH("show-error",e.line)]}))});return function(){return e()}}},[K,d]);var ed=function(){var e=4;return c&&(e+=6),v||(e+=1),"var(--".concat("sp","-space-").concat(e,")")};return el?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("pre",{ref:T,className:G("cm",[G(m),G(er),tF,tM]),translate:"no",children:(0,x.jsx)("code",{className:G("pre-placeholder",[tA]),style:{marginLeft:ed()},children:es})}),v&&(void 0===g||g)&&(0,x.jsx)("span",B({className:G("read-only",[tR])},{},{children:"Read-only"}))]}):(0,x.jsx)("div",{ref:T,"aria-autocomplete":"list","aria-label":o?"Code Editor for ".concat(ec(o)):"Code Editor","aria-multiline":"true",className:G("cm",[G(m),G(er),tF,tM]),onKeyDown:function(e){"Enter"===e.key&&H.current&&(e.preventDefault(),H.current.contentDOM.focus())},role:"textbox",tabIndex:0,translate:"no",suppressHydrationWarning:!0,children:(0,x.jsx)("pre",{className:G("pre-placeholder",[tA]),style:{marginLeft:ed()},children:es})})}),tT=(0,y.forwardRef)(function(e,t){var n=e.showTabs,r=e.showLineNumbers,o=e.showInlineErrors,i=e.showRunButton,s=e.wrapContent,a=e.closableTabs,c=e.initMode,l=e.extensions,d=e.extensionsKeymap,u=e.readOnly,p=e.showReadOnly,f=e.additionalLanguages,m=e.className,h=P(e,["showTabs","showLineNumbers","showInlineErrors","showRunButton","wrapContent","closableTabs","initMode","extensions","extensionsKeymap","readOnly","showReadOnly","additionalLanguages","className"]),v=e9().sandpack,g=te(),b=g.code,w=g.updateCode,j=g.readOnly,$=v.activeFile,C=v.status,k=v.editorState,S=null!=n?n:v.visibleFiles.length>1,N=e$(),O=function(e,t){void 0===t&&(t=!0),w(e,t)},E="function"==typeof y.useId?(0,y.useId)():ep();return(0,x.jsxs)(ty,B({className:N("editor",[m])},h,{children:[S&&(0,x.jsx)(th,{activeFileUniqueId:E,closableTabs:void 0!==a&&a}),(0,x.jsxs)("div",{"aria-labelledby":"".concat($,"-").concat(E,"-tab"),className:N("code-editor",[tL]),id:"".concat($,"-").concat(E,"-tab-panel"),role:"tabpanel",children:[(0,x.jsx)(tD,{ref:t,additionalLanguages:f,code:b,editorState:k,extensions:l,extensionsKeymap:d,filePath:$,initMode:c||v.initMode,onCodeUpdate:function(e){var t;return O(e,null==(t=v.autoReload)||t)},readOnly:u||j,showInlineErrors:void 0!==o&&o,showLineNumbers:void 0!==r&&r,showReadOnly:p,wrapContent:void 0!==s&&s},$),(void 0===i||i)&&(!v.autoReload||"idle"===C)?(0,x.jsx)(tb,{}):null]})]}))}),tH=em(((p={border:"1px solid $colors$surface2",display:"flex",flexWrap:"wrap",alignItems:"stretch",borderRadius:"$border$radius",overflow:"hidden",position:"relative",backgroundColor:"$colors$surface2",gap:1})["> .".concat(tx)]={flexGrow:1,flexShrink:1,flexBasis:"0",height:"$layout$height",overflow:"hidden","@media print":{height:"auto",display:"block"},"@media screen and (max-width: 768px)":((f={})["&:not(.".concat("sp","-preview, .").concat("sp","-editor, .").concat("sp","-preset-column)")]={height:"calc($layout$height / 2)"},f.minWidth="100%;",f)},p["> .".concat("sp","-file-explorer")]={flex:.2,minWidth:200,"@media screen and (max-width: 768px)":{flex:1}},p)),tB=y.forwardRef(function(e,t){var n=e.children,r=e.className,o=P(e,["children","className"]),i=e9().sandpack,s=e$(),a=tN(i.lazyAnchorRef,t);return(0,x.jsx)("div",B({ref:a,className:s("layout",[tH,r])},o,{children:n}))}),tP=function(){var e,t=e9().sandpack.error;return null!=(e=null==t?void 0:t.message)?e:null},tz=function(e,t){var n=e9(),r=n.sandpack,o=n.listen,i=y.useState("LOADING"),s=i[0],a=i[1];return(y.useEffect(function(){var t=o(function(e){"start"===e.type&&!0===e.firstLoad&&a("LOADING"),"done"===e.type&&a(function(e){return"LOADING"===e?"PRE_FADING":"HIDDEN"})},e);return function(){t()}},[e,"idle"===r.status]),y.useEffect(function(){var e;return"PRE_FADING"!==s||t?"FADING"===s&&(e=setTimeout(function(){return a("HIDDEN")},200)):a("FADING"),function(){clearTimeout(e)}},[s,t]),"timeout"===r.status)?"TIMEOUT":"running"!==r.status?"HIDDEN":s},t_=function(e){var t=e9().dispatch;return{refresh:function(){return t({type:"refresh"},e)},back:function(){return t({type:"urlback"},e)},forward:function(){return t({type:"urlforward"},e)}}},tU=function(e){var t=e9(),n=t.sandpack,r=t.listen,o=t.dispatch,i=y.useRef(null),s=y.useRef(ep());return y.useEffect(function(){var t=i.current,r=s.current;return null!==t&&n.registerBundler(t,r,e),function(){return n.unregisterBundler(r)}},[]),{sandpack:n,getClient:function(){return n.clients[s.current]||null},clientId:s.current,iframe:i,listen:function(e){return r(e,s.current)},dispatch:function(e){return o(e,s.current)}}},tW=function(e){var t=e9().dispatch;return{restart:function(){return t({type:"shell/restart"},e)},openPreview:function(){return t({type:"shell/openPreview"},e)}}},tZ=function(e,t){var n;switch(e.state){case"downloading_manifest":return"[1/3] Downloading manifest";case"downloaded_module":return"[2/3] Downloaded ".concat(e.name," (").concat(t-e.totalPending,"/").concat(t,")");case"starting_command":return"[3/3] Starting command";case"command_running":return'[3/3] Running "'.concat(null==(n=e.command)?void 0:n.trim(),'"')}},tJ=function(e){var t=y.useState(!1),n=t[0],r=t[1],o=y.useState(),i=o[0],s=o[1],a=y.useState(null),c=a[0],l=a[1],d=null==e?void 0:e.timeout,u=null==e?void 0:e.clientId,p=e9().listen;return y.useEffect(function(){var e,t=p(function(t){"start"===t.type&&t.firstLoad&&r(!1),d&&(e=setTimeout(function(){l(null)},d)),"dependencies"===t.type?l(function(){switch(t.data.state){case"downloading_manifest":return"[1/3] Downloading manifest";case"downloaded_module":return"[2/3] Downloaded ".concat(t.data.name," (").concat(t.data.progress,"/").concat(t.data.total,")");case"starting":return"[3/3] Starting"}return null}):"shell/progress"!==t.type||n||(i||"downloaded_module"!==t.data.state||s(t.data.totalPending),void 0!==i&&l(tZ(t.data,i))),"done"===t.type&&!1===t.compilatonError&&(l(null),r(!0),clearTimeout(e))},u);return function(){e&&clearTimeout(e),t()}},[u,n,i,d]),c},tV=function(e){var t=e.clientId,n=e.maxMessageCount,r=void 0===n?800:n;e.resetOnPreviewRestart;var o=y.useState([]),i=o[0],s=o[1],a=e9().listen;return y.useEffect(function(){return a(function(e){"start"===e.type?s([]):"stdout"===e.type&&e.payload.data&&e.payload.data.trim()&&s(function(t){for(var n=U(U([],t,!0),[{data:e.payload.data,id:ep()}],!1);n.length>r;)n.shift();return n})},t)},[r,t]),{logs:i,reset:function(){return s([])}}},tY=function(e){var t=e.replace("[sandpack-client]: ","");if(/process.exit/.test(t)){var n=t.match(/process.exit\((\d+)\)/);return n?0===Number(n[1])?"Server is not running, would you like to start it again?":"Server has crashed with status code ".concat(n[1],", would you like to restart the server?"):t}return t},tq=function(e){var t=e.children,n=e.className,r=P(e,["children","className"]),o=tP(),i=tW().restart,s=e$(),a=e9().sandpack,c=a.runSandpack,l=a.teamId,d=e9().dispatch;if(!o&&!t)return null;var u=null==o?void 0:o.startsWith("[sandpack-client]");return(null==o?void 0:o.includes("NPM_REGISTRY_UNAUTHENTICATED_REQUEST"))?(0,x.jsxs)("div",B({className:s("overlay",[s("error"),ts,tc,n])},e,{children:[(0,x.jsx)("p",{className:s("error-message",[tl]),children:(0,x.jsx)("strong",{children:"Unable to fetch required dependency."})}),(0,x.jsx)("div",{className:s("error-message",[tl]),children:(0,x.jsxs)("p",{children:["Authentication required. Please sign in to your account (make sure to allow pop-ups to this page) and try again. If the issue persists, contact"," ",(0,x.jsx)("a",{href:"mailto:hello@codesandbox.io?subject=Sandpack Timeout Error",children:"support"})," ","for further assistance."]})}),(0,x.jsx)("div",{children:(0,x.jsxs)("button",{className:s("button",[tn,tt,tr]),onClick:function(){l&&d({type:"sign-in",teamId:l})},children:[(0,x.jsx)(Z,{}),(0,x.jsx)("span",{children:"Sign in"})]})})]})):u&&o?(0,x.jsx)("div",B({className:s("overlay",[s("error"),ts,tc,n])},r,{children:(0,x.jsxs)("div",{className:s("error-message",[tl]),children:[(0,x.jsx)("p",{className:s("error-title",[em({fontWeight:"bold"})]),children:"Couldn't connect to server"}),(0,x.jsx)("p",{children:tY(o)}),(0,x.jsx)("div",{children:(0,x.jsxs)("button",{className:s("button",[s("icon-standalone"),tn,tt,tr]),onClick:function(){i(),c()},title:"Restart script",type:"button",children:[(0,x.jsx)(V,{})," ",(0,x.jsx)("span",{children:"Restart"})]})})]})})):(0,x.jsxs)("div",B({className:s("overlay",[s("error"),ts,ta({solidBg:!0}),n]),translate:"no"},r,{children:[(0,x.jsx)("p",{className:s("error-message",[tl]),children:(0,x.jsx)("strong",{children:"Something went wrong"})}),(0,x.jsx)("p",{className:s("error-message",[tl({errorCode:!0})]),children:o||t})]}))};function tG(e,t,n,r){var o,i,s=t?null:function(e){var t={};switch(e.bg&&(t.backgroundColor="rgb(".concat(e.bg,")")),e.fg&&(t.color="rgb(".concat(e.fg,")")),e.decoration){case"bold":t.fontWeight="bold";break;case"dim":t.opacity="0.5";break;case"italic":t.fontStyle="italic";break;case"hidden":t.visibility="hidden";break;case"strikethrough":t.textDecoration="line-through";break;case"underline":t.textDecoration="underline";break;case"blink":t.textDecoration="blink"}return t}(n),a=t?(o="",(n.bg&&(o+="".concat(n.bg,"-bg ")),n.fg&&(o+="".concat(n.fg,"-fg ")),n.decoration&&(o+="ansi-".concat(n.decoration," ")),""===o)?null:o=o.substring(0,o.length-1)):null;if(!e)return y.createElement("span",{style:s,key:r,className:a},n.content);for(var c=[],l=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,d=0;null!==(i=l.exec(n.content));){var u=i[1],p=i[2],f=i.index+u.length;f>d&&c.push(n.content.substring(d,f));var m=p.startsWith("www.")?"http://".concat(p):p;c.push(y.createElement("a",{key:d,href:m,target:"_blank"},"".concat(p))),d=l.lastIndex}return d<n.content.length&&c.push(n.content.substring(d)),y.createElement("span",{style:s,key:r,className:a},c)}function tX(e){var t,n,r=e.className,o=e.useClasses,i=e.children,s=e.linkify;return y.createElement("code",{className:r},(t=null!=i?i:"",void 0===(n=null!=o&&o)&&(n=!1),t=(0,D.escapeCarriageReturn)(function(e){var t=e;do t=(e=t).replace(/[^\n]\x08/gm,"");while(t.length<e.length);return e}(t)),I.ansiToJson(t,{json:!0,remove_empty:!0,use_classes:n})).map(tG.bind(null,null!=s&&s,null!=o&&o)))}var tK=function(e){var t=e.data,n=e$();return(0,x.jsx)(x.Fragment,{children:t.map(function(e){var t=e.data,r=e.id;return(0,x.jsx)("div",{className:n("console-item",[tQ]),children:(0,x.jsx)(tX,{children:t})},r)})})},tQ=em({width:"100%",padding:"$space$3 $space$2",fontSize:".85em",position:"relative",whiteSpace:"pre","&:not(:first-child):after":{content:"",position:"absolute",top:0,left:0,right:0,height:1,background:"$colors$surface3"}}),t0="https://codesandbox.io/api/v1/sandboxes/define",t1=function(e,t){var n,r=Object.keys(e).reduce(function(t,n){var r,o=n.replace("/",""),i={content:e[n].code,isBinary:!1};return B(B({},t),((r={})[o]=i,r))},{});return n=B({files:r},t?{template:t}:null),T.compressToBase64(JSON.stringify(n)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},t3=function(e){var t=e9().sandpack;return t.exportOptions?(0,x.jsx)(t2,B({state:t},e)):(0,x.jsx)(t5,B({state:t},e))},t2=function(e){var t=e.children,n=e.state,r=P(e,["children","state"]);return(0,x.jsx)("button",B({onClick:function(){return z(void 0,void 0,void 0,function(){var e,t,r;return _(this,function(o){switch(o.label){case 0:if(!(null==(r=n.exportOptions)?void 0:r.apiToken))throw Error("Missing `apiToken` property");return e=Object.keys(n.files).reduce(function(e,t){var r,o=t.replace("/","");return B(B({},e),((r={})[o]=n.files[t],r))},{}),[4,fetch("https://api.codesandbox.io/sandbox",{method:"POST",body:JSON.stringify({template:n.environment,files:e,privacy:2*("public"!==n.exportOptions.privacy)}),headers:{Authorization:"Bearer ".concat(n.exportOptions.apiToken),"Content-Type":"application/json","X-CSB-API-Version":"2023-07-01"}})];case 1:return[4,o.sent().json()];case 2:return t=o.sent(),window.open("https://codesandbox.io/p/sandbox/".concat(t.data.alias,"?file=/").concat(n.activeFile,"&utm-source=storybook-addon"),"_blank"),[2]}})})},title:"Export to workspace in CodeSandbox",type:"button"},r,{children:t}))},t5=function(e){var t,n,r,o=e.children,i=e.state,s=P(e,["children","state"]),a=y.useRef(null),c=y.useState(),l=c[0],d=c[1];return(y.useEffect(function(){var e=setTimeout(function(){d(new URLSearchParams({parameters:t1(i.files,i.environment),query:new URLSearchParams({file:i.activeFile,utm_medium:"sandpack"}).toString()}))},600);return function(){clearTimeout(e)}},[i.activeFile,i.environment,i.files]),(null!=(r=null==(n=null==(t=null==l?void 0:l.get)?void 0:t.call(l,"parameters"))?void 0:n.length)?r:0)>1500)?(0,x.jsxs)("button",B({onClick:function(){var e;return null==(e=a.current)?void 0:e.submit()},title:"Open in CodeSandbox",type:"button"},s,{children:[(0,x.jsxs)("form",{ref:a,action:t0,method:"POST",style:{visibility:"hidden"},target:"_blank",children:[(0,x.jsx)("input",{name:"environment",type:"hidden",value:"node"===i.environment?"server":i.environment}),Array.from(l,function(e){var t=e[0],n=e[1];return(0,x.jsx)("input",{name:t,type:"hidden",value:n},t)})]}),o]})):(0,x.jsx)("a",B({href:"".concat(t0,"?").concat(null==l?void 0:l.toString(),"&environment=").concat("node"===i.environment?"server":i.environment),rel:"noreferrer noopener",target:"_blank",title:"Open in CodeSandbox"},s,{children:o}))},t6=function(){var e=e$();return(0,x.jsxs)(t3,{className:e("button",[e("icon-standalone"),tn,tt,tr]),children:[(0,x.jsx)(Q,{}),(0,x.jsx)("span",{children:"Open Sandbox"})]})},t4=em({transform:"translate(-4px, 9px) scale(0.13, 0.13)","*":{position:"absolute",width:"96px",height:"96px"}}),t7=em(((m={position:"absolute",right:"$space$2",bottom:"$space$2",zIndex:"$top",width:"32px",height:"32px",borderRadius:"$border$radius"})[".".concat(t4)]={display:"flex"},m[".sp-button.".concat(tn)]={display:"none"},m["&:hover .sp-button.".concat(tn)]={display:"flex"},m["&:hover .sp-button.".concat(tn," > span")]={display:"none"},m["&:hover .".concat(t4)]={display:"none"},m)),t8=eh({"0%":{transform:"rotateX(-25.5deg) rotateY(45deg)"},"100%":{transform:"rotateX(-25.5deg) rotateY(405deg)"}}),t9=em({animation:"".concat(t8," 1s linear infinite"),animationFillMode:"forwards",transformStyle:"preserve-3d",transform:"rotateX(-25.5deg) rotateY(45deg)","*":{border:"10px solid $colors$clickable",borderRadius:"8px",background:"$colors$surface1"},".top":{transform:"rotateX(90deg) translateZ(44px)",transformOrigin:"50% 50%"},".bottom":{transform:"rotateX(-90deg) translateZ(44px)",transformOrigin:"50% 50%"},".front":{transform:"rotateY(0deg) translateZ(44px)",transformOrigin:"50% 50%"},".back":{transform:"rotateY(-180deg) translateZ(44px)",transformOrigin:"50% 50%"},".left":{transform:"rotateY(-90deg) translateZ(44px)",transformOrigin:"50% 50%"},".right":{transform:"rotateY(90deg) translateZ(44px)",transformOrigin:"50% 50%"}}),ne=function(e){var t=e.className,n=e.showOpenInCodeSandbox,r=P(e,["className","showOpenInCodeSandbox"]),o=e$();return(0,x.jsxs)("div",B({className:o("cube-wrapper",[t7,t]),title:"Open in CodeSandbox"},r,{children:[n&&(0,x.jsx)(t6,{}),(0,x.jsx)("div",{className:o("cube",[t4]),children:(0,x.jsxs)("div",{className:o("sides",[t9]),children:[(0,x.jsx)("div",{className:"top"}),(0,x.jsx)("div",{className:"right"}),(0,x.jsx)("div",{className:"bottom"}),(0,x.jsx)("div",{className:"left"}),(0,x.jsx)("div",{className:"front"}),(0,x.jsx)("div",{className:"back"})]})})]}))},nt=em({backgroundColor:"$colors$surface1"}),nn=function(e){var t=e.clientId,n=e.loading,r=e.className,o=e.style,i=e.showOpenInCodeSandbox,s=P(e,["clientId","loading","className","style","showOpenInCodeSandbox"]),a=e$(),c=e9().sandpack,l=c.runSandpack,d=c.environment,u=y.useState(!1),p=u[0],f=u[1],m=tz(t,n),h=tJ({clientId:t}),v=tV({clientId:t}).logs;return(y.useEffect(function(){var e;return(null==h?void 0:h.includes("Running"))&&(e=setTimeout(function(){f(!0)},3e3)),function(){e&&clearTimeout(e)}},[h]),"HIDDEN"===m)?null:"TIMEOUT"===m?(0,x.jsx)("div",B({className:a("overlay",[a("error"),ts,ta,tc,r])},s,{children:(0,x.jsxs)("div",{className:a("error-message",[tl]),children:[(0,x.jsx)("p",{className:a("error-title",[em({fontWeight:"bold"})]),children:"Couldn't connect to server"}),(0,x.jsx)("div",{className:a("error-message",[tl]),children:(0,x.jsxs)("p",{children:["This means sandpack cannot connect to the runtime or your network is having some issues. Please check the network tab in your browser and try again. If the problem persists, report it via"," ",(0,x.jsx)("a",{href:"mailto:hello@codesandbox.io?subject=Sandpack Timeout Error",children:"email"})," ","or submit an issue on"," ",(0,x.jsx)("a",{href:"https://github.com/codesandbox/sandpack/issues",rel:"noreferrer noopener",target:"_blank",children:"GitHub."})]})}),(0,x.jsxs)("p",{className:a("error-message",[tl({errorCode:!0})]),children:["ENV: ",d,(0,x.jsx)("br",{}),"ERROR: TIME_OUT"]}),(0,x.jsx)("div",{children:(0,x.jsxs)("button",{className:a("button",[a("icon-standalone"),tn,tt,tr]),onClick:l,title:"Restart script",type:"button",children:[(0,x.jsx)(V,{})," ",(0,x.jsx)("span",{children:"Try again"})]})})]})})):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",B({className:a("overlay",[a("loading"),ts,nt,r]),style:B(B({},o),{opacity:+("LOADING"===m||"PRE_FADING"===m),transition:"opacity ".concat(200,"ms ease-out")})},s,{children:[p&&(0,x.jsx)("div",{className:nr.toString(),children:(0,x.jsx)(tK,{data:v})}),(0,x.jsx)(ne,{showOpenInCodeSandbox:i})]})),h&&(0,x.jsx)("div",{className:no.toString(),children:(0,x.jsx)("p",{children:h})})]})},nr=em({position:"absolute",left:0,right:0,bottom:"$space$8",overflow:"auto",opacity:.5,overflowX:"hidden"}),no=em({position:"absolute",left:"$space$5",bottom:"$space$4",zIndex:"$top",color:"$colors$clickable",animation:"".concat(ti," 150ms ease"),fontFamily:"$font$mono",fontSize:".8em",width:"75%",p:{whiteSpace:"nowrap",margin:0,textOverflow:"ellipsis",overflow:"hidden"}}),ni=function(e){var t=tJ({timeout:3e3,clientId:e.clientId});return t?(0,x.jsx)("div",{className:ns.toString(),children:(0,x.jsx)("p",{children:t})}):null},ns=em({position:"absolute",left:"$space$5",bottom:"$space$4",zIndex:"$top",color:"$colors$clickable",animation:"".concat(ti," 150ms ease"),fontFamily:"$font$mono",fontSize:".8em",width:"75%",p:{whiteSpace:"nowrap",margin:0,textOverflow:"ellipsis",overflow:"hidden"}}),na=em({borderRadius:"0",width:"100%",padding:0,marginBottom:"$space$2",span:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},svg:{marginRight:"$space$1"}}),nc=function(e){var t=e.selectFile,n=e.path,r=e.active,o=e.onClick,i=e.depth,s=e.isDirOpen,a=e$(),c=n.split("/").filter(Boolean).pop();return jsxs("button",{className:a("button",[a("explorer"),tn,na]),"data-active":r,onClick:function(e){t&&t(n),null==o||o(e)},style:{paddingLeft:18*i+"px"},title:c,type:"button",children:[t?jsx(en,{}):s?jsx(ee,{}):jsx(et,{}),jsx("span",{children:c})]})},nl=function(e){var t=e.prefixedPath,n=e.files,r=e.selectFile,o=e.activeFile,i=e.depth,s=e.autoHiddenFiles,a=e.visibleFiles,c=e.initialCollapsedFolder,l=React.useState(!(null==c?void 0:c.includes(t))),d=l[0],u=l[1];return jsxs("div",{children:[jsx(nc,{depth:i,isDirOpen:d,onClick:function(){return u(function(e){return!e})},path:t+"/"}),d&&jsx(nu,{activeFile:o,autoHiddenFiles:s,depth:i+1,files:n,initialCollapsedFolder:c,prefixedPath:t,selectFile:r,visibleFiles:a})]},t)},nd=function(e){var t=e.autoHiddenFiles,n=e.visibleFiles,r=e.files,o=e.prefixedPath,i=n.length>0,s=t&&!i,a=t&&!!i,c=Object.keys(r).filter(function(e){var t,i=e.startsWith(o);return a?i&&n.includes(e):s?i&&!(null==(t=r[e])?void 0:t.hidden):i}).map(function(e){return e.substring(o.length)}),l=new Set(c.filter(function(e){return e.includes("/")}).map(function(e){return"".concat(o).concat(e.split("/")[0],"/")})),d=c.filter(function(e){return!e.includes("/")}).map(function(e){return"".concat(o).concat(e)});return{directories:Array.from(l),modules:d}},nu=function(e){var t=e.depth,n=void 0===t?0:t,r=e.activeFile,o=e.selectFile,i=e.prefixedPath,s=e.files,a=e.autoHiddenFiles,c=e.visibleFiles,l=e.initialCollapsedFolder,d=nd({visibleFiles:c,autoHiddenFiles:a,prefixedPath:i,files:s}),u=d.directories,p=d.modules;return jsxs("div",{children:[u.map(function(e){return jsx(nl,{activeFile:r,autoHiddenFiles:a,depth:n,files:s,initialCollapsedFolder:l,prefixedPath:e,selectFile:o,visibleFiles:c},e)}),p.map(function(e){return jsx(nc,{active:r===e,depth:n,path:e,selectFile:o},e)})]})},np=(em({padding:"$space$3",overflow:"auto",height:"100%"}),function(e){var t=e.match(/(https?:\/\/.*?)\//);return t&&t[1]?[t[1],e.replace(t[1],"")]:[e,"/"]}),nf=em({display:"flex",alignItems:"center",height:"$layout$headerHeight",borderBottom:"1px solid $colors$surface2",padding:"$space$3 $space$2",background:"$colors$surface1"}),nm=em({backgroundColor:"$colors$surface2",color:"$colors$clickable",padding:"$space$1 $space$3",borderRadius:"99999px",border:"1px solid $colors$surface2",height:"24px",lineHeight:"24px",fontSize:"inherit",outline:"none",flex:1,marginLeft:"$space$4",width:"0",transition:"background $transitions$default","&:hover":{backgroundColor:"$colors$surface3"},"&:focus":{backgroundColor:"$surface1",border:"1px solid $colors$accent",color:"$colors$base"}}),nh=function(e){var t,n=e.clientId,r=e.onURLChange,o=e.className,i=e.startRoute,s=P(e,["clientId","onURLChange","className","startRoute"]),a=y.useState(""),c=a[0],l=a[1],d=e9(),u=d.sandpack,p=d.dispatch,f=d.listen,m=y.useState(null!=(t=null!=i?i:u.startRoute)?t:"/"),h=m[0],v=m[1],g=y.useState(!1),b=g[0],w=g[1],j=y.useState(!1),$=j[0],C=j[1],k=e$();y.useEffect(function(){var e=f(function(e){if("urlchange"===e.type){var t=e.url,n=e.back,r=e.forward,o=np(t),i=o[0],s=o[1];l(i),v(s),w(n),C(r)}},n);return function(){return e()}},[]);var S=k("button",[k("icon"),tn,to,em({minWidth:"$space$6",justifyContent:"center"})]);return(0,x.jsxs)("div",B({className:k("navigator",[nf,o])},s,{children:[(0,x.jsx)("button",{"aria-label":"Go back one page",className:S,disabled:!b,onClick:function(){p({type:"urlback"})},type:"button",children:(0,x.jsx)(q,{})}),(0,x.jsx)("button",{"aria-label":"Go forward one page",className:S,disabled:!$,onClick:function(){p({type:"urlforward"})},type:"button",children:(0,x.jsx)(G,{})}),(0,x.jsx)("button",{"aria-label":"Refresh page",className:S,onClick:function(){p({type:"refresh"})},type:"button",children:(0,x.jsx)(X,{})}),(0,x.jsx)("input",{"aria-label":"Current Sandpack URL",className:k("input",[nm]),name:"Current Sandpack URL",onChange:function(e){v(e.target.value.startsWith("/")?e.target.value:"/".concat(e.target.value))},onKeyDown:function(e){"Enter"===e.code&&(e.preventDefault(),e.stopPropagation(),"function"==typeof r&&r(c+e.currentTarget.value))},type:"text",value:h})]}))},nv=em(((h={flex:1,display:"flex",flexDirection:"column",background:"white",overflow:"auto",position:"relative"})[".".concat("sp","-bridge-frame")]={border:0,position:"absolute",left:"$space$2",bottom:"$space$2",zIndex:"$top",height:12,width:"30%",mixBlendMode:"multiply",pointerEvents:"none"},h)),ng=em({border:"0",outline:"0",width:"100%",height:"100%",minHeight:"160px",maxHeight:"2000px",flex:1}),nb=em({display:"flex",position:"absolute",bottom:"$space$2",right:"$space$2",zIndex:"$overlay",gap:"$space$2"}),nx=y.forwardRef(function(e,t){var n=e.showNavigator,r=void 0!==n&&n,o=e.showRefreshButton,i=e.showOpenInCodeSandbox,s=void 0===i||i,a=e.showSandpackErrorOverlay;e.showOpenNewtab;var c=e.showRestartButton,l=e.actionsChildren,d=void 0===l?(0,x.jsx)(x.Fragment,{}):l,u=e.children,p=e.className,f=e.startRoute,m=void 0===f?"/":f,h=P(e,["showNavigator","showRefreshButton","showOpenInCodeSandbox","showSandpackErrorOverlay","showOpenNewtab","showRestartButton","actionsChildren","children","className","startRoute"]),v=tU({startRoute:m}),g=v.sandpack,b=v.listen,w=v.iframe,j=v.getClient,$=v.clientId,C=v.dispatch,k=y.useState(null),S=k[0],N=k[1],O=g.status,E=t_($).refresh,A=tW($).restart,M=e$();return y.useEffect(function(){return b(function(e){"resize"===e.type&&N(e.height)})},[]),y.useImperativeHandle(t,function(){return{clientId:$,getClient:j}},[j,$]),(0,x.jsxs)(ty,B({className:M("preview",[p])},h,{children:[r&&(0,x.jsx)(nh,{clientId:$,onURLChange:function(e){w.current&&(w.current.src=e)},startRoute:m}),(0,x.jsxs)("div",{className:M("preview-container",[nv]),children:[(0,x.jsx)("iframe",{ref:w,className:M("preview-iframe",[ng]),style:{height:S||void 0},title:"Sandpack Preview"}),(0,x.jsxs)("div",{className:M("preview-actions",[nb]),children:[d,(void 0===c||c)&&"node"===g.environment&&(0,x.jsx)(tv,{onClick:A,children:(0,x.jsx)(V,{})}),!r&&(void 0===o||o)&&"running"===O&&(0,x.jsx)(tv,{onClick:E,children:(0,x.jsx)(X,{})}),g.teamId&&(0,x.jsx)("button",{className:M("button",[M("icon-standalone"),tn,tt,tr]),onClick:function(){return C({type:"sign-out"})},title:"Sign out",type:"button",children:(0,x.jsx)(J,{})}),s&&(0,x.jsx)(t6,{})]}),(0,x.jsx)(nn,{clientId:$,showOpenInCodeSandbox:s}),(void 0===a||a)&&(0,x.jsx)(tq,{}),u]})]}))}),ny=(em(((v={display:"flex",flexDirection:"column",width:"100%",position:"relative",overflow:"auto",minHeight:"160px",flex:1})[".".concat("sp","-stack")]={height:"100%"},v)),em({justifyContent:"space-between",borderBottom:"1px solid $colors$surface2",padding:"0 $space$2",fontFamily:"$font$mono",height:"$layout$headerHeight",minHeight:"$layout$headerHeight",overflowX:"auto",whiteSpace:"nowrap"})),nw=em({display:"flex",flexDirection:"row",alignItems:"center",gap:"$space$2"}),nj=function(e){var t=e.status,n=e.suiteOnly,r=e.setSuiteOnly,o=e.setVerbose,i=e.verbose,s=e.watchMode,a=e.setWatchMode,c=e.showSuitesOnly,l=e.showWatchButton,d=e.showVerboseButton,u=e.hideTestsAndSupressLogs,p=e$(),f=p("test-header-button",[tn,tr,em({padding:"$space$1 $space$3"})]);return(0,x.jsxs)("div",{className:p("test-header",[ny,nw]),children:[(0,x.jsx)("div",{className:p("test-header-wrapper",[nw]),children:(0,x.jsxs)("p",{className:p("test-header-title",[em({lineHeight:1,margin:0,color:"$colors$base",fontSize:"$font$size",display:"flex",alignItems:"center",gap:"$space$2"})]),children:[(0,x.jsx)(eo,{}),"Tests"]})}),(0,x.jsxs)("div",{className:p("test-header-actions",[nw]),children:[c&&(0,x.jsx)("button",{className:f,"data-active":n,disabled:"initialising"===t,onClick:r,type:"button",children:"Suite only"}),d&&(0,x.jsx)("button",{className:f,"data-active":i,disabled:"initialising"===t||u,onClick:o,type:"button",children:"Verbose"}),l&&(0,x.jsx)("button",{className:f,"data-active":s,disabled:"initialising"===t,onClick:a,type:"button",children:"Watch"})]})]})},n$=function(e){var t=e.onClick;return(0,x.jsx)(tv,{onClick:t,title:"Run tests",children:(0,x.jsx)(Y,{})})},nC=em({variants:{status:{pass:{color:"var(--test-pass)"},fail:{color:"var(--test-fail)"},skip:{color:"var(--test-skip)"},title:{color:"var(--test-title)"}}}}),nk=nC({status:"pass"}),nS=nC({status:"fail"}),nN=nC({status:"skip"}),nO=nC({status:"title"}),nE=em({variants:{status:{pass:{background:"var(--test-pass)",color:"$colors$surface1"},fail:{background:"var(--test-fail)",color:"$colors$surface1"},run:{background:"var(--test-run)",color:"$colors$surface1"}}}}),nA=nE({status:"run"}),nM=nE({status:"pass"}),nL=nE({status:"fail"}),nF=em({marginLeft:"$space$4"}),nR=em({marginBottom:"$space$2",color:"$colors$clickable"}),nI=em({marginBottom:"$space$2",color:"$colors$hover"}),nD=em({marginLeft:"$space$2"}),nT=em({marginRight:"$space$2"}),nH=function(e){var t=e.tests;e.style;var n=e$();return(0,x.jsx)("div",{className:n("test",[nF]),children:t.map(function(e){return(0,x.jsxs)("div",{className:n("test-result",[nR]),children:["pass"===e.status&&(0,x.jsx)("span",{className:n("test-pass-text",[nk,nT]),children:"✓"}),"fail"===e.status&&(0,x.jsx)("span",{className:n("test-fail-text",[nS,nT]),children:"✕"}),"idle"===e.status&&(0,x.jsx)("span",{className:n("test-idle-text",[nN,nT]),children:"○"}),(0,x.jsx)("span",{className:n("test-name-text",[nI]),children:e.name}),void 0!==e.duration&&(0,x.jsxs)("span",{className:n("test-duration-text",[nD]),children:["(",e.duration," ms)"]})]},e.name)})})},nB=function(e){var t,n,r;return(t=Object.values(null!=(n=e.tests)?n:{})).concat.apply(t,Object.values(null!=(r=e.describes)?r:{}).map(nB))},nP=function(e){return nB(e).reduce(function(e,t){return{pass:"pass"===t.status?e.pass+1:e.pass,fail:"fail"===t.status?e.fail+1:e.fail,skip:"idle"===t.status||"running"===t.status?e.skip+1:e.skip,total:e.total+1}},{pass:0,fail:0,skip:0,total:0})},nz=function(e){var t,n;return 0===Object.values(null!=(t=e.describes)?t:{}).length&&0===Object.values(null!=(n=e.tests)?n:{}).length},n_=function(e){var t=e.length-1;return[e.slice(0,t),e[t]]},nU=function(e,t){return e.map(t).reduce(function(e,t){return e.concat(t)},[])},nW=function(e,t){return function(n){return(0,H.A)(n,e,t)}},nZ=em({color:"$colors$hover",marginBottom:"$space$2"}),nJ=em({marginLeft:"$space$4"}),nV=function(e){var t=e.describes,n=e$();return(0,x.jsx)(x.Fragment,{children:t.map(function(e){if(nz(e))return null;var t,r,o=Object.values(null!=(t=e.tests)?t:{}),i=Object.values(null!=(r=e.describes)?r:{});return(0,x.jsxs)("div",{className:n("test-describe",[nJ]),children:[(0,x.jsx)("div",{className:n("test-name",[nZ]),children:e.name}),(0,x.jsx)(nH,{tests:o}),(0,x.jsx)(nV,{describes:i})]},e.name)})})},nY=em({color:"$colors$hover",fontSize:"$font$size",padding:"$space$2",whiteSpace:"pre-wrap"}),nq=function(e){var t=e.error,n=e.path,r=e$();return(0,x.jsx)("div",{className:r("test-error",[nY]),dangerouslySetInnerHTML:{__html:nX(t,n)}})},nG=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},nX=function(e,t){var n,r,o="";if(o=e.matcherResult?"<span>".concat(nG(null!=(n=e.message)?n:"").replace(/(expected)/m,'<span class="'.concat(nk,'">$1</span>')).replace(/(received)/m,'<span class="'.concat(nS,'">$1</span>')).replace(/(Difference:)/m,"<span>$1</span>").replace(/(Expected:)(.*)/m,'<span>$1</span><span class="'.concat(nk,'">$2</span>')).replace(/(Received:)(.*)/m,'<span>$1</span><span class="'.concat(nS,'">$2</span>')).replace(/^(-.*)/gm,'<span class="'.concat(nS,'">$1</span>')).replace(/^(\+.*)/gm,'<span class="'.concat(nk,'">$1</span>')),"</span>"):nG(null!=(r=e.message)?r:""),e.mappedErrors&&e.mappedErrors[0]&&e.mappedErrors[0].fileName.endsWith(t)&&e.mappedErrors[0]._originalScriptCode){var i=e.mappedErrors[0]._originalScriptCode||[],s=Math.max.apply(Math,i.map(function(e){return(e.lineNumber+"").length}))+2,a=Array.from({length:s}).map(function(){return" "});o+="<br />",o+="<br />",o+="<div>",i.filter(function(e){return e.content.trim()}).forEach(function(e){var t=(e.lineNumber+"").length,n=U([],a,!0);n.length-=t,e.highlight&&(n.length-=2);var r=e.content.indexOf(".to"),i=Array.from({length:a.length+r-(s-1)},function(){return" "}),c=nG(e.content).replace(/(describe|test|it)(\()(&#039;|&quot;|`)(.*)(&#039;|&quot;|`)/m,'<span>$1$2$3</span><span class="'.concat(nO,'">$4</span><span>$5</span>')).replace(/(expect\()(.*)(\)\..*)(to[\w\d]*)(\()(.*)(\))/m,'<span>$1</span><span class="'.concat(nS,'">$2</span><span>$3</span><span style="text-decoration: underline; font-weight: 900">$4</span><span>$5</span><span class="').concat(nk,'">$6</span><span>$7</span>'));o+="<div ".concat(e.highlight?'style="font-weight:200;"':"",">")+(e.highlight?'<span class="'.concat(nS,'">></span> '):"")+n.join("")+nG(""+e.lineNumber)+" | "+c+"</div>"+(e.highlight?"<div>"+a.join("")+" | "+i.join("")+'<span class="'.concat(nS,'">^</span>')+"</div>":"")}),o+="</div>"}return o.replace(/(?:\r\n|\r|\n)/g,"<br />")},nK=em({display:"flex",flexDirection:"row",alignItems:"center",marginBottom:"$space$2"}),nQ=em({marginBottom:"$space$2"}),n0=em({fontWeight:"bold"}),n1=em({borderRadius:"calc($border$radius / 2)"}),n3=em({padding:"$space$1 $space$2",fontFamily:"$font$mono",textTransform:"uppercase",marginRight:"$space$2"}),n2=em({fontFamily:"$font$mono",cursor:"pointer",display:"inline-block"}),n5=em({color:"$colors$clickable",textDecorationStyle:"dotted",textDecorationLine:"underline"}),n6=em({color:"$colors$hover",fontWeight:"bold",textDecorationStyle:"dotted",textDecorationLine:"underline"}),n4=function(e){var t=e.specs,n=e.openSpec,r=e.status,o=e.verbose,i=e.hideTestsAndSupressLogs,s=e$();return(0,x.jsx)(x.Fragment,{children:t.map(function(e){if(e.error)return(0,x.jsxs)("div",{className:s("test-spec",[nQ]),children:[(0,x.jsx)(n7,{className:s("test-spec-error",[n1,nL]),children:"Error"}),(0,x.jsx)(n8,{onClick:function(){return n(e.name)},path:e.name}),(0,x.jsx)(nq,{error:e.error,path:e.name})]},e.name);if(nz(e))return null;var t=Object.values(e.tests),a=Object.values(e.describes),c=nP(e);return(0,x.jsxs)("div",{className:s("test-spec-name",[nQ]),children:[(0,x.jsxs)("div",{className:s("test-spec-name-container",[nK]),children:["complete"===r?c.fail>0?(0,x.jsx)(n7,{className:s("test-spec-complete",[n1,nL]),children:"Fail"}):(0,x.jsx)(n7,{className:s("test-spec-pass",[n1,nM]),children:"Pass"}):(0,x.jsx)(n7,{className:s("test-spec-run",[n1,nA]),children:"Run"}),(0,x.jsx)(n8,{onClick:function(){i||n(e.name)},path:e.name})]}),o&&!i&&(0,x.jsx)(nH,{tests:t}),o&&!i&&(0,x.jsx)(nV,{describes:a}),!i&&nB(e).filter(function(e){return"fail"===e.status}).map(function(e){return(0,x.jsxs)("div",{className:s("test-spec-error",[nQ]),children:[(0,x.jsxs)("div",{className:s("test-spec-error-text",[n0,nS]),children:["● ",e.blocks.join(" › ")," › ",e.name]}),e.errors.map(function(t){return(0,x.jsx)(nq,{error:t,path:e.path},"failing-".concat(e.name,"-error"))})]},"failing-".concat(e.name))})]},e.name)})})},n7=function(e){var t=e.children,n=e.className,r=e$();return(0,x.jsx)("span",{className:r("test-spec-label",[n3,n]),children:t})},n8=function(e){var t=e.onClick,n=e.path.split("/"),r=n.slice(0,n.length-1).join("/")+"/",o=n[n.length-1],i=e$();return(0,x.jsxs)("button",{className:i("test-filename",[tn,n2]),onClick:t,type:"button",children:[(0,x.jsx)("span",{className:i("test-filename-base",[n5]),children:r}),(0,x.jsx)("span",{className:i("test-filename-file",[n6]),children:o})]})},n9=em({marginBottom:"$space$2"}),re=em({fontWeight:"bold",color:"$colors$hover",whiteSpace:"pre-wrap"}),rt=em({fontWeight:"bold",color:"$colors$clickable"}),rn=function(e){var t=e.suites,n=e.tests,r=e.duration,o="Test suites: ",i=function(e){var t=Array.from({length:o.length-e.length},function(){return" "}).join("");return e+t},s=e$();return(0,x.jsxs)("div",{className:s("test-summary",[rt]),children:[(0,x.jsxs)("div",{className:s("test-summary",[n9]),children:[(0,x.jsx)("span",{className:s("test-summary-suites-label",[re]),children:o}),t.fail>0&&(0,x.jsxs)("span",{className:s("test-summary-suites-fail",[nS]),children:[t.fail," failed,"," "]}),t.pass>0&&(0,x.jsxs)("span",{className:s("test-summary-suites-pass",[nk]),children:[t.pass," passed,"," "]}),(0,x.jsxs)("span",{children:[t.total," total"]})]}),(0,x.jsxs)("div",{className:s("test-summary",[n9]),children:[(0,x.jsx)("span",{className:s("test-summary-label",[re]),children:i("Tests:")}),n.fail>0&&(0,x.jsxs)("span",{className:s("test-summary-fail",[nS]),children:[n.fail," failed,"," "]}),n.skip>0&&(0,x.jsxs)("span",{className:s("test-summary-skip",[nN]),children:[n.skip," skipped,"," "]}),n.pass>0&&(0,x.jsxs)("span",{className:s("test-summary-pass",[nk]),children:[n.pass," passed,"," "]}),(0,x.jsxs)("span",{children:[n.total," total"]})]}),(0,x.jsxs)("div",{className:s("test-summary-curation",[re]),children:[i("Time:"),r/1e3,"s"]})]})},rr=em({display:"flex",position:"absolute",bottom:"$space$2",right:"$space$2",zIndex:"$overlay","> *":{marginLeft:"$space$2"}}),ro={specs:{},status:"initialising",verbose:!1,watchMode:!0,suiteOnly:!1,specsCount:0},ri=function(e){var t,n=e.verbose,r=e.watchMode,o=e.style,i=e.className,s=e.onComplete,a=e.actionsChildren,c=e.showVerboseButton,l=e.showWatchButton,d=e.hideTestsAndSupressLogs,u=void 0!==d&&d,p=P(e,["verbose","watchMode","style","className","onComplete","actionsChildren","showVerboseButton","showWatchButton","hideTestsAndSupressLogs"]),f=tw(),m=tU(),h=m.getClient,v=m.iframe,g=m.listen,b=m.sandpack,w=y.useState(B(B({},ro),{verbose:void 0!==n&&n,watchMode:void 0===r||r})),j=w[0],$=w[1],C=y.useCallback(function(){$(function(e){return B(B({},e),{status:"running",specs:{}})});var e=h();e&&e.dispatch({type:"run-all-tests"})},[h]),k=y.useCallback(function(){$(function(e){return B(B({},e),{status:"running",specs:{}})});var e=h();e&&e.dispatch({type:"run-tests",path:b.activeFile})},[h,b.activeFile]),S=/.*\.(test|spec)\.[tj]sx?$/,N=null!==b.activeFile.match(S);y.useEffect(function(){var e=[],t="";return g(function(n){if(!j.suiteOnly||(!("path"in n)||n.path===b.activeFile)&&(!("test"in n)||!("path"in n.test)||n.test.path===b.activeFile)){if("action"===n.type&&"clear-errors"===n.action&&"jest"===n.source){t=n.path;return}if("test"===n.type){if("initialize_tests"===n.event)return(e=[],t="",j.watchMode)?C():$(function(e){return B(B({},e),{status:"idle",specs:{}})});if("test_count"===n.event)return $(function(e){return B(B({},e),{specsCount:n.count})});if("total_test_start"===n.event)return e=[],$(function(e){return B(B({},e),{status:"running"})});if("total_test_end"===n.event)return $(function(e){return void 0!==s&&s(e.specs),B(B({},e),{status:"complete"})});if("add_file"===n.event)return $(nW(["specs",n.path],{describes:{},tests:{},name:n.path}));if("remove_file"===n.event)return $(function(e){var t=Object.entries(e.specs).reduce(function(e,t){var r,o=t[0],i=t[1];return o===n.path?e:B(B({},e),((r={})[o]=i,r))},{});return B(B({},e),{specs:t})});if("file_error"===n.event)return $(nW(["specs",n.path,"error"],n.error));if("describe_start"===n.event){e.push(n.blockName);var r=n_(e),o=r[0],i=r[1],a=t;if(void 0===i)return;return $(nW(U(U(["specs",a,"describes"],nU(o,function(e){return[e,"describes"]}),!0),[i],!1),{name:n.blockName,tests:{},describes:{}}))}if("describe_end"===n.event)return void e.pop();if("add_test"===n.event){var c=n_(e),o=c[0],i=c[1],l={status:"idle",errors:[],name:n.testName,blocks:U([],e,!0),path:n.path};return void 0===i?$(nW(["specs",n.path,"tests",n.testName],l)):$(nW(U(U(["specs",n.path,"describes"],nU(o,function(e){return[e,"describes"]}),!0),[i,"tests",n.testName],!1),l))}if("test_start"===n.event){var d=n.test,u=n_(d.blocks),o=u[0],i=u[1],p={status:"running",name:d.name,blocks:d.blocks,path:d.path,errors:[]};return void 0===i?$(nW(["specs",d.path,"tests",d.name],p)):$(nW(U(U(["specs",d.path,"describes"],nU(o,function(e){return[e,"describes"]}),!0),[i,"tests",d.name],!1),p))}if("test_end"===n.event){var f=n.test,m=n_(f.blocks),o=m[0],i=m[1],h={status:f.status,errors:f.errors,duration:f.duration,name:f.name,blocks:f.blocks,path:f.path};return void 0===i?$(nW(["specs",f.path,"tests",f.name],h)):$(nW(U(U(["specs",f.path,"describes"],nU(o,function(e){return[e,"describes"]}),!0),[i,"tests",f.name],!1),h))}}}})},[j.suiteOnly,j.watchMode,b.activeFile]),y.useEffect(function(){return g(function(e){"done"===e.type&&j.watchMode&&(N?k():C())})},[k,C,j.watchMode,N]);var O=Object.values(j.specs),E=nU(O,nB).reduce(function(e,t){return e+(t.duration||0)},0),A=O.map(nP).reduce(function(e,t){return{pass:e.pass+t.pass,fail:e.fail+t.fail,skip:e.skip+t.skip,total:e.total+t.total}},{pass:0,skip:0,fail:0,total:0}),M=O.filter(function(e){var t,n;return Object.values(null!=(t=e.describes)?t:{}).length>0||Object.values(null!=(n=e.tests)?n:{}).length>0}).map(nP).reduce(function(e,t){return{pass:e.pass+ +(0===t.fail),fail:e.fail+ +(t.fail>0),total:e.total+1}},{pass:0,fail:0,total:0}),L=e$();return(0,x.jsxs)(ty,B({className:L("tests",[i]),style:B(B({},{"--test-pass":(t="dark"===f.themeMode)?"#18df16":"#15c213","--test-fail":t?"#df162b":"#c21325","--test-skip":t?"#eace2b":"#c2a813","--test-run":t?"#eace2b":"#c2a813","--test-title":t?"#3fbabe":"#256c6f"}),o)},p,{children:[(0,x.jsx)("iframe",{ref:v,style:{display:"none"},title:"Sandpack Tests"}),(0,x.jsx)(nj,{hideTestsAndSupressLogs:u,setSuiteOnly:function(){return $(function(e){return B(B({},e),{suiteOnly:!e.suiteOnly})})},setVerbose:function(){return $(function(e){return B(B({},e),{verbose:!e.verbose})})},setWatchMode:function(){$(function(e){return B(B({},e),{watchMode:!e.watchMode})})},showSuitesOnly:j.specsCount>1,showVerboseButton:void 0===c||c,showWatchButton:void 0===l||l,status:j.status,suiteOnly:j.suiteOnly,verbose:j.verbose,watchMode:j.watchMode}),"running"===j.status||"initialising"===j.status?(0,x.jsx)(ne,{showOpenInCodeSandbox:!1}):(0,x.jsxs)("div",{className:rr.toString(),children:[a,(0,x.jsx)(n$,{onClick:j.suiteOnly?k:C})]}),(0,x.jsx)("div",{className:rs.toString(),children:0===O.length&&"complete"===j.status?(0,x.jsxs)("div",{className:ra.toString(),children:[(0,x.jsx)("p",{children:"No test files found."}),(0,x.jsxs)("p",{children:["Test match:"," ",(0,x.jsx)("span",{className:nS.toString(),children:S.toString()})]})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(n4,{hideTestsAndSupressLogs:u,openSpec:function(e){b.setActiveFile(e)},specs:O,status:j.status,verbose:j.verbose}),"complete"===j.status&&A.total>0&&(0,x.jsx)(rn,{duration:E,suites:M,tests:A})]})})]}))},rs=em({padding:"$space$4",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",position:"relative",fontFamily:"$font$mono"}),ra=em({fontWeight:"bold",color:"$colors$base"}),rc=["SyntaxError: ","Error in sandbox:"],rl={id:"random",method:"clear",data:["Console was cleared"]},rd=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;throw Error("Unable to locate global object")}(),ru="function"==typeof ArrayBuffer,rp="function"==typeof Map,rf="function"==typeof Set;!function(e){e[e.infinity=0]="infinity",e[e.minusInfinity=1]="minusInfinity",e[e.minusZero=2]="minusZero"}(g||(g={}));var rm={Arithmetic:function(e){return e===g.infinity?1/0:e===g.minusInfinity?-1/0:e===g.minusZero?-0:e},HTMLElement:function(e){var t=document.implementation.createHTMLDocument("sandbox");try{var n=t.createElement(e.tagName);n.innerHTML=e.innerHTML;for(var r=0,o=Object.keys(e.attributes);r<o.length;r++){var i=o[r];try{n.setAttribute(i,e.attributes[i])}catch(e){}}return n}catch(t){return e}},Function:function(e){var t=function(){};return Object.defineProperty(t,"toString",{value:function(){return"function ".concat(e.name,"() {").concat(e.body,"}")}}),t},"[[NaN]]":function(){return NaN},"[[undefined]]":function(){},"[[Date]]":function(e){var t=new Date;return t.setTime(e),t},"[[RegExp]]":function(e){return new RegExp(e.src,e.flags)},"[[Error]]":function(e){var t=new(rd[e.name]||Error)(e.message);return t.stack=e.stack,t},"[[ArrayBuffer]]":function(e){if(ru){var t=new ArrayBuffer(e.length);return new Int8Array(t).set(e),t}return e},"[[TypedArray]]":function(e){return"function"==typeof rd[e.ctorName]?new rd[e.ctorName](e.arr):e.arr},"[[Map]]":function(e){if(rp){for(var t=new Map,n=0;n<e.length;n+=2)t.set(e[n],e[n+1]);return t}for(var r=[],o=0;o<e.length;o+=2)r.push([e[n],e[n+1]]);return r},"[[Set]]":function(e){if(rf){for(var t=new Set,n=0;n<e.length;n++)t.add(e[n]);return t}return e}},rh=function(e){var t;if("string"==typeof e||"number"==typeof e||null===e);else if(Array.isArray(e))return e.map(rh);else if("object"==typeof e&&"@t"in e){var n=e["@t"],r=rm[n];return r(e.data)}else if("object"==typeof e&&"#@t"in e){var n=e["#@t"],r=rm[n];return r(e.data)}else if("object"==typeof e&&(null==(t=e.constructor)?void 0:t.name)==="NodeList"){var o={};return Object.entries(e).forEach(function(e){var t=e[0],n=e[1];o[t]=rh(n)}),o}return e},rv=function(e,t,n){var r=e.reduce(function(e,r,o){return"".concat(e).concat(o?", ":"").concat(rb(r,t,n))},"");return"[".concat(r,"]")},rg=function(e,t,n){var r="Object"!==e.constructor.name?"".concat(e.constructor.name," "):"";if(n>2)return r;var o=Object.entries(e),i=Object.entries(e).reduce(function(e,r,i){var s=r[0],a=r[1],c=o.length>10?"\n ":"",l=rb(a,t,n);return 400===i?e+c+"...":i>400?e:e+"".concat(0===i?"":", ").concat(c).concat(s,": ")+l},"");return"".concat(r,"{ ").concat(i).concat(o.length>10?"\n":" ","}")},rb=function(e,t,n){var r;void 0===n&&(n=0);try{var o=rh(e);if(Array.isArray(o))return rv(o,t,n+1);switch(typeof o){case"string":return'"'.concat(o,'"').slice(0,1e4);case"number":case"function":case"symbol":return o.toString();case"boolean":return String(o);case"undefined":return"undefined";default:if(o instanceof RegExp||o instanceof Error||o instanceof Date)return o.toString();if(null===o)return String(null);if(o instanceof HTMLElement)return o.outerHTML.slice(0,1e4);if(0===Object.entries(o).length)return"{}";if("@r"in o){if(n>2)return"Unable to print information";var i=t[o["@r"]];return rb(i,t,n+1)}if((null==(r=o.constructor)?void 0:r.name)==="NodeList"){var s=o.length,a=Array(s).fill(null).map(function(e,n){return rb(o[n],t)});return"NodeList(".concat(o.length,")[").concat(a,"]")}return rg(o,t,n+1)}}catch(e){return"Unable to print information"}},rx=function(e){switch(e){case"warn":return"warning";case"clear":return"clear";case"error":return"error";default:return"info"}},ry=function(e){var t=e.data,n=e$();return(0,x.jsx)(x.Fragment,{children:t.map(function(e,t,r){var o=e.data,i=e.id,s=e.method;return o&&Array.isArray(o)?(0,x.jsx)(y.Fragment,{children:o.map(function(e,o){var a=r.slice(t,r.length);return(0,x.jsx)("div",{className:n("console-item",[rw({variant:rx(s)})]),children:(0,x.jsx)(tD,{code:"clear"===s?e:rb(e,a),fileType:"js",initMode:"user-visible",showReadOnly:!1,readOnly:!0,wrapContent:!0})},"".concat(i,"-").concat(o))})},i):null})})},rw=em(((b={width:"100%",padding:"$space$3 $space$2",fontSize:".8em",position:"relative","&:not(:first-child):after":{content:"",position:"absolute",top:0,left:0,right:0,height:1,background:"$colors$surface3"},".sp-cm":{padding:0},".cm-editor":{background:"none"},".cm-content":{padding:0}})[".".concat("sp","-pre-placeholder")]={margin:"0 !important",fontSize:"1em"},b.variants={variant:{error:{color:"$colors$error",background:"$colors$errorSurface","&:not(:first-child):after":{background:"$colors$error",opacity:.07}},warning:{color:"$colors$warning",background:"$colors$warningSurface","&:not(:first-child):after":{background:"$colors$warning",opacity:.07}},clear:{fontStyle:"italic"},info:{}}},b)),rj=em({justifyContent:"space-between",borderBottom:"1px solid $colors$surface2",padding:"0 $space$2",fontFamily:"$font$mono",height:"$layout$headerHeight",minHeight:"$layout$headerHeight",overflowX:"auto",whiteSpace:"nowrap"}),r$=em({display:"flex",flexDirection:"row",alignItems:"center",gap:"$space$2"}),rC=function(e){var t=e.currentTab,n=e.setCurrentTab,r=e.node,o=e$(),i=o("console-header-button",[tn,tr,em({padding:"$space$1 $space$3"})]);return(0,x.jsxs)("div",{className:o("console-header",[rj,r$]),children:[(0,x.jsxs)("p",{className:o("console-header-title",[em({lineHeight:1,margin:0,color:"$colors$base",fontSize:"$font$size",display:"flex",alignItems:"center",gap:"$space$2"})]),children:[(0,x.jsx)(eo,{}),(0,x.jsx)("span",{children:"Terminal"})]}),r&&(0,x.jsxs)("div",{className:o("console-header-actions",[r$]),children:[(0,x.jsx)("button",{className:i,"data-active":"server"===t,onClick:function(){return n("server")},type:"button",children:"Server"}),(0,x.jsx)("button",{className:i,"data-active":"client"===t,onClick:function(){return n("client")},type:"button",children:"Client"})]})]})},rk=function(e){var t=e.clientId,n=e.maxMessageCount,r=void 0===n?800:n,o=e.showSyntaxError,i=void 0!==o&&o,s=e.resetOnPreviewRestart,a=void 0!==s&&s,c=y.useState([]),l=c[0],d=c[1],u=e9().listen;return y.useEffect(function(){return u(function(e){if(a&&"start"===e.type)d([]);else if("console"===e.type&&e.codesandbox){var t=Array.isArray(e.log)?e.log:[e.log];if(t.find(function(e){return"clear"===e.method}))return d([rl]);var n=i?t:t.filter(function(e){var t,n,r;return(null!=(r=null==(n=null==(t=null==e?void 0:e.data)?void 0:t.filter)?void 0:n.call(t,function(e){return"string"!=typeof e||0===rc.filter(function(t){return e.startsWith(t)}).length}))?r:[]).length>0});if(!n)return;d(function(e){for(var t=U(U([],e,!0),n,!0).filter(function(e,t,n){return t===n.findIndex(function(t){return t.id===e.id})});t.length>r;)t.shift();return t})}},t)},[i,r,t,a]),{logs:l,reset:function(){return d([])}}},rS=y.forwardRef(function(e,t){var n,r=e.showHeader,o=e.showSyntaxError,i=e.maxMessageCount,s=e.onLogsChange,a=e.className;e.showSetupProgress;var c=e.showResetConsoleButton,l=e.showRestartButton,d=e.resetOnPreviewRestart,u=void 0!==d&&d,p=e.actionsChildren,f=void 0===p?(0,x.jsx)(x.Fragment,{}):p,m=e.standalone,h=void 0!==m&&m,v=P(e,["showHeader","showSyntaxError","maxMessageCount","onLogsChange","className","showSetupProgress","showResetConsoleButton","showRestartButton","resetOnPreviewRestart","actionsChildren","standalone"]),g=e9().sandpack.environment,b=tU(),w=b.iframe,j=b.clientId,$=tW().restart,C=y.useState("node"===g?"server":"client"),k=C[0],S=C[1],N=h?j:void 0,O=rk({maxMessageCount:i,showSyntaxError:void 0!==o&&o,resetOnPreviewRestart:u,clientId:N}),E=O.logs,A=O.reset,M=tV({maxMessageCount:i,resetOnPreviewRestart:u,clientId:N}),L=M.logs,F=M.reset,R=y.useRef(null);y.useEffect(function(){null==s||s(E),R.current&&(R.current.scrollTop=R.current.scrollHeight)},[s,E,L,k]);var I="server"===k,D="node"===g;y.useImperativeHandle(t,function(){return{reset:function(){A(),F()}}});var T=e$();return(0,x.jsxs)(ty,B({className:T("console",[em(((n={height:"100%",background:"$surface1",iframe:{display:"none"}})[".".concat("sp","-bridge-frame")]={display:"block",border:0,position:"absolute",left:"$space$2",bottom:"$space$2",zIndex:"$top",height:12,width:"30%",mixBlendMode:"multiply",pointerEvents:"none"},n)),a])},v,{children:[(void 0===r||r)&&D&&(0,x.jsx)(rC,{currentTab:k,node:D,setCurrentTab:S}),(0,x.jsx)("div",{ref:R,className:T("console-list",[em({overflow:"auto",scrollBehavior:"smooth"})]),children:I?(0,x.jsx)(tK,{data:L}):(0,x.jsx)(ry,{data:E})}),(0,x.jsxs)("div",{className:T("console-actions",[em({position:"absolute",bottom:"$space$2",right:"$space$2",display:"flex",gap:"$space$2"})]),children:[f,(void 0===l||l)&&I&&(0,x.jsx)(tv,{onClick:function(){$(),A(),F()},children:(0,x.jsx)(V,{})}),(void 0===c||c)&&(0,x.jsx)(tv,{onClick:function(){"client"===k?A():F()},children:(0,x.jsx)(K,{})})]}),h&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ni,{clientId:N}),(0,x.jsx)("iframe",{ref:w})]})]}))}),rN=function(e){var t,n,r,o,i,s,a,c,l=e.options,d=e.template,u=e.customSetup,p=e.files,f=e.theme,m=P(e,["options","template","customSetup","files","theme"]);null!=l||(l={}),null!=l.resizablePanels||(l.resizablePanels=!0),null!=l.editorWidthPercentage||(l.editorWidthPercentage=50),null!=l.showConsole||(l.showConsole=!1);var h=null!=(o=null==l?void 0:l.rtl)&&o,v={showTabs:l.showTabs,showLineNumbers:l.showLineNumbers,showInlineErrors:l.showInlineErrors,wrapContent:l.wrapContent,closableTabs:l.closableTabs,initMode:l.initMode,extensions:null==(i=l.codeEditor)?void 0:i.extensions,extensionsKeymap:null==(s=l.codeEditor)?void 0:s.extensionsKeymap,readOnly:l.readOnly,showReadOnly:l.showReadOnly,additionalLanguages:null==(a=l.codeEditor)?void 0:a.additionalLanguages},g={activeFile:l.activeFile,visibleFiles:l.visibleFiles,recompileMode:l.recompileMode,recompileDelay:l.recompileDelay,autorun:l.autorun,autoReload:l.autoReload,bundlerURL:l.bundlerURL,startRoute:l.startRoute,skipEval:l.skipEval,fileResolver:l.fileResolver,initMode:l.initMode,initModeObserverOptions:l.initModeObserverOptions,externalResources:l.externalResources,logLevel:l.logLevel,classes:l.classes,experimental_enableServiceWorker:l.experimental_enableServiceWorker,experimental_enableStableServiceWorkerId:l.experimental_enableStableServiceWorkerId},b=y.useState(l.showConsole),w=b[0],j=b[1],$=y.useState(0),C=$[0],k=$[1],S=l.showConsole||l.showConsoleButton,N=null!=(c=eX[d])?c:{},O=(null==l?void 0:l.layout)?null==l?void 0:l.layout:"mode"in N?N.mode:"preview",E=l.showConsoleButton?(0,x.jsx)(rE,{counter:C,onClick:function(){return j(function(e){return!e})}}):void 0,A=y.useRef(null),M=y.useState(l.editorWidthPercentage),L=M[0],F=M[1],R=y.useState(70),I=R[0],D=R[1],T=S?ty:y.Fragment,H={flexGrow:100-L,flexShrink:100-L,flexBasis:0,width:100-L+"%",gap:+!!w,height:l.editorHeight},z=S?{flexGrow:I,flexShrink:I,flexBasis:0,overflow:"hidden"}:H,_=function(e){if(A.current){var t=A.current.parentElement;if(t){var n="horizontal"===A.current.dataset.direction,r=t.getBoundingClientRect(),o=r.left,i=r.top,s=r.height,a=r.width,c=Math.min(Math.max(n?(e.clientX-o)/a*100:(e.clientY-i)/s*100,25),75);n?F(h?100-c:c):D(c),t.querySelectorAll(".".concat("sp","-stack")).forEach(function(e){e.style.pointerEvents="none"})}}},U=function(){var e,t=null==(e=A.current)?void 0:e.parentElement;t&&(t.querySelectorAll(".".concat("sp","-stack")).forEach(function(e){e.style.pointerEvents=""}),A.current=null)};y.useEffect(function(){if(null==l?void 0:l.resizablePanels)return document.body.addEventListener("mousemove",_),document.body.addEventListener("mouseup",U),function(){document.body.removeEventListener("mousemove",_),document.body.removeEventListener("mouseup",U)}},[l]),y.useEffect(function(){var e;j(null!=(e=null==l?void 0:l.showConsole)&&e)},[l.showConsole]);var W=S?{className:"sp-preset-column",style:H}:{},Z=e$();return(0,x.jsx)(e8,B({customSetup:u,files:p,options:g,template:d,theme:f},m,{children:(0,x.jsxs)(tB,{className:h?Z("rtl-layout",[rL]):"",children:[(0,x.jsx)(tT,B({},v,{style:{height:l.editorHeight,flexGrow:L,flexShrink:L,flexBasis:0,overflow:"hidden"}})),l.resizablePanels&&(0,x.jsx)("div",{className:Z("resize-handler",[rO({direction:"horizontal"})]),"data-direction":"horizontal",onMouseDown:function(e){A.current=e.target},style:{left:"calc(".concat(h?100-L:L,"% - 5px)")}}),(0,x.jsxs)(T,B({},W,{children:["preview"===O&&(0,x.jsx)(nx,{actionsChildren:E,showNavigator:l.showNavigator,showRefreshButton:l.showRefreshButton,style:z}),"tests"===O&&(0,x.jsx)(ri,{actionsChildren:E,style:z}),"console"===O&&(0,x.jsx)(rS,{actionsChildren:E,style:z,standalone:!0}),(l.showConsoleButton||w)&&(0,x.jsxs)(x.Fragment,{children:[l.resizablePanels&&w&&(0,x.jsx)("div",{className:Z("resize-handler",[rO({direction:"vertical"})]),"data-direction":"vertical",onMouseDown:function(e){A.current=e.target},style:{top:"calc(".concat(I,"% - 5px)")}}),(0,x.jsx)("div",{className:Z("console-wrapper",[rM]),style:{flexGrow:w?100-I:0,flexShrink:w?100-I:0,flexBasis:0},children:(0,x.jsx)(rS,{onLogsChange:function(e){return k(e.length)},showHeader:!1})})]})]}))]})}),d)},rO=em({position:"absolute",zIndex:"$top",variants:{direction:{vertical:{right:0,left:0,height:10,cursor:"ns-resize"},horizontal:{top:0,bottom:0,width:10,cursor:"ew-resize"}}},"@media screen and (max-width: 768px)":{display:"none"}}),rE=function(e){var t=e.onClick,n=e.counter;return(0,x.jsxs)(tv,{className:rA.toString(),onClick:t,children:[(0,x.jsx)(eo,{}),n>0&&(0,x.jsx)("strong",{children:n})]})},rA=em({position:"relative",strong:{background:"$colors$clickable",color:"$colors$surface1",minWidth:12,height:12,padding:"0 2px",borderRadius:12,fontSize:8,lineHeight:"12px",position:"absolute",top:0,right:0,fontWeight:"normal"}}),rM=em({width:"100%",overflow:"hidden"}),rL=em({flexDirection:"row-reverse","@media screen and (max-width: 768px)":{flexFlow:"wrap-reverse !important",flexDirection:"initial"}})}}]);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HelloGGX/shadcn-vue-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server