@dao42/d42paas-front 0.5.23 → 0.5.28

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.
@@ -29401,7 +29401,7 @@ const Loading = () => {
29401
29401
  })
29402
29402
  });
29403
29403
  };
29404
- let index$5 = 0;
29404
+ let index$7 = 0;
29405
29405
  const REPLAY_INTERVAL = 250;
29406
29406
  let timer;
29407
29407
  let timeOutT;
@@ -29418,7 +29418,7 @@ const replayHandler = async () => {
29418
29418
  data: dockerInfo.fileTree
29419
29419
  });
29420
29420
  const crdts = await getLocalCRDTs();
29421
- const filterData = crdts[index$5];
29421
+ const filterData = crdts[index$7];
29422
29422
  const cdata = __spreadValues({}, filterData);
29423
29423
  timeOutT = setTimeout(async () => {
29424
29424
  if (!cdata.timestamp) {
@@ -29440,7 +29440,7 @@ const replayHandler = async () => {
29440
29440
  }
29441
29441
  setCRDTInfo(__spreadValues({}, cdata));
29442
29442
  }, 0);
29443
- index$5++;
29443
+ index$7++;
29444
29444
  return {};
29445
29445
  };
29446
29446
  const replay = async (status2) => {
@@ -29460,7 +29460,7 @@ const replay = async (status2) => {
29460
29460
  content: "\u64AD\u653E\u5B8C\u6BD5",
29461
29461
  placement: "topCenter"
29462
29462
  });
29463
- index$5 = 0;
29463
+ index$7 = 0;
29464
29464
  break;
29465
29465
  case "disabled":
29466
29466
  clearInterval(timer);
@@ -29469,7 +29469,7 @@ const replay = async (status2) => {
29469
29469
  path: ""
29470
29470
  });
29471
29471
  setAppStatus("code");
29472
- index$5 = 0;
29472
+ index$7 = 0;
29473
29473
  break;
29474
29474
  case "pause":
29475
29475
  clearInterval(timer);
@@ -29492,13 +29492,19 @@ const replay = async (status2) => {
29492
29492
  break;
29493
29493
  }
29494
29494
  };
29495
- var index$4 = "";
29495
+ var index$6 = "";
29496
29496
  const LazyTreeComponent = lazy$2(async () => (await Promise.resolve().then(function() {
29497
- return index$3;
29497
+ return index$5;
29498
29498
  })).FileTree);
29499
29499
  const LazyEditorComponent = lazy$2(async () => (await Promise.resolve().then(function() {
29500
- return index$2;
29500
+ return index$4;
29501
29501
  })).Editor);
29502
+ const LazyConsoleComponent = lazy$2(async () => (await Promise.resolve().then(function() {
29503
+ return index$3;
29504
+ })).default);
29505
+ const LazyBrowserComponent = lazy$2(async () => (await Promise.resolve().then(function() {
29506
+ return index$2;
29507
+ })).default);
29502
29508
  const LazyShellComponent = lazy$2(async () => (await Promise.resolve().then(function() {
29503
29509
  return index$1;
29504
29510
  })).default);
@@ -29674,6 +29680,26 @@ class DaoPaaS {
29674
29680
  children: /* @__PURE__ */ jsx(LazyTreeComponent, __spreadValues({}, props))
29675
29681
  }), this.editorDOM);
29676
29682
  }
29683
+ Console({
29684
+ container,
29685
+ props
29686
+ }) {
29687
+ this.editorDOM = container ? isHTMLElement$1(container) : this.editorDOM;
29688
+ reactDom.exports.render(/* @__PURE__ */ jsx(react.exports.Suspense, {
29689
+ fallback: /* @__PURE__ */ jsx(Loading, {}),
29690
+ children: /* @__PURE__ */ jsx(LazyConsoleComponent, __spreadValues({}, props))
29691
+ }), this.editorDOM);
29692
+ }
29693
+ Browser({
29694
+ container,
29695
+ props
29696
+ }) {
29697
+ this.editorDOM = container ? isHTMLElement$1(container) : this.editorDOM;
29698
+ reactDom.exports.render(/* @__PURE__ */ jsx(react.exports.Suspense, {
29699
+ fallback: /* @__PURE__ */ jsx(Loading, {}),
29700
+ children: /* @__PURE__ */ jsx(LazyBrowserComponent, __spreadValues({}, props))
29701
+ }), this.editorDOM);
29702
+ }
29677
29703
  }
29678
29704
  function isHTMLElement$1(arg) {
29679
29705
  if (!/HTMLDivElement|HTMLElement/.test(Object.prototype.toString.call(arg))) {
@@ -31621,13 +31647,13 @@ var Tree = react.exports.forwardRef(function(props, ref) {
31621
31647
  }
31622
31648
  return react.exports.createElement(TreeContext.Provider, { value: treeContextProps }, react.exports.createElement(TreeActionsProvider, { ref }, react.exports.createElement(TreeManager, null)));
31623
31649
  });
31624
- function IoClient(revision) {
31650
+ const IoClient = function(revision) {
31625
31651
  this.revision = revision;
31626
31652
  this.state = synchronized_;
31627
31653
  this.operation = [];
31628
31654
  this.receiveOperation = [];
31629
31655
  this.io = useOT.getState().socket;
31630
- }
31656
+ };
31631
31657
  IoClient.prototype.setState = function(state) {
31632
31658
  this.state = state;
31633
31659
  };
@@ -31708,10 +31734,15 @@ AwaitingWithBuffer.prototype.applyClient = function(client2, operation) {
31708
31734
  return new AwaitingWithBuffer(this.outstanding, newBuffer);
31709
31735
  };
31710
31736
  AwaitingWithBuffer.prototype.applyServer = function(client2, operation) {
31737
+ let pair2, pair1;
31711
31738
  const transform = operation.constructor.transform;
31712
- const pair1 = transform(this.outstanding, operation);
31713
- const pair2 = transform(this.buffer, pair1[1]);
31714
- client2.applyOperation(pair2[1]);
31739
+ if (this.outstanding.baseLength === operation.baseLength) {
31740
+ pair1 = transform(this.outstanding, operation);
31741
+ if (this.buffer.baseLength === pair1[1].baseLength) {
31742
+ pair2 = transform(this.buffer, pair1[1]);
31743
+ client2.applyOperation(pair2[1]);
31744
+ }
31745
+ }
31715
31746
  return new AwaitingWithBuffer(pair1[0], pair2[0]);
31716
31747
  };
31717
31748
  AwaitingWithBuffer.prototype.serverAck = function(client2) {
@@ -32064,7 +32095,7 @@ const FileTree = ({
32064
32095
  })
32065
32096
  });
32066
32097
  };
32067
- var index$3 = /* @__PURE__ */ Object.freeze({
32098
+ var index$5 = /* @__PURE__ */ Object.freeze({
32068
32099
  __proto__: null,
32069
32100
  [Symbol.toStringTag]: "Module",
32070
32101
  FileTree
@@ -174690,7 +174721,9 @@ const EditorLayout = newStyled.div`
174690
174721
  .stack-list {
174691
174722
  width: 100%;
174692
174723
  height: 40px;
174693
-
174724
+ transform: translate(0, -1px);
174725
+ overflow-x: auto;
174726
+ flex-wrap: nowrap;
174694
174727
  li {
174695
174728
  /* width: 100px; */
174696
174729
  height: 100%;
@@ -174701,11 +174734,11 @@ const EditorLayout = newStyled.div`
174701
174734
 
174702
174735
  .active {
174703
174736
  background: #1e1e1e;
174737
+ box-shadow: 0px 1px 0px 0 #333;
174704
174738
  /* border-left: 1px solid rgb(42 96 231);
174705
174739
  border-right: 1px solid rgb(42 96 231); */
174706
174740
  /* background: red; */
174707
174741
  }
174708
-
174709
174742
  }
174710
174743
  `;
174711
174744
  const ContentLayout = newStyled.div`
@@ -174715,7 +174748,10 @@ const ContentLayout = newStyled.div`
174715
174748
  `;
174716
174749
  const Editor = ({
174717
174750
  doc,
174718
- docType
174751
+ docType,
174752
+ containerStyle,
174753
+ menuStyle,
174754
+ editorStyle
174719
174755
  }) => {
174720
174756
  const divEl = react.exports.useRef(null);
174721
174757
  react.exports.useState(doc ? doc : "");
@@ -174788,13 +174824,20 @@ const Editor = ({
174788
174824
  setPosition(editor.getPosition());
174789
174825
  let keepString = 0;
174790
174826
  let rangeLengthamount = 0;
174827
+ let rangeOffsetthamount = 0;
174828
+ let preOffset = 0;
174791
174829
  const valuelength = editorValue.length - changes.reduce((change, nextChange, i2) => change - nextChange.rangeLength + nextChange.text.length, 0);
174792
- const operation = changes.sort((c1, c2) => c1.rangeOffset - c2.rangeOffset).map((change, i2) => {
174793
- rangeLengthamount += i2 === 0 ? 0 : change.rangeLength;
174794
- keepString += i2 === 0 ? 0 : change.text.length;
174795
- return new TextOperation().retain(i2 === 0 ? change.rangeOffset : change.rangeOffset - rangeLengthamount + keepString).delete(change.rangeLength).insert(change.text).retain(valuelength - change.rangeOffset - change.rangeLength);
174796
- }).reduce((a2, b2) => a2.compose(b2));
174797
- setLocalFile((doc2 == null ? void 0 : doc2.path) ? doc2 == null ? void 0 : doc2.path : "singleFile", editor.getValue());
174830
+ const operation = new TextOperation();
174831
+ changes.sort((change1, change2) => change1.rangeOffset - change2.rangeOffset).forEach((change, index2, _array) => {
174832
+ operation.retain(index2 === 0 ? change.rangeOffset : change.rangeOffset - preOffset).delete(change.rangeLength).insert(change.text);
174833
+ if (index2 + 1 === _array.length) {
174834
+ operation.retain(valuelength - change.rangeLength - change.rangeOffset);
174835
+ }
174836
+ preOffset = change.rangeOffset + change.rangeLength;
174837
+ rangeLengthamount += change.rangeLength;
174838
+ keepString += change.text.length;
174839
+ rangeOffsetthamount += change.rangeOffset;
174840
+ });
174798
174841
  client2.applyClient(operation);
174799
174842
  } else {
174800
174843
  setValue(changes[0].text);
@@ -174867,7 +174910,7 @@ const Editor = ({
174867
174910
  setLocalFile(doc2.path, file.value);
174868
174911
  }
174869
174912
  };
174870
- const lspServerInject = (lan, disable) => {
174913
+ const lspServerInject = (_lan, disable) => {
174871
174914
  languages.register({
174872
174915
  id: "ruby",
174873
174916
  extensions: [".rb"],
@@ -174962,13 +175005,14 @@ const Editor = ({
174962
175005
  });
174963
175006
  editor = editor$1.create(divEl.current, {
174964
175007
  theme: "vs-dark",
175008
+ automaticLayout: true,
174965
175009
  glyphMargin: true,
174966
175010
  lightbulb: {
174967
175011
  enabled: true
174968
175012
  }
174969
175013
  });
174970
- lspServerInject(INIT_LANGUAGE, oTStore.getState().lspServerDisabled);
174971
175014
  editorEventBinder();
175015
+ lspServerInject(INIT_LANGUAGE, oTStore.getState().lspServerDisabled);
174972
175016
  const editorService = editor._codeEditorService;
174973
175017
  const openEditorBase = editorService.openCodeEditor.bind(editorService);
174974
175018
  editorService.openCodeEditor = async (input, source, workspacePath) => {
@@ -175014,7 +175058,7 @@ const Editor = ({
175014
175058
  index2 += op;
175015
175059
  }
175016
175060
  if (TextOperation.isInsert(op)) {
175017
- const insert = model.getPositionAt(index2);
175061
+ const insert = model == null ? void 0 : model.getPositionAt(index2);
175018
175062
  const originResult = {
175019
175063
  forceMoveMarkers: true,
175020
175064
  range: new Range$4(insert.lineNumber, insert.column, insert.lineNumber, insert.column),
@@ -175023,8 +175067,8 @@ const Editor = ({
175023
175067
  results.push(originResult);
175024
175068
  }
175025
175069
  if (TextOperation.isDelete(op)) {
175026
- const start = model.getPositionAt(index2);
175027
- const end = model.getPositionAt(index2 - op);
175070
+ const start = model == null ? void 0 : model.getPositionAt(index2);
175071
+ const end = model == null ? void 0 : model.getPositionAt(index2 - op);
175028
175072
  results.push({
175029
175073
  forceMoveMarkers: false,
175030
175074
  range: new Range$4(start.lineNumber, start.column, end.lineNumber, end.column),
@@ -175034,7 +175078,7 @@ const Editor = ({
175034
175078
  }
175035
175079
  });
175036
175080
  {
175037
- model.pushEditOperations([], results, null);
175081
+ model == null ? void 0 : model.pushEditOperations([], results, null);
175038
175082
  }
175039
175083
  }
175040
175084
  }, [OTSTATE.CRDTInfo]);
@@ -175078,10 +175122,9 @@ const Editor = ({
175078
175122
  }));
175079
175123
  });
175080
175124
  setUsersDelta(usersDelta.map((deltaInfo) => {
175081
- var _a3;
175082
175125
  if (deltaInfo.uuid === CRDTInfo.userInfo.uuid) {
175083
175126
  return __spreadProps(__spreadValues({}, deltaInfo), {
175084
- delta: editor.deltaDecorations(deltaInfo.delta ? deltaInfo.delta : "", (_a3 = CRDTInfo == null ? void 0 : CRDTInfo.selection) == null ? void 0 : _a3.map((s2) => ({
175127
+ delta: editor.deltaDecorations(deltaInfo.delta ? deltaInfo.delta : "", (CRDTInfo == null ? void 0 : CRDTInfo.selection).map((s2) => ({
175085
175128
  range: new Range$4(s2[0], s2[1], s2[2], s2[3]),
175086
175129
  options: {
175087
175130
  isWholeLine: false,
@@ -175176,8 +175219,10 @@ const Editor = ({
175176
175219
  });
175177
175220
  }, [USERLISTSTORE.userList, file == null ? void 0 : file.path]);
175178
175221
  return /* @__PURE__ */ jsxs(EditorLayout, {
175222
+ style: containerStyle,
175179
175223
  className: "editor-layout flex flex-col",
175180
175224
  children: [FileTreeStack.length > 0 ? /* @__PURE__ */ jsx("ul", {
175225
+ style: menuStyle,
175181
175226
  className: "bg-codezone-black stack-list flex flex-row items-center flex-shrink-0",
175182
175227
  children: FileTreeStack.map((f2, index2) => /* @__PURE__ */ jsx("li", {
175183
175228
  className: `flex flex-row justify-center items-center cursor-pointer ${f2.path === (file == null ? void 0 : file.path) ? "active" : ""}`,
@@ -175189,11 +175234,12 @@ const Editor = ({
175189
175234
  }) : null, /* @__PURE__ */ jsx(ContentLayout, {
175190
175235
  ref: divEl,
175191
175236
  userList: userListStore.getState().userList,
175192
- className: "edito-content flex-1"
175237
+ className: "edito-content flex-1",
175238
+ style: editorStyle
175193
175239
  })]
175194
175240
  });
175195
175241
  };
175196
- var index$2 = /* @__PURE__ */ Object.freeze({
175242
+ var index$4 = /* @__PURE__ */ Object.freeze({
175197
175243
  __proto__: null,
175198
175244
  [Symbol.toStringTag]: "Module",
175199
175245
  Editor
@@ -182320,12 +182366,237 @@ const XTerm = (_a2) => {
182320
182366
  })
182321
182367
  });
182322
182368
  };
182323
- const TerminalComponent = (_c2) => {
182369
+ const Console = (_c2) => {
182324
182370
  var _d2 = _c2, {
182325
182371
  options
182326
182372
  } = _d2, props = __objRest(_d2, [
182327
182373
  "options"
182328
182374
  ]);
182375
+ const defaultOptions2 = __spreadValues({
182376
+ convertEol: true,
182377
+ fontSize: 12,
182378
+ fontFamily: "Monaco, Menlo, monospace",
182379
+ lineHeight: 1,
182380
+ cursorBlink: true,
182381
+ cursorWidth: 1,
182382
+ cursorStyle: "block",
182383
+ rightClickSelectsWord: true,
182384
+ theme: {
182385
+ background: "#1E1E1E"
182386
+ }
182387
+ }, options);
182388
+ const [terminal, setTerminal] = react.exports.useState(null);
182389
+ const {
182390
+ CRDTInfo
182391
+ } = oTStore((state) => state);
182392
+ const {
182393
+ dockerStatus
182394
+ } = oTStore((state) => state);
182395
+ const initTerminalText = (terminal2, text2) => {
182396
+ terminal2.write("\r\n");
182397
+ terminal2.clear();
182398
+ writeText(terminal2, text2);
182399
+ };
182400
+ const writeText = (terminal2, text2) => {
182401
+ terminal2.write(text2);
182402
+ };
182403
+ react.exports.useEffect(() => {
182404
+ if (!terminal) {
182405
+ const term = new xterm.exports.Terminal(defaultOptions2);
182406
+ setTerminal(term);
182407
+ }
182408
+ }, []);
182409
+ react.exports.useEffect(() => {
182410
+ if (!terminal)
182411
+ return;
182412
+ if (dockerStatus === "STOP") {
182413
+ initTerminalText(terminal, "\u5E94\u7528\u672A\u542F\u52A8\r\n");
182414
+ } else {
182415
+ initTerminalText(terminal, oTStore.getState().dockerInfo.consoleHistory);
182416
+ }
182417
+ }, [terminal]);
182418
+ react.exports.useEffect(() => {
182419
+ if (!terminal)
182420
+ return;
182421
+ const crdt = CRDTInfo.console;
182422
+ if (crdt) {
182423
+ writeText(terminal, crdt.doc.value || "");
182424
+ }
182425
+ }, [CRDTInfo.console]);
182426
+ react.exports.useEffect(() => {
182427
+ if (!terminal)
182428
+ return;
182429
+ if (dockerStatus === "STOP") {
182430
+ setTimeout(() => {
182431
+ writeText(terminal, "\r\n\u5E94\u7528\u672A\u542F\u52A8\r\n");
182432
+ }, 400);
182433
+ } else {
182434
+ initTerminalText(terminal, "");
182435
+ }
182436
+ }, [dockerStatus]);
182437
+ return /* @__PURE__ */ jsx("div", {
182438
+ style: {
182439
+ height: "100%",
182440
+ width: "100%"
182441
+ },
182442
+ children: /* @__PURE__ */ jsx(XTerm, __spreadValues({
182443
+ terminal
182444
+ }, props))
182445
+ });
182446
+ };
182447
+ var index$3 = /* @__PURE__ */ Object.freeze({
182448
+ __proto__: null,
182449
+ [Symbol.toStringTag]: "Module",
182450
+ "default": Console
182451
+ });
182452
+ const PROTOCOL = "https://";
182453
+ const NavBar = newStyled.div`
182454
+ background-color: white;
182455
+ height: 30px;
182456
+ display: flex;
182457
+ align-items: center;
182458
+
182459
+ i {
182460
+ margin: 0 10px;
182461
+ width: 24px;
182462
+ height: 24px;
182463
+ border-radius: 50%;
182464
+ display: flex;
182465
+ justify-content: center;
182466
+ align-items: center;
182467
+
182468
+ &.disabled {
182469
+ color: #f2fffe;
182470
+ &:hover {
182471
+ background-color: white;
182472
+ }
182473
+ }
182474
+
182475
+ &:hover {
182476
+ background-color: #e0e0e0;
182477
+ }
182478
+ }
182479
+
182480
+ input {
182481
+ flex: 1;
182482
+ display: inline-block;
182483
+ height: 26px;
182484
+ line-height: 26px;
182485
+ padding: 0 8px;
182486
+ border: 1px solid #adacac;
182487
+ border-radius: 5px;
182488
+ }
182489
+ `;
182490
+ const StopMask = newStyled.div`
182491
+ width: 100%;
182492
+ height: calc(100% - 30px);
182493
+ position: absolute;
182494
+ display: flex;
182495
+ justify-content: center;
182496
+ align-items: center;
182497
+ font-size: 18px;
182498
+ color: #ffffff;
182499
+ background-color: #5a5a5a;
182500
+ opacity: 0.6;
182501
+ `;
182502
+ const OutputBrowser = (_e2) => {
182503
+ var _f2 = _e2, {
182504
+ url: url2
182505
+ } = _f2, props = __objRest(_f2, [
182506
+ "url"
182507
+ ]);
182508
+ const pStatus = oTStore((state) => state.playgroundStatus);
182509
+ const dStatus = oTStore((state) => state.dockerStatus);
182510
+ const [playgroundStatus, setPlaygroundStatus] = react.exports.useState("EMPTY");
182511
+ const [dockerStatus, setDockerStatus] = react.exports.useState("STOP");
182512
+ const urlWithProtocol = (url22) => {
182513
+ if (!url22)
182514
+ return `${PROTOCOL}showmebug.com`;
182515
+ if (url22.indexOf("http://") !== 0 && url22.indexOf("https://") !== 0) {
182516
+ url22 = `${PROTOCOL}${url22}`;
182517
+ }
182518
+ return url22;
182519
+ };
182520
+ react.exports.useEffect(() => {
182521
+ setPlaygroundStatus(pStatus);
182522
+ }, [pStatus]);
182523
+ react.exports.useEffect(() => {
182524
+ setDockerStatus(dStatus);
182525
+ setTimeout(() => {
182526
+ onRefresh();
182527
+ }, 800);
182528
+ }, [dStatus]);
182529
+ const iframeRef = react.exports.useRef(null);
182530
+ const [iframeSrc, setIframeSrc] = react.exports.useState(urlWithProtocol(url2));
182531
+ react.exports.useEffect(() => {
182532
+ setIframeSrc(urlWithProtocol(url2));
182533
+ }, [url2]);
182534
+ react.exports.useEffect(() => {
182535
+ }, [iframeRef]);
182536
+ const onEnterKey = (e2) => {
182537
+ var _a2, _b2;
182538
+ if (e2.keyCode !== 13)
182539
+ return;
182540
+ const url22 = urlWithProtocol(e2.target.value);
182541
+ setIframeSrc(url22);
182542
+ (_b2 = (_a2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b2.location.replace(url22);
182543
+ };
182544
+ const onRefresh = () => {
182545
+ var _a2, _b2;
182546
+ (_b2 = (_a2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b2.location.replace(iframeSrc);
182547
+ };
182548
+ const onOpenInNewTab = () => {
182549
+ window.open(iframeSrc);
182550
+ };
182551
+ react.exports.useEffect(() => {
182552
+ var _a2, _b2;
182553
+ if (playgroundStatus === "EMPTY")
182554
+ return;
182555
+ if (playgroundStatus === "ACTIVE" && dockerStatus === "RUNNING") {
182556
+ if (iframeSrc !== "http://" && iframeSrc !== "https://") {
182557
+ (_b2 = (_a2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b2.location.replace(iframeSrc);
182558
+ }
182559
+ }
182560
+ }, [playgroundStatus, dockerStatus]);
182561
+ return /* @__PURE__ */ jsxs(Fragment, {
182562
+ children: [/* @__PURE__ */ jsxs(NavBar, {
182563
+ children: [/* @__PURE__ */ jsx("i", {
182564
+ className: "d42 text-xl reload cursor-pointer",
182565
+ onClick: onRefresh
182566
+ }), /* @__PURE__ */ jsx("input", {
182567
+ type: "text",
182568
+ value: iframeSrc,
182569
+ onChange: (e2) => setIframeSrc(e2.target.value),
182570
+ onKeyDown: onEnterKey
182571
+ }), /* @__PURE__ */ jsx("i", {
182572
+ className: "d42 text-xl file-copy cursor-pointer",
182573
+ onClick: onOpenInNewTab
182574
+ })]
182575
+ }), dockerStatus === "STOP" && /* @__PURE__ */ jsx(StopMask, {
182576
+ children: /* @__PURE__ */ jsx("span", {
182577
+ children: "\u70B9\u51FB\u201C\u8FD0\u884C\u201D\uFF0C\u542F\u52A8\u5E94\u7528"
182578
+ })
182579
+ }), /* @__PURE__ */ jsx("iframe", {
182580
+ ref: iframeRef,
182581
+ src: iframeSrc,
182582
+ style: {
182583
+ width: "100%",
182584
+ height: "calc(100% - 30px)"
182585
+ }
182586
+ })]
182587
+ });
182588
+ };
182589
+ var index$2 = /* @__PURE__ */ Object.freeze({
182590
+ __proto__: null,
182591
+ [Symbol.toStringTag]: "Module",
182592
+ "default": OutputBrowser
182593
+ });
182594
+ const TerminalComponent = (_g2) => {
182595
+ var _h2 = _g2, {
182596
+ options
182597
+ } = _h2, props = __objRest(_h2, [
182598
+ "options"
182599
+ ]);
182329
182600
  const defaultOptions2 = __spreadValues({}, options);
182330
182601
  const userLabel = document.createElement("div");
182331
182602
  userLabel.classList.add("xterm-helper-user-label");
@@ -182365,15 +182636,15 @@ const TerminalComponent = (_c2) => {
182365
182636
  }
182366
182637
  }, []);
182367
182638
  react.exports.useEffect(() => {
182368
- var _a2, _b2, _c3, _d3;
182639
+ var _a2, _b2, _c2, _d2;
182369
182640
  if (!terminal)
182370
182641
  return;
182371
182642
  if (CRDTInfo.terminal) {
182372
- initTerminalText(terminal, ((_d3 = (_c3 = (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.CRDTInfo) == null ? void 0 : _b2.terminal) == null ? void 0 : _c3.doc) == null ? void 0 : _d3.value) || "");
182643
+ initTerminalText(terminal, ((_d2 = (_c2 = (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.CRDTInfo) == null ? void 0 : _b2.terminal) == null ? void 0 : _c2.doc) == null ? void 0 : _d2.value) || "");
182373
182644
  }
182374
182645
  }, [terminal]);
182375
182646
  react.exports.useEffect(() => {
182376
- var _a2, _b2, _c3;
182647
+ var _a2, _b2, _c2;
182377
182648
  const crdt = CRDTInfo.terminal;
182378
182649
  if (terminal && crdt) {
182379
182650
  if (((_a2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _a2.action) === "Get") {
@@ -182381,7 +182652,7 @@ const TerminalComponent = (_c2) => {
182381
182652
  return;
182382
182653
  }
182383
182654
  writeText(terminal, ((_b2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _b2.value) || "");
182384
- const postUser = userListStore.getState().userList[(_c3 = CRDTInfo == null ? void 0 : CRDTInfo.userInfo) == null ? void 0 : _c3.uuid];
182655
+ const postUser = userListStore.getState().userList[(_c2 = CRDTInfo == null ? void 0 : CRDTInfo.userInfo) == null ? void 0 : _c2.uuid];
182385
182656
  if (postUser && !IsMe(CRDTInfo.userInfo)) {
182386
182657
  const helperContainer = terminal._core._helperContainer;
182387
182658
  userLabel.innerText = postUser.name;
@@ -182428,12 +182699,12 @@ var index$1 = /* @__PURE__ */ Object.freeze({
182428
182699
  [Symbol.toStringTag]: "Module",
182429
182700
  "default": TerminalComponent
182430
182701
  });
182431
- const Tabs = (_e2) => {
182432
- var _f2 = _e2, {
182702
+ const Tabs = (_i) => {
182703
+ var _j = _i, {
182433
182704
  activeKey,
182434
182705
  onSelect,
182435
182706
  tabItems
182436
- } = _f2, props = __objRest(_f2, [
182707
+ } = _j, props = __objRest(_j, [
182437
182708
  "activeKey",
182438
182709
  "onSelect",
182439
182710
  "tabItems"
@@ -182751,10 +183022,10 @@ const AvatarLayout = newStyled.div`
182751
183022
  border-color: ${(props) => props.user.color};
182752
183023
  background-image: ${(props) => 'url("' + props.user.avatar + '")'};
182753
183024
  `;
182754
- const Avatar = (_g2) => {
182755
- var _h2 = _g2, {
183025
+ const Avatar = (_k) => {
183026
+ var _l = _k, {
182756
183027
  user
182757
- } = _h2, props = __objRest(_h2, [
183028
+ } = _l, props = __objRest(_l, [
182758
183029
  "user"
182759
183030
  ]);
182760
183031
  return /* @__PURE__ */ jsx(AvatarLayout, __spreadValues({
@@ -182763,8 +183034,8 @@ const Avatar = (_g2) => {
182763
183034
  }, props));
182764
183035
  };
182765
183036
  const SkeletonThemeContext = React.createContext({});
182766
- function SkeletonTheme(_i) {
182767
- var _j = _i, { children } = _j, styleOptions = __objRest(_j, ["children"]);
183037
+ function SkeletonTheme(_m) {
183038
+ var _n = _m, { children } = _n, styleOptions = __objRest(_n, ["children"]);
182768
183039
  return React.createElement(SkeletonThemeContext.Provider, { value: styleOptions }, children);
182769
183040
  }
182770
183041
  const defaultEnableAnimation = true;
@@ -182790,8 +183061,8 @@ function styleOptionsToCssProperties({ baseColor, highlightColor, width, height,
182790
183061
  style["--highlight-color"] = highlightColor;
182791
183062
  return style;
182792
183063
  }
182793
- function Skeleton$1(_k) {
182794
- var _l = _k, { count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp } = _l, propsStyleOptions = __objRest(_l, ["count", "wrapper", "className", "containerClassName", "containerTestId", "circle", "style"]);
183064
+ function Skeleton$1(_o) {
183065
+ var _p = _o, { count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp } = _p, propsStyleOptions = __objRest(_p, ["count", "wrapper", "className", "containerClassName", "containerTestId", "circle", "style"]);
182795
183066
  var _a2, _b2;
182796
183067
  const contextStyleOptions = React.useContext(SkeletonThemeContext);
182797
183068
  const styleOptions = __spreadProps(__spreadValues(__spreadValues({}, contextStyleOptions), propsStyleOptions), {
@@ -182842,87 +183113,6 @@ function Box({
182842
183113
  children
182843
183114
  });
182844
183115
  }
182845
- const Console = (_m) => {
182846
- var _n = _m, {
182847
- options
182848
- } = _n, props = __objRest(_n, [
182849
- "options"
182850
- ]);
182851
- const defaultOptions2 = __spreadValues({
182852
- convertEol: true,
182853
- fontSize: 12,
182854
- fontFamily: "Monaco, Menlo, monospace",
182855
- lineHeight: 1,
182856
- cursorBlink: true,
182857
- cursorWidth: 1,
182858
- cursorStyle: "block",
182859
- rightClickSelectsWord: true,
182860
- theme: {
182861
- background: "#1E1E1E"
182862
- }
182863
- }, options);
182864
- const [terminal, setTerminal] = react.exports.useState(null);
182865
- const {
182866
- CRDTInfo
182867
- } = oTStore((state) => state);
182868
- const {
182869
- dockerStatus
182870
- } = oTStore((state) => state);
182871
- const initTerminalText = (terminal2, text2) => {
182872
- terminal2.write("\r\n");
182873
- terminal2.clear();
182874
- writeText(terminal2, text2);
182875
- };
182876
- const writeText = (terminal2, text2) => {
182877
- terminal2.write(text2);
182878
- };
182879
- react.exports.useEffect(() => {
182880
- if (!terminal) {
182881
- const term = new xterm.exports.Terminal(defaultOptions2);
182882
- setTerminal(term);
182883
- }
182884
- }, []);
182885
- react.exports.useEffect(() => {
182886
- if (!terminal)
182887
- return;
182888
- if (dockerStatus === "STOP") {
182889
- initTerminalText(terminal, "\u5E94\u7528\u672A\u542F\u52A8\r\n");
182890
- } else {
182891
- initTerminalText(terminal, oTStore.getState().dockerInfo.consoleHistory);
182892
- }
182893
- }, [terminal]);
182894
- react.exports.useEffect(() => {
182895
- const crdt = CRDTInfo.console;
182896
- if (terminal && crdt) {
182897
- if (crdt.doc.value === "^C") {
182898
- writeText(terminal, crdt.doc.value);
182899
- initTerminalText(terminal, "");
182900
- return;
182901
- }
182902
- writeText(terminal, crdt.doc.value || "");
182903
- }
182904
- }, [CRDTInfo.console]);
182905
- react.exports.useEffect(() => {
182906
- if (!terminal)
182907
- return;
182908
- if (dockerStatus === "STOP") {
182909
- setTimeout(() => {
182910
- initTerminalText(terminal, "\u5E94\u7528\u672A\u542F\u52A8\r\n");
182911
- }, 400);
182912
- } else {
182913
- initTerminalText(terminal, "");
182914
- }
182915
- }, [dockerStatus]);
182916
- return /* @__PURE__ */ jsx("div", {
182917
- style: {
182918
- height: "100%",
182919
- width: "100%"
182920
- },
182921
- children: /* @__PURE__ */ jsx(XTerm, __spreadValues({
182922
- terminal
182923
- }, props))
182924
- });
182925
- };
182926
183116
  const ToolBarWrapper = newStyled.div`
182927
183117
  position: relative;
182928
183118
  display: flex;
@@ -182995,8 +183185,8 @@ const ButtonContent = ({
182995
183185
  })()
182996
183186
  });
182997
183187
  };
182998
- const ToolBar = (_o) => {
182999
- var props = __objRest(_o, []);
183188
+ const ToolBar = (_q) => {
183189
+ var props = __objRest(_q, []);
183000
183190
  const io = useOT((state) => state.socket);
183001
183191
  const pStatus = oTStore((state) => state.playgroundStatus);
183002
183192
  const dStatus = oTStore((state) => state.dockerStatus);
@@ -183062,140 +183252,6 @@ const ToolBar = (_o) => {
183062
183252
  })]
183063
183253
  });
183064
183254
  };
183065
- const PROTOCOL = "https://";
183066
- const NavBar = newStyled.div`
183067
- background-color: white;
183068
- height: 30px;
183069
- display: flex;
183070
- align-items: center;
183071
-
183072
- i {
183073
- margin: 0 10px;
183074
- width: 24px;
183075
- height: 24px;
183076
- border-radius: 50%;
183077
- display: flex;
183078
- justify-content: center;
183079
- align-items: center;
183080
-
183081
- &.disabled {
183082
- color: #f2fffe;
183083
- &:hover {
183084
- background-color: white;
183085
- }
183086
- }
183087
-
183088
- &:hover {
183089
- background-color: #e0e0e0;
183090
- }
183091
- }
183092
-
183093
- input {
183094
- flex: 1;
183095
- display: inline-block;
183096
- height: 26px;
183097
- line-height: 26px;
183098
- padding: 0 8px;
183099
- border: 1px solid #adacac;
183100
- border-radius: 5px;
183101
- }
183102
- `;
183103
- const StopMask = newStyled.div`
183104
- width: 100%;
183105
- height: calc(100% - 30px);
183106
- position: absolute;
183107
- display: flex;
183108
- justify-content: center;
183109
- align-items: center;
183110
- font-size: 18px;
183111
- color: #ffffff;
183112
- background-color: #5a5a5a;
183113
- opacity: 0.6;
183114
- `;
183115
- const OutputBrowser = (_p) => {
183116
- var _q = _p, {
183117
- url: url2
183118
- } = _q, props = __objRest(_q, [
183119
- "url"
183120
- ]);
183121
- const pStatus = oTStore((state) => state.playgroundStatus);
183122
- const dStatus = oTStore((state) => state.dockerStatus);
183123
- const [playgroundStatus, setPlaygroundStatus] = react.exports.useState("EMPTY");
183124
- const [dockerStatus, setDockerStatus] = react.exports.useState("STOP");
183125
- const urlWithProtocol = (url22) => {
183126
- if (!url22)
183127
- return `${PROTOCOL}showmebug.com`;
183128
- if (url22.indexOf("http://") !== 0 && url22.indexOf("https://") !== 0) {
183129
- url22 = `${PROTOCOL}${url22}`;
183130
- }
183131
- return url22;
183132
- };
183133
- react.exports.useEffect(() => {
183134
- setPlaygroundStatus(pStatus);
183135
- }, [pStatus]);
183136
- react.exports.useEffect(() => {
183137
- setDockerStatus(dStatus);
183138
- setTimeout(() => {
183139
- onRefresh();
183140
- }, 800);
183141
- }, [dStatus]);
183142
- const iframeRef = react.exports.useRef(null);
183143
- const [iframeSrc, setIframeSrc] = react.exports.useState(urlWithProtocol(url2));
183144
- react.exports.useEffect(() => {
183145
- setIframeSrc(urlWithProtocol(url2));
183146
- }, [url2]);
183147
- react.exports.useEffect(() => {
183148
- }, [iframeRef]);
183149
- const onEnterKey = (e2) => {
183150
- if (e2.keyCode !== 13)
183151
- return;
183152
- const url22 = urlWithProtocol(e2.target.value);
183153
- setIframeSrc(url22);
183154
- iframeRef.current.contentWindow.location.replace(url22);
183155
- };
183156
- const onRefresh = () => {
183157
- iframeRef.current.contentWindow.location.replace(iframeSrc);
183158
- };
183159
- const onOpenInNewTab = () => {
183160
- window.open(iframeSrc);
183161
- };
183162
- react.exports.useEffect(() => {
183163
- if (playgroundStatus === "EMPTY")
183164
- return;
183165
- if (playgroundStatus === "ACTIVE" && dockerStatus === "RUNNING") {
183166
- if (iframeSrc !== "http://" && iframeSrc !== "https://") {
183167
- iframeRef.current.contentWindow.location.replace(iframeSrc);
183168
- }
183169
- }
183170
- }, [playgroundStatus, dockerStatus]);
183171
- return /* @__PURE__ */ jsxs(Fragment, {
183172
- children: [/* @__PURE__ */ jsxs(NavBar, {
183173
- children: [/* @__PURE__ */ jsx("i", {
183174
- className: "d42 text-xl reload cursor-pointer",
183175
- onClick: onRefresh
183176
- }), /* @__PURE__ */ jsx("input", {
183177
- type: "text",
183178
- value: iframeSrc,
183179
- onChange: (e2) => setIframeSrc(e2.target.value),
183180
- onKeyDown: onEnterKey
183181
- }), /* @__PURE__ */ jsx("i", {
183182
- className: "d42 text-xl file-copy cursor-pointer",
183183
- onClick: onOpenInNewTab
183184
- })]
183185
- }), dockerStatus === "STOP" && /* @__PURE__ */ jsx(StopMask, {
183186
- children: /* @__PURE__ */ jsx("span", {
183187
- children: "\u70B9\u51FB\u201C\u8FD0\u884C\u201D\uFF0C\u542F\u52A8\u5E94\u7528"
183188
- })
183189
- }), /* @__PURE__ */ jsx("iframe", {
183190
- ref: iframeRef,
183191
- src: iframeSrc,
183192
- style: {
183193
- width: "100%",
183194
- height: "calc(100% - 30px)"
183195
- }
183196
- })]
183197
- });
183198
- };
183199
183255
  var loglevel = { exports: {} };
183200
183256
  (function(module2) {
183201
183257
  (function(root2, definition) {
@@ -232609,6 +232665,7 @@ const Index = (props) => {
232609
232665
  };
232610
232666
  const isFolded = useIndexState.getState().isFolded;
232611
232667
  const playgroundInfo = oTStore((state) => state.playgroundInfo);
232668
+ const dockerInfo = oTStore((state) => state.dockerInfo);
232612
232669
  const [active, setActive] = react.exports.useState("shell");
232613
232670
  const [url2, setUrl] = react.exports.useState(playgroundInfo.url);
232614
232671
  const {
@@ -232647,7 +232704,7 @@ const Index = (props) => {
232647
232704
  children: [/* @__PURE__ */ jsx(SliderComponent, {}), /* @__PURE__ */ jsx(TreeComponent, {})]
232648
232705
  }), /* @__PURE__ */ jsx("section", {
232649
232706
  className: "bg-codezone-black rounded-sm mx-3.5 flex-1 flex flex-col",
232650
- children: playgroundInfo.dockerId ? /* @__PURE__ */ jsx(react.exports.Suspense, {
232707
+ children: dockerInfo.dockerId ? /* @__PURE__ */ jsx(react.exports.Suspense, {
232651
232708
  fallback: /* @__PURE__ */ jsx(Skeleton, {
232652
232709
  count: 10
232653
232710
  }),