Liferay.Loader.define("fragment-web$codemirror@5.65.2/addon/display/panel",["module","exports","require","../../lib/codemirror"],(function(e,t,i){var n,r=void 0;window;n=function(e){function Panel(e,t,i,n){this.cm=e,this.node=t,this.options=i,this.height=n,this.cleared=!1}function isAtTop(e,t){for(var i=t.nextSibling;i;i=i.nextSibling)if(i==e.getWrapperElement())return!0;return!1}e.defineExtension("addPanel",(function(e,t){t=t||{},this.state.panels||function initPanels(e){var t=e.getWrapperElement(),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n=parseInt(i.height),r=e.state.panels={setHeight:t.style.height,panels:[],wrapper:document.createElement("div")},o=e.hasFocus(),s=e.getScrollInfo();t.parentNode.insertBefore(r.wrapper,t),r.wrapper.appendChild(t),e.scrollTo(s.left,s.top),o&&e.focus(),e._setSize=e.setSize,null!=n&&(e.setSize=function(t,i){if(i||(i=r.wrapper.offsetHeight),r.setHeight=i,"number"!=typeof i){var o=/^(\d+\.?\d*)px$/.exec(i);o?i=Number(o[1]):(r.wrapper.style.height=i,i=r.wrapper.offsetHeight)}var s=i-r.panels.map((function(e){return e.node.getBoundingClientRect().height})).reduce((function(e,t){return e+t}),0);e._setSize(t,s),n=i})}(this);var i=this.state.panels,n=i.wrapper,r=this.getWrapperElement(),o=t.replace instanceof Panel&&!t.replace.cleared;t.after instanceof Panel&&!t.after.cleared?n.insertBefore(e,t.before.node.nextSibling):t.before instanceof Panel&&!t.before.cleared?n.insertBefore(e,t.before.node):o?(n.insertBefore(e,t.replace.node),t.replace.clear(!0)):"bottom"==t.position?n.appendChild(e):"before-bottom"==t.position?n.insertBefore(e,r.nextSibling):"after-top"==t.position?n.insertBefore(e,r):n.insertBefore(e,n.firstChild);var s=t&&t.height||e.offsetHeight,l=new Panel(this,e,t,s);return i.panels.push(l),this.setSize(),t.stable&&isAtTop(this,e)&&this.scrollTo(null,this.getScrollInfo().top+s),l})),Panel.prototype.clear=function(e){if(!this.cleared){this.cleared=!0;var t=this.cm.state.panels;t.panels.splice(t.panels.indexOf(this),1),this.cm.setSize(),this.options.stable&&isAtTop(this.cm,this.node)&&this.cm.scrollTo(null,this.cm.getScrollInfo().top-this.height),t.wrapper.removeChild(this.node),0!=t.panels.length||e||function removePanels(e){var t=e.state.panels;e.state.panels=null;var i=e.getWrapperElement(),n=e.hasFocus(),r=e.getScrollInfo();t.wrapper.parentNode.replaceChild(i,t.wrapper),e.scrollTo(r.left,r.top),n&&e.focus(),i.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}(this.cm)}},Panel.prototype.changed=function(){this.height=this.node.getBoundingClientRect().height,this.cm.setSize()}},"object"==typeof t&&"object"==typeof e?n(i("../../lib/codemirror")):"function"==typeof r&&r.amd?r(["../../lib/codemirror"],n):n(CodeMirror)}));
//# sourceMappingURL=panel.js.map