1import{b9 as e,r as t,ba as n,j as r,bb as o,bc as i,bd as a,be as s,bf as c,bg as l,bh as u,bi as d,bj as p,bk as f,bl as m,bm as h}from"./vendor.BfdSebvv.js";import{c as v,d as g,h as y,a as b,b as x,e as w,f as j,g as S,j as C,i as k,k as O}from"./codemirror-core.BRFVimjg.js";import{s as E,b as N,H as M}from"./codemirror-language.BwogaqY-.js";import{E as L,S as A,a as I,A as _}from"./codemirror-state.C8nmO8dc.js";import{D as T,V as R,E as D,k as P,h as F,a as U,l as H}from"./codemirror-view.EwfUXKtO.js";const z={},B=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=function(e){return Promise.all(e.map((e=>Promise.resolve(e).then((e=>({status:"fulfilled",value:e})),(e=>({status:"rejected",reason:e}))))))};const o=document.getElementsByTagName("link"),i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");r=e(t.map((e=>{if(e=function(e,t){return new URL(e,t).href}(e,n),e in z)return;z[e]=!0;const t=e.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(n)for(let n=o.length-1;n>=0;n--){const r=o[n];if(r.href===e&&(!t||"stylesheet"===r.rel))return}else if(document.querySelector(`link[href="${e}"]${r}`))return;const i=document.createElement("link");return i.rel=t?"stylesheet":"modulepreload",t||(i.as="script"),i.crossOrigin="",i.href=e,a&&i.setAttribute("nonce",a),document.head.appendChild(i),t?new Promise(((t,n)=>{i.addEventListener("load",t),i.addEventListener("error",(()=>n(new Error(`Unable to preload CSS for ${e}`))))})):void 0})))}function o(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then((t=>{for(const e of t||[])"rejected"===e.status&&o(e.reason);return e().catch(o)}))};var J=function(e,t){return(J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function W(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var V,Z,q=function(){return q=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},q.apply(this,arguments)};function Y(e,t,n,r){return new(n||(n=Promise))((function(t,o){function i(e){try{s(r.next(e))}catch(t){o(t)}}function a(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,a)}s((r=r.apply(e,[])).next())}))}function $(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(s){i=[6,s],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function G(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))}(Z=V||(V={}))[Z.None=0]="None",Z[Z.Error=10]="Error",Z[Z.Warning=20]="Warning",Z[Z.Info=30]="Info",Z[Z.Debug=40]="Debug";var K=function(e){return"[sandpack-client]: ".concat(e)};function X(t,n){return void 0===n&&(n="Value is nullish"),e(null!=t,K(n)),t}var Q='"entry" was not specified - provide either a package.json with the "main" field or an "entry" value';function ee(e,t,n){return void 0===e&&(e={}),void 0===t&&(t={}),void 0===n&&(n="/index.js"),JSON.stringify({name:"sandpack-project",main:n,dependencies:e,devDependencies:t},null,2)}function te(e,t,n,r){var o,i,a=re(e),s=a["/package.json"];if(!s)return X(t,'"dependencies" was not specified - provide either a package.json or a "dependencies" value'),X(r,Q),a["/package.json"]={code:ee(t,n,r)},a;if(s){var c=JSON.parse(s.code);X(!(!t&&!c.dependencies),Q),t&&(c.dependencies=q(q({},null!==(o=c.dependencies)&&void 0!==o?o:{}),null!=t?t:{})),n&&(c.devDependencies=q(q({},null!==(i=c.devDependencies)&&void 0!==i?i:{}),null!=n?n:{})),r&&(c.main=r),a["/package.json"]={code:JSON.stringify(c,null,2)}}return a}function ne(e){var t;if("SyntaxError"===e.title)return{title:e.title,path:e.path,message:e.message,line:e.line,column:e.column};var n=function(e){if(!e)return;return e.find((function(e){return!!e._originalFileName}))}(null===(t=e.payload)||void 0===t?void 0:t.frames);if(!n)return{message:e.message};var r,o,i,a=(o=(r=n)._originalScriptCode[r._originalScriptCode.length-1].lineNumber.toString().length,i=2+o+3+r._originalColumnNumber,r._originalScriptCode.reduce((function(e,t){var n=t.highlight?">":" ",r=t.lineNumber.toString().length===o?"".concat(t.lineNumber):" ".concat(t.lineNumber),a=t.highlight?"\n"+" ".repeat(i)+"^":"";return e+"\n"+n+" "+r+" | "+t.content+a}),"")),s=function(e){return e?" (".concat(e._originalLineNumber,":").concat(e._originalColumnNumber,")"):""}(n),c=function(e,t,n,r){return"".concat(e,": ").concat(t).concat(n,"\n").concat(r)}(n._originalFileName,e.message,s,a);return{message:c,title:e.title,path:n._originalFileName,line:n._originalLineNumber,column:n._originalColumnNumber}}var re=function(e){return"string"==typeof e?e.startsWith("/")?e:"/".concat(e):Array.isArray(e)?e.map((function(e){return e.startsWith("/")?e:"/".concat(e)})):"object"==typeof e&&null!==e?Object.entries(e).reduce((function(e,t){var n=t[0],r=t[1];return e[n.startsWith("/")?n:"/".concat(n)]=r,e}),{}):null};function oe(e,t,n){var r;return void 0===n&&(n={}),Y(this,0,void 0,(function(){var o,i;return $(this,(function(a){switch(a.label){case 0:switch(o=null!==(r=t.template)&&void 0!==r?r:"parcel",o){case"node":return[3,1];case"static":return[3,3]}return[3,5];case 1:return[4,B((()=>Promise.resolve().then((()=>Or))),void 0,import.meta.url).then((function(e){return e.SandpackNode}))];case 2:return i=a.sent(),[3,7];case 3:return[4,B((()=>Promise.resolve().then((()=>Mr))),void 0,import.meta.url).then((function(e){return e.SandpackStatic}))];case 4:return i=a.sent(),[3,7];case 5:return[4,B((()=>Promise.resolve().then((()=>$r))),void 0,import.meta.url).then((function(e){return e.SandpackRuntime}))];case 6:i=a.sent(),a.label=7;case 7:return[2,new i(e,t,n)]}}))}))}var ie=function(){return ie=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},ie.apply(this,arguments)};function ae(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}
1function se(e,t,n,r){return new(n||(n=Promise))((function(t,o){function i(e){try{s(r.next(e))}catch(t){o(t)}}function a(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,a)}s((r=r.apply(e,[])).next())}))}function ce(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(s){i=[6,s],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function le(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 ue,de=function(e){return r.jsx("svg",ie({fill:"currentColor",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg"},e))},pe=function(){return r.jsxs(de,{viewBox:"0 0 48 48",children:[r.jsx("title",{children:"Sign in"}),r.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"})]})},fe=function(){return r.jsxs(de,{viewBox:"0 0 48 48",children:[r.jsx("title",{children:"Sign out"}),r.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"})]})},me=function(){return r.jsxs(de,{fill:"none",stroke:"currentColor",children:[r.jsx("title",{children:"Restart script"}),r.jsx("path",{d:"M8 2C4.68629 2 2 4.68629 2 8C2 10.0946 3.07333 11.9385 4.7 13.0118",strokeLinecap:"round"}),r.jsx("path",{d:"M14.0005 7.9998C14.0005 5.82095 12.8391 3.91335 11.1016 2.8623",strokeLinecap:"round"}),r.jsx("path",{d:"M14.0003 2.3335H11.167C10.8908 2.3335 10.667 2.55735 10.667 2.8335V5.66683",strokeLinecap:"round"}),r.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"}),r.jsx("path",{d:"M10 10L12 12L10 14",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M14.667 14L12.667 14",strokeLinecap:"round",strokeLinejoin:"round"})]})},he=function(){return r.jsxs(de,{children:[r.jsx("title",{children:"Run sandbox"}),r.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"})]})},ve=function(){return r.jsxs(de,{children:[r.jsx("title",{children:"Click to go back"}),r.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"})]})},ge=function(){return r.jsxs(de,{children:[r.jsx("title",{children:"Click to go forward"}),r.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.12
1663 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"})]})},ye=function(){return r.jsxs(de,{children:[r.jsx("title",{children:"Refresh preview"}),r.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"})]})},be=function(){return r.jsxs(de,{fill:"none",stroke:"currentColor",children:[r.jsx("title",{children:"Clean"}),r.jsx("circle",{cx:"7.99998",cy:"8.00004",r:"4.66667",strokeLinecap:"round"}),r.jsx("path",{d:"M4.66669 4.66663L11.3334 11.3333"})]})},xe=function(){return r.jsxs(de,{fill:"none",stroke:"currentColor",children:[r.jsx("title",{children:"Open on CodeSandbox"}),r.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"}),r.jsx("path",{d:"M10 3.33337H12.5667C12.6219 3.33337 12.6667 3.37815 12.6667 3.43337V6.00004",strokeLinecap:"round"}),r.jsx("path",{d:"M7.33331 8.66668L12.5333 3.46667",strokeLinecap:"round"})]})},we=function(){return r.jsxs(de,{stroke:"currentColor",children:[r.jsx("title",{children:"Close file"}),r.jsx("path",{d:"M12 4L4 12",strokeLinecap:"round"}),r.jsx("path",{d:"M4 4L12 12",strokeLinecap:"round"})]})},je=function(){return r.jsxs(de,{children:[r.jsx("title",{children:"Open browser console"}),r.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"}),r.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"})]})},Se={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"}},Ce={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"}},ke={light:Se,dark:Ce,auto:"undefined"!=typeof window&&(null===(ue=null===window||void 0===window?void 0:window.matchMedia)||void 0===ue?void 0:ue.call(window,"(prefers-color-scheme: dark)").matches)?Ce:Se},Oe=function(e){var t=e.lastIndexOf("/");return e.slice(t+1)},Ee=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},Ne=0,Me=function(){return(+(Date.now().toString(10).substr(0,4)+Ne++)).toString(16)},Le=function(){return""},Ae=function(){return Le},Ie=Object.getOwnPropertyDescriptors({toString:Le});Object.defineProperties(Le,Ie),Object.defineProperties(Ae,Ie);var _e,Te="sp",Re=(_e={createTheme:Le,css:Ae,getCssText:Le,keyframes:Ae}).createTheme,De=_e.keyframes,Pe={space:new Array(11).fill(" ").reduce((function(e,t,n){var r;return ie(ie({},e),((r={})[n+1]="".concat(4*(n+1),"px"),r))}),{}),border:{radius:"4px"},layout:{height:"300px",headerHeight:"40px"},transitions:{default:"150ms ease"},zIndices:{base:"1",overlay:"2",top:"3"}},Fe=function(e){for(var t=0,n=0;n<e.length;t&=t)t=31*t+e.charCodeAt(n++);return Math.abs(t)},Ue=function(){return""};Ue.toString=Ue;var He=t.createContext({}),ze=function(e){var t=e.children,n=e.classes;return r.jsx(He.Provider,{value:n||{},children:t})},Be=function(){var e=t.useContext(He);return function(t,n){void 0===n&&(n=[]);var r="".concat(Te,"-").concat(t);return Je.apply(void 0,le(le([],n,!1),[r,e[r]],!1))}},Je=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(Boolean).join(" ")},We=Ue,Ve=t.createContext({theme:Se,id:"light",mode:"light"}
1),Ze=function(e){var n=e.theme,o=e.children,i=e.className,a=ae(e,["theme","children","className"]),s=t.useState(n),c=s[0],l=s[1],u=function(e){var t,n,r,o,i;if(void 0===e&&(e="light"),"string"==typeof e){var a=ke[e];if(!a)throw new Error("[sandpack-react]: invalid theme '".concat(e,"' provided."));return{theme:a,id:e,mode:Ee(a.colors.surface1)?"dark":"light"}}var s=Ee(null!==(n=null===(t=null==e?void 0:e.colors)||void 0===t?void 0:t.surface1)&&void 0!==n?n:Se.colors.surface1)?"dark":"light",c="dark"===s?Ce:Se,l={colors:ie(ie({},c.colors),null!==(r=null==e?void 0:e.colors)&&void 0!==r?r:{}),syntax:ie(ie({},c.syntax),null!==(o=null==e?void 0:e.syntax)&&void 0!==o?o:{}),font:ie(ie({},c.font),null!==(i=null==e?void 0:e.font)&&void 0!==i?i:{})},u=e?Fe(JSON.stringify(l)):"default";return{theme:l,id:"sp-".concat(u),mode:s}}(c),d=u.theme,p=u.id,f=u.mode,m=Be(),h=t.useMemo((function(){return Re(p,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 ie(ie({},e),((n={})["".concat(o,"-").concat(r)]=i,n))}),{})),ie(ie({},e),i)}),{});return ie(ie({},Pe),{colors:e.colors,font:e.font,syntax:t})}(d))}),[d,p]);return t.useEffect((function(){if("auto"===n){var e=function(e){var t=e.matches;l(t?"dark":"light")};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e),function(){window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",e)}}l(n)}),[n]),r.jsx(Ve.Provider,{value:{theme:d,id:p,mode:f},children:r.jsx("div",ie({className:m("wrapper",[h,We(),i])},a,{children:o}))})};Ve.Consumer;var qe={"/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}"}},Ye={files:{"/src/styles.css":qe["/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"},$e={files:ie(ie({},qe),{"/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"},Ge={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"},Ke={files:ie(ie({},qe),{"/index.js":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n<h1>
1Hello 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"},Xe={files:ie(ie({},qe),{"/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"},Qe={files:ie(ie({},qe),{"/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"},et={files:ie(ie({},qe),{"/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"},tt={files:ie(ie({},qe),{"/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:"^18.2.0","react-dom":"^18.2.0"},devDependencies:{"@types/react":"^18.0.28","@types/react-dom":"^18.0.11","@vitejs/plugin-react":"^3.1.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 react from '@vitejs/plugin-react'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [react()],\n})\n"}}),main:"/App.tsx",environment:"node"},nt={files:{"/src/styles.css":qe["/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"},rt={files:{"/src/styles.css":qe["/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"},ot={files:{"/src/styles.css":qe["/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"},it={files:{"/src/styles.css":qe["/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"},at={files:{"/src/app/app.component.css":qe["/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="/">
1\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"},st={files:ie(ie({},qe),{"/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:"^18.0.0","react-dom":"^18.0.0","react-scripts":"^5.0.0"},main:"/index.js"})}}),main:"/App.js",environment:"create-react-app"},ct={files:ie(ie({},qe),{"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:"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},devDependencies:{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0",typescript:"^4.0.0"},main:"/index.tsx"})}}),main:"/App.tsx",environment:"create-react-app"},lt={files:ie(ie({},qe),{"/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"},ut={files:ie(ie({},qe),{"/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"},dt={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"},pt={files:ie(ie({},qe),{"/index.js":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n<h1>
1Hello 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"},ft={files:ie(ie({},qe),{"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"},mt={files:{"/src/styles.css":qe["/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"},ht={files:{"/src/styles.css":qe["/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"},vt={static:{files:ie(ie({},qe),{"/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>
1Hello world</h1>\n</body>\n\n</html>'},"/package.json":{code:JSON.stringify({dependencies:{},main:"/index.html"})}}),main:"/index.html",environment:"static"},angular:at,react:st,"react-ts":ct,solid:lt,svelte:ut,"test-ts":dt,"vanilla-ts":ft,vanilla:pt,vue:mt,"vue-ts":ht,node:Ge,nextjs:$e,vite:Ke,"vite-react":et,"vite-react-ts":tt,"vite-preact":Xe,"vite-preact-ts":Qe,"vite-vue":ot,"vite-vue-ts":it,"vite-svelte":nt,"vite-svelte-ts":rt,astro:Ye},gt=function(e){var t,n,r,o,i,a,s=re(e.files),c=bt({template:e.template,customSetup:e.customSetup,files:s}),l=re(null!==(n=null===(t=e.options)||void 0===t?void 0:t.visibleFiles)&&void 0!==n?n:[]),u=(null===(r=e.options)||void 0===r?void 0:r.activeFile)?yt(null===(o=e.options)||void 0===o?void 0:o.activeFile,c.files):void 0;0===l.length&&s&&Object.keys(s).forEach((function(e){var t=s[e];"string"!=typeof t?(!u&&t.active&&(u=e,!0===t.hidden&&l.push(e)),t.hidden||l.push(e)):l.push(e)})),0===l.length&&(l=[c.main]),c.entry&&!c.files[c.entry]&&(c.entry=yt(c.entry,c.files)),!u&&c.main&&(u=c.main),u&&c.files[u]||(u=l[0]),l.includes(u)||l.push(u);var d=te(c.files,null!==(i=c.dependencies)&&void 0!==i?i:{},null!==(a=c.devDependencies)&&void 0!==a?a:{},c.entry);return{visibleFiles:l.filter((function(e){return d[e]})),activeFile:u,files:d,environment:c.environment,shouldUpdatePreview:!0}},yt=function(e,t){var n=re(t),r=re(e);if(r in n)return r;if(!e)return null;for(var o=null,i=0,a=[".js",".jsx",".ts",".tsx"];!o&&i<a.length;){var s=r.split(".")[0],c="".concat(s).concat(a[i]);void 0!==n[c]&&(o=c),i++}return o},bt=function(e){var t=e.files,n=e.template,r=e.customSetup;if(!n){if(!r){var o=vt.vanilla;return ie(ie({},o),{files:ie(ie({},o.files),xt(t))})}if(!t||0===Object.keys(t).length)throw new Error("[sandpack-react]: without a template, you must pass at least one file");return ie(ie({},r),{files:xt(t)})}var i=vt[n];if(!i)throw new Error('[sandpack-react]: invalid template "'.concat(n,'" provided'));return r||t?{files:xt(ie(ie({},i.files),t)),dependencies:ie(ie({},i.dependencies),null==r?void 0:r.dependencies),devDependencies:ie(ie({},i.devDependencies),null==r?void 0:r.devDependencies),entry:re(null==r?void 0:r.entry),main:i.main,environment:(null==r?void 0:r.environment)||i.environment}:i},xt=function(e){return e?Object.keys(e).reduce((function(t,n){return"string"==typeof e[n]?t[n]={code:e[
1n]}:t[n]=e[n],t}),{}):{}},wt=function(){return"function"==typeof t.useId?t.useId():Me()},jt={}.SANDPACK_CLIENT_VERSION;function St(e,t){return e.length>t?e.slice(0,t):e.padEnd(t,"s")}function Ct(e){return se(this,0,void 0,(function(){var t,n,r,o;return ce(this,(function(i){switch(i.label){case 0:return t=new TextEncoder,n=t.encode(e),[4,crypto.subtle.digest("SHA-256",n)];case 1:return r=i.sent(),o=Array.from(new Uint8Array(r)),[2,btoa(String.fromCharCode.apply(String,o))]}}))}))}var kt=function(e,n){var r,o,i,a=e.options,s=e.customSetup,c=e.teamId,l=e.sandboxId;null!=a||(a={}),null!=s||(s={});var u=(null==a?void 0:a.initMode)||"lazy",d=t.useState({startRoute:null==a?void 0:a.startRoute,bundlerState:void 0,error:null,initMode:u,reactDevTools:void 0,status:null===(r=null==a?void 0:a.autorun)||void 0===r||r?"initial":"idle"}),p=d[0],f=d[1],m=t.useRef(),h=t.useRef(null),v=t.useRef(null),g=t.useRef({}),y=t.useRef({}),b=t.useRef(null),x=t.useRef({}),w=t.useRef(),j=t.useRef({global:{}}),S=t.useRef(),C=t.useRef(n.environment),k=function(e){if("function"==typeof t.useId){var n=t.useId();return function(){return se(void 0,0,void 0,(function(){return ce(this,(function(t){switch(t.label){case 0:return[4,Ct(Object.entries(e).map((function(e,t){return e+"|"+t})).join("|||")+n+jt)];case 1:return[2,St(t.sent().replace(/:/g,"sp").replace(/[^a-zA-Z]/g,""),9)]}}))}))}}return function(){return St(Me(),9)}}(n.files),O=t.useCallback((function(e,t,r){return se(void 0,0,void 0,(function(){var o,i,u,d,m,h,v,g,S;return ce(this,(function(C){switch(C.label){case 0:return y.current[t]&&y.current[t].destroy(),null!=a||(a={}),null!=s||(s={}),o=null!==(v=null==a?void 0:a.bundlerTimeOut)&&void 0!==v?v:4e4,b.current&&clearTimeout(b.current),"function"!=typeof w.current&&(b.current=setTimeout((function(){E(),f((function(e){return ie(ie({},e),{status:"timeout"})}))}),o)),i=function(){return se(void 0,0,void 0,(function(){var e,t;return ce(this,(function(n){switch(n.label){case 0:return(null==a?void 0:a.experimental_enableStableServiceWorkerId)?(e="SANDPACK_INTERNAL:URL-CONSISTENT-ID",(t=localStorage.getItem(e))?[3,2]:[4,k()]):[3,3];case 1:t=n.sent(),localStorage.setItem(e,t),n.label=2;case 2:return[2,t];case 3:return[4,k()];case 4:return[2,n.sent()]}}))}))},d=oe,m=[e,{files:n.files,template:n.environment}],h={externalResources:a.externalResources,bundlerURL:a.bundlerURL,startRoute:null!==(g=null==r?void 0:r.startRoute)&&void 0!==g?g:a.startRoute,fileResolver:a.fileResolver,skipEval:null!==(S=a.skipEval)&&void 0!==S&&S,logLevel:a.logLevel,showOpenInCodeSandbox:!1,showErrorScreen:!0,showLoadingScreen:!1,reactDevTools:p.reactDevTools,customNpmRegistries:null==s?void 0:s.npmRegistries,teamId:c,experimental_enableServiceWorker:!!(null==a?void 0:a.experimental_enableServiceWorker)},[4,i()];case 1:return[4,d.apply(void 0,m.concat([(h.experimental_stableServiceWorkerId=C.sent(),h.sandboxId=l,h)]))];case 2:return u=C.sent(),"function"!=typeof w.current&&(w.current=u.listen(I)),x.current[t]=x.current[t]||{},j.current[t]&&(Object.keys(j.current[t]).forEach((function(e){var n=j.current[t][e],r=u.listen(n);x.current[t][e]=r})),j.current[t]={}),Object.entries(j.current.global).forEach((function(e){var n=e[0],r=e[1],o=u.listen(r);x.current[t][n]=o})),y.current[t]=u,[2]}}))}))}),[n.environment,n.files,p.reactDevTools]),E=t.useCallback((function(){Object.keys(y.current).map(A),"function"==typeof w.current&&(w.current(),w.current=void 0)}),[]),N=t.useCallback((function(){return se(void 0,0,void 0,(function(){return ce(this,(function(e){switch(e.label){case 0:return[4,Promise.all(Object.entries(g.current).map((function(e){var t=e[0],n=e[1],r=n.iframe,o=n.clientPropsOverride,i=void 0===o?{}:o;return se(void 0,0,void 0,(function(){return ce(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(),f((function(e){return ie(ie({},e),{error:null,status:"running"})})),[2]}}))}))}),[O]);m.current=function(e){e.some((function(e){return e.isIntersecting}))?N():E()};var M=t.useCallback((function(){var e,t,n;if(null===(e=null==a?void 0:a.autorun)||void 0===e||e){var r=null!==(t=null==a?void 0:a.initModeObserverOptions)&&void 0!==t?t:{rootMargin:"1000px 0px"};h.current&&v.current&&(null===(n=h.current)||void 0===n||n.unobserve(v.current)),v.current&&"lazy"===p.initMode?(h.current=ne
1w IntersectionObserver((function(e){var t,n;e.some((function(e){return e.isIntersecting}))&&e.some((function(e){return e.isIntersecting}))&&v.current&&(null===(t=m.current)||void 0===t||t.call(m,e),null===(n=h.current)||void 0===n||n.unobserve(v.current))}),r),h.current.observe(v.current)):v.current&&"user-visible"===p.initMode?(h.current=new IntersectionObserver((function(e){var t;null===(t=m.current)||void 0===t||t.call(m,e)}),r),h.current.observe(v.current)):N()}}),[null==a?void 0:a.autorun,null==a?void 0:a.initModeObserverOptions,N,p.initMode,E]),L=t.useCallback((function(e,t,n){return se(void 0,0,void 0,(function(){return ce(this,(function(r){switch(r.label){case 0:return g.current[t]={iframe:e,clientPropsOverride:n},"running"!==p.status?[3,2]:[4,O(e,t,n)];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))}),[O,p.status]),A=function(e){var t,n,r=y.current[e];r?(r.destroy(),null===(t=r.iframe.contentWindow)||void 0===t||t.location.replace("about:blank"),r.iframe.removeAttribute("src"),delete y.current[e]):delete g.current[e],b.current&&clearTimeout(b.current),Object.values(null!==(n=x.current[e])&&void 0!==n?n:{}).forEach((function(e){Object.values(e).forEach((function(e){return e()}))}));var o=Object.keys(y.current).length>0?"running":"idle";f((function(e){return ie(ie({},e),{status:o})}))},I=function(e){"start"===e.type?f((function(e){return ie(ie({},e),{error:null})})):"state"===e.type?f((function(t){return ie(ie({},t),{bundlerState:e.state})})):"done"===e.type&&!e.compilatonError||"connected"===e.type?(b.current&&clearTimeout(b.current),f((function(e){return ie(ie({},e),{error:null})}))):"action"===e.type&&"show-error"===e.action?(b.current&&clearTimeout(b.current),f((function(t){return ie(ie({},t),{error:ne(e)})}))):"action"===e.type&&"notification"===e.action&&"error"===e.notificationType&&f((function(t){return ie(ie({},t),{error:{message:e.title}})}))},_=null!==(o=null==a?void 0:a.recompileMode)&&void 0!==o?o:"delayed",T=null!==(i=null==a?void 0:a.recompileDelay)&&void 0!==i?i:200;return t.useEffect((function(){if("running"===p.status&&n.shouldUpdatePreview){if(C.current!==n.environment&&(C.current=n.environment,Object.entries(y.current).forEach((function(e){var t=e[0],n=e[1];L(n.iframe,t)}))),"immediate"===_&&Object.values(y.current).forEach((function(e){"done"===e.status&&e.updateSandbox({files:n.files,template:n.environment})})),"delayed"===_){if("undefined"==typeof window)return;window.clearTimeout(S.current),S.current=window.setTimeout((function(){Object.values(y.current).forEach((function(e){"done"===e.status&&e.updateSandbox({files:n.files,template:n.environment})}))}),T)}return function(){window.clearTimeout(S.current)}}}),[n.files,n.environment,n.shouldUpdatePreview,T,_,L,p.status]),t.useEffect((function(){u!==p.initMode&&(f((function(e){return ie(ie({},e),{initMode:u})})),M())}),[u,M,p.initMode]),t.useEffect((function(){return function(){"function"==typeof w.current&&w.current(),b.current&&clearTimeout(b.current),S.current&&clearTimeout(S.current),h.current&&h.current.disconnect()}}),[]),[p,{clients:y.current,initializeSandpackIframe:M,runSandpack:N,registerBundler:L,unregisterBundler:A,registerReactDevTools:function(e){f((function(t){return ie(ie({},t),{reactDevTools:e})}))},addListener:function(e,t){if(t){if(y.current[t])return y.current[t].listen(e);var n=Me();return j.current[t]=j.current[t]||{},x.current[t]=x.current[t]||{},j.current[t][n]=e,function(){j.current[t][n]?delete j.current[t][n]:x.current[t][n]&&(x.current[t][n](),delete x.current[t][n])}}var r=Me();j.current.global[r]=e;var o=Object.values(y.current).map((function(t){return t.listen(e)}));return function(){o.forEach((function(e){return e()})),delete j.current.global[r],Object.values(x.current).forEach((function(e){var t;null===(t=null==e?void 0:e[r])||void 0===t||t.call(e)}))}},dispatchMessage:function(e,t){"running"===p.status?t?y.current[t].dispatch(e):Object.values(y.current).forEach((function(t){t.dispatch(e)})):console.warn("[sandpack-react]: dispatch cannot be called while in idle mode")},lazyAnchorRef:v,unsubscribeClientListenersRef:x,queuedListenersRef:j}]},Ot=t.createContext(null),Et=function(e){var n,o,i,a=e.children,s=e.options,c=e.style,l=e.className,d=e.theme,p=function(e){var n=gt(e),r=t.useState(n),o=r[0],i=r[1],a=t.useRef(!1);t.useEffect((function(){a.current?i(gt(e)):a.current=!0}),[e.files,e.customSetup,e.template]);var s=function(e,t,n){void 0===n&&(n=!0),i((function(r){var o,i=r.files;return"string"==typeof e&&"string"==typeof t?i=ie(ie({},i),((o={})[e]=ie(ie({}
1,i[e]),{code:t}),o)):"object"==typeof e&&(i=ie(ie({},i),xt(e))),ie(ie({},r),{files:re(i),shouldUpdatePreview:n})}))},c={openFile:function(e){i((function(t){var n=t.visibleFiles,r=ae(t,["visibleFiles"]),o=n.includes(e)?n:le(le([],n,!0),[e],!1);return ie(ie({},r),{activeFile:e,visibleFiles:o})}))},resetFile:function(e){i((function(t){var r;return ie(ie({},t),{files:ie(ie({},t.files),(r={},r[e]=n.files[e],r))})}))},resetAllFiles:function(){i((function(e){return ie(ie({},e),{files:n.files})}))},setActiveFile:function(e){o.files[e]&&i((function(t){return ie(ie({},t),{activeFile:e})}))},updateCurrentFile:function(e,t){void 0===t&&(t=!0),s(o.activeFile,e,t)},updateFile:s,addFile:s,closeFile:function(e){1!==o.visibleFiles.length&&i((function(t){var n=t.visibleFiles,r=t.activeFile,o=ae(t,["visibleFiles","activeFile"]),i=n.indexOf(e),a=n.filter((function(t){return t!==e}));return ie(ie({},o),{activeFile:e===r?0===i?n[1]:n[i-1]:r,visibleFiles:a})}))},deleteFile:function(e,t){void 0===t&&(t=!0),i((function(n){var r=n.visibleFiles,o=n.files,i=n.activeFile,a=ae(n,["visibleFiles","files","activeFile"]),s=ie({},o);delete s[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 ie(ie({},a),{visibleFiles:[l],activeFile:l,files:s,shouldUpdatePreview:t})}return ie(ie({},a),{visibleFiles:c,activeFile:e===i?c[c.length-1]:i,files:s,shouldUpdatePreview:t})}))}};return[ie(ie({},o),{visibleFilesFromProps:n.visibleFiles}),c]}(e),f=p[0],m=p[1],h=kt(e,f),v=h[0],g=h[1],y=g.dispatchMessage,b=g.addListener,x=ae(g,["dispatchMessage","addListener"]),w=function(e,n){var r=t.useState({editorState:"pristine"}),o=r[0],i=r[1],a=gt(e),s=u(a.files,n)?"pristine":"dirty";return s!==o.editorState&&i((function(e){return ie(ie({},e),{editorState:s})})),o}(e,f.files);return t.useEffect((function(){x.initializeSandpackIframe()}),[]),r.jsx(Ot.Provider,{value:ie(ie(ie(ie(ie(ie({},f),v),w),m),x),{autoReload:null===(o=null===(n=e.options)||void 0===n?void 0:n.autoReload)||void 0===o||o,teamId:null==e?void 0:e.teamId,exportOptions:null===(i=null==e?void 0:e.customSetup)||void 0===i?void 0:i.exportOptions,listen:b,dispatch:y}),children:r.jsx(ze,{classes:null==s?void 0:s.classes,children:r.jsx(Ze,{className:l,style:c,theme:d,children:a})})})};function Nt(){var e=t.useContext(Ot);if(null===e)throw new Error('[sandpack-react]: "useSandpack" must be wrapped by a "SandpackProvider"');var n=e.dispatch,r=e.listen,o=ae(e,["dispatch","listen"]);return{sandpack:ie({},o),dispatch:n,listen:r}}Ot.Consumer;var Mt=function(){var e,t,n,r=Nt().sandpack;return{code:null===(e=r.files[r.activeFile])||void 0===e?void 0:e.code,readOnly:null!==(n=null===(t=r.files[r.activeFile])||void 0===t?void 0:t.readOnly)&&void 0!==n&&n,updateCode:r.updateCurrentFile}},Lt=Ue,At=Ue,It=Ue,_t=Ue;De({"0%":{opacity:0},"100%":{opacity:1}});var Tt=Ue,Rt=Ue,Dt=Ue,Pt=Ue,Ft=Ue,Ut=Ue,Ht=Ue,zt=Ue,Bt=Ue,Jt=function(e){var n=e.closableTabs,o=e.className,i=e.activeFileUniqueId,a=ae(e,["closableTabs","className","activeFileUniqueId"]),s=Nt().sandpack,c=Be(),l=s.activeFile,u=s.visibleFiles,d=s.setActiveFile,p=t.useState(null),f=p[0],m=p[1];return r.jsx("div",ie({className:c("tabs",[Ft,o]),translate:"no"},a,{children:r.jsx("div",{"aria-label":"Select active file",className:c("tabs-scrollable-container",[Ut]),role:"tablist",children:u.map((function(e,t){return r.jsxs("div",{"aria-controls":"".concat(e,"-").concat(i,"-tab-panel"),"aria-selected":e===l,className:c("tab-container",[Ht]),onKeyDown:function(e){return function(e){var t,n,r,o,i=e.e,a=e.index,s=i.currentTarget;switch(i.key){case"ArrowLeft":var c=s.previousElementSibling;c&&(null===(t=c.querySelector("button"))||void 0===t||t.focus(),d(u[a-1]));break;case"ArrowRight":var l=s.nextElementSibling;l&&(null===(n=l.querySelector("button"))||void 0===n||n.focus(),d(u[a+1]));break;case"Home":null===(r=s.parentElement.firstElementChild.querySelector("button"))||void 0===r||r.focus(),d(u[0]);break;case"End":null===(o=s.parentElement.lastElementChild.querySelector("button"))||void 0===o||o.focus(),d(u[-1])}}({e:e,index:t})},onMouseEnter:function(){return m(t)},onMouseLeave:function(){return m(null)},role:"tab",children:[r.jsx("button",{className:c("tab-button",[At,Bt]),"data-active":e===l,id:"".concat(e,"-").concat(i,"-tab"),onClick:function(){return d(e)},tabIndex:e===l?0:-1,title:e,type:"button",children:(o=e,a=Oe(o),p=u.reduce((function(e,t){return t===o?e:Oe(t)===a?(e.push(t),e):e}),[]),0===p.length?a: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("/"),a=1;a<=n.length;a++){var s=n[n.length-a],c=i[i.length-a];if(r.length<a&&r.unshift(s),s!==c)break}return r.length<n.length&&r.unshift(".."),r.join("/")}(o,p))}),n&&u.length>1&&r.jsx("span",{className:c("close-button",[zt]),onClick:function(t){t.stopPropagation(),s.closeFile(e)},style:{visibility:e===l||f===t?"visible":"hidden"},tabIndex:e===l?0:-1,children:r.jsx(we,{})})]},e);var o,a,p}))})}))}
1,Wt=function(e){var t=e.onClick,n=e.className,o=e.children,i=Be();return r.jsx("button",{className:i("button",[i("icon-standalone"),At,Lt,It,n]),onClick:t,type:"button",children:o})},Vt=Ue,Zt=function(e){var t=e.onClick,n=ae(e,["className","onClick"]),o=Nt().sandpack;return r.jsxs(Wt,ie({className:Vt.toString(),onClick:function(e){o.runSandpack(),null==t||t(e)}},n,{children:[r.jsx(he,{}),r.jsx("span",{children:"Run"})]}))},qt=Ue,Yt=function(e){var t=e.className,n=ae(e,["className"]),o=Be();return r.jsx("div",ie({className:o("stack",[qt,t])},n))},$t=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},Gt=function(e,t){var n=t.line,r=t.column;return e.line(n).from+(null!=r?r:0)-1},Kt=function(e){return"".concat(Te,"-syntax-").concat(e)},Xt=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.useCallback((function(t){return e.forEach((function(e){if(e)return"function"==typeof e?e(t):void(e.current=t)}))}),e)};var Qt=T.line({attributes:{class:"cm-errorLine"}}),en=R.fromClass(function(){function e(){this.decorations=T.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=Gt(e.view.state.doc,{line:r})+1;t.decorations=T.set([Qt.range(o)])}else n.annotation("remove-errors")&&(t.decorations=T.none)}))},e}(),{decorations:function(e){return e.decorations}}),tn=Ue,nn=Ue,rn=Ue,on=Ue,an=Ue,sn=t.forwardRef((function(e,o){var s=e.code,c=void 0===s?"":s,l=e.filePath,u=e.fileType,d=e.onCodeUpdate,p=e.showLineNumbers,f=void 0!==p&&p,m=e.showInlineErrors,h=void 0!==m&&m,z=e.wrapContent,B=void 0!==z&&z,J=e.editorState,W=void 0===J?"pristine":J,V=e.readOnly,Z=void 0!==V&&V,q=e.showReadOnly,Y=void 0===q||q,$=e.decorators,G=e.initMode,K=void 0===G?"lazy":G,X=e.extensions,Q=void 0===X?[]:X,ee=e.extensionsKeymap,te=void 0===ee?[]:ee,ne=e.additionalLanguages,re=void 0===ne?[]:ne,oe=t.useRef(null),ae=Xt(oe,o),se=t.useRef(),ce=function(){var e=t.useContext(Ve);return{theme:e.theme,themeId:e.id,themeMode:e.mode}}(),ue=ce.theme,de=ce.themeId,pe=t.useState(c),fe=pe[0],me=pe[1],he=t.useState("immediate"===K),ve=he[0],ge=he[1],ye=Be(),be=Nt(),xe=be.listen,we=be.sandpack.autoReload,je=t.useRef([]),Se=t.useRef([]),Ce=n(oe,{rootMargin:"600px 0px",threshold:.2}).isIntersecting;t.useImperativeHandle(o,(function(){return{getCodemirror:function(){return se.current}}})),t.useEffect((function(){("lazy"===K||"user-visible"===K)&&Ce&&ge(!0)}),[K,Ce]);var ke=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,a=n;i<a.length;i++){var s=a[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"}}(l,u,re),Ee=function(e,t){for(var n={javascript:C({jsx:!0,typescript:!1}),typescript:C({jsx:!0,typescript:!0}),html:S(),css:j()},r=0,o=t;r<o.length;r++){var i=o[r];if(e===i.name)return i.language}return n[e]}(ke,re),Ne=function(e){return M.define([{tag:i.link,textDecoration:"underline"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.strong,fontWeight:"bold"},{tag:i.keyword,class:Kt("keyword")},{tag:[i.atom,i.number,i.bool],class:Kt("static")},{tag:i.variableName,class:Kt("plain")},{tag:i.standard(i.tagName),class:Kt("tag")},{tag:[i.function(i.variableName),i.definition(i.function(i.variableName)),i.tagName],class:Kt("definition")},{tag:i.propertyName,class:Kt("property")},{tag:[i.literal,i.inserted],class:Kt(e.syntax.string?"string":"static")},{tag:i.punctuation,class:Kt("punctuation")},{tag:[i.comment,i.quote],class:Kt("comment")}])}(ue),Me=function(e){var n=e.langSupport,r=e.highlightTheme,o=e.code,i=void 0===o?"":o,s=n.language.parser.parse(i),c=0,l=[],u=function(e,n){if(e>c){var r=i.slice(c,e);l.push(n?t.createElement("span",{children:r,className:n,key:"".concat(e).concat(c)}):r),c=e}};return a(s,r,(function(e,t,n){u(e,""),u(t,n)})),c<i.length&&(null==i?void 0:i.includes("\n"))&&l.push("\n\n"),l}({langSupport:Ee,highlightTheme:Ne,code:c}),Le=t.useMemo((function(){return $?$.sort((function(e,t){return e.line-t.line})):$}),[$]),Ae=Z&&0===(null==$?void 0:$.length);t.useEffect((function(){if(oe.current&&ve&&!Ae){var e=oe.current,t=e.querySelector(".sp-pre-placeholder");t&&e.removeChild(t);var n=new D({doc:c,extensions:[],parent:e});return n.contentDOM.setAttribute("data-gramm","false"),n.contentDOM.setAttribute("data-lt-active","false"),n.contentDOM.setAttribute("aria-label",l?"Code Editor for ".concat(Oe(l)):"Code Editor"),n.contentDOM.setAttribute("tabIndex","-1"),se.current=n,function(){var e;null===(e=se.current)||void 0===e||e.destroy()}}}),[ve,Z,Ae]),t.useEffect((function(){var e;if(!Ae&&se.current){var t=[{key:"Tab",run:function(e){var t,n;k(e);var r=te.find((function(e){return"Tab"===e.key}));return null===(n=null===(t=null==r?void 0:r.run)||void 0===t?void 0:t.call(r,e))||void 0===n||n}},{key:"Shift-Tab",run:function(e){var t,n;O({state:e.state,dispatch:e.dispatch});var r=te.find((function(e){return"Shift-Tab"===e.key}));return null===(n=null===(t=null==r?void 0:r.run)||void 0===t?void 0:t.call(r,e))||void 0===n||n}},{key:"Escape",run:function(){return Z||oe.current&&oe.current.focus(),!0}},{key:"mod-Backspace",run:b}],n=le(le([F(),x(),w()],Q,!0),[P.of(le(le(le(le(le([],v,!0),g,!0),y,!0),t,!0),te,!0)),Ee,D.theme({"&":{backgroundColor:"var(--".concat(Te,"-colors-surface1)"),color:"var(--".concat(Te,"-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(Te,"-colors-surface3)"),borderRadius:"var(--".concat(Te,"-border-radius)")},".cm-errorLine":{backgroundColor:"var(--".concat(Te,"-colors-errorSurface)"),borderRadius:"var(--".concat(Te,"-border-radius)")},".cm-content":{caretColor:"var(--".concat(Te,"-colors-accent)"),padding:"0 var(--".concat(Te,"-space-4)")},".cm-scroller":{fontFamily:"var(--".concat(Te,"-font-mono)"),lineHeight:"var(--".concat(Te,"-font-lineHeight)")},".cm-gutters":{backgroundColor:"var(--".concat(Te,"-colors-surface1)"),color:"var(--".concat(Te,"-colors-disabled)"),border:"none",paddingLeft:"var(--".concat(Te,"-space-1)")},".cm-gutter.cm-lineNumbers":{fontSize:".6em"},".cm-lineNumbers .cm-gutterElement":{lineHeight:"var(--".concat(Te,"-font-lineHeight)"),minWidth:"var(--".concat(Te,"-space-5)")},".cm-content .cm-line":{paddingLeft:"var(--".concat(Te,"-space-1)")},".cm-content.cm-readonly .cm-line":{paddingLeft:0}}),E(Ne),D.updateListener.of((function(e){if(e.docChanged){var t=e.state.doc.toString();me(t),null==d||d(t)}}))],!1);Z?(n.push(L.readOnly.of(!0)),n.push(D.editable.of(!1))):(n.push(N()),n.push(U())),Le&&n.push((e=Le,R.fromClass(function(){function t(e){this.decorations=this.getDecoration(e)}return t.prototype.update=function(e){},t.prototype.getDecoration=function(t){if(!e)return T.none;var n=e.map((function(e){var n,r,o,i=T.line({attributes:{class:null!==(n=e.className)&&void 0!==n?n:""}}),a=T.mark({class:null!==(r=e.className)&&void 0!==r?r:"",attributes:null!==(o=e.elementAttributes)&&void 0!==o?o:void 0}),s=Gt(t.state.doc,{line:e.line,column:e.startColumn})+1;if(e.startColumn&&e.endColumn){var c=Gt(t.state.doc,{line:e.line,column:e.endColumn})+1;return a.range(s,c)}return i.range(s)}));
1return T.set(n)},t}(),{decorations:function(e){return e.decorations}}))),B&&n.push(D.lineWrapping),f&&n.push(H()),h&&n.push(en),se.current.dispatch({effects:A.reconfigure.of(n)})}}),[ve,Le,f,B,de,Z,Ae,we]),t.useEffect((function(){var e=se.current,t=!$t(Q,je.current)||!$t(te,Se.current);e&&t&&(e.dispatch({effects:A.appendConfig.of(Q)}),e.dispatch({effects:A.appendConfig.of(P.of(le([],te,!0)))}),je.current=Q,Se.current=te)}),[Q,te]),t.useEffect((function(){se.current&&"dirty"===W&&window.matchMedia("(min-width: 768px)").matches&&se.current.contentDOM.focus()}),[]),t.useEffect((function(){if(se.current&&"string"==typeof c&&c!==fe){var e=se.current,t=e.state.selection.ranges.some((function(e){var t=e.to,n=e.from;return t>c.length||n>c.length}))?I.cursor(c.length):e.state.selection,n={from:0,to:e.state.doc.length,insert:c};e.dispatch({changes:n,selection:t})}}),[c]),t.useEffect((function(){if(h){var e=xe((function(e){var t=se.current;"success"===e.type?null==t||t.dispatch({annotations:[new _("remove-errors",!0)]}):"action"===e.type&&"show-error"===e.action&&e.path===l&&e.line&&(null==t||t.dis
1patch({annotations:[new _("show-error",e.line)]}))}));return function(){return e()}}}),[xe,h]);var Ie=function(){var e=4;return f&&(e+=6),Z||(e+=1),"var(--".concat(Te,"-space-").concat(e,")")};return Ae?r.jsxs(r.Fragment,{children:[r.jsx("pre",{ref:ae,className:ye("cm",[ye(W),ye(ke),on,nn]),translate:"no",children:r.jsx("code",{className:ye("pre-placeholder",[tn]),style:{marginLeft:Ie()},children:Me})}),Z&&Y&&r.jsx("span",ie({className:ye("read-only",[an])},{},{children:"Read-only"}))]}):r.jsx("div",{ref:ae,"aria-autocomplete":"list","aria-label":l?"Code Editor for ".concat(Oe(l)):"Code Editor","aria-multiline":"true",className:ye("cm",[ye(W),ye(ke),on,nn]),onKeyDown:function(e){"Enter"===e.key&&se.current&&(e.preventDefault(),se.current.contentDOM.focus())},role:"textbox",tabIndex:0,translate:"no",suppressHydrationWarning:!0,children:r.jsx("pre",{className:ye("pre-placeholder",[tn]),style:{marginLeft:Ie()},children:Me})})}));t.forwardRef((function(e,t){var n=e.showTabs,o=e.showLineNumbers,i=void 0!==o&&o,a=e.showInlineErrors,s=void 0!==a&&a,c=e.showRunButton,l=void 0===c||c,u=e.wrapContent,d=void 0!==u&&u,p=e.closableTabs,f=void 0!==p&&p,m=e.initMode,h=e.extensions,v=e.extensionsKeymap,g=e.readOnly,y=e.showReadOnly,b=e.additionalLanguages,x=e.className,w=ae(e,["showTabs","showLineNumbers","showInlineErrors","showRunButton","wrapContent","closableTabs","initMode","extensions","extensionsKeymap","readOnly","showReadOnly","additionalLanguages","className"]),j=Nt().sandpack,S=Mt(),C=S.code,k=S.updateCode,O=S.readOnly,E=j.activeFile,N=j.status,M=j.editorState,L=null!=n?n:j.visibleFiles.length>1,A=Be(),I=wt();return r.jsxs(Yt,ie({className:A("editor",[x])},w,{children:[L&&r.jsx(Jt,{activeFileUniqueId:I,closableTabs:f}),r.jsxs("div",{"aria-labelledby":"".concat(E,"-").concat(I,"-tab"),className:A("code-editor",[rn]),id:"".concat(E,"-").concat(I,"-tab-panel"),role:"tabpanel",children:[r.jsx(sn,{ref:t,additionalLanguages:b,code:C,editorState:M,extensions:h,extensionsKeymap:v,filePath:E,initMode:m||j.initMode,onCodeUpdate:function(e){var t;return function(e,t){void 0===t&&(t=!0),k(e,t)}(e,null===(t=j.autoReload)||void 0===t||t)},readOnly:g||O,showInlineErrors:s,showLineNumbers:i,showReadOnly:y,wrapContent:d},E),!l||j.autoReload&&"idle"!==N?null:r.jsx(Zt,{})]})]}))})),t.forwardRef((function(e,t){var n=e.showTabs,o=e.showLineNumbers,i=e.decorators,a=e.code,s=e.initMode,c=e.wrapContent,l=e.additionalLanguages,u=ae(e,["showTabs","showLineNumbers","decorators","code","initMode","wrapContent","additionalLanguages"]),d=Nt().sandpack,p=Mt().code,f=Be(),m=null!=n?n:d.visibleFiles.length>1,h=wt();return r.jsxs(Yt,ie({className:f("editor-viewer")},u,{children:[m?r.jsx(Jt,{activeFileUniqueId:h}):null,r.jsx("div",{"aria-labelledby":"".concat(d.activeFile,"-").concat(h,"-tab"),className:f("code-editor",[rn]),id:"".concat(d.activeFile,"-").concat(h,"-tab-panel"),role:"tabpanel",children:r.jsx(sn,{ref:t,additionalLanguages:l,code:null!=a?a:p,decorators:i,filePath:d.activeFile,initMode:s||d.initMode,showLineNumbers:o,showReadOnly:!1,wrapContent:c,readOnly:!0})}),"idle"===d.status?r.jsx(Zt,{}):null]}))}));var cn=Ue;t.forwardRef((function(e,t){var n=e.children,o=e.className,i=ae(e,["children","className"]),a=Nt().sandpack,s=Be(),c=Xt(a.lazyAnchorRef,t);return r.jsx("div",ie({ref:c,className:s("layout",[cn,o])},i,{children:n}))}));var ln=function(e){var n=Nt(),r=n.sandpack,o=n.listen,i=n.dispatch,a=t.useRef(null),s=t.useRef(Me());t.useEffect((function(){var t=a.current,n=s.current;return null!==t&&r.registerBundler(t,n,e),function(){return r.unregisterBundler(n)}}),[]);return{sandpack:r,getClient:function(){return r.clients[s.current]||null},clientId:s.current,iframe:a,listen:function(e){return o(e,s.current)},dispatch:function(e){return i(e,s.current)}}},un=function(e){var t=Nt().dispatch;return{restart:function(){return t({type:"shell/restart"},e)},openPreview:function(){return t({type:"shell/openPreview"},e)}}},dn=function(e){var n=t.useState(!1),r=n[0],o=n[1],i=t.useState(),a=i[0],s=i[1],c=t.useState(null),l=c[0],u=c[1],d=null==e?void 0:e.timeout,p=null==e?void 0:e.clientId,f=Nt().listen;return t.useEffect((function(){var e,t=f((function(t){"start"===t.type&&t.firstLoad&&o(!1),d&&(e=setTimeout((function(){u(null)}),d)),"dependencies"===t.type?u((function(){switch(t.data.state){case"downloading_manifest":return"[1/3] Downloading manifest";case"downloaded_module":return"[2/3] Downloaded ".concat(t.data.name,"
1(").concat(t.data.progress,"/").concat(t.data.total,")");case"starting":return"[3/3] Starting"}return null})):"shell/progress"!==t.type||r||(a||"downloaded_module"!==t.data.state||s(t.data.totalPending),void 0!==a&&u(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?void 0:n.trim(),'"')}}(t.data,a))),"done"===t.type&&!1===t.compilatonError&&(u(null),o(!0),clearTimeout(e))}),p);return function(){e&&clearTimeout(e),t()}}),[p,r,a,d]),l},pn=function(e){var n=e.clientId,r=e.maxMessageCount,o=void 0===r?800:r,i=t.useState([]),a=i[0],s=i[1],c=Nt().listen;return t.useEffect((function(){return c((function(e){"start"===e.type?s([]):"stdout"===e.type&&e.payload.data&&Boolean(e.payload.data.trim())&&s((function(t){for(var n=le(le([],t,!0),[{data:e.payload.data,id:Me()}],!1);n.length>o;)n.shift();return n}))}),n)}),[o,n]),{logs:a,reset:function(){return s([])}}},fn=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},mn=function(e){var t=e.children,n=e.className,o=ae(e,["children","className"]),i=function(){var e,t=Nt().sandpack.error;return null!==(e=null==t?void 0:t.message)&&void 0!==e?e:null}(),a=un().restart,s=Be(),c=Nt().sandpack,l=c.runSandpack,u=c.teamId,d=Nt().dispatch;if(!i&&!t)return null;var p=null==i?void 0:i.startsWith("[sandpack-client]");return(null==i?void 0:i.includes("NPM_REGISTRY_UNAUTHENTICATED_REQUEST"))?r.jsxs("div",ie({className:s("overlay",[s("error"),Tt,Dt,n])},e,{children:[r.jsx("p",{className:s("error-message",[Pt]),children:r.jsx("strong",{children:"Unable to fetch required dependency."})}),r.jsx("div",{className:s("error-message",[Pt]),children:r.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"," ",r.jsx("a",{href:"mailto:[email protected]?subject=Sandpack Timeout Error",children:"support"})," ","for further assistance."]})}),r.jsx("div",{children:r.jsxs("button",{className:s("button",[At,Lt,It]),onClick:function(){u&&d({type:"sign-in",teamId:u})},children:[r.jsx(pe,{}),r.jsx("span",{children:"Sign in"})]})})]})):p&&i?r.jsx("div",ie({className:s("overlay",[s("error"),Tt,Dt,n])},o,{children:r.jsxs("div",{className:s("error-message",[Pt]),children:[r.jsx("p",{className:s("error-title",[Ue]),children:"Couldn't connect to server"}),r.jsx("p",{children:fn(i)}),r.jsx("div",{children:r.jsxs("button",{className:s("button",[s("icon-standalone"),At,Lt,It]),onClick:function(){a(),l()},title:"Restart script",type:"button",children:[r.jsx(me,{})," ",r.jsx("span",{children:"Restart"})]})})]})})):r.jsxs("div",ie({className:s("overlay",[s("error"),Tt,Rt(),n]),translate:"no"},o,{children:[r.jsx("p",{className:s("error-message",[Pt]),children:r.jsx("strong",{children:"Something went wrong"})}),r.jsx("p",{className:s("error-message",[Pt()]),children:i||t})]}))};function hn(e,n,r,o){var i=n?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}(r),a=n?function(e){var t="";return e.bg&&(t+="".concat(e.bg,"-bg ")),e.fg&&(t+="".concat(e.fg,"-fg ")),e.decoration&&(t+="ansi-".concat(e.decoration," ")),""===t?null:t=t.substring(0,t.length-1)}(r):null;if(!e)return t.createElement("span",{style:i,key:o,className:a},r.content);for(var s,c=[],l=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,u=0;null!==(s=l.exec(r.content));){var d=s[1],p=s[2],f=s.index+d.length;f>u&&c.push(r.content.substring(u,f));var m=p.startsWith("www.")?"http://".concat(p):p;c.push(t.createElement("a",{key:u,href:m,target:"_blank"},"".concat(p))),u=l.lastIndex}return u<r.content.length&&c.push(r.content.substring(u)),t.createElement("span",{style:i,key:o,className:a},c)}function vn(e){var n,r,o=e.className,i=e.useClasses,a=e.children,l=e.linkify;return t.createElement("code",{className:o},(n=null!=a?a:"",r=null!=i&&i,void 0===r&&(r=!1),n=s.escapeCarriageReturn(function(e){var t=e;do{t=(e=t).replace(/[^\n]\x08/gm,"")}while(t.length<e.length);return e}(n)),c.ansiToJson(n,{json:!0,remove_empty:!0,use_classes:r})).map(hn.bind(null,null!=l&&l,null!=i&&i)))}var gn=function(e){var t=e.data,n=Be();return r.jsx(r.Fragment,{children:t.map((function(e){var t=e.data,o=e.id;return r.jsx("div",{className:n("console-item",[yn]),children:r.jsx(vn,{children:t})},o)}))})},yn=Ue,bn="https://codesandbox.io/api/v1/sandboxes/define",xn=function(e,t){var n,r=Object.keys(e).reduce((function(t,n){var r,o=n.replace("/",""),i={content:e[n].c
1ode,isBinary:!1};return ie(ie({},t),((r={})[o]=i,r))}),{});return n=ie({files:r},t?{template:t}:null),l.compressToBase64(JSON.stringify(n)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},wn=function(e){var t=Nt().sandpack;return t.exportOptions?r.jsx(jn,ie({state:t},e)):r.jsx(Sn,ie({state:t},e))},jn=function(e){var t=e.children,n=e.state,o=ae(e,["children","state"]);return r.jsx("button",ie({onClick:function(){return se(void 0,0,void 0,(function(){var e,t,r;return ce(this,(function(o){switch(o.label){case 0:if(!(null===(r=n.exportOptions)||void 0===r?void 0:r.apiToken))throw new Error("Missing `apiToken` property");return e=Object.keys(n.files).reduce((function(e,t){var r,o=t.replace("/","");return ie(ie({},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:"public"===n.exportOptions.privacy?0:2}),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"},o,{children:t}))},Sn=function(e){var n,o,i,a=e.children,s=e.state,c=ae(e,["children","state"]),l=t.useRef(null),u=t.useState(),d=u[0],p=u[1];return t.useEffect((function(){var e=setTimeout((function(){var e=xn(s.files,s.environment),t=new URLSearchParams({parameters:e,query:new URLSearchParams({file:s.activeFile,utm_medium:"sandpack"}).toString()});p(t)}),600);return function(){clearTimeout(e)}}),[s.activeFile,s.environment,s.files]),(null!==(i=null===(o=null===(n=null==d?void 0:d.get)||void 0===n?void 0:n.call(d,"parameters"))||void 0===o?void 0:o.length)&&void 0!==i?i:0)>1500?r.jsxs("button",ie({onClick:function(){var e;return null===(e=l.current)||void 0===e?void 0:e.submit()},title:"Open in CodeSandbox",type:"button"},c,{children:[r.jsxs("form",{ref:l,action:bn,method:"POST",style:{visibility:"hidden"},target:"_blank",children:[r.jsx("input",{name:"environment",type:"hidden",value:"node"===s.environment?"server":s.environment}),Array.from(d,(function(e){var t=e[0],n=e[1];return r.jsx("input",{name:t,type:"hidden",value:n},t)}))]}),a]})):r.jsx("a",ie({href:"".concat(bn,"?").concat(null==d?void 0:d.toString(),"&environment=").concat("node"===s.environment?"server":s.environment),rel:"noreferrer noopener",target:"_blank",title:"Open in CodeSandbox"},c,{children:a}))},Cn=function(){var e=Be();return r.jsxs(wn,{className:e("button",[e("icon-standalone"),At,Lt,It]),children:[r.jsx(xe,{}),r.jsx("span",{children:"Open Sandbox"})]})},kn=Ue,On=Ue;De({"0%":{transform:"rotateX(-25.5deg) rotateY(45deg)"},"100%":{transform:"rotateX(-25.5deg) rotateY(405deg)"}});var En,Nn,Mn=Ue,Ln=function(e){var t=e.className,n=e.showOpenInCodeSandbox,o=ae(e,["className","showOpenInCodeSandbox"]),i=Be();return r.jsxs("div",ie({className:i("cube-wrapper",[On,t]),title:"Open in CodeSandbox"},o,{children:[n&&r.jsx(Cn,{}),r.jsx("div",{className:i("cube",[kn]),children:r.jsxs("div",{className:i("sides",[Mn]),children:[r.jsx("div",{className:"top"}),r.jsx("div",{className:"right"}),r.jsx("div",{className:"bottom"}),r.jsx("div",{className:"left"}),r.jsx("div",{className:"front"}),r.jsx("div",{className:"back"})]})})]}))},An=Ue,In=function(e){var n=e.clientId,o=e.loading,i=e.className,a=e.style,s=e.showOpenInCodeSandbox,c=ae(e,["clientId","loading","className","style","showOpenInCodeSandbox"]),l=Be(),u=Nt().sandpack,d=u.runSandpack,p=u.environment,f=t.useState(!1),m=f[0],h=f[1],v=function(e,n){var r=Nt(),o=r.sandpack,i=r.listen,a=t.useState("LOADING"),s=a[0],c=a[1];return t.useEffect((function(){var t=i((function(e){"start"===e.type&&!0===e.firstLoad&&c("LOADING"),"done"===e.type&&c((function(e){return"LOADING"===e?"PRE_FADING":"HIDDEN"}))}),e);return function(){t()}}),[e,"idle"===o.status]),t.useEffect((function(){var e;return"PRE_FADING"!==s||n?"FADING"===s&&(e=setTimeout((function(){return c("HIDDEN")}),200)):c("FADING"),function(){clearTimeout(e)}}),[s,n]),"timeout"===o.status?"TIMEOUT":"running"!==o.status?"HIDDEN":s}(n,o),g=dn({clientId:n}
1),y=pn({clientId:n}).logs;if(t.useEffect((function(){var e;return(null==g?void 0:g.includes("Running"))&&(e=setTimeout((function(){h(!0)}),3e3)),function(){e&&clearTimeout(e)}}),[g]),"HIDDEN"===v)return null;if("TIMEOUT"===v)return r.jsx("div",ie({className:l("overlay",[l("error"),Tt,Rt,Dt,i])},c,{children:r.jsxs("div",{className:l("error-message",[Pt]),children:[r.jsx("p",{className:l("error-title",[Ue]),children:"Couldn't connect to server"}),r.jsx("div",{className:l("error-message",[Pt]),children:r.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"," ",r.jsx("a",{href:"mailto:[email protected]?subject=Sandpack Timeout Error",children:"email"})," ","or submit an issue on"," ",r.jsx("a",{href:"https://github.com/codesandbox/sandpack/issues",rel:"noreferrer noopener",target:"_blank",children:"GitHub."})]})}),r.jsxs("p",{className:l("error-message",[Pt()]),children:["ENV: ",p,r.jsx("br",{}),"ERROR: TIME_OUT"]}),r.jsx("div",{children:r.jsxs("button",{className:l("button",[l("icon-standalone"),At,Lt,It]),onClick:d,title:"Restart script",type:"button",children:[r.jsx(me,{})," ",r.jsx("span",{children:"Try again"})]})})]})}));var b="LOADING"===v||"PRE_FADING"===v;return r.jsxs(r.Fragment,{children:[r.jsxs("div",ie({className:l("overlay",[l("loading"),Tt,An,i]),style:ie(ie({},a),{opacity:b?1:0,transition:"opacity ".concat(200,"ms ease-out")})},c,{children:[m&&r.jsx("div",{className:_n.toString(),children:r.jsx(gn,{data:y})}),r.jsx(Ln,{showOpenInCodeSandbox:s})]})),g&&r.jsx("div",{className:Tn.toString(),children:r.jsx("p",{children:g})})]})},_n=Ue,Tn=Ue,Rn=function(e){var t=e.clientId,n=dn({timeout:3e3,clientId:t});return n?r.jsx("div",{className:Dn.toString(),children:r.jsx("p",{children:n})}):null},Dn=Ue,Pn=Ue,Fn=Ue,Un=function(e){var n,o=e.clientId,i=e.onURLChange,a=e.className,s=e.startRoute,c=ae(e,["clientId","onURLChange","className","startRoute"]),l=t.useState(""),u=l[0],d=l[1],p=Nt(),f=p.sandpack,m=p.dispatch,h=p.listen,v=t.useState(null!==(n=null!=s?s:f.startRoute)&&void 0!==n?n:"/"),g=v[0],y=v[1],b=t.useState(!1),x=b[0],w=b[1],j=t.useState(!1),S=j[0],C=j[1],k=Be();t.useEffect((function(){var e=h((function(e){if("urlchange"===e.type){var t=e.url,n=e.back,r=e.forward,o=function(e){var t=e.match(/(https?:\/\/.*?)\//);return t&&t[1]?[t[1],e.replace(t[1],"")]:[e,"/"]}(t),i=o[0],a=o[1];d(i),y(a),w(n),C(r)}}),o);return function(){return e()}}),[]);var O=k("button",[k("icon"),At,_t,Ue]);return r.jsxs("div",ie({className:k("navigator",[Pn,a])},c,{children:[r.jsx("button",{"aria-label":"Go back one page",className:O,disabled:!x,onClick:function(){m({type:"urlback"})},type:"button",children:r.jsx(ve,{})}),r.jsx("button",{"aria-label":"Go forward one page",className:O,disabled:!S,onClick:function(){m({type:"urlforward"})},type:"button",children:r.jsx(ge,{})}),r.jsx("button",{"aria-label":"Refresh page",className:O,onClick:function(){m({type:"refresh"})},type:"button",children:r.jsx(ye,{})}),r.jsx("input",{"aria-label":"Current Sandpack URL",className:k("input",[Fn]),name:"Current Sandpack URL",onChange:function(e){var t=e.target.value.startsWith("/")?e.target.value:"/".concat(e.target.value);y(t)},onKeyDown:function(e){"Enter"===e.code&&(e.preventDefault(),e.stopPropagation(),"function"==typeof i&&i(u+e.currentTarget.value))},type:"text",value:g})]}))},Hn=Ue,zn=Ue,Bn=Ue,Jn=t.forwardRef((function(e,n){var o=e.showNavigator,i=void 0!==o&&o,a=e.showRefreshButton,s=void 0===a||a,c=e.showOpenInCodeSandbox,l=void 0===c||c,u=e.showSandpackErrorOverlay,d=void 0===u||u,p=e.showRestartButton,f=void 0===p||p,m=e.actionsChildren,h=void 0===m?r.jsx(r.Fragment,{}):m,v=e.children,g=e.className,y=e.startRoute,b=void 0===y?"/":y,x=ae(e,["showNavigator","showRefreshButton","showOpenInCodeSandbox","showSandpackErrorOverlay","showOpenNewtab","showRestartButton","actionsChildren","children","className","startRoute"]),w=ln({startRoute:b}),j=w.sandpack,S=w.listen,C=w.iframe,k=w.getClient,O=w.clientId,E=w.dispatch,N=t.useState(null),M=N[0],L=N[1],A=j.status,I=function(e){var t=Nt().dispatch;return{refresh:function(){return t({type:"refresh"},e)},back:function(){return t({type:"urlback"},e)},forward:function(){return t({type:"urlforward"},e)}}}(O).refresh,_=un(O).restart,T=Be();t.useEffect((function(){return S((function(e){"resize"===e.type&&L(e.height)}))}),[]),t.useImperativeHandle(n,(function(){return{clientId:O,getClient:k}}),[k,O]);return r.jsxs(Yt,ie({className:T("preview",[g])},x,{children:[i&&r.jsx(Un,{clientId:O,onURLChange:function(e){C.current&&(C.current.src=e)},startRoute:b}),r.jsxs("div",{className:T("preview-container",[Hn]),children:[r.jsx("iframe",{ref:C,className:T("preview-iframe",[zn]),style:{height:M||void 0},title:"Sandpack Preview"}),r.jsxs("div",{className:T("preview-actions",[Bn]),children:[h,f&&"node"===j.environment&&r.jsx(Wt,{onClick:_,children:r.jsx(me,{})}),!i&&s&&"running"===A&&r.jsx(Wt,{onClick:I,children:r.jsx(ye,{})}),j.teamId&&r.jsx("button",{className:T("button",[T("icon-standalone"),At,Lt,It]),onClick:function(){return E({type:"sign-out"})},title:"Sign out",type:"button",children:r.jsx(fe,{})}),l&&r.jsx(Cn,{})]}),r.jsx(In,{clientId:O,showOpenInCodeSandbox:l}),d&&r.jsx(mn,{}),v]})]}))})),Wn=["SyntaxError: ","Error in sandbox:"],Vn={id:"random",method:"clear",data:["Console was cleared"]},Zn=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof window)return window;if(void 0!==o)return o;if("undefined"!=typeof self)return self;throw Error("Unable to locate global object")}(),qn="function"==typeof ArrayBuffer,Yn="function"==typeof Map,$n="function"==typeof Set;(Nn=En||(En={}))[Nn.infinity=0]="infinity",Nn[Nn.minusInfinity=1]="minusInfinity",Nn[Nn.minusZero=2]="minusZero";var Gn={Arithmetic:function(e){return e===En.infinity?1/0:e===En.minusInfinity?-1/0:e===En.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(Ur){}}return n}catch(a){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(Zn[e.name]||Error)(e.message);return t.stack=e.stack,t},"[[ArrayBuffer]]":function(e){if(qn){var t=new ArrayBuffer(e.length);return new Int8Array(t).set(e),t}return e},"[[TypedArray]]":function(e){return"function"==typeof Zn[e.ctorName]?new Zn[e.ctorName](e.arr):e.arr},"[[Map]]":function(e){if(Yn){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($n){for(var t=new Set,n=0;n<e.length;n++)t.add(e[n]);return t}return e}},Kn=function(e){var t;if("string"==typeof e||"number"==typeof e||null===e)return e;if(Array.isArray(e))return e.map(Kn);if("object"==typeof e&&"@t"in e){var n=e["@t"];return(0,Gn[n])(e.data)}if("object"==typeof e&&"#@t"in e){n=e["#@t"];return(0,Gn[n])(e.data)}if("object"==typeof e&&"NodeList"===(null===(t=e.constructor)||void 0===t?void 0:t.name)){var r={};return Object.entries(e).forEach((function(e){var t=e[0],n=e[1];r[t]=Kn(n)})),r}return e},Xn=function(e,t,n){var r;void 0===n&&(n=0);try{var o=Kn(e);if(Array.isArray(o))return function(e,t,n){var r=e.reduce((function(e,r,o){return"".concat(e).concat(o?", ":"").concat(Xn(r,t,n))}),"");return"[".concat(r,"]")}(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 Xn(i,t,n+1)}if("NodeList"===(null===(r=o.constructor)||void 0===r?void 0:r.name)){var a=o.length,s=new Array(a).fill(null).map((function(e,n){return Xn(o[n],t)}));return"NodeList(".concat(o.length,")[").concat(s,"]")}return 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 a=r[0],s=r[1],c=0===i?"":", ",l=o.length>10?"\n ":"",u=Xn(s,t,n);return 400===i?e+l+"...":i>400?e:e+"".concat(c).concat(l).concat(a,": ")+u}),"");
1return"".concat(r,"{ ").concat(i).concat(o.length>10?"\n":" ","}")}(o,t,n+1)}}catch(Ur){return"Unable to print information"}},Qn=function(e){var n=e.data,o=Be();return r.jsx(r.Fragment,{children:n.map((function(e,n,i){var a=e.data,s=e.id,c=e.method;return a&&Array.isArray(a)?r.jsx(t.Fragment,{children:a.map((function(e,t){var a=i.slice(n,i.length);return r.jsx("div",{className:o("console-item",[er()]),children:r.jsx(sn,{code:"clear"===c?e:Xn(e,a),fileType:"js",initMode:"user-visible",showReadOnly:!1,readOnly:!0,wrapContent:!0})},"".concat(s,"-").concat(t))}))},s):null}))})},er=Ue,tr=Ue,nr=Ue,rr=function(e){var t=e.currentTab,n=e.setCurrentTab,o=e.node,i=Be(),a=i("console-header-button",[At,It,Ue]);return r.jsxs("div",{className:i("console-header",[tr,nr]),children:[r.jsxs("p",{className:i("console-header-title",[Ue]),children:[r.jsx(je,{}),r.jsx("span",{children:"Terminal"})]}),o&&r.jsxs("div",{className:i("console-header-actions",[nr]),children:[r.jsx("button",{className:a,"data-active":"server"===t,onClick:function(){return n("server")},type:"button",children:"Server"}),r.jsx("button",{className:a,"data-active":"client"===t,onClick:function(){return n("client")},type:"button",children:"Client"})]})]})};t.forwardRef((function(e,n){var o=e.showHeader,i=void 0===o||o,a=e.showSyntaxError,s=void 0!==a&&a,c=e.maxMessageCount,l=e.onLogsChange,u=e.className,d=e.showResetConsoleButton,p=void 0===d||d,f=e.showRestartButton,m=void 0===f||f,h=e.resetOnPreviewRestart,v=void 0!==h&&h,g=e.actionsChildren,y=void 0===g?r.jsx(r.Fragment,{}):g,b=e.standalone,x=void 0!==b&&b,w=ae(e,["showHeader","showSyntaxError","maxMessageCount","onLogsChange","className","showSetupProgress","showResetConsoleButton","showRestartButton","resetOnPreviewRestart","actionsChildren","standalone"]),j=Nt().sandpack.environment,S=ln(),C=S.iframe,k=S.clientId,O=un().restart,E=t.useState("node"===j?"server":"client"),N=E[0],M=E[1],L=x?k:void 0,A=function(e){var n=e.clientId,r=e.maxMessageCount,o=void 0===r?800:r,i=e.showSyntaxError,a=void 0!==i&&i,s=e.resetOnPreviewRestart,c=void 0!==s&&s,l=t.useState([]),u=l[0],d=l[1],p=Nt().listen;return t.useEffect((function(){return p((function(e){if(c&&"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([Vn]);var n=a?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?void 0:t.filter)||void 0===n?void 0:n.call(t,(function(e){return"string"!=typeof e||0===Wn.filter((function(t){return e.startsWith(t)})).length})))&&void 0!==r?r:[]).length>0}));if(!n)return;d((function(e){for(var t=le(le([],e,!0),n,!0).filter((function(e,t,n){return t===n.findIndex((function(t){return t.id===e.id}))}));t.length>o;)t.shift();return t}))}}),n)}),[a,o,n,c]),{logs:u,reset:function(){return d([])}}}({maxMessageCount:c,showSyntaxError:s,resetOnPreviewRestart:v,clientId:L}),I=A.logs,_=A.reset,T=pn({maxMessageCount:c,clientId:L}),R=T.logs,D=T.reset,P=t.useRef(null);t.useEffect((function(){null==l||l(I),P.current&&(P.current.scrollTop=P.current.scrollHeight)}),[l,I,R,N]);var F="server"===N,U="node"===j;t.useImperativeHandle(n,(function(){return{reset:function(){_(),D()}}}));var H=Be();return r.jsxs(Yt,ie({className:H("console",[Ue,u])},w,{children:[i&&U&&r.jsx(rr,{currentTab:N,node:U,setCurrentTab:M}),r.jsx("div",{ref:P,className:H("console-list",[Ue]),children:F?r.jsx(gn,{data:R}):r.jsx(Qn,{data:I})}),r.jsxs("div",{className:H("console-actions",[Ue]),children:[y,m&&F&&r.jsx(Wt,{onClick:function(){O(),_(),D()},children:r.jsx(me,{})}),p&&r.jsx(Wt,{onClick:function(){"client"===N?_():D()},children:r.jsx(be,{})})]}),x&&r.jsxs(r.Fragment,{children:[r.jsx(Rn,{clientId:L}),r.jsx("iframe",{ref:C})]})]}))}));var or,ir,ar=function(){function e(e,t,n){void 0===n&&(n={}),this.status="idle",this.options=n,this.sandboxSetup=t,this.iframeSelector=e}return e.prototype.updateOptions=function(e){u(this.options,e)||(this.options=e,this.updateSandbox())},e.prototype.updateSandbox=function(e,t){throw void 0===e&&(e=this.sandboxSetup),Error("Method not implemented")},e.prototype.destroy=function(){throw Error("Method not implemented")},e.prototype.dispatch=function(e){throw Error("Method not implemented")},e.prototype.listen=function(e){throw Error("Method not implemented")},e}(),sr=function(){function e(){this.listeners={},this.listenersCount=0,this.channelId=Math.floor(1e6*Math.random()),this.listeners=[]}return e.prototype.cleanup=function(){this.listeners={},this.listenersCount=0},e.prototype.dispatch=function(e){Object.values(this.listeners).forEac
1h((function(t){return t(e)}))},e.prototype.listener=function(e){var t=this;if("function"!=typeof e)return function(){};var n=this.listenersCount;return this.listeners[n]=e,this.listenersCount++,function(){delete t.listeners[n]}},e}();function cr(e){return/[a-zA-Z.]/.test(e)}function lr(e){return/[a-zA-Z]/.test(e)}function ur(e){return/[&|]/.test(e)}function dr(e){return/-/.test(e)}function pr(e){return/["']/.test(e)}function fr(e){return lr(e)&&e===e.toUpperCase()}(ir=or||(or={})).OR="OR",ir.AND="AND",ir.PIPE="PIPE",ir.Command="Command",ir.Argument="Argument",ir.String="String",ir.EnvVar="EnvVar";var mr=new Map([["&&",{type:or.AND}],["||",{type:or.OR}],["|",{type:or.PIPE}],["-",{type:or.Argument}]]);var hr=0;function vr(){var e=Date.now(),t=Math.round(1e4*Math.random()),n=hr+=1;return(+"".concat(e).concat(t).concat(n)).toString(16)}var gr=function(e){return"string"==typeof e?(new TextEncoder).encode(e):e},yr=function(e){return"string"==typeof e?e:(new TextDecoder).decode(e)},br=function(e){return Object.entries(e).reduce((function(e,t){var n=t[0],r=t[1];return e[n]=gr(r.code),e}),{})},xr=function(t){var n={},r=["dev","start"];try{n=JSON.parse(t).scripts}catch(s){throw K("Could not parse package.json file: "+s.message)}e(n,"Failed to start. Please provide a `start` or `dev` script on the package.json");for(var o=function(e){if(r[e]in n){var t=n[r[e]],o={},i="",a=[];return function(e){var t=0,n=[];function r(){for(var n="";cr(e[t])&&t<e.length;)n+=e[t],t++;return{type:or.Command,value:n}}function o(){for(var n="";ur(e[t])&&t<e.length;)n+=e[t],t++;return mr.get(n)}function i(){for(var n="";(dr(e[t])||lr(e[t]))&&t<e.length;)n+=e[t],t++;return{type:or.Argument,value:n}}function a(){var n=e[t],r=e[t];for(t++;e[t]!==n&&t<e.length;)r+=e[t],t++;return r+=e[t],t++,{type:or.String,value:r}}function s(){for(var n={},r=function(){for(var r="",o="";"="!==e[t]&&t<e.length;)r+=e[t],t++;for("="===e[t]&&t++;" "!==e[t]&&t<e.length;)o+=e[t],t++;n[r]=o};fr(e[t])&&t<e.length;)r(),t++;return{type:or.EnvVar,value:n}}for(;t<e.length;){var c=e[t];if(/\s/.test(c))t++;else switch(!0){case fr(c):n.push(s());break;case cr(c):n.push(r());break;case ur(c):n.push(o());break;case dr(c):n.push(i());break;case pr(c):n.push(a());break;default:throw new Error("Unknown character: ".concat(c))}}return n}(t).forEach((function(e){var t=""===i;e.type===or.EnvVar&&(o=e.value),e.type===or.Command&&t&&(i=e.value),(e.type===or.Argument||!t&&e.type===or.Command)&&a.push(e.value)})),{value:[i,a,{env:o}]}}},i=0;i<r.length;i++){var a=o(i);if("object"==typeof a)return a.value}throw K("Failed to start. Please provide a `start` or `dev` script on the package.json")},wr=function(e){return"string"==typeof e?e:"object"==typeof e&&"message"in e?e.message:K("The server could not be reached. Make sure that the node script is running and that a port has been started.")},jr='var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e={},n={};!function(t){t.__esModule=!0,t.default=["log","debug","info","warn","error","table","clear","time","timeEnd","count","assert","command","result"]}(n);var a,o={},i={};(a=i).__esModule=!0,a.default=function(){var t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};
1return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+"-"+Date.now()};var u={},s={__esModule:!0};s.update=s.state=void 0,s.update=function(t){s.state=t};var f={},c={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.initialState=void 0,r.initialState={timings:{},count:{}};var n=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};r.default=function(t,a){var o,i,u;switch(void 0===t&&(t=r.initialState),a.type){case"COUNT":var s=t.count[a.name]||0;return e(e({},t),{count:e(e({},t.count),(o={},o[a.name]=s+1,o))});case"TIME_START":return e(e({},t),{timings:e(e({},t.timings),(i={},i[a.name]={start:n()},i))});case"TIME_END":var f=t.timings[a.name],c=n(),l=c-f.start;return e(e({},t),{timings:e(e({},t.timings),(u={},u[a.name]=e(e({},f),{end:c,time:l}),u))});default:return t}}}(c),function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var n=e(c),a=s;r.default=function(t){a.update(n.default(a.state,t))}}(f);var l={__esModule:!0};l.timeEnd=l.timeStart=l.count=void 0,l.count=function(t){return{type:"COUNT",name:t}},l.timeStart=function(t){return{type:"TIME_START",name:t}},l.timeEnd=function(t){return{type:"TIME_END",name:t}};var d=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};u.__esModule=!0,u.stop=u.start=void 0;var p=s,h=d(f),m=l;u.start=function(t){h.default(m.timeStart(t))},u.stop=function(t){var r=null===p.state||void 0===p.state?void 0:p.state.timings[t];return r&&!r.end?(h.default(m.timeEnd(t)),{method:"log",data:[t+": "+p.state.timings[t].time+"ms"]}):{method:"warn",data:["Timer \'"+t+"\' does not exist"]}};var y={},v=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};y.__esModule=!0,y.increment=void 0;var _=s,b=v(f),g=l;y.increment=function(t){return b.default(g.count(t)),{method:"log",data:[t+": "+_.state.count[t]]}};var M={},T=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n};M.__esModule=!0,M.test=void 0,M.test=function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return!t&&(0===r.length&&r.push("console.assert"),{method:"error",data:T(["Assertion failed:"],r)})},function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)},n=t&&t.__createBinding||(Object.create?function(t,r,e,n){void 0===n&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}),a=t&&t.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),o=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)"default"!==e&&Object.prototype.hasOwnProperty.call(t,e)&&n(r,t,e);return a(r,t),r},s=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n},f=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var c=f(i),l=o(u),d=o(y),p=o(M);r.default=function(t,r,n){var a=n||c.default();switch(t){case"clear":return{method:t,id:a};case"count":return!!(o="string"==typeof r[0]?r[0]:"default")&&e(e({},d.increment(o)),{id:a});case"time":case"timeEnd":var o;return!!(o="string"==typeof r[0]?r[0]:"default")&&("time"===t?(l.start(o),!1):e(e({},l.stop(o)),{id:a}));case"assert":if(0!==r.length){var i=p.test.apply(p,s([r[0]],r.slice(1)));if(i)return e(e({},i),{id:a})}return!1;case"error":return{method:t,id:a,data:r.map((function(t){try{return t.stack||t}catch(r){return t}}))};default:return{method:t,id:a,data:r}}}}(o);var S={},O={};!function(t){var r;t.__esModule=!0,function(t){t[t.infinity=0]="infinity",t[t.minusInfinity=1]="minusInfinity",t[t.minusZero=2]="minusZero"}(r||(r={})),t.default={type:"Arithmetic",lookup:Number,shouldTransform:function(t,r){return"number"===t&&(r===1/0||r===-1/0||function(t){return 1/t==-1/0}(r))},toSerializable:function(t){return t===1/0?r.infinity:t===-1/0?r.minu
1sInfinity:r.minusZero},fromSerializable:function(t){return t===r.infinity?1/0:t===r.minusInfinity?-1/0:t===r.minusZero?-0:t}}}(O);var w={};!function(t){t.__esModule=!0,t.default={type:"Function",lookup:Function,shouldTransform:function(t,r){return"function"==typeof r},toSerializable:function(t){var r="";try{r=t.toString().substring(r.indexOf("{")+1,r.lastIndexOf("}"))}catch(t){}return{name:t.name,body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){try{var r=function(){};return"string"==typeof t.name&&Object.defineProperty(r,"name",{value:t.name,writable:!1}),"string"==typeof t.body&&Object.defineProperty(r,"body",{value:t.body,writable:!1}),"string"==typeof t.proto&&(r.constructor={name:t.proto}),r}catch(r){return t}}}}(w);var A={};!function(t){var r;function e(t){for(var r={},e=0,n=t.attributes;e<n.length;e++){var a=n[e];r[a.name]=a.value}return r}t.__esModule=!0,t.default={type:"HTMLElement",shouldTransform:function(t,r){return r&&r.children&&"string"==typeof r.innerHTML&&"string"==typeof r.tagName},toSerializable:function(t){return{tagName:t.tagName.toLowerCase(),attributes:e(t),innerHTML:t.innerHTML}},fromSerializable:function(t){try{var e=(r||(r=document.implementation.createHTMLDocument("sandbox"))).createElement(t.tagName);e.innerHTML=t.innerHTML;for(var n=0,a=Object.keys(t.attributes);n<a.length;n++){var o=a[n];try{e.setAttribute(o,t.attributes[o])}catch(t){}}return e}catch(r){return t}}}}(A);var j={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.default={type:"Map",shouldTransform:function(t,r){return r&&r.constructor&&"Map"===r.constructor.name},toSerializable:function(t){var r={};return t.forEach((function(t,e){var n="object"==typeof e?JSON.stringify(e):e;r[n]=t})),{name:"Map",body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){var r=t.body,n=e({},r);return"string"==typeof t.proto&&(n.constructor={name:t.proto}),n}}}(j);var z={};!function(t){t.__esModule=!0;var r="@t",e=/^#*@(t|r)$/,n=(0,eval)("this"),a="function"==typeof ArrayBuffer,o="function"==typeof Map,i="function"==typeof Set,u=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],s=Array.prototype.slice,f={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}},c=function(){function t(t,r){this.references=t,this.transforms=r,this.transformsMap=this._makeTransformsMap(),this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}return t._createRefMark=function(t){var r=Object.create(null);return r["@r"]=t,r},t.prototype._createCircularCandidate=function(t,r,e){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:r,key:e,refIdx:-1})},t.prototype._applyTransform=function(t,e,n,a){var o=Object.create(null),i=a.toSerializable(t);return"object"==typeof i&&this._createCircularCandidate(t,e,n),o[r]=a.type,o.data=this._handleValue((function(){return i}),e,n),o},t.prototype._handleArray=function(t){for(var r=[],e=function(e){r[e]=n._handleValue((function(){return t[e]}),r,e)},n=this,a=0;a<t.length;a++)e(a);return r},t.prototype._handlePlainObject=function(t){var r,n,a=Object.create(null),o=function(r){if(Reflect.has(t,r)){var n=e.test(r)?"#"+r:r;a[n]=i._handleValue((function(){return t[r]}),a,n)}},i=this;for(var u in t)o(u);var s=null===(n=null===(r=null==t?void 0:t.__proto__)||void 0===r?void 0:r.constructor)||void 0===n?void 0:n.name;return s&&"Object"!==s&&(a.constructor={name:s}),a},t.prototype._handleObject=function(t,r,e){return this._createCircularCandidate(t,r,e),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},t.prototype._ensureCircularReference=function(r){var e=this.circularCandidates.indexOf(r);if(e>-1){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),t._createRefMark(n.refIdx)}return null},t.prototype._handleValue=function(t,r,e){try{var n=t(),a=typeof n,o="object"===a&&null!==n;if(o){var i=this._ensureCircularReference(n);if(i)return i}var u=this._findTransform(a,n);return u?this._applyTransform(n,r,e,u):o?this._handleObject(n,r,e):n}catch(t){try{return this._handleValue((function(){return t instanceof Error?t:new Error(t)}),r,e)}catch(t){return null}}},t.prototype._makeTransformsMap=function(){if(o){var t=new Map;
1return this.transforms.forEach((function(r){r.lookup&&t.set(r.lookup,r)})),t}},t.prototype._findTransform=function(t,r){if(o&&r&&r.constructor&&(null==(a=this.transformsMap.get(r.constructor))?void 0:a.shouldTransform(t,r)))return a;for(var e=0,n=this.transforms;e<n.length;e++){var a;if((a=n[e]).shouldTransform(t,r))return a}},t.prototype.transform=function(){for(var r=this,e=[this._handleValue((function(){return r.references}),null,null)],n=0,a=this.circularCandidatesDescrs;n<a.length;n++){var o=a[n];o.refIdx>0&&(e[o.refIdx]=o.parent[o.key],o.parent[o.key]=t._createRefMark(o.refIdx))}return e},t}(),l=function(){function t(t,r){this.activeTransformsStack=[],this.visitedRefs=Object.create(null),this.references=t,this.transformMap=r}return t.prototype._handlePlainObject=function(t){var r=Object.create(null);for(var n in"constructor"in t&&(t.constructor&&"string"==typeof t.constructor.name||(t.constructor={name:"Object"})),t)t.hasOwnProperty(n)&&(this._handleValue(t[n],t,n),e.test(n)&&(r[n.substring(1)]=t[n],delete t[n]));for(var a in r)t[a]=r[a]},t.prototype._handleTransformedObject=function(t,e,n){var a=t[r],o=this.transformMap[a];if(!o)throw new Error("Can\'t find transform for \\""+a+\'" type.\');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=o.fromSerializable(t.data)},t.prototype._handleCircularSelfRefDuringTransform=function(t,r,e){var n=this.references;Object.defineProperty(r,e,{val:void 0,configurable:!0,enumerable:!0,get:function(){return void 0===this.val&&(this.val=n[t]),this.val},set:function(t){this.val=t}})},t.prototype._handleCircularRef=function(t,r,e){this.activeTransformsStack.includes(this.references[t])?this._handleCircularSelfRefDuringTransform(t,r,e):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),r[e]=this.references[t])},t.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var a=t["@r"];if(void 0!==a)this._handleCircularRef(a,e,n);else if(t[r])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var o=0;o<t.length;o++)this._handleValue(t[o],t,o);else this._handlePlainObject(t)}},t.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]},t}(),d=[{type:"[[NaN]]",shouldTransform:function(t,r){return"number"===t&&isNaN(r)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",lookup:Date,shouldTransform:function(t,r){return r instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var r=new Date;return r.setTime(t),r}},{type:"[[RegExp]]",lookup:RegExp,shouldTransform:function(t,r){return r instanceof RegExp},toSerializable:function(t){var r={src:t.source,flags:""};return t.globalThis&&(r.flags+="g"),t.ignoreCase&&(r.flags+="i"),t.multiline&&(r.flags+="m"),r},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",lookup:Error,shouldTransform:function(t,r){return r instanceof Error},toSerializable:function(t){var r,e;return t.stack||null===(e=(r=Error).captureStackTrace)||void 0===e||e.call(r,t),{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var r=new(n[t.name]||Error)(t.message);return r.stack=t.stack,r}},{type:"[[ArrayBuffer]]",lookup:a&&ArrayBuffer,shouldTransform:function(t,r){return a&&r instanceof ArrayBuffer},toSerializable:function(t){var r=new Int8Array(t);return s.call(r)},fromSerializable:function(t){if(a){var r=new ArrayBuffer(t.length);return new Int8Array(r).set(t),r}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,r){if(a)return ArrayBuffer.isView(r)&&!(r instanceof DataView);for(var e=0,o=u;e<o.length;e++){var i=o[e];if("function"==typeof n[i]&&r instanceof n[i])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:s.call(t)}},fromSerializable:function(t){return"function"==typeof n[t.ctorName]?new n[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",lookup:o&&Map,shouldTransform:function(t,r){return o&&r instanceof Map},toSerializable:function(t){var r=[];return t.forEach((function(t,e){r.push(e),r.push(t)})),r},fromSerializable:function(t){if(o){for(var r=new Map,e=0;e<t.length;e+=2)r.set(t[e],t[e+1]);return r}for(var n=[],a=0;a<t.length;a+=2)n.push([t[e],t[e+1]]);return n}}
1,{type:"[[Set]]",lookup:i&&Set,shouldTransform:function(t,r){return i&&r instanceof Set},toSerializable:function(t){var r=[];return t.forEach((function(t){r.push(t)})),r},fromSerializable:function(t){if(i){for(var r=new Set,e=0;e<t.length;e++)r.add(t[e]);return r}return t}}],p=function(){function t(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||f,this.addTransforms(d)}return t.prototype.addTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r];if(this.transformsMap[n.type])throw new Error(\'Transform with type "\'+n.type+\'" was already added.\');this.transforms.push(n),this.transformsMap[n.type]=n}return this},t.prototype.removeTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r],a=this.transforms.indexOf(n);a>-1&&this.transforms.splice(a,1),delete this.transformsMap[n.type]}return this},t.prototype.encode=function(t){var r=new c(t,this.transforms).transform();return this.serializer.serialize(r)},t.prototype.decode=function(t){var r=this.serializer.deserialize(t);return new l(r,this.transformsMap).transform()},t}();t.default=p}(z);var E=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};S.__esModule=!0,S.Decode=P=S.Encode=void 0;var k=E(O),C=E(w),D=E(A),I=E(j),N=E(z),R=[D.default,C.default,k.default,I.default],x=new N.default;x.addTransforms(R);var P=S.Encode=function(t){return JSON.parse(x.encode(t))};S.Decode=function(t){return x.decode(JSON.stringify(t))},function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var a=e(n),i=e(o),u=S;r.default=function(t,r,e){void 0===e&&(e=!0);for(var n=t,o={pointers:{},src:{npm:"https://npmjs.com/package/console-feed",github:"https://github.com/samdenty99/console-feed"}},s=function(t){var a=n[t];n[t]=function(){a.apply(this,arguments);var n=[].slice.call(arguments);setTimeout((function(){var a=i.default(t,n);if(a){var o=a;e&&(o=u.Encode(a)),r(o,a)}}))},o.pointers[t]=a},f=0,c=a.default;f<c.length;f++)s(c[f]);return n.feed=o,n}}(e),r(e)(window.console,(function(t){var r=P(t);parent.postMessage({type:"console",codesandbox:!0,log:Array.isArray(r)?r[0]:r,channelId:scope.channelId},"*")}));\n';function Sr(e,t){return Y(this,0,void 0,(function(){var n,r;return $(this,(function(o){return X(e.contentWindow,"Failed to await preview iframe: no content window found"),9e4,20,n=0,[2,new Promise((function(o,i){var a=function(){var s=function(){clearTimeout(r),n=20,o(),e.removeEventListener("load",s)};n>=20?i(K("Could not able to connect to preview.")):(e.setAttribute("src",t),r=setTimeout((function(){a(),e.removeEventListener("load",s)}),9e4),n+=1,e.addEventListener("load",s))};e.addEventListener("error",(function(){return i(new Error("Iframe error"))})),e.addEventListener("abort",(function(){return i(new Error("Aborted"))})),a()}))]}))}))}var Cr=[{code:function(e){var t=e.scope,n=window.history.__proto__,r=[],o=0,i=function(e){parent.postMessage({type:"urlchange",url:e,back:o>0,forward:o<r.length-1,channelId:t.channelId},"*")};Object.assign(window.history,{go:function(e){var t=o+e;if(t>=0&&t<=r.length-1){var a=r[o=t],s=a.url,c=a.state;n.replaceState.call(window.history,c,"",s);var l=document.location.href;i(l),window.dispatchEvent(new PopStateEvent("popstate",{state:c}))}},back:function(){window.history.go(-1)},forward:function(){window.history.go(1)},pushState:function(e,t,a){n.replaceState.call(window.history,e,t,a),function(e,t){r.splice(o+1),r.push({url:e,state:t}),o=r.length-1}(a,e),i(document.location.href)},replaceState:function(e,t,a){n.replaceState.call(window.history,e,t,a),r[o]={state:e,url:a},i(document.location.href)}}),window.addEventListener("message",(function(e){var t=e.data;"urlback"===t.type?history.back():"urlforward"===t.type?history.forward():"refresh"===t.type&&document.location.reload()}))}.toString(),id:"historyListener"},{code:"function consoleHook({ scope }) {"+jr+"\n};",id:"consoleHook"},{code:function(e){var t,n=e.scope,r=0;function o(){var e=function(){if("undefined"==typeof window)return 0;var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.offsetHeight)}();r!==e&&window.parent.postMessage({type:"resize",height:e,codesandbox:!0,channelId:n.channelId},"*"),r=e}o(),new MutationObserver((function(){void 0===t&&(o(),t=setTimeout((function(){t=void 0}),300))})).observe(document,{attributes:!0,childList:!0,subtree:!0}),setInterval(o,300)}.toString(),id:"watchResize"}],kr=function(e){function t(t,n,r){void 0===r&&(r={});var o=e.call(this,t,n,q(q({},r),{bundlerURL:r.bundlerURL}))||this;return o._modulesCache=new Map,o.messageChannelId=vr(),o._initPromise=null,o.emitter=new sr,o.manageIframes(t),o.emulator=new p({iframe:o.emulatorIframe,runtimeUrl:o.options.bundlerURL}),o.updateSandbox(n),o}return W(t,e),t.prototype._init=function(e){return Y(this,0,void 0,(function(){return $(this,(function(t){switch(t.label){case 0:return[4,this.emulator.connect()];case 1:return t.sent(),[4,this.emulator.fs.init(e)];case 2:return t.sent(),[4,this.globalListeners()];case 3:return t.sent(),[2]}}))}))},t.prototype.compile=function(e){return Y(this,0,void 0,(function(){var t,n;return $(this,(function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),this.status="initializing",this.dispatch({type:"start",firstLoad:!0}),this._initPromise||(this._initPromise=this._init(e)),[4,this._initPromise];case 1:return r.sent(),this.dispatch({type:"connected"}),[4,this.createShellProcessFromTask(e)];case 2:return t=r.sent().id,[4,this.createPreviewURLFromId(t)];case 3:return r.sent(),[4,this.setLocationURLIntoIFrame()];case 4:return r.sent(),this.dispatchDoneMessage(),[3,6];case 5:return n=r.sent(),this.dispatch({type:"action",action:"notification",notificationType:"error",title:wr(n)}),this.dispatch({type:"done",compilatonError:!0}),[3,6];case 6:return[2]}}
1))}))},t.prototype.createShellProcessFromTask=function(e){return Y(this,0,void 0,(function(){var t,n,r=this;return $(this,(function(o){switch(o.label){case 0:return t=yr(e["/package.json"]),this.emulatorCommand=xr(t),this.emulatorShellProcess=this.emulator.shell.create(),[4,this.emulatorShellProcess.on("exit",(function(e){r.dispatch({type:"action",action:"notification",notificationType:"error",title:K("Error: process.exit(".concat(e,") called."))})}))];case 1:return o.sent(),[4,this.emulatorShellProcess.on("progress",(function(e){var t,n;if("command_running"===e.state||"starting_command"===e.state)return r.dispatch({type:"shell/progress",data:q(q({},e),{command:[null===(t=r.emulatorCommand)||void 0===t?void 0:t[0],null===(n=r.emulatorCommand)||void 0===n?void 0:n[1].join(" ")].join(" ")})}),void(r.status="installing-dependencies");r.dispatch({type:"shell/progress",data:e})}))];case 2:return o.sent(),this.emulatorShellProcess.stdout.on("data",(function(e){r.dispatch({type:"stdout",payload:{data:e,type:"out"}})})),this.emulatorShellProcess.stderr.on("data",(function(e){r.dispatch({type:"stdout",payload:{data:e,type:"err"}})})),[4,(n=this.emulatorShellProcess).runCommand.apply(n,this.emulatorCommand)];case 3:return[2,o.sent()]}}))}))},t.prototype.createPreviewURLFromId=function(e){var t;return Y(this,0,void 0,(function(){var n;return $(this,(function(r){switch(r.label){case 0:return this.iframePreviewUrl=void 0,[4,this.emulator.preview.getByShellId(e)];case 1:return n=r.sent().url,this.iframePreviewUrl=n+(null!==(t=this.options.startRoute)&&void 0!==t?t:""),[2]}}))}))},t.prototype.manageIframes=function(e){var t,n,r;if("string"==typeof e){var o=document.querySelector(e);X(o,"The element '".concat(e,"' was not found")),this.iframe=document.createElement("iframe"),null==o||o.appendChild(this.iframe)}else this.iframe=e;n=this.iframe,r=this.options,n.style.border="0",n.style.width=r.width||"100%",n.style.height=r.height||"100%",n.style.overflow="hidden",n.allow="cross-origin-isolated",X(this.iframe.parentNode,"The given iframe does not have a parent."),this.emulatorIframe=document.createElement("iframe"),this.emulatorIframe.classList.add("sp-bridge-frame"),null===(t=this.iframe.parentNode)||void 0===t||t.appendChild(this.emulatorIframe)},t.prototype.setLocationURLIntoIFrame=function(){return Y(this,0,void 0,(function(){return $(this,(function(e){switch(e.label){case 0:return this.iframePreviewUrl?[4,Sr(this.iframe,this.iframePreviewUrl)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}
1))}))},t.prototype.dispatchDoneMessage=function(){this.status="done",this.dispatch({type:"done",compilatonError:!1}),this.iframePreviewUrl&&this.dispatch({type:"urlchange",url:this.iframePreviewUrl,back:!1,forward:!1})},t.prototype.globalListeners=function(){return Y(this,0,void 0,(function(){var e=this;return $(this,(function(t){switch(t.label){case 0:return window.addEventListener("message",(function(t){var n,r;t.data.type===d&&(n=e.iframe,r=e.messageChannelId,Cr.forEach((function(e){var t,o=e.code,i={uid:e.id,type:f,code:"exports.activate = ".concat(o),scope:{channelId:r}};null===(t=n.contentWindow)||void 0===t||t.postMessage(i,"*")}))),"urlchange"===t.data.type&&t.data.channelId===e.messageChannelId?e.dispatch({type:"urlchange",url:t.data.url,back:t.data.back,forward:t.data.forward}):t.data.channelId===e.messageChannelId&&e.dispatch(t.data)})),[4,this.emulator.fs.watch(["*"],[".next","node_modules","build","dist","vendor",".config",".vuepress"],(function(t){return Y(e,0,void 0,(function(){var e,n,r,o,i;return $(this,(function(a){switch(a.label){case 0:return t?(n="newPath"in(e=t)?e.newPath:"path"in e?e.path:"",[4,this.emulator.fs.stat(n)]):[2];case 1:if("file"!==a.sent().type)return[2,null];a.label=2;case 2:switch(a.trys.push([2,10,,11]),e.type){case"change":case"create":return[3,3];case"remove":return[3,5];case"rename":return[3,6];case"close":return[3,8]}return[3,9];case 3:return[4,this.emulator.fs.readFile(e.path,"utf8")];case 4:return r=a.sent(),this.dispatch({type:"fs/change",path:e.path,content:r}),this._modulesCache.set(e.path,gr(r)),[3,9];case 5:return this.dispatch({type:"fs/remove",path:e.path}),this._modulesCache.delete(e.path),[3,9];case 6:return this.dispatch({type:"fs/remove",path:e.oldPath}),this._modulesCache.delete(e.oldPath),[4,this.emulator.fs.readFile(e.newPath,"utf8")];case 7:return o=a.sent(),this.dispatch({type:"fs/change",path:e.newPath,content:o}),this._modulesCache.set(e.newPath,gr(o)),[3,9];case 8:return[3,9];case 9:return[3,11];case 10:return i=a.sent(),this.dispatch({type:"action",action:"notification",notificationType:"error",title:wr(i)}),[3,11];case 11:return[2]}}
1))}))}))];case 1:return t.sent(),[2]}}))}))},t.prototype.restartShellProcess=function(){var e;return Y(this,0,void 0,(function(){return $(this,(function(t){switch(t.label){case 0:return this.emulatorShellProcess&&this.emulatorCommand?(this.dispatch({type:"start",firstLoad:!0}),this.status="initializing",[4,this.emulatorShellProcess.kill()]):[3,3];case 1:return t.sent(),null===(e=this.iframe)||void 0===e||e.removeAttribute("attr"),this.emulator.fs.rm("/node_modules/.vite",{recursive:!0,force:!0}),[4,this.compile(Object.fromEntries(this._modulesCache))];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype.updateSandbox=function(e){var t,n=this,r=br(e.files);"running"!==(null===(t=this.emulatorShellProcess)||void 0===t?void 0:t.state)?(this.dispatch({codesandbox:!0,modules:r,template:e.template,type:"compile"}),Object.entries(r).forEach((function(e){var t=e[0],r=e[1];n._modulesCache.set(t,gr(r))}))):Object.entries(r).forEach((function(e){var t=e[0],r=e[1];n._modulesCache.get(t)&&yr(r)===yr(n._modulesCache.get(t))||n.emulator.fs.writeFile(t,r,{recursive:!0})}))},t.prototype.dispatch=function(e){var t,n;return Y(this,0,void 0,(function(){return $(this,(function(r){switch(r.label){case 0:switch(e.type){case"compile":return[3,1];case"refresh":return[3,2];case"urlback":case"urlforward":return[3,4];case"shell/restart":return[3,5];case"shell/openPreview":return[3,6]}return[3,7];case 1:return this.compile(e.modules),[3,8];case 2:return[4,this.setLocationURLIntoIFrame()];case 3:return r.sent(),[3,8];case 4:return null===(n=null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage(e,"*"),[3,8];case 5:return this.restartShellProcess(),[3,8];case 6:return window.open(this.iframePreviewUrl,"_blank"),[3,8];case 7:this.emitter.dispatch(e),r.label=8;case 8:return[2]}}
1))}))},t.prototype.listen=function(e){return this.emitter.listener(e)},t.prototype.destroy=function(){this.emulatorIframe.remove(),this.emitter.cleanup()},t}(ar);const Or=Object.freeze(Object.defineProperty({__proto__:null,SandpackNode:kr},Symbol.toStringTag,{value:"Module"}));var Er=function(e){return"string"==typeof e?e:(new TextDecoder).decode(e)},Nr=function(e){function t(t,n,r){var o;void 0===r&&(r={});var i=e.call(this,t,n,r)||this;if(i.files=new Map,i.status="initializing",i.emitter=new sr,i.previewController=new m.PreviewController({baseUrl:null!==(o=r.bundlerURL)&&void 0!==o?o:"https://preview.sandpack-static-server.codesandbox.io",getFileContent:function(e){var t=i.files.get(e);if(!t)throw new Error("File not found");if(e.endsWith(".html")||e.endsWith(".htm"))try{t=function(e){var t=Er(e),n=(new DOMParser).parseFromString(t,"text/html");n.documentElement.getAttribute("lang")||n.documentElement.setAttribute("lang","en");var r=n.documentElement.outerHTML;return"<!DOCTYPE html>\n".concat(r)}(t),t=i.injectProtocolScript(t),t=i.injectExternalResources(t,r.externalResources),t=i.injectScriptIntoHead(t,{script:jr,scope:{channelId:vr()}})}catch(n){console.error("Runtime injection failed",n)}return t}}),"string"==typeof t){i.selector=t;var a=document.querySelector(t);i.element=a,i.iframe=document.createElement("iframe")}else i.element=t,i.iframe=t;return i.iframe.getAttribute("sandbox")||(i.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads allow-pointer-lock"),i.iframe.setAttribute("allow","accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-read; clipboard-write; xr-spatial-tracking;")),i.eventListener=i.eventListener.bind(i),"undefined"!=typeof window&&window.addEventListener("message",i.eventListener),i.updateSandbox(),i}return W(t,e),t.prototype.injectContentIntoHead=function(e,t){var n;return e=null!==(n=function(e,t,n){var r=e.exec(t);if(r&&r.length>=1){var o=r.index+r[0].length;return t.substring(0,o)+n+t.substring(o)}}(/<head[^<>]*>/g,e=Er(e),"\n"+t))&&void 0!==n?n:t+"\n"+e},t.prototype.injectProtocolScript=function(e){return this.injectContentIntoHead(e,'<script>\n window.addEventListener("message", (message) => {\n if(message.data.type === "refresh") {\n window.location.reload();\n }\n })\n<\/script>')},t.prototype.injectExternalResources=function(e,t){void 0===t&&(t=[]);var n=t.map((function(e){var t=e.match(/\.([^.]*)$/),n=null==t?void 0:t[1];if("css"===n||e.includes("fonts.googleapis"))return'<link rel="stylesheet" href="'.concat(e,'">');if("js"===n)return'<script src="'.concat(e,'"><\/script>');throw new Error("Unable to determine file type for external resource: ".concat(e))})).join("\n");return this.injectContentIntoHead(e,n)},t.prototype.injectScriptIntoHead=function(e,t){var n=t.script,r=t.scope,o=void 0===r?{}:r,i="\n <script>\n const scope = ".concat(JSON.stringify(o),";\n ").concat(n,"\n <\/script>\n ").trim();return this.injectContentIntoHead(e,i)},t.prototype.updateSandbox=function(e,t){void 0===e&&(e=this.sandboxSetup);var n=br(e.files);this.dispatch({codesandbox:!0,modules:n,template:e.template,type:"compile"})},t.prototype.compile=function(e){return Y(this,0,void 0,(function(){var t;return $(this,(function(n){switch(n.label){case 0:return this.files=new Map(Object.entries(e)),[4,this.previewController.initPreview()];case 1:return t=n.sent(),this.iframe.setAttribute("src",t),this.status="done",this.dispatch({type:"done",compilatonError:!1}),this.dispatch({type:"urlchange",url:t,back:!1,forward:!1}),[2]}}))}))},t.prototype.eventListener=function(e){if(e.source===this.iframe.contentWindow){var t=e.data;t.codesandbox&&this.dispatch(t)}},t.prototype.dispatch=function(e){var t;if("compile"===e.type)this.compile(e.modules);else null===(t=this.iframe.contentWindow)||void 0===t||t.postMessage(e,"*"),this.emitter.dispatch(e)},t.prototype.listen=function(e){return this.emitter.listener(e)},t.prototype.destroy=function(){this.emitter.cleanup(),"undefined"!=typeof window&&window.removeEventListener("message",this.eventListener)},t}(ar);const Mr=Object.freeze(Object.defineProperty({__proto__:null,SandpackStatic:Nr},Symbol.toStringTag,{value:"Module"}));for(var Lr=function(){function e(e,t,n){var r=this;this.type=e,this.handleMessage=t,this.protocol=n,this._disposeMessageListener=this.protocol.channelListen((function(e){return Y(r,0,void 0,(function(){var t,n,r,o;return $(this,(function(i){switch(i.label){case 0:if(e.type!==this.getTypeId()||!e.method)return[3,4];t=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.handleMessage(t)];case 2:return n=i.sent(),o={type:this.getTypeId(),msgId:t.msgId,result:n},this.protocol.dispatch(o),[3,4];case 3:return r=i.sent(),o={type:this.getTypeId(),msgId:t.msgId,error:{message:r.message}},this.protocol.dispatch(o),[3,4];case 4:return[2]}}
1))}))}))}return e.prototype.getTypeId=function(){return"protocol-".concat(this.type)},e.prototype.dispose=function(){this._disposeMessageListener()},e}(),Ar=function(){function e(e,t){this.globalListeners={},this.globalListenersCount=0,this.channelListeners={},this.channelListenersCount=0,this.channelId=Math.floor(1e6*Math.random()),this.frameWindow=e.contentWindow,this.origin=t,this.globalListeners=[],this.channelListeners=[],this.eventListener=this.eventListener.bind(this),"undefined"!=typeof window&&window.addEventListener("message",this.eventListener)}return e.prototype.cleanup=function(){window.removeEventListener("message",this.eventListener),this.globalListeners={},this.channelListeners={},this.globalListenersCount=0,this.channelListenersCount=0},e.prototype.register=function(){this.frameWindow&&this.frameWindow.postMessage({type:"register-frame",origin:document.location.origin,id:this.channelId},this.origin)},e.prototype.dispatch=function(e){this.frameWindow&&this.frameWindow.postMessage(q({$id:this.channelId,codesandbox:!0},e),this.origin)},e.prototype.globalListen=function(e){var t=this;if("function"!=typeof e)return function(){};var n=this.globalListenersCount;return this.globalListeners[n]=e,this.globalListenersCount++,function(){delete t.globalListeners[n]}},e.prototype.channelListen=function(e){var t=this;if("function"!=typeof e)return function(){};var n=this.channelListenersCount;return this.channelListeners[n]=e,this.channelListenersCount++,function(){delete t.channelListeners[n]}},e.prototype.eventListener=function(e){if(e.source===this.frameWindow){var t=e.data;t.codesandbox&&(Object.values(this.globalListeners).forEach((function(e){return e(t)})),t.$id===this.channelId&&Object.values(this.channelListeners).forEach((function(e){return e(t)})))}},e}(),Ir=new Map,_r=0,Tr=Object.entries(h);_r<Tr.length;_r++){var Rr=Tr[_r],Dr=Rr[0],Pr=Rr[1];if(Pr.extensions){var Fr=Pr.extensions;if(Fr.length)for(var Ur=0,Hr=Fr;Ur<Hr.length;Ur++){var zr=Hr[Ur];Ir.set(zr,Dr)}}}var Br,Jr=Ir,Wr="$CSB_RELAY";function Vr(e,t){if(!e)return"static";var n=e.dependencies,r=void 0===n?{}:n,o=e.devDependencies,i=void 0===o?{}:o,a=G(G([],Object.keys(r),!0),Object.keys(i),!0),s=Object.keys(t),c=["@adonisjs/framework","@adonisjs/core"];if(a.some((function(e){return c.indexOf(e)>-1})))return"adonis";var l=["nuxt","nuxt-edge","nuxt-ts","nuxt-ts-edge","nuxt3"];if(a.some((function(e){return l.indexOf(e)>-1})))return"nuxt";if(a.indexOf("next")>-1)return"next";var u=["apollo-server","apollo-server-express","apollo-server-hapi","apollo-server-koa","apollo-server-lambda","apollo-server-micro"];if(a.some((function(e){return u.indexOf(e)>-1})))return"apollo";if(a.indexOf("mdx-deck")>-1)return"mdx-deck";if(a.indexOf("gridsome")>-1)return"gridsome";if(a.indexOf("vuepress")>-1)return"vuepress";if(a.indexOf("ember-cli")>-1)return"ember";if(a.indexOf("sapper")>-1)return"sapper";if(a.indexOf("gatsby")>-1)return"gatsby";if(a.indexOf("quasar")>-1)return"quasar";if(a.indexOf("@docusaurus/core")>-1)return"docusaurus";if(a.indexOf("remix")>-1)return"remix";if(a.indexOf("astro")>-1)return"node";if(s.some((function(e){return e.endsWith(".re")})))return"reason";var d=["parcel-bundler","parcel"];if(a.some((function(e){return d.indexOf(e)>-1})))return"parcel";var p=["@dojo/core","@dojo/framework"];if(a.some((function(e){return p.indexOf(e)>-1})))return"@dojo/cli-create-app";if(a.indexOf("@nestjs/core")>-1||a.indexOf("@nestjs/common")>-1)return"nest";if(a.indexOf("react-styleguidist")>-1)return"styleguidist";if(a.indexOf("react-scripts")>-1)return"create-react-app";if(a.indexOf("react-scripts-ts")>-1)return"create-react-app-typescript";if(a.indexOf("@angular/core")>-1)return"angular-cli";if(a.indexOf("preact-cli")>-1)return"preact-cli";if(a.indexOf("@sveltech/routify")>-1||a.indexOf("@roxi/routify")>-1)return"node";if(a.indexOf("vite")>-1)return"node";if(a.indexOf("@frontity/core")>-1)return"node";if(a.indexOf("svelte")>-1)return"svelte";if(a.indexOf("vue")>-1)return"vue-cli";if(a.indexOf("cx")>-1)return"cxjs";var f=["express","koa","nodemon","ts-node","@tensorflow/tfjs-node","webpack-dev-server","snowpack"];return a.some((function(e){return f.indexOf(e)>-1}))||Object.keys(r).length>=50?"node":void 0}var Zr="-{{suffix}}",qr="https://".concat(null===(Br="2.19.8")?void 0:Br.replace(/\./g,"-")).c
1oncat(Zr,"-sandpack.codesandbox.io/"),Yr=function(e){function t(t,n,r){void 0===r&&(r={});var o=e.call(this,t,n,r)||this;if(o.getTranspilerContext=function(){return new Promise((function(e){var t=o.listen((function(n){"transpiler-context"===n.type&&(e(n.data),t())}));o.dispatch({type:"get-transpiler-context"})}))},o.getTranspiledFiles=function(){return new Promise((function(e){var t=o.listen((function(n){"all-modules"===n.type&&(e(n.data),t())}));o.dispatch({type:"get-modules"})}))},o.bundlerURL=o.createBundlerURL(),o.bundlerState=void 0,o.errors=[],o.status="initializing","string"==typeof t){o.selector=t;var i=document.querySelector(t);X(i,"The element '".concat(t,"' was not found")),o.element=i,o.iframe=document.createElement("iframe"),o.initializeElement()}else o.element=t,o.iframe=t;return o.iframe.getAttribute("sandbox")||(o.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads allow-pointer-lock"),o.iframe.setAttribute("allow","accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-read; clipboard-write; xr-spatial-tracking;")),o.setLocationURLIntoIFrame(),o.iframeProtocol=new Ar(o.iframe,o.bundlerURL),o.unsubscribeGlobalListener=o.iframeProtocol.globalListen((function(e){"initialized"===e.type&&o.iframe.contentWindow&&(o.iframeProtocol.register(),o.options.fileResolver&&(o.fileResolverProtocol=new Lr("fs",(function(e){return Y(o,0,void 0,(function(){return $(this,(function(t){if("isFile"===e.method)return[2,this.options.fileResolver.isFile(e.params[0])];if("readFile"===e.method)return[2,this.options.fileResolver.readFile(e.params[0])];throw new Error("Method not supported")}))}))}),o.iframeProtocol)),o.updateSandbox(o.sandboxSetup,!0))})),o.unsubscribeChannelListener=o.iframeProtocol.channelListen((function(e){switch(e.type){case"start":o.errors=[];break;case"status":o.status=e.status;break;case"action":"show-error"===e.action&&(o.errors=G(G([],o.errors,!0),[ne(e)],!1));break;case"done":o.status="done";break;case"state":o.bundlerState=e.state}})),r.experimental_enableServiceWorker&&o.serviceWorkerHandshake(),o}return W(t,e),t.prototype.createBundlerURL=function(){var e,t=this.options.bundlerURL||qr;if(this.options.bundlerURL)return t;if(this.options.teamId&&(t=t.replace("https://","https://"+this.options.teamId+"-")+"?cache=".concat(Date.now())),this.options.experimental_enableServiceWorker){var n=[];n.push(Math.random().toString(36).slice(4)),t=t.replace(Zr,"-".concat(null!==(e=this.options.experimental_stableServiceWorkerId)&&void 0!==e?e:n.join("-")))}else t=t.replace(Zr,"");return t},t.prototype.serviceWorkerHandshake=function(){var e=this,t=new MessageChannel,n=this.iframe.contentWindow;if(!n)throw new Error("Could not get iframe contentWindow");var r=t.port1;r.onmessage=function(t){if("object"==typeof t.data&&t.data.$channel===Wr)switch(t.data.$type){case"preview/ready":break;case"preview/request":e.handleWorkerRequest(t.data,r)}};var o=function(){var r={$channel:Wr,$type:"preview/init"};n.postMessage(r,"*",[t.port2]),e.iframe.removeEventListener("load",o)};this.iframe.addEventListener("load",o)},t.prototype.handleWorkerRequest=function(e,t){return Y(this,0,void 0,(function(){var n,r,o,i,a,s,c,l,u,d,p;return $(this,(function(f){switch(f.label){case 0:n=function(){var n={$channel:Wr,$type:"preview/response",id:e.id,headers:{"Content-Type":"text/html; charset=utf-8"},status:404,body:"File not found"};t.postMessage(n)},f.label=1;case 1:return f.trys.push([1,4,,5]),r=new URL(e.url,this.bundlerURL).pathname,o={},i=this.getFiles(),(a=i[r])?[3,3]:[4,this.getTranspiledFiles()];case 2:if(s=f.sent(),!(a=s.find((function(e){return e.path.endsWith(r)}))))return n(),[2];f.label=3;case 3:return c=a.code,o["Content-Type"]||(m=r.split("."),l=m.length<=1?"":m[m.length-1],(u=Jr.get(l))&&(o["Content-Type"]=u)),d={$channel:Wr,$type:"preview/response",id:e.id,headers:o,status:200,body:c},t.postMessage(d),[3,5];case 4:return p=f.sent(),console.error(p),n(),[3,5];case 5:return[2]}var m}))}))},t.prototype.setLocationURLIntoIFrame=function(){var e,t=this.options.startRoute?new URL(this.options.startRoute,this.bundlerURL).toString():this.bundlerURL;null===(e=this.iframe.contentWindow)||void 0===e||e.location.replace(t),this.iframe.src=t},t.prototype.destroy=function(){this.unsubscribeChannelListener(),this.unsubscribeGlobalListener(),this.iframeProtocol.cleanup()},t.prototype.updateOptions=function(e){u(this.options,e)||(this.options=e,this.updateSandbox())},t.prototype.updateSandbox=function(e,t){var n,r,o,i;void 0===e&&(e=this.sandboxSetup),this.sandboxSetup=q(q({},this.sandboxSetup),e);var a=this.getFiles(),s=Object.keys(a).reduce((function(e,t){var n;return q(q({},e),((n={})[t]={code:a[t].code,path:t},n))}),{}),c=JSON.parse(ee(this.sandboxSetup.dependencies,this.sandboxSetup.devDependencies,this.sandboxSetup.entry));try{c=JSON.parse(a["/package.json"].code)}catch(u){console.error(K("could not parse package.json file: "+u.message))}var l=Object.keys(a).reduce((function(e,t){var n;return q(q({},e),((n={})[t]={content:a[t].code,path:t},n))}),{});this.dispatch(q(q({},this.options),{type:"compile",codesandbox:!0,version:3,isInitializationCompile:t,modules:s,reactDevTools:this.options.reactDevTools,externalResources:this.options.externalResources||[],hasFileResolver:Boolean(this.options.fileResolver),disableDependencyPreprocessing:this.sandboxSetup.disableDependencyPreprocessing,experimental_enableServiceWorker:this.options.experimental_enableServiceWorker,template:this.sandboxSetup.template||Vr(c,l),showOpenInCodeSandbox:null===(n=this.options.showOpenInCodeSandbox)||void 0===n||n,showErrorScreen:null===(r=this.options.showErrorScreen)||void 0===r||r,showLoadingScreen:null!==(o=this.options.showLoadingScreen)&&void 0!==o&&o,skipEval:this.options.skipEval||!1,clearConsoleDisabled:!this.options.clearConsoleOnFirstC
1ompile,logLevel:null!==(i=this.options.logLevel)&&void 0!==i?i:V.Info,customNpmRegistries:this.options.customNpmRegistries,teamId:this.options.teamId,sandboxId:this.options.sandboxId}))},t.prototype.dispatch=function(e){"refresh"===e.type&&(this.setLocationURLIntoIFrame(),this.options.experimental_enableServiceWorker&&this.serviceWorkerHandshake()),this.iframeProtocol.dispatch(e)},t.prototype.listen=function(e){return this.iframeProtocol.channelListen(e)},t.prototype.getCodeSandboxURL=function(){var e=this.getFiles(),t=Object.keys(e).reduce((function(t,n){var r;return q(q({},t),((r={})[n.replace("/","")]={content:e[n].code,isBinary:!1},r))}),{});return fetch("https://codesandbox.io/api/v1/sandboxes/define?json=1",{method:"POST",body:JSON.stringify({files:t}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(e){return{sandboxId:e.sandbox_id,editorUrl:"https://codesandbox.io/s/".concat(e.sandbox_id),embedUrl:"https://codesandbox.io/embed/".concat(e.sandbox_id)}}))},t.prototype.getFiles=function(){var e=this.sandboxSetup;return void 0===e.files["/package.json"]?te(e.files,e.dependencies,e.devDependencies,e.entry):this.sandboxSetup.files},t.prototype.initializeElement=function(){this.iframe.style.border="0",this.iframe.style.width=this.options.width||"100%",this.iframe.style.height=this.options.height||"100%",this.iframe.style.overflow="hidden",X(this.element.parentNode,"The given iframe does not have a parent."),this.element.parentNode.replaceChild(this.iframe,this.element)},t}(ar);const $r=Object.freeze(Object.defineProperty({__proto__:null,SandpackRuntime:Yr},Symbol.toStringTag,{value:"Module"}));export{Et as S,B as _,Jn as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.