text: (()=>{var e={36:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SandpackClient:()=>f,addPackageJSONIfNeeded:()=>d,createPackageJSON:()=>l,extractErrorDetails:()=>u});var r=n(770),i=n(307),o=n.n(i);const s=()=>Math.floor(1e6*Math.random()+1e6*Math.random());class a{constructor(e,t,n){this.type=e,this.handleMessage=t,this.target=n,this.outgoingMessages=new Set,this._messageListener=async e=>{const{data:t}=e;if(t.$type!==this.getTypeId())return;if(this.outgoingMessages.has(t.$id))return;const n=await this.handleMessage(t.$data),r={$originId:this.internalId,$type:this.getTypeId(),$data:n,$id:t.$id};e.source?e.source.postMessage(r,"*"):this._postMessage(r)},this.createConnection(),this.internalId=s(),this.isWorker="Worker"===(e=>{try{return e.constructor.name}catch(e){return""}})(n)}getTypeId(){return`p-${this.type}`}createConnection(){self.addEventListener("message",this._messageListener)}dispose(){self.removeEventListener("message",this._messageListener)}sendMessage(e){return new Promise((t=>{const n=s(),r={$originId:this.internalId,$type:this.getTypeId(),$data:e,$id:n};this.outgoingMessages.add(n);const i=e=>{const{data:r}=e;r.$type===this.getTypeId()&&r.$id===n&&r.$originId!==this.internalId&&(t(r.$data),self.removeEventListener("message",i))};self.addEventListener("message",i),this._postMessage(r)}))}_postMessage(e){this.isWorker||"undefined"!=typeof DedicatedWorkerGlobalScope&&this.target instanceof DedicatedWorkerGlobalScope?this.target.postMessage(e):this.target.postMessage(e,"*")}}class c{constructor(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)}cleanup(){window.removeEventListener("message",this.eventListener),this.globalListeners={},this.channelListeners={},this.globalListenersCount=0,this.channelListenersCount=0}register(){this.frameWindow&&this.frameWindow.postMessage({type:"register-frame",origin:document.location.origin,id:this.channelId},this.origin)}dispatch(e){this.frameWindow&&this.frameWindow.postMessage({$id:this.channelId,codesandbox:!0,...e},this.origin)}globalListen(e){if("function"!=typeof e)return()=>{};const t=this.globalListenersCount;return this.globalListeners[t]=e,this.globalListenersCount++,()=>{delete this.globalListeners[t]}}channelListen(e){if("function"!=typeof e)return()=>{};const t=this.channelListenersCount;return this.channelListeners[t]=e,this.channelListenersCount++,()=>{delete this.channelListeners[t]}}eventListener(e){e.data.codesandbox&&(Object.values(this.globalListeners).forEach((t=>t(e.data))),e.data.$id===this.channelId&&Object.values(this.channelListeners).forEach((t=>t(e.data))))}}function l(e={},t="/index.js"){return JSON.stringify({name:"sandpack-project",main:t,dependencies:e},null,2)}function d(e,t,n){const r={...e};if(!r["/package.json"]){if(!t)throw new Error("No dependencies specified, please specify either a package.json or dependencies.");if(!n)throw new Error("Missing 'entry' parameter. Either specify an entry point, or pass in a package.json with the 'main' field set.");r["/package.json"]={code:l(t,n)}}return r}function u(e){if("SyntaxError"===e.title){const{title:t,path:n,message:r,line:i,column:o}=e;return{title:t,path:n,message:r,line:i,column:o}}const t=function(e){if(e)return e.find((e=>!!e._originalFileName))}(e.payload.frames);if(!t)return{message:e.message};const n=function(e){const t=e._originalScriptCode[e._originalScriptCode.length-1].lineNumber.toString().length,n=2+t+3+e._originalColumnNumber;return e._originalScriptCode.reduce(((e,r)=>{const i=r.highlight?">":" ",o=r.lineNumber.toString().length===t?`${r.lineNumber}`:` ${r.lineNumber}`,s=r.highlight?"\n"+" ".repeat(n)+"^":"";return e+"\n"+i+" "+o+" | "+r.content+s}),"")}(t),r=(i=t)?` (${i._originalLineNumber}:${i._originalColumnNumber})`:"";var i;return{message:function(e,t,n,r){return`${e}: ${t}${n}\n${r}`}(t._originalFileName,e.message,r,n),title:e.title,path:t._originalFileName,line:t._originalLineNumber,column:t._originalColumnNumber}}const h="development"===n(155).env.CODESANDBOX_ENV?"http://localhost:3000/":`https://${"0.1.6".replace(/\./g,"-")}-sandpack.codesandbox.io/`;class f{constructor(e,t,n={}){if(this.getTranspilerContext=()=>new Promise((e=>{const t=this.listen((n=>{"transpiler-context"===n.type&&(e(n.data),t())}));this.dispatch({type:"get-transpiler-context"})})),this.options=n,this.sandboxInfo=t,this.bundlerURL=n.bundlerURL||h,this.bundlerState=void 0,this.errors=[],this.status="initializing","string"==typeof e){this.selector=e;const t=document.querySelector(e);if(!t)throw new Error(`No element found for selector '${e}'`);this.element=t,this.iframe=document.createElement("iframe"),this.initializeElement()}else this.element=e,this.iframe=e;this.iframe.getAttribute("sandbox")||this.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"),this.iframe.src=n.startRoute?new URL(n.startRoute,this.bundlerURL).toString():this.bundlerURL,this.iframeProtocol=new c(this.iframe,this.bundlerURL),this.unsubscribeGlobalListener=this.iframeProtocol.globalListen((e=>{"initialized"===e.type&&this.iframe.contentWindow&&(this.iframeProtocol.register(),this.options.fileResolver&&(this.fileResolverProtocol=new a("file-resolver",(async e=>"isFile"===e.m?this.options.fileResolver.isFile(e.p):this.options.fileResolver.readFile(e.p)),this.iframe.contentWindow)),this.updatePreview(this.sandboxInfo,!0))})),this.unsubscribeChannelListener=this.iframeProtocol.channelListen((e=>{switch(e.type){case"start":this.errors=[];break;case"status":this.status=e.status;break;case"action":"show-error"===e.action&&(this.errors=[...this.errors,u(e)]);break;case"state":this.bundlerState=e.state}}))}cleanup(){this.unsubscribeChannelListener(),this.unsubscribeGlobalListener(),this.iframeProtocol.cleanup()}updateOptions(e){o()(this.options,e)||(this.options=e,this.updatePreview())}updatePreview(e=this.sandboxInfo,t){var n,i,o;this.sandboxInfo=e;const s=this.getFiles(),a=Object.keys(s).reduce(((e,t)=>({...e,[t]:{code:s[t].code,path:t}})),{});let c=JSON.parse(l(this.sandboxInfo.dependencies,this.sandboxInfo.entry));try{c=JSON.parse(s["/package.json"].code)}catch(e){console.error("Could not parse package.json file: "+e.message)}const d=Object.keys(s).reduce(((e,t)=>({...e,[t]:{content:s[t].code,path:t}})),{});this.dispatch({type:"compile",codesandbox:!0,version:3,isInitializationCompile:t,modules:a,externalResources:[],hasFileResolver:Boolean(this.options.fileResolver),disableDependencyPreprocessing:this.sandboxInfo.disableDependencyPreprocessing,template:this.sandboxInfo.template||(0,r.t4)(c,d),showOpenInCodeSandbox:null===(n=this.options.showOpenInCodeSandbox)||void 0===n||n,showErrorScreen:null===(i=this.options.showErrorScreen)||void 0===i||i,showLoadingScreen:null===(o=this.options.showLoadingScreen)||void 0===o||o,skipEval:this.options.skipEval||!1,clearConsoleDisabled:!this.options.clearConsoleOnFirstCompile})}dispatch(e){this.iframeProtocol.dispatch(e)}listen(e){return this.iframeProtocol.channelListen(e)}getCodeSandboxURL(){const e=this.getFiles(),t=Object.keys(e).reduce(((t,n)=>({...t,[n.replace("/","")]:{content:e[n].code,isBinary:!1}})),{});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((e=>e.json())).then((e=>({sandboxId:e.sandbox_id,editorUrl:`https://codesandbox.io/s/${e.sandbox_id}`,embedUrl:`https://codesandbox.io/embed/${e.sandbox_id}`})))}getFiles(){const{sandboxInfo:e}=this;return void 0===e.files["/package.json"]?d(e.files,e.dependencies,e.entry):this.sandboxInfo.files}initializeElement(){if(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",!this.element.parentNode)throw new Error("Given element does not have a parent.");this.element.parentNode.replaceChild(this.iframe,this.element)}}},770:(e,t)=>{"use strict";var n="sandbox.config.json";t.t4=function(e,t){var r=t[n]||t["/"+n];if(r)try{var i=JSON.parse(r.content);if(i.template)return i.template}catch(e){}var o=e.dependencies,s=void 0===o?{}:o,a=e.devDependencies,c=void 0===a?{}:a,l=Object.keys(s).concat(Object.keys(c)),d=["nuxt","nuxt-edge"];if(l.some((function(e){return d.indexOf(e)>-1})))return"nuxt";if(l.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(l.some((function(e){return u.indexOf(e)>-1})))return"apollo";if(l.indexOf("ember-cli")>-1)return"ember";if(l.indexOf("sapper")>-1)return"sapper";var h=Object.keys(t);if(h.some((function(e){return e.endsWith(".vue")})))return"vue-cli";if(h.some((function(e){return e.endsWith(".re")})))return"reason";if(l.indexOf("gatsby")>-1)return"gatsby";if(l.indexOf("parcel-bundler")>-1)return"parcel";if(l.indexOf("react-scripts")>-1)return"create-react-app";if(l.indexOf("react-scripts-ts")>-1)return"create-react-app-typescript";if(l.indexOf("@angular/core")>-1)return"angular-cli";if(l.indexOf("preact-cli")>-1)return"preact-cli";if(l.indexOf("svelte")>-1)return"svelte";if(l.indexOf("vue")>-1)return"vue-cli";var f=["@dojo/core","@dojo/framework"];return l.some((function(e){return f.indexOf(e)>-1}))?"@dojo/cli-create-app":l.indexOf("cx")>-1?"cxjs":l.indexOf("@nestjs/core")>-1||l.indexOf("@nestjs/common")>-1?"nest":void 0}},307:(e,t,n)=>{e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Array]",a="[object Boolean]",c="[object Date]",l="[object Error]",d="[object Function]",u="[object Map]",h="[object Number]",f="[object Object]",p="[object Promise]",b="[object RegExp]",g="[object Set]",v="[object String]",y="[object WeakMap]",m="[object ArrayBuffer]",w="[object DataView]",x=/^\[object .+?Constructor\]$/,_=/^(?:0|[1-9]\d*)$/,S={};S["[object Float32Array]"]=S["[object Float64Array]"]=S["[object Int8Array]"]=S["[object Int16Array]"]=S["[object Int32Array]"]=S["[object Uint8Array]"]=S["[object Uint8ClampedArray]"]=S["[object Uint16Array]"]=S["[object Uint32Array]"]=!0,S[o]=S[s]=S[m]=S[a]=S[w]=S[c]=S[l]=S[d]=S[u]=S[h]=S[f]=S[b]=S[g]=S[v]=S[y]=!1;var j="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,O="object"==typeof self&&self&&self.Object===Object&&self,k=j||O||Function("return this")(),L=t&&!t.nodeType&&t,C=L&&e&&!e.nodeType&&e,$=C&&C.exports===L,A=$&&j.process,E=function(){try{return A&&A.binding&&A.binding("util")}catch(e){}}(),P=E&&E.isTypedArray;function T(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function I(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function M(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var N,z,D,F=Array.prototype,B=Function.prototype,R=Object.prototype,W=k["__core-js_shared__"],U=B.toString,J=R.hasOwnProperty,G=(N=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"",H=R.toString,V=RegExp("^"+U.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),q=$?k.Buffer:void 0,Y=k.Symbol,X=k.Uint8Array,K=R.propertyIsEnumerable,Q=F.splice,Z=Y?Y.toStringTag:void 0,ee=Object.getOwnPropertySymbols,te=q?q.isBuffer:void 0,ne=(z=Object.keys,D=Object,function(e){return z(D(e))}),re=Ce(k,"DataView"),ie=Ce(k,"Map"),oe=Ce(k,"Promise"),se=Ce(k,"Set"),ae=Ce(k,"WeakMap"),ce=Ce(Object,"create"),le=Pe(re),de=Pe(ie),ue=Pe(oe),he=Pe(se),fe=Pe(ae),pe=Y?Y.prototype:void 0,be=pe?pe.valueOf:void 0;function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ye(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ye;++t<n;)this.add(e[t])}function we(e){var t=this.__data__=new ve(e);this.size=t.size}function xe(e,t){for(var n=e.length;n--;)if(Te(e[n][0],t))return n;return-1}function _e(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Z&&Z in Object(e)?function(e){var t=J.call(e,Z),n=e[Z];try{e[Z]=void 0;var r=!0}catch(e){}var i=H.call(e);return r&&(t?e[Z]=n:delete e[Z]),i}(e):function(e){return H.call(e)}(e)}function Se(e){return Be(e)&&_e(e)==o}function je(e,t,n,r,i){return e===t||(null==e||null==t||!Be(e)&&!Be(t)?e!=e&&t!=t:function(e,t,n,r,i,d){var p=Me(e),y=Me(t),x=p?s:Ae(e),_=y?s:Ae(t),S=(x=x==o?f:x)==f,j=(_=_==o?f:_)==f,O=x==_;if(O&&Ne(e)){if(!Ne(t))return!1;p=!0,S=!1}if(O&&!S)return d||(d=new we),p||Re(e)?Oe(e,t,n,r,i,d):function(e,t,n,r,i,o,s){switch(n){case w:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case m:return!(e.byteLength!=t.byteLength||!o(new X(e),new X(t)));case a:case c:case h:return Te(+e,+t);case l:return e.name==t.name&&e.message==t.message;case b:case v:return e==t+"";case u:var d=I;case g:var f=1&r;if(d||(d=M),e.size!=t.size&&!f)return!1;var p=s.get(e);if(p)return p==t;r|=2,s.set(e,t);var y=Oe(d(e),d(t),r,i,o,s);return s.delete(e),y;case"[object Symbol]":if(be)return be.call(e)==be.call(t)}return!1}(e,t,x,n,r,i,d);if(!(1&n)){var k=S&&J.call(e,"__wrapped__"),L=j&&J.call(t,"__wrapped__");if(k||L){var C=k?e.value():e,$=L?t.value():t;return d||(d=new we),i(C,$,n,r,d)}}return!!O&&(d||(d=new we),function(e,t,n,r,i,o){var s=1&n,a=ke(e),c=a.length;if(c!=ke(t).length&&!s)return!1;for(var l=c;l--;){var d=a[l];if(!(s?d in t:J.call(t,d)))return!1}var u=o.get(e);if(u&&o.get(t))return u==t;var h=!0;o.set(e,t),o.set(t,e);for(var f=s;++l<c;){var p=e[d=a[l]],b=t[d];if(r)var g=s?r(b,p,d,t,e,o):r(p,b,d,e,t,o);if(!(void 0===g?p===b||i(p,b,n,r,o):g)){h=!1;break}f||(f="constructor"==d)}if(h&&!f){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(h=!1)}return o.delete(e),o.delete(t),h}(e,t,n,r,i,d))}(e,t,n,r,je,i))}function Oe(e,t,n,r,i,o){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var d=-1,u=!0,h=2&n?new me:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var f=e[d],p=t[d];if(r)var b=s?r(p,f,d,t,e,o):r(f,p,d,e,t,o);if(void 0!==b){if(b)continue;u=!1;break}if(h){if(!T(t,(function(e,t){if(s=t,!h.has(s)&&(f===e||i(f,e,n,r,o)))return h.push(t);var s}))){u=!1;break}}else if(f!==p&&!i(f,p,n,r,o)){u=!1;break}}return o.delete(e),o.delete(t),u}function ke(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,We,$e)}function Le(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ce(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Fe(e)||function(e){return!!G&&G in e}(e))&&(ze(e)?V:x).test(Pe(e))}(n)?n:void 0}ge.prototype.clear=function(){this.__data__=ce?ce(null):{},this.size=0},ge.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ge.prototype.get=function(e){var t=this.__data__;if(ce){var n=t[e];return n===r?void 0:n}return J.call(t,e)?t[e]:void 0},ge.prototype.has=function(e){var t=this.__data__;return ce?void 0!==t[e]:J.call(t,e)},ge.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ce&&void 0===t?r:t,this},ve.prototype.clear=function(){this.__data__=[],this.size=0},ve.prototype.delete=function(e){var t=this.__data__,n=xe(t,e);return!(n<0||(n==t.length-1?t.pop():Q.call(t,n,1),--this.size,0))},ve.prototype.get=function(e){var t=this.__data__,n=xe(t,e);return n<0?void 0:t[n][1]},ve.prototype.has=function(e){return xe(this.__data__,e)>-1},ve.prototype.set=function(e,t){var n=this.__data__,r=xe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ye.prototype.clear=function(){this.size=0,this.__data__={hash:new ge,map:new(ie||ve),string:new ge}},ye.prototype.delete=function(e){var t=Le(this,e).delete(e);return this.size-=t?1:0,t},ye.prototype.get=function(e){return Le(this,e).get(e)},ye.prototype.has=function(e){return Le(this,e).has(e)},ye.prototype.set=function(e,t){var n=Le(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},me.prototype.add=me.prototype.push=function(e){return this.__data__.set(e,r),this},me.prototype.has=function(e){return this.__data__.has(e)},we.prototype.clear=function(){this.__data__=new ve,this.size=0},we.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ve){var r=n.__data__;if(!ie||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ye(r)}return n.set(e,t),this.size=n.size,this};var $e=ee?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var r=-1,i=null==t?0:t.length,o=0,s=[];++r<i;){var a=t[r];c=a,K.call(e,c)&&(s[o++]=a)}var c;return s}(ee(e)))}:function(){return[]},Ae=_e;function Ee(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||_.test(e))&&e>-1&&e%1==0&&e<t}function Pe(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Te(e,t){return e===t||e!=e&&t!=t}(re&&Ae(new re(new ArrayBuffer(1)))!=w||ie&&Ae(new ie)!=u||oe&&Ae(oe.resolve())!=p||se&&Ae(new se)!=g||ae&&Ae(new ae)!=y)&&(Ae=function(e){var t=_e(e),n=t==f?e.constructor:void 0,r=n?Pe(n):"";if(r)switch(r){case le:return w;case de:return u;case ue:return p;case he:return g;case fe:return y}return t});var Ie=Se(function(){return arguments}())?Se:function(e){return Be(e)&&J.call(e,"callee")&&!K.call(e,"callee")},Me=Array.isArray,Ne=te||function(){return!1};function ze(e){if(!Fe(e))return!1;var t=_e(e);return t==d||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function De(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function Fe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Be(e){return null!=e&&"object"==typeof e}var Re=P?function(e){return function(t){return e(t)}}(P):function(e){return Be(e)&&De(e.length)&&!!S[_e(e)]};function We(e){return null!=(t=e)&&De(t.length)&&!ze(t)?function(e,t){var n=Me(e),r=!n&&Ie(e),i=!n&&!r&&Ne(e),o=!n&&!r&&!i&&Re(e),s=n||r||i||o,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var l in e)!t&&!J.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ee(l,c))||a.push(l);return a}(e):function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||R))return ne(e);var t,n,r=[];for(var i in Object(e))J.call(e,i)&&"constructor"!=i&&r.push(i);return r}(e);var t}e.exports=function(e,t){return je(e,t)}},155:e=>{var t,n,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var a,c=[],l=!1,d=-1;function u(){l&&a&&(l=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!l){var e=s(u);l=!0;for(var t=c.length;t;){for(a=c,c=[];++d<t;)a&&a[d].run();d=-1,t=c.length}a=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new f(e,t)),1!==c.length||l||s(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=p,r.addListener=p,r.once=p,r.off=p,r.removeListener=p,r.removeAllListeners=p,r.emit=p,r.prependListener=p,r.prependOnceListener=p,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},191:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SNBComponentSandboxRenderer=void 0;const r=n(36),i=n(687),o=n(633);t.SNBComponentSandboxRenderer=class{constructor(){this.trackedSandboxes=new Map,this.trackedConfigurations=new Map}buildSandboxForTargetWithID(e){this.buildSandboxWithPageTarget(e)}buildSandboxesForTargetsWithIDStartingWith(e){this.buildSandboxesForTargetsWithPattern(`[id^="${e}"]`)}buildSandboxesForTargetsWithIDEndingWith(e){this.buildSandboxesForTargetsWithPattern(`[id$="${e}]`)}buildSandboxesForTargetsWithPattern(e){document.querySelectorAll(e).forEach((e=>{this.buildSandboxWithPageTarget(e.id)}))}buildSandboxWithPageTarget(e){var t,n;if(this.trackedSandboxes.get(e))throw new Error(`Sandbox for id ${e} was already created. You can only create one tracked sandbox per target`);let o=document.querySelector(`#${e}`);if(!o)throw new Error(`Can't build sandbox with target ${e} as there is no such target in the current context`);if("div"!==o.nodeName.toLowerCase()&&"iframe"!==o.nodeName.toLowerCase())throw new Error("Sandbox can only be created on element types of div or iframe (div is preferred)");let s,a=o.getAttribute("sn-sandbox-data");if(!a||0===a.length)throw new Error("Sandbox doesn't provide any valid data");try{const e=atob(a);s=JSON.parse(e)}catch(e){throw new Error("Provided sandbox data corrupted")}if(!s.code||!s.dependencies||!s.type)throw new Error("Provided sandbox data incomplete");if(!Object.values(i.SandboxMode).includes(s.type))throw new Error(`Unsupported sandbox type ${s.type}`);let c=this.createBundledData(s),l={showErrorScreen:!0,showLoadingScreen:!1,showOpenInCodeSandbox:null!==(n=null===(t=s.visual)||void 0===t?void 0:t.showSandbox)&&void 0!==n&&n},d=new r.SandpackClient(`#${e}`,c,l);this.trackedSandboxes.set(e,d),this.trackedConfigurations.set(e,s),this.listener&&d.listen((t=>{let n="unknown";switch(t.type){case"start":n="start";break;case"state":n=`state:${t.state.entry}`;case"success":n="success";break;case"initialized":n="initialized"}"unknown"!==n&&this.listener({message:t,sandboxId:e})}))}updateSandboxWithCode(e,t){let n=this.trackedSandboxes.get(t),r=this.trackedConfigurations.get(t);if(!n||!r)throw new Error(`Sandbox (${t}) was not yet created or not configured properly. Please initialize sandbox fully before trying to update its data`);let i={code:e,type:r.type,dependencies:r.dependencies,editable:r.editable,visual:r.visual};n.updatePreview();let o=this.createBundledData(i);n.updatePreview(o)}createBundledData(e){var t;let n;switch(e.type){case i.SandboxMode.react:n=new o.SNBReactBundler(e.code,e.dependencies,null!==(t=e.visual)&&void 0!==t?t:{});break;default:throw new Error(`Unsupported bundler type ${e.type}`)}return{files:n.buildSandboxPayload()}}getCodeForSandboxId(e){if(console.log(`tracked sandboxes: ${Array.from(this.trackedConfigurations.keys())}`),!this.trackedConfigurations.get(e))throw new Error(`Unknown code sandbox for id ${e}`);return this.trackedConfigurations.get(e).code}encodeBlockData(e){let t=e.split("---"),n=t[0],r={};for(let e of n.split("\n")){let t=e.split(":");if(2===t.length){let e=this.cleanupString(t[0]),n=this.cleanupString(t[1]);r[e]=n}}let i=t[1],o={};for(let e of i.split("\n")){let t=e.split(":");if(2===t.length){let e=this.cleanupString(t[0]);if(e.length>0){let n=this.cleanupString(t[1]);o[e]=n}}else if(1===t.length){let t=this.cleanupString(e);if(t.length>0){let e="latest";o[t]=e}}}let s=t[2];const a={};r.Horizontal&&(a.horizontalAlignment=r.Horizontal),r.Vertical&&(a.verticalAlignment=r.Vertical),r.Background&&(a.backgroundHex=r.Background);const c={type:"react",code:s,dependencies:o,visual:a};return console.log(c),btoa(JSON.stringify(c))}cleanupString(e){return e.trim().replace(/^"(.*)"$/,"$1")}encodeReactSandboxData(e,t){return this.encodeSandboxData({type:i.SandboxMode.react,code:e,dependencies:t})}encodeSandboxData(e){return btoa(JSON.stringify(e))}injectSandboxDataToTarget(e,t){let n=document.querySelector(`#${e}`);if(!n)throw new Error("Can't inject sandbox data to target");n.setAttribute("sn-sandbox-data",t)}}},687:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SandboxMode=void 0,(t.SandboxMode||(t.SandboxMode={})).react="react"},969:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SNBBundler=t.SandboxContentAlignment=void 0,(n=t.SandboxContentAlignment||(t.SandboxContentAlignment={})).start="start",n.center="center",n.end="end",t.SNBBundler=class{constructor(e,t,n){this.code=e,this.dependencies=this.toDependencyMap(t),this.visualSettings=n}buildSandboxPayload(){throw new Error("Unable to use generic bundler, please provide type-specific implementation")}toDependencyMap(e){const t=new Map;for(const n of Object.keys(e)){let r=e[n];if("string"!=typeof n)throw"Dependency name must be a string";if("string"!=typeof r)throw"Dependency version must be a string";t.set(n,r)}return t}}},633:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SNBReactBundler=void 0;const r=n(969);class i extends r.SNBBundler{buildSandboxPayload(){return{"/public/index.html":{code:this.buildIndexFile()},"/src/App.js":{code:this.buildAppJS()},"/src/index.js":{code:this.buildIndexJS()},"/package.json":{code:this.buildPackageJSON()}}}buildIndexFile(){const e='\n        <!DOCTYPE html>\n        <html lang="en">\n        <head>\n            <meta charset="utf-8">\n            <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">\n            <meta name="theme-color" content="#000000">\n            <title>Supernova Sandbox App</title>\n        </head>\n        <div id="root"></div>\n        </body>\n\n        </html>';return console.log(e),e}alignmentToFlexString(e){switch(e){case r.SandboxContentAlignment.start:return"flex-start";case r.SandboxContentAlignment.center:return"center";case r.SandboxContentAlignment.end:return"flex-end"}}buildAppJS(){return this.code}buildIndexJS(){var e,t;return`\n        import ReactDOM from "react-dom";\n        import App from "./App";\n\n        /* Configure body style */\n        document.body.style.margin = "0px";\n\n        ReactDOM.render(\n            <div style={{\n                height: "100vh",\n                display: "flex",\n                justifyContent: "${this.alignmentToFlexString(null!==(e=this.visualSettings.horizontalAlignment)&&void 0!==e?e:r.SandboxContentAlignment.center)}",\n                alignItems: "${this.alignmentToFlexString(null!==(t=this.visualSettings.verticalAlignment)&&void 0!==t?t:r.SandboxContentAlignment.center)}",\n                background: "${this.visualSettings.backgroundHex?`#${this.visualSettings.backgroundHex}`:"transparent"}"\n            }}>\n                <App />\n            </div>,\n            document.getElementById("root")\n        );`}buildPackageJSON(){return`\n        {\n            "name": "react",\n            "version": "1.0.0",\n            "description": "Supernova documentation sandbox project (find more at https://supernova.io)",\n            "keywords": ["react"],\n            "main": "src/index.js",\n            "dependencies": {   \n                ${Array.from(this.dependencies.keys()).map((e=>`"${e}": "${this.dependencies.get(e)}"`)).join(",\n")}\n            },\n            "devDependencies": {\n                "@babel/runtime": "7.13.8",\n                "typescript": "4.1.3"\n            },\n            "scripts": {\n                "start": "react-scripts start",\n                "build": "react-scripts build",\n                "test": "react-scripts test --env=jsdom",\n                "eject": "react-scripts eject"\n            },\n            "browserslist": [">0.2%", "not dead", "not ie <= 11", "not op_mini all"]\n        }`}}t.SNBReactBundler=i}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r](o,o.exports,n),o.loaded=!0,o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";const e=n(191);window.sandboxRenderer=e.SNBComponentSandboxRenderer})()})();
  //# sourceMappingURL=rtcp-core.js.map