@wangtaizong/components 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{base-80a1f760-bfbf5d12.js → base-80a1f760-daa8780a.js} +1 -1
- package/dist/components/editor/{Editor.d.ts → WEditor.d.ts} +2 -2
- package/dist/{consoleHook-59e792cb-4a29d8de.js → consoleHook-59e792cb-9ddf7539.js} +1 -1
- package/dist/{index-fb0ef221.js → index-2f9d96f2.js} +2 -2
- package/dist/{index-585bceb7-0925bffa.js → index-585bceb7-137dd510.js} +3 -3
- package/dist/{index-ab265236.js → index-8e5d739b.js} +4 -4
- package/dist/{index-fbbb80b8.js → index-cb3fd099.js} +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +2 -2
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
|
@@ -8,5 +8,5 @@ interface MyEditorProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
};
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}
|
|
11
|
-
declare const
|
|
12
|
-
export default
|
|
11
|
+
declare const WEditor: ({ type, children, showConsole, files, className, style, ...restProps }: MyEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default WEditor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as L, e as w, c as u, f as O, d as S, S as I, g as k, n as x, h as m, a as g, b as y, j as _ } from "./index-
|
|
2
|
-
import { S as R } from "./base-80a1f760-
|
|
1
|
+
import { _ as L, e as w, c as u, f as O, d as S, S as I, g as k, n as x, h as m, a as g, b as y, j as _ } from "./index-8e5d739b.js";
|
|
2
|
+
import { S as R } from "./base-80a1f760-daa8780a.js";
|
|
3
3
|
import "react";
|
|
4
4
|
var j = (
|
|
5
5
|
/** @class */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as k, a as j, b as z } from "./index-
|
|
2
|
-
import { a as q, E as _, c as U, b as F } from "./consoleHook-59e792cb-
|
|
3
|
-
import { S as T } from "./base-80a1f760-
|
|
1
|
+
import { _ as k, a as j, b as z } from "./index-8e5d739b.js";
|
|
2
|
+
import { a as q, E as _, c as U, b as F } from "./consoleHook-59e792cb-9ddf7539.js";
|
|
3
|
+
import { S as T } from "./base-80a1f760-daa8780a.js";
|
|
4
4
|
import "react";
|
|
5
5
|
var P = Object.create, u = Object.defineProperty, S = Object.getOwnPropertyDescriptor, d = Object.getOwnPropertyNames, E = Object.getPrototypeOf, C = Object.prototype.hasOwnProperty, x = (i, e) => function() {
|
|
6
6
|
return e || (0, i[d(i)[0]])((e = { exports: {} }).exports, e), e.exports;
|
|
@@ -1875,19 +1875,19 @@ function mw(t, e, r) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
return [3, 5];
|
|
1877
1877
|
case 1:
|
|
1878
|
-
return [4, import("./index-
|
|
1878
|
+
return [4, import("./index-cb3fd099.js").then(function(l) {
|
|
1879
1879
|
return l.SandpackNode;
|
|
1880
1880
|
})];
|
|
1881
1881
|
case 2:
|
|
1882
1882
|
return s = a.sent(), [3, 7];
|
|
1883
1883
|
case 3:
|
|
1884
|
-
return [4, import("./index-585bceb7-
|
|
1884
|
+
return [4, import("./index-585bceb7-137dd510.js").then(function(l) {
|
|
1885
1885
|
return l.SandpackStatic;
|
|
1886
1886
|
})];
|
|
1887
1887
|
case 4:
|
|
1888
1888
|
return s = a.sent(), [3, 7];
|
|
1889
1889
|
case 5:
|
|
1890
|
-
return [4, import("./index-
|
|
1890
|
+
return [4, import("./index-2f9d96f2.js").then(function(l) {
|
|
1891
1891
|
return l.SandpackRuntime;
|
|
1892
1892
|
})];
|
|
1893
1893
|
case 6:
|
|
@@ -32163,8 +32163,8 @@ const c_ = ({
|
|
|
32163
32163
|
] });
|
|
32164
32164
|
};
|
|
32165
32165
|
export {
|
|
32166
|
-
S_ as M,
|
|
32167
32166
|
ad as S,
|
|
32167
|
+
S_ as W,
|
|
32168
32168
|
p_ as _,
|
|
32169
32169
|
ow as a,
|
|
32170
32170
|
aw as b,
|
|
@@ -10,9 +10,9 @@ var k = (e, r, t) => (T(e, r, "read from private field"), t ? t.call(e) : r.get(
|
|
|
10
10
|
r instanceof WeakSet ? r.add(e) : r.set(e, t);
|
|
11
11
|
}, V = (e, r, t, n) => (T(e, r, "write to private field"), n ? n.call(e, t) : r.set(e, t), t);
|
|
12
12
|
var F = (e, r, t) => (T(e, r, "access private method"), t);
|
|
13
|
-
import { _ as se, a as E, b as P, c as A, d as K, n as N } from "./index-
|
|
14
|
-
import { S as oe } from "./base-80a1f760-
|
|
15
|
-
import { c as ae, g as z, r as U, f as ce, w as W, a as de, b as le, E as ue } from "./consoleHook-59e792cb-
|
|
13
|
+
import { _ as se, a as E, b as P, c as A, d as K, n as N } from "./index-8e5d739b.js";
|
|
14
|
+
import { S as oe } from "./base-80a1f760-daa8780a.js";
|
|
15
|
+
import { c as ae, g as z, r as U, f as ce, w as W, a as de, b as le, E as ue } from "./consoleHook-59e792cb-9ddf7539.js";
|
|
16
16
|
import "react";
|
|
17
17
|
var he = Object.create, q = Object.defineProperty, fe = Object.getOwnPropertyDescriptor, X = Object.getOwnPropertyNames, pe = Object.getPrototypeOf, me = Object.prototype.hasOwnProperty, ve = (e, r, t) => r in e ? q(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, b = (e, r) => function() {
|
|
18
18
|
return r || (0, e[X(e)[0]])((r = { exports: {} }).exports, r), r.exports;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export {
|
|
1
|
+
import WEditor from "./components/editor/WEditor";
|
|
2
|
+
export { WEditor };
|
package/dist/index.es.js
CHANGED
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(xe,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],P):(xe=typeof globalThis<"u"?globalThis:xe||self,P(xe
|
|
1
|
+
(function(xe,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],P):(xe=typeof globalThis<"u"?globalThis:xe||self,P(xe.wtz={},xe.React))})(this,function(xe,P){"use strict";var PL=Object.defineProperty;var kL=(xe,P,Ne)=>P in xe?PL(xe,P,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):xe[P]=Ne;var Ze=(xe,P,Ne)=>(kL(xe,typeof P!="symbol"?P+"":P,Ne),Ne),cf=(xe,P,Ne)=>{if(!P.has(xe))throw TypeError("Cannot "+Ne)};var co=(xe,P,Ne)=>(cf(xe,P,"read from private field"),Ne?Ne.call(xe):P.get(xe)),uf=(xe,P,Ne)=>{if(P.has(xe))throw TypeError("Cannot add the same private member more than once");P instanceof WeakSet?P.add(xe):P.set(xe,Ne)},e1=(xe,P,Ne,U)=>(cf(xe,P,"write to private field"),U?U.call(xe,Ne):P.set(xe,Ne),Ne);var Nl=(xe,P,Ne)=>(cf(xe,P,"access private method"),Ne);function Ne(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const U=Ne(P);function uo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xl={exports:{}},Lr={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -776,4 +776,4 @@ declare module "*.vue" {
|
|
|
776
776
|
const scope = `.concat(JSON.stringify(o),`;
|
|
777
777
|
`).concat(r,`
|
|
778
778
|
<\/script>
|
|
779
|
-
`).trim();return this.injectContentIntoHead(n,a)},e.prototype.updateSandbox=function(n,i){n===void 0&&(n=this.sandboxSetup);var r=_w(n.files);this.dispatch({codesandbox:!0,modules:r,template:n.template,type:"compile"})},e.prototype.compile=function(n){return gt(this,void 0,void 0,function(){var i;return vt(this,function(r){switch(r.label){case 0:return this.files=new Map(Object.entries(n)),[4,this.previewController.initPreview()];case 1:return i=r.sent(),this.iframe.setAttribute("src",i),this.status="done",this.dispatch({type:"done",compilatonError:!1}),this.dispatch({type:"urlchange",url:i,back:!1,forward:!1}),[2]}})})},e.prototype.eventListener=function(n){if(n.source===this.iframe.contentWindow){var i=n.data;i.codesandbox&&this.dispatch(i)}},e.prototype.dispatch=function(n){var i;switch(n.type){case"compile":this.compile(n.modules);break;default:(i=this.iframe.contentWindow)===null||i===void 0||i.postMessage(n,"*"),this.emitter.dispatch(n)}},e.prototype.listen=function(n){return this.emitter.listener(n)},e.prototype.destroy=function(){this.emitter.cleanup(),typeof window<"u"&&window.removeEventListener("message",this.eventListener)},e}(ef);const tL=Object.freeze(Object.defineProperty({__proto__:null,SandpackStatic:eL},Symbol.toStringTag,{value:"Module"}));var nL=function(){function t(e,n,i){var r=this;this.type=e,this.handleMessage=n,this.protocol=i,this._disposeMessageListener=this.protocol.channelListen(function(s){return gt(r,void 0,void 0,function(){var o,a,c,l,c;return vt(this,function(u){switch(u.label){case 0:if(!(s.type===this.getTypeId()&&s.method))return[3,4];o=s,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.handleMessage(o)];case 2:return a=u.sent(),c={type:this.getTypeId(),msgId:o.msgId,result:a},this.protocol.dispatch(c),[3,4];case 3:return l=u.sent(),c={type:this.getTypeId(),msgId:o.msgId,error:{message:l.message}},this.protocol.dispatch(c),[3,4];case 4:return[2]}})})})}return t.prototype.getTypeId=function(){return"protocol-".concat(this.type)},t.prototype.dispose=function(){this._disposeMessageListener()},t}(),iL=function(){function t(e,n){this.globalListeners={},this.globalListenersCount=0,this.channelListeners={},this.channelListenersCount=0,this.channelId=Math.floor(Math.random()*1e6),this.frameWindow=e.contentWindow,this.origin=n,this.globalListeners=[],this.channelListeners=[],this.eventListener=this.eventListener.bind(this),typeof window<"u"&&window.addEventListener("message",this.eventListener)}return t.prototype.cleanup=function(){window.removeEventListener("message",this.eventListener),this.globalListeners={},this.channelListeners={},this.globalListenersCount=0,this.channelListenersCount=0},t.prototype.register=function(){this.frameWindow&&this.frameWindow.postMessage({type:"register-frame",origin:document.location.origin,id:this.channelId},this.origin)},t.prototype.dispatch=function(e){this.frameWindow&&this.frameWindow.postMessage(Me({$id:this.channelId,codesandbox:!0},e),this.origin)},t.prototype.globalListen=function(e){var n=this;if(typeof e!="function")return function(){};var i=this.globalListenersCount;return this.globalListeners[i]=e,this.globalListenersCount++,function(){delete n.globalListeners[i]}},t.prototype.channelListen=function(e){var n=this;if(typeof e!="function")return function(){};var i=this.channelListenersCount;return this.channelListeners[i]=e,this.channelListenersCount++,function(){delete n.channelListeners[i]}},t.prototype.eventListener=function(e){if(e.source===this.frameWindow){var n=e.data;n.codesandbox&&(Object.values(this.globalListeners).forEach(function(i){return i(n)}),n.$id===this.channelId&&Object.values(this.channelListeners).forEach(function(i){return i(n)}))}},t}(),rL=50;function sL(t,e){if(!t)return"static";var n=t.dependencies,i=n===void 0?{}:n,r=t.devDependencies,s=r===void 0?{}:r,o=vo(vo([],Object.keys(i),!0),Object.keys(s),!0),a=Object.keys(e),l=["@adonisjs/framework","@adonisjs/core"];if(o.some(function(h){return l.indexOf(h)>-1}))return"adonis";var c=["nuxt","nuxt-edge","nuxt-ts","nuxt-ts-edge","nuxt3"];if(o.some(function(h){return c.indexOf(h)>-1}))return"nuxt";if(o.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(o.some(function(h){return u.indexOf(h)>-1}))return"apollo";if(o.indexOf("mdx-deck")>-1)return"mdx-deck";if(o.indexOf("gridsome")>-1)return"gridsome";if(o.indexOf("vuepress")>-1)return"vuepress";if(o.indexOf("ember-cli")>-1)return"ember";if(o.indexOf("sapper")>-1)return"sapper";if(o.indexOf("gatsby")>-1)return"gatsby";if(o.indexOf("quasar")>-1)return"quasar";if(o.indexOf("@docusaurus/core")>-1)return"docusaurus";if(o.indexOf("remix")>-1)return"remix";if(o.indexOf("astro")>-1)return"node";if(a.some(function(h){return h.endsWith(".re")}))return"reason";var d=["parcel-bundler","parcel"];if(o.some(function(h){return d.indexOf(h)>-1}))return"parcel";var p=["@dojo/core","@dojo/framework"];if(o.some(function(h){return p.indexOf(h)>-1}))return"@dojo/cli-create-app";if(o.indexOf("@nestjs/core")>-1||o.indexOf("@nestjs/common")>-1)return"nest";if(o.indexOf("react-styleguidist")>-1)return"styleguidist";if(o.indexOf("react-scripts")>-1)return"create-react-app";if(o.indexOf("react-scripts-ts")>-1)return"create-react-app-typescript";if(o.indexOf("@angular/core")>-1)return"angular-cli";if(o.indexOf("preact-cli")>-1)return"preact-cli";if(o.indexOf("@sveltech/routify")>-1||o.indexOf("@roxi/routify")>-1||o.indexOf("vite")>-1||o.indexOf("@frontity/core")>-1)return"node";if(o.indexOf("svelte")>-1)return"svelte";if(o.indexOf("vue")>-1)return"vue-cli";if(o.indexOf("cx")>-1)return"cxjs";var f=["express","koa","nodemon","ts-node","@tensorflow/tfjs-node","webpack-dev-server","snowpack"];if(o.some(function(h){return f.indexOf(h)>-1})||Object.keys(i).length>=rL)return"node"}var rf,oL="https://".concat((rf="2.13.8")===null||rf===void 0?void 0:rf.replace(/\./g,"-"),"-sandpack.codesandbox.io/"),aL=function(t){Hl(e,t);function e(n,i,r){r===void 0&&(r={});var s=t.call(this,n,i,r)||this;if(s.getTranspilerContext=function(){return new Promise(function(a){var l=s.listen(function(c){c.type==="transpiler-context"&&(a(c.data),l())});s.dispatch({type:"get-transpiler-context"})})},s.bundlerURL=r.bundlerURL||oL,r.teamId&&(s.bundlerURL=s.bundlerURL.replace("https://","https://"+r.teamId+"-")+"?cache=".concat(Date.now())),s.bundlerState=void 0,s.errors=[],s.status="initializing",typeof n=="string"){s.selector=n;var o=document.querySelector(n);Fn(o,"The element '".concat(n,"' was not found")),s.element=o,s.iframe=document.createElement("iframe"),s.initializeElement()}else s.element=n,s.iframe=n;return s.iframe.getAttribute("sandbox")||(s.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads allow-pointer-lock"),s.iframe.setAttribute("allow","accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-write;")),s.setLocationURLIntoIFrame(),s.iframeProtocol=new iL(s.iframe,s.bundlerURL),s.unsubscribeGlobalListener=s.iframeProtocol.globalListen(function(a){a.type!=="initialized"||!s.iframe.contentWindow||(s.iframeProtocol.register(),s.options.fileResolver&&(s.fileResolverProtocol=new nL("fs",function(l){return gt(s,void 0,void 0,function(){return vt(this,function(c){if(l.method==="isFile")return[2,this.options.fileResolver.isFile(l.params[0])];if(l.method==="readFile")return[2,this.options.fileResolver.readFile(l.params[0])];throw new Error("Method not supported")})})},s.iframeProtocol)),s.updateSandbox(s.sandboxSetup,!0))}),s.unsubscribeChannelListener=s.iframeProtocol.channelListen(function(a){switch(a.type){case"start":{s.errors=[];break}case"status":{s.status=a.status;break}case"action":{a.action==="show-error"&&(s.errors=vo(vo([],s.errors,!0),[Nf(a)],!1));break}case"done":{s.status="done";break}case"state":{s.bundlerState=a.state;break}}}),s}return e.prototype.setLocationURLIntoIFrame=function(){var n,i=this.options.startRoute?new URL(this.options.startRoute,this.bundlerURL).toString():this.bundlerURL;(n=this.iframe.contentWindow)===null||n===void 0||n.location.replace(i),this.iframe.src=i},e.prototype.destroy=function(){this.unsubscribeChannelListener(),this.unsubscribeGlobalListener(),this.iframeProtocol.cleanup()},e.prototype.updateOptions=function(n){Pi(this.options,n)||(this.options=n,this.updateSandbox())},e.prototype.updateSandbox=function(n,i){var r,s,o,a;n===void 0&&(n=this.sandboxSetup),this.sandboxSetup=Me(Me({},this.sandboxSetup),n);var l=this.getFiles(),c=Object.keys(l).reduce(function(p,f){var h;return Me(Me({},p),(h={},h[f]={code:l[f].code,path:f},h))},{}),u=JSON.parse(If(this.sandboxSetup.dependencies,this.sandboxSetup.devDependencies,this.sandboxSetup.entry));try{u=JSON.parse(l["/package.json"].code)}catch(p){console.error(ki("could not parse package.json file: "+p.message))}var d=Object.keys(l).reduce(function(p,f){var h;return Me(Me({},p),(h={},h[f]={content:l[f].code,path:f},h))},{});this.dispatch(Me(Me({},this.options),{type:"compile",codesandbox:!0,version:3,isInitializationCompile:i,modules:c,reactDevTools:this.options.reactDevTools,externalResources:this.options.externalResources||[],hasFileResolver:!!this.options.fileResolver,disableDependencyPreprocessing:this.sandboxSetup.disableDependencyPreprocessing,template:this.sandboxSetup.template||sL(u,d),showOpenInCodeSandbox:(r=this.options.showOpenInCodeSandbox)!==null&&r!==void 0?r:!0,showErrorScreen:(s=this.options.showErrorScreen)!==null&&s!==void 0?s:!0,showLoadingScreen:(o=this.options.showLoadingScreen)!==null&&o!==void 0?o:!1,skipEval:this.options.skipEval||!1,clearConsoleDisabled:!this.options.clearConsoleOnFirstCompile,logLevel:(a=this.options.logLevel)!==null&&a!==void 0?a:Jl.Info,customNpmRegistries:this.options.customNpmRegistries,teamId:this.options.teamId,sandboxId:this.options.sandboxId}))},e.prototype.dispatch=function(n){n.type==="refresh"&&this.setLocationURLIntoIFrame(),this.iframeProtocol.dispatch(n)},e.prototype.listen=function(n){return this.iframeProtocol.channelListen(n)},e.prototype.getCodeSandboxURL=function(){var n=this.getFiles(),i=Object.keys(n).reduce(function(r,s){var o;return Me(Me({},r),(o={},o[s.replace("/","")]={content:n[s].code,isBinary:!1},o))},{});return fetch("https://codesandbox.io/api/v1/sandboxes/define?json=1",{method:"POST",body:JSON.stringify({files:i}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(r){return r.json()}).then(function(r){return{sandboxId:r.sandbox_id,editorUrl:"https://codesandbox.io/s/".concat(r.sandbox_id),embedUrl:"https://codesandbox.io/embed/".concat(r.sandbox_id)}})},e.prototype.getFiles=function(){var n=this.sandboxSetup;return n.files["/package.json"]===void 0?Zf(n.files,n.dependencies,n.devDependencies,n.entry):this.sandboxSetup.files},e.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",Fn(this.element.parentNode,"The given iframe does not have a parent."),this.element.parentNode.replaceChild(this.iframe,this.element)},e}(ef);const lL=Object.freeze(Object.defineProperty({__proto__:null,SandpackRuntime:aL},Symbol.toStringTag,{value:"Module"}));xe.Editor=IZ,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
|
|
779
|
+
`).trim();return this.injectContentIntoHead(n,a)},e.prototype.updateSandbox=function(n,i){n===void 0&&(n=this.sandboxSetup);var r=_w(n.files);this.dispatch({codesandbox:!0,modules:r,template:n.template,type:"compile"})},e.prototype.compile=function(n){return gt(this,void 0,void 0,function(){var i;return vt(this,function(r){switch(r.label){case 0:return this.files=new Map(Object.entries(n)),[4,this.previewController.initPreview()];case 1:return i=r.sent(),this.iframe.setAttribute("src",i),this.status="done",this.dispatch({type:"done",compilatonError:!1}),this.dispatch({type:"urlchange",url:i,back:!1,forward:!1}),[2]}})})},e.prototype.eventListener=function(n){if(n.source===this.iframe.contentWindow){var i=n.data;i.codesandbox&&this.dispatch(i)}},e.prototype.dispatch=function(n){var i;switch(n.type){case"compile":this.compile(n.modules);break;default:(i=this.iframe.contentWindow)===null||i===void 0||i.postMessage(n,"*"),this.emitter.dispatch(n)}},e.prototype.listen=function(n){return this.emitter.listener(n)},e.prototype.destroy=function(){this.emitter.cleanup(),typeof window<"u"&&window.removeEventListener("message",this.eventListener)},e}(ef);const tL=Object.freeze(Object.defineProperty({__proto__:null,SandpackStatic:eL},Symbol.toStringTag,{value:"Module"}));var nL=function(){function t(e,n,i){var r=this;this.type=e,this.handleMessage=n,this.protocol=i,this._disposeMessageListener=this.protocol.channelListen(function(s){return gt(r,void 0,void 0,function(){var o,a,c,l,c;return vt(this,function(u){switch(u.label){case 0:if(!(s.type===this.getTypeId()&&s.method))return[3,4];o=s,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.handleMessage(o)];case 2:return a=u.sent(),c={type:this.getTypeId(),msgId:o.msgId,result:a},this.protocol.dispatch(c),[3,4];case 3:return l=u.sent(),c={type:this.getTypeId(),msgId:o.msgId,error:{message:l.message}},this.protocol.dispatch(c),[3,4];case 4:return[2]}})})})}return t.prototype.getTypeId=function(){return"protocol-".concat(this.type)},t.prototype.dispose=function(){this._disposeMessageListener()},t}(),iL=function(){function t(e,n){this.globalListeners={},this.globalListenersCount=0,this.channelListeners={},this.channelListenersCount=0,this.channelId=Math.floor(Math.random()*1e6),this.frameWindow=e.contentWindow,this.origin=n,this.globalListeners=[],this.channelListeners=[],this.eventListener=this.eventListener.bind(this),typeof window<"u"&&window.addEventListener("message",this.eventListener)}return t.prototype.cleanup=function(){window.removeEventListener("message",this.eventListener),this.globalListeners={},this.channelListeners={},this.globalListenersCount=0,this.channelListenersCount=0},t.prototype.register=function(){this.frameWindow&&this.frameWindow.postMessage({type:"register-frame",origin:document.location.origin,id:this.channelId},this.origin)},t.prototype.dispatch=function(e){this.frameWindow&&this.frameWindow.postMessage(Me({$id:this.channelId,codesandbox:!0},e),this.origin)},t.prototype.globalListen=function(e){var n=this;if(typeof e!="function")return function(){};var i=this.globalListenersCount;return this.globalListeners[i]=e,this.globalListenersCount++,function(){delete n.globalListeners[i]}},t.prototype.channelListen=function(e){var n=this;if(typeof e!="function")return function(){};var i=this.channelListenersCount;return this.channelListeners[i]=e,this.channelListenersCount++,function(){delete n.channelListeners[i]}},t.prototype.eventListener=function(e){if(e.source===this.frameWindow){var n=e.data;n.codesandbox&&(Object.values(this.globalListeners).forEach(function(i){return i(n)}),n.$id===this.channelId&&Object.values(this.channelListeners).forEach(function(i){return i(n)}))}},t}(),rL=50;function sL(t,e){if(!t)return"static";var n=t.dependencies,i=n===void 0?{}:n,r=t.devDependencies,s=r===void 0?{}:r,o=vo(vo([],Object.keys(i),!0),Object.keys(s),!0),a=Object.keys(e),l=["@adonisjs/framework","@adonisjs/core"];if(o.some(function(h){return l.indexOf(h)>-1}))return"adonis";var c=["nuxt","nuxt-edge","nuxt-ts","nuxt-ts-edge","nuxt3"];if(o.some(function(h){return c.indexOf(h)>-1}))return"nuxt";if(o.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(o.some(function(h){return u.indexOf(h)>-1}))return"apollo";if(o.indexOf("mdx-deck")>-1)return"mdx-deck";if(o.indexOf("gridsome")>-1)return"gridsome";if(o.indexOf("vuepress")>-1)return"vuepress";if(o.indexOf("ember-cli")>-1)return"ember";if(o.indexOf("sapper")>-1)return"sapper";if(o.indexOf("gatsby")>-1)return"gatsby";if(o.indexOf("quasar")>-1)return"quasar";if(o.indexOf("@docusaurus/core")>-1)return"docusaurus";if(o.indexOf("remix")>-1)return"remix";if(o.indexOf("astro")>-1)return"node";if(a.some(function(h){return h.endsWith(".re")}))return"reason";var d=["parcel-bundler","parcel"];if(o.some(function(h){return d.indexOf(h)>-1}))return"parcel";var p=["@dojo/core","@dojo/framework"];if(o.some(function(h){return p.indexOf(h)>-1}))return"@dojo/cli-create-app";if(o.indexOf("@nestjs/core")>-1||o.indexOf("@nestjs/common")>-1)return"nest";if(o.indexOf("react-styleguidist")>-1)return"styleguidist";if(o.indexOf("react-scripts")>-1)return"create-react-app";if(o.indexOf("react-scripts-ts")>-1)return"create-react-app-typescript";if(o.indexOf("@angular/core")>-1)return"angular-cli";if(o.indexOf("preact-cli")>-1)return"preact-cli";if(o.indexOf("@sveltech/routify")>-1||o.indexOf("@roxi/routify")>-1||o.indexOf("vite")>-1||o.indexOf("@frontity/core")>-1)return"node";if(o.indexOf("svelte")>-1)return"svelte";if(o.indexOf("vue")>-1)return"vue-cli";if(o.indexOf("cx")>-1)return"cxjs";var f=["express","koa","nodemon","ts-node","@tensorflow/tfjs-node","webpack-dev-server","snowpack"];if(o.some(function(h){return f.indexOf(h)>-1})||Object.keys(i).length>=rL)return"node"}var rf,oL="https://".concat((rf="2.13.8")===null||rf===void 0?void 0:rf.replace(/\./g,"-"),"-sandpack.codesandbox.io/"),aL=function(t){Hl(e,t);function e(n,i,r){r===void 0&&(r={});var s=t.call(this,n,i,r)||this;if(s.getTranspilerContext=function(){return new Promise(function(a){var l=s.listen(function(c){c.type==="transpiler-context"&&(a(c.data),l())});s.dispatch({type:"get-transpiler-context"})})},s.bundlerURL=r.bundlerURL||oL,r.teamId&&(s.bundlerURL=s.bundlerURL.replace("https://","https://"+r.teamId+"-")+"?cache=".concat(Date.now())),s.bundlerState=void 0,s.errors=[],s.status="initializing",typeof n=="string"){s.selector=n;var o=document.querySelector(n);Fn(o,"The element '".concat(n,"' was not found")),s.element=o,s.iframe=document.createElement("iframe"),s.initializeElement()}else s.element=n,s.iframe=n;return s.iframe.getAttribute("sandbox")||(s.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads allow-pointer-lock"),s.iframe.setAttribute("allow","accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-write;")),s.setLocationURLIntoIFrame(),s.iframeProtocol=new iL(s.iframe,s.bundlerURL),s.unsubscribeGlobalListener=s.iframeProtocol.globalListen(function(a){a.type!=="initialized"||!s.iframe.contentWindow||(s.iframeProtocol.register(),s.options.fileResolver&&(s.fileResolverProtocol=new nL("fs",function(l){return gt(s,void 0,void 0,function(){return vt(this,function(c){if(l.method==="isFile")return[2,this.options.fileResolver.isFile(l.params[0])];if(l.method==="readFile")return[2,this.options.fileResolver.readFile(l.params[0])];throw new Error("Method not supported")})})},s.iframeProtocol)),s.updateSandbox(s.sandboxSetup,!0))}),s.unsubscribeChannelListener=s.iframeProtocol.channelListen(function(a){switch(a.type){case"start":{s.errors=[];break}case"status":{s.status=a.status;break}case"action":{a.action==="show-error"&&(s.errors=vo(vo([],s.errors,!0),[Nf(a)],!1));break}case"done":{s.status="done";break}case"state":{s.bundlerState=a.state;break}}}),s}return e.prototype.setLocationURLIntoIFrame=function(){var n,i=this.options.startRoute?new URL(this.options.startRoute,this.bundlerURL).toString():this.bundlerURL;(n=this.iframe.contentWindow)===null||n===void 0||n.location.replace(i),this.iframe.src=i},e.prototype.destroy=function(){this.unsubscribeChannelListener(),this.unsubscribeGlobalListener(),this.iframeProtocol.cleanup()},e.prototype.updateOptions=function(n){Pi(this.options,n)||(this.options=n,this.updateSandbox())},e.prototype.updateSandbox=function(n,i){var r,s,o,a;n===void 0&&(n=this.sandboxSetup),this.sandboxSetup=Me(Me({},this.sandboxSetup),n);var l=this.getFiles(),c=Object.keys(l).reduce(function(p,f){var h;return Me(Me({},p),(h={},h[f]={code:l[f].code,path:f},h))},{}),u=JSON.parse(If(this.sandboxSetup.dependencies,this.sandboxSetup.devDependencies,this.sandboxSetup.entry));try{u=JSON.parse(l["/package.json"].code)}catch(p){console.error(ki("could not parse package.json file: "+p.message))}var d=Object.keys(l).reduce(function(p,f){var h;return Me(Me({},p),(h={},h[f]={content:l[f].code,path:f},h))},{});this.dispatch(Me(Me({},this.options),{type:"compile",codesandbox:!0,version:3,isInitializationCompile:i,modules:c,reactDevTools:this.options.reactDevTools,externalResources:this.options.externalResources||[],hasFileResolver:!!this.options.fileResolver,disableDependencyPreprocessing:this.sandboxSetup.disableDependencyPreprocessing,template:this.sandboxSetup.template||sL(u,d),showOpenInCodeSandbox:(r=this.options.showOpenInCodeSandbox)!==null&&r!==void 0?r:!0,showErrorScreen:(s=this.options.showErrorScreen)!==null&&s!==void 0?s:!0,showLoadingScreen:(o=this.options.showLoadingScreen)!==null&&o!==void 0?o:!1,skipEval:this.options.skipEval||!1,clearConsoleDisabled:!this.options.clearConsoleOnFirstCompile,logLevel:(a=this.options.logLevel)!==null&&a!==void 0?a:Jl.Info,customNpmRegistries:this.options.customNpmRegistries,teamId:this.options.teamId,sandboxId:this.options.sandboxId}))},e.prototype.dispatch=function(n){n.type==="refresh"&&this.setLocationURLIntoIFrame(),this.iframeProtocol.dispatch(n)},e.prototype.listen=function(n){return this.iframeProtocol.channelListen(n)},e.prototype.getCodeSandboxURL=function(){var n=this.getFiles(),i=Object.keys(n).reduce(function(r,s){var o;return Me(Me({},r),(o={},o[s.replace("/","")]={content:n[s].code,isBinary:!1},o))},{});return fetch("https://codesandbox.io/api/v1/sandboxes/define?json=1",{method:"POST",body:JSON.stringify({files:i}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(r){return r.json()}).then(function(r){return{sandboxId:r.sandbox_id,editorUrl:"https://codesandbox.io/s/".concat(r.sandbox_id),embedUrl:"https://codesandbox.io/embed/".concat(r.sandbox_id)}})},e.prototype.getFiles=function(){var n=this.sandboxSetup;return n.files["/package.json"]===void 0?Zf(n.files,n.dependencies,n.devDependencies,n.entry):this.sandboxSetup.files},e.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",Fn(this.element.parentNode,"The given iframe does not have a parent."),this.element.parentNode.replaceChild(this.iframe,this.element)},e}(ef);const lL=Object.freeze(Object.defineProperty({__proto__:null,SandpackRuntime:aL},Symbol.toStringTag,{value:"Module"}));xe.WEditor=IZ,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
|