import"./vue.DgHH_kY-.js";import{b as z}from"./codemirror.D8LmMR8i.js";import{E as g,g as h,v as E,I as F,J as P,K as W,S as M,C as R}from"./@codemirror.BJ94m1Be.js";import{e as I,O as A,d as k,p as J,w as m,D as K,h as L,J as O,M as N}from"./@vue.DGZX2uae.js";/*!
* VueCodemirror v6.1.1
* Copyright (c) Surmon. All rights reserved.
* Released under the MIT License.
* Surmon
*/var $=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[z]}),S=Symbol("vue-codemirror-global-config"),a,q=function(t){var o=t.onUpdate,u=t.onChange,f=t.onFocus,d=t.onBlur,c=function(n,l){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&l.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(e=Object.getOwnPropertySymbols(n);s<e.length;s++)l.indexOf(e[s])<0&&Object.prototype.propertyIsEnumerable.call(n,e[s])&&(r[e[s]]=n[e[s]])}return r}(t,["onUpdate","onChange","onFocus","onBlur"]);return h.create({doc:c.doc,selection:c.selection,extensions:(Array.isArray(c.extensions)?c.extensions:[c.extensions]).concat([g.updateListener.of(function(n){o(n),n.docChanged&&u(n.state.doc.toString(),n),n.focusChanged&&(n.view.hasFocus?f(n):d(n))})])})},v=function(t){var o=new R;return{compartment:o,run:function(u){o.get(t.state)?t.dispatch({effects:o.reconfigure(u)}):t.dispatch({effects:M.appendConfig.of(o.of(u))})}}},j=function(t,o){var u=v(t),f=u.compartment,d=u.run;return function(c){var n=f.get(t.state);d(c??n!==o?o:[])}},b={type:Boolean,default:void 0},G={autofocus:b,disabled:b,indentWithTab:b,tabSize:Number,placeholder:String,style:Object,autoDestroy:b,phrases:Object,root:Object,extensions:Array,selection:Object},H={modelValue:{type:String,default:""}},Q=Object.assign(Object.assign({},G),H);(function(t){t.Change="change",t.Update="update",t.Focus="focus",t.Blur="blur",t.Ready="ready",t.ModelUpdate="update:modelValue"})(a||(a={}));var p={};p[a.Change]=function(t,o){return!0},p[a.Update]=function(t){return!0},p[a.Focus]=function(t){return!0},p[a.Blur]=function(t){return!0},p[a.Ready]=function(t){return!0};var C={};C[a.ModelUpdate]=p[a.Change];var X=Object.assign(Object.assign({},p),C),y=I({name:"VueCodemirror",props:Object.assign({},Q),emits:Object.assign({},X),setup:function(t,o){var u=O(),f=O(),d=O(),c=Object.assign(Object.assign({},$),A(S,{})),n=k(function(){var l={};return Object.keys(N(t)).forEach(function(r){var e;r!=="modelValue"&&(l[r]=(e=t[r])!==null&&e!==void 0?e:c[r])}),l});return J(function(){var l;f.value=q({doc:t.modelValue,selection:n.value.selection,extensions:(l=c.extensions)!==null&&l!==void 0?l:[],onFocus:function(e){return o.emit(a.Focus,e)},onBlur:function(e){return o.emit(a.Blur,e)},onUpdate:function(e){return o.emit(a.Update,e)},onChange:function(e,s){e!==t.modelValue&&(o.emit(a.Change,e,s),o.emit(a.ModelUpdate,e,s))}}),d.value=function(e){return new g(Object.assign({},e))}({state:f.value,parent:u.value,root:n.value.root});var r=function(e){var s=function(){return e.state.doc.toString()},x=v(e).run,w=j(e,[g.editable.of(!1),h.readOnly.of(!0)]),U=j(e,E.of([F])),D=v(e).run,B=v(e).run,T=v(e).run,V=v(e).run;return{focus:function(){return e.focus()},getDoc:s,setDoc:function(i){i!==s()&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:i}})},reExtensions:x,toggleDisabled:w,toggleIndentWithTab:U,setTabSize:function(i){D([h.tabSize.of(i),P.of(" ".repeat(i))])},setPhrases:function(i){B([h.phrases.of(i)])},setPlaceholder:function(i){T(W(i))},setStyle:function(i){i===void 0&&(i={}),V(g.theme({"&":Object.assign({},i)}))}}}(d.value);m(function(){return t.modelValue},function(e){e!==r.getDoc()&&r.setDoc(e)}),m(function(){return t.extensions},function(e){return r.reExtensions(e||[])},{immediate:!0}),m(function(){return n.value.disabled},function(e){return r.toggleDisabled(e)},{immediate:!0}),m(function(){return n.value.indentWithTab},function(e){return r.toggleIndentWithTab(e)},{immediate:!0}),m(function(){return n.value.tabSize},function(e){return r.setTabSize(e)},{immediate:!0}),m(function(){return n.value.phrases},function(e){return r.setPhrases(e||{})},{immediate:!0}),m(function(){return n.value.placeholder},function(e){return r.setPlaceholder(e)},{immediate:!0}),m(function(){return n.value.style},function(e){return r.setStyle(e)},{immediate:!0}),n.value.autofocus&&r.focus(),o.emit(a.Ready,{state:f.value,view:d.value,container:u.value})}),K(function(){n.value.autoDestroy&&d.value&&function(l){l.destroy()}(d.value)}),function(){return L("div",{class:"v-codemirror",style:{display:"contents"},ref:u})}}}),Y=y,Z=function(t,o){t.component(y.name,y),t.component("Codemirror",y),function(u,f){u.provide(S,f)}(t,o)},oe={Codemirror:Y,install:Z};export{Y as T,oe as W};
