/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../codemirror/dist/index.js"),n=require("../../@codemirror/state/dist/index.js"),o=require("../../@codemirror/view/dist/index.js"),r=require("../../@codemirror/commands/dist/index.js"),i=require("../../@codemirror/language/dist/index.js");var a,u,c=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[t.basicSetup]}),s=Symbol("vue-codemirror-global-config"),d=function(e){var t=new n.Compartment;return{compartment:t,run:function(o){t.get(e.state)?e.dispatch({effects:t.reconfigure(o)}):e.dispatch({effects:n.StateEffect.appendConfig.of(t.of(o))})}}},l=function(e,t){var n=d(e),o=n.compartment,r=n.run;return function(n){var i=o.get(e.state);r((null!=n?n:i!==t)?t:[])}},f={type:Boolean,default:void 0},m={autofocus:f,disabled:f,indentWithTab:f,tabSize:Number,placeholder:String,style:Object,autoDestroy:f,phrases:Object,root:Object,extensions:Array,selection:Object},p={modelValue:{type:String,default:""}},g=Object.assign(Object.assign({},m),p);(u=a||(a={})).Change="change",u.Update="update",u.Focus="focus",u.Blur="blur",u.Ready="ready",u.ModelUpdate="update:modelValue";var h={};h[a.Change]=function(e,t){return!0},h[a.Update]=function(e){return!0},h[a.Focus]=function(e){return!0},h[a.Blur]=function(e){return!0},h[a.Ready]=function(e){return!0};var v={};v[a.ModelUpdate]=h[a.Change];var b=Object.assign(Object.assign({},h),v),y=e.defineComponent({name:"VueCodemirror",props:Object.assign({},g),emits:Object.assign({},b),setup:function(t,u){var f=e.shallowRef(),m=e.shallowRef(),p=e.shallowRef(),g=Object.assign(Object.assign({},c),e.inject(s,{})),h=e.computed(function(){var n={};return Object.keys(e.toRaw(t)).forEach(function(e){var o;"modelValue"!==e&&(n[e]=null!==(o=t[e])&&void 0!==o?o:g[e])}),n});return e.onMounted(function(){var c,s;m.value=function(e){var t=e.onUpdate,r=e.onChange,i=e.onFocus,a=e.onBlur,u=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["onUpdate","onChange","onFocus","onBlur"]);return n.EditorState.create({doc:u.doc,selection:u.selection,extensions:(Array.isArray(u.extensions)?u.extensions:[u.extensions]).concat([o.EditorView.updateListener.of(function(e){t(e),e.docChanged&&r(e.state.doc.toString(),e),e.focusChanged&&(e.view.hasFocus?i(e):a(e))})])})}({doc:t.modelValue,selection:h.value.selection,extensions:null!==(c=g.extensions)&&void 0!==c?c:[],onFocus:function(e){return u.emit(a.Focus,e)},onBlur:function(e){return u.emit(a.Blur,e)},onUpdate:function(e){return u.emit(a.Update,e)},onChange:function(e,n){e!==t.modelValue&&(u.emit(a.Change,e,n),u.emit(a.ModelUpdate,e,n))}}),p.value=(s={state:m.value,parent:f.value,root:h.value.root},new o.EditorView(Object.assign({},s)));var v=function(e){var t=function(){return e.state.doc.toString()},a=d(e).run,u=l(e,[o.EditorView.editable.of(!1),n.EditorState.readOnly.of(!0)]),c=l(e,o.keymap.of([r.indentWithTab])),s=d(e).run,f=d(e).run,m=d(e).run,p=d(e).run;return{focus:function(){return e.focus()},getDoc:t,setDoc:function(n){n!==t()&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:n}})},reExtensions:a,toggleDisabled:u,toggleIndentWithTab:c,setTabSize:function(e){s([n.EditorState.tabSize.of(e),i.indentUnit.of(" ".repeat(e))])},setPhrases:function(e){f([n.EditorState.phrases.of(e)])},setPlaceholder:function(e){m(o.placeholder(e))},setStyle:function(e){void 0===e&&(e={}),p(o.EditorView.theme({"&":Object.assign({},e)}))}}}(p.value);e.watch(function(){return t.modelValue},function(e){e!==v.getDoc()&&v.setDoc(e)}),e.watch(function(){return t.extensions},function(e){return v.reExtensions(e||[])},{immediate:!0}),e.watch(function(){return h.value.disabled},function(e){return v.toggleDisabled(e)},{immediate:!0}),e.watch(function(){return h.value.indentWithTab},function(e){return v.toggleIndentWithTab(e)},{immediate:!0}),e.watch(function(){return h.value.tabSize},function(e){return v.setTabSize(e)},{immediate:!0}),e.watch(function(){return h.value.phrases},function(e){return v.setPhrases(e||{})},{immediate:!0}),e.watch(function(){return h.value.placeholder},function(e){return v.setPlaceholder(e)},{immediate:!0}),e.watch(function(){return h.value.style},function(e){return v.setStyle(e)},{immediate:!0}),h.value.autofocus&&v.focus(),u.emit(a.Ready,{state:m.value,view:p.value,container:f.value})}),e.onBeforeUnmount(function(){h.value.autoDestroy&&p.value&&function(e){e.destroy()}(p.value)}),function(){return e.h("div",{class:"v-codemirror",style:{display:"contents"},ref:f})}}}),O=y;exports.Codemirror=O,exports.DEFAULT_CONFIG=c;