import React from"react";import ReactDOM from"react-dom";import*as renderers from"./renderers.js";import{FormComponent}from"./FormComponent.js";function refresh(e){e instanceof FormComponent&&e.forceUpdate()}function refreshForm(e,r){ReactDOM.render(React.createElement(FormComponent,{host:e,type:"form"}),r)}function releaseForm(e){ReactDOM.unmountComponentAtNode(e)}function render(e){if(e instanceof FormComponent){switch(e.props.type){case"form":return renderers.renderForm(e);case"header":return renderers.renderHeader(e);case"main":return renderers.renderMain(e);case"footer":return renderers.renderFooter(e);case"body":return renderers.renderBody(e);case"row":return renderers.renderRow(e);case"section":return renderers.element.renderSection(e,e.prepare());case"element":break;default:return}var r=e.prepare();if(null==r)return;var n=r.type;if("string"!=typeof n)return;if("Custom"===n)return e.props.host.renderCustom(e,r);if(e.elementRegistration)return React.createElement(e.elementRegistration.component,renderers.getElementProps(e,r));const t=renderers.element["render"+n];if("function"==typeof t)return t(e,r)}}function renderNone(e){if(e instanceof FormComponent)return renderers.renderNone(e)}export{refresh,refreshForm,releaseForm,render,renderNone};