import{b as z}from"./codemirror-Cveqosts.js";import{E as g,g as h,v as E,I as F,J as P,K as W,C as M,S as R}from"./@codemirror-CrrLLfm9.js";import{d as I,M as O,N as A,i as k,S as N,p as G,l as m,G as J,h as K}from"./@vue-COImUMPt.js";/*!
* VueCodemirror v6.1.1
* Copyright (c) Surmon. All rights reserved.
* Released under the MIT License.
* Surmon
*/var L=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[z]}),S=Symbol("vue-codemirror-global-config"),a,$=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 M;return{compartment:o,run:function(u){o.get(t.state)?t.dispatch({effects:o.reconfigure(u)}):t.dispatch({effects:R.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},q={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({},q),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({},L),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 G((function(){var l;f.value=$({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,U=j(e,[g.editable.of(!1),h.readOnly.of(!0)]),w=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:U,toggleIndentWithTab:w,setTabSize:function(i){D([h.tabSize.of(i),W.of(" ".repeat(i))])},setPhrases:function(i){B([h.phrases.of(i)])},setPlaceholder:function(i){T(P(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})})),J((function(){n.value.autoDestroy&&d.value&&(function(l){l.destroy()})(d.value)})),function(){return K("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)},ne={Codemirror:Y,install:Z};export{Y as T,ne as W};
