/* eslint-disable */
import './index.css'
/*! @flatjs/forge MIT https://github.com/flatjs */
import{b as r}from"../../_rollupPluginBabelHelpers-d1520900.js";import{classNames as o}from"@dimjs/utils/esm/class-names";import e from"codemirror";import"codemirror/addon/display/fullscreen.css";import"codemirror/addon/display/fullscreen.js";import"codemirror/addon/display/placeholder.js";import"codemirror/addon/edit/closebrackets.js";import"codemirror/addon/edit/closetag.js";import"codemirror/addon/edit/matchtags.js";import"codemirror/addon/edit/trailingspace.js";import"codemirror/addon/hint/javascript-hint.js";import"codemirror/addon/hint/show-hint.css";import"codemirror/addon/hint/show-hint.js";import"codemirror/addon/lint/javascript-lint.js";import"codemirror/addon/lint/json-lint.js";import"codemirror/addon/lint/lint.css";import"codemirror/addon/lint/lint.js";import"codemirror/addon/scroll/simplescrollbars.css";import"codemirror/addon/scroll/simplescrollbars.js";import"codemirror/addon/selection/active-line.js";import"codemirror/keymap/sublime.js";import"codemirror/lib/codemirror.css";import"codemirror/mode/javascript/javascript.js";import t from"js-beautify";import{r as i,j as s}from"../../jsx-runtime-51c674dd.js";var a={keyMap:"sublime",tabSize:2,mode:{name:"javascript",json:true},scrollbarStyle:"simple",lint:true,styleActiveLine:true,lineNumbers:true,showTrailingSpace:true,autoCloseBrackets:true,autoCloseTags:true,matchTags:{bothTags:true},placeholder:"",gutters:["CodeMirror-lint-markers"],extraKeys:{Esc:function r(o){o.setOption("fullScreen",!o.getOption("fullScreen"))}}};var n={indent_size:2,space_in_empty_paren:true};var c=function c(l){var d=l.options,m=l.size,u=l.onChange,p=l.autoFocus,f=l.onScroll;var j=i.exports.useState(),v=j[0],h=j[1];var x=i.exports.useRef(null);var g=o("ReactCodeMirror",l.className);i.exports.useEffect((function(){var o;if(x.current){o=e.fromTextArea(x.current,r({},a,d));if(m){var t;(t=o).setSize.apply(t,m)}if(p){o.focus()}}h(o);return function(){var r;(r=o)==null?void 0:r.toTextArea()}}),[d,p,m]);var b=i.exports.useCallback((function(r,o){if(u&&o.origin!=="setValue"){u(r.getValue(),o)}}),[u]);var y=i.exports.useCallback((function(r){f&&f(r.getScrollInfo())}),[f]);var S=t(l.defaultValue||l.value||"",n);i.exports.useEffect((function(){if(v){v.setValue(S);v.focus()}}),[v,S]);i.exports.useEffect((function(){if(v){v.on("change",b);v.on("scroll",y)}return function(){if(v){v.off("change",b);v.off("scroll",y)}}}),[b,v,y]);return s.exports.jsx("div",{className:g,children:s.exports.jsx("textarea",{ref:x,autoFocus:l.autoFocus,name:l.name,defaultValue:l.value,autoComplete:"off"})})};export{c as CodeMirror};
//# sourceMappingURL=index.js.map
