@alifd/adaptor-render
Advanced tools
Comparing version 0.1.11 to 0.2.1
@@ -33,3 +33,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread"; | ||
themeId = _this$props.themeId; | ||
render(node.adaptor, node.props, themeId).then(onDragStart); | ||
return render(node.adaptor, node.props, themeId).then(onDragStart); | ||
}; | ||
@@ -39,4 +39,4 @@ | ||
scale: 1, | ||
rect: {}, | ||
loaded: false | ||
loaded: false, | ||
error: false | ||
}; | ||
@@ -47,2 +47,8 @@ return _this; | ||
_createClass(Demo, [{ | ||
key: "componentDidCatch", | ||
value: function componentDidCatch(error, info) { | ||
// You can also log the error to an error reporting service | ||
this.props.onError(error, info); | ||
} | ||
}, { | ||
key: "componentDidMount", | ||
@@ -57,3 +63,2 @@ value: function componentDidMount() { | ||
var scale = 1; | ||
var rect = {}; | ||
@@ -65,14 +70,5 @@ if (this.demo) { | ||
var _node$getBoundingClie = node.getBoundingClientRect(), | ||
width = _node$getBoundingClie.width, | ||
height = _node$getBoundingClie.height; | ||
if (scale > 1) { | ||
scale = 1; | ||
} | ||
rect = { | ||
width: width * scale, | ||
height: height * scale | ||
}; | ||
} | ||
@@ -82,4 +78,3 @@ | ||
loaded: true, | ||
scale: scale, | ||
rect: rect | ||
scale: scale | ||
}, function () { | ||
@@ -100,5 +95,10 @@ onLoad(); | ||
loaded = _this$state.loaded, | ||
rect = _this$state.rect; | ||
error = _this$state.error; | ||
var demoNode = renderAdaptor(node.adaptor, node.props || {}, themeId); | ||
if (!demoNode) return null; | ||
if (error) { | ||
return React.createElement("div", null, " This demo is running incorrectly, please contact the developer "); | ||
} | ||
var imgStyle = { | ||
@@ -109,4 +109,4 @@ opacity: 0, | ||
left: '10px', | ||
width: rect.width, | ||
height: height ? height * scale - 20 : rect.height, | ||
width: '100%', | ||
height: 'calc(100% - 20px)', | ||
cursor: 'pointer', | ||
@@ -144,2 +144,10 @@ zIndex: 1 | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromError", | ||
value: function getDerivedStateFromError() { | ||
// Update state so the next render will show the fallback UI. | ||
return { | ||
error: true | ||
}; | ||
} | ||
}]); | ||
@@ -157,4 +165,5 @@ | ||
onLoad: function onLoad() {}, | ||
onError: function onError() {}, | ||
onDragStart: function onDragStart() {} | ||
}; | ||
export { Demo as default }; |
@@ -13,2 +13,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
onLoad = _ref.onLoad, | ||
onError = _ref.onError, | ||
themeId = _ref.themeId; | ||
@@ -54,2 +55,3 @@ var index = 0; | ||
onDragStart: onDragStart, | ||
onError: onError, | ||
themeId: themeId, | ||
@@ -86,3 +88,3 @@ onLoad: handleLoad | ||
_context.next = 6; | ||
return new Promise(function (resolve) { | ||
return new Promise(function (resolve, reject) { | ||
ReactDOM.render(React.createElement(DemoView, { | ||
@@ -92,2 +94,3 @@ components: components, | ||
onDragStart: onDragStart, | ||
onError: reject, | ||
onLoad: function onLoad() { | ||
@@ -94,0 +97,0 @@ return resolve(); |
@@ -0,2 +1,4 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ErrorBoundary from './ErrorBoundary'; | ||
import { renderAdaptor } from '../utils'; | ||
@@ -24,6 +26,17 @@ | ||
export default (function (name, props, themeId) { | ||
var node = renderAdaptor(name, props, themeId); | ||
var mountNode = createMountedNode(); | ||
return new Promise(function (resolve) { | ||
ReactDOM.render(node, mountNode, function () { | ||
var RenderComponent = function RenderComponent(_ref) { | ||
var onError = _ref.onError; | ||
var node = renderAdaptor(name, props, themeId); | ||
return React.createElement(ErrorBoundary, { | ||
onError: onError | ||
}, node); | ||
}; | ||
return new Promise(function (resolve, reject) { | ||
ReactDOM.render(React.createElement(RenderComponent, { | ||
onError: reject | ||
}), mountNode, function () { | ||
if (!!mountNode.querySelector('.__error__')) return; | ||
resolve(mountNode.firstElementChild); | ||
@@ -30,0 +43,0 @@ }); |
{ | ||
"name": "@alifd/adaptor-render", | ||
"version": "0.1.11", | ||
"version": "0.2.1", | ||
"main": "umd/react/adaptor-render.development.js", | ||
@@ -5,0 +5,0 @@ "unpkg": "umd/react/adaptor-render.production.min.js", |
@@ -15,2 +15,3 @@ import React, { Component } from 'react'; | ||
onLoad: PropTypes.func, | ||
onError: PropTypes.func, | ||
onDragStart: PropTypes.func, | ||
@@ -23,2 +24,3 @@ } | ||
onLoad: () => {}, | ||
onError: () => {}, | ||
onDragStart: () => {}, | ||
@@ -31,7 +33,18 @@ } | ||
scale: 1, | ||
rect: {}, | ||
loaded: false, | ||
error: false, | ||
} | ||
} | ||
static getDerivedStateFromError() { | ||
// Update state so the next render will show the fallback UI. | ||
return { error: true }; | ||
} | ||
componentDidCatch(error, info) { | ||
// You can also log the error to an error reporting service | ||
this.props.onError(error, info); | ||
} | ||
componentDidMount() { | ||
@@ -47,3 +60,3 @@ this.computeScale(); | ||
const { onDragStart, node, themeId } = this.props; | ||
render(node.adaptor, node.props, themeId).then(onDragStart); | ||
return render(node.adaptor, node.props, themeId).then(onDragStart); | ||
} | ||
@@ -54,3 +67,2 @@ | ||
let scale = 1; | ||
let rect = {}; | ||
if (this.demo) { | ||
@@ -60,3 +72,2 @@ const demoNode = ReactDOM.findDOMNode(this.demo); | ||
scale = (demoNode.offsetWidth - 20) / node.offsetWidth; | ||
const { width, height } = node.getBoundingClientRect(); | ||
@@ -66,6 +77,2 @@ if (scale > 1) { | ||
} | ||
rect = { | ||
width: width * scale, | ||
height: height * scale, | ||
}; | ||
} | ||
@@ -78,3 +85,2 @@ | ||
scale, | ||
rect, | ||
}, () => { | ||
@@ -87,3 +93,3 @@ onLoad(); | ||
const { background, height, node, themeId } = this.props; | ||
const { scale, loaded, rect } = this.state; | ||
const { scale, loaded, error } = this.state; | ||
const demoNode = renderAdaptor(node.adaptor, node.props || {}, themeId); | ||
@@ -93,2 +99,6 @@ | ||
if (error) { | ||
return <div> This demo is running incorrectly, please contact the developer </div>; | ||
} | ||
const imgStyle = { | ||
@@ -99,4 +109,4 @@ opacity: 0, | ||
left: '10px', | ||
width: rect.width, | ||
height: height ? height * scale - 20 : rect.height, | ||
width: '100%', | ||
height: 'calc(100% - 20px)', | ||
cursor: 'pointer', | ||
@@ -103,0 +113,0 @@ zIndex: 1, |
@@ -7,3 +7,3 @@ import React from 'react'; | ||
const DemoView = ({ components, onDragStart, onLoad, themeId }) => { | ||
const DemoView = ({ components, onDragStart, onLoad, onError, themeId }) => { | ||
let index = 0; | ||
@@ -42,3 +42,3 @@ let count = 0; | ||
{ | ||
demos.map(demo => <Demo key={demo.id} onDragStart={onDragStart} themeId={themeId} onLoad={handleLoad} {...demo} />) | ||
demos.map(demo => <Demo key={demo.id} onDragStart={onDragStart} onError={onError} themeId={themeId} onLoad={handleLoad} {...demo} />) | ||
} | ||
@@ -62,5 +62,5 @@ </div> | ||
document.body.appendChild(mountNode); | ||
await new Promise((resolve) => { | ||
ReactDOM.render(<DemoView components={components} themeId={themeId} onDragStart={onDragStart} onLoad={() => resolve()}/>, mountNode); | ||
await new Promise((resolve, reject) => { | ||
ReactDOM.render(<DemoView components={components} themeId={themeId} onDragStart={onDragStart} onError={reject} onLoad={() => resolve()}/>, mountNode); | ||
}); | ||
} |
@@ -0,4 +1,7 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ErrorBoundary from './ErrorBoundary'; | ||
import { renderAdaptor } from '../utils'; | ||
const createMountedNode = () => { | ||
@@ -22,7 +25,14 @@ let mountNode = document.getElementById('mount-node'); | ||
export default (name, props, themeId) => { | ||
const node = renderAdaptor(name, props, themeId); | ||
const mountNode = createMountedNode(); | ||
return new Promise((resolve) => { | ||
ReactDOM.render(node, mountNode, () => { | ||
const RenderComponent = ({ onError }) => { | ||
const node = renderAdaptor(name, props, themeId); | ||
return ( | ||
<ErrorBoundary onError={onError}> | ||
{node} | ||
</ErrorBoundary> | ||
); | ||
} | ||
return new Promise((resolve, reject) => { | ||
ReactDOM.render(<RenderComponent onError={reject} />, mountNode, () => { | ||
if (!!mountNode.querySelector('.__error__')) return; | ||
resolve(mountNode.firstElementChild); | ||
@@ -29,0 +39,0 @@ }); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react-dom'), require('react')) : | ||
typeof define === 'function' && define.amd ? define(['react-dom', 'react'], factory) : | ||
(global = global || self, global.AdaptorRender = factory(global.ReactDOM, global.React)); | ||
}(this, function (ReactDOM, React) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('react-dom')) : | ||
typeof define === 'function' && define.amd ? define(['react', 'react-dom'], factory) : | ||
(global = global || self, global.AdaptorRender = factory(global.React, global.ReactDOM)); | ||
}(this, function (React, ReactDOM) { 'use strict'; | ||
var React__default = 'default' in React ? React['default'] : React; | ||
ReactDOM = ReactDOM && ReactDOM.hasOwnProperty('default') ? ReactDOM['default'] : ReactDOM; | ||
var React__default = 'default' in React ? React['default'] : React; | ||
@@ -1227,31 +1227,2 @@ function _defineProperty(obj, key, value) { | ||
var createMountedNode = function createMountedNode() { | ||
var mountNode = document.getElementById('mount-node'); | ||
if (!mountNode) { | ||
mountNode = document.createElement('div'); | ||
mountNode.setAttribute('id', 'mount-node'); | ||
if (typeof window !== 'undefined' && window.__ENV__ !== 'watch') { | ||
mountNode.style.position = 'fixed'; | ||
mountNode.style.left = '-10000px'; | ||
mountNode.style.top = '-10000px'; | ||
} | ||
document.body.appendChild(mountNode); | ||
} | ||
return mountNode; | ||
}; | ||
var render = (function (name, props, themeId) { | ||
var node = renderAdaptor(name, props, themeId); | ||
var mountNode = createMountedNode(); | ||
return new Promise(function (resolve) { | ||
ReactDOM.render(node, mountNode, function () { | ||
resolve(mountNode.firstElementChild); | ||
}); | ||
}); | ||
}); | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -1342,2 +1313,91 @@ if (!(instance instanceof Constructor)) { | ||
var ErrorBoundary = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(ErrorBoundary, _Component); | ||
function ErrorBoundary(props) { | ||
var _this; | ||
_classCallCheck(this, ErrorBoundary); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ErrorBoundary).call(this, props)); | ||
_this.state = { | ||
hasError: false | ||
}; | ||
return _this; | ||
} | ||
_createClass(ErrorBoundary, [{ | ||
key: "componentDidCatch", | ||
value: function componentDidCatch(error, info) { | ||
this.props.onError(error, info); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
if (this.state.hasError) { | ||
return React__default.createElement("div", { | ||
className: "__error__" | ||
}, " This demo is running incorrectly, please contact the developer. "); | ||
} | ||
return this.props.children; | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromError", | ||
value: function getDerivedStateFromError() { | ||
return { | ||
hasError: true | ||
}; | ||
} | ||
}]); | ||
return ErrorBoundary; | ||
}(React.Component); | ||
ErrorBoundary.defaultProps = { | ||
onError: function onError() {} | ||
}; | ||
var createMountedNode = function createMountedNode() { | ||
var mountNode = document.getElementById('mount-node'); | ||
if (!mountNode) { | ||
mountNode = document.createElement('div'); | ||
mountNode.setAttribute('id', 'mount-node'); | ||
if (typeof window !== 'undefined' && window.__ENV__ !== 'watch') { | ||
mountNode.style.position = 'fixed'; | ||
mountNode.style.left = '-10000px'; | ||
mountNode.style.top = '-10000px'; | ||
} | ||
document.body.appendChild(mountNode); | ||
} | ||
return mountNode; | ||
}; | ||
var render = (function (name, props, themeId) { | ||
var mountNode = createMountedNode(); | ||
var RenderComponent = function RenderComponent(_ref) { | ||
var onError = _ref.onError; | ||
var node = renderAdaptor(name, props, themeId); | ||
return React__default.createElement(ErrorBoundary, { | ||
onError: onError | ||
}, node); | ||
}; | ||
return new Promise(function (resolve, reject) { | ||
ReactDOM.render(React__default.createElement(RenderComponent, { | ||
onError: reject | ||
}), mountNode, function () { | ||
if (!!mountNode.querySelector('.__error__')) return; | ||
resolve(mountNode.firstElementChild); | ||
}); | ||
}); | ||
}); | ||
var Demo = | ||
@@ -1364,3 +1424,3 @@ /*#__PURE__*/ | ||
themeId = _this$props.themeId; | ||
render(node.adaptor, node.props, themeId).then(onDragStart); | ||
return render(node.adaptor, node.props, themeId).then(onDragStart); | ||
}; | ||
@@ -1370,4 +1430,4 @@ | ||
scale: 1, | ||
rect: {}, | ||
loaded: false | ||
loaded: false, | ||
error: false | ||
}; | ||
@@ -1378,2 +1438,8 @@ return _this; | ||
_createClass(Demo, [{ | ||
key: "componentDidCatch", | ||
value: function componentDidCatch(error, info) { | ||
// You can also log the error to an error reporting service | ||
this.props.onError(error, info); | ||
} | ||
}, { | ||
key: "componentDidMount", | ||
@@ -1388,3 +1454,2 @@ value: function componentDidMount() { | ||
var scale = 1; | ||
var rect = {}; | ||
@@ -1396,14 +1461,5 @@ if (this.demo) { | ||
var _node$getBoundingClie = node.getBoundingClientRect(), | ||
width = _node$getBoundingClie.width, | ||
height = _node$getBoundingClie.height; | ||
if (scale > 1) { | ||
scale = 1; | ||
} | ||
rect = { | ||
width: width * scale, | ||
height: height * scale | ||
}; | ||
} | ||
@@ -1413,4 +1469,3 @@ | ||
loaded: true, | ||
scale: scale, | ||
rect: rect | ||
scale: scale | ||
}, function () { | ||
@@ -1431,5 +1486,10 @@ onLoad(); | ||
loaded = _this$state.loaded, | ||
rect = _this$state.rect; | ||
error = _this$state.error; | ||
var demoNode = renderAdaptor(node.adaptor, node.props || {}, themeId); | ||
if (!demoNode) return null; | ||
if (error) { | ||
return React__default.createElement("div", null, " This demo is running incorrectly, please contact the developer "); | ||
} | ||
var imgStyle = { | ||
@@ -1440,4 +1500,4 @@ opacity: 0, | ||
left: '10px', | ||
width: rect.width, | ||
height: height ? height * scale - 20 : rect.height, | ||
width: '100%', | ||
height: 'calc(100% - 20px)', | ||
cursor: 'pointer', | ||
@@ -1475,2 +1535,10 @@ zIndex: 1 | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromError", | ||
value: function getDerivedStateFromError() { | ||
// Update state so the next render will show the fallback UI. | ||
return { | ||
error: true | ||
}; | ||
} | ||
}]); | ||
@@ -1488,2 +1556,3 @@ | ||
onLoad: function onLoad() {}, | ||
onError: function onError() {}, | ||
onDragStart: function onDragStart() {} | ||
@@ -1496,2 +1565,3 @@ }; | ||
onLoad = _ref.onLoad, | ||
onError = _ref.onError, | ||
themeId = _ref.themeId; | ||
@@ -1537,2 +1607,3 @@ var index = 0; | ||
onDragStart: onDragStart, | ||
onError: onError, | ||
themeId: themeId, | ||
@@ -1568,3 +1639,3 @@ onLoad: handleLoad | ||
_context.next = 6; | ||
return new Promise(function (resolve) { | ||
return new Promise(function (resolve, reject) { | ||
ReactDOM.render(React__default.createElement(DemoView, { | ||
@@ -1574,2 +1645,3 @@ components: components, | ||
onDragStart: onDragStart, | ||
onError: reject, | ||
onLoad: function onLoad() { | ||
@@ -1576,0 +1648,0 @@ return resolve(); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react-dom"),require("react")):"function"==typeof define&&define.amd?define(["react-dom","react"],e):(t=t||self).AdaptorRender=e(t.ReactDOM,t.React)}(this,function(i,n){"use strict";i=i&&i.hasOwnProperty("default")?i.default:i;var f="default"in n?n.default:n;function p(o){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},e=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),e.forEach(function(t){var e,n,r;e=o,r=a[n=t],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r})}return o}var t,a=(function(t){var e=function(a){var u,t=Object.prototype,l=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",r=e.toStringTag||"@@toStringTag";function i(t,e,n,r){var o=e&&e.prototype instanceof c?e:c,a=Object.create(o.prototype),i=new L(r||[]);return a._invoke=function(a,i,c){var u=f;return function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return k()}for(c.method=t,c.arg=e;;){var n=c.delegate;if(n){var r=O(n,c);if(r){if(r===m)continue;return r}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(u===f)throw u=h,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u=d;var o=s(a,i,c);if("normal"===o.type){if(u=c.done?h:p,o.arg===m)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u=h,c.method="throw",c.arg=o.arg)}}}(t,n,i),a}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=i;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function c(){}function v(){}function y(){}var g={};g[o]=function(){return this};var C=Object.getPrototypeOf,b=C&&C(C(_([])));b&&b!==t&&l.call(b,o)&&(g=b);var w=y.prototype=c.prototype=Object.create(g);function x(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function E(u){var e;this._invoke=function(n,r){function t(){return new Promise(function(t,e){!function e(t,n,r,o){var a=s(u[t],u,n);if("throw"!==a.type){var i=a.arg,c=i.value;return c&&"object"==typeof c&&l.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):Promise.resolve(c).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)})}o(a.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function O(t,e){var n=t.iterator[e.method];if(n===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=u,O(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,m;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}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 j(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 _(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t};return r.next=r}}return{next:k}}function k(){return{value:u,done:!0}}return v.prototype=w.constructor=y,y.constructor=v,y[r]=v.displayName="GeneratorFunction",a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,r in t||(t[r]="GeneratorFunction")),t.prototype=Object.create(w),t},a.awrap=function(t){return{__await:t}},x(E.prototype),E.prototype[n]=function(){return this},a.AsyncIterator=E,a.async=function(t,e,n,r){var o=new E(i(t,e,n,r));return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},x(w),w[r]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},a.keys=function(n){var r=[];for(var t in n)r.push(t);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=_,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(j),!t)for(var e in this)"t"===e.charAt(0)&&l.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 a.type="throw",a.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],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=l.call(o,"catchLoc"),c=l.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new 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&&l.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 a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},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),j(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),m}},a}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(t={exports:{}},t.exports),t.exports);function u(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function o(c){return function(){var t=this,i=arguments;return new Promise(function(e,n){var r=c.apply(t,i);function o(t){u(r,e,n,o,a,"next",t)}function a(t){u(r,e,n,o,a,"throw",t)}o(void 0)})}}var e,r,c,l,s,d,h={"-":"disabled","*":"active","~":"hover","":"normal"},m={};Object.keys(h).forEach(function(t){m[h[t]]=t}),(r=e||(e={})).divider="divider",r.node="node",r.comment="comment",(l=c||(c={})).text="text",l.icon="icon",(d=s||(s={})).enum="enum",d.string="string",d.number="number",d.bool="bool",d.node="node",d.nodeList="node-list";function v(t){return t.replace(/\B([A-Z])/g,"-$1").split(/[-|_]/).map(function(t){return function(t){return t?[t.substring(0,1).toUpperCase(),t.substring(1)].join(""):""}(t)}).join(" ")}var y=s;function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(t){C(e,t,n[t])})}return e}function C(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}for(var b=function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){return g({},t,{label:t.label||v(t.name),options:function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||v(e)}})}(t.options)})})},w=function(n){if(!n.name)return console.error("[error] muse be have name:"),n;var t;t=!n.shape||!Array.isArray(n.shape)||n.shape.length<1?[{label:n.name,value:"normal"}]:n.shape.filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||"".concat(v(e)," ").concat("normal"===e?"":n.name)}});return g({},n,{shape:t,editor:function(t){var e=n.editor?n.editor(t):{};return e.props||(e.props=[]),e.nodes||(e.nodes=[]),g({},e,{props:b(e.props),nodes:b(e.nodes)})},content:function(t){var e=n.content?n.content(t):{};return g({},e,{options:b(e.options)})}})},x=function(e){return(1<arguments.length&&void 0!==arguments[1]?arguments[1]:[]).find(function(t){return t.name===e})},E=1,O=(new Date).getTime(),S=function(f){var p=[];return f.shape.forEach(function(t){var a=t.value,e=f.editor(a),i=x("size",e.props),c=x("state",e.props),u=x("level",e.props),l=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{default:""},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n={normal:!0,hover:!!t.hover,active:!!t.active,disabled:!!t.disable},r=!1===t.generate?null:Object.keys(n).filter(function(t){return n[t]}),o=x("state",e);return o&&(r=(o.options||[]).map(function(t){return t.value})),r||["normal"]}(e.data,e.props),n=i&&i.options?i.options.map(function(t){return t.value}):["medium"],s=u&&u.options?u.options.map(function(t){return t.value}):["normal"];l.forEach(function(o){n.forEach(function(r){s.forEach(function(t){var e=g({},function(t,e){var n=t.editor(e),r={shape:e,data:n.data&&n.data.default||""};return n.props.forEach(function(t){var e=t.default;if(null==e)switch(t.type){case y.string:e="";break;case y.number:e=0;break;case y.bool:e=!1;break;case y.enum:e=t.options?t.options[0].value:""}r[t.name]=e}),n.nodes.forEach(function(t){var e=t.name,n=t.default;r[e]=n}),r}(f,a));i&&(e.size=r),u&&(e.level=t),1<l.length&&(c?e.state=o:(e.data&&h[e.data.substring(0,1)]&&(e.data=e.data.substring(1)),e.data=m[o]+e.data));var n={id:(O+E++).toString(16),node:{adaptor:f.name,props:e}};p.push(g({},n,f.demoOptions&&f.demoOptions(n)))})})})}),p},j=[],L=[],_=0;_<256;_+=1)L[_]=(_<16?"0":"")+_.toString(16);function k(){return function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return"".concat(L[255&t]+L[t>>8&255]+L[t>>16&255]+L[t>>24&255],"-").concat(L[255&e]).concat(L[e>>8&255],"-").concat(L[e>>16&15|64]).concat(L[e>>24&255],"-").concat(L[63&n|128]).concat(L[n>>8&255],"-").concat(L[n>>16&255]).concat(L[n>>24&255]).concat(L[255&r]).concat(L[r>>8&255]).concat(L[r>>16&255]).concat(L[r>>24&255])}()}function P(e){return j.find(function(t){return t.name===e})}function M(t,a,i,e){var n=P(t);if(!n)return null;var c={};return Object.keys(a).forEach(function(t){if("object"==typeof a[t]&&a[t].adaptor){var e=a[t],n=e.adaptor,r=e.props,o=k();a[t]=M(n,r,i,o),c[t]={adaptor:n,id:o}}else c[t]=a[t]}),n.adaptor(p({},a,{"data-fusioncool":JSON.stringify(p({name:t,props:c,type:"adaptor-component",themeId:String(i)},e?{"data-id":e}:{}))}))}var A=function(){var e=o(a.mark(function t(e){return a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(window.Adaptors&&Object.keys(window.Adaptors).forEach(function(t){j.push(w(window.Adaptors[t]))}),e)return t.next=4,Promise.all(e.map(function(t){var e=t.script,n=t.stylesheet;if(e){var r,o,a=[];return a.push((r=e,new Promise(function(t,e){var n=document.createElement("script");n.type="text/javascript",n.setAttribute("crossorigin",!0),n.onload=t,n.onerror=e,n.src=r,document.body.appendChild(n)})).then(function(){window.Adaptor&&(j.push(w(window.Adaptor)),window.Adaptor=null)})),n&&a.push((o=n,new Promise(function(t,e){var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.onload=t,n.onerror=e,n.href=o,document.head.appendChild(n)}))),Promise.all(a)}}));t.next=4;break;case 4:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}();function D(t,e,n){var r=M(t,e,n),o=function(){var t=document.getElementById("mount-node");return t||((t=document.createElement("div")).setAttribute("id","mount-node"),"undefined"!=typeof window&&"watch"!==window.__ENV__&&(t.style.position="fixed",t.style.left="-10000px",t.style.top="-10000px"),document.body.appendChild(t)),t}();return new Promise(function(t){i.render(r,o,function(){t(o.firstElementChild)})})}function I(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,r.key,r)}}function T(t){return(T="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})(t)}function N(t){return(N="function"==typeof Symbol&&"symbol"===T(Symbol.iterator)?function(t){return T(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":T(t)})(t)}function F(t,e){return!e||"object"!==N(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function R(t){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function G(t,e){return(G=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var z=function(t){function e(t){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=F(this,R(e).call(this,t))).saveRef=function(t){o.demo=t},o.handleDragStart=function(){var t=o.props,e=t.onDragStart,n=t.node,r=t.themeId;D(n.adaptor,n.props,r).then(e)},o.state={scale:1,rect:{},loaded:!1},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&G(t,e)}(e,n.Component),function(t,e,n){e&&I(t.prototype,e),n&&I(t,n)}(e,[{key:"componentDidMount",value:function(){this.computeScale()}},{key:"computeScale",value:function(){var t=this.props.onLoad,e=1,n={};if(this.demo){var r=i.findDOMNode(this.demo),o=r.firstElementChild;e=(r.offsetWidth-20)/o.offsetWidth;var a=o.getBoundingClientRect();1<e&&(e=1),n={width:a.width*e,height:a.height*e}}this.setState({loaded:!0,scale:e,rect:n},function(){t()})}},{key:"render",value:function(){var t=this.props,e=t.background,n=t.height,r=t.node,o=t.themeId,a=this.state,i=a.scale,c=a.loaded,u=a.rect,l=M(r.adaptor,r.props||{},o);if(!l)return null;var s={opacity:0,position:"absolute",top:"10px",left:"10px",width:u.width,height:n?n*i-20:u.height,cursor:"pointer",zIndex:1};return f.createElement("div",{ref:this.saveRef,style:{background:e,height:n?n*i:"auto",padding:10,overflow:"hidden",position:"relative",display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"flex-start",visibility:c?"":"hidden"}},f.cloneElement(l,{style:p({transform:"scale(".concat(i,")"),transformOrigin:"top left",flexShrink:0,flexGrow:0},l.props.style||{})}),f.createElement("img",{onDragStart:this.handleDragStart,draggable:!0,alt:"drag layer",src:function(t,e,n,r){var o=!(4<arguments.length&&void 0!==arguments[4])||arguments[4];return'data:image/svg+xml;charset=UTF-8,<svg width="'.concat(t,'px" height="').concat(e,'px" viewBox="0 0 ').concat(t," ").concat(e,'" version="1.1" xmlns="http://www.w3.org/2000/svg"><rect stroke="none" fill="none" id=\'__magic:FC_').concat(n,",").concat(r,'\' x="0" y="0" width="').concat(t,'" height="').concat(e,'" />\n ').concat(o?'<g id="loading" transform="translate('.concat(t/2-27,", ").concat(e/2-25,')" fill="#5A5A5A" opacity="0.5">\n <text id="text" font-family="PingFangSC-Regular, PingFang SC" font-size="16" font-weight="normal">\n <tspan x="0" y="45">Loading</tspan>\n </text>\n <g id="icon" transform="translate(18.000000, 0.000000)" fill-rule="nonzero">\n <path d="M14.3390969,12.0749978 C14.3390969,12.1289011 14.3881236,12.1779078 14.441947,12.1779078 C14.4957704,12.1779078 14.5447771,12.1289011 14.5447771,12.0749978 C14.5447771,12.0211744 14.4958303,11.9720678 14.441947,11.9720678 C14.3881636,11.9720478 14.3390969,12.0211544 14.3390969,12.0749978 M12.0693204,14.4193036 C12.0693204,14.4730071 12.0913854,14.5262309 12.1292396,14.5641052 C12.1670739,14.6019994 12.2202777,14.6240644 12.2737813,14.6240644 C12.3274249,14.6240644 12.3805887,14.6019994 12.418403,14.5641052 C12.4562173,14.526211 12.4783223,14.4729671 12.4783223,14.4193036 C12.4783223,14.3657201 12.4562373,14.3124763 12.418403,14.274662 C12.3805687,14.2367678 12.3273649,14.2146828 12.2737813,14.2146828 C12.2202178,14.2146828 12.1670539,14.2367478 12.1292396,14.274662 C12.0913654,14.3124763 12.0693204,14.3657201 12.0693204,14.4193036 M9.00980084,15.626023 C9.00980084,15.7065283 9.04285836,15.7866138 9.09977965,15.8435551 C9.15666098,15.9005164 9.23664658,15.9336538 9.31709187,15.9336538 C9.39745723,15.9336538 9.47744283,15.9005164 9.53436412,15.8435551 C9.59128541,15.7866138 9.62438291,15.7065683 9.62438291,15.626023 C9.62438291,15.5455578 9.59128541,15.4654922 9.53436412,15.4085309 C9.47744283,15.3515497 9.39745723,15.3184122 9.31709187,15.3184122 C9.23664658,15.3184122 9.15666098,15.3515497 9.09977965,15.4085309 C9.04285836,15.4654922 9.00980084,15.5455378 9.00980084,15.626023 M5.71628043,15.464353 C5.71628043,15.5714801 5.76041043,15.6779677 5.83607896,15.7537962 C5.91174752,15.8295447 6.01819512,15.8736347 6.12530229,15.8736347 C6.23234949,15.8736347 6.33881709,15.8295447 6.41448564,15.7537962 C6.49025412,15.6779677 6.53430416,15.5714802 6.53430416,15.464353 C6.53430416,15.3570859 6.49025412,15.2506383 6.41448564,15.1747699 C6.33881709,15.0990414 6.23236949,15.0549514 6.12530229,15.0549514 C6.0182151,15.0549514 5.9117475,15.0990414 5.83607896,15.1747699 C5.76041043,15.2506383 5.71628043,15.3570859 5.71628043,15.464353 M2.79454721,13.9635735 C2.79454721,14.0977623 2.84970969,14.2310516 2.94444527,14.3258871 C3.03918086,14.4206827 3.17237029,14.4759251 3.30641914,14.4759251 C3.44032809,14.4759251 3.57351752,14.4206827 3.66825309,14.3258871 C3.76298867,14.2310516 3.81815115,14.0977623 3.81815115,13.9635735 C3.81815115,13.8294847 3.76298867,13.6961754 3.66825309,13.6013798 C3.5735175,13.5065643 3.44032807,13.4513218 3.30641914,13.4513218 C3.17237029,13.4513218 3.03918086,13.5065643 2.94444527,13.6013798 C2.84968971,13.6961754 2.79454721,13.8294847 2.79454721,13.9635735 M0.771023203,11.4122684 C0.771023203,11.5733788 0.837238184,11.73339 0.95100082,11.8473126 C1.06480344,11.9611951 1.22479465,12.02757 1.38562527,12.02757 C1.54657582,12.02757 1.70646711,11.9612151 1.82024973,11.8473126 C1.93401236,11.73343 2.00030729,11.5733788 2.00030729,11.4122684 C2.00030729,11.2512779 1.93403234,11.0912267 1.82024973,10.9773242 C1.70646709,10.8634416 1.54657582,10.7970667 1.38562527,10.7970667 C1.22479463,10.7970667 1.06480344,10.8634016 0.95100082,10.9773242 C0.837218184,11.0912267 0.771023203,11.2512779 0.771023203,11.4122684 M0.0117595117,8.27969855 C0.0117595117,8.46747088 0.0890069922,8.65400402 0.221576836,8.78677375 C0.35414668,8.91944354 0.540519961,8.99667102 0.728092402,8.99667102 C0.915664844,8.99667102 1.10201813,8.91944354 1.23460797,8.78677375 C1.36717781,8.65396406 1.44442529,8.4674309 1.44442529,8.27969855 C1.44442529,8.09200619 1.36717781,7.90547303 1.23460797,7.77270332 C1.10201813,7.63999355 0.915664844,7.56276607 0.728092402,7.56276607 C0.540519961,7.56276607 0.35414668,7.63999355 0.221576836,7.77270332 C0.0890269531,7.90549301 0.0117595117,8.09202617 0.0117595117,8.27969855 M0.636554648,5.16747486 C0.636554648,5.38212891 0.724814629,5.59552379 0.876551445,5.74728059 C1.02816834,5.89905738 1.24124346,5.9873973 1.45571762,5.9873973 C1.67019178,5.9873973 1.88328688,5.89905738 2.03490377,5.74728059 C2.18662061,5.59552379 2.27488059,5.38212889 2.27488059,5.16747486 C2.27488059,4.95290078 2.18662061,4.73952586 2.03490377,4.58776906 C1.88328687,4.43597229 1.67019178,4.34763236 1.45571762,4.34763236 C1.24124346,4.34763236 1.02816836,4.43597229 0.876551445,4.58776906 C0.724814629,4.73950588 0.636554648,4.95290078 0.636554648,5.16747486 M2.51094006,2.65808125 C2.51094006,2.89963699 2.61035246,3.13969375 2.78101641,3.31053758 C2.95170033,3.48136143 3.19159721,3.58083377 3.43293311,3.58083377 C3.67428898,3.58083377 3.91408592,3.48132145 4.08474986,3.31053758 C4.25545379,3.13969375 4.35482621,2.89963699 4.35482621,2.65808125 C4.35482621,2.41646555 4.25545379,2.17634883 4.08474986,2.00554498 C3.91408592,1.83470115 3.67428898,1.73524879 3.43293311,1.73524879 C3.19159721,1.73524879 2.95170035,1.83472115 2.78101641,2.00554498 C2.61035246,2.17636883 2.51094006,2.41646555 2.51094006,2.65808125 M5.2632285,1.22063871 C5.2632285,1.48887631 5.37355348,1.755515 5.56300465,1.94512605 C5.75253576,2.13485703 6.01883469,2.24522199 6.28683244,2.24522199 C6.5548302,2.24522199 6.8211491,2.13487703 7.01064025,1.94512605 C7.20019137,1.75551498 7.31053633,1.48887631 7.31053633,1.22063871 C7.31053633,0.952381133 7.20019137,0.685882344 7.01064025,0.496131367 C6.8211691,0.306520293 6.5548302,0.19605541 6.28683244,0.19605541 C6.01883469,0.19605541 5.75255574,0.306500313 5.56300465,0.496131367 C5.37355348,0.685902344 5.2632285,0.952401113 5.2632285,1.22063871 M8.35448645,1.13137941 C8.35448645,1.42653871 8.47582395,1.71987924 8.68438211,1.9285973 C8.89288033,2.13731537 9.18596104,2.2588927 9.48084053,2.2588927 C9.77583992,2.2588927 10.0689206,2.13731537 10.2773989,1.9285973 C10.4858971,1.71989922 10.6072945,1.42653871 10.6072945,1.13137941 C10.6072945,0.836200137 10.4859371,0.542859609 10.2773989,0.334061582 C10.0688607,0.125343516 9.77581994,0.00386611328 9.48084053,0.00386611328 C9.18596105,0.00386611328 8.89288033,0.125343516 8.68438211,0.334061582 C8.47582395,0.542819629 8.35448645,0.836200137 8.35448645,1.13137941 M11.184642,2.40591273 C11.184642,2.72773389 11.3170519,3.04755643 11.5443573,3.27506172 C11.7717427,3.50270691 12.0912854,3.63513687 12.4128268,3.63513687 C12.7343282,3.63513687 13.0538709,3.50270693 13.2811763,3.27506172 C13.5085617,3.04755643 13.6408917,2.72771391 13.6408917,2.40591273 C13.6408917,2.08407158 13.5085617,1.76424906 13.2811763,1.53662385 C13.0538709,1.30909857 12.7343282,1.17656869 12.4128268,1.17656869 C12.0912854,1.17656869 11.7717427,1.30909857 11.5443573,1.53662385 C11.3170519,1.76424906 11.184642,2.08407158 11.184642,2.40591273 M13.1957344,4.79996477 C13.1957344,5.1487276 13.3391968,5.49531193 13.5855493,5.74200418 C13.8319817,5.9885965 14.1782663,6.13215887 14.5267093,6.13215887 C14.8751524,6.13215887 15.2214769,5.9885765 15.4678294,5.74200418 C15.7141819,5.49531193 15.8576043,5.14872762 15.8576043,4.79996477 C15.8576043,4.45116195 15.7141819,4.10455764 15.4678294,3.85796533 C15.2214769,3.61129307 14.8751524,3.46773068 14.5267093,3.46773068 C14.1782663,3.46773068 13.8319818,3.61131305 13.5855493,3.85796533 C13.3391969,4.10455766 13.1957344,4.45118195 13.1957344,4.79996477 M13.9957104,7.90093611 C13.9957104,8.27658068 14.1501854,8.65000674 14.4156648,8.91566609 C14.6811043,9.18134543 15.0540907,9.33604023 15.4295154,9.33604023 C15.8048002,9.33604023 16.1778665,9.18134543 16.4432861,8.91566609 C16.7087256,8.65002674 16.8632405,8.27658066 16.8632405,7.90093611 C16.8632405,7.52517164 16.7087456,7.15176555 16.4432861,6.88610619 C16.1778865,6.62044684 15.8048202,6.46585197 15.4295154,6.46585197 C15.0541107,6.46585197 14.6811243,6.62044686 14.4156648,6.88610619 C14.1501654,7.15174557 13.9957104,7.52515164 13.9957104,7.90093611" id="Shape"></path>\n </g>\n </g>'):"","\n </svg>")}(0,0,r.adaptor,"group"),style:s}))}}]),e}();z.defaultProps={background:"transparent",node:{adaptor:"__test__",props:{}},onLoad:function(){},onDragStart:function(){}};function B(t){function a(){++r===u&&n()}var e=t.components,i=t.onDragStart,n=t.onLoad,c=t.themeId,r=0,u=0,o=f.createElement("div",null,e.map(function(t,e){var n=t.name,r=P(n),o=S(r).filter(function(t){var e=t.node.props.size;return!e||"medium"===e});return u+=o.length,f.createElement("div",{id:"component-".concat(r.name),key:e},f.createElement("div",{style:{color:"#888",fontSize:11,padding:"0 10px",height:24,lineHeight:"22px",position:"relative",borderTop:"1px solid hsla(0,0%,53.7%,.4)",borderBottom:"1px solid hsla(0,0%,53.7%,.4)",backgroundColor:"rgba(137, 137, 137, .1)"}},n),o.map(function(t){return f.createElement(z,Object.assign({key:t.id,onDragStart:i,themeId:c,onLoad:a},t))}))}));return 0===u&&n(),o}return{init:function(){var r=o(a.mark(function t(e,n,r){var o;return a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,A(e);case 2:return o=document.createElement("div"),document.body.appendChild(o),t.next=6,new Promise(function(t){i.render(f.createElement(B,{components:e,themeId:r,onDragStart:n,onLoad:function(){return t()}}),o)});case 6:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),findEditor:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"normal",n=P(t);if(n)return n.editor(e)},render:D,scrollTo:function(t){var e=document.getElementById("component-".concat(t));e&&window.scrollTo(0,e.offsetTop)}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):(t=t||self).AdaptorRender=e(t.React,t.ReactDOM)}(this,function(r,c){"use strict";var l="default"in r?r.default:r;function f(o){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},e=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),e.forEach(function(t){var e,n,r;e=o,r=a[n=t],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r})}return o}c=c&&c.hasOwnProperty("default")?c.default:c;var t,i=(function(t){var e=function(a){var u,t=Object.prototype,s=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",r=e.toStringTag||"@@toStringTag";function i(t,e,n,r){var o=e&&e.prototype instanceof c?e:c,a=Object.create(o.prototype),i=new j(r||[]);return a._invoke=function(a,i,c){var u=f;return function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return L()}for(c.method=t,c.arg=e;;){var n=c.delegate;if(n){var r=O(n,c);if(r){if(r===m)continue;return r}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(u===f)throw u=h,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u=d;var o=l(a,i,c);if("normal"===o.type){if(u=c.done?h:p,o.arg===m)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u=h,c.method="throw",c.arg=o.arg)}}}(t,n,i),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=i;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function c(){}function v(){}function y(){}var g={};g[o]=function(){return this};var C=Object.getPrototypeOf,b=C&&C(C(k([])));b&&b!==t&&s.call(b,o)&&(g=b);var w=y.prototype=c.prototype=Object.create(g);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function x(u){var e;this._invoke=function(n,r){function t(){return new Promise(function(t,e){!function e(t,n,r,o){var a=l(u[t],u,n);if("throw"!==a.type){var i=a.arg,c=i.value;return c&&"object"==typeof c&&s.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):Promise.resolve(c).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)})}o(a.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function O(t,e){var n=t.iterator[e.method];if(n===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=u,O(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,m;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}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 _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=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};return r.next=r}}return{next:L}}function L(){return{value:u,done:!0}}return v.prototype=w.constructor=y,y.constructor=v,y[r]=v.displayName="GeneratorFunction",a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,r in t||(t[r]="GeneratorFunction")),t.prototype=Object.create(w),t},a.awrap=function(t){return{__await:t}},E(x.prototype),x.prototype[n]=function(){return this},a.AsyncIterator=x,a.async=function(t,e,n,r){var o=new x(i(t,e,n,r));return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},E(w),w[r]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},a.keys=function(n){var r=[];for(var t in n)r.push(t);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=k,j.prototype={constructor:j,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(_),!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 a.type="throw",a.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],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new 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 a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},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),_(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;_(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),m}},a}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(t={exports:{}},t.exports),t.exports);function u(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function n(c){return function(){var t=this,i=arguments;return new Promise(function(e,n){var r=c.apply(t,i);function o(t){u(r,e,n,o,a,"next",t)}function a(t){u(r,e,n,o,a,"throw",t)}o(void 0)})}}var e,o,a,s,p,d,h={"-":"disabled","*":"active","~":"hover","":"normal"},m={};Object.keys(h).forEach(function(t){m[h[t]]=t}),(o=e||(e={})).divider="divider",o.node="node",o.comment="comment",(s=a||(a={})).text="text",s.icon="icon",(d=p||(p={})).enum="enum",d.string="string",d.number="number",d.bool="bool",d.node="node",d.nodeList="node-list";function v(t){return t.replace(/\B([A-Z])/g,"-$1").split(/[-|_]/).map(function(t){return function(t){return t?[t.substring(0,1).toUpperCase(),t.substring(1)].join(""):""}(t)}).join(" ")}var y=p;function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(t){C(e,t,n[t])})}return e}function C(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}for(var b=function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){return g({},t,{label:t.label||v(t.name),options:function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||v(e)}})}(t.options)})})},w=function(n){if(!n.name)return console.error("[error] muse be have name:"),n;var t;t=!n.shape||!Array.isArray(n.shape)||n.shape.length<1?[{label:n.name,value:"normal"}]:n.shape.filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||"".concat(v(e)," ").concat("normal"===e?"":n.name)}});return g({},n,{shape:t,editor:function(t){var e=n.editor?n.editor(t):{};return e.props||(e.props=[]),e.nodes||(e.nodes=[]),g({},e,{props:b(e.props),nodes:b(e.nodes)})},content:function(t){var e=n.content?n.content(t):{};return g({},e,{options:b(e.options)})}})},E=function(e){return(1<arguments.length&&void 0!==arguments[1]?arguments[1]:[]).find(function(t){return t.name===e})},x=1,O=(new Date).getTime(),S=function(f){var p=[];return f.shape.forEach(function(t){var a=t.value,e=f.editor(a),i=E("size",e.props),c=E("state",e.props),u=E("level",e.props),s=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{default:""},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n={normal:!0,hover:!!t.hover,active:!!t.active,disabled:!!t.disable},r=!1===t.generate?null:Object.keys(n).filter(function(t){return n[t]}),o=E("state",e);return o&&(r=(o.options||[]).map(function(t){return t.value})),r||["normal"]}(e.data,e.props),n=i&&i.options?i.options.map(function(t){return t.value}):["medium"],l=u&&u.options?u.options.map(function(t){return t.value}):["normal"];s.forEach(function(o){n.forEach(function(r){l.forEach(function(t){var e=g({},function(t,e){var n=t.editor(e),r={shape:e,data:n.data&&n.data.default||""};return n.props.forEach(function(t){var e=t.default;if(null==e)switch(t.type){case y.string:e="";break;case y.number:e=0;break;case y.bool:e=!1;break;case y.enum:e=t.options?t.options[0].value:""}r[t.name]=e}),n.nodes.forEach(function(t){var e=t.name,n=t.default;r[e]=n}),r}(f,a));i&&(e.size=r),u&&(e.level=t),1<s.length&&(c?e.state=o:(e.data&&h[e.data.substring(0,1)]&&(e.data=e.data.substring(1)),e.data=m[o]+e.data));var n={id:(O+x++).toString(16),node:{adaptor:f.name,props:e}};p.push(g({},n,f.demoOptions&&f.demoOptions(n)))})})})}),p},_=[],j=[],k=0;k<256;k+=1)j[k]=(k<16?"0":"")+k.toString(16);function L(){return function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return"".concat(j[255&t]+j[t>>8&255]+j[t>>16&255]+j[t>>24&255],"-").concat(j[255&e]).concat(j[e>>8&255],"-").concat(j[e>>16&15|64]).concat(j[e>>24&255],"-").concat(j[63&n|128]).concat(j[n>>8&255],"-").concat(j[n>>16&255]).concat(j[n>>24&255]).concat(j[255&r]).concat(j[r>>8&255]).concat(j[r>>16&255]).concat(j[r>>24&255])}()}function P(e){return _.find(function(t){return t.name===e})}function M(t,a,i,e){var n=P(t);if(!n)return null;var c={};return Object.keys(a).forEach(function(t){if("object"==typeof a[t]&&a[t].adaptor){var e=a[t],n=e.adaptor,r=e.props,o=L();a[t]=M(n,r,i,o),c[t]={adaptor:n,id:o}}else c[t]=a[t]}),n.adaptor(f({},a,{"data-fusioncool":JSON.stringify(f({name:t,props:c,type:"adaptor-component",themeId:String(i)},e?{"data-id":e}:{}))}))}var D=function(){var e=n(i.mark(function t(e){return i.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(window.Adaptors&&Object.keys(window.Adaptors).forEach(function(t){_.push(w(window.Adaptors[t]))}),e)return t.next=4,Promise.all(e.map(function(t){var e=t.script,n=t.stylesheet;if(e){var r,o,a=[];return a.push((r=e,new Promise(function(t,e){var n=document.createElement("script");n.type="text/javascript",n.setAttribute("crossorigin",!0),n.onload=t,n.onerror=e,n.src=r,document.body.appendChild(n)})).then(function(){window.Adaptor&&(_.push(w(window.Adaptor)),window.Adaptor=null)})),n&&a.push((o=n,new Promise(function(t,e){var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.onload=t,n.onerror=e,n.href=o,document.head.appendChild(n)}))),Promise.all(a)}}));t.next=4;break;case 4:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}();function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(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,r.key,r)}}function I(t,e,n){return e&&T(t.prototype,e),n&&T(t,n),t}function F(t){return(F="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})(t)}function N(t){return(N="function"==typeof Symbol&&"symbol"===F(Symbol.iterator)?function(t){return F(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":F(t)})(t)}function G(t,e){return!e||"object"!==N(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function R(t){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function z(t,e){return(z=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function B(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&z(t,e)}var q=function(t){function n(t){var e;return A(this,n),(e=G(this,R(n).call(this,t))).state={hasError:!1},e}return B(n,r.Component),I(n,[{key:"componentDidCatch",value:function(t,e){this.props.onError(t,e)}},{key:"render",value:function(){return this.state.hasError?l.createElement("div",{className:"__error__"}," This demo is running incorrectly, please contact the developer. "):this.props.children}}],[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}]),n}();q.defaultProps={onError:function(){}};function U(r,o,a){function n(t){var e=t.onError,n=M(r,o,a);return l.createElement(q,{onError:e},n)}var i=function(){var t=document.getElementById("mount-node");return t||((t=document.createElement("div")).setAttribute("id","mount-node"),"undefined"!=typeof window&&"watch"!==window.__ENV__&&(t.style.position="fixed",t.style.left="-10000px",t.style.top="-10000px"),document.body.appendChild(t)),t}();return new Promise(function(t,e){c.render(l.createElement(n,{onError:e}),i,function(){i.querySelector(".__error__")||t(i.firstElementChild)})})}var W=function(t){function e(t){var o;return A(this,e),(o=G(this,R(e).call(this,t))).saveRef=function(t){o.demo=t},o.handleDragStart=function(){var t=o.props,e=t.onDragStart,n=t.node,r=t.themeId;return U(n.adaptor,n.props,r).then(e)},o.state={scale:1,loaded:!1,error:!1},o}return B(e,r.Component),I(e,[{key:"componentDidCatch",value:function(t,e){this.props.onError(t,e)}},{key:"componentDidMount",value:function(){this.computeScale()}},{key:"computeScale",value:function(){var t=this.props.onLoad,e=1;if(this.demo){var n=c.findDOMNode(this.demo),r=n.firstElementChild;1<(e=(n.offsetWidth-20)/r.offsetWidth)&&(e=1)}this.setState({loaded:!0,scale:e},function(){t()})}},{key:"render",value:function(){var t=this.props,e=t.background,n=t.height,r=t.node,o=t.themeId,a=this.state,i=a.scale,c=a.loaded,u=a.error,s=M(r.adaptor,r.props||{},o);if(!s)return null;if(u)return l.createElement("div",null," This demo is running incorrectly, please contact the developer ");return l.createElement("div",{ref:this.saveRef,style:{background:e,height:n?n*i:"auto",padding:10,overflow:"hidden",position:"relative",display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"flex-start",visibility:c?"":"hidden"}},l.cloneElement(s,{style:f({transform:"scale(".concat(i,")"),transformOrigin:"top left",flexShrink:0,flexGrow:0},s.props.style||{})}),l.createElement("img",{onDragStart:this.handleDragStart,draggable:!0,alt:"drag layer",src:function(t,e,n,r){var o=!(4<arguments.length&&void 0!==arguments[4])||arguments[4];return'data:image/svg+xml;charset=UTF-8,<svg width="'.concat(t,'px" height="').concat(e,'px" viewBox="0 0 ').concat(t," ").concat(e,'" version="1.1" xmlns="http://www.w3.org/2000/svg"><rect stroke="none" fill="none" id=\'__magic:FC_').concat(n,",").concat(r,'\' x="0" y="0" width="').concat(t,'" height="').concat(e,'" />\n ').concat(o?'<g id="loading" transform="translate('.concat(t/2-27,", ").concat(e/2-25,')" fill="#5A5A5A" opacity="0.5">\n <text id="text" font-family="PingFangSC-Regular, PingFang SC" font-size="16" font-weight="normal">\n <tspan x="0" y="45">Loading</tspan>\n </text>\n <g id="icon" transform="translate(18.000000, 0.000000)" fill-rule="nonzero">\n <path d="M14.3390969,12.0749978 C14.3390969,12.1289011 14.3881236,12.1779078 14.441947,12.1779078 C14.4957704,12.1779078 14.5447771,12.1289011 14.5447771,12.0749978 C14.5447771,12.0211744 14.4958303,11.9720678 14.441947,11.9720678 C14.3881636,11.9720478 14.3390969,12.0211544 14.3390969,12.0749978 M12.0693204,14.4193036 C12.0693204,14.4730071 12.0913854,14.5262309 12.1292396,14.5641052 C12.1670739,14.6019994 12.2202777,14.6240644 12.2737813,14.6240644 C12.3274249,14.6240644 12.3805887,14.6019994 12.418403,14.5641052 C12.4562173,14.526211 12.4783223,14.4729671 12.4783223,14.4193036 C12.4783223,14.3657201 12.4562373,14.3124763 12.418403,14.274662 C12.3805687,14.2367678 12.3273649,14.2146828 12.2737813,14.2146828 C12.2202178,14.2146828 12.1670539,14.2367478 12.1292396,14.274662 C12.0913654,14.3124763 12.0693204,14.3657201 12.0693204,14.4193036 M9.00980084,15.626023 C9.00980084,15.7065283 9.04285836,15.7866138 9.09977965,15.8435551 C9.15666098,15.9005164 9.23664658,15.9336538 9.31709187,15.9336538 C9.39745723,15.9336538 9.47744283,15.9005164 9.53436412,15.8435551 C9.59128541,15.7866138 9.62438291,15.7065683 9.62438291,15.626023 C9.62438291,15.5455578 9.59128541,15.4654922 9.53436412,15.4085309 C9.47744283,15.3515497 9.39745723,15.3184122 9.31709187,15.3184122 C9.23664658,15.3184122 9.15666098,15.3515497 9.09977965,15.4085309 C9.04285836,15.4654922 9.00980084,15.5455378 9.00980084,15.626023 M5.71628043,15.464353 C5.71628043,15.5714801 5.76041043,15.6779677 5.83607896,15.7537962 C5.91174752,15.8295447 6.01819512,15.8736347 6.12530229,15.8736347 C6.23234949,15.8736347 6.33881709,15.8295447 6.41448564,15.7537962 C6.49025412,15.6779677 6.53430416,15.5714802 6.53430416,15.464353 C6.53430416,15.3570859 6.49025412,15.2506383 6.41448564,15.1747699 C6.33881709,15.0990414 6.23236949,15.0549514 6.12530229,15.0549514 C6.0182151,15.0549514 5.9117475,15.0990414 5.83607896,15.1747699 C5.76041043,15.2506383 5.71628043,15.3570859 5.71628043,15.464353 M2.79454721,13.9635735 C2.79454721,14.0977623 2.84970969,14.2310516 2.94444527,14.3258871 C3.03918086,14.4206827 3.17237029,14.4759251 3.30641914,14.4759251 C3.44032809,14.4759251 3.57351752,14.4206827 3.66825309,14.3258871 C3.76298867,14.2310516 3.81815115,14.0977623 3.81815115,13.9635735 C3.81815115,13.8294847 3.76298867,13.6961754 3.66825309,13.6013798 C3.5735175,13.5065643 3.44032807,13.4513218 3.30641914,13.4513218 C3.17237029,13.4513218 3.03918086,13.5065643 2.94444527,13.6013798 C2.84968971,13.6961754 2.79454721,13.8294847 2.79454721,13.9635735 M0.771023203,11.4122684 C0.771023203,11.5733788 0.837238184,11.73339 0.95100082,11.8473126 C1.06480344,11.9611951 1.22479465,12.02757 1.38562527,12.02757 C1.54657582,12.02757 1.70646711,11.9612151 1.82024973,11.8473126 C1.93401236,11.73343 2.00030729,11.5733788 2.00030729,11.4122684 C2.00030729,11.2512779 1.93403234,11.0912267 1.82024973,10.9773242 C1.70646709,10.8634416 1.54657582,10.7970667 1.38562527,10.7970667 C1.22479463,10.7970667 1.06480344,10.8634016 0.95100082,10.9773242 C0.837218184,11.0912267 0.771023203,11.2512779 0.771023203,11.4122684 M0.0117595117,8.27969855 C0.0117595117,8.46747088 0.0890069922,8.65400402 0.221576836,8.78677375 C0.35414668,8.91944354 0.540519961,8.99667102 0.728092402,8.99667102 C0.915664844,8.99667102 1.10201813,8.91944354 1.23460797,8.78677375 C1.36717781,8.65396406 1.44442529,8.4674309 1.44442529,8.27969855 C1.44442529,8.09200619 1.36717781,7.90547303 1.23460797,7.77270332 C1.10201813,7.63999355 0.915664844,7.56276607 0.728092402,7.56276607 C0.540519961,7.56276607 0.35414668,7.63999355 0.221576836,7.77270332 C0.0890269531,7.90549301 0.0117595117,8.09202617 0.0117595117,8.27969855 M0.636554648,5.16747486 C0.636554648,5.38212891 0.724814629,5.59552379 0.876551445,5.74728059 C1.02816834,5.89905738 1.24124346,5.9873973 1.45571762,5.9873973 C1.67019178,5.9873973 1.88328688,5.89905738 2.03490377,5.74728059 C2.18662061,5.59552379 2.27488059,5.38212889 2.27488059,5.16747486 C2.27488059,4.95290078 2.18662061,4.73952586 2.03490377,4.58776906 C1.88328687,4.43597229 1.67019178,4.34763236 1.45571762,4.34763236 C1.24124346,4.34763236 1.02816836,4.43597229 0.876551445,4.58776906 C0.724814629,4.73950588 0.636554648,4.95290078 0.636554648,5.16747486 M2.51094006,2.65808125 C2.51094006,2.89963699 2.61035246,3.13969375 2.78101641,3.31053758 C2.95170033,3.48136143 3.19159721,3.58083377 3.43293311,3.58083377 C3.67428898,3.58083377 3.91408592,3.48132145 4.08474986,3.31053758 C4.25545379,3.13969375 4.35482621,2.89963699 4.35482621,2.65808125 C4.35482621,2.41646555 4.25545379,2.17634883 4.08474986,2.00554498 C3.91408592,1.83470115 3.67428898,1.73524879 3.43293311,1.73524879 C3.19159721,1.73524879 2.95170035,1.83472115 2.78101641,2.00554498 C2.61035246,2.17636883 2.51094006,2.41646555 2.51094006,2.65808125 M5.2632285,1.22063871 C5.2632285,1.48887631 5.37355348,1.755515 5.56300465,1.94512605 C5.75253576,2.13485703 6.01883469,2.24522199 6.28683244,2.24522199 C6.5548302,2.24522199 6.8211491,2.13487703 7.01064025,1.94512605 C7.20019137,1.75551498 7.31053633,1.48887631 7.31053633,1.22063871 C7.31053633,0.952381133 7.20019137,0.685882344 7.01064025,0.496131367 C6.8211691,0.306520293 6.5548302,0.19605541 6.28683244,0.19605541 C6.01883469,0.19605541 5.75255574,0.306500313 5.56300465,0.496131367 C5.37355348,0.685902344 5.2632285,0.952401113 5.2632285,1.22063871 M8.35448645,1.13137941 C8.35448645,1.42653871 8.47582395,1.71987924 8.68438211,1.9285973 C8.89288033,2.13731537 9.18596104,2.2588927 9.48084053,2.2588927 C9.77583992,2.2588927 10.0689206,2.13731537 10.2773989,1.9285973 C10.4858971,1.71989922 10.6072945,1.42653871 10.6072945,1.13137941 C10.6072945,0.836200137 10.4859371,0.542859609 10.2773989,0.334061582 C10.0688607,0.125343516 9.77581994,0.00386611328 9.48084053,0.00386611328 C9.18596105,0.00386611328 8.89288033,0.125343516 8.68438211,0.334061582 C8.47582395,0.542819629 8.35448645,0.836200137 8.35448645,1.13137941 M11.184642,2.40591273 C11.184642,2.72773389 11.3170519,3.04755643 11.5443573,3.27506172 C11.7717427,3.50270691 12.0912854,3.63513687 12.4128268,3.63513687 C12.7343282,3.63513687 13.0538709,3.50270693 13.2811763,3.27506172 C13.5085617,3.04755643 13.6408917,2.72771391 13.6408917,2.40591273 C13.6408917,2.08407158 13.5085617,1.76424906 13.2811763,1.53662385 C13.0538709,1.30909857 12.7343282,1.17656869 12.4128268,1.17656869 C12.0912854,1.17656869 11.7717427,1.30909857 11.5443573,1.53662385 C11.3170519,1.76424906 11.184642,2.08407158 11.184642,2.40591273 M13.1957344,4.79996477 C13.1957344,5.1487276 13.3391968,5.49531193 13.5855493,5.74200418 C13.8319817,5.9885965 14.1782663,6.13215887 14.5267093,6.13215887 C14.8751524,6.13215887 15.2214769,5.9885765 15.4678294,5.74200418 C15.7141819,5.49531193 15.8576043,5.14872762 15.8576043,4.79996477 C15.8576043,4.45116195 15.7141819,4.10455764 15.4678294,3.85796533 C15.2214769,3.61129307 14.8751524,3.46773068 14.5267093,3.46773068 C14.1782663,3.46773068 13.8319818,3.61131305 13.5855493,3.85796533 C13.3391969,4.10455766 13.1957344,4.45118195 13.1957344,4.79996477 M13.9957104,7.90093611 C13.9957104,8.27658068 14.1501854,8.65000674 14.4156648,8.91566609 C14.6811043,9.18134543 15.0540907,9.33604023 15.4295154,9.33604023 C15.8048002,9.33604023 16.1778665,9.18134543 16.4432861,8.91566609 C16.7087256,8.65002674 16.8632405,8.27658066 16.8632405,7.90093611 C16.8632405,7.52517164 16.7087456,7.15176555 16.4432861,6.88610619 C16.1778865,6.62044684 15.8048202,6.46585197 15.4295154,6.46585197 C15.0541107,6.46585197 14.6811243,6.62044686 14.4156648,6.88610619 C14.1501654,7.15174557 13.9957104,7.52515164 13.9957104,7.90093611" id="Shape"></path>\n </g>\n </g>'):"","\n </svg>")}(0,0,r.adaptor,"group"),style:{opacity:0,position:"absolute",top:"10px",left:"10px",width:"100%",height:"calc(100% - 20px)",cursor:"pointer",zIndex:1}}))}}],[{key:"getDerivedStateFromError",value:function(){return{error:!0}}}]),e}();W.defaultProps={background:"transparent",node:{adaptor:"__test__",props:{}},onLoad:function(){},onError:function(){},onDragStart:function(){}};function Y(t){function a(){++r===s&&n()}var e=t.components,i=t.onDragStart,n=t.onLoad,c=t.onError,u=t.themeId,r=0,s=0,o=l.createElement("div",null,e.map(function(t,e){var n=t.name,r=P(n),o=S(r).filter(function(t){var e=t.node.props.size;return!e||"medium"===e});return s+=o.length,l.createElement("div",{id:"component-".concat(r.name),key:e},l.createElement("div",{style:{color:"#888",fontSize:11,padding:"0 10px",height:24,lineHeight:"22px",position:"relative",borderTop:"1px solid hsla(0,0%,53.7%,.4)",borderBottom:"1px solid hsla(0,0%,53.7%,.4)",backgroundColor:"rgba(137, 137, 137, .1)"}},n),o.map(function(t){return l.createElement(W,Object.assign({key:t.id,onDragStart:i,onError:c,themeId:u,onLoad:a},t))}))}));return 0===s&&n(),o}return{init:function(){var r=n(i.mark(function t(n,r,o){var a;return i.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D(n);case 2:return a=document.createElement("div"),document.body.appendChild(a),t.next=6,new Promise(function(t,e){c.render(l.createElement(Y,{components:n,themeId:o,onDragStart:r,onError:e,onLoad:function(){return t()}}),a)});case 6:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),findEditor:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"normal",n=P(t);if(n)return n.editor(e)},render:U,scrollTo:function(t){var e=document.getElementById("component-".concat(t));e&&window.scrollTo(0,e.offsetTop)}}}); |
138412
19
2495