@alicloud/console-os-browser-vm 1.4.40-alpha.0 → 1.4.41-beta.1

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/es/Context.js CHANGED
@@ -38,21 +38,21 @@ var Context = /*#__PURE__*/function () {
38
38
  value: function () {
39
39
  var _loadScripts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, script) {
40
40
  var resp, code;
41
- return _regeneratorRuntime.wrap(function _callee$(_context) {
41
+ return _regeneratorRuntime.wrap(function (_context) {
42
42
  while (1) switch (_context.prev = _context.next) {
43
43
  case 0:
44
- _context.next = 2;
44
+ _context.next = 1;
45
45
  return fetch(url, {
46
46
  credentials: getFetchCredentials(url)
47
47
  });
48
- case 2:
48
+ case 1:
49
49
  resp = _context.sent;
50
- _context.next = 5;
50
+ _context.next = 2;
51
51
  return resp.text();
52
- case 5:
52
+ case 2:
53
53
  code = _context.sent;
54
54
  this.evalScript(code, url, script);
55
- case 7:
55
+ case 3:
56
56
  case "end":
57
57
  return _context.stop();
58
58
  }
@@ -126,7 +126,7 @@ var Context = /*#__PURE__*/function () {
126
126
  key: "remove",
127
127
  value: function () {
128
128
  var _remove = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(context) {
129
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
129
+ return _regeneratorRuntime.wrap(function (_context2) {
130
130
  while (1) switch (_context2.prev = _context2.next) {
131
131
  case 0:
132
132
  if (context.remove) {
package/es/Elements.js CHANGED
@@ -55,7 +55,12 @@ if (!isSSR() && typeof window.Element === 'function') {
55
55
  var mountElementMethods = ['appendChild', 'insertBefore', 'append'];
56
56
  for (var _i = 0, _mountElementMethods = mountElementMethods; _i < _mountElementMethods.length; _i++) {
57
57
  var method = _mountElementMethods[_i];
58
- var originMethod = window.Element.prototype[method];
59
- window.Element.prototype[method] = makeElInjector(originMethod, method);
58
+ var originMethod = window.HTMLHeadElement.prototype[method];
59
+ window.HTMLHeadElement.prototype[method] = makeElInjector(originMethod, method);
60
+ }
61
+ for (var _i2 = 0, _mountElementMethods2 = mountElementMethods; _i2 < _mountElementMethods2.length; _i2++) {
62
+ var _method = _mountElementMethods2[_i2];
63
+ var _originMethod = window.Element.prototype[_method];
64
+ window.Element.prototype[_method] = makeElInjector(_originMethod, _method);
60
65
  }
61
66
  }
package/es/index.js CHANGED
@@ -16,15 +16,15 @@ export var createContext = /*#__PURE__*/function () {
16
16
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
17
17
  var conf,
18
18
  _args = arguments;
19
- return _regeneratorRuntime.wrap(function _callee$(_context) {
19
+ return _regeneratorRuntime.wrap(function (_context) {
20
20
  while (1) switch (_context.prev = _context.next) {
21
21
  case 0:
22
22
  conf = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
23
- _context.next = 3;
23
+ _context.next = 1;
24
24
  return Context.create(conf);
25
- case 3:
25
+ case 1:
26
26
  return _context.abrupt("return", _context.sent);
27
- case 4:
27
+ case 2:
28
28
  case "end":
29
29
  return _context.stop();
30
30
  }
@@ -36,14 +36,14 @@ export var createContext = /*#__PURE__*/function () {
36
36
  }();
37
37
  export var removeContext = /*#__PURE__*/function () {
38
38
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(context) {
39
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
39
+ return _regeneratorRuntime.wrap(function (_context2) {
40
40
  while (1) switch (_context2.prev = _context2.next) {
41
41
  case 0:
42
- _context2.next = 2;
42
+ _context2.next = 1;
43
43
  return Context.remove(context);
44
- case 2:
44
+ case 1:
45
45
  return _context2.abrupt("return", _context2.sent);
46
- case 3:
46
+ case 2:
47
47
  case "end":
48
48
  return _context2.stop();
49
49
  }
@@ -59,18 +59,18 @@ export var evalScripts = /*#__PURE__*/function () {
59
59
  ctx,
60
60
  resolver,
61
61
  _args3 = arguments;
62
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
62
+ return _regeneratorRuntime.wrap(function (_context3) {
63
63
  while (1) switch (_context3.prev = _context3.next) {
64
64
  case 0:
65
65
  conf = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
66
- _context3.next = 3;
66
+ _context3.next = 1;
67
67
  return Context.create(conf);
68
- case 3:
68
+ case 1:
69
69
  ctx = _context3.sent;
70
70
  // eslint-disable-next-line no-new-func
71
71
  resolver = new Function("\n return function({window, location, history, document}){ \n with(window.__CONSOLE_OS_GLOBAL_VARS_) { \n ".concat(code, "\n }\n }//@sourceURL=").concat(conf.name));
72
72
  return _context3.abrupt("return", resolver(_objectSpread({}, ctx)));
73
- case 6:
73
+ case 2:
74
74
  case "end":
75
75
  return _context3.stop();
76
76
  }
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface ContextOption {
16
16
  url?: string;
17
17
  id?: string;
18
18
  disableBody?: boolean;
19
- allowResources?: string[];
19
+ allowResources?: string[] | '*';
20
20
  enableScriptEscape?: boolean;
21
21
  }
22
22
 
package/lib/Context.js CHANGED
@@ -45,21 +45,21 @@ var Context = /*#__PURE__*/function () {
45
45
  value: function () {
46
46
  var _loadScripts = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(url, script) {
47
47
  var resp, code;
48
- return _regenerator.default.wrap(function _callee$(_context) {
48
+ return _regenerator.default.wrap(function (_context) {
49
49
  while (1) switch (_context.prev = _context.next) {
50
50
  case 0:
51
- _context.next = 2;
51
+ _context.next = 1;
52
52
  return fetch(url, {
53
53
  credentials: (0, _credentials.getFetchCredentials)(url)
54
54
  });
55
- case 2:
55
+ case 1:
56
56
  resp = _context.sent;
57
- _context.next = 5;
57
+ _context.next = 2;
58
58
  return resp.text();
59
- case 5:
59
+ case 2:
60
60
  code = _context.sent;
61
61
  this.evalScript(code, url, script);
62
- case 7:
62
+ case 3:
63
63
  case "end":
64
64
  return _context.stop();
65
65
  }
@@ -133,7 +133,7 @@ var Context = /*#__PURE__*/function () {
133
133
  key: "remove",
134
134
  value: function () {
135
135
  var _remove = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(context) {
136
- return _regenerator.default.wrap(function _callee2$(_context2) {
136
+ return _regenerator.default.wrap(function (_context2) {
137
137
  while (1) switch (_context2.prev = _context2.next) {
138
138
  case 0:
139
139
  if (context.remove) {
package/lib/Elements.js CHANGED
@@ -5,8 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
6
6
  var _injectScriptCallBack = _interopRequireWildcard(require("./utils/injectScriptCallBack"));
7
7
  var _isSSR = require("./utils/isSSR");
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
10
9
  var makeElInjector = function makeElInjector(originMethod, methodName) {
11
10
  return function (el) {
12
11
  var notAllowed = el && el.ownerContext && el.ownerContext.allowResources.indexOf(el.src) === -1 && el.ownerContext.allowResources !== '*';
@@ -61,7 +60,12 @@ if (!(0, _isSSR.isSSR)() && typeof window.Element === 'function') {
61
60
  var mountElementMethods = ['appendChild', 'insertBefore', 'append'];
62
61
  for (var _i = 0, _mountElementMethods = mountElementMethods; _i < _mountElementMethods.length; _i++) {
63
62
  var method = _mountElementMethods[_i];
64
- var originMethod = window.Element.prototype[method];
65
- window.Element.prototype[method] = makeElInjector(originMethod, method);
63
+ var originMethod = window.HTMLHeadElement.prototype[method];
64
+ window.HTMLHeadElement.prototype[method] = makeElInjector(originMethod, method);
65
+ }
66
+ for (var _i2 = 0, _mountElementMethods2 = mountElementMethods; _i2 < _mountElementMethods2.length; _i2++) {
67
+ var _method = _mountElementMethods2[_i2];
68
+ var _originMethod = window.Element.prototype[_method];
69
+ window.Element.prototype[_method] = makeElInjector(_originMethod, _method);
66
70
  }
67
71
  }
package/lib/index.js CHANGED
@@ -21,15 +21,15 @@ var createContext = exports.createContext = /*#__PURE__*/function () {
21
21
  var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
22
22
  var conf,
23
23
  _args = arguments;
24
- return _regenerator.default.wrap(function _callee$(_context) {
24
+ return _regenerator.default.wrap(function (_context) {
25
25
  while (1) switch (_context.prev = _context.next) {
26
26
  case 0:
27
27
  conf = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
28
- _context.next = 3;
28
+ _context.next = 1;
29
29
  return _Context.default.create(conf);
30
- case 3:
30
+ case 1:
31
31
  return _context.abrupt("return", _context.sent);
32
- case 4:
32
+ case 2:
33
33
  case "end":
34
34
  return _context.stop();
35
35
  }
@@ -41,14 +41,14 @@ var createContext = exports.createContext = /*#__PURE__*/function () {
41
41
  }();
42
42
  var removeContext = exports.removeContext = /*#__PURE__*/function () {
43
43
  var _ref2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(context) {
44
- return _regenerator.default.wrap(function _callee2$(_context2) {
44
+ return _regenerator.default.wrap(function (_context2) {
45
45
  while (1) switch (_context2.prev = _context2.next) {
46
46
  case 0:
47
- _context2.next = 2;
47
+ _context2.next = 1;
48
48
  return _Context.default.remove(context);
49
- case 2:
49
+ case 1:
50
50
  return _context2.abrupt("return", _context2.sent);
51
- case 3:
51
+ case 2:
52
52
  case "end":
53
53
  return _context2.stop();
54
54
  }
@@ -64,18 +64,18 @@ var evalScripts = exports.evalScripts = /*#__PURE__*/function () {
64
64
  ctx,
65
65
  resolver,
66
66
  _args3 = arguments;
67
- return _regenerator.default.wrap(function _callee3$(_context3) {
67
+ return _regenerator.default.wrap(function (_context3) {
68
68
  while (1) switch (_context3.prev = _context3.next) {
69
69
  case 0:
70
70
  conf = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
71
- _context3.next = 3;
71
+ _context3.next = 1;
72
72
  return _Context.default.create(conf);
73
- case 3:
73
+ case 1:
74
74
  ctx = _context3.sent;
75
75
  // eslint-disable-next-line no-new-func
76
76
  resolver = new Function("\n return function({window, location, history, document}){ \n with(window.__CONSOLE_OS_GLOBAL_VARS_) { \n ".concat(code, "\n }\n }//@sourceURL=").concat(conf.name));
77
77
  return _context3.abrupt("return", resolver(_objectSpread({}, ctx)));
78
- case 6:
78
+ case 2:
79
79
  case "end":
80
80
  return _context3.stop();
81
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/console-os-browser-vm",
3
- "version": "1.4.40-alpha.0",
3
+ "version": "1.4.41-beta.1",
4
4
  "description": "browser virtual machine",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -24,6 +24,7 @@
24
24
  "@babel/runtime": "^7.24.1"
25
25
  },
26
26
  "scripts": {
27
+ "build": "npm run clean && npm run babel && npm run babel:esm",
27
28
  "babel": "breezr build --engine babel",
28
29
  "babel:esm": "breezr build --engine babel --es-module",
29
30
  "storybook": "breezr start-storybook",
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.aliOSBrowserVM=e():t.aliOSBrowserVM=e()}(window,function(){return n=[function(t,e,n){n=n(2)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e,n){t.exports=n(4)},function(P,t,e){var k=e(3).default;function n(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */P.exports=function(){return a},P.exports.__esModule=!0,P.exports.default=P.exports;var u,a={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o,i,a,c,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new L(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,c=p,function(t,e){if(c===h)throw Error("Generator is already running");if(c===y){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(o===u)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=u,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=u),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===p)throw c=y,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=h;n=f(o,i,a);if("normal"===n.type){if(c=a.done?y:d,n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(c=y,a.method="throw",a.arg=n.arg)}})}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",m={};function v(){}function w(){}function b(){}var e={},g=(i(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(j([]))),x=(g&&g!==t&&s.call(g,r)&&(e=g),b.prototype=v.prototype=Object.create(e));function O(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function _(a,c){var e;l(this,"_invoke",{value:function(n,r){function t(){return new c(function(t,e){!function e(t,n,r,o){var i,t=f(a[t],a,n);if("throw"!==t.type)return i=t.arg,n=i.value,n&&"object"==k(n)&&s.call(n,"__await")?c.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):c.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function j(e){if(e||""===e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,t=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t},t.next=t}throw new TypeError(k(e)+" is not iterable")}return w.prototype=b,l(x,"constructor",{value:b,configurable:!0}),l(b,"constructor",{value:w,configurable:!0}),w.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,i(t,o,"GeneratorFunction")),t.prototype=Object.create(x),t},a.awrap=function(t){return{__await:t}},O(_.prototype),i(_.prototype,n,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,n,r,o){void 0===o&&(o=Promise);var i=new _(c(t,e,n,r),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(x),i(x,o,"Generator"),i(x,r,function(){return this}),i(x,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=j,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return i.type="throw",i.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,o=this.tryEntries[e];if(o.tryLoc===t)return n=o.completion,"throw"===n.type&&(r=n.arg,E(o)),r}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:j(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),m}},a}P.exports=n,P.exports.__esModule=!0,P.exports.default=P.exports},function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(R,t,e){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t){t=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if(n=n.call(t,e||"default"),"object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==r(t)?t:t+""}function a(t,e,n){e=o(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}function u(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function i(c){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=c.apply(t,a);function o(t){u(r,e,n,o,i,"next",t)}function i(t){u(r,e,n,o,i,"throw",t)}o(void 0)})}}e.r(t),e.d(t,"createContext",function(){return W}),e.d(t,"removeContext",function(){return U}),e.d(t,"evalScripts",function(){return V});var t=e(0),c=e.n(t);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var n;if(t)return"string"==typeof t?s(t,e):(n=Object.prototype.toString.call(t).slice(8,-1),"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){var e;try{e=new URL(t)}catch(t){return}return t=e.searchParams,t?t.get("callback")||t.get("cb"):null}function n(){return"undefined"==typeof document}var p=function(t){setTimeout(function(){var e,n;t.src&&(e=t.ownerContext.window,n=f(t.src),n)&&"function"==typeof e[n]&&(window[n]=function(){var t=e[n].apply(e,arguments);return window[n]=null,t})},0)};if(!n()&&"function"==typeof window.Element)for(var d=0,h=["appendChild","insertBefore","append"];d<h.length;d++){var y=h[d],m=window.Element.prototype[y];window.Element.prototype[y]=function(i,a){return function(n){var e=n&&n.ownerContext&&-1===n.ownerContext.allowResources.indexOf(n.src)&&"*"!==n.ownerContext.allowResources;if(n&&n._evalScriptInSandbox&&n.ownerContext&&"SCRIPT"===n.nodeName&&n.src&&e&&!f(n.src))return n.ownerContext.loadScripts(n.src).then(function(){var t=n._listenerMap.get("load"),t=(t&&t.forEach(function(t){t()}),new Event("load"));n.onload&&n.onload(t)}).catch(function(e){console.error(e,n.src);var t=n._listenerMap.get("error");t&&t.forEach(function(t){t(e)}),n.onerror&&n.onerror(e)});n&&"SCRIPT"===n.nodeName&&n.ownerContext&&p(n),n&&n.scriptText&&n.ownerContext.evalScript(n.scriptText);for(var t=arguments.length,r=new Array(1<t?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e=("append"===a&&void 0===n?[]:[n]).concat(r);try{return i.call.apply(i,[this].concat(l(e)))}catch(t){return i.apply(this,e)}}}(m,y)}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function b(t,e,n){return e&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var g=n()?function(){}:window.addEventListener,x=n()?function(){}:window.removeEventListener,O=["webkitmouseforcedown","webkitmouseforcewillbegin","visibilitychange","error","mousemove","mousedown","mouseup","touchcancel","touchend","touchstart","auxclick","dblclick","pointercancel","pointerdown","pointerup","dragend","dragstart","drop","compositionend","compositionstart","keydown","keypress","keyup","input","textInput","close","cancel","copy","cut","paste","click","change","contextmenu","reset","submit","resize","scroll","foucs","blur"];function _(t){t=t.prototype&&t.prototype.constructor===t&&1<Object.getOwnPropertyNames(t.prototype).length||/^class\b/.test(t.toString());return t}function S(t){t=0===t.name.indexOf("bound ")&&!t.hasOwnProperty("prototype");return t}var E=["setTimeout","setInterval","clearInterval","clearTimeout"],L=["location","history"],j=["requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame","cancelAnimationFrame","webkitCancelAnimationFrame","mozCancelAnimationFrame","oCancelAnimationFrame","msCancelAnimationFrame","matchMedia","getSelection","open"];function P(e){var o,i,a,c;e._listenerMap=new Map,e.addEventListener=(o=e,i=e.addEventListener,function(t,e,n){var r=o._listenerMap.get(t)||[];return o._listenerMap.set(t,[].concat(l(r),[e])),i.apply(o,[t,e,n])}),e.removeEventListener=(a=e,c=e.removeEventListener,function(t,e,n){var r=a._listenerMap.get(t);return r&&r.length&&-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),c.apply(a,[t,e,n])}),e._evalScriptInSandbox||(A.forEach(function(t){Object.defineProperty(e,t,{get:function(){return this.scriptText||""},set:function(t){this.scriptText=t,e.parentNode&&this.ownerContext.evalScript&&e.ownerContext.evalScript(t.toString())},enumerable:!1})}),e._evalScriptInSandbox=!0)}var e=b(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=1<arguments.length?arguments[1]:void 0,n=2<arguments.length?arguments[2]:void 0,u=(v(this,t),[].concat(j,l(e.externals||[]))),s={};return E.forEach(function(t){u.includes(t)||(s[t]=n.contentWindow[t].bind(n.contentWindow))}),L.forEach(function(t){u.includes(t)&&(s[t]=window[t])}),new Proxy(n.contentWindow,{set:function(t,e,n){return t[e]=n,s[e]=n,!0},get:function(t,e){if(u.includes(e)){var n=window[e];if("function"!=typeof n||S(n)||_(n))return n;var r,o=n.bind(window);for(r in n)o[r]=n[r];return o}switch(e){case"document":return c.document;case"location":return c.location;case"history":return c.history;case"__CONSOLE_OS_GLOBAL_VARS_":return s;case"addEventListener":return a=c,function(t,e,n){var r=a._listenerMap.get(t)||[];return a._listenerMap.set(t,[].concat(l(r),[e])),-1===O.indexOf(t)?a.baseFrame.addEventListener.apply(a.baseFrame.contentWindow,[t,e,n]):g.apply(window,[t,e,n])};case"removeEventListener":return i=c,function(t,e,n){var r=i._listenerMap.get(t);return r&&r.length&&-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),-1===O.indexOf(t)?i.baseFrame.removeEventListener.apply(i.baseFrame.contentWindow,[t,e,n]):x.apply(window,[t,e,n])}}var i,a;return s[e]||(e=t[e],"function"!=typeof e||S(e)||_(e)?e:e.bind&&e.bind(t))}})}),k=e,A=["innerHTML","text","innerText"],t=b(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,o=(v(this,t),[]);return new Proxy(document,{set:function(t,e,n){return"cookie"===e?document.cookie=n:t[e]=n,!0},get:function(r,t){switch(t){case"body":return n.body;case"location":return n.location;case"defaultView":return n.window;case"write":case"writeln":return function(){};case"createElement":return function(){var t=(t=document).createElement.apply(t,arguments);return t.ownerContext=n,t.appId=e.id,"SCRIPT"!==t.tagName||e.enableScriptEscape||P(t),t};case"addEventListener":return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return o.push(e),r.addEventListener.apply(r,e)};case"removeEventListeners":return function(){for(var t=0,e=o;t<e.length;t++){var n=e[t];r.removeEventListener.apply(r,l(n))}}}return"function"==typeof r[t]?r[t].bind&&r[t].bind(r):r[t]}})}),I=t;function C(t){return t&&"about:blank"===t.href}var e=b(function t(r){return v(this,t),new Proxy({},{set:function(t,e,n){return"href"!==e&&(r[e]=n),!0},get:function(t,e){switch(e){case"reload":return function(){return window.location.reload()};case"replace":return function(){};case"toString":return function(){try{return(C(r)?window.location:r).toString()}catch(t){return(C(r)?window.location:r).href}}}return"function"==typeof r[e]?r[e].bind&&r[e].bind(t):(C(r)?window.location:r)[e]}})}),G=e,t=b(function t(e,o){if(v(this,t),!e)return o.history;function i(){o.postMessage({type:"".concat(e,":history-change"),data:JSON.parse(JSON.stringify(o.location))},"*")}try{var a=o.history.pushState,c=o.history.replaceState;return o.history.pushState=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=a.apply(o.history,[].concat(e));return i(),r},o.history.replaceState=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=c.apply(o.history,[].concat(e));return i(),r},o.history}catch(t){}}),B=t;function D(t){return t.includes("console.aliyun.com")||t.includes("console.alibabacloud.com")||function(t,e){try{var n=new URL(t);return n.origin===e}catch(t){}try{var r=new URL(t,e);return r.origin===e}catch(t){}}(t,location&&location.origin)?"include":"omit"}function T(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var e=function(){function o(t,e){v(this,o),this.location=new G(e.contentWindow.location),this.history=new B(t.id,e.contentWindow),this.window=new k(t,this,e,location),this.allowResources=t.allowResources||[];var n=t.body,r=t.disableBody;r?n=document.body:n||(n=document.createElement("body"),document.documentElement.appendChild(n)),this.body=n,this.document=new I(F({enableScriptEscape:!0},t),this,e,location),this.baseFrame=e,this._listenerMap=new Map,this.window.__IS_CONSOLE_OS_CONTEXT__=!0}var e,n;return b(o,[{key:"loadScripts",value:(n=i(c.a.mark(function t(e){var n;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e,{credentials:D(e)});case 2:return n=t.sent,t.next=5,n.text();case 5:n=t.sent,this.evalScript(n,e);case 7:case"end":return t.stop()}},t,this)})),function(t){return n.apply(this,arguments)})},{key:"evalScript",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=this.document.createElement("script"),t=(n.src=e,new Function('\n return function ({window, location, history, document, __os_current_script__}){\n var document = new Proxy(document, {\n get: function get(target, prop) {\n if (prop === "currentScript" && __os_current_script__) {\n return __os_current_script__;\n }\n return target[prop];\n }\n });\n var window = new Proxy(window, {\n get: function get(target, prop) {\n if (prop === "document") return document;\n return target[prop];\n }\n })\n var globalThis = window;\n with(window.__CONSOLE_OS_GLOBAL_VARS_) {\n try {\n '.concat(t,"\n } catch(e) {\n console.log(e)\n }\n }\n }//# sourceMappingURL=").concat(e)));t().call(this.window,F(F({},this),{},{__os_current_script__:n}))}},{key:"updateBody",value:function(t){!t&&this.body||(this.body=t)}},{key:"remove",value:function(){this.document.removeEventListeners(),this.baseFrame&&(this.baseFrame.parentNode?this.baseFrame.parentNode.removeChild(this.baseFrame):this.baseFrame.setAttribute("src","about:blank"))}}],[{key:"create",value:function(r){var o=this;return new Promise(function(t){var e=document.createElement("iframe"),n=(e.setAttribute("src",r.url||"/api.json"),e.style.cssText="position: absolute; top: -20000px; width: 1px; height: 1px;",r.id&&e.setAttribute("data-id",r.id),(null==(n=document.documentElement)?void 0:n.getElementsByTagName("body")[0])||document.body);if(n.appendChild(e),"about:blank"===r.url)return t(new o(r,e));e.onload=function(){t(new o(r,e))}})}},{key:"remove",value:(e=i(c.a.mark(function t(e){return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.remove&&e.remove();case 1:case"end":return t.stop()}},t)})),function(t){return e.apply(this,arguments)})}]),o}(),M=e;function N(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}var W=function(){var t=i(c.a.mark(function t(){var e,n=arguments;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=0<n.length&&void 0!==n[0]?n[0]:{},t.next=3,M.create(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),U=function(){var e=i(c.a.mark(function t(e){return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,M.remove(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=i(c.a.mark(function t(e){var n,r,o,i=arguments;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=1<i.length&&void 0!==i[1]?i[1]:{},t.next=3,M.create(n);case 3:return r=t.sent,o=new Function("\n return function({window, location, history, document}){ \n with(window.__CONSOLE_OS_GLOBAL_VARS_) { \n ".concat(e,"\n }\n }//@sourceURL=").concat(n.name)),t.abrupt("return",o(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},r)));case 6:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}()}],r={},o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=1);function o(t){var e;return(r[t]||(e=r[t]={i:t,l:!1,exports:{}},n[t].call(e.exports,e,e.exports,o),e.l=!0,e)).exports}var n,r});