unione-form-vue 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(J,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],K):(J=typeof globalThis<"u"?globalThis:J||self,K(J.index={},J.UnioneBaseVue,J.Vue,J.antDesignVue,J.lodashEs,J.vueCodemirror,J.langJavascript,J.iconsVue,J.uuid))})(this,function(J,K,n,G,na,Lt,la,We,sa){"use strict";const oa={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},Ji=n.ref(oa);function Ae(a){return a&&(Ji.value=K.utils.obj.ext(Ji.value,a)),Ji.value}const aa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ra={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},da=n.ref([aa,ra]);function ca(a,e){return K.locales.loadLanguage(a,()=>new Promise((t,i)=>{const l=da.value.filter(s=>s.localeName==a);if(e)if(typeof e=="function")e().then(s=>{if(l.length==0){const o={...s,localeName:a};t(o)}else{const o={...l[0],...s};t(o)}});else if(l.length==0){const s={...e,localeName:a};t(s)}else{const s={...l[0],...e};t(s)}else l.length>0?t(l[0]):i("local language not defined ,lang:"+a)}))}const Zi={...K.locales};Zi.loadLanguage=ca;class ha{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=n.ref(e),this.$pid=n.ref(""),this.$store=n.ref({}),this.$forms=n.ref({}),this.$params=n.ref({}),this.$refObj=n.ref({}),this.$refData=n.ref({}),this.$model=t}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const t in this.$store.value)this.$store.value[t].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,i){}use(e,t,i){let l=this.$store.value[e];return l||(l=new en(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,t,i){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(s=>{i&&i(s)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class en{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,i){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=t,this.$data=n.ref(t=="form"?{}:[]),this.$dialog=K.useDialog(),this.$model=i||n.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}$processParams(e,t){if(t)t.forEach(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}find(e){const t=this.$store.controller+"/find";return this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e.body=this.$processParams(e.body,this.$store.findParams),new Promise((i,l)=>{const s=G.message.loading("数据加载中...");K.axios.form({url:t,method:"post",data:e}).then(o=>{o.success?(this.$data.value=o.body,i(o)):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:o})}).finally(()=>{s()})})}save(e){const t=this.$store.controller+"/save";return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((i,l)=>{const s=G.message.loading("数据提交中...");K.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(o=>{o.success?(this.$type=="form"&&(this.$data.value=o.body||{}),o.silence||G.message.success(o.message),i(o)):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:o})}).finally(()=>{s()})})}loadByIds(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/loadByIds";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(o=>{o.success?t(o):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:o})}).finally(()=>{l()})})}detail(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/detail";K.axios.form({url:s,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(o=>{o.success?(this.$type=="form"&&(this.$data.value=o.body),t(o)):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,err:o})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=G.message.loading("数据处理中..."),s=this.$store.controller+"/delete";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(o=>{o.success?t(o):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,err:o})}).finally(()=>{l()})}})})}}class fa{$event;$onces;$delayEmit;constructor(){this.$event=n.ref({}),this.$onces=n.ref({}),this.$delayEmit=n.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];t(i)}}$emit(e,t){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(t)}this.$event.value[e]?this.$event.value[e](t):(this.$delayEmit.value[e]=t,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,t){this.$onces.value[e]=t}$off(e){delete this.$event.value[e]}}class wt{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=n.ref("run"),this.type=n.ref(e.types||"setting"),this.define=n.ref(e),this.ebus=new fa,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ha(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=K.useDialog(),this.loadConfig(t)}sn(){return this.define.value.sn}load(e,t){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",t),t&&t.configs&&(this.define.value=t,this.type.value=this.define.value.types||"setting",this.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}K.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):t&&t.configs&&(this.define.value=t,this.loadConfig(t.configs))})}save(){return new Promise((e,t)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),t();return}this.$axiosProccess.value.save=!0;const i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),K.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(s=>{this.$axiosProccess.value.save=!1,s.success?(G.message.success(s.message),this.define.value=s.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(s.body)):(this.$dialog.error({content:s.message}),t())}).catch(s=>{console.error("页面配置保存失败",s),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,t){if(t){const i={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(t=>{t.wid||(t.wid="w:"+na.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ua={class:"widget-setting-dialog"},pa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(a,{emit:e}){const t=e,i=n.ref(),l=n.ref(!1);function s(){i.value&&(l.value=!0),t("setting")}function o(){t("saving"),l.value=!1}return(r,d)=>{const h=n.resolveComponent("SettingOutlined"),c=n.resolveComponent("a-tooltip"),f=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",a.model])},[n.createVNode(c,{title:a.settingTitle},{default:n.withCtx(()=>[a.model=="edit"&&(r.$slots["widget-setting"]||a.custome)?(n.openBlock(),n.createBlock(h,{key:0,class:"widget-setting",onClick:s})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),a.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(f,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:i,open:l.value,"onUpdate:open":d[0]||(d[0]=u=>l.value=u),centered:"",width:"80%",onOk:o},{default:n.withCtx(()=>[n.createElementVNode("div",ua,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),Z=(a,e)=>{const t=a.__vccOpts||a;for(const[i,l]of e)t[i]=l;return t},rt=Z(pa,[["__scopeId","data-v-3a88c0c0"]]),ma={key:0},ga=["onClick"],ci=Z(n.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const t=a,i=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),s={mounted:k=>k.focus()},o=n.ref({});function r(){const k=Object.keys(o.value);if(k.length)for(let m in k){const N=g.value.form.action.params[m];N&&o.value[m]&&Object.keys(o.value[m]).forEach(_=>{N[_]=o.value[m][_]})}o.value={}}function d(k,m,N){r();const _={};_[N]=m[N]||"",N=="showIndex"&&(_[N]=m.show?.query?.index),o.value[k]=_}function h(k,m,N){if(!m||!N){o.value={};return}const _=o.value[k][N];m[N]=_,o.value={}}function c(){g.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const u=n.ref(""),p=n.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,m)=>u.value!=m&&t.preset.includes(m)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=n.ref([la.javascript()]),g=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),v=n.ref();function x(k,m,N={}){k=JSON.parse(JSON.stringify(k)),k.event||(k.event={}),k.props||(k.props={}),k.action||(k.action={}),Object.keys(k.action).includes("maskClosable")||(k.action.maskClosable=!0),k.action.params||(k.action.params=[]),u.value=k.name,g.value.form=k,g.value.helps=N,g.value.visible=!0,v.value=m}const w=n.ref(null);function O(){w.value&&w.value.validate().then(()=>{g.value.visible=!1,v.value(g.value.form)})}return e({open:x,close}),(k,m)=>{const N=n.resolveComponent("a-input"),_=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-select"),y=n.resolveComponent("a-input-number"),B=n.resolveComponent("a-checkbox"),M=n.resolveComponent("a-tab-pane"),V=n.resolveComponent("a-switch"),F=n.resolveComponent("a-button"),I=n.resolveComponent("a-divider"),D=n.resolveComponent("ToolOutlined"),q=n.resolveComponent("a-tooltip"),R=n.resolveComponent("a-table"),T=n.resolveComponent("a-tabs"),P=n.resolveComponent("a-form"),A=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock(A,{visible:g.value.visible,"onUpdate:visible":m[23]||(m[23]=S=>g.value.visible=S),title:g.value.title,centered:"",width:"50%",onOk:O},{default:n.withCtx(()=>[n.createVNode(P,{name:"basic",ref_key:"form",ref:w,rules:p.value,model:g.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(T,null,{default:n.withCtx(()=>[n.createVNode(M,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.form.title,"onUpdate:value":m[0]||(m[0]=S=>g.value.form.title=S)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.form.name,"onUpdate:value":m[1]||(m[1]=S=>g.value.form.name=S),disabled:t.preset.includes(g.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(_,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.form.icon,"onUpdate:value":m[2]||(m[2]=S=>g.value.form.icon=S)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.type,"onUpdate:value":m[3]||(m[3]=S=>g.value.form.type=S),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(y,{value:g.value.form.index,"onUpdate:value":m[4]||(m[4]=S=>g.value.form.index=S)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.size,"onUpdate:value":m[5]||(m[5]=S=>g.value.form.size=S),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(B,{checked:g.value.form.props.block,"onUpdate:checked":m[6]||(m[6]=S=>g.value.form.props.block=S)},{default:n.withCtx(()=>m[24]||(m[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:g.value.form.props.danger,"onUpdate:checked":m[7]||(m[7]=S=>g.value.form.props.danger=S)},{default:n.withCtx(()=>m[25]||(m[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:g.value.form.props.ghost,"onUpdate:checked":m[8]||(m[8]=S=>g.value.form.props.ghost=S)},{default:n.withCtx(()=>m[26]||(m[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(M,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.action.type,"onUpdate:value":m[9]||(m[9]=S=>g.value.form.action.type=S),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.form.action.psn,"onUpdate:value":m[10]||(m[10]=S=>g.value.form.action.psn=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.form.action.component,"onUpdate:value":m[11]||(m[11]=S=>g.value.form.action.component=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(_,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.form.action.href,"onUpdate:value":m[12]||(m[12]=S=>g.value.form.action.href=S)},null,8,["value"])]),_:1}),["link","route"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.action.target,"onUpdate:value":m[13]||(m[13]=S=>g.value.form.action.target=S),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.action.position,"onUpdate:value":m[14]||(m[14]=S=>g.value.form.action.position=S),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.form.action.title,"onUpdate:value":m[15]||(m[15]=S=>g.value.form.action.title=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(V,{checked:g.value.form.action.maskClosable,"onUpdate:checked":m[16]||(m[16]=S=>g.value.form.action.maskClosable=S),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(y,{value:g.value.form.action.width,"onUpdate:value":m[17]||(m[17]=S=>g.value.form.action.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(y,{value:g.value.form.action.height,"onUpdate:value":m[18]||(m[18]=S=>g.value.form.action.height=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(I,{orientation:"left"},{default:n.withCtx(()=>[m[29]||(m[29]=n.createTextVNode("参数列表 ")),n.createVNode(F,{size:"small",class:"param-btn",onClick:c},{default:n.withCtx(()=>m[27]||(m[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(F,{size:"small",class:"param-btn",danger:"",onClick:f},{default:n.withCtx(()=>m[28]||(m[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode(R,{columns:i.value,"data-source":g.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["name","title"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",ma,[n.createVNode(D),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),["value"].includes(S.key)?(n.openBlock(),n.createBlock(q,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(D),n.createTextVNode(" "+n.toDisplayString(S.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:U,record:E,index:$})=>[["name","title","value"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!o.value[$]||!Object.keys(o.value[$]).includes(S.dataIndex))&&!U&&"empty"]),onClick:ae=>d($,E,S.dataIndex)},[o.value[$]&&Object.keys(o.value[$]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(N,{key:0,value:o.value[$][S.dataIndex],"onUpdate:value":ae=>o.value[$][S.dataIndex]=ae,onBlur:ae=>h($,E,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(U),1)],64))],10,ga)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(M,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"点击事件",help:g.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.clickScript,"onUpdate:modelValue":m[19]||(m[19]=S=>g.value.form.event.clickScript=S),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"禁用逻辑",help:g.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.disableScript,"onUpdate:modelValue":m[20]||(m[20]=S=>g.value.form.event.disableScript=S),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"显示逻辑",help:g.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.visibleScript,"onUpdate:modelValue":m[21]||(m[21]=S=>g.value.form.event.visibleScript=S),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"动态标题",help:g.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.titleScript,"onUpdate:modelValue":m[22]||(m[22]=S=>g.value.form.event.titleScript=S),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),ka=["src"],ba=["src"],ya=Z(n.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(a,{emit:e}){const t=Ae(),i=a,l=K.useSession();n.watch(()=>i.widget?.event,()=>{o()}),n.onMounted(()=>{o()});const s=n.ref({});function o(){i.widget?.event&&(i.widget.event.clickScript?s.value.click=new Function("ctx","btn","event",i.widget.event.clickScript):i.widget.event.click&&(s.value.click=i.widget.event.click),i.widget.event.disableScript?s.value.disable=new Function("ctx","btn",i.widget.event.disableScript):i.widget.event.disable&&(s.value.disable=i.widget.event.disable),i.widget.event.visibleScript?s.value.visible=new Function("ctx","btn",i.widget.event.visibleScript):i.widget.event.visible&&(s.value.visible=i.widget.event.visible),i.widget.event.titleScript?s.value.title=new Function("ctx","btn",i.widget.event.titleScript):i.widget.event.title&&(s.value.title=i.widget.event.title)),typeof i.widget.click=="function"&&(s.value.click=i.widget.click),typeof i.widget.title=="function"&&(s.value.title=i.widget.title),typeof i.widget.visible=="function"&&(s.value.visible=i.widget.visible),typeof i.widget.disabled=="function"&&(s.value.disable=i.widget.disabled)}const r=n.computed(()=>s.value.title?s.value.title(u.value,i.widget):i.widget.title),d=n.computed(()=>s.value.visible?s.value.visible(u.value,i.widget)!=!1:!0),h=n.computed(()=>i.disabled?!0:s.value.disable?s.value.disable(u.value,i.widget):!1),c=n.ref(null);function f(){c.value?.open(i.widget,O=>{console.log("btn props",O),Object.keys(O).forEach(k=>{i.widget[k]=O[k]}),console.log("props btn",i.widget)})}const u=n.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),p=n.ref({open:!1}),b=n.computed(()=>{if(i.widget.action?.href){let O=i.widget.action.href;const k=O.matchAll("{[a-zA-Z.]*}"),m=[];let N=null;for(;N=k.next();){if(N&&N.value&&N.value[0]){let _=N.value[0].substring(1,N.value[0].length-1);m.includes(_)||m.push(_)}if(N.done)break}if(m.length>0)for(let _=0;_<m.length;_++){let C=m[_],y=K.utils.obj.getValue(u.value,C);y?y instanceof Object?O=O.replaceAll("{"+C+"}",JSON.stringify(y)):Array.isArray(y)?O=O.replaceAll("{"+C+"}",y.join(",")):O=O.replaceAll("{"+C+"}",y):O=O.replaceAll("{"+C+"}","")}return O}return""}),g=n.computed(()=>{const O={};let k=i.widget.action?.href||i.widget.action?.link;if(k){const m=k.matchAll("{[a-zA-Z0-9.]*}"),N=[];let _=null;for(;_=m.next();){if(_&&_.value&&_.value[0]){let y=_.value[0].substring(1,_.value[0].length-1);N.includes(y)||N.push(y)}if(_.done)break}if(N.length>0)for(let y=0;y<N.length;y++){let B=N[y],M=K.utils.obj.getValue(u.value,B);M?M instanceof Object?k=k.replaceAll("{"+B+"}",JSON.stringify(M)):Array.isArray(M)?k=k.replaceAll("{"+B+"}",M.join(",")):k=k.replaceAll("{"+B+"}",M):k=k.replaceAll("{"+B+"}","")}const C=k.split("?")[1];C&&C.split("&").forEach(y=>{const B=y.split("=");B[0]&&B[1]&&(O[B[0]]=B[1])})}return i.widget.action?.params&&i.widget.action.params.filter(m=>m.value+"").forEach(m=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(m.value)){let _=K.utils.obj.getValue(u.value,m.value);O[m.name]=_}else O[m.name]=m.value}),O}),v=e,x=n.inject("router");function w(O){if(t.isDebug&&console.log("unione btn click",i.widget,O),!(s.value.click&&s.value.click(u.value,i.widget,O)==!1)){if(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog")p.value.open=!0;else if(i.widget.action?.type=="route"&&(i.widget.action?.href||i.widget.action?.link)){if(i.widget.action.link&&i.editor?.type.value=="code")return;x.push({path:i.widget.action.href||i.widget.action?.link,query:g.value})}v("click",{btn:i.widget,event:O})}}return(O,k)=>{const m=n.resolveComponent("a-button"),N=n.resolveComponent("a-drawer"),_=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(rt,{key:0,class:n.normalizeClass(["unione-btn",a.widget.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:f,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[n.createVNode(m,n.mergeProps({disabled:h.value,size:a.widget.size||"small",type:a.type||a.widget.type,shape:a.widget.shape,class:"unione-btn-"+a.widget.name,loading:a.widget.loading,target:a.widget.action?.target,title:a.widget.tooltip,onClick:w},a.widget.props),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value)+" ",1)]),_:2},[a.widget.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"]),a.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(N,{key:0,open:p.value.open,"onUpdate:open":k[0]||(k[0]=C=>p.value.open=C),title:a.widget.action?.title,placement:a.widget.action?.position,maskClosable:a.widget.action?.maskClosable,width:a.widget.action?.width,bodyStyle:{padding:0,overflow:!a.widget.action.component||a.widget.action.component=="iframe"?"hidden":"auto"}},{default:n.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value},null,8,ka)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),a.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(_,{key:1,open:p.value.open,"onUpdate:open":k[1]||(k[1]=C=>p.value.open=C),title:a.widget.action?.title,width:a.widget.action?.width,maskClosable:a.widget.action?.maskClosable,centered:"",footer:null},{default:n.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value,style:n.normalizeStyle({height:a.widget.action?.height?a.widget.action?.height+"px":""})},null,12,ba)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(ci,{ref_key:"btnSetting",ref:c,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-ea6fa089"]]),wa={key:0,class:"unione-widget-empty-tip"},xa=Z(n.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(a){const e=a,t=n.ref(),i=n.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,s)=>{const o=n.resolveComponent("a-tab-pane"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:n.withCtx(()=>[i.value?(n.openBlock(),n.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":s[0]||(s[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,h)=>(n.openBlock(),n.createBlock(o,{key:h,class:"unione-layout-tab-pane"},{tab:n.withCtx(()=>[n.createElementVNode("span",null,[d.icon?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.icon),{key:0})):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d.title),1)])]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.chidlren,(c,f)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(c.widget),{key:f,wid:c.wid,editor:e.editor,widget:c},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",wa,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),va={class:"title"},Ca={class:"text"},Sa={key:0,class:"reactive"},Na={key:1,class:"opts"},Ba={class:"warp"},Oa=Z(n.defineComponent({__name:"section",props:n.mergeModels({title:{type:String,required:!1},icon:{type:String,required:!1},type:{type:String,required:!1},location:{type:String,default:"left"},reactive:{type:Boolean,default:!1},wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},{modelValue:{type:Boolean,default:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=n.computed(()=>e.editor?.widget(e.wid)||e.widget),i=n.computed(()=>t.value?.title||e.title),l=n.computed(()=>t.value?.icon||e.icon),s=n.computed(()=>t.value?.type||e.type),o=n.useModel(a,"modelValue");function r(){e.reactive&&(o.value=!o.value)}return(d,h)=>(n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-section",o.value?"open":"close"]),model:e.editor?.model},{default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[n.createElementVNode("div",va,[s.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",s.value])},null,2)):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",Ca,n.toDisplayString(i.value),1)]),a.reactive?(n.openBlock(),n.createElementBlock("div",Sa,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),a.location=="left"?(n.openBlock(),n.createElementBlock("div",Na,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Ba,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,o.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Va={class:"unione-props-setting unione-form-setting"},_a={class:"unione-form-btns"},Ma={key:0},Ta=["onClick"],Aa={class:"field-txt"},Ea=["onClick"],Ia={key:1,class:"field-txt"},Da=["onClick"],Pa={key:0,class:"field-txt"},Fa={key:3,class:"edit-field"},$a={key:0},Ra=["onClick"],La=Z(n.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.settings||(C.configs.settings={}),C.configs.settings.btns||(C.configs.settings.btns=[]),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(y=>({value:y.sn,label:y.title+"("+y.name+")"}))),s=n.computed(()=>{const C=i.value.configs.settings.btns,y=C.map(B=>B.name);if(!y.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(B.index,0,B)}if(!y.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let M=B.index||1;C.splice(M,0,B)}if(!y.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(B.index,0,B)}if(!y.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};C.splice(B.index,0,B)}return C}),o=n.ref(null);function r(C){o.value&&o.value.open(C,y=>{y.visible=!0,Object.keys(y).forEach(B=>{C[B]=y[B]}),i.value.configs.settings.btns.sort((B,M)=>{const V=B.index||1,F=M.index||1;return V-F}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const C=i.value.configs.settings.btns.length+1;let y={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};y.name="new_"+i.value.configs.settings.btns.length;const B=i.value.configs.settings.btns.filter(M=>M.name==y.name).length;B>0&&(y.name=y.name+B),i.value.configs.settings.btns.push(y),e.editor.widget(e.wid,i.value),o.value.open(y,M=>{Object.keys(M).forEach(V=>{y[V]=M[V]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(C){const y=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const B=[];i.value.configs.settings.btns.forEach(M=>{M.name!=C.name&&B.push(M)}),i.value.configs.settings.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{y()}})}const c=n.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:C=>{const y=c.value.widgets.filter(B=>B.value==C);return y[0]?y[0].label:C},toSetting:()=>{}}),f=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let y="";return C.rules&&(y=C.rules.filter(B=>B.enable).length||""),y&&(y="("+y+")"),y},toSetting:()=>{const C=f.value.props,y={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(y.min=C.rangeMin,y.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(y.max=C.rangeMax,y.enable=!0);const B={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(B.pattern=C.regExpress,B.enable=!0),f.value.field.rules=[y,B],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(C){f.value.visible=!0,f.value.field=C;const y=C.rules||[],B={trigger:"change",whitespace:!0};y.forEach(M=>{M.name=="reg"&&(B.trigger=M.trigger,B.whitespace=M.whitespace,B.regExpress=M.pattern,B.regMessage=M.message),M.name=="range"&&(B.rangeMin=M.min,B.rangeMax=M.max,B.rangeMessage=M.message)}),f.value.props=B}const p=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{p.value.visible=!1}});function b(C,y){const B=w.value.filter(V=>V.name==C.name);B.forEach(V=>{y!="isSort"?V[y]=!0:V[y]=!V[y]});const M=B[0];if(!(!M||y=="isSort")){switch(p.value.prop=y,p.value.field=C,M.show||(M.show={}),y){case"isQuery":M.show.query||(M.show.query={}),p.value.show=M.show.query,p.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":M.show.form||(M.show.form={}),p.value.show=M.show.form,p.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":M.show.view||(M.show.view={}),p.value.show=M.show.view,p.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":M.show.list||(M.show.list={}),p.value.show=M.show.list,p.value.title=`列头设置/${C.title}(${C.name})`;break}p.value.visible=!0}}const g=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{g.value.convert.options||(g.value.convert.options=[]),g.value.convert.options.push({label:"",value:""})},toDelOption:(C,y)=>{g.value.convert.options.splice(C,1)},toSetting:()=>{g.value.visible=!1}});function v(C){g.value.visible=!0,g.value.field=C,g.value.convert=C.convert||{}}const x=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),w=n.computed(()=>x.value.fields?.length?x.value.fields:[]),O={mounted:C=>C.focus()},k=n.ref({});function m(C,y){const B={};y=="convertName"?B[y]=C.convert?.type:B[y]=C[y]||"",k.value={},k.value[C.name]=B}function N(C,y){{k.value={};return}}function _(C,y){w.value.filter(M=>M.name==C.name).forEach(M=>{M[y]=!M[y]})}return(C,y)=>{const B=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),F=n.resolveComponent("PlusOutlined"),I=n.resolveComponent("a-select"),D=n.resolveComponent("ToolOutlined"),q=n.resolveComponent("a-checkbox"),R=n.resolveComponent("a-table"),T=n.resolveComponent("a-select-option"),P=n.resolveComponent("a-form-item"),A=n.resolveComponent("a-form"),S=n.resolveComponent("a-modal"),U=n.resolveComponent("a-checkbox-group"),E=n.resolveComponent("a-input-number"),$=n.resolveComponent("a-input"),ae=n.resolveComponent("a-col"),Rt=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Va,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[23]||(y[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",_a,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,j=>(n.openBlock(),n.createBlock(V,n.mergeProps({key:j.name,class:["btn",j.name,!j.visible&&"deleted"],type:j.visible?j.type:"default",size:j.size,ref_for:!0},j.props||{},{onClick:Ue=>r(j)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(j.title)+" ",1),j.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers(Ue=>h(j),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[j.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(j.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:y[0]||(y[0]=j=>d())},{default:n.withCtx(()=>[n.createVNode(F)]),_:1})]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[24]||(y[24]=[n.createTextVNode("表单设置")])),_:1}),y[36]||(y[36]=n.createTextVNode(" 数据模型:")),n.createVNode(I,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":y[1]||(y[1]=j=>i.value.dataModel=j)},null,8,["options","value"]),n.createVNode(R,{columns:t.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:j})=>[["widget","rules","convertName"].includes(j.key)?(n.openBlock(),n.createElementBlock("span",Ma,[n.createVNode(D),n.createTextVNode(" "+n.toDisplayString(j.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:j,text:Ue,record:ie})=>[["rules"].includes(j.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!f.value.showInfo(ie)&&"empty"]),onClick:xe=>u(ie)},[n.createElementVNode("span",Aa,n.toDisplayString(f.value.showInfo(ie)),1),f.value.showInfo(ie)?(n.openBlock(),n.createBlock(V,{key:0,type:"link"},{default:n.withCtx(()=>y[25]||(y[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ta)):["widget"].includes(j.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!k.value[ie.name]||!Object.keys(k.value[ie.name]).includes(j.dataIndex))&&!Ue&&"empty"]),onClick:xe=>m(ie,j.dataIndex)},[k.value[ie.name]&&Object.keys(k.value[ie.name]).includes(j.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(I,{key:0,value:ie[j.dataIndex],"onUpdate:value":xe=>ie[j.dataIndex]=xe,options:c.value.widgets,onBlur:y[2]||(y[2]=xe=>N())},null,8,["value","onUpdate:value","options"])),[[O]]):(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(c.value.widgetName(Ue)),1))],10,Ea)):["convertName"].includes(j.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!k.value[ie.name]||!Object.keys(k.value[ie.name]).includes(j.dataIndex))&&!ie.convert?.type&&"empty"]),onClick:xe=>m(ie,j.dataIndex)},[k.value[ie.name]&&Object.keys(k.value[ie.name]).includes(j.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(I,{key:0,value:ie[j.dataIndex],"onUpdate:value":xe=>ie[j.dataIndex]=xe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:y[3]||(y[3]=xe=>N())},null,8,["value","onUpdate:value"])),[[O]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[ie.convert?.type?(n.openBlock(),n.createElementBlock("span",Pa,n.toDisplayString(ie.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),ie.convert?.type?(n.openBlock(),n.createBlock(V,{key:1,type:"link",onClick:n.withModifiers(xe=>v(ie),["stop"])},{default:n.withCtx(()=>y[26]||(y[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Da)):["isForm","isView"].includes(j.dataIndex)?(n.openBlock(),n.createElementBlock("div",Fa,[n.createVNode(q,{checked:ie[j.dataIndex],onClick:xe=>_(ie,j.dataIndex)},null,8,["checked","onClick"]),n.createVNode(V,{type:"link",onClick:xe=>b(ie,j.dataIndex)},{default:n.withCtx(()=>y[27]||(y[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(S,{visible:c.value.visible,"onUpdate:visible":y[5]||(y[5]=j=>c.value.visible=j),title:"控件设置",onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:c.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[c.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(P,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(I,{value:c.value.props.mode,"onUpdate:value":y[4]||(y[4]=j=>c.value.props.mode=j),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(T,{value:"multiple"},{default:n.withCtx(()=>y[28]||(y[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(T,{value:"tags"},{default:n.withCtx(()=>y[29]||(y[29]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(S,{visible:f.value.visible,"onUpdate:visible":y[13]||(y[13]=j=>f.value.visible=j),title:"规则设置",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[30]||(y[30]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(P,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(U,{value:f.value.props.trigger,"onUpdate:value":y[6]||(y[6]=j=>f.value.props.trigger=j),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(P,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(q,{value:f.value.props.whitespace,"onUpdate:value":y[7]||(y[7]=j=>f.value.props.whitespace=j),checked:f.value.props.whitespace},{default:n.withCtx(()=>y[31]||(y[31]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[32]||(y[32]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(P,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(E,{value:f.value.props.rangeMin,"onUpdate:value":y[8]||(y[8]=j=>f.value.props.rangeMin=j)},null,8,["value"]),y[33]||(y[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(E,{value:f.value.props.rangeMax,"onUpdate:value":y[9]||(y[9]=j=>f.value.props.rangeMax=j)},null,8,["value"])]),_:1}),n.createVNode(P,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode($,{value:f.value.props.rangeMessage,"onUpdate:value":y[10]||(y[10]=j=>f.value.props.rangeMessage=j)},null,8,["value"])]),_:1}),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[34]||(y[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(P,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode($,{value:f.value.props.regExpress,"onUpdate:value":y[11]||(y[11]=j=>f.value.props.regExpress=j)},null,8,["value"])]),_:1}),n.createVNode(P,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode($,{value:f.value.props.regMessage,"onUpdate:value":y[12]||(y[12]=j=>f.value.props.regMessage=j)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(S,{visible:p.value.visible,"onUpdate:visible":y[20]||(y[20]=j=>p.value.visible=j),title:p.value.title,onOk:p.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:p.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(P,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(E,{value:p.value.show.index,"onUpdate:value":y[14]||(y[14]=j=>p.value.show.index=j)},null,8,["value"])]),_:1}),["isQuery"].includes(p.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(P,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode($,{value:p.value.show.width,"onUpdate:value":y[15]||(y[15]=j=>p.value.show.width=j)},null,8,["value"])]),_:1})),["isForm","isView"].includes(p.value.prop)?(n.openBlock(),n.createBlock(P,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode($,{value:p.value.show.labelWidth,"onUpdate:value":y[16]||(y[16]=j=>p.value.show.labelWidth=j)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(p.value.prop)?(n.openBlock(),n.createBlock(P,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode($,{value:p.value.show.valueWidth,"onUpdate:value":y[17]||(y[17]=j=>p.value.show.valueWidth=j)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(p.value.prop)?(n.openBlock(),n.createBlock(P,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(I,{value:p.value.show.fixed,"onUpdate:value":y[18]||(y[18]=j=>p.value.show.fixed=j),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(p.value.prop)?(n.openBlock(),n.createBlock(P,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(I,{value:p.value.show.align,"onUpdate:value":y[19]||(y[19]=j=>p.value.show.align=j),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(S,{visible:g.value.visible,"onUpdate:visible":y[22]||(y[22]=j=>g.value.visible=j),title:g.value.convert.type=="dict"?"字典设置":"选项设置",onOk:g.value.toSetting},{default:n.withCtx(()=>[g.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",$a,[n.createVNode(V,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:g.value.toAddOption},{default:n.withCtx(()=>y[35]||(y[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(R,{columns:g.value.optionColumn,"data-source":g.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:j,record:Ue,index:ie})=>[j.dataIndex==="label"?(n.openBlock(),n.createBlock($,{key:0,value:Ue.label,"onUpdate:value":xe=>Ue.label=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),j.dataIndex==="value"?(n.openBlock(),n.createBlock($,{key:1,value:Ue.value,"onUpdate:value":xe=>Ue.value=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),j.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:xe=>g.value.toDelOption(ie,Ue)},"删除",8,Ra)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),g.value.convert.type=="dict"?(n.openBlock(),n.createBlock(A,{key:1,model:g.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Rt,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(ae,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(P,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode($,{value:g.value.convert.dict,"onUpdate:value":y[21]||(y[21]=j=>g.value.convert.dict=j)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(ci,{ref_key:"btnSetting",ref:o},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),ja=Z(n.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(a,{expose:e}){const t=a,i=n.ref(!1),l=n.ref(),s=n.ref({}),o=n.ref(null);n.onMounted(()=>{if(t.editor&&r.value.dsn){const x=t.editor.dataManager();r.value.primary&&x.psn(r.value.dsn),o.value.setDisabled=v,o.value.getValue=f,o.value.setValue=u,o.value.reset=p,l.value=x.useForm(r.value.dsn,o.value,w=>{s.value=w.body||{}})}b()});const r=n.computed(()=>t.widget||t.form||{}),d=n.computed(()=>{let x=r.value.widgets||[];return!x.length&&t.form?.fields&&(x=t.form.fields),x.forEach(w=>{w.widget||(w.widget="unione-form-item"),w.control||(w.control="a-input")}),x}),h=n.inject("pageSetting"),c=n.computed(()=>r.value.setting||h?.form||{});n.provide("formSetting",c.value);function f(){return s.value}function u(x){s.value=x,b()}function p(){s.value={},b()}function b(){const x=w=>{w.widget=="unione-form-item"&&w.name&&w.value!=null&&w.value!=null&&w.value!=""&&(s.value[w.name]=w.value),w.widgets?.forEach(O=>{x(O)})};d.value.forEach(w=>{x(w)})}function g(){return o.value.validate()}function v(x=!0){i.value=x}return e({validate:g,getValue:f,setValue:u,reset:p,setDisabled:v}),(x,w)=>{const O=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-form-widget","setting-title":"表单设置",model:a.editor?.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(O,{ref_key:"formObj",ref:o,model:s.value,class:n.normalizeClass(["unione-form",a.editor?.model.value,"form-layout-col-"+(c.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(k,m)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(k.widget),{key:m,widget:k,editor:a.editor,value:s.value[k.name],"onUpdate:value":N=>s.value[k.name]=N,disabled:i.value,formValue:s.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[a.editor&&r.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(La,{wid:r.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-e10a94d9"]]);function bl(a,e=!1){const t=Ae();if(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),!a)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+a);return i&&e==!1?Promise.resolve(JSON.parse(i)):new Promise((l,s)=>{K.axios.admin({url:"/api/system/dict/load/"+a}).then(o=>{if(o.success){const r=o.body.filter(d=>d.dictName!=d.dictKey);r.forEach(d=>{d.value=d.dictKey,d.label=d.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+a,JSON.stringify(r)),l(r)):s("字典加载失败,dict:"+a+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+a,o),s("字典加载失败,dict:"+a+",error:"+o.message)})})}async function yl(a,e){const t=Ae();if(t.isDebug&&console.log("进入:根据获取字典选项方法,dict name:"+a+",key:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await bl(a),l=i.filter(s=>s.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function za(a,e){const t=await yl(a,e);return Promise.resolve(t.dictValue)}const wl={load:bl,getLabel:za,getOption:yl};class dt{convertObj;config;options;constructor(e){(!e||!e.types)&&console.error("转换器定义不能为空,type不能为空",e),e.valueField||(e.valueField="id"),e.labelField||(e.labelField="title"),this.convertObj=e,this.options=e.options||[],this.config=Ae()}load(e,t=!1){return this.config.isDebug&&console.log("进入:加载转换选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e+",force:"+t),!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}wl.load(this.convertObj.dictName,t).then(s=>{this.options=s,typeof e=="number"&&this.options.forEach(o=>{o.value=parseInt(o.value)}),i(this.options)})}):this.convertObj.types=="option"?(this.options=this.convertObj.options||[],this.convertObj.options?.length?Promise.resolve(this.convertObj.options):(this.config.isDebug&&console.error("静态转换器选项为空,id:"+this.convertObj.id,this.convertObj),Promise.reject("静态转换器选项为空,id:"+this.convertObj.id))):!this.convertObj.id&&this.convertObj.types!="local"?Promise.reject("转换器id不能为空,type:"+this.convertObj.types):new Promise((i,l)=>{const s=this.convertObj.params||{body:{}};this.convertObj.pidField&&(s.pid=-1);const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:o,data:s,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(d=>{d.value=parseInt(d.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(h=>h.value==e).length?i(this.options):(s.body||(s.body={}),s.body[this.convertObj.valueField]=e,K.axios.admin({url:o,data:s,method:"POST"}).then(h=>{if(h.success){const c={};this.options.forEach(f=>{c[e]=!0}),h.body.forEach(f=>{c[f.value]||this.options.push(f)}),i(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(this.config.isDebug&&console.log("进入:数据转换:value->label方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?wl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(i=>i.value==e);return t.length?Promise.resolve(t[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const t=this.options.filter(i=>i.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,i)=>{this.load(e).then(l=>{const s=l.filter(o=>o.value==e);if(s.length)return t(s[0].label);i()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((i,l)=>{const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:s,data:e,method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),this.options=[...this.options,...o.body],i(o.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,o),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+o.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){return this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.resolve(this.options.filter(t=>t.label.indexOf(e)>=0)):new Promise(t=>{const i=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(l=>{l.success?(this.$processOptions(l.body),t(l.body)):t([])})})}$processOptions(e){return this.convertObj.types=="local"&&e.forEach(t=>{this.convertObj.idField&&(t.id=t[this.convertObj.idField]),this.convertObj.pidField&&(t.pid=t[this.convertObj.pidField]),t.value=t[this.convertObj.valueField],t.label=t[this.convertObj.labelField]}),e}}const qa={key:1,class:"text-view"},Ua=Z(n.defineComponent({__name:"formItem",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.inject("formSetting");n.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(t.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?t.value=s.value.value.split(","):t.value=[s.value.value])))});const l=n.ref({}),s=n.computed(()=>{const v=e.editor?.widget(e.wid)||e.widget||{};return v.event&&Object.keys(v.event).forEach(x=>{const w=v.event[x];w&&(l.value[x]=null,typeof w=="function"?l.value[x]=w:w.enable&&w.scriptText&&(l.value[x]=new Function("value","ctx",w.scriptText)))}),v}),o=n.computed(()=>!(l.value.visible&&l.value.visible(e.formValue[s.value.name],e.formValue)==!1)),r=n.computed(()=>l.value.title&&l.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=n.computed(()=>l.value.change&&l.value.change(e.formValue[s.value.name],e.formValue)||s.value.change),h=n.ref({}),c=n.computed(()=>{const v=[],x=s.value.rule||{};if((s.value.props?.required||s.value.required)&&v.push({required:!0,whitespace:x?.whitespace||!1,trigger:x?.trigger||i.ruleTrigger||"change",validator:(w,O)=>(x?.whitespace&&O&&typeof O=="string"&&(O=O.trim()),O&&(O+"").length>0?Promise.resolve():Promise.reject(s.value.title+"不能为空!"))}),x.advance&&h.value[x.advance]){const w=h.value[x.advance];v.push({pattern:w.pattern,message:w.message||"表单验证不通过!",trigger:x.trigger||i.ruleTrigger||"change"})}return x.regExpress&&v.push({pattern:x.regExpress,message:x.regMessage||"表单验证不通过!",trigger:x.trigger||i.ruleTrigger||"change"}),s.value.dataLen&&v.push({validator:(w,O)=>O&&(O+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(O+"").length+"]"):Promise.resolve(),trigger:x?.trigger||i.ruleTrigger||"change"}),v}),f=n.computed(()=>{const v=s.value.props||{};if(s.value.control=="a-input-number"){const x=s.value.rule||{};x.rangeMin!=null&&x.rangeMin!=null&&(v.min=x.rangeMin),x.rangeMax!=null&&x.rangeMax!=null&&(v.max=x.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(v.format=s.value.view.dataFormat,v.valueFormat=s.value.view.dataFormat),s.value.required&&(v.required=s.value.required),v}),u=n.computed(()=>{const v=s.value.css||{},x=[];return v.cssName&&x.push(v.cssName),i.platform=="app"?v.cssName?typeof v.cssName=="string"&&v.cssName.indexOf("all-line")<0&&x.push("all-line"):x.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!v.cssName||typeof v.cssName=="string"&&v.cssName.indexOf("all-line")<0)&&x.push("all-line"):s.value.view.width==2&&x.push("2in-line")),x}),p=n.computed(()=>{const v=i.showColumn||3;let x=s.value.view?.labelWidth||i.labelWidth||9;return s.value.css?.cssName&&v>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(x/v)}:s.value.view?.width>=3&&v>1?{span:Math.round(x/v)}:{span:x}}),b=n.computed(()=>{const v=i.showColumn||3;let x=s.value.view?.valueWidth||i.valueWidth||19;return s.value.css?.cssName&&v>1&&u.value.includes("all-line")?{}:{span:x}}),g=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new dt(s.value.convert).convert(t.value.toString()).then(v=>{g.value=v})}),(v,x)=>{const w=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-form-item",u.value]),style:n.normalizeStyle(s.value.css?.cssText)},{default:n.withCtx(()=>[o.value?(n.openBlock(),n.createBlock(w,{key:0,label:r.value,name:s.value.name,labelCol:p.value,wrapperCol:b.value,required:s.value.props?.required,rules:c.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:n.withCtx(()=>[!a.editor||a.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value.control||"a-input"),n.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:d.value,value:t.value,"onUpdate:value":x[0]||(x[0]=O=>t.value=O)},f.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","style"])):t.value?(n.openBlock(),n.createElementBlock("div",qa,n.toDisplayString(g.value?g.value:t.value),1)):n.createCommentVNode("",!0)]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-d8a9fb47"]]);function xl(a,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{a(i)},e)}}const Wa=Z(n.defineComponent({__name:"selectBox",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){Ae();const e=a,t=n.useModel(a,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),s=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),o=xl(c=>{h.value.search(c).then(f=>{i.value=f})},500);n.onMounted(()=>{h.value.load(t.value).then(c=>{i.value=c})});const r=n.ref({}),d=n.computed(()=>{const c=e.editor?.widget(e.wid)||e.widget||{};return c.event&&Object.keys(c.event).forEach(f=>{const u=c.event[f];r.value[f]=null,u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText))}),c}),h=n.computed(()=>{const c=d.value.convert||e.convert||{};return new dt(c)});return n.watch(t,()=>{t.value&&h.value.load(t.value).then(c=>{i.value=c})}),n.watch(()=>d.value.convert||e.convert||{},()=>{h.value.load().then(c=>{i.value=c})}),(c,f)=>{const u=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(u,{class:"unione-form-select",options:l.value,showSearch:s.value,value:t.value,"onUpdate:value":f[0]||(f[0]=p=>t.value=p),onSearch:n.unref(o)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Ha=Z(n.defineComponent({__name:"switchBox",props:n.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.ref({});n.onMounted(()=>{o.value?.load(t.value).then(r=>{r.forEach(d=>{d.value&&(d.value=="1"||d.value=="true"||d.value=="TRUE")?(i.value.checkedChildren=d.label,d.value=="true"||d.value=="TRUE"?i.value.checkedValue=!0:i.value.checkedValue=1):(i.value.unCheckedChildren=d.label,d.value=="false"||d.value=="FALSE"?i.value.unCheckedValue=!1:i.value.unCheckedValue=0)})})});const l=n.ref({}),s=n.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const h=r.event[d];l.value[d]=null,h.enable&&h.scriptText&&(l.value[d]=new Function("value","ctx",h.scriptText))}),r}),o=n.computed(()=>{const r=s.value.convert||e.convert;return r?new dt(r):null});return(r,d)=>{const h=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(h,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=c=>t.value=c)}),null,16,["checked"])}}}),[["__scopeId","data-v-a56d945e"]]),Ka=Z(n.defineComponent({__name:"radioBox",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||o.value.value).then(d=>{i.value=d})});const s=n.ref({}),o=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const c=d.event[h];s.value[h]=null,c.enable&&c.scriptText&&(s.value[h]=new Function("value","ctx",c.scriptText))}),d}),r=n.computed(()=>{const d=o.value.convert||e.convert||{};return new dt(d)});return(d,h)=>{const c=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(c,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Qa=Z(n.defineComponent({__name:"checkBox",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||o.value.value).then(d=>{i.value=d})});const s=n.ref({}),o=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const c=d.event[h];s.value[h]=null,c.enable&&c.scriptText&&(s.value[h]=new Function("value","ctx",c.scriptText))}),d}),r=n.computed(()=>{const d=o.value.convert||e.convert||{};return new dt(d)});return(d,h)=>{const c=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(c,{class:"unione-form-checkbox",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Ga=Z(n.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=n.ref(),t=n.useModel(a,"value");return n.watch(()=>e.value,()=>{e.value?t.value=K.utils.sm2Encrypt(e.value):t.value=""}),(i,l)=>{const s=n.resolveComponent("a-input-password");return n.openBlock(),n.createBlock(s,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=o=>e.value=o)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]),Ya={class:"unione-props-setting unione-query-setting"},Xa={class:"unione-query-opts"},Ja={key:0},Za=["onClick"],er={key:1},tr={key:1,class:"edit-field"},ir=["onClick"],nr=Z(n.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:O})=>O+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),i=n.computed(()=>{const O=e.editor.widget(e.wid)||{};return O.configs||(O.configs={}),O.configs.btns||(O.configs.btns=[]),O}),l=n.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),s=n.computed(()=>{const O=[],k=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(m=>{O.push(m),k.push(m.name)}),k.includes("query")||O.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||O.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||O.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),O.sort((m,N)=>{const _=m.index||1,C=N.index||1;return _-C}),O}),o=n.ref(null);function r(O){o.value&&o.value.open(O,k=>{k.visible=!0,Object.keys(k).forEach(m=>{O[m]=k[m]}),i.value.configs.btns.sort((m,N)=>{const _=m.index||1,C=N.index||1;return _-C}),i.value.configs.btns=[...i.value.configs.btns]})}function d(){const O=i.value.configs.btns.length+1;let k={title:"新增",name:"new_"+O,size:"default",index:O,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(k),e.editor.widget(e.wid,i.value),o.value.open(k,m=>{Object.keys(m).forEach(N=>{k[N]=m[N]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(O){const k=()=>{if(["query","reset","advanced"].includes(O.name))O.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const m=[];i.value.configs.btns.forEach(N=>{N.name!=O.name&&m.push(N)}),i.value.configs.btns=m}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const c=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=n.computed(()=>c.value.fields?.length?c.value.fields:[]),u={mounted:O=>O.focus()},p=n.ref({});function b(){const O=Object.keys(p.value);if(O.length)for(let k in O){const m=f.value.filter(N=>N.name==k);if(m&&m[0]){let N=p.value[k];Object.keys(N).forEach(_=>{if(_=="showIndex"){const C=m[0].show?.query||{};m[0].show||(m[0].show={}),m[0].show.query={...C,index:N[_]}}else m[0][_]=N[_]})}}p.value={}}function g(O,k){b();const m={};m[k]=O[k]||"",k=="showIndex"&&(m[k]=O.show?.query?.index),p.value[O.name]=m}function v(O,k){if(!O||!k){p.value={};return}const m=p.value[O.name][k];if(k=="showIndex"){const N=O.show?.query||{};O.show||(O.show={}),O.show.query={...N,index:m}}else O[k]=m;p.value={}}function x(O,k){f.value.filter(N=>N.name==O.name).forEach(N=>{N[k]=!N[k]})}const w=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:O=>{const k=w.value.options.filter(m=>m.value==O);return k[0]?k[0].label:O}});return(O,k)=>{const m=n.resolveComponent("a-divider"),N=n.resolveComponent("CloseOutlined"),_=n.resolveComponent("a-button"),C=n.resolveComponent("PlusOutlined"),y=n.resolveComponent("a-select"),B=n.resolveComponent("ToolOutlined"),M=n.resolveComponent("a-checkbox"),V=n.resolveComponent("a-input-number"),F=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Ya,[n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>k[3]||(k[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Xa,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,I=>(n.openBlock(),n.createBlock(_,n.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size||"default",ref_for:!0},I.props||{},{onClick:D=>r(I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(N,{key:0,class:"btn-del",onClick:n.withModifiers(D=>h(I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(_,{class:n.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=I=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(C)]),_:1})]),n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>k[4]||(k[4]=[n.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=n.createTextVNode(" 数据模型:")),n.createVNode(y,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":k[1]||(k[1]=I=>i.value.dataModel=I)},null,8,["options","value"]),n.createVNode(F,{columns:t.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:I})=>[["showIndex","queryType"].includes(I.key)?(n.openBlock(),n.createElementBlock("span",Ja,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(I.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:I,text:D,record:q})=>[["queryType"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!p.value[q.name]||!Object.keys(p.value[q.name]).includes(I.dataIndex))&&!D&&"empty"]),onClick:R=>g(q,I.dataIndex)},[p.value[q.name]&&Object.keys(p.value[q.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(y,{key:0,value:q[I.dataIndex],"onUpdate:value":R=>q[I.dataIndex]=R,allowClear:!0,options:w.value.options,onBlur:k[2]||(k[2]=R=>v())},null,8,["value","onUpdate:value","options"])),[[u]]):(n.openBlock(),n.createElementBlock("span",er,n.toDisplayString(w.value.showLabel(D)),1))],10,Za)):["isQuery"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",tr,[n.createVNode(M,{checked:q[I.dataIndex],onClick:R=>x(q,I.dataIndex)},null,8,["checked","onClick"])])):I.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!p.value[q.name]||!Object.keys(p.value[q.name]).includes(I.dataIndex))&&!D&&"empty"]),onClick:R=>g(q,I.dataIndex)},[p.value[q.name]&&Object.keys(p.value[q.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(V,{key:0,value:p.value[q.name][I.dataIndex],"onUpdate:value":R=>p.value[q.name][I.dataIndex]=R,onBlur:R=>v(q,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(q.show?.query?.index||" "),1)],64))],10,ir)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:o},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),lr={class:"query-btn"},sr={class:"btn-advanced-overlay"},vl=Z(n.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},emits:["query","reset","btnClick"],setup(a,{emit:e}){const t=a,i=n.computed(()=>{const g=t.editor?.widget(t.wid)||t.widget||{};return g.btns||(g.btns=[]),g}),l=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),s=n.computed(()=>{let g=[];return i.value.fields?.length&&(g=i.value.fields),g.sort((v,x)=>{const w=v.show?.query?.index||1,O=x.show?.query?.index||1;return w-O}),g.forEach(v=>{v.widget=v.widget||v.control||"a-input",v.defaultValue!=null&&v.defaultValue!="undefined"&&typeof v.defaultValue<"u"&&(c.value[v.name]=v.defaultValue,v.value=v.defaultValue)}),g}),o=n.computed(()=>i.value.labelWidth||7),r=n.computed(()=>{const g=i.value.btns.filter(v=>v.name=="advanced")[0]||{};return g.event?.clickScript&&(g.event.click=new Function("ctx","btn","event",g.event.clickScript)),g.event?.disableScript&&(g.event.disable=new Function("ctx","btn",g.event.disableScript)),g.event?.visibleScript&&(g.event.visible=new Function("ctx","btn",g.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...g}}),d=["query","reset","advanced"],h=n.computed(()=>{const g=i.value.btns.filter(x=>x.name!="advanced"),v=[];return g.forEach(x=>{x.size||(x.size="default"),v.push(x.name)}),v.includes("query")||g.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),v.includes("reset")||g.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),g.sort((x,w)=>{const O=x.index||1,k=w.index||1;return O-k}),g}),c=n.ref({});n.onMounted(()=>{t.editor?.ebus.$emit("table-list-search",c.value)});const f=e;function u({btn:g,event:v}){console.log("unione query form btn click",g,v),g.name=="query"&&p(),g.name=="reset"&&b(),f("btnClick",{btn:g,event:v})}function p(){const g=[];s.value.forEach(x=>{x.visible&&g.push(x.name)});const v={params:{},keywords:""};Object.keys(c.value).forEach(x=>{g.includes(x)&&(v.params[x]=c.value[x])}),l.value.visible&&c.value[l.value.name]&&(v.keywords=c.value[l.value.name]),f("query",v),t.editor?.ebus.$emit("table-list-search",v)}function b(){c.value={},s.value.forEach(g=>{g.visible=!1}),f("reset"),t.editor?.ebus.$emit("table-list-reset")}return(g,v)=>{const x=n.resolveComponent("a-input"),w=n.resolveComponent("a-form-item"),O=n.resolveComponent("unione-btn"),k=n.resolveComponent("a-checkbox"),m=n.resolveComponent("DownOutlined"),N=n.resolveComponent("a-button"),_=n.resolveComponent("a-dropdown"),C=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},n.createSlots({default:n.withCtx(()=>[n.createVNode(C,{model:c.value,layout:"horizontal","label-col":{span:o.value}},{default:n.withCtx(()=>[l.value.visible?(n.openBlock(),n.createBlock(w,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:n.normalizeStyle({width:o.value})},{default:n.withCtx(()=>[n.createVNode(x,{placeholder:l.value.placeholder,value:c.value[l.value.name],"onUpdate:value":v[0]||(v[0]=y=>c.value[l.value.name]=y),allowClear:"",onKeyup:n.withKeys(p,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,y=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:y.name},[y.visible?(n.openBlock(),n.createBlock(w,{key:0,label:y.title,class:n.normalizeClass(["query-field",y.name]),style:n.normalizeStyle({width:o.value}),name:y.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(y.widget),n.mergeProps({placeholder:y.placeholder,value:c.value[y.name],"onUpdate:value":B=>c.value[y.name]=B,ref_for:!0},y.props||{},{allowClear:"",widget:y}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",lr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,y=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:y.name},[y.visible!=!1?(n.openBlock(),n.createBlock(O,{key:0,widget:y,editor:a.editor,onClick:u,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&s.value.length?(n.openBlock(),n.createBlock(_,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",sr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,y=>(n.openBlock(),n.createBlock(k,{key:y.name,class:"item",checked:y.visible,onClick:B=>y.visible=!y.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(y.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(N,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value.title)+" ",1),n.createVNode(m)]),_:1})]),_:1},8,["trigger"])):n.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(nr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-16d6d00f"]]),or={class:"unione-props-setting unione-table-setting"},ar={class:"unione-table-tools"},rr={key:1,class:"unione-table-opts"},dr={key:0},cr=["onClick"],hr={key:1,class:"edit-field"},fr=["onClick"],ur={key:1},pr=Z(n.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(C,y){let B=C.filter(M=>M.value==y);return B&&B[0]&&B[0].label||y}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,y){let B=C.filter(M=>M.value==y);return B&&B[0]&&B[0].label||y}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.leftBtns||(C.configs.leftBtns=[]),C.configs.rightBtns||(C.configs.rightBtns=[]),C.configs.operation||(C.configs.operation={}),C.configs.operation.btns||(C.configs.operation.btns=[]),C.configs.operation.more||(C.configs.operation.more={}),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(y=>({value:y.sn,label:y.title+"("+y.name+")"}))),s=n.computed(()=>{if(!i.value)return[];const C=[],y=i.value.configs.leftBtns;if(y.forEach(B=>{C.push(B.name)}),!C.includes("add")){const B={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};y.splice(0,0,B)}if(!C.includes("delBatch")){const B={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};y.splice(1,0,B)}return y}),o=n.computed(()=>{if(!i.value)return[];const C=[],y=i.value.configs.rightBtns;if(y.forEach(B=>{C.push(B.name)}),!C.includes("downData")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};y.splice(0,0,B)}if(!C.includes("impData")){const B={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};y.splice(1,0,B)}if(!C.includes("expData")){const B={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};y.splice(2,0,B)}if(!C.includes("downTmpl")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};y.splice(3,0,B)}return y});function r(C,y){C=="left"?c.value.open(y,B=>{B.visible=!0,Object.keys(B).forEach(M=>{y[M]=B[M]}),i.value.configs.leftBtns.sort((M,V)=>{const F=M.index||1,I=V.index||1;return F-I}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):c.value.open(y,B=>{B.visible=!0,Object.keys(B).forEach(M=>{y[M]=B[M]}),i.value.configs.rightBtns.sort((M,V)=>{const F=M.index||1,I=V.index||1;return F-I}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(C){const y=C=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let B={title:"新增"+y,name:"new_"+y,index:y,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?i.value.configs.leftBtns.push(B):i.value.configs.rightBtns.push(B),e.editor.widget(e.wid,i.value),r(C,B)}function h(C,y){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(y.name))y.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const M=[];i.value.configs.leftBtns.forEach(V=>{V.name!=y.name&&M.push(V)}),i.value.configs.leftBtns=M}else{const M=[];i.value.configs.rightBtns.forEach(V=>{V.name!=y.name&&M.push(V)}),i.value.configs.rightBtns=M}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const c=n.ref(null);function f(C){c.value.open(C,y=>{y.visible=!0,Object.keys(y).forEach(B=>{C[B]=y[B]}),i.value.configs.operation.btns.sort((B,M)=>{const V=B.index||1,F=M.index||1;return V-F}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const C=i.value.configs.operation.btns.length+1;let y={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(y),e.editor.widget(e.wid,i.value),c.value.open(y,B=>{Object.keys(B).forEach(M=>{y[M]=B[M]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function p(C){const y=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const B=[];i.value.configs.operation.btns.forEach(M=>{M.name!=C.name&&B.push(M)}),i.value.configs.operation.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{y()}})}const b=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),g=n.computed(()=>b.value.fields?.length?(b.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),b.value.fields):[]),v={mounted:C=>C.focus()},x=n.ref({});function w(){const C=Object.keys(x.value);if(C.length)for(let y in C){const B=g.value.filter(M=>M.name==y);if(B&&B[0]){let M=x.value[y];Object.keys(M).forEach(V=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),V=="showIndex"?B[0].show.list.index=M[V]:V=="showWidth"?B[0].show.list.width=M[V]:V=="fixed"?B[0].show.list.fixed=M[V]:V=="align"?B[0].show.list.align=M[V]:B[0][V]=M[V]})}}x.value={}}function O(C,y){w();const B={};y=="showIndex"?B[y]=C.show?.list?.index:y=="showWidth"?B[y]=C.show?.list?.width:y=="fixed"?B[y]=C.show?.list?.fixed:y=="align"?B[y]=C.show?.list?.align:B[y]=C[y]||"",x.value[C.name]=B}function k(C,y){if(!C||!y){x.value={};return}const B=x.value[C.name][y];C.show||(C.show={}),C.show.list||(C.show.list={}),y=="showIndex"?C.show.list.index=B:y=="showWidth"?C.show.list.width=B:y=="fixed"?C.show.list.fixed=B:y=="align"?C.show.list.align=B:C[y]=B,x.value={}}function m(C,y){return y=="showIndex"?C.show?.list?.index:y=="showWidth"?C.show?.list?.width:y=="fixed"?C.show?.list?.fixed:y=="align"?C.show?.list?.align:C[y]}function N(C,y){g.value.filter(M=>M.name==C.name).forEach(M=>{M[y]=!M[y]})}const _=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const y=_.value.options.filter(B=>B.value==C);return y[0]?y[0].label:C}});return(C,y)=>{const B=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),F=n.resolveComponent("PlusOutlined"),I=n.resolveComponent("a-input"),D=n.resolveComponent("a-form-item"),q=n.resolveComponent("a-col"),R=n.resolveComponent("a-input-number"),T=n.resolveComponent("a-checkbox"),P=n.resolveComponent("a-row"),A=n.resolveComponent("a-select"),S=n.resolveComponent("ToolOutlined"),U=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",or,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[8]||(y[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",ar,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,E=>(n.openBlock(),n.createBlock(V,n.mergeProps({key:E.name,class:["btn",E.name,!E.visible&&"deleted"],type:E.visible?E.type:"default",size:E.size,ref_for:!0},E.props||{},{onClick:$=>r("left",E)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(E.title)+" ",1),E.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers($=>h("left",E),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[E.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(E.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:y[0]||(y[0]=E=>d("left"))},{default:n.withCtx(()=>[n.createVNode(F)]),_:1}),n.createVNode(V,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:y[1]||(y[1]=E=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(F)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,E=>(n.openBlock(),n.createBlock(V,n.mergeProps({key:E.name,class:["btn","right",E.name,!E.visible&&"deleted"],type:E.visible?E.type:"default",size:E.size,ref_for:!0},E.props||{},{onClick:$=>r("right",E)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(E.title)+" ",1),E.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers($=>h("right",E),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[E.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(E.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[9]||(y[9]=[n.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createBlock(P,{key:0},{default:n.withCtx(()=>[n.createVNode(q,{span:7},{default:n.withCtx(()=>[n.createVNode(D,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(I,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(q,{span:5},{default:n.withCtx(()=>[n.createVNode(D,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(R,{value:i.value.configs.operation.width,"onUpdate:value":y[2]||(y[2]=E=>i.value.configs.operation.width=E)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(q,{span:6},{default:n.withCtx(()=>[n.createVNode(D,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(R,{value:i.value.configs.operation.count,"onUpdate:value":y[3]||(y[3]=E=>i.value.configs.operation.count=E)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(q,{span:5},{default:n.withCtx(()=>[n.createVNode(D,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(T,{checked:i.value.configs.operation.visible,"onUpdate:checked":y[4]||(y[4]=E=>i.value.configs.operation.visible=E)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[10]||(y[10]=[n.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createElementBlock("div",rr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,E=>(n.openBlock(),n.createBlock(V,n.mergeProps({key:E.name,class:["btn",E.name,!E.visible&&"deleted"],type:E.visible?E.type:"default",size:E.size||"small",ref_for:!0},E.props||{},{onClick:$=>f(E)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(E.title)+" ",1),E.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers($=>p(E),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[E.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(E.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),onClick:y[5]||(y[5]=E=>u()),size:"small"},{default:n.withCtx(()=>[n.createVNode(F)]),_:1})])):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>y[11]||(y[11]=[n.createTextVNode("表头设置")])),_:1}),y[12]||(y[12]=n.createTextVNode(" 数据模型:")),n.createVNode(A,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":y[6]||(y[6]=E=>i.value.dataModel=E)},null,8,["options","value"]),n.createVNode(U,{columns:t.value,"data-source":g.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:E})=>[["showIndex","showWidth","align","fixed"].includes(E.key)?(n.openBlock(),n.createElementBlock("span",dr,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(E.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:E,record:$})=>[["showIndex","showWidth"].includes(E.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!x.value[$.name]||!Object.keys(x.value[$.name]).includes(E.dataIndex))&&!m($,E.dataIndex)&&"empty"]),onClick:ae=>O($,E.dataIndex)},[x.value[$.name]&&Object.keys(x.value[$.name]).includes(E.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(R,{key:0,value:x.value[$.name][E.dataIndex],"onUpdate:value":ae=>x.value[$.name][E.dataIndex]=ae,onBlur:ae=>k($,E.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[v]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m($,E.dataIndex)),1)],64))],10,cr)):["isList","isQuery","isSort"].includes(E.dataIndex)?(n.openBlock(),n.createElementBlock("div",hr,[n.createVNode(T,{checked:$[E.dataIndex],onClick:ae=>N($,E.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(E.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!x.value[$.name]||!Object.keys(x.value[$.name]).includes(E.dataIndex))&&!m($,E.dataIndex)&&"empty"]),onClick:ae=>O($,E.dataIndex)},[x.value[$.name]&&Object.keys(x.value[$.name]).includes(E.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(A,{key:0,value:$.show.list[E.dataIndex],"onUpdate:value":ae=>$.show.list[E.dataIndex]=ae,allowClear:!0,options:E.options,onBlur:y[7]||(y[7]=ae=>k())},null,8,["value","onUpdate:value","options"])),[[v]]):(n.openBlock(),n.createElementBlock("span",ur,n.toDisplayString(E.showLabel(E.options,m($,E.dataIndex))),1))],10,fr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:c,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function tn(a){const e=a.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const mr={toHump:tn},gr={class:"unione-table-tools"},kr={class:"unione-table-data"},br={key:0,class:"unione-table-opts"},Cl=Z(n.defineComponent({__name:"tableList",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},loading:{type:Boolean,default:!1},pagination:{type:Object,required:!1},dataList:{type:Array,default(){return[]}},rowKey:{type:String,default:"id"}},emits:["edit","view","add","delete","delBatch","expData","impData","downTmpl","leftBtnClick","rightBtnClick","optBtnClick","btnClick","change"],setup(a,{expose:e,emit:t}){const i=Ae(),l=a,s=n.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),o=n.computed(()=>s.value.props||{}),r=n.computed(()=>s.value.rowKey||l.rowKey||"id"),d=n.computed(()=>s.value.dsn?l.editor?.dataManager().use(s.value.dsn,"list"):null),h=n.computed(()=>{const V=l.dataList||[];return!V.length&&d.value?d.value.data()||[]:V}),c=n.computed(()=>{if(s.value.operation==!1)return{visible:!1};const V=K.utils.obj.ext(s.value.operation||{},{title:"操作",visible:!0,width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),F=[];let I=s.value.operation?.btns||[];if(I.forEach(D=>{F.push(D.name)}),F.includes("edit")||I.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),F.includes("view")||I.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),F.includes("delete")||I.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const D=I.filter(R=>R.name=="edit")[0];if(D.visible&&(D.action||(D.action={}),D.action.type||(D.action.type="route"),!D.action.href)){const R=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",T=l.editor.model.value;D.action.link=i.editPageUrl+"?psn="+R+"&model="+T+"&id={row."+l.rowKey+"}"}const q=I.filter(R=>R.name=="view")[0];if(q.visible&&(q.action||(q.action={}),q.action.type||(q.action.type="route"),!q.action.href)){const R=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";q.action.link=i.viewPageUrl+"?psn="+R+"&model=view&id={row."+l.rowKey+"}"}}return I=I.filter(D=>D.visible!=!1).sort((D,q)=>{const R=D.index||1,T=q.index||1;return R-T}),V.count&&(I.length>V.count+1?(V.btns=I.slice(0,V.count),V.more.items=I.slice(V.count,I.length),V.more.visible=!0):(V.btns=I,V.more.visible=!1)),V}),f=n.computed(()=>{let V=[];s.value.columns?.length&&(V=[...s.value.columns]);const F=[];V.forEach((D,q)=>{D.dataIndex=D.name,D.convert&&(D.dataIndex=D.name+"Label",D.convertObj=new dt(D.convert),D.customCell=(R,T,P)=>{const A=R[P.name];D.convertObj&&(R[P.dataIndex]==null||R[P.dataIndex]==null)&&A!=null&&A!=null&&(A+"").length>0&&(R[P.dataIndex]=A,D.convertObj.convert(A).then(S=>{S&&(R[P.dataIndex]=S)}))}),D.sort?.enable&&(D.sorter=!0,D.sort.defoult&&(D.defaultSortOrder=D.sort.asc?"ascend":"descend")),D.customRender=({text:R})=>R||"--",D.fkey?.enable&&(D.fkey.labelName&&(D.dataIndex=tn(D.fkey.labelName)),D.fkey.labelTitle&&(D.title=D.fkey.labelTitle),D.customRender=({record:R,column:T})=>R&&R[T.name+"FEntry"]&&R[T.name+"FEntry"][T.dataIndex]||"--",D.fkey.fields?.forEach((R,T)=>{if(!R.name)return;const P=tn(R.name),A={fkName:D.name,title:R.title,name:P,dataIndex:R.name,width:R.width,index:R.index||q+T+1,customRender:({record:S,column:U})=>{if(S&&S[U.fkName+"FEntry"]){const E=S[U.fkName+"FEntry"][U.name];if(E)return R.convertObj&&R.convertObj.convert(E)||E}return"--"}};R.convert&&(R.convertObj=new dt(R.convert)),F.push(A)}))}),F.forEach(D=>{V.splice(D.index,0,D)});const I=K.utils.obj.ext(s.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return I&&I.visible!=!1&&(I.customRender=D=>w.value?(w.value.current-1)*w.value.pageSize+D.index+1:D.index,V=[I,...V]),c.value&&c.value.visible!=!1&&V.push({fixed:"right",align:"center",...c.value,name:"operation"}),V}),u=n.computed(()=>{if(s.value.leftBtns===!1)return[];const V=[],F=[];if((s.value.leftBtns||[]).forEach(D=>{D.visible!=!1&&V.push(D),F.push(D.name),D.name=="delBatch"&&!O.value&&(D.visible=!1)}),!F.includes("add")){const D={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};V.splice(0,0,D)}if(!F.includes("delBatch")&&O.value){const D={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};V.splice(1,0,D)}if(l.editor&&l.editor.type.value!="code"){const D=V.filter(q=>q.name=="add")[0];if(D.visible&&(D.action||(D.action={}),D.action.type||(D.action.type="route"),!D.action.href)){const q=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",R=l.editor.model.value;D.action.link=i.addPageUrl+"?psn="+q+"&model="+R}}return V});function p({btn:V,event:F}){if(i.isDebug&&console.log("unione table left btn click",V,F),V.name=="delBatch"){if(!k.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.loadByIds(k.value.selectedRowKeys).then(()=>{B()});return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+k.value.selectedRowKeys.length+")数据",onOk:()=>{N("delBatch",{btn:V,event:F,keys:k.value.selectedRowKeys}),N("leftBtnClick",{btn:V,event:F,keys:k.value.selectedRowKeys}),N("btnClick",{btn:V,event:F,keys:k.value.selectedRowKeys})}});return}N(V.name,{btn:V,event:F}),N("leftBtnClick",{btn:V,event:F}),N("btnClick",{btn:V,event:F})}const b=n.computed(()=>{if(s.value.rightBtns===!1)return[];const V=[],F=[];if((s.value.rightBtns||[]).forEach(D=>{D.visible!=!1&&V.push(D),F.push(D.name)}),!F.includes("impData")){const D={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};V.splice(1,0,D)}if(!F.includes("expData")){const D={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};V.splice(2,0,D)}if(!F.includes("downTmpl")){const D={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};V.splice(3,0,D)}return V});function g({btn:V,event:F}){i.isDebug&&console.log("unione table right btn click",V,F),N(V.name,{btn:V,event:F}),N("rightBtnClick",{btn:V,event:F}),N("btnClick",{btn:V,event:F})}const v=n.computed(()=>({bordered:!0,size:"small",...s.value.attrs||{}})),x=n.ref({}),w=n.computed(()=>K.utils.obj.ext(l.pagination||s.value.pagination,{showTotal:V=>"共"+V+"记录",pageSize:10,current:1,total:0,position:["bottomCenter"]})),O=n.computed(()=>typeof s.value.selection<"u"?s.value.selection:!0),k=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(V,F)=>{k.value.selectedRowKeys=V,k.value.selectedRowList=F},getCheckboxProps:V=>({disabled:V.checkable})}),m=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],N=t;function _({btn:V,event:F},I){if(i.isDebug&&console.log("unione table opt btn click",V,F),V.name=="delete"){if(d.value){d.value.deleteByIds([I[r.value]]).then(()=>{B()});return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{N(V.name,{btn:V,event:F,row:I}),N("optBtnClick",{btn:V,event:F,row:I}),N("btnClick",{btn:V,event:F,row:I})}});return}N(V.name,{btn:V,event:F,row:I}),N("optBtnClick",{btn:V,event:F,row:I}),N("btnClick",{btn:V,event:F,row:I})}function C(V,F,I,D){B(),N("change",{pagination:V,filters:F,sorter:I,event:D})}function y(V=!1){V?(k.value.selectedRowKeys=[],k.value.selectedRowList=[]):G.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${k.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{k.value.selectedRowKeys=[],k.value.selectedRowList=[]}})}function B(){const V={page:w.value.current,pageSize:w.value.pageSize,keywords:x.value.keywords,body:x.value.params||{}};console.log("dataStorage find params",V),d.value?.find(V)}n.onMounted(()=>{l.editor?.ebus.$on("table-list-search",V=>{console.log("table-list-search",V),x.value=V||{},B()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),x.value={},B(),y(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),B()})});function M(){return{keys:k.value.selectedRowKeys,rows:k.value.selectedRowList}}return e({getSelected:M,clearSelected:y}),(V,F)=>{const I=n.resolveComponent("unione-btn"),D=n.resolveComponent("DownOutlined"),q=n.resolveComponent("a-button"),R=n.resolveComponent("a-dropdown"),T=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(rt,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,P=>(n.openBlock(),n.createBlock(I,{key:P.name,class:"btn",widget:P,editor:a.editor,onClick:p,preset:m,ctx:{sltKeys:k.value.selectedRowKeys,sltRows:k.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),k.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:F[0]||(F[0]=P=>y())},"当前选中记录("+n.toDisplayString(k.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,P=>(n.openBlock(),n.createBlock(I,{key:P.name,class:"btn right",widget:P,editor:a.editor,onClick:g,preset:m,ctx:{sltKeys:k.value.selectedRowKeys,sltRows:k.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",kr,[f.value&&f.value.length?(n.openBlock(),n.createBlock(T,n.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":h.value,"row-selection":O.value?k.value:null,scroll:{x:o.value.scrollX||"max-content",y:o.value.scrollY},pagination:w.value,onChange:C},v.value),{bodyCell:n.withCtx(({column:P,record:A})=>[P.name==="operation"?(n.openBlock(),n.createElementBlock("div",br,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value.btns,S=>(n.openBlock(),n.createBlock(I,{key:S.name,class:"opt",widget:S,editor:a.editor,onClick:U=>_(U,A),preset:m,ctx:{row:A}},null,8,["widget","editor","onClick","ctx"]))),128)),c.value.more?.visible!=!1&&c.value.more.items?.length?(n.openBlock(),n.createBlock(R,{key:0,trigger:[c.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",c.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",c.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value.more.items,S=>(n.openBlock(),n.createBlock(I,{key:S.name,class:"item",widget:S,editor:a.editor,onClick:U=>_(U,A),type:"text",preset:m,ctx:{row:A}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(q,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(c.value.more.title)+" ",1),n.createVNode(D)]),_:1})]),_:2},1032,["trigger","class"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):n.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(pr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-ae4b8723"]]),yr={class:"page-setting-dialog"},jt=n.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const t=a,i=n.computed(()=>t.editor?.model?.value),l=K.useSession(),s=n.computed(()=>l.getPrincipal()),o=n.ref(!1);n.provide("closeSetting",()=>{t.editor?.save().then(u=>{o.value=!1})});function r(){o.value=!0}function d(){t.editor?.save().then(u=>{console.log("res",u)})}function h(){t.editor?.save().then(u=>{console.log("res",u)})}const c=n.ref("");function f(u){c.value||(c.value=i.value),u?t.editor?.setModel("edit"):t.editor?.setModel(c.value)}return(u,p)=>{const b=n.resolveComponent("SettingOutlined"),g=n.resolveComponent("a-tooltip"),v=n.resolveComponent("SaveOutlined"),x=n.resolveComponent("FormOutlined"),w=n.resolveComponent("StopOutlined"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:0,title:a.settingTitle},{default:n.withCtx(()=>[n.createVNode(b,{class:"page-setting",onClick:r})]),_:1},8,["title"])):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(x,{class:"btn-edit",onClick:p[0]||(p[0]=k=>f(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(w,{class:"btn-edit",onClick:p[1]||(p[1]=k=>f(!1))})]),_:1})):n.createCommentVNode("",!0),n.renderSlot(u.$slots,"default"),i.value=="edit"?(n.openBlock(),n.createBlock(O,{key:4,title:t.settingTitle,open:o.value,"onUpdate:open":p[2]||(p[2]=k=>o.value=k),centered:"",width:"85%",onOk:h},{default:n.withCtx(()=>[n.createElementVNode("div",yr,[n.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),wr={class:"unione-props-setting data-field-manage"},xr={key:0},vr={key:1},Cr={key:2},Sr={key:3},Nr={key:4},Br={key:5},Or={key:6},Vr=["onClick"],_r=["onClick"],Mr=["onClick"],Tr={key:1},Ar=Z(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=n.useModel(a,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:u=>{u.forEach(p=>{i.value.selectedRowKeys.includes(p)||i.value.selectedRowKeys.push(p);const b=[];t.value.forEach(g=>{!u.includes(g.name)&&i.value.selectedRowKeys.includes(g.name)&&b.push(g.name)}),b.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(g=>!b.includes(g)))})}}),l={mounted:u=>u.focus()},s=n.ref({});function o(){const u=Object.keys(s.value);if(u.length)for(let p in u){const b=t.value.filter(g=>g.name==p);if(b&&b[0]){let g=s.value[p];Object.keys(g).forEach(v=>{b[0][v]=g[v]})}}s.value={}}function r(u,p){o();const b={};b[p]=u[p]||"",s.value[u.name]=b}function d(u,p){if(!u||!p){s.value={};return}const b=s.value[u.name][p];if(p=="name"&&t.value.filter(v=>v[p]==b&&v.name!=u.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}u[p]=b,s.value={}}function h(u,p){t.value.filter(g=>g.name==u.name).forEach(g=>{g[p]=!g[p]})}function c(){if(o(),t.value.filter(b=>b.name=="new_").length>0){s.value.new_={name:"new_"};return}const p={title:"",name:"new_",isPk:!1};t.value.push(p),s.value[p.name]={name:"new_"}}function f(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,p)=>{const b=n.resolveComponent("a-button"),g=n.resolveComponent("a-tooltip"),v=n.resolveComponent("a-input"),x=n.resolveComponent("a-input-number"),w=n.resolveComponent("a-select-option"),O=n.resolveComponent("a-select"),k=n.resolveComponent("a-checkbox"),m=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",wr,[n.createVNode(b,{class:"btn btn-add",type:"primary",onClick:c,size:"small"},{default:n.withCtx(()=>p[1]||(p[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:n.withCtx(()=>p[2]||(p[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(m,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:n.withCtx(({column:N})=>[N.key==="name"?(n.openBlock(),n.createElementBlock("span",xr,[p[3]||(p[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),N.key==="title"?(n.openBlock(),n.createElementBlock("span",vr,[p[4]||(p[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),N.key==="descs"?(n.openBlock(),n.createElementBlock("span",Cr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),N.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),N.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),N.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Br,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),N.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Or,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),N.key==="isPk"?(n.openBlock(),n.createBlock(g,{key:7,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[p[5]||(p[5]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(N.title),1)]),_:2},1024)):n.createCommentVNode("",!0),N.key==="isFk"?(n.openBlock(),n.createBlock(g,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(N.title),1)]),_:2},1024)):n.createCommentVNode("",!0),N.key==="isNull"?(n.openBlock(),n.createBlock(g,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(N.title),1)]),_:2},1024)):n.createCommentVNode("",!0),N.key==="syncDbEnable"?(n.openBlock(),n.createBlock(g,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(N.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:N,text:_,record:C})=>[["name","title","descs","defaultValue"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(N.dataIndex))&&!_&&"empty"]),onClick:y=>r(C,N.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:s.value[C.name][N.dataIndex],"onUpdate:value":y=>s.value[C.name][N.dataIndex]=y,onBlur:y=>d(C,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_||" "),1)],64))],10,Vr)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(N.dataIndex))&&!_&&"empty"]),onClick:y=>r(C,N.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:s.value[C.name][N.dataIndex],"onUpdate:value":y=>s.value[C.name][N.dataIndex]=y,onBlur:y=>d(C,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_||" "),1)],64))],10,_r)):["dataType"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(N.dataIndex))&&!_&&"empty"]),onClick:y=>r(C,N.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(O,{key:0,value:C[N.dataIndex],"onUpdate:value":y=>C[N.dataIndex]=y,onBlur:p[0]||(p[0]=y=>d())},{default:n.withCtx(()=>[n.createVNode(w,{key:"String",value:"String"}),n.createVNode(w,{key:"Long",value:"Long"}),n.createVNode(w,{key:"Short",value:"Short"}),n.createVNode(w,{key:"Integer",value:"Integer"}),n.createVNode(w,{key:"Float",value:"Float"}),n.createVNode(w,{key:"Double",value:"Double"}),n.createVNode(w,{key:"Date",value:"Date"}),n.createVNode(w,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Tr,n.toDisplayString(_),1))],10,Mr)):["syncDbEnable","isFk","isPk"].includes(N.dataIndex)?(n.openBlock(),n.createBlock(k,{key:3,checked:C[N.dataIndex],onClick:y=>h(C,N.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(N.dataIndex)?(n.openBlock(),n.createBlock(k,{key:4,checked:!C[N.dataIndex],onClick:y=>h(C,N.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Er={class:"unione-props-setting data-field-setting"},Ir={key:0},Dr=["onClick"],Pr={class:"field-txt"},Fr=["onClick"],$r={key:1,class:"field-txt"},Rr=["onClick"],Lr={key:1},jr=["onClick"],zr={key:0,class:"field-txt"},qr={key:4,class:"edit-field"},Ur={key:0},Wr=["onClick"],Hr=Z(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:x})=>x+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),t=n.useModel(a,"modelValue"),i={mounted:x=>x.focus()},l=n.ref({});function s(){const x=Object.keys(l.value);if(x.length)for(let w in x){const O=t.value.filter(k=>k.name==w);if(O&&O[0]){let k=l.value[w];Object.keys(k).forEach(m=>{m=="convertName"?(O[0].convert||(O[0].convert={}),O[0].convert.type=k[m]):O[0][m]=k[m]})}}l.value={}}function o(x,w){s();const O={};w=="convertName"?(x.convert||(x.convert={}),O[w]=x.convert?.type):O[w]=x[w]||"",l.value[x.name]=O}function r(x,w){{l.value={};return}}function d(x,w){t.value.filter(k=>k.name==x.name).forEach(k=>{k[w]=!k[w]})}const h=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function c(x,w){const O=t.value.filter(m=>m.name==x.name);O.forEach(m=>{w!="isSort"?m[w]=!0:m[w]=!m[w]});const k=O[0];if(!(!k||w=="isSort")){switch(h.value.prop=w,h.value.field=x,k.show||(k.show={}),w){case"isQuery":k.show.query||(k.show.query={}),h.value.show=k.show.query,h.value.title=`查询设置/${x.title}(${x.name})`;break;case"isForm":k.show.form||(k.show.form={}),h.value.show=k.show.form,h.value.title=`表单设置/${x.title}(${x.name})`;break;case"isView":k.show.view||(k.show.view={}),h.value.show=k.show.view,h.value.title=`详情设置/${x.title}(${x.name})`;break;case"isList":k.show.list||(k.show.list={}),h.value.show=k.show.list,h.value.title=`列头设置/${x.title}(${x.name})`;break}h.value.visible=!0}}const f=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:x=>{const w=f.value.options.filter(O=>O.value==x);return w[0]?w[0].label:x}}),u=n.ref({visible:!1,field:{},props:{},showInfo:x=>{let w="";return x.rules&&(w=x.rules.filter(O=>O.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const x=u.value.props,w={name:"range",trigger:x.trigger,whitespace:x.whitespace,message:x.rangeMessage};x.rangeMin!=null&&x.rangeMin!=null&&(w.min=x.rangeMin,w.enable=!0),x.rangeMax!=null&&x.rangeMax!=null&&(w.max=x.rangeMax,w.enable=!0);const O={name:"reg",trigger:x.trigger,whitespace:x.whitespace,message:x.regMessage};x.regExpress&&(O.pattern=x.regExpress,O.enable=!0),u.value.field.rules=[w,O],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function p(x){u.value.visible=!0,u.value.field=x;const w=x.rules||[],O={trigger:"change",whitespace:!0};w.forEach(k=>{k.name=="reg"&&(O.trigger=k.trigger,O.whitespace=k.whitespace,O.regExpress=k.pattern,O.regMessage=k.message),k.name=="range"&&(O.rangeMin=k.min,O.rangeMax=k.max,O.rangeMessage=k.message)}),u.value.props=O}const b=n.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:x=>{const w=b.value.widgets.filter(O=>O.value==x);return w[0]?w[0].label:x},toSetting:()=>{}}),g=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{g.value.convert.options||(g.value.convert.options=[]),g.value.convert.options.push({label:"",value:""})},toDelOption:(x,w)=>{g.value.convert.options.splice(x,1)},toSetting:()=>{g.value.visible=!1}});function v(x){g.value.visible=!0,g.value.field=x,g.value.convert=x.convert||{}}return(x,w)=>{const O=n.resolveComponent("ToolOutlined"),k=n.resolveComponent("a-button"),m=n.resolveComponent("a-select"),N=n.resolveComponent("a-checkbox"),_=n.resolveComponent("a-table"),C=n.resolveComponent("a-input-number"),y=n.resolveComponent("a-form-item"),B=n.resolveComponent("a-input"),M=n.resolveComponent("a-form"),V=n.resolveComponent("a-modal"),F=n.resolveComponent("a-col"),I=n.resolveComponent("a-row"),D=n.resolveComponent("a-select-option"),q=n.resolveComponent("a-divider"),R=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Er,[n.createVNode(_,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:T})=>[["widget","queryType","rules","convertName"].includes(T.key)?(n.openBlock(),n.createElementBlock("span",Ir,[n.createVNode(O),n.createTextVNode(" "+n.toDisplayString(T.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:T,text:P,record:A})=>[["rules"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!u.value.showInfo(A)&&"empty"]),onClick:S=>p(A)},[n.createElementVNode("span",Pr,n.toDisplayString(u.value.showInfo(A)),1),u.value.showInfo(A)?(n.openBlock(),n.createBlock(k,{key:0,type:"link"},{default:n.withCtx(()=>w[22]||(w[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Dr)):["widget"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[A.name]||!Object.keys(l.value[A.name]).includes(T.dataIndex))&&!P&&"empty"]),onClick:S=>o(A,T.dataIndex)},[l.value[A.name]&&Object.keys(l.value[A.name]).includes(T.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:A[T.dataIndex],"onUpdate:value":S=>A[T.dataIndex]=S,allowClear:!0,options:b.value.widgets,onBlur:w[0]||(w[0]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",$r,n.toDisplayString(b.value.widgetName(P)),1))],10,Fr)):["queryType"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[A.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[A.name]||!Object.keys(l.value[A.name]).includes(T.dataIndex))&&!P&&"empty"]),onClick:S=>o(A,T.dataIndex)},[l.value[A.name]&&Object.keys(l.value[A.name]).includes(T.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:A[T.dataIndex],"onUpdate:value":S=>A[T.dataIndex]=S,allowClear:!0,options:f.value.options,onBlur:w[1]||(w[1]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Lr,n.toDisplayString(f.value.showLabel(P)),1))],10,Rr)):n.createCommentVNode("",!0)],64)):["convertName"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[A.name]||!Object.keys(l.value[A.name]).includes(T.dataIndex))&&!A.convert?.type&&"empty"]),onClick:S=>o(A,T.dataIndex)},[l.value[A.name]&&Object.keys(l.value[A.name]).includes(T.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:A.convert.type,"onUpdate:value":S=>A.convert.type=S,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:w[2]||(w[2]=S=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[A.convert?.type?(n.openBlock(),n.createElementBlock("span",zr,n.toDisplayString(A.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),A.convert?.type?(n.openBlock(),n.createBlock(k,{key:1,type:"link",onClick:n.withModifiers(S=>v(A),["stop"])},{default:n.withCtx(()=>w[23]||(w[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,jr)):["isQuery","isForm","isView","isList","isSort"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",qr,[n.createVNode(N,{checked:A[T.dataIndex],onClick:S=>d(A,T.dataIndex)},null,8,["checked","onClick"]),n.createVNode(k,{type:"link",onClick:S=>c(A,T.dataIndex)},{default:n.withCtx(()=>w[24]||(w[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(V,{visible:h.value.visible,"onUpdate:visible":w[9]||(w[9]=T=>h.value.visible=T),title:h.value.title,onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(y,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(C,{value:h.value.show.index,"onUpdate:value":w[3]||(w[3]=T=>h.value.show.index=T)},null,8,["value"])]),_:1}),["isQuery"].includes(h.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(y,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:h.value.show.width,"onUpdate:value":w[4]||(w[4]=T=>h.value.show.width=T)},null,8,["value"])]),_:1})),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:h.value.show.labelWidth,"onUpdate:value":w[5]||(w[5]=T=>h.value.show.labelWidth=T)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:h.value.show.valueWidth,"onUpdate:value":w[6]||(w[6]=T=>h.value.show.valueWidth=T)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(m,{value:h.value.show.fixed,"onUpdate:value":w[7]||(w[7]=T=>h.value.show.fixed=T),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(m,{value:h.value.show.align,"onUpdate:value":w[8]||(w[8]=T=>h.value.show.align=T),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(V,{visible:g.value.visible,"onUpdate:visible":w[11]||(w[11]=T=>g.value.visible=T),title:g.value.convert.type=="dict"?"字典设置":"选项设置",onOk:g.value.toSetting},{default:n.withCtx(()=>[g.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",Ur,[n.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:g.value.toAddOption},{default:n.withCtx(()=>w[25]||(w[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(_,{columns:g.value.optionColumn,"data-source":g.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:T,text:P,record:A,index:S})=>[T.dataIndex==="label"?(n.openBlock(),n.createBlock(B,{key:0,value:A.label,"onUpdate:value":U=>A.label=U,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),T.dataIndex==="value"?(n.openBlock(),n.createBlock(B,{key:1,value:A.value,"onUpdate:value":U=>A.value=U,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),T.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:U=>g.value.toDelOption(S,A)},"删除",8,Wr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),g.value.convert.type=="dict"?(n.openBlock(),n.createBlock(M,{key:1,model:g.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(I,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(F,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(y,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.convert.dict,"onUpdate:value":w[10]||(w[10]=T=>g.value.convert.dict=T)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(V,{visible:b.value.visible,"onUpdate:visible":w[13]||(w[13]=T=>b.value.visible=T),title:"控件设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[b.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(y,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(m,{value:b.value.props.mode,"onUpdate:value":w[12]||(w[12]=T=>b.value.props.mode=T),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(D,{value:"multiple"},{default:n.withCtx(()=>w[26]||(w[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(D,{value:"tags"},{default:n.withCtx(()=>w[27]||(w[27]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(V,{visible:u.value.visible,"onUpdate:visible":w[21]||(w[21]=T=>u.value.visible=T),title:"规则设置",onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(q,{orientation:"left"},{default:n.withCtx(()=>w[28]||(w[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(y,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(R,{value:u.value.props.trigger,"onUpdate:value":w[14]||(w[14]=T=>u.value.props.trigger=T),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(y,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.whitespace,"onUpdate:value":w[15]||(w[15]=T=>u.value.props.whitespace=T),checked:u.value.props.whitespace},{default:n.withCtx(()=>w[29]||(w[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(q,{orientation:"left"},{default:n.withCtx(()=>w[30]||(w[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(y,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(C,{value:u.value.props.rangeMin,"onUpdate:value":w[16]||(w[16]=T=>u.value.props.rangeMin=T)},null,8,["value"]),w[31]||(w[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(C,{value:u.value.props.rangeMax,"onUpdate:value":w[17]||(w[17]=T=>u.value.props.rangeMax=T)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.rangeMessage,"onUpdate:value":w[18]||(w[18]=T=>u.value.props.rangeMessage=T)},null,8,["value"])]),_:1}),n.createVNode(q,{orientation:"left"},{default:n.withCtx(()=>w[32]||(w[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(y,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.regExpress,"onUpdate:value":w[19]||(w[19]=T=>u.value.props.regExpress=T)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.regMessage,"onUpdate:value":w[20]||(w[20]=T=>u.value.props.regMessage=T)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Kr={class:"unione-props-setting data-field"},Qr=Z(n.defineComponent({__name:"dataField",props:n.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=n.useModel(a,"modelValue");return(t,i)=>{const l=n.resolveComponent("OrderedListOutlined"),s=n.resolveComponent("a-tab-pane"),o=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Kr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(s,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(l),i[2]||(i[2]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(Ar,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=d=>e.value=d)},null,8,["modelValue"])]),_:1}),n.createVNode(s,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(o),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Hr,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Gr={key:0,class:"data-model-list"},Yr=["onClick"],Xr=Z(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const t=n.computed(()=>l.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const l=a;function s(f){i.value=f}function o(){if(t.value.length>=l.limit){G.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=sa.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),l.editor.dataModel(f,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},d=n.ref(),h=n.inject("closeSetting");function c(){d.value.validate().then(f=>{h&&h()})}return e({toSaving:c}),(f,u)=>{const p=n.resolveComponent("a-input"),b=n.resolveComponent("a-form-item"),g=n.resolveComponent("a-textarea"),v=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(n.openBlock(),n.createElementBlock("div",Gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,x=>(n.openBlock(),n.createElementBlock("div",{key:x.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==x.sn&&"slt"]),onClick:w=>s(x)},n.toDisplayString(x.title),11,Yr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:o},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[n.createVNode(v,{ref_key:"formObj",ref:d,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:n.withCtx(()=>[n.createVNode(b,{label:"数据标题",name:"title",required:""},{default:n.withCtx(()=>[n.createVNode(p,{value:i.value.title,"onUpdate:value":u[0]||(u[0]=x=>i.value.title=x)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(p,{value:i.value.name,"onUpdate:value":u[1]||(u[1]=x=>i.value.name=x)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:n.withCtx(()=>[n.createVNode(p,{value:i.value.url,"onUpdate:value":u[2]||(u[2]=x=>i.value.url=x)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(g,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=x=>i.value.descs=x)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Qr,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=x=>i.value.fields=x)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Jr={class:"unione-props-setting unione-page-setting"},zt=Z(n.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref({});return n.onMounted(()=>{t.value=e.editor.define.value}),(i,l)=>{const s=n.resolveComponent("a-form-item"),o=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),h=n.resolveComponent("a-form"),c=n.resolveComponent("a-tab-pane"),f=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Jr,[n.createVNode(f,{type:"card"},{default:n.withCtx(()=>[n.createVNode(c,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(h,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(n.openBlock(),n.createBlock(s,{key:0,label:"页面编码"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.value.sn)+"/V"+n.toDisplayString(t.value.vers),1)]),_:1})):n.createCommentVNode("",!0),n.createVNode(s,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(o,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=u=>t.value.title=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(o,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=u=>t.value.component=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(o,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=u=>t.value.icon=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"是否全局"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>t.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"是否模版"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>t.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=u=>t.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),n.createVNode(c,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Xr,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Sl=Z(n.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){console.log("unione page view setup .....");const e=a,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new wt,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,o=>{o&&i.load(s.value,o)});const s=n.ref("new_");return n.onMounted(()=>{const o=n.inject("route");console.log("unione page view route",o),s.value=e.psn||o?.query?.psn||o?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel("run"),i.load(s.value,e.pageDefine||t)}),(o,r)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Zr={class:"form-btns"},Nl=n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){const e=n.inject("router"),t=a,i={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new wt,s=n.computed(()=>l.$widgetList.value||[]),o=n.computed(()=>{const f=l.define.value?.configs?.btns||[],u=f.map(p=>p.name);if(!u.includes("save")){const p={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};f.splice(p.index,0,p)}if(!u.includes("submit")){const p={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let b=p.index||1;f.splice(b,0,p)}if(!u.includes("reset")){const p={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};f.splice(p.index,0,p)}if(!u.includes("back")){const p={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};f.splice(p.index,0,p)}return l.model.value=="view"&&f.filter(p=>["save","submit","reset"].includes(p.name)).forEach(p=>{p.visible=!1}),f});function r({btn:f,event:u}){f.name=="save"&&d(),f.name=="reset",f.name=="back"&&h()}async function d(){const f=l.dataManager().form();let u={};for(let p in f){const b=await f[p].validate();if(l.dataManager().psn()==p){for(let g in u)b[g]=u[g];u=b}else u[p]=b}console.log("=======form data=====",u),l.dataManager().primary().save({data:u,params:l.dataManager().params}).then(p=>{console.log("save result:",p)})}function h(){e.back()}n.watch(()=>t.pageDefine,f=>{f&&l.load(c.value,f)});const c=n.ref("new_");return n.onMounted(()=>{const f=n.inject("route");console.log("unione page view route",f),c.value=t.psn||f?.query?.psn||f?.meta?.psn||"new_",console.log("unione page view,psn:"+c.value),l.setModel(f?.query?.model||f?.meta?.model||"run"),f?.query&&l.dataManager().params(f.query),l.load(c.value,t.pageDefine||i)}),(f,u)=>{const p=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(jt,{class:"unione-page-form","setting-title":"页面设置",editor:n.unref(l)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,b=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:n.unref(l)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",Zr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,b=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b.name},[b.visible!=!1?(n.openBlock(),n.createBlock(p,{key:0,widget:b,editor:n.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(l)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),ed=["onMouseover"],td={key:0,class:"node-opts"},id={class:"form-warp"},nd={class:"form-btns"},Bl=n.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},setting:{type:Object,required:!0},btns:{type:Array,required:!1},event:{type:Object,required:!1}},setup(a){const e=K.useDialog(),t=n.inject("router"),i=a,l={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function s(){if(i.fields?.length){const T={widget:"unione-form",dsn:"primary",primary:!0,widgets:i.fields};l.configs.widgets=[T],l.configs.dsnList=["primary"],o.dataManager().use("primary","form").store(i.storage)}l.configs.btns=i.btns||[],l.configs.setting=i.setting||{}}const o=new wt,r=n.ref(!1),d=n.ref([]),h=n.ref({}),c=n.ref(null),f=n.ref(null),u=n.ref([]),p=n.ref([]),b=n.ref(0),g=n.computed(()=>{const T={disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"parentId",labelField:"title",leafField:"isLeaf",...i.setting?.tree||{}};return o.define.value?.configs?.tree||T}),v=n.computed(()=>{const T=g.value.btns||[],P=[];return T.forEach(A=>{P.push(A.name)}),T.filter(A=>A.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),x=n.computed(()=>{const T=g.value.btns||[],P=[],A=[];return T.forEach(S=>{A.push(S.name),S.name!="add"&&P.push(S)}),A.includes("delete")||P.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),A.includes("child")||P.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),P});function w({btn:T,event:P},A){P.stopPropagation();const S=h.value[A[g.value.idField]];if(console.log("onTreeMenuClick,btn:"+T+",node:",S),T.name=="child"){const U=h.value[S[g.value.idField]];U.isLeaf=!1,c.value={},c.value[g.value.pidField]=U[g.value.idField],c.value[g.value.labelField]="新建...",c.value[g.value.idField]="new_"+b.value,c.value.parentNode=U,b.value=b.value+1,U.children||(U.children=[],p.value.push(U[g.value.idField])),M.value.createNode&&M.value.createNode(c.value,U,o.dataManager().params()),h.value[c.value[g.value.idField]]=c.value,U.children.push(c.value),u.value=[c.value[g.value.idField]],o.dataManager().primary().setValue(c.value)}T.name=="delete"&&(S[g.value.idField].startsWith("new_")?(S.parentNode?S.parentNode.children=S.parentNode.children.filter(U=>U[g.value.idField]!=S[g.value.idField]):d.value=d.value.filter(U=>U[g.value.idField]!=S[g.value.idField]),delete h.value[S[g.value.idField]]):o.dataManager().primary().deleteByIds([S[g.value.idField]]).then(()=>{S.parentNode?S.parentNode.children=S.children.filter(U=>U[g.value.idField]!=S[g.value.idField]):d.value=d.value.filter(U=>U[g.value.idField]!=S[g.value.idField]),delete h.value[S[g.value.idField]]}))}function O(T,{expanded:P,node:A}){P&&(c.value=A.dataRef,o.dataManager().primary().setValue(c.value),y())}function k(T,{selected:P,node:A}){P?(c.value=A.dataRef,o.dataManager().primary().setValue(c.value)):c.value&&(u.value=[c.value[g.value.idField]])}n.watch(()=>i.params,()=>{r.value&&(d.value=[],h.value={},c.value=null,u.value=[],p.value=[],b.value=0,o.dataManager().params(i.params||{}),console.log("params changed props.params",i.params),y())}),n.watch(()=>c.value,()=>{console.log("active node changed",c.value),m(!c.value)});function m(T=!0){const P=o.dataManager().form();for(let A in P)P[A].setDisabled(T)}function N(){if(c.value={},c.value[g.value.pidField]=-1,c.value[g.value.labelField]="新建...",c.value[g.value.idField]="new_"+b.value,b.value=b.value+1,M.value.createNode&&M.value.createNode(c.value,null,o.dataManager().params()),c.value[g.value.pidField]==-1)d.value.push(c.value);else{const T=h.value[c.value[g.value.pidField]];T.children||(T.children=[]),T.children.push(c.value)}u.value=[c.value[g.value.idField]],o.dataManager().primary().setValue(c.value)}const _=n.ref(""),C=xl(()=>{o.dataManager().primary().find({page:1,pageSize:9999,keywords:_.value,needCount:!1,body:{}}).then(T=>{if(h.value={},d.value=[],T.body?.length){const P={};T.body.forEach(A=>{P[A[g.value.idField]]=A}),T.body.forEach(A=>{const S=P[A[g.value.pidField]];S?(S.children||(S.children=[],S.isLeaf=!1),S.children.push(A)):d.value.push(A)})}})},400);function y(){const T={};if(T[g.value.pidField]=-1,c.value){if(c.value.children?.length)return;T[g.value.pidField]=c.value[g.value.idField],o.dataManager().primary().find({page:1,pageSize:999,body:T}).then(P=>{c.value.children=P.body||[],c.value.children.forEach(A=>{A.isLeaf=!!A[g.value.leafField],h.value[A[g.value.idField]]=A,A.parentNode=h.value[A[g.value.pidField]]})})}else o.dataManager().primary().find({page:1,pageSize:999,body:T}).then(P=>{d.value=P.body||[],d.value.forEach(A=>{A.isLeaf=!!A[g.value.leafField],h.value[A[g.value.idField]]=A})})}const B=n.computed(()=>o.$widgetList.value||[]),M=n.computed(()=>{const T={...i.event||o.define.value?.configs?.event||{}};for(const P in T)T[P]&&typeof T[P]!="function"&&T[P].enable&&T[P].scriptText&&(P=="createNode"?T[P]=new Function("node","parent","params",T[P].scriptText):T[P]=new Function("data","event",T[P].scriptText));return T}),V=n.computed(()=>o.define.value?.configs?.setting||i.setting||{});n.provide("pageSetting",V.value);const F=n.computed(()=>{const T=o.define.value?.configs?.btns||i.btns||[],P=T.map(A=>A.name);if(!P.includes("save")){const A={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};T.splice(A.index,0,A)}if(!P.includes("submit")){const A={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let S=A.index||1;T.splice(S,0,A)}if(!P.includes("reset")){const A={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};T.splice(A.index,0,A)}if(!P.includes("back")){const A={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};T.splice(A.index,0,A)}return o.model.value=="view"&&T.filter(A=>["save","submit","reset"].includes(A.name)).forEach(A=>{A.visible=!1}),T});function I({btn:T,event:P}){T.name=="save"&&D({btn:T,event:P}),T.name=="reset",T.name=="back"&&q()}async function D(T){const P=o.dataManager().form();let A={...c.value};for(let S in P){const U=await P[S].validate();if(o.dataManager().psn()==S)for(let E in U)A[E]=U[E];else A[S]=U}if(A[g.value.pidField]?.startsWith("new_")){e.error({content:"请先保存父节点!"});return}A[g.value.idField].startsWith("new_")&&delete A[g.value.idField],delete A.parentNode,delete A.children,A.isLeaf=A.isLeaf?1:0,M.value.preSave&&M.value.preSave(A,T),console.log("=======form data=====",A),o.dataManager().primary().save({data:A}).then(S=>{console.log("save result:",S),c.value[g.value.idField]=S.body,u.value=[S.body],h.value[S.body]=c.value,c.value.children?.forEach(U=>{U[g.value.pidField]=S.body}),M.value.postSaved&&M.value.postSaved(A,T)})}function q(){t.back()}const R=n.ref("new_");return n.onMounted(()=>{const T=n.inject("route");console.log("unione page tree route",T),R.value=i.psn||T?.query?.psn||T?.meta?.psn||"new_",console.log("unione page tree,psn:"+R.value),o.setModel(T?.query?.model||T?.meta?.model||"run");const P={...i.params||{},...T?.query||{},...T?.params||{}};o.dataManager().params(P),s(),o.load(R.value,l),n.nextTick(()=>{m(!0)}),y(),r.value=!0}),(T,P)=>{const A=n.resolveComponent("SearchOutlined"),S=n.resolveComponent("a-input"),U=n.resolveComponent("unione-btn"),E=n.resolveComponent("a-tree");return n.openBlock(),n.createBlock(jt,{class:"unione-page-tree","setting-title":"页面设置",editor:n.unref(o)},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",{class:"tree-warp",onContextmenu:P[4]||(P[4]=n.withModifiers(()=>{},["prevent"]))},[n.createVNode(S,{size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:_.value,"onUpdate:value":P[0]||(P[0]=$=>_.value=$),onChange:n.unref(C),onPressEnter:n.unref(C)},{suffix:n.withCtx(()=>[n.createVNode(A)]),_:1},8,["value","onChange","onPressEnter"]),n.createVNode(U,{widget:v.value,onClick:N},null,8,["widget"]),n.createVNode(E,{"show-line":g.value.showLine,"show-icon":g.value.showIcon,disabled:g.value.disabled,blockNode:!0,draggable:g.value.draggable,multiple:g.value.multiple,selectable:g.value.selectable,checkable:g.value.checkable,fieldNames:{title:g.value.labelField,key:g.value.idField},selectedKeys:u.value,"onUpdate:selectedKeys":P[2]||(P[2]=$=>u.value=$),expandedKeys:p.value,"onUpdate:expandedKeys":P[3]||(P[3]=$=>p.value=$),"tree-data":d.value,onExpand:O,onSelect:k},n.createSlots({icon:n.withCtx(({dataRef:$})=>[$.iconName?(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.iconName),{key:0})):n.createCommentVNode("",!0)]),_:2},[x.value?.length?{name:"title",fn:n.withCtx(({dataRef:$})=>[n.createElementVNode("div",{class:"node-label",onMouseover:()=>f.value=$,onMouseleave:P[1]||(P[1]=()=>f.value=null)},[n.createElementVNode("span",null,n.toDisplayString($[g.value.labelField]),1),c.value&&c.value[g.value.idField]==$[g.value.idField]||f.value&&f.value[g.value.idField]==$[g.value.idField]?(n.openBlock(),n.createElementBlock("div",td,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(x.value,ae=>(n.openBlock(),n.createBlock(U,{key:ae.name,widget:ae,ctx:{node:$},onClick:Rt=>w(Rt,$)},null,8,["widget","ctx","onClick"]))),128))])):n.createCommentVNode("",!0)],40,ed)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),n.createElementVNode("div",id,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.value,$=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.widget),{key:$.wid,wid:$.wid,widget:$,editor:n.unref(o)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",nd,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.value,$=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:$.name},[$.visible!=!1?(n.openBlock(),n.createBlock(U,{key:0,widget:$,editor:n.unref(o),disabled:!c.value,ctx:{},onClick:I},null,8,["widget","editor","disabled"])):n.createCommentVNode("",!0)],64))),128))])])]),_:2},[n.unref(o)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(o)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Ol=n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},leftBtns:{type:Array,required:!1},rightBtns:{type:Array,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:t}){const i=a,l={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function s(){if(i.fields?.length){l.configs.widgets[0].dsn="primary",l.configs.widgets[0].fields=i.fields.filter(b=>b.isQuery),l.configs.widgets[0].btns=i.queryBtns||[],l.configs.dsnList=["primary"],l.configs.widgets[1].dsn="primary";const p=i.fields.filter(b=>b.isPk)[0];p&&p.name&&(l.configs.widgets[1].dataKey=p.name),l.configs.widgets[1].columns=i.fields.filter(b=>b.hidden!=!0),l.configs.widgets[1].operation=K.utils.obj.ext(l.configs.widgets[1].operation,i.operation||{}),l.configs.widgets[1].leftBtns=i.leftBtns||[],l.configs.widgets[1].rightBtns=i.rightBtns||[],o.dataManager().use("primary","list").store(i.storage)}}const o=new wt,r=n.computed(()=>o.$widgetList.value||[]),d=t;function h(p){d("btnClick",p)}const c=n.ref("new_");n.onMounted(()=>{const p=n.inject("route");console.log("unione page view route",p),c.value=i.psn||p?.query?.psn||p?.meta?.psn||"new_",console.log("unione page view,psn:"+c.value),o.setModel(p?.query?.model||p?.meta?.model||"run");const b={...i.params||{},...p?.query||{},...p?.params||{}};o.dataManager().params(b),s(),o.load(c.value,l)});function f(){return o.dataManager().use("primary","list")}function u(){o.ebus.$emit("table-list-reload")}return e({storage:f,editor:o,reload:u}),(p,b)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(o)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,g=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(g.widget),{key:g.wid,wid:g.wid,widget:g,editor:n.unref(o),onBtnClick:h},null,40,["wid","widget","editor"]))),128))]),_:2},[n.unref(o)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(o)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),ct={release(a){return K.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return K.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return K.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return K.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return K.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return K.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return K.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},ld={class:"unione-page list-page"},sd=Z(n.defineComponent({__name:"list",setup(a){const e=Ae(),t=K.useDialog(),i=n.inject("router"),l=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),s=n.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});n.onMounted(()=>{r()});const o=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){o.value.loading=!0,ct.find({page:o.value.pagination.current,pageSize:o.value.pagination.pageSize,body:o.value.params,keywords:o.value.keywords}).then(k=>{o.value.data=k.body,o.value.pagination.total=k.total*1}).finally(()=>{o.value.loading=!1})}function d(k){o.value.pagination.current=k.pagination.current,o.value.pagination.pageSize=k.pagination.pageSize,r()}function h({params:k,keywords:m}){o.value.pagination.current=1,o.value.params=k,o.value.keywords=m,r()}function c({btn:k,event:m,row:N}){console.log("table btn click",k,m,N),(k.name=="add"||k.name=="edit")&&i.push({path:"/system/data/define/edit",query:N?{id:N.id}:{}}),k.name=="impFromDb"&&(u.value=!0),k.name=="release"&&f(N),k.name=="view"&&i.push({path:e.listPageUrl,query:{psn:N.sn+":list",model:"preview"}})}function f(k){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([k.id]).then(m=>{m.success?(t.success({title:"发布成功",content:m.body}),r()):t.error({title:"发布失败",content:m.body})})}})}const u=n.ref(!1),p=n.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),b=n.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),g=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function v(k){!k||!Object.keys(k).length||!k.dsId||(G.message.loading("数据加载中..."),g.value.params=k,g.value.loading=!0,ct.loadFromDb(k).then(m=>{g.value.loading=!1,G.message.destroy(),m.success?(m.body.forEach(N=>{N.checkable=!!N.id}),g.value.data=m.body,g.value.pagination.total=m.body.length):G.message.error(m.message)}))}function x(k){g.value.pagination.current=k.pagination.current,g.value.pagination.pageSize=k.pagination.pageSize}const w=n.ref();function O({btn:k}){if(k.name!="imp")return;const m=w.value.getSelected();m?.keys?.length?t.confirm({content:"确定导入选中的"+m.keys.length+"条记录么?",onOk:()=>{G.message.loading("数据导入中..."),ct.impFromDb({dsId:g.value.params.dsId,tables:m.keys.join()}).then(N=>{G.message.destroy(),N.success?(t.success({content:N.message}),o.value.pagination.current=1,r()):t.error({context:N.message})})}}):t.error({content:"请选择目标记录!"})}return(k,m)=>{const N=n.resolveComponent("UnioneQuery"),_=n.resolveComponent("UnioneTable"),C=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",ld,[n.createVNode(N,{widget:l.value,onQuery:h,onReset:h},null,8,["widget"]),n.createVNode(_,{widget:s.value,dataList:o.value.data,loading:o.value.loading,pagination:o.value.pagination,onChange:d,onBtnClick:c},null,8,["widget","dataList","loading","pagination"]),n.createVNode(C,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":m[0]||(m[0]=y=>u.value=y),placement:"left"},{default:n.withCtx(()=>[n.createVNode(N,{widget:p.value,onQuery:v,onReset:v,onBtnClick:O,class:"load-table-form"},null,8,["widget"]),n.createVNode(_,{widget:b.value,dataList:g.value.data,loading:g.value.loading,pagination:g.value.pagination,onChange:x,rowKey:"name",ref_key:"loadTableObj",ref:w},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-483acb94"]]),od={class:"unione-props-setting data-field-manage"},ad={key:0},rd={key:1},dd=["onClick"],cd=["onClick"],hd=["onClick"],fd={key:1},ud=Z(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:p})=>p+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=n.useModel(a,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(b=>{i.value.selectedRowKeys.includes(b)||i.value.selectedRowKeys.push(b);const g=[];t.value.forEach(v=>{!p.includes(v.name)&&i.value.selectedRowKeys.includes(v.name)&&g.push(v.name)}),g.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(v=>!g.includes(v)))})}}),l={mounted:p=>p.focus()},s=n.ref({});function o(){const p=Object.keys(s.value);if(p.length)for(let b in p){const g=t.value.filter(v=>v.name==b);if(g&&g[0]){let v=s.value[b];Object.keys(v).forEach(x=>{g[0][x]=v[x]})}}s.value={}}function r(p,b){o();const g={};g[b]=p[b]||"",s.value[p.name]=g}function d(p,b){if(!p||!b){s.value={};return}const g=s.value[p.name][b];if(b=="name"&&t.value.filter(x=>x[b]==g&&x.name!=p.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+g+"]已存在"});return}p[b]=g,s.value={}}function h(p,b){const g=t.value.filter(v=>v.name==p.name)[0];return b=="isFk"?g.configs?.fkey?.enable:g[b]==1}function c(p,b){const g=t.value.filter(v=>v.name==p.name)[0];b=="isFk"?(g.configs||(g.configs={}),g.configs.fkey||(g.configs.fkey={}),g.configs.fkey.enable=!g.configs.fkey.enable):g[b]!=1?g[b]=1:g[b]=0}function f(){if(o(),t.value.filter(g=>g.name=="new_").length>0){s.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),s.value[b.name]={name:"new_"}}function u(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(p=>!i.value.selectedRowKeys.includes(p.name)),i.value.selectedRowKeys=[]}})}return(p,b)=>{const g=n.resolveComponent("a-button"),v=n.resolveComponent("a-tooltip"),x=n.resolveComponent("a-input"),w=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-select-option"),k=n.resolveComponent("a-select"),m=n.resolveComponent("a-checkbox"),N=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",od,[n.createVNode(g,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>b[1]||(b[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(g,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:n.withCtx(()=>b[2]||(b[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(N,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:_})=>[["name","title"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",ad,[b[3]||(b[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",rd,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0),_.key==="isPk"?(n.openBlock(),n.createBlock(v,{key:2,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[b[4]||(b[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="isFk"?(n.openBlock(),n.createBlock(v,{key:3,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="isNull"?(n.openBlock(),n.createBlock(v,{key:4,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="syncEnable"?(n.openBlock(),n.createBlock(v,{key:5,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:_,text:C,record:y})=>[["name","title","descs","dataValue"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[y.name]||!Object.keys(s.value[y.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(y,_.dataIndex)},[s.value[y.name]&&Object.keys(s.value[y.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:s.value[y.name][_.dataIndex],"onUpdate:value":B=>s.value[y.name][_.dataIndex]=B,onBlur:B=>d(y,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,dd)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[y.name]||!Object.keys(s.value[y.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(y,_.dataIndex)},[s.value[y.name]&&Object.keys(s.value[y.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[y.name][_.dataIndex],"onUpdate:value":B=>s.value[y.name][_.dataIndex]=B,onBlur:B=>d(y,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,cd)):["dataType"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[y.name]||!Object.keys(s.value[y.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(y,_.dataIndex)},[s.value[y.name]&&Object.keys(s.value[y.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(k,{key:0,value:y[_.dataIndex],"onUpdate:value":B=>y[_.dataIndex]=B,onBlur:b[0]||(b[0]=B=>d())},{default:n.withCtx(()=>[n.createVNode(O,{key:"String",value:"String"}),n.createVNode(O,{key:"Long",value:"Long"}),n.createVNode(O,{key:"Short",value:"Short"}),n.createVNode(O,{key:"Integer",value:"Integer"}),n.createVNode(O,{key:"Float",value:"Float"}),n.createVNode(O,{key:"Double",value:"Double"}),n.createVNode(O,{key:"Date",value:"Date"}),n.createVNode(O,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",fd,n.toDisplayString(C),1))],10,hd)):["syncEnable","isFk","isPk"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:3,checked:h(y,_.dataIndex),onClick:B=>c(y,_.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:4,checked:!h(y,_.dataIndex),onClick:B=>c(y,_.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Vl=1024;let pd=0,nn=class{constructor(e,t){this.from=e,this.to=t}};class Y{constructor(e={}){this.id=pd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ce.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Y.closedBy=new Y({deserialize:a=>a.split(" ")}),Y.openedBy=new Y({deserialize:a=>a.split(" ")}),Y.group=new Y({deserialize:a=>a.split(" ")}),Y.isolate=new Y({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),Y.contextHash=new Y({perNode:!0}),Y.lookAhead=new Y({perNode:!0}),Y.mounted=new Y({perNode:!0});class hi{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[Y.mounted.id]}}const md=Object.create(null);class Ce{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):md,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Ce(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(l)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Y.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(Y.group),s=-1;s<(l?l.length:0);s++){let o=t[s<0?i.name:l[s]];if(o)return o}}}}Ce.none=new Ce("",Object.create(null),0,8);class ln{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let l=null;for(let s of e){let o=s(i);o&&(l||(l=Object.assign({},i.props)),l[o[0].id]=o[1])}t.push(l?new Ce(i.name,l,i.id,i.flags):i)}return new ln(t)}}const fi=new WeakMap,_l=new WeakMap;var fe;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(fe||(fe={}));class de{constructor(e,t,i,l,s){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,r]of s)this.props[typeof o=="number"?o:o.id]=r}}toString(){let e=hi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.toString();l&&(t&&(t+=","),t+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new an(this.topNode,e)}cursorAt(e,t=0,i=0){let l=fi.get(this)||this.topNode,s=new an(l);return s.moveTo(e,t),fi.set(this,s._tree),s}get topNode(){return new Ve(this,0,0,null)}resolve(e,t=0){let i=qt(fi.get(this)||this.topNode,e,t,!1);return fi.set(this,i),i}resolveInner(e,t=0){let i=qt(_l.get(this)||this.topNode,e,t,!0);return _l.set(this,i),i}resolveStack(e,t=0){return bd(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:s=this.length}=e,o=e.mode||0,r=(o&fe.IncludeAnonymous)>0;for(let d=this.cursor(o|fe.IncludeAnonymous);;){let h=!1;if(d.from<=s&&d.to>=l&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:dn(Ce.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new de(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new de(Ce.none,t,i,l)))}static build(e){return yd(e)}}de.empty=new de(Ce.none,[],[],0);class sn{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new sn(this.buffer,this.index)}}class Ze{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ce.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],l=this.set.types[t],s=l.name;if(/\W/.test(s)&&!l.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,l,s){let{buffer:o}=this,r=-1;for(let d=e;d!=t&&!(Ml(s,l,o[d+1],o[d+2])&&(r=d,i>0));d=o[d+3]);return r}slice(e,t,i){let l=this.buffer,s=new Uint16Array(t-e),o=0;for(let r=e,d=0;r<t;){s[d++]=l[r++],s[d++]=l[r++]-i;let h=s[d++]=l[r++]-i;s[d++]=l[r++]-e,o=Math.max(o,h)}return new Ze(s,o,this.set)}}function Ml(a,e,t,i){switch(a){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function qt(a,e,t,i){for(var l;a.from==a.to||(t<1?a.from>=e:a.from>e)||(t>-1?a.to<=e:a.to<e);){let o=!i&&a instanceof Ve&&a.index<0?null:a.parent;if(!o)return a;a=o}let s=i?0:fe.IgnoreOverlays;if(i)for(let o=a,r=o.parent;r;o=r,r=o.parent)o instanceof Ve&&o.index<0&&((l=r.enter(e,t,s))===null||l===void 0?void 0:l.from)!=o.from&&(a=r);for(;;){let o=a.enter(e,t,s);if(!o)return a;a=o}}class Tl{cursor(e=0){return new an(this,e)}getChild(e,t=null,i=null){let l=Al(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return Al(this,e,t,i)}resolve(e,t=0){return qt(this,e,t,!1)}resolveInner(e,t=0){return qt(this,e,t,!0)}matchContext(e){return on(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class Ve extends Tl{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,l,s=0){for(let o=this;;){for(let{children:r,positions:d}=o._tree,h=t>0?r.length:-1;e!=h;e+=t){let c=r[e],f=d[e]+o.from;if(Ml(l,i,f,f+c.length)){if(c instanceof Ze){if(s&fe.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,l);if(u>-1)return new et(new gd(o,c,e,f),null,u)}else if(s&fe.IncludeAnonymous||!c.type.isAnonymous||rn(c)){let u;if(!(s&fe.IgnoreMounts)&&(u=hi.get(c))&&!u.overlay)return new Ve(u.tree,f,e,o);let p=new Ve(c,f,e,o);return s&fe.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?c.children.length-1:0,t,i,l)}}}if(s&fe.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let l;if(!(i&fe.IgnoreOverlays)&&(l=hi.get(this._tree))&&l.overlay){let s=e-this.from;for(let{from:o,to:r}of l.overlay)if((t>0?o<=s:o<s)&&(t<0?r>=s:r>s))return new Ve(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Al(a,e,t,i){let l=a.cursor(),s=[];if(!l.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=l.type.is(t),!l.nextSibling())return s}for(;;){if(i!=null&&l.type.is(i))return s;if(l.type.is(e)&&s.push(l.node),!l.nextSibling())return i==null?s:[]}}function on(a,e,t=e.length-1){for(let i=a.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class gd{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class et extends Tl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new et(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&fe.ExcludeBuffers)return null;let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new et(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new et(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new et(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,s=i.buffer[this.index+3];if(s>l){let o=i.buffer[this.index+1];e.push(i.slice(l,s,o)),t.push(0)}return new de(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function El(a){if(!a.length)return null;let e=0,t=a[0];for(let s=1;s<a.length;s++){let o=a[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof Ve&&t.index<0?null:t.parent,l=a.slice();return i?l[e]=i:l.splice(e,1),new kd(l,t)}class kd{constructor(e,t){this.heads=e,this.node=t}get next(){return El(this.heads)}}function bd(a,e,t){let i=a.resolveInner(e,t),l=null;for(let s=i instanceof Ve?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(l||(l=[i])).push(o.resolve(e,t)),s=o}else{let o=hi.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let r=new Ve(o.tree,o.overlay[0].from+s.from,-1,s);(l||(l=[i])).push(qt(r,e,t,!1))}}return l?El(l):i}class an{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ve)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Ve?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&fe.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(l.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let r=i._tree.children[s];if(this.mode&fe.IncludeAnonymous||r instanceof Ze||!r.type.isAnonymous||rn(r))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==l){if(l==this.index)return o;t=o,i=s+1;break e}l=this.stack[--s]}for(let l=i;l<this.stack.length;l++)t=new et(this.buffer,t,this.stack[l]);return this.bufferNode=new et(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return on(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,s=this.stack.length-1;l>=0;s--){if(s<0)return on(this.node,e,l);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[l]&&e[l]!=o.name)return!1;l--}}return!0}}function rn(a){return a.children.some(e=>e instanceof Ze||!e.type.isAnonymous||rn(e))}function yd(a){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=Vl,reused:s=[],minRepeatType:o=i.types.length}=a,r=Array.isArray(t)?new sn(t,t.length):t,d=i.types,h=0,c=0;function f(m,N,_,C,y,B){let{id:M,start:V,end:F,size:I}=r,D=c;for(;I<0;)if(r.next(),I==-1){let A=s[M];_.push(A),C.push(V-m);return}else if(I==-3){h=M;return}else if(I==-4){c=M;return}else throw new RangeError(`Unrecognized record size: ${I}`);let q=d[M],R,T,P=V-m;if(F-V<=l&&(T=v(r.pos-N,y))){let A=new Uint16Array(T.size-T.skip),S=r.pos-T.size,U=A.length;for(;r.pos>S;)U=x(T.start,A,U);R=new Ze(A,F-T.start,i),P=T.start-m}else{let A=r.pos-I;r.next();let S=[],U=[],E=M>=o?M:-1,$=0,ae=F;for(;r.pos>A;)E>=0&&r.id==E&&r.size>=0?(r.end<=ae-l&&(b(S,U,V,$,r.end,ae,E,D),$=S.length,ae=r.end),r.next()):B>2500?u(V,A,S,U):f(V,A,S,U,E,B+1);if(E>=0&&$>0&&$<S.length&&b(S,U,V,$,V,ae,E,D),S.reverse(),U.reverse(),E>-1&&$>0){let Rt=p(q);R=dn(q,S,U,0,S.length,0,F-V,Rt,Rt)}else R=g(q,S,U,F-V,D-F)}_.push(R),C.push(P)}function u(m,N,_,C){let y=[],B=0,M=-1;for(;r.pos>N;){let{id:V,start:F,end:I,size:D}=r;if(D>4)r.next();else{if(M>-1&&F<M)break;M<0&&(M=I-l),y.push(V,F,I),B++,r.next()}}if(B){let V=new Uint16Array(B*4),F=y[y.length-2];for(let I=y.length-3,D=0;I>=0;I-=3)V[D++]=y[I],V[D++]=y[I+1]-F,V[D++]=y[I+2]-F,V[D++]=D;_.push(new Ze(V,y[2]-F,i)),C.push(F-m)}}function p(m){return(N,_,C)=>{let y=0,B=N.length-1,M,V;if(B>=0&&(M=N[B])instanceof de){if(!B&&M.type==m&&M.length==C)return M;(V=M.prop(Y.lookAhead))&&(y=_[B]+M.length+V)}return g(m,N,_,C,y)}}function b(m,N,_,C,y,B,M,V){let F=[],I=[];for(;m.length>C;)F.push(m.pop()),I.push(N.pop()+_-y);m.push(g(i.types[M],F,I,B-y,V-B)),N.push(y-_)}function g(m,N,_,C,y=0,B){if(h){let M=[Y.contextHash,h];B=B?[M].concat(B):[M]}if(y>25){let M=[Y.lookAhead,y];B=B?[M].concat(B):[M]}return new de(m,N,_,C,B)}function v(m,N){let _=r.fork(),C=0,y=0,B=0,M=_.end-l,V={size:0,start:0,skip:0};e:for(let F=_.pos-m;_.pos>F;){let I=_.size;if(_.id==N&&I>=0){V.size=C,V.start=y,V.skip=B,B+=4,C+=4,_.next();continue}let D=_.pos-I;if(I<0||D<F||_.start<M)break;let q=_.id>=o?4:0,R=_.start;for(_.next();_.pos>D;){if(_.size<0)if(_.size==-3)q+=4;else break e;else _.id>=o&&(q+=4);_.next()}y=R,C+=I,B+=q}return(N<0||C==m)&&(V.size=C,V.start=y,V.skip=B),V.size>4?V:void 0}function x(m,N,_){let{id:C,start:y,end:B,size:M}=r;if(r.next(),M>=0&&C<o){let V=_;if(M>4){let F=r.pos-(M-4);for(;r.pos>F;)_=x(m,N,_)}N[--_]=V,N[--_]=B-m,N[--_]=y-m,N[--_]=C}else M==-3?h=C:M==-4&&(c=C);return _}let w=[],O=[];for(;r.pos>0;)f(a.start||0,a.bufferStart||0,w,O,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:w.length?O[0]+w[0].length:0;return new de(d[a.topID],w.reverse(),O.reverse(),k)}const Il=new WeakMap;function ui(a,e){if(!a.isAnonymous||e instanceof Ze||e.type!=a)return 1;let t=Il.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=a||!(i instanceof de)){t=1;break}t+=ui(a,i)}Il.set(e,t)}return t}function dn(a,e,t,i,l,s,o,r,d){let h=0;for(let b=i;b<l;b++)h+=ui(a,e[b]);let c=Math.ceil(h*1.5/8),f=[],u=[];function p(b,g,v,x,w){for(let O=v;O<x;){let k=O,m=g[O],N=ui(a,b[O]);for(O++;O<x;O++){let _=ui(a,b[O]);if(N+_>=c)break;N+=_}if(O==k+1){if(N>c){let _=b[k];p(_.children,_.positions,0,_.children.length,g[k]+w);continue}f.push(b[k])}else{let _=g[O-1]+b[O-1].length-m;f.push(dn(a,b,g,k,O,m,_,null,d))}u.push(m+w-s)}}return p(e,t,i,l,0),(r||d)(f,u,o)}class ht{constructor(e,t,i,l,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new ht(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&l.push(s);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],s=1,o=e.length?e[0]:null;for(let r=0,d=0,h=0;;r++){let c=r<t.length?t[r]:null,f=c?c.fromA:1e9;if(f-d>=i)for(;o&&o.from<f;){let u=o;if(d>=u.from||f<=u.to||h){let p=Math.max(u.from,d)-h,b=Math.min(u.to,f)-h;u=p>=b?null:new ht(p,b,u.tree,u.offset+h,r>0,!!c)}if(u&&l.push(u),o.to>f)break;o=s<e.length?e[s++]:null}if(!c)break;d=c.toA,h=c.toA-c.toB}return l}}class Dl{startParse(e,t,i){return typeof e=="string"&&(e=new wd(e)),i=i?i.length?i.map(l=>new nn(l.from,l.to)):[new nn(0,0)]:[new nn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let s=l.advance();if(s)return s}}}class wd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Y({perNode:!0});class pi{constructor(e,t,i,l,s,o,r,d,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=s,this.score=o,this.buffer=r,this.bufferBase=d,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new pi(e,[],t,i,i,0,[],0,l?new Pl(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,l=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let r=s.dynamicPrecedence(l);if(r&&(this.score+=r),i==0){this.pushState(s.getGoto(this.state,l,!0),this.reducePos),l<s.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(l,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),h=d?this.stack[d-2]:this.p.ranges[0].from,c=this.reducePos-h;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let f=d?this.stack[d-1]:0,u=this.bufferBase+this.buffer.length-f;if(l<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,h,p,u+4,!0)}if(e&262144)this.state=this.stack[d];else{let p=this.stack[d-3];this.state=s.getGoto(p,l,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(l,h)}storeNode(e,t,i,l=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,r=this.buffer.length;if(r==0&&o.parent&&(r=o.bufferBase-o.parent.bufferBase,o=o.parent),r>0&&o.buffer[r-4]==0&&o.buffer[r-1]>-1){if(t==i)return;if(o.buffer[r-2]>=t){o.buffer[r-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,l);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let r=!1;for(let d=o;d>0&&this.buffer[d-2]>i;d-=4)if(this.buffer[d-1]>=0){r=!0;break}if(r)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,l>4&&(l-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4);else{let s=e,{parser:o}=this.p;(l>this.pos||t<=o.maxNode)&&(this.pos=l,o.stateFlag(s,1)||(this.reducePos=l)),this.pushState(s,i),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,l,4)}}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(i,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new pi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new xd(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&l.push(t[s],o);if(this.stack.length<120)for(let s=0;l.length<8&&s<t.length;s+=2){let o=t[s+1];l.some((r,d)=>d&1&&r==o)||l.push(t[s],o)}t=l}let i=[];for(let l=0;l<t.length&&i.length<4;l+=2){let s=t[l+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[l],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let i=t>>19,l=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],l,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(l,s)=>{if(!t.includes(l))return t.push(l),e.allActions(l,o=>{if(!(o&393216))if(o&65536){let r=(o>>19)-s;if(r>1){let d=o&65535,h=this.stack.length-r*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return r<<19|65536|d}}else{let r=i(o,s+1);if(r!=null)return r}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Pl(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Pl{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class xd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class mi{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new mi(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new mi(this.stack,this.pos,this.index)}}function gi(a,e=Uint16Array){if(typeof a!="string")return a;let t=null;for(let i=0,l=0;i<a.length;){let s=0;for(;;){let o=a.charCodeAt(i++),r=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let d=o-32;if(d>=46&&(d-=46,r=!0),s+=d,r)break;s*=46}t?t[l++]=s:t=new e(s)}return t}class ki{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Fl=new ki;class vd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Fl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,l=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!l)return null;let o=this.ranges[--l];s-=i.from-o.to,i=o}for(;t<0?s>i.to:s>=i.to;){if(l==this.ranges.length-1)return null;let o=this.ranges[++l];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Fl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class xt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Cd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}xt.prototype.contextual=xt.prototype.fallback=xt.prototype.extend=!1,xt.prototype.fallback=xt.prototype.extend=!1;function Cd(a,e,t,i,l,s){let o=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&a[o];){let h=a[o+1];for(let p=o+3;p<h;p+=2)if((a[p+1]&r)>0){let b=a[p];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||Sd(b,e.token.value,l,s))){e.acceptToken(b);break}}let c=e.next,f=0,u=a[o+2];if(e.next<0&&u>f&&a[h+u*3-3]==65535){o=a[h+u*3-1];continue e}for(;f<u;){let p=f+u>>1,b=h+p+(p<<1),g=a[b],v=a[b+1]||65536;if(c<g)u=p;else if(c>=v)f=p+1;else{o=a[b+2],e.advance();continue e}}break}}function $l(a,e,t){for(let i=e,l;(l=a[i])!=65535;i++)if(l==t)return i-e;return-1}function Sd(a,e,t,i){let l=$l(t,i,e);return l<0||$l(t,i,a)<l}const Ne=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let cn=null;function Rl(a,e,t){let i=a.cursor(fe.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(a.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:a.length}}class Nd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Rl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Rl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],l=this.index[t];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[l],o=this.start[t]+i.positions[l];if(o>e)return this.nextStart=o,null;if(s instanceof de){if(o==e){if(o<this.safeFrom)return null;let r=o+s.length;if(r<=this.safeTo){let d=s.prop(Y.lookAhead);if(!d||r+d<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class Bd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ki)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:s}=l,o=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let h=0;h<s.length;h++){if(!(1<<h&o))continue;let c=s[h],f=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||f.start!=e.pos||f.mask!=o||f.context!=r)&&(this.updateCachedToken(f,c,e),f.mask=o,f.context=r),f.lookAhead>f.end+25&&(d=Math.max(f.lookAhead,d)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return d&&e.setLookAhead(d),!i&&e.pos==this.stream.end&&(i=new ki,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ki,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let r=s.specializers[o](this.stream.read(e.start,e.end),i);if(r>=0&&i.p.parser.dialect.allows(r>>1)){r&1?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,i,l){for(let s=0;s<l;s+=3)if(this.actions[s]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=i,l}addActions(e,t,i,l){let{state:s}=e,{parser:o}=e.p,{data:r}=o;for(let d=0;d<2;d++)for(let h=o.stateSlot(s,d?2:1);;h+=3){if(r[h]==65535)if(r[h+1]==1)h=He(r,h+2);else{l==0&&r[h+1]==2&&(l=this.putAction(He(r,h+2),t,i,l));break}r[h]==t&&(l=this.putAction(He(r,h+1),t,i,l))}return l}}class Od{constructor(e,t,i,l){this.parser=e,this.input=t,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new vd(t,l),this.tokens=new Bd(e,this.stream),this.topTerm=e.top[1];let{from:s}=l[0];this.stacks=[pi.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Nd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let r=e[o];for(;;){if(this.tokens.mainToken=null,r.pos>t)i.push(r);else{if(this.advanceStack(r,i,e))continue;{l||(l=[],s=[]),l.push(r);let d=this.tokens.getMainToken(r);s.push(d.value,d.end)}}break}}if(!i.length){let o=l&&_d(l);if(o)return Ne&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ne&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let o=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,s,i);if(o)return Ne&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((r,d)=>d.score-r.score);i.length>o;)i.pop();i.some(r=>r.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let r=i[o];for(let d=o+1;d<i.length;d++){let h=i[d];if(r.sameState(h)||r.buffer.length>500&&h.buffer.length>500)if((r.score-h.score||r.buffer.length-h.buffer.length)>0)i.splice(d--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let l=e.pos,{parser:s}=this,o=Ne?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(Y.contextHash)||0)==c))return e.useNode(f,u),Ne&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof de)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof de&&f.positions[0]==0)f=p;else break}}let r=s.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ne&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;h<d.length;){let c=d[h++],f=d[h++],u=d[h++],p=h==d.length||!i,b=p?e:e.split(),g=this.tokens.mainToken;if(b.apply(c,f,g?g.start:b.pos,u),Ne&&console.log(o+this.stackID(b)+` (via ${c&65536?`reduce of ${s.getName(c&65535)}`:"shift"} for ${s.getName(f)} @ ${l}${b==e?"":", split"})`),p)return!0;b.pos>l?t.push(b):i.push(b)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Ll(e,t),!0}}runRecovery(e,t,i){let l=null,s=!1;for(let o=0;o<e.length;o++){let r=e[o],d=t[o<<1],h=t[(o<<1)+1],c=Ne?this.stackID(r)+" -> ":"";if(r.deadEnd&&(s||(s=!0,r.restart(),Ne&&console.log(c+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),u=c;for(let p=0;f.forceReduce()&&p<10&&(Ne&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));p++)Ne&&(u=this.stackID(f)+" -> ");for(let p of r.recoverByInsert(d))Ne&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,i);this.stream.end>r.pos?(h==r.pos&&(h++,d=0),r.recoverByDelete(d,h),Ne&&console.log(c+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),Ll(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),de.build({buffer:mi.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(cn||(cn=new WeakMap)).get(e);return t||cn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Ll(a,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==a.pos&&i.sameState(a)){e[t].score<a.score&&(e[t]=a);return}}e.push(a)}class Vd{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class bi extends Dl{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function s(r,d,h){l[r].push([d,d.deserialize(String(h))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=Y[d]);for(let h=1;h<r.length;){let c=r[h++];if(c>=0)s(c,d,r[h++]);else{let f=r[h+-c];for(let u=-c;u>0;u--)s(r[h++],d,f);h++}}}this.nodeSet=new ln(t.map((r,d)=>Ce.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:l[d],top:i.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Vl;let o=gi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(jl),this.states=gi(e.states,Uint32Array),this.data=gi(e.stateData),this.goto=gi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new xt(o,r):r),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let l=new Od(this,e,t,i);for(let s of this.wrappers)l=s(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let s=l[t+1];;){let o=l[s++],r=o&1,d=l[s++];if(r&&i)return d;for(let h=s+(o>>1);s<h;s++)if(l[s]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let l=0;l<2;l++)for(let s=this.stateSlot(e,l?2:1),o;;s+=3){if((o=i[s])==65535)if(i[s+1]==1)o=i[s=He(i,s+2)];else{if(i[s+1]==2)return He(i,s+2);break}if(o==t||o==0)return He(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let s=this.stateSlot(e,1);l==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=He(this.data,s+2);else break;l=t(He(this.data,s+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=He(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];t.some((s,o)=>o&1&&s==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(bi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(s=>s.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let s=e.specializers.find(r=>r.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[l]=jl(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let l=null;for(let s=0;s<t.length;s++)if(!i[s])for(let o=this.dialects[t[s]],r;(r=this.data[o++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Vd(e,i,l)}static deserialize(e){return new bi(e)}}function He(a,e){return a[e]|a[e+1]<<16}function _d(a){let e=null;for(let t of a){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function jl(a){if(a.external){let e=a.extend?1:0;return(t,i)=>a.external(t,i)<<1|e}return a.get}let Md=0;class _e{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=Md++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof _e&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new _e(i,[],null,[]);if(l.set.push(l),t)for(let s of t.set)l.set.push(s);return l}static defineModifier(e){let t=new yi(e);return i=>i.modified.indexOf(t)>-1?i:yi.get(i.base||i,i.modified.concat(t).sort((l,s)=>l.id-s.id))}}let Td=0;class yi{constructor(e){this.name=e,this.instances=[],this.id=Td++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Ad(t,r.modified));if(i)return i;let l=[],s=new _e(e.name,l,e,t);for(let r of t)r.instances.push(s);let o=Ed(t);for(let r of e.set)if(!r.modified.length)for(let d of o)l.push(yi.get(r,d));return s}}function Ad(a,e){return a.length==e.length&&a.every((t,i)=>t==e[i])}function Ed(a){let e=[[]];for(let t=0;t<a.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(a[t]));return e.sort((t,i)=>i.length-t.length)}function zl(a){let e=Object.create(null);for(let t in a){let i=a[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let s=[],o=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==l.length)break;let p=l[f++];if(f==l.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let d=s.length-1,h=s[d];if(!h)throw new RangeError("Invalid path: "+l);let c=new hn(i,o,d>0?s.slice(0,d):null);e[h]=c.sort(e[h])}}return Id.add(e)}const Id=new Y;class hn{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}hn.empty=new hn([],2,null);function ql(a,e){let t=Object.create(null);for(let s of a)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:l=null}=e||{};return{style:s=>{let o=l;for(let r of s)for(let d of r.set){let h=t[d.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}const z=_e.define,wi=z(),tt=z(),Ul=z(tt),Wl=z(tt),it=z(),xi=z(it),fn=z(it),Pe=z(),ft=z(Pe),Fe=z(),$e=z(),un=z(),Ut=z(un),vi=z(),L={comment:wi,lineComment:z(wi),blockComment:z(wi),docComment:z(wi),name:tt,variableName:z(tt),typeName:Ul,tagName:z(Ul),propertyName:Wl,attributeName:z(Wl),className:z(tt),labelName:z(tt),namespace:z(tt),macroName:z(tt),literal:it,string:xi,docString:z(xi),character:z(xi),attributeValue:z(xi),number:fn,integer:z(fn),float:z(fn),bool:z(it),regexp:z(it),escape:z(it),color:z(it),url:z(it),keyword:Fe,self:z(Fe),null:z(Fe),atom:z(Fe),unit:z(Fe),modifier:z(Fe),operatorKeyword:z(Fe),controlKeyword:z(Fe),definitionKeyword:z(Fe),moduleKeyword:z(Fe),operator:$e,derefOperator:z($e),arithmeticOperator:z($e),logicOperator:z($e),bitwiseOperator:z($e),compareOperator:z($e),updateOperator:z($e),definitionOperator:z($e),typeOperator:z($e),controlOperator:z($e),punctuation:un,separator:z(un),bracket:Ut,angleBracket:z(Ut),squareBracket:z(Ut),paren:z(Ut),brace:z(Ut),content:Pe,heading:ft,heading1:z(ft),heading2:z(ft),heading3:z(ft),heading4:z(ft),heading5:z(ft),heading6:z(ft),contentSeparator:z(Pe),list:z(Pe),quote:z(Pe),emphasis:z(Pe),strong:z(Pe),link:z(Pe),monospace:z(Pe),strikethrough:z(Pe),inserted:z(),deleted:z(),changed:z(),invalid:z(),meta:vi,documentMeta:z(vi),annotation:z(vi),processingInstruction:z(vi),definition:_e.defineModifier("definition"),constant:_e.defineModifier("constant"),function:_e.defineModifier("function"),standard:_e.defineModifier("standard"),local:_e.defineModifier("local"),special:_e.defineModifier("special")};for(let a in L){let e=L[a];e instanceof _e&&(e.name=a)}ql([{tag:L.link,class:"tok-link"},{tag:L.heading,class:"tok-heading"},{tag:L.emphasis,class:"tok-emphasis"},{tag:L.strong,class:"tok-strong"},{tag:L.keyword,class:"tok-keyword"},{tag:L.atom,class:"tok-atom"},{tag:L.bool,class:"tok-bool"},{tag:L.url,class:"tok-url"},{tag:L.labelName,class:"tok-labelName"},{tag:L.inserted,class:"tok-inserted"},{tag:L.deleted,class:"tok-deleted"},{tag:L.literal,class:"tok-literal"},{tag:L.string,class:"tok-string"},{tag:L.number,class:"tok-number"},{tag:[L.regexp,L.escape,L.special(L.string)],class:"tok-string2"},{tag:L.variableName,class:"tok-variableName"},{tag:L.local(L.variableName),class:"tok-variableName tok-local"},{tag:L.definition(L.variableName),class:"tok-variableName tok-definition"},{tag:L.special(L.variableName),class:"tok-variableName2"},{tag:L.definition(L.propertyName),class:"tok-propertyName tok-definition"},{tag:L.typeName,class:"tok-typeName"},{tag:L.namespace,class:"tok-namespace"},{tag:L.className,class:"tok-className"},{tag:L.macroName,class:"tok-macroName"},{tag:L.propertyName,class:"tok-propertyName"},{tag:L.operator,class:"tok-operator"},{tag:L.comment,class:"tok-comment"},{tag:L.meta,class:"tok-meta"},{tag:L.invalid,class:"tok-invalid"},{tag:L.punctuation,class:"tok-punctuation"}]);const Dd=zl({String:L.string,Number:L.number,"True False":L.bool,PropertyName:L.propertyName,Null:L.null,",":L.separator,"[ ]":L.squareBracket,"{ }":L.brace}),Pd=bi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Dd],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});class X{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=vt(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Re.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=vt(this,e,t);let i=[];return this.decompose(e,t,i,0),Re.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Wt(this),s=new Wt(e);for(let o=t,r=t;;){if(l.next(o),s.next(o),o=0,l.lineBreak!=s.lineBreak||l.done!=s.done||l.value!=s.value)return!1;if(r+=l.value.length,l.done||r>=i)return!0}}iter(e=1){return new Wt(this,e)}iterRange(e,t=this.length){return new Kl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ql(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?X.empty:e.length<=32?new re(e):Re.from(re.split(e,[]))}}class re extends X{constructor(e,t=Fd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let s=0;;s++){let o=this.text[s],r=l+o.length;if((t?i:r)>=e)return new $d(l,r,i,o);l=r+1,i++}}decompose(e,t,i,l){let s=e<=0&&t>=this.length?this:new re(Hl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let o=i.pop(),r=Ci(s.text,o.text.slice(),0,s.length);if(r.length<=32)i.push(new re(r,o.length+s.length));else{let d=r.length>>1;i.push(new re(r.slice(0,d)),new re(r.slice(d)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);[e,t]=vt(this,e,t);let l=Ci(this.text,Ci(i.text,Hl(this.text,0,e)),t),s=this.length+i.length-(t-e);return l.length<=32?new re(l,s):Re.from(re.split(l,[]),s)}sliceString(e,t=this.length,i=`
|
|
1
|
+
(function(J,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],K):(J=typeof globalThis<"u"?globalThis:J||self,K(J.index={},J.UnioneBaseVue,J.Vue,J.antDesignVue,J.lodashEs,J.vueCodemirror,J.langJavascript,J.iconsVue,J.uuid))})(this,function(J,K,n,G,na,Lt,la,We,sa){"use strict";const oa={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},Ji=n.ref(oa);function Ae(a){return a&&(Ji.value=K.utils.obj.ext(Ji.value,a)),Ji.value}const aa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ra={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},da=n.ref([aa,ra]);function ca(a,e){return K.locales.loadLanguage(a,()=>new Promise((t,i)=>{const l=da.value.filter(s=>s.localeName==a);if(e)if(typeof e=="function")e().then(s=>{if(l.length==0){const o={...s,localeName:a};t(o)}else{const o={...l[0],...s};t(o)}});else if(l.length==0){const s={...e,localeName:a};t(s)}else{const s={...l[0],...e};t(s)}else l.length>0?t(l[0]):i("local language not defined ,lang:"+a)}))}const Zi={...K.locales};Zi.loadLanguage=ca;class ha{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=n.ref(e),this.$pid=n.ref(""),this.$store=n.ref({}),this.$forms=n.ref({}),this.$params=n.ref({}),this.$refObj=n.ref({}),this.$refData=n.ref({}),this.$model=t}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const t in this.$store.value)this.$store.value[t].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,i){}use(e,t,i){let l=this.$store.value[e];return l||(l=new en(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,t,i){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(s=>{i&&i(s)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class en{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,i){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=t,this.$data=n.ref(t=="form"?{}:{body:[],total:0}),this.$dialog=K.useDialog(),this.$model=i||n.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}$processParams(e,t){if(t)t.forEach(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}find(e){const t=this.$store.controller+"/find";return this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e.body=this.$processParams(e.body,this.$store.findParams),new Promise((i,l)=>{const s=G.message.loading("数据加载中...");K.axios.form({url:t,method:"post",data:e}).then(o=>{o.success?(this.$data.value=o,i(o)):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:o})}).finally(()=>{s()})})}save(e){const t=this.$store.controller+"/save";return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((i,l)=>{const s=G.message.loading("数据提交中...");K.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(o=>{o.success?(this.$type=="form"&&(this.$data.value=o.body||{}),o.silence||G.message.success(o.message),i(o)):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:o})}).finally(()=>{s()})})}loadByIds(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/loadByIds";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(o=>{o.success?t(o):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:o})}).finally(()=>{l()})})}detail(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/detail";K.axios.form({url:s,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(o=>{o.success?(this.$type=="form"&&(this.$data.value=o.body),t(o)):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,err:o})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=G.message.loading("数据处理中..."),s=this.$store.controller+"/delete";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(o=>{o.success?t(o):(o.silence||this.$dialog.error({content:o.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,result:o}))}).catch(o=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,err:o})}).finally(()=>{l()})}})})}}class fa{$event;$onces;$delayEmit;constructor(){this.$event=n.ref({}),this.$onces=n.ref({}),this.$delayEmit=n.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];t(i)}}$emit(e,t){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(t)}this.$event.value[e]?this.$event.value[e](t):(this.$delayEmit.value[e]=t,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,t){this.$onces.value[e]=t}$off(e){delete this.$event.value[e]}}class wt{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=n.ref("run"),this.type=n.ref(e.types||"setting"),this.define=n.ref(e),this.ebus=new fa,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ha(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=K.useDialog(),this.loadConfig(t)}sn(){return this.define.value.sn}load(e,t){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",t),t&&t.configs&&(this.define.value=t,this.type.value=this.define.value.types||"setting",this.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}K.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):t&&t.configs&&(this.define.value=t,this.loadConfig(t.configs))})}save(){return new Promise((e,t)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),t();return}this.$axiosProccess.value.save=!0;const i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),K.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(s=>{this.$axiosProccess.value.save=!1,s.success?(G.message.success(s.message),this.define.value=s.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(s.body)):(this.$dialog.error({content:s.message}),t())}).catch(s=>{console.error("页面配置保存失败",s),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,t){if(t){const i={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(t=>{t.wid||(t.wid="w:"+na.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ua={class:"widget-setting-dialog"},pa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(a,{emit:e}){const t=e,i=n.ref(),l=n.ref(!1);function s(){i.value&&(l.value=!0),t("setting")}function o(){t("saving"),l.value=!1}return(r,d)=>{const h=n.resolveComponent("SettingOutlined"),c=n.resolveComponent("a-tooltip"),f=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",a.model])},[n.createVNode(c,{title:a.settingTitle},{default:n.withCtx(()=>[a.model=="edit"&&(r.$slots["widget-setting"]||a.custome)?(n.openBlock(),n.createBlock(h,{key:0,class:"widget-setting",onClick:s})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),a.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(f,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:i,open:l.value,"onUpdate:open":d[0]||(d[0]=u=>l.value=u),centered:"",width:"80%",onOk:o},{default:n.withCtx(()=>[n.createElementVNode("div",ua,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),Z=(a,e)=>{const t=a.__vccOpts||a;for(const[i,l]of e)t[i]=l;return t},rt=Z(pa,[["__scopeId","data-v-3a88c0c0"]]),ma={key:0},ga=["onClick"],ci=Z(n.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const t=a,i=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),s={mounted:k=>k.focus()},o=n.ref({});function r(){const k=Object.keys(o.value);if(k.length)for(let p in k){const B=g.value.form.action.params[p];B&&o.value[p]&&Object.keys(o.value[p]).forEach(V=>{B[V]=o.value[p][V]})}o.value={}}function d(k,p,B){r();const V={};V[B]=p[B]||"",B=="showIndex"&&(V[B]=p.show?.query?.index),o.value[k]=V}function h(k,p,B){if(!p||!B){o.value={};return}const V=o.value[k][B];p[B]=V,o.value={}}function c(){g.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const u=n.ref(""),m=n.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,p)=>u.value!=p&&t.preset.includes(p)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=n.ref([la.javascript()]),g=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),v=n.ref();function w(k,p,B={}){k=JSON.parse(JSON.stringify(k)),k.event||(k.event={}),k.props||(k.props={}),k.action||(k.action={}),Object.keys(k.action).includes("maskClosable")||(k.action.maskClosable=!0),k.action.params||(k.action.params=[]),u.value=k.name,g.value.form=k,g.value.helps=B,g.value.visible=!0,v.value=p}const x=n.ref(null);function O(){x.value&&x.value.validate().then(()=>{g.value.visible=!1,v.value(g.value.form)})}return e({open:w,close}),(k,p)=>{const B=n.resolveComponent("a-input"),V=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-select"),y=n.resolveComponent("a-input-number"),N=n.resolveComponent("a-checkbox"),M=n.resolveComponent("a-tab-pane"),A=n.resolveComponent("a-switch"),E=n.resolveComponent("a-button"),D=n.resolveComponent("a-divider"),z=n.resolveComponent("ToolOutlined"),P=n.resolveComponent("a-tooltip"),U=n.resolveComponent("a-table"),_=n.resolveComponent("a-tabs"),F=n.resolveComponent("a-form"),T=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock(T,{visible:g.value.visible,"onUpdate:visible":p[23]||(p[23]=S=>g.value.visible=S),title:g.value.title,centered:"",width:"50%",onOk:O},{default:n.withCtx(()=>[n.createVNode(F,{name:"basic",ref_key:"form",ref:x,rules:m.value,model:g.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(_,null,{default:n.withCtx(()=>[n.createVNode(M,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(V,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.form.title,"onUpdate:value":p[0]||(p[0]=S=>g.value.form.title=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.form.name,"onUpdate:value":p[1]||(p[1]=S=>g.value.form.name=S),disabled:t.preset.includes(g.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(V,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.form.icon,"onUpdate:value":p[2]||(p[2]=S=>g.value.form.icon=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.type,"onUpdate:value":p[3]||(p[3]=S=>g.value.form.type=S),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),n.createVNode(V,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(y,{value:g.value.form.index,"onUpdate:value":p[4]||(p[4]=S=>g.value.form.index=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.size,"onUpdate:value":p[5]||(p[5]=S=>g.value.form.size=S),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(V,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(N,{checked:g.value.form.props.block,"onUpdate:checked":p[6]||(p[6]=S=>g.value.form.props.block=S)},{default:n.withCtx(()=>p[24]||(p[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:g.value.form.props.danger,"onUpdate:checked":p[7]||(p[7]=S=>g.value.form.props.danger=S)},{default:n.withCtx(()=>p[25]||(p[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:g.value.form.props.ghost,"onUpdate:checked":p[8]||(p[8]=S=>g.value.form.props.ghost=S)},{default:n.withCtx(()=>p[26]||(p[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(M,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(V,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.action.type,"onUpdate:value":p[9]||(p[9]=S=>g.value.form.action.type=S),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.form.action.psn,"onUpdate:value":p[10]||(p[10]=S=>g.value.form.action.psn=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.form.action.component,"onUpdate:value":p[11]||(p[11]=S=>g.value.form.action.component=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(V,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.form.action.href,"onUpdate:value":p[12]||(p[12]=S=>g.value.form.action.href=S)},null,8,["value"])]),_:1}),["link","route"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.action.target,"onUpdate:value":p[13]||(p[13]=S=>g.value.form.action.target=S),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:g.value.form.action.position,"onUpdate:value":p[14]||(p[14]=S=>g.value.form.action.position=S),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(B,{value:g.value.form.action.title,"onUpdate:value":p[15]||(p[15]=S=>g.value.form.action.title=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(A,{checked:g.value.form.action.maskClosable,"onUpdate:checked":p[16]||(p[16]=S=>g.value.form.action.maskClosable=S),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(y,{value:g.value.form.action.width,"onUpdate:value":p[17]||(p[17]=S=>g.value.form.action.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(g.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(y,{value:g.value.form.action.height,"onUpdate:value":p[18]||(p[18]=S=>g.value.form.action.height=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(D,{orientation:"left"},{default:n.withCtx(()=>[p[29]||(p[29]=n.createTextVNode("参数列表 ")),n.createVNode(E,{size:"small",class:"param-btn",onClick:c},{default:n.withCtx(()=>p[27]||(p[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(E,{size:"small",class:"param-btn",danger:"",onClick:f},{default:n.withCtx(()=>p[28]||(p[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode(U,{columns:i.value,"data-source":g.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["name","title"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",ma,[n.createVNode(z),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),["value"].includes(S.key)?(n.openBlock(),n.createBlock(P,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(z),n.createTextVNode(" "+n.toDisplayString(S.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:q,record:I,index:$})=>[["name","title","value"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!o.value[$]||!Object.keys(o.value[$]).includes(S.dataIndex))&&!q&&"empty"]),onClick:ae=>d($,I,S.dataIndex)},[o.value[$]&&Object.keys(o.value[$]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(B,{key:0,value:o.value[$][S.dataIndex],"onUpdate:value":ae=>o.value[$][S.dataIndex]=ae,onBlur:ae=>h($,I,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(q),1)],64))],10,ga)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(M,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(V,{label:"点击事件",help:g.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.clickScript,"onUpdate:modelValue":p[19]||(p[19]=S=>g.value.form.event.clickScript=S),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(V,{label:"禁用逻辑",help:g.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.disableScript,"onUpdate:modelValue":p[20]||(p[20]=S=>g.value.form.event.disableScript=S),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(V,{label:"显示逻辑",help:g.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.visibleScript,"onUpdate:modelValue":p[21]||(p[21]=S=>g.value.form.event.visibleScript=S),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(V,{label:"动态标题",help:g.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:g.value.form.event.titleScript,"onUpdate:modelValue":p[22]||(p[22]=S=>g.value.form.event.titleScript=S),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),ka=["src"],ba=["src"],ya=Z(n.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(a,{emit:e}){const t=Ae(),i=a,l=K.useSession();n.watch(()=>i.widget?.event,()=>{o()}),n.onMounted(()=>{o()});const s=n.ref({});function o(){i.widget?.event&&(i.widget.event.clickScript?s.value.click=new Function("ctx","btn","event",i.widget.event.clickScript):i.widget.event.click&&(s.value.click=i.widget.event.click),i.widget.event.disableScript?s.value.disable=new Function("ctx","btn",i.widget.event.disableScript):i.widget.event.disable&&(s.value.disable=i.widget.event.disable),i.widget.event.visibleScript?s.value.visible=new Function("ctx","btn",i.widget.event.visibleScript):i.widget.event.visible&&(s.value.visible=i.widget.event.visible),i.widget.event.titleScript?s.value.title=new Function("ctx","btn",i.widget.event.titleScript):i.widget.event.title&&(s.value.title=i.widget.event.title)),typeof i.widget.click=="function"&&(s.value.click=i.widget.click),typeof i.widget.title=="function"&&(s.value.title=i.widget.title),typeof i.widget.visible=="function"&&(s.value.visible=i.widget.visible),typeof i.widget.disabled=="function"&&(s.value.disable=i.widget.disabled)}const r=n.computed(()=>s.value.title?s.value.title(u.value,i.widget):i.widget.title),d=n.computed(()=>s.value.visible?s.value.visible(u.value,i.widget)!=!1:i.widget.visible!=!1),h=n.computed(()=>i.disabled?!0:s.value.disable?s.value.disable(u.value,i.widget):!1),c=n.ref(null);function f(){c.value?.open(i.widget,O=>{console.log("btn props",O),Object.keys(O).forEach(k=>{i.widget[k]=O[k]}),console.log("props btn",i.widget)})}const u=n.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),m=n.ref({open:!1}),b=n.computed(()=>{if(i.widget.action?.href){let O=i.widget.action.href;const k=O.matchAll("{[a-zA-Z.]*}"),p=[];let B=null;for(;B=k.next();){if(B&&B.value&&B.value[0]){let V=B.value[0].substring(1,B.value[0].length-1);p.includes(V)||p.push(V)}if(B.done)break}if(p.length>0)for(let V=0;V<p.length;V++){let C=p[V],y=K.utils.obj.getValue(u.value,C);y?y instanceof Object?O=O.replaceAll("{"+C+"}",JSON.stringify(y)):Array.isArray(y)?O=O.replaceAll("{"+C+"}",y.join(",")):O=O.replaceAll("{"+C+"}",y):O=O.replaceAll("{"+C+"}","")}return O}return""}),g=n.computed(()=>{const O={};let k=i.widget.action?.href||i.widget.action?.link;if(k){const p=k.matchAll("{[a-zA-Z0-9.]*}"),B=[];let V=null;for(;V=p.next();){if(V&&V.value&&V.value[0]){let y=V.value[0].substring(1,V.value[0].length-1);B.includes(y)||B.push(y)}if(V.done)break}if(B.length>0)for(let y=0;y<B.length;y++){let N=B[y],M=K.utils.obj.getValue(u.value,N);M?M instanceof Object?k=k.replaceAll("{"+N+"}",JSON.stringify(M)):Array.isArray(M)?k=k.replaceAll("{"+N+"}",M.join(",")):k=k.replaceAll("{"+N+"}",M):k=k.replaceAll("{"+N+"}","")}const C=k.split("?")[1];C&&C.split("&").forEach(y=>{const N=y.split("=");N[0]&&N[1]&&(O[N[0]]=N[1])})}return i.widget.action?.params&&i.widget.action.params.filter(p=>p.value+"").forEach(p=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(p.value)){let V=K.utils.obj.getValue(u.value,p.value);O[p.name]=V}else O[p.name]=p.value}),O}),v=e,w=n.inject("router");function x(O){if(t.isDebug&&console.log("unione btn click",i.widget,O),!(s.value.click&&s.value.click(u.value,i.widget,O)==!1)){if(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog")m.value.open=!0;else if(i.widget.action?.type=="route"&&(i.widget.action?.href||i.widget.action?.link)){if(i.widget.action.link&&i.editor?.type.value=="code")return;w.push({path:i.widget.action.href||i.widget.action?.link,query:g.value})}v("click",{btn:i.widget,event:O})}}return(O,k)=>{const p=n.resolveComponent("a-button"),B=n.resolveComponent("a-drawer"),V=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(rt,{key:0,class:n.normalizeClass(["unione-btn",a.widget.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:f,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[n.createVNode(p,n.mergeProps({disabled:h.value,size:a.widget.size||"small",type:a.type||a.widget.type,shape:a.widget.shape,class:"unione-btn-"+a.widget.name,loading:a.widget.loading,target:a.widget.action?.target,title:a.widget.tooltip,onClick:x},a.widget.props),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value)+" ",1)]),_:2},[a.widget.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"]),a.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(B,{key:0,open:m.value.open,"onUpdate:open":k[0]||(k[0]=C=>m.value.open=C),title:a.widget.action?.title,placement:a.widget.action?.position,maskClosable:a.widget.action?.maskClosable,width:a.widget.action?.width,bodyStyle:{padding:0,overflow:!a.widget.action.component||a.widget.action.component=="iframe"?"hidden":"auto"}},{default:n.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value},null,8,ka)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),a.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(V,{key:1,open:m.value.open,"onUpdate:open":k[1]||(k[1]=C=>m.value.open=C),title:a.widget.action?.title,width:a.widget.action?.width,maskClosable:a.widget.action?.maskClosable,centered:"",footer:null},{default:n.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value,style:n.normalizeStyle({height:a.widget.action?.height?a.widget.action?.height+"px":""})},null,12,ba)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(ci,{ref_key:"btnSetting",ref:c,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-21657bec"]]),wa={key:0,class:"unione-widget-empty-tip"},xa=Z(n.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(a){const e=a,t=n.ref(),i=n.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,s)=>{const o=n.resolveComponent("a-tab-pane"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:n.withCtx(()=>[i.value?(n.openBlock(),n.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":s[0]||(s[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,h)=>(n.openBlock(),n.createBlock(o,{key:h,class:"unione-layout-tab-pane"},{tab:n.withCtx(()=>[n.createElementVNode("span",null,[d.icon?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.icon),{key:0})):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d.title),1)])]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.chidlren,(c,f)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(c.widget),{key:f,wid:c.wid,editor:e.editor,widget:c},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",wa,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),va={class:"title"},Ca={class:"text"},Sa={key:0,class:"reactive"},Na={key:1,class:"opts"},Ba={class:"warp"},Oa=Z(n.defineComponent({__name:"section",props:n.mergeModels({title:{type:String,required:!1},icon:{type:String,required:!1},type:{type:String,required:!1},location:{type:String,default:"left"},reactive:{type:Boolean,default:!1},wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},{modelValue:{type:Boolean,default:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=n.computed(()=>e.editor?.widget(e.wid)||e.widget),i=n.computed(()=>t.value?.title||e.title),l=n.computed(()=>t.value?.icon||e.icon),s=n.computed(()=>t.value?.type||e.type),o=n.useModel(a,"modelValue");function r(){e.reactive&&(o.value=!o.value)}return(d,h)=>(n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-section",o.value?"open":"close"]),model:e.editor?.model},{default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[n.createElementVNode("div",va,[s.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",s.value])},null,2)):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",Ca,n.toDisplayString(i.value),1)]),a.reactive?(n.openBlock(),n.createElementBlock("div",Sa,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),a.location=="left"?(n.openBlock(),n.createElementBlock("div",Na,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Ba,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,o.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Va={class:"unione-props-setting unione-form-setting"},_a={class:"unione-form-btns"},Ma={key:0},Ta=["onClick"],Aa={class:"field-txt"},Ea=["onClick"],Ia={key:1,class:"field-txt"},Da=["onClick"],Pa={key:0,class:"field-txt"},Fa={key:3,class:"edit-field"},$a={key:0},Ra=["onClick"],La=Z(n.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.settings||(C.configs.settings={}),C.configs.settings.btns||(C.configs.settings.btns=[]),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(y=>({value:y.sn,label:y.title+"("+y.name+")"}))),s=n.computed(()=>{const C=i.value.configs.settings.btns,y=C.map(N=>N.name);if(!y.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(N.index,0,N)}if(!y.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let M=N.index||1;C.splice(M,0,N)}if(!y.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(N.index,0,N)}if(!y.includes("back")){const N={title:"返回",type:"default",index:3,visible:!0,name:"back"};C.splice(N.index,0,N)}return C}),o=n.ref(null);function r(C){o.value&&o.value.open(C,y=>{y.visible=!0,Object.keys(y).forEach(N=>{C[N]=y[N]}),i.value.configs.settings.btns.sort((N,M)=>{const A=N.index||1,E=M.index||1;return A-E}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const C=i.value.configs.settings.btns.length+1;let y={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};y.name="new_"+i.value.configs.settings.btns.length;const N=i.value.configs.settings.btns.filter(M=>M.name==y.name).length;N>0&&(y.name=y.name+N),i.value.configs.settings.btns.push(y),e.editor.widget(e.wid,i.value),o.value.open(y,M=>{Object.keys(M).forEach(A=>{y[A]=M[A]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(C){const y=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const N=[];i.value.configs.settings.btns.forEach(M=>{M.name!=C.name&&N.push(M)}),i.value.configs.settings.btns=N}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{y()}})}const c=n.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:C=>{const y=c.value.widgets.filter(N=>N.value==C);return y[0]?y[0].label:C},toSetting:()=>{}}),f=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let y="";return C.rules&&(y=C.rules.filter(N=>N.enable).length||""),y&&(y="("+y+")"),y},toSetting:()=>{const C=f.value.props,y={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(y.min=C.rangeMin,y.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(y.max=C.rangeMax,y.enable=!0);const N={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(N.pattern=C.regExpress,N.enable=!0),f.value.field.rules=[y,N],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(C){f.value.visible=!0,f.value.field=C;const y=C.rules||[],N={trigger:"change",whitespace:!0};y.forEach(M=>{M.name=="reg"&&(N.trigger=M.trigger,N.whitespace=M.whitespace,N.regExpress=M.pattern,N.regMessage=M.message),M.name=="range"&&(N.rangeMin=M.min,N.rangeMax=M.max,N.rangeMessage=M.message)}),f.value.props=N}const m=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function b(C,y){const N=x.value.filter(A=>A.name==C.name);N.forEach(A=>{y!="isSort"?A[y]=!0:A[y]=!A[y]});const M=N[0];if(!(!M||y=="isSort")){switch(m.value.prop=y,m.value.field=C,M.show||(M.show={}),y){case"isQuery":M.show.query||(M.show.query={}),m.value.show=M.show.query,m.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":M.show.form||(M.show.form={}),m.value.show=M.show.form,m.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":M.show.view||(M.show.view={}),m.value.show=M.show.view,m.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":M.show.list||(M.show.list={}),m.value.show=M.show.list,m.value.title=`列头设置/${C.title}(${C.name})`;break}m.value.visible=!0}}const g=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{g.value.convert.options||(g.value.convert.options=[]),g.value.convert.options.push({label:"",value:""})},toDelOption:(C,y)=>{g.value.convert.options.splice(C,1)},toSetting:()=>{g.value.visible=!1}});function v(C){g.value.visible=!0,g.value.field=C,g.value.convert=C.convert||{}}const w=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),x=n.computed(()=>w.value.fields?.length?w.value.fields:[]),O={mounted:C=>C.focus()},k=n.ref({});function p(C,y){const N={};y=="convertName"?N[y]=C.convert?.type:N[y]=C[y]||"",k.value={},k.value[C.name]=N}function B(C,y){{k.value={};return}}function V(C,y){x.value.filter(M=>M.name==C.name).forEach(M=>{M[y]=!M[y]})}return(C,y)=>{const N=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),A=n.resolveComponent("a-button"),E=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-select"),z=n.resolveComponent("ToolOutlined"),P=n.resolveComponent("a-checkbox"),U=n.resolveComponent("a-table"),_=n.resolveComponent("a-select-option"),F=n.resolveComponent("a-form-item"),T=n.resolveComponent("a-form"),S=n.resolveComponent("a-modal"),q=n.resolveComponent("a-checkbox-group"),I=n.resolveComponent("a-input-number"),$=n.resolveComponent("a-input"),ae=n.resolveComponent("a-col"),Rt=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Va,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[23]||(y[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",_a,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,L=>(n.openBlock(),n.createBlock(A,n.mergeProps({key:L.name,class:["btn",L.name,!L.visible&&"deleted"],type:L.visible?L.type:"default",size:L.size,ref_for:!0},L.props||{},{onClick:Ue=>r(L)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(L.title)+" ",1),L.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers(Ue=>h(L),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[L.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(L.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(A,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:y[0]||(y[0]=L=>d())},{default:n.withCtx(()=>[n.createVNode(E)]),_:1})]),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[24]||(y[24]=[n.createTextVNode("表单设置")])),_:1}),y[36]||(y[36]=n.createTextVNode(" 数据模型:")),n.createVNode(D,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":y[1]||(y[1]=L=>i.value.dataModel=L)},null,8,["options","value"]),n.createVNode(U,{columns:t.value,"data-source":x.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:L})=>[["widget","rules","convertName"].includes(L.key)?(n.openBlock(),n.createElementBlock("span",Ma,[n.createVNode(z),n.createTextVNode(" "+n.toDisplayString(L.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:L,text:Ue,record:ie})=>[["rules"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!f.value.showInfo(ie)&&"empty"]),onClick:xe=>u(ie)},[n.createElementVNode("span",Aa,n.toDisplayString(f.value.showInfo(ie)),1),f.value.showInfo(ie)?(n.openBlock(),n.createBlock(A,{key:0,type:"link"},{default:n.withCtx(()=>y[25]||(y[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ta)):["widget"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!k.value[ie.name]||!Object.keys(k.value[ie.name]).includes(L.dataIndex))&&!Ue&&"empty"]),onClick:xe=>p(ie,L.dataIndex)},[k.value[ie.name]&&Object.keys(k.value[ie.name]).includes(L.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ie[L.dataIndex],"onUpdate:value":xe=>ie[L.dataIndex]=xe,options:c.value.widgets,onBlur:y[2]||(y[2]=xe=>B())},null,8,["value","onUpdate:value","options"])),[[O]]):(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(c.value.widgetName(Ue)),1))],10,Ea)):["convertName"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!k.value[ie.name]||!Object.keys(k.value[ie.name]).includes(L.dataIndex))&&!ie.convert?.type&&"empty"]),onClick:xe=>p(ie,L.dataIndex)},[k.value[ie.name]&&Object.keys(k.value[ie.name]).includes(L.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ie[L.dataIndex],"onUpdate:value":xe=>ie[L.dataIndex]=xe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:y[3]||(y[3]=xe=>B())},null,8,["value","onUpdate:value"])),[[O]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[ie.convert?.type?(n.openBlock(),n.createElementBlock("span",Pa,n.toDisplayString(ie.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),ie.convert?.type?(n.openBlock(),n.createBlock(A,{key:1,type:"link",onClick:n.withModifiers(xe=>v(ie),["stop"])},{default:n.withCtx(()=>y[26]||(y[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Da)):["isForm","isView"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",Fa,[n.createVNode(P,{checked:ie[L.dataIndex],onClick:xe=>V(ie,L.dataIndex)},null,8,["checked","onClick"]),n.createVNode(A,{type:"link",onClick:xe=>b(ie,L.dataIndex)},{default:n.withCtx(()=>y[27]||(y[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(S,{visible:c.value.visible,"onUpdate:visible":y[5]||(y[5]=L=>c.value.visible=L),title:"控件设置",onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(T,{model:c.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[c.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(F,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(D,{value:c.value.props.mode,"onUpdate:value":y[4]||(y[4]=L=>c.value.props.mode=L),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(_,{value:"multiple"},{default:n.withCtx(()=>y[28]||(y[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(_,{value:"tags"},{default:n.withCtx(()=>y[29]||(y[29]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(S,{visible:f.value.visible,"onUpdate:visible":y[13]||(y[13]=L=>f.value.visible=L),title:"规则设置",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(T,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[30]||(y[30]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(F,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(q,{value:f.value.props.trigger,"onUpdate:value":y[6]||(y[6]=L=>f.value.props.trigger=L),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(F,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(P,{value:f.value.props.whitespace,"onUpdate:value":y[7]||(y[7]=L=>f.value.props.whitespace=L),checked:f.value.props.whitespace},{default:n.withCtx(()=>y[31]||(y[31]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[32]||(y[32]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(F,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(I,{value:f.value.props.rangeMin,"onUpdate:value":y[8]||(y[8]=L=>f.value.props.rangeMin=L)},null,8,["value"]),y[33]||(y[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(I,{value:f.value.props.rangeMax,"onUpdate:value":y[9]||(y[9]=L=>f.value.props.rangeMax=L)},null,8,["value"])]),_:1}),n.createVNode(F,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode($,{value:f.value.props.rangeMessage,"onUpdate:value":y[10]||(y[10]=L=>f.value.props.rangeMessage=L)},null,8,["value"])]),_:1}),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[34]||(y[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(F,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode($,{value:f.value.props.regExpress,"onUpdate:value":y[11]||(y[11]=L=>f.value.props.regExpress=L)},null,8,["value"])]),_:1}),n.createVNode(F,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode($,{value:f.value.props.regMessage,"onUpdate:value":y[12]||(y[12]=L=>f.value.props.regMessage=L)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(S,{visible:m.value.visible,"onUpdate:visible":y[20]||(y[20]=L=>m.value.visible=L),title:m.value.title,onOk:m.value.toSetting},{default:n.withCtx(()=>[n.createVNode(T,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(F,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.index,"onUpdate:value":y[14]||(y[14]=L=>m.value.show.index=L)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(F,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode($,{value:m.value.show.width,"onUpdate:value":y[15]||(y[15]=L=>m.value.show.width=L)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(F,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode($,{value:m.value.show.labelWidth,"onUpdate:value":y[16]||(y[16]=L=>m.value.show.labelWidth=L)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(F,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode($,{value:m.value.show.valueWidth,"onUpdate:value":y[17]||(y[17]=L=>m.value.show.valueWidth=L)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(F,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(D,{value:m.value.show.fixed,"onUpdate:value":y[18]||(y[18]=L=>m.value.show.fixed=L),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(F,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(D,{value:m.value.show.align,"onUpdate:value":y[19]||(y[19]=L=>m.value.show.align=L),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(S,{visible:g.value.visible,"onUpdate:visible":y[22]||(y[22]=L=>g.value.visible=L),title:g.value.convert.type=="dict"?"字典设置":"选项设置",onOk:g.value.toSetting},{default:n.withCtx(()=>[g.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",$a,[n.createVNode(A,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:g.value.toAddOption},{default:n.withCtx(()=>y[35]||(y[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(U,{columns:g.value.optionColumn,"data-source":g.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:L,record:Ue,index:ie})=>[L.dataIndex==="label"?(n.openBlock(),n.createBlock($,{key:0,value:Ue.label,"onUpdate:value":xe=>Ue.label=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),L.dataIndex==="value"?(n.openBlock(),n.createBlock($,{key:1,value:Ue.value,"onUpdate:value":xe=>Ue.value=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),L.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:xe=>g.value.toDelOption(ie,Ue)},"删除",8,Ra)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),g.value.convert.type=="dict"?(n.openBlock(),n.createBlock(T,{key:1,model:g.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Rt,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(ae,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(F,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode($,{value:g.value.convert.dict,"onUpdate:value":y[21]||(y[21]=L=>g.value.convert.dict=L)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(ci,{ref_key:"btnSetting",ref:o},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),ja=Z(n.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(a,{expose:e}){const t=a,i=n.ref(!1),l=n.ref(),s=n.ref({}),o=n.ref(null);n.onMounted(()=>{if(t.editor&&r.value.dsn){const w=t.editor.dataManager();r.value.primary&&w.psn(r.value.dsn),o.value.setDisabled=v,o.value.getValue=f,o.value.setValue=u,o.value.reset=m,l.value=w.useForm(r.value.dsn,o.value,x=>{s.value=x.body||{}})}b()});const r=n.computed(()=>t.widget||t.form||{}),d=n.computed(()=>{let w=r.value.widgets||[];return!w.length&&t.form?.fields&&(w=t.form.fields),w.forEach(x=>{x.widget||(x.widget="unione-form-item"),x.control||(x.control="a-input")}),w}),h=n.inject("pageSetting"),c=n.computed(()=>r.value.setting||h?.form||{});n.provide("formSetting",c.value);function f(){return s.value}function u(w){s.value=w,b()}function m(){s.value={},b()}function b(){const w=x=>{x.widget=="unione-form-item"&&x.name&&(x.value!=null&&x.value!=null&&x.value!=""||x.value==0)&&(s.value[x.name]==null||s.value[x.name]==null||s.value[x.name]=="")&&(s.value[x.name]=x.value),x.widgets?.forEach(O=>{w(O)})};d.value.forEach(x=>{w(x)})}function g(){return o.value.validate()}function v(w=!0){i.value=w}return e({validate:g,getValue:f,setValue:u,reset:m,setDisabled:v}),(w,x)=>{const O=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-form-widget","setting-title":"表单设置",model:a.editor?.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(O,{ref_key:"formObj",ref:o,model:s.value,class:n.normalizeClass(["unione-form",a.editor?.model.value,"form-layout-col-"+(c.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(k,p)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(k.widget),{key:p,widget:k,editor:a.editor,value:s.value[k.name],"onUpdate:value":B=>s.value[k.name]=B,disabled:i.value,formValue:s.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[a.editor&&r.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(La,{wid:r.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-c2f74698"]]);function bl(a,e=!1){const t=Ae();if(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),!a)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+a);return i&&e==!1?Promise.resolve(JSON.parse(i)):new Promise((l,s)=>{K.axios.admin({url:"/api/system/dict/load/"+a}).then(o=>{if(o.success){const r=o.body.filter(d=>d.dictName!=d.dictKey);r.forEach(d=>{d.value=d.dictKey,d.label=d.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+a,JSON.stringify(r)),l(r)):s("字典加载失败,dict:"+a+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+a,o),s("字典加载失败,dict:"+a+",error:"+o.message)})})}async function yl(a,e){const t=Ae();if(t.isDebug&&console.log("进入:根据获取字典选项方法,dict name:"+a+",key:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await bl(a),l=i.filter(s=>s.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function za(a,e){const t=await yl(a,e);return Promise.resolve(t.dictValue)}const wl={load:bl,getLabel:za,getOption:yl};class dt{convertObj;config;options;constructor(e){(!e||!e.types)&&console.error("转换器定义不能为空,type不能为空",e),e.valueField||(e.valueField="id"),e.labelField||(e.labelField="title"),this.convertObj=e,this.options=e.options||[],this.config=Ae()}load(e,t=!1){return this.config.isDebug&&console.log("进入:加载转换选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e+",force:"+t),!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}wl.load(this.convertObj.dictName,t).then(s=>{this.options=s,typeof e=="number"&&this.options.forEach(o=>{o.value=parseInt(o.value)}),i(this.options)})}):this.convertObj.types=="option"?(this.options=this.convertObj.options||[],this.convertObj.options?.length?Promise.resolve(this.convertObj.options):(this.config.isDebug&&console.error("静态转换器选项为空,id:"+this.convertObj.id,this.convertObj),Promise.reject("静态转换器选项为空,id:"+this.convertObj.id))):!this.convertObj.id&&this.convertObj.types!="local"?Promise.reject("转换器id不能为空,type:"+this.convertObj.types):new Promise((i,l)=>{const s=this.convertObj.params||{body:{}};this.convertObj.pidField&&(s.pid=-1);const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:o,data:s,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(d=>{d.value=parseInt(d.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(h=>h.value==e).length?i(this.options):(s.body||(s.body={}),s.body[this.convertObj.valueField]=e,K.axios.admin({url:o,data:s,method:"POST"}).then(h=>{if(h.success){const c={};this.options.forEach(f=>{c[e]=!0}),h.body.forEach(f=>{c[f.value]||this.options.push(f)}),i(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(this.config.isDebug&&console.log("进入:数据转换:value->label方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?wl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(i=>i.value==e);return t.length?Promise.resolve(t[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const t=this.options.filter(i=>i.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,i)=>{this.load(e).then(l=>{const s=l.filter(o=>o.value==e);if(s.length)return t(s[0].label);i()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((i,l)=>{const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:s,data:e,method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),this.options=[...this.options,...o.body],i(o.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,o),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+o.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){return this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.resolve(this.options.filter(t=>t.label.indexOf(e)>=0)):new Promise(t=>{const i=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(l=>{l.success?(this.$processOptions(l.body),t(l.body)):t([])})})}$processOptions(e){return this.convertObj.types=="local"&&e.forEach(t=>{this.convertObj.idField&&(t.id=t[this.convertObj.idField]),this.convertObj.pidField&&(t.pid=t[this.convertObj.pidField]),t.value=t[this.convertObj.valueField],t.label=t[this.convertObj.labelField]}),e}}const qa={key:1,class:"text-view"},Ua=Z(n.defineComponent({__name:"formItem",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.inject("formSetting");n.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(t.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?t.value=s.value.value.split(","):t.value=[s.value.value])))});const l=n.ref({}),s=n.computed(()=>{const v=e.editor?.widget(e.wid)||e.widget||{};return v.event&&Object.keys(v.event).forEach(w=>{const x=v.event[w];x&&(l.value[w]=null,typeof x=="function"?l.value[w]=x:x.enable&&x.scriptText&&(l.value[w]=new Function("value","ctx",x.scriptText)))}),v}),o=n.computed(()=>!(l.value.visible&&l.value.visible(e.formValue[s.value.name],e.formValue)==!1)),r=n.computed(()=>l.value.title&&l.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=n.computed(()=>l.value.change&&l.value.change(e.formValue[s.value.name],e.formValue)||s.value.change),h=n.ref({}),c=n.computed(()=>{const v=[],w=s.value.rule||{};if((s.value.props?.required||s.value.required)&&v.push({required:!0,whitespace:w?.whitespace||!1,trigger:w?.trigger||i.ruleTrigger||"change",validator:(x,O)=>(w?.whitespace&&O&&typeof O=="string"&&(O=O.trim()),O!=null&&O!=null&&(O+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(s.value.title+"不能为空!"))}),w.advance&&h.value[w.advance]){const x=h.value[w.advance];v.push({pattern:x.pattern,message:x.message||"表单验证不通过!",trigger:w.trigger||i.ruleTrigger||"change"})}return w.regExpress&&v.push({pattern:w.regExpress,message:w.regMessage||"表单验证不通过!",trigger:w.trigger||i.ruleTrigger||"change"}),s.value.dataLen&&v.push({validator:(x,O)=>O&&(O+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(O+"").length+"]"):Promise.resolve(),trigger:w?.trigger||i.ruleTrigger||"change"}),v}),f=n.computed(()=>{const v=s.value.props||{};if(s.value.control=="a-input-number"){const w=s.value.rule||{};w.rangeMin!=null&&w.rangeMin!=null&&(v.min=w.rangeMin),w.rangeMax!=null&&w.rangeMax!=null&&(v.max=w.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(v.format=s.value.view.dataFormat,v.valueFormat=s.value.view.dataFormat),s.value.required&&(v.required=s.value.required),v}),u=n.computed(()=>{const v=s.value.css||{},w=[];return v.cssName&&w.push(v.cssName),i.platform=="app"?v.cssName?typeof v.cssName=="string"&&v.cssName.indexOf("all-line")<0&&w.push("all-line"):w.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!v.cssName||typeof v.cssName=="string"&&v.cssName.indexOf("all-line")<0)&&w.push("all-line"):s.value.view.width==2&&w.push("2in-line")),w}),m=n.computed(()=>{const v=i.showColumn||3;let w=s.value.view?.labelWidth||i.labelWidth||9;return s.value.css?.cssName&&v>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(w/v)}:s.value.view?.width>=3&&v>1?{span:Math.round(w/v)}:{span:w}}),b=n.computed(()=>{const v=i.showColumn||3;let w=s.value.view?.valueWidth||i.valueWidth||19;return s.value.css?.cssName&&v>1&&u.value.includes("all-line")?{}:{span:w}}),g=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new dt(s.value.convert).convert(t.value.toString()).then(v=>{g.value=v})}),(v,w)=>{const x=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-form-item",u.value]),style:n.normalizeStyle(s.value.css?.cssText)},{default:n.withCtx(()=>[o.value?(n.openBlock(),n.createBlock(x,{key:0,label:r.value,name:s.value.name,labelCol:m.value,wrapperCol:b.value,required:s.value.props?.required,rules:c.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:n.withCtx(()=>[!a.editor||a.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value.control||"a-input"),n.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:d.value,value:t.value,"onUpdate:value":w[0]||(w[0]=O=>t.value=O)},f.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","style"])):t.value?(n.openBlock(),n.createElementBlock("div",qa,n.toDisplayString(g.value?g.value:t.value),1)):n.createCommentVNode("",!0)]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-1d53d430"]]);function xl(a,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{a(i)},e)}}const Wa=Z(n.defineComponent({__name:"selectBox",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){Ae();const e=a,t=n.useModel(a,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),s=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),o=xl(c=>{h.value.search(c).then(f=>{i.value=f})},500);n.onMounted(()=>{h.value.load(t.value).then(c=>{i.value=c})});const r=n.ref({}),d=n.computed(()=>{const c=e.editor?.widget(e.wid)||e.widget||{};return c.event&&Object.keys(c.event).forEach(f=>{const u=c.event[f];r.value[f]=null,u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText))}),c}),h=n.computed(()=>{const c=d.value.convert||e.convert||{};return new dt(c)});return n.watch(t,()=>{t.value&&h.value.load(t.value).then(c=>{i.value=c})}),n.watch(()=>d.value.convert||e.convert||{},()=>{h.value.load().then(c=>{i.value=c})}),(c,f)=>{const u=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(u,{class:"unione-form-select",options:l.value,showSearch:s.value,value:t.value,"onUpdate:value":f[0]||(f[0]=m=>t.value=m),onSearch:n.unref(o)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Ha=Z(n.defineComponent({__name:"switchBox",props:n.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.ref({});n.onMounted(()=>{o.value?.load(t.value).then(r=>{r.forEach(d=>{d.value&&(d.value=="1"||d.value=="true"||d.value=="TRUE")?(i.value.checkedChildren=d.label,d.value=="true"||d.value=="TRUE"?i.value.checkedValue=!0:i.value.checkedValue=1):(i.value.unCheckedChildren=d.label,d.value=="false"||d.value=="FALSE"?i.value.unCheckedValue=!1:i.value.unCheckedValue=0)})})});const l=n.ref({}),s=n.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const h=r.event[d];l.value[d]=null,h.enable&&h.scriptText&&(l.value[d]=new Function("value","ctx",h.scriptText))}),r}),o=n.computed(()=>{const r=s.value.convert||e.convert;return r?new dt(r):null});return(r,d)=>{const h=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(h,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=c=>t.value=c)}),null,16,["checked"])}}}),[["__scopeId","data-v-a56d945e"]]),Ka=Z(n.defineComponent({__name:"radioBox",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||o.value.value).then(d=>{i.value=d})});const s=n.ref({}),o=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const c=d.event[h];s.value[h]=null,c.enable&&c.scriptText&&(s.value[h]=new Function("value","ctx",c.scriptText))}),d}),r=n.computed(()=>{const d=o.value.convert||e.convert||{};return new dt(d)});return(d,h)=>{const c=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(c,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Qa=Z(n.defineComponent({__name:"checkBox",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=n.useModel(a,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||o.value.value).then(d=>{i.value=d})});const s=n.ref({}),o=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const c=d.event[h];s.value[h]=null,c.enable&&c.scriptText&&(s.value[h]=new Function("value","ctx",c.scriptText))}),d}),r=n.computed(()=>{const d=o.value.convert||e.convert||{};return new dt(d)});return(d,h)=>{const c=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(c,{class:"unione-form-checkbox",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Ga=Z(n.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=n.ref(),t=n.useModel(a,"value");return n.watch(()=>e.value,()=>{e.value?t.value=K.utils.sm2Encrypt(e.value):t.value=""}),(i,l)=>{const s=n.resolveComponent("a-input-password");return n.openBlock(),n.createBlock(s,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=o=>e.value=o)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]),Ya={class:"unione-props-setting unione-query-setting"},Xa={class:"unione-query-opts"},Ja={key:0},Za=["onClick"],er={key:1},tr={key:1,class:"edit-field"},ir=["onClick"],nr=Z(n.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:O})=>O+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),i=n.computed(()=>{const O=e.editor.widget(e.wid)||{};return O.configs||(O.configs={}),O.configs.btns||(O.configs.btns=[]),O}),l=n.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),s=n.computed(()=>{const O=[],k=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(p=>{O.push(p),k.push(p.name)}),k.includes("query")||O.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||O.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||O.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),O.sort((p,B)=>{const V=p.index||1,C=B.index||1;return V-C}),O}),o=n.ref(null);function r(O){o.value&&o.value.open(O,k=>{k.visible=!0,Object.keys(k).forEach(p=>{O[p]=k[p]}),i.value.configs.btns.sort((p,B)=>{const V=p.index||1,C=B.index||1;return V-C}),i.value.configs.btns=[...i.value.configs.btns]})}function d(){const O=i.value.configs.btns.length+1;let k={title:"新增",name:"new_"+O,size:"default",index:O,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(k),e.editor.widget(e.wid,i.value),o.value.open(k,p=>{Object.keys(p).forEach(B=>{k[B]=p[B]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(O){const k=()=>{if(["query","reset","advanced"].includes(O.name))O.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const p=[];i.value.configs.btns.forEach(B=>{B.name!=O.name&&p.push(B)}),i.value.configs.btns=p}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const c=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=n.computed(()=>c.value.fields?.length?c.value.fields:[]),u={mounted:O=>O.focus()},m=n.ref({});function b(){const O=Object.keys(m.value);if(O.length)for(let k in O){const p=f.value.filter(B=>B.name==k);if(p&&p[0]){let B=m.value[k];Object.keys(B).forEach(V=>{if(V=="showIndex"){const C=p[0].show?.query||{};p[0].show||(p[0].show={}),p[0].show.query={...C,index:B[V]}}else p[0][V]=B[V]})}}m.value={}}function g(O,k){b();const p={};p[k]=O[k]||"",k=="showIndex"&&(p[k]=O.show?.query?.index),m.value[O.name]=p}function v(O,k){if(!O||!k){m.value={};return}const p=m.value[O.name][k];if(k=="showIndex"){const B=O.show?.query||{};O.show||(O.show={}),O.show.query={...B,index:p}}else O[k]=p;m.value={}}function w(O,k){f.value.filter(B=>B.name==O.name).forEach(B=>{B[k]=!B[k]})}const x=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:O=>{const k=x.value.options.filter(p=>p.value==O);return k[0]?k[0].label:O}});return(O,k)=>{const p=n.resolveComponent("a-divider"),B=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),C=n.resolveComponent("PlusOutlined"),y=n.resolveComponent("a-select"),N=n.resolveComponent("ToolOutlined"),M=n.resolveComponent("a-checkbox"),A=n.resolveComponent("a-input-number"),E=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Ya,[n.createVNode(p,{orientation:"left"},{default:n.withCtx(()=>k[3]||(k[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Xa,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,D=>(n.openBlock(),n.createBlock(V,n.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size||"default",ref_for:!0},D.props||{},{onClick:z=>r(D)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(D.title)+" ",1),D.visible?(n.openBlock(),n.createBlock(B,{key:0,class:"btn-del",onClick:n.withModifiers(z=>h(D),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=D=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(C)]),_:1})]),n.createVNode(p,{orientation:"left"},{default:n.withCtx(()=>k[4]||(k[4]=[n.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=n.createTextVNode(" 数据模型:")),n.createVNode(y,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":k[1]||(k[1]=D=>i.value.dataModel=D)},null,8,["options","value"]),n.createVNode(E,{columns:t.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:D})=>[["showIndex","queryType"].includes(D.key)?(n.openBlock(),n.createElementBlock("span",Ja,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(D.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:D,text:z,record:P})=>[["queryType"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!m.value[P.name]||!Object.keys(m.value[P.name]).includes(D.dataIndex))&&!z&&"empty"]),onClick:U=>g(P,D.dataIndex)},[m.value[P.name]&&Object.keys(m.value[P.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(y,{key:0,value:P[D.dataIndex],"onUpdate:value":U=>P[D.dataIndex]=U,allowClear:!0,options:x.value.options,onBlur:k[2]||(k[2]=U=>v())},null,8,["value","onUpdate:value","options"])),[[u]]):(n.openBlock(),n.createElementBlock("span",er,n.toDisplayString(x.value.showLabel(z)),1))],10,Za)):["isQuery"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",tr,[n.createVNode(M,{checked:P[D.dataIndex],onClick:U=>w(P,D.dataIndex)},null,8,["checked","onClick"])])):D.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!m.value[P.name]||!Object.keys(m.value[P.name]).includes(D.dataIndex))&&!z&&"empty"]),onClick:U=>g(P,D.dataIndex)},[m.value[P.name]&&Object.keys(m.value[P.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(A,{key:0,value:m.value[P.name][D.dataIndex],"onUpdate:value":U=>m.value[P.name][D.dataIndex]=U,onBlur:U=>v(P,D.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(P.show?.query?.index||" "),1)],64))],10,ir)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:o},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),lr={class:"query-btn"},sr={class:"btn-advanced-overlay"},vl=Z(n.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},fields:{type:Array},params:{type:Object,default(){return{}}}},emits:["query","reset","btnClick"],setup(a,{emit:e}){const t=a,i=n.computed(()=>{const v=t.editor?.widget(t.wid)||t.widget||{};return v.btns||(v.btns=[]),v}),l=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),s=n.computed(()=>{let v=[];return i.value.fields?.length&&(v=i.value.fields),v.length==0&&t.fields?.length&&(v=t.fields),v.sort((w,x)=>{const O=w.show?.query?.index||1,k=x.show?.query?.index||1;return O-k}),v.forEach(w=>{w.widget=w.widget||w.control||"a-input",w.defaultValue!=null&&w.defaultValue!="undefined"&&typeof w.defaultValue<"u"&&(c.value[w.name]=w.defaultValue,w.value=w.defaultValue)}),v}),o=n.computed(()=>i.value.labelWidth||7),r=n.computed(()=>{const v=i.value.btns.filter(w=>w.name=="advanced")[0]||{};return v.event?.clickScript&&(v.event.click=new Function("ctx","btn","event",v.event.clickScript)),v.event?.disableScript&&(v.event.disable=new Function("ctx","btn",v.event.disableScript)),v.event?.visibleScript&&(v.event.visible=new Function("ctx","btn",v.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...v}}),d=["query","reset","advanced"],h=n.computed(()=>{const v=i.value.btns.filter(x=>x.name!="advanced"),w=[];return v.forEach(x=>{x.size||(x.size="default"),w.push(x.name)}),w.includes("query")||v.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),w.includes("reset")||v.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),v.sort((x,O)=>{const k=x.index||1,p=O.index||1;return k-p}),v}),c=n.ref({}),f=n.computed(()=>{const v={};return i.value.params?Object.keys(i.value.params).forEach(w=>{v[w]=i.value.params[w]}):t.params&&Object.keys(t.params).forEach(w=>{v[w]=t.params[w]}),v});n.onMounted(()=>{b()});const u=e;function m({btn:v,event:w}){console.log("unione query form btn click",v,w),v.name=="query"&&b(),v.name=="reset"&&g(),u("btnClick",{btn:v,event:w})}function b(){const v=[];s.value.forEach(x=>{x.visible&&v.push(x.name)});const w={params:{...f.value},keywords:""};Object.keys(c.value).forEach(x=>{v.includes(x)&&(w.params[x]=c.value[x])}),l.value.visible&&c.value[l.value.name]&&(w.keywords=c.value[l.value.name]),u("query",w),t.editor?.ebus.$emit("table-list-search",w)}function g(){c.value={},s.value.forEach(w=>{w.visible=!1});const v={params:{...f.value},keywords:""};u("reset",v),t.editor?.ebus.$emit("table-list-reset",v)}return(v,w)=>{const x=n.resolveComponent("a-input"),O=n.resolveComponent("a-form-item"),k=n.resolveComponent("unione-btn"),p=n.resolveComponent("a-checkbox"),B=n.resolveComponent("DownOutlined"),V=n.resolveComponent("a-button"),C=n.resolveComponent("a-dropdown"),y=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},n.createSlots({default:n.withCtx(()=>[n.createVNode(y,{model:c.value,layout:"horizontal","label-col":{span:o.value}},{default:n.withCtx(()=>[l.value.visible?(n.openBlock(),n.createBlock(O,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:n.normalizeStyle({width:o.value})},{default:n.withCtx(()=>[n.createVNode(x,{placeholder:l.value.placeholder,value:c.value[l.value.name],"onUpdate:value":w[0]||(w[0]=N=>c.value[l.value.name]=N),allowClear:"",onKeyup:n.withKeys(b,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,N=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N.name},[N.visible?(n.openBlock(),n.createBlock(O,{key:0,label:N.title,class:n.normalizeClass(["query-field",N.name]),style:n.normalizeStyle({width:o.value}),name:N.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(N.widget),n.mergeProps({placeholder:N.placeholder,value:c.value[N.name],"onUpdate:value":M=>c.value[N.name]=M,ref_for:!0},N.props||{},{allowClear:"",widget:N}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",lr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,N=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N.name},[N.visible!=!1?(n.openBlock(),n.createBlock(k,{key:0,widget:N,editor:a.editor,onClick:m,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&s.value.length?(n.openBlock(),n.createBlock(C,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",sr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,N=>(n.openBlock(),n.createBlock(p,{key:N.name,class:"item",checked:N.visible,onClick:M=>N.visible=!N.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(N.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(V,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value.title)+" ",1),n.createVNode(B)]),_:1})]),_:1},8,["trigger"])):n.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(nr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-b14fb229"]]),or={class:"unione-props-setting unione-table-setting"},ar={class:"unione-table-tools"},rr={key:1,class:"unione-table-opts"},dr={key:0},cr=["onClick"],hr={key:1,class:"edit-field"},fr=["onClick"],ur={key:1},pr=Z(n.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(C,y){let N=C.filter(M=>M.value==y);return N&&N[0]&&N[0].label||y}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,y){let N=C.filter(M=>M.value==y);return N&&N[0]&&N[0].label||y}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.leftBtns||(C.configs.leftBtns=[]),C.configs.rightBtns||(C.configs.rightBtns=[]),C.configs.operation||(C.configs.operation={}),C.configs.operation.btns||(C.configs.operation.btns=[]),C.configs.operation.more||(C.configs.operation.more={}),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(y=>({value:y.sn,label:y.title+"("+y.name+")"}))),s=n.computed(()=>{if(!i.value)return[];const C=[],y=i.value.configs.leftBtns;if(y.forEach(N=>{C.push(N.name)}),!C.includes("add")){const N={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};y.splice(0,0,N)}if(!C.includes("delBatch")){const N={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};y.splice(1,0,N)}return y}),o=n.computed(()=>{if(!i.value)return[];const C=[],y=i.value.configs.rightBtns;if(y.forEach(N=>{C.push(N.name)}),!C.includes("downData")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};y.splice(0,0,N)}if(!C.includes("impData")){const N={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};y.splice(1,0,N)}if(!C.includes("expData")){const N={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};y.splice(2,0,N)}if(!C.includes("downTmpl")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};y.splice(3,0,N)}return y});function r(C,y){C=="left"?c.value.open(y,N=>{N.visible=!0,Object.keys(N).forEach(M=>{y[M]=N[M]}),i.value.configs.leftBtns.sort((M,A)=>{const E=M.index||1,D=A.index||1;return E-D}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):c.value.open(y,N=>{N.visible=!0,Object.keys(N).forEach(M=>{y[M]=N[M]}),i.value.configs.rightBtns.sort((M,A)=>{const E=M.index||1,D=A.index||1;return E-D}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(C){const y=C=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let N={title:"新增"+y,name:"new_"+y,index:y,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?i.value.configs.leftBtns.push(N):i.value.configs.rightBtns.push(N),e.editor.widget(e.wid,i.value),r(C,N)}function h(C,y){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(y.name))y.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const M=[];i.value.configs.leftBtns.forEach(A=>{A.name!=y.name&&M.push(A)}),i.value.configs.leftBtns=M}else{const M=[];i.value.configs.rightBtns.forEach(A=>{A.name!=y.name&&M.push(A)}),i.value.configs.rightBtns=M}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const c=n.ref(null);function f(C){c.value.open(C,y=>{y.visible=!0,Object.keys(y).forEach(N=>{C[N]=y[N]}),i.value.configs.operation.btns.sort((N,M)=>{const A=N.index||1,E=M.index||1;return A-E}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const C=i.value.configs.operation.btns.length+1;let y={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(y),e.editor.widget(e.wid,i.value),c.value.open(y,N=>{Object.keys(N).forEach(M=>{y[M]=N[M]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function m(C){const y=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const N=[];i.value.configs.operation.btns.forEach(M=>{M.name!=C.name&&N.push(M)}),i.value.configs.operation.btns=N}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{y()}})}const b=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),g=n.computed(()=>b.value.fields?.length?(b.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),b.value.fields):[]),v={mounted:C=>C.focus()},w=n.ref({});function x(){const C=Object.keys(w.value);if(C.length)for(let y in C){const N=g.value.filter(M=>M.name==y);if(N&&N[0]){let M=w.value[y];Object.keys(M).forEach(A=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),A=="showIndex"?N[0].show.list.index=M[A]:A=="showWidth"?N[0].show.list.width=M[A]:A=="fixed"?N[0].show.list.fixed=M[A]:A=="align"?N[0].show.list.align=M[A]:N[0][A]=M[A]})}}w.value={}}function O(C,y){x();const N={};y=="showIndex"?N[y]=C.show?.list?.index:y=="showWidth"?N[y]=C.show?.list?.width:y=="fixed"?N[y]=C.show?.list?.fixed:y=="align"?N[y]=C.show?.list?.align:N[y]=C[y]||"",w.value[C.name]=N}function k(C,y){if(!C||!y){w.value={};return}const N=w.value[C.name][y];C.show||(C.show={}),C.show.list||(C.show.list={}),y=="showIndex"?C.show.list.index=N:y=="showWidth"?C.show.list.width=N:y=="fixed"?C.show.list.fixed=N:y=="align"?C.show.list.align=N:C[y]=N,w.value={}}function p(C,y){return y=="showIndex"?C.show?.list?.index:y=="showWidth"?C.show?.list?.width:y=="fixed"?C.show?.list?.fixed:y=="align"?C.show?.list?.align:C[y]}function B(C,y){g.value.filter(M=>M.name==C.name).forEach(M=>{M[y]=!M[y]})}const V=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const y=V.value.options.filter(N=>N.value==C);return y[0]?y[0].label:C}});return(C,y)=>{const N=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),A=n.resolveComponent("a-button"),E=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-input"),z=n.resolveComponent("a-form-item"),P=n.resolveComponent("a-col"),U=n.resolveComponent("a-input-number"),_=n.resolveComponent("a-checkbox"),F=n.resolveComponent("a-row"),T=n.resolveComponent("a-select"),S=n.resolveComponent("ToolOutlined"),q=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",or,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[8]||(y[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",ar,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,I=>(n.openBlock(),n.createBlock(A,n.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size,ref_for:!0},I.props||{},{onClick:$=>r("left",I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers($=>h("left",I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(A,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:y[0]||(y[0]=I=>d("left"))},{default:n.withCtx(()=>[n.createVNode(E)]),_:1}),n.createVNode(A,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:y[1]||(y[1]=I=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(E)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,I=>(n.openBlock(),n.createBlock(A,n.mergeProps({key:I.name,class:["btn","right",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size,ref_for:!0},I.props||{},{onClick:$=>r("right",I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers($=>h("right",I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[9]||(y[9]=[n.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createBlock(F,{key:0},{default:n.withCtx(()=>[n.createVNode(P,{span:7},{default:n.withCtx(()=>[n.createVNode(z,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(D,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(P,{span:5},{default:n.withCtx(()=>[n.createVNode(z,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(U,{value:i.value.configs.operation.width,"onUpdate:value":y[2]||(y[2]=I=>i.value.configs.operation.width=I)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(P,{span:6},{default:n.withCtx(()=>[n.createVNode(z,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(U,{value:i.value.configs.operation.count,"onUpdate:value":y[3]||(y[3]=I=>i.value.configs.operation.count=I)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(P,{span:5},{default:n.withCtx(()=>[n.createVNode(z,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(_,{checked:i.value.configs.operation.visible,"onUpdate:checked":y[4]||(y[4]=I=>i.value.configs.operation.visible=I)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[10]||(y[10]=[n.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createElementBlock("div",rr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,I=>(n.openBlock(),n.createBlock(A,n.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size||"small",ref_for:!0},I.props||{},{onClick:$=>f(I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers($=>m(I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(A,{class:n.normalizeClass(["btn","btn-add"]),onClick:y[5]||(y[5]=I=>u()),size:"small"},{default:n.withCtx(()=>[n.createVNode(E)]),_:1})])):n.createCommentVNode("",!0),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>y[11]||(y[11]=[n.createTextVNode("表头设置")])),_:1}),y[12]||(y[12]=n.createTextVNode(" 数据模型:")),n.createVNode(T,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":y[6]||(y[6]=I=>i.value.dataModel=I)},null,8,["options","value"]),n.createVNode(q,{columns:t.value,"data-source":g.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:I})=>[["showIndex","showWidth","align","fixed"].includes(I.key)?(n.openBlock(),n.createElementBlock("span",dr,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(I.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:I,record:$})=>[["showIndex","showWidth"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!w.value[$.name]||!Object.keys(w.value[$.name]).includes(I.dataIndex))&&!p($,I.dataIndex)&&"empty"]),onClick:ae=>O($,I.dataIndex)},[w.value[$.name]&&Object.keys(w.value[$.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(U,{key:0,value:w.value[$.name][I.dataIndex],"onUpdate:value":ae=>w.value[$.name][I.dataIndex]=ae,onBlur:ae=>k($,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[v]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p($,I.dataIndex)),1)],64))],10,cr)):["isList","isQuery","isSort"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",hr,[n.createVNode(_,{checked:$[I.dataIndex],onClick:ae=>B($,I.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!w.value[$.name]||!Object.keys(w.value[$.name]).includes(I.dataIndex))&&!p($,I.dataIndex)&&"empty"]),onClick:ae=>O($,I.dataIndex)},[w.value[$.name]&&Object.keys(w.value[$.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(T,{key:0,value:$.show.list[I.dataIndex],"onUpdate:value":ae=>$.show.list[I.dataIndex]=ae,allowClear:!0,options:I.options,onBlur:y[7]||(y[7]=ae=>k())},null,8,["value","onUpdate:value","options"])),[[v]]):(n.openBlock(),n.createElementBlock("span",ur,n.toDisplayString(I.showLabel(I.options,p($,I.dataIndex))),1))],10,fr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:c,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function tn(a){const e=a.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const mr={toHump:tn},gr={class:"unione-table-tools"},kr={class:"unione-table-data"},br={key:0,class:"unione-table-opts"},Cl=Z(n.defineComponent({__name:"tableList",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},loading:{type:Boolean,default:!1},pagination:{type:Object,required:!1},dataList:{type:Array,default(){return[]}},rowKey:{type:String,default:"id"}},emits:["edit","view","add","delete","delBatch","expData","impData","downTmpl","leftBtnClick","rightBtnClick","optBtnClick","btnClick","change"],setup(a,{expose:e,emit:t}){const i=Ae(),l=a,s=n.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),o=n.computed(()=>s.value.props||{}),r=n.computed(()=>s.value.rowKey||l.rowKey||"id"),d=n.computed(()=>s.value.dsn?l.editor?.dataManager().use(s.value.dsn,"list"):null),h=n.computed(()=>{const E=l.dataList||[];return!E.length&&d.value?d.value.data().body||[]:E}),c=n.computed(()=>{if(s.value.operation==!1)return{visible:!1};const E=K.utils.obj.ext(s.value.operation||{},{title:"操作",visible:!0,width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),D=[];let z=s.value.operation?.btns||[];if(z.forEach(P=>{D.push(P.name)}),D.includes("edit")||z.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),D.includes("view")||z.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),D.includes("delete")||z.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const P=z.filter(_=>_.name=="edit")[0];if(P.visible&&(P.action||(P.action={}),P.action.type||(P.action.type="route"),!P.action.href)){const _=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",F=l.editor.model.value;P.action.link=i.editPageUrl+"?psn="+_+"&model="+F+"&id={row."+l.rowKey+"}"}const U=z.filter(_=>_.name=="view")[0];if(U.visible&&(U.action||(U.action={}),U.action.type||(U.action.type="route"),!U.action.href)){const _=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";U.action.link=i.viewPageUrl+"?psn="+_+"&model=view&id={row."+l.rowKey+"}"}}return z=z.filter(P=>P.visible!=!1).sort((P,U)=>{const _=P.index||1,F=U.index||1;return _-F}),E.count&&(z.length>E.count+1?(E.btns=z.slice(0,E.count),E.more.items=z.slice(E.count,z.length),E.more.visible=!0):(E.btns=z,E.more.visible=!1)),E}),f=n.computed(()=>{let E=[];s.value.columns?.length&&(E=[...s.value.columns]);const D=[];E.forEach((P,U)=>{P.dataIndex=P.name,P.convert&&(P.dataIndex=P.name+"Label",P.convertObj=new dt(P.convert),P.customCell=(_,F,T)=>{const S=_[T.name];P.convertObj&&(_[T.dataIndex]==null||_[T.dataIndex]==null)&&S!=null&&S!=null&&(S+"").length>0&&(_[T.dataIndex]=S,P.convertObj.convert(S).then(q=>{q&&(_[T.dataIndex]=q)}))}),P.sort?.enable&&(P.sorter=!0,P.sort.defoult&&(P.defaultSortOrder=P.sort.asc?"ascend":"descend")),P.customRender=({text:_})=>_||"--",P.fkey?.enable&&(P.fkey.labelName&&(P.dataIndex=tn(P.fkey.labelName)),P.fkey.labelTitle&&(P.title=P.fkey.labelTitle),P.customRender=({record:_,column:F})=>_&&_[F.name+"FEntry"]&&_[F.name+"FEntry"][F.dataIndex]||"--",P.fkey.fields?.forEach((_,F)=>{if(!_.name)return;const T=tn(_.name),S={fkName:P.name,title:_.title,name:T,dataIndex:_.name,width:_.width,index:_.index||U+F+1,customRender:({record:q,column:I})=>{if(q&&q[I.fkName+"FEntry"]){const $=q[I.fkName+"FEntry"][I.name];if($)return _.convertObj&&_.convertObj.convert($)||$}return"--"}};_.convert&&(_.convertObj=new dt(_.convert)),D.push(S)}))}),D.forEach(P=>{E.splice(P.index,0,P)});const z=K.utils.obj.ext(s.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return z&&z.visible!=!1&&(z.customRender=P=>O.value?(O.value.current-1)*O.value.pageSize+P.index+1:P.index,E=[z,...E]),c.value&&c.value.visible!=!1&&E.push({fixed:"right",align:"center",...c.value,name:"operation"}),E}),u=n.computed(()=>{if(s.value.leftBtns===!1)return[];const E=[],D=[];if((s.value.leftBtns||[]).forEach(P=>{P.visible!=!1&&E.push(P),D.push(P.name),P.name=="delBatch"&&!k.value&&(P.visible=!1)}),!D.includes("add")){const P={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};E.splice(0,0,P)}if(!D.includes("delBatch")&&k.value){const P={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};E.splice(1,0,P)}if(l.editor&&l.editor.type.value!="code"){const P=E.filter(U=>U.name=="add")[0];if(P.visible&&(P.action||(P.action={}),P.action.type||(P.action.type="route"),!P.action.href)){const U=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",_=l.editor.model.value;P.action.link=i.addPageUrl+"?psn="+U+"&model="+_}}return E});function m({btn:E,event:D}){if(i.isDebug&&console.log("unione table left btn click",E,D),E.name=="delBatch"){if(!p.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.deleteByIds(p.value.selectedRowKeys).then(()=>{M(),N(!0)});return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+p.value.selectedRowKeys.length+")数据",onOk:()=>{V("delBatch",{btn:E,event:D,keys:p.value.selectedRowKeys}),V("leftBtnClick",{btn:E,event:D,keys:p.value.selectedRowKeys}),V("btnClick",{btn:E,event:D,keys:p.value.selectedRowKeys})}});return}V(E.name,{btn:E,event:D}),V("leftBtnClick",{btn:E,event:D}),V("btnClick",{btn:E,event:D})}const b=n.computed(()=>{if(s.value.rightBtns===!1)return[];const E=[],D=[];if((s.value.rightBtns||[]).forEach(P=>{P.visible!=!1&&E.push(P),D.push(P.name)}),!D.includes("impData")){const P={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};E.splice(1,0,P)}if(!D.includes("expData")){const P={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};E.splice(2,0,P)}if(!D.includes("downTmpl")){const P={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};E.splice(3,0,P)}return E});function g({btn:E,event:D}){i.isDebug&&console.log("unione table right btn click",E,D),V(E.name,{btn:E,event:D}),V("rightBtnClick",{btn:E,event:D}),V("btnClick",{btn:E,event:D})}const v=n.computed(()=>({bordered:!0,size:"small",...s.value.attrs||{}})),w=n.ref({}),x=n.ref(null),O=n.computed(()=>K.utils.obj.ext(l.pagination||s.value.pagination,{showTotal:E=>"共"+E+"记录",pageSize:l.pagination?.pageSize||d.value?.data()?.pageSize||10,current:l.pagination?.current||d.value?.data()?.page||1,total:l.pagination?.total||d.value?.data()?.total||0,position:["bottomCenter"]})),k=n.computed(()=>typeof s.value.selection<"u"?s.value.selection:!0),p=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(E,D)=>{p.value.selectedRowKeys=E,p.value.selectedRowList=D},getCheckboxProps:E=>({disabled:E.checkable})}),B=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],V=t;function C({btn:E,event:D},z){if(i.isDebug&&console.log("unione table opt btn click",E,D),E.name=="delete"){if(d.value){d.value.deleteByIds([z[r.value]]).then(()=>{M(),p.value.selectedRowKeys=p.value.selectedRowKeys.filter(P=>P!=z[r.value]),p.value.selectedRowList=p.value.selectedRowList.filter(P=>P[r.value]!=z[r.value])});return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{V(E.name,{btn:E,event:D,row:z}),V("optBtnClick",{btn:E,event:D,row:z}),V("btnClick",{btn:E,event:D,row:z})}});return}V(E.name,{btn:E,event:D,row:z}),V("optBtnClick",{btn:E,event:D,row:z}),V("btnClick",{btn:E,event:D,row:z})}function y(E,D,z,P){x.value={current:E.current,pageSize:E.pageSize},M(),V("change",{pagination:E,filters:D,sorter:z,event:P})}function N(E=!1){E?(p.value.selectedRowKeys=[],p.value.selectedRowList=[]):G.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${p.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{p.value.selectedRowKeys=[],p.value.selectedRowList=[]}})}function M(){if(d.value){const E={page:O.value.current,pageSize:O.value.pageSize,keywords:w.value.keywords,body:w.value.params||{}};x.value&&(E.page=x.value.current,E.pageSize=x.value.pageSize),console.log("dataStorage find params",E),d.value.find(E)}}n.onMounted(()=>{l.editor?.ebus.$on("table-list-search",E=>{console.log("table-list-search",E),w.value=E||{},M()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),w.value={},M(),N(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),M()})});function A(){return{keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}}return e({getSelected:A,clearSelected:N}),(E,D)=>{const z=n.resolveComponent("unione-btn"),P=n.resolveComponent("DownOutlined"),U=n.resolveComponent("a-button"),_=n.resolveComponent("a-dropdown"),F=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(rt,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,T=>(n.openBlock(),n.createBlock(z,{key:T.name,class:"btn",widget:T,editor:a.editor,onClick:m,preset:B,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),p.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:D[0]||(D[0]=T=>N())},"当前选中记录("+n.toDisplayString(p.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,T=>(n.openBlock(),n.createBlock(z,{key:T.name,class:"btn right",widget:T,editor:a.editor,onClick:g,preset:B,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",kr,[f.value&&f.value.length?(n.openBlock(),n.createBlock(F,n.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":h.value,"row-selection":k.value?p.value:null,scroll:{x:o.value.scrollX||"max-content",y:o.value.scrollY},pagination:O.value,onChange:y},v.value),{bodyCell:n.withCtx(({column:T,record:S})=>[T.name==="operation"?(n.openBlock(),n.createElementBlock("div",br,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value.btns,q=>(n.openBlock(),n.createBlock(z,{key:q.name,class:"opt",widget:q,editor:a.editor,onClick:I=>C(I,S),preset:B,ctx:{row:S}},null,8,["widget","editor","onClick","ctx"]))),128)),c.value.more?.visible!=!1&&c.value.more.items?.length?(n.openBlock(),n.createBlock(_,{key:0,trigger:[c.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",c.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",c.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value.more.items,q=>(n.openBlock(),n.createBlock(z,{key:q.name,class:"item",widget:q,editor:a.editor,onClick:I=>C(I,S),type:"text",preset:B,ctx:{row:S}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(U,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(c.value.more.title)+" ",1),n.createVNode(P)]),_:1})]),_:2},1032,["trigger","class"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):n.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(pr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-9a52327e"]]),yr={class:"page-setting-dialog"},jt=n.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const t=a,i=n.computed(()=>t.editor?.model?.value),l=K.useSession(),s=n.computed(()=>l.getPrincipal()),o=n.ref(!1);n.provide("closeSetting",()=>{t.editor?.save().then(u=>{o.value=!1})});function r(){o.value=!0}function d(){t.editor?.save().then(u=>{console.log("res",u)})}function h(){t.editor?.save().then(u=>{console.log("res",u)})}const c=n.ref("");function f(u){c.value||(c.value=i.value),u?t.editor?.setModel("edit"):t.editor?.setModel(c.value)}return(u,m)=>{const b=n.resolveComponent("SettingOutlined"),g=n.resolveComponent("a-tooltip"),v=n.resolveComponent("SaveOutlined"),w=n.resolveComponent("FormOutlined"),x=n.resolveComponent("StopOutlined"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:0,title:a.settingTitle},{default:n.withCtx(()=>[n.createVNode(b,{class:"page-setting",onClick:r})]),_:1},8,["title"])):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(w,{class:"btn-edit",onClick:m[0]||(m[0]=k=>f(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(g,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(x,{class:"btn-edit",onClick:m[1]||(m[1]=k=>f(!1))})]),_:1})):n.createCommentVNode("",!0),n.renderSlot(u.$slots,"default"),i.value=="edit"?(n.openBlock(),n.createBlock(O,{key:4,title:t.settingTitle,open:o.value,"onUpdate:open":m[2]||(m[2]=k=>o.value=k),centered:"",width:"85%",onOk:h},{default:n.withCtx(()=>[n.createElementVNode("div",yr,[n.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),wr={class:"unione-props-setting data-field-manage"},xr={key:0},vr={key:1},Cr={key:2},Sr={key:3},Nr={key:4},Br={key:5},Or={key:6},Vr=["onClick"],_r=["onClick"],Mr=["onClick"],Tr={key:1},Ar=Z(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=n.useModel(a,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:u=>{u.forEach(m=>{i.value.selectedRowKeys.includes(m)||i.value.selectedRowKeys.push(m);const b=[];t.value.forEach(g=>{!u.includes(g.name)&&i.value.selectedRowKeys.includes(g.name)&&b.push(g.name)}),b.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(g=>!b.includes(g)))})}}),l={mounted:u=>u.focus()},s=n.ref({});function o(){const u=Object.keys(s.value);if(u.length)for(let m in u){const b=t.value.filter(g=>g.name==m);if(b&&b[0]){let g=s.value[m];Object.keys(g).forEach(v=>{b[0][v]=g[v]})}}s.value={}}function r(u,m){o();const b={};b[m]=u[m]||"",s.value[u.name]=b}function d(u,m){if(!u||!m){s.value={};return}const b=s.value[u.name][m];if(m=="name"&&t.value.filter(v=>v[m]==b&&v.name!=u.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}u[m]=b,s.value={}}function h(u,m){t.value.filter(g=>g.name==u.name).forEach(g=>{g[m]=!g[m]})}function c(){if(o(),t.value.filter(b=>b.name=="new_").length>0){s.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};t.value.push(m),s.value[m.name]={name:"new_"}}function f(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,m)=>{const b=n.resolveComponent("a-button"),g=n.resolveComponent("a-tooltip"),v=n.resolveComponent("a-input"),w=n.resolveComponent("a-input-number"),x=n.resolveComponent("a-select-option"),O=n.resolveComponent("a-select"),k=n.resolveComponent("a-checkbox"),p=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",wr,[n.createVNode(b,{class:"btn btn-add",type:"primary",onClick:c,size:"small"},{default:n.withCtx(()=>m[1]||(m[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:n.withCtx(()=>m[2]||(m[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(p,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:n.withCtx(({column:B})=>[B.key==="name"?(n.openBlock(),n.createElementBlock("span",xr,[m[3]||(m[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="title"?(n.openBlock(),n.createElementBlock("span",vr,[m[4]||(m[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="descs"?(n.openBlock(),n.createElementBlock("span",Cr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Br,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Or,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="isPk"?(n.openBlock(),n.createBlock(g,{key:7,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[m[5]||(m[5]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="isFk"?(n.openBlock(),n.createBlock(g,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="isNull"?(n.openBlock(),n.createBlock(g,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="syncDbEnable"?(n.openBlock(),n.createBlock(g,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:B,text:V,record:C})=>[["name","title","descs","defaultValue"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!V&&"empty"]),onClick:y=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:s.value[C.name][B.dataIndex],"onUpdate:value":y=>s.value[C.name][B.dataIndex]=y,onBlur:y=>d(C,B.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V||" "),1)],64))],10,Vr)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!V&&"empty"]),onClick:y=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[C.name][B.dataIndex],"onUpdate:value":y=>s.value[C.name][B.dataIndex]=y,onBlur:y=>d(C,B.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V||" "),1)],64))],10,_r)):["dataType"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!V&&"empty"]),onClick:y=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(O,{key:0,value:C[B.dataIndex],"onUpdate:value":y=>C[B.dataIndex]=y,onBlur:m[0]||(m[0]=y=>d())},{default:n.withCtx(()=>[n.createVNode(x,{key:"String",value:"String"}),n.createVNode(x,{key:"Long",value:"Long"}),n.createVNode(x,{key:"Short",value:"Short"}),n.createVNode(x,{key:"Integer",value:"Integer"}),n.createVNode(x,{key:"Float",value:"Float"}),n.createVNode(x,{key:"Double",value:"Double"}),n.createVNode(x,{key:"Date",value:"Date"}),n.createVNode(x,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Tr,n.toDisplayString(V),1))],10,Mr)):["syncDbEnable","isFk","isPk"].includes(B.dataIndex)?(n.openBlock(),n.createBlock(k,{key:3,checked:C[B.dataIndex],onClick:y=>h(C,B.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(B.dataIndex)?(n.openBlock(),n.createBlock(k,{key:4,checked:!C[B.dataIndex],onClick:y=>h(C,B.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Er={class:"unione-props-setting data-field-setting"},Ir={key:0},Dr=["onClick"],Pr={class:"field-txt"},Fr=["onClick"],$r={key:1,class:"field-txt"},Rr=["onClick"],Lr={key:1},jr=["onClick"],zr={key:0,class:"field-txt"},qr={key:4,class:"edit-field"},Ur={key:0},Wr=["onClick"],Hr=Z(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:w})=>w+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),t=n.useModel(a,"modelValue"),i={mounted:w=>w.focus()},l=n.ref({});function s(){const w=Object.keys(l.value);if(w.length)for(let x in w){const O=t.value.filter(k=>k.name==x);if(O&&O[0]){let k=l.value[x];Object.keys(k).forEach(p=>{p=="convertName"?(O[0].convert||(O[0].convert={}),O[0].convert.type=k[p]):O[0][p]=k[p]})}}l.value={}}function o(w,x){s();const O={};x=="convertName"?(w.convert||(w.convert={}),O[x]=w.convert?.type):O[x]=w[x]||"",l.value[w.name]=O}function r(w,x){{l.value={};return}}function d(w,x){t.value.filter(k=>k.name==w.name).forEach(k=>{k[x]=!k[x]})}const h=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function c(w,x){const O=t.value.filter(p=>p.name==w.name);O.forEach(p=>{x!="isSort"?p[x]=!0:p[x]=!p[x]});const k=O[0];if(!(!k||x=="isSort")){switch(h.value.prop=x,h.value.field=w,k.show||(k.show={}),x){case"isQuery":k.show.query||(k.show.query={}),h.value.show=k.show.query,h.value.title=`查询设置/${w.title}(${w.name})`;break;case"isForm":k.show.form||(k.show.form={}),h.value.show=k.show.form,h.value.title=`表单设置/${w.title}(${w.name})`;break;case"isView":k.show.view||(k.show.view={}),h.value.show=k.show.view,h.value.title=`详情设置/${w.title}(${w.name})`;break;case"isList":k.show.list||(k.show.list={}),h.value.show=k.show.list,h.value.title=`列头设置/${w.title}(${w.name})`;break}h.value.visible=!0}}const f=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:w=>{const x=f.value.options.filter(O=>O.value==w);return x[0]?x[0].label:w}}),u=n.ref({visible:!1,field:{},props:{},showInfo:w=>{let x="";return w.rules&&(x=w.rules.filter(O=>O.enable).length||""),x&&(x="("+x+")"),x},toSetting:()=>{const w=u.value.props,x={name:"range",trigger:w.trigger,whitespace:w.whitespace,message:w.rangeMessage};w.rangeMin!=null&&w.rangeMin!=null&&(x.min=w.rangeMin,x.enable=!0),w.rangeMax!=null&&w.rangeMax!=null&&(x.max=w.rangeMax,x.enable=!0);const O={name:"reg",trigger:w.trigger,whitespace:w.whitespace,message:w.regMessage};w.regExpress&&(O.pattern=w.regExpress,O.enable=!0),u.value.field.rules=[x,O],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function m(w){u.value.visible=!0,u.value.field=w;const x=w.rules||[],O={trigger:"change",whitespace:!0};x.forEach(k=>{k.name=="reg"&&(O.trigger=k.trigger,O.whitespace=k.whitespace,O.regExpress=k.pattern,O.regMessage=k.message),k.name=="range"&&(O.rangeMin=k.min,O.rangeMax=k.max,O.rangeMessage=k.message)}),u.value.props=O}const b=n.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:w=>{const x=b.value.widgets.filter(O=>O.value==w);return x[0]?x[0].label:w},toSetting:()=>{}}),g=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{g.value.convert.options||(g.value.convert.options=[]),g.value.convert.options.push({label:"",value:""})},toDelOption:(w,x)=>{g.value.convert.options.splice(w,1)},toSetting:()=>{g.value.visible=!1}});function v(w){g.value.visible=!0,g.value.field=w,g.value.convert=w.convert||{}}return(w,x)=>{const O=n.resolveComponent("ToolOutlined"),k=n.resolveComponent("a-button"),p=n.resolveComponent("a-select"),B=n.resolveComponent("a-checkbox"),V=n.resolveComponent("a-table"),C=n.resolveComponent("a-input-number"),y=n.resolveComponent("a-form-item"),N=n.resolveComponent("a-input"),M=n.resolveComponent("a-form"),A=n.resolveComponent("a-modal"),E=n.resolveComponent("a-col"),D=n.resolveComponent("a-row"),z=n.resolveComponent("a-select-option"),P=n.resolveComponent("a-divider"),U=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Er,[n.createVNode(V,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:_})=>[["widget","queryType","rules","convertName"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",Ir,[n.createVNode(O),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:_,text:F,record:T})=>[["rules"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!u.value.showInfo(T)&&"empty"]),onClick:S=>m(T)},[n.createElementVNode("span",Pr,n.toDisplayString(u.value.showInfo(T)),1),u.value.showInfo(T)?(n.openBlock(),n.createBlock(k,{key:0,type:"link"},{default:n.withCtx(()=>x[22]||(x[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Dr)):["widget"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[T.name]||!Object.keys(l.value[T.name]).includes(_.dataIndex))&&!F&&"empty"]),onClick:S=>o(T,_.dataIndex)},[l.value[T.name]&&Object.keys(l.value[T.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:T[_.dataIndex],"onUpdate:value":S=>T[_.dataIndex]=S,allowClear:!0,options:b.value.widgets,onBlur:x[0]||(x[0]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",$r,n.toDisplayString(b.value.widgetName(F)),1))],10,Fr)):["queryType"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[T.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[T.name]||!Object.keys(l.value[T.name]).includes(_.dataIndex))&&!F&&"empty"]),onClick:S=>o(T,_.dataIndex)},[l.value[T.name]&&Object.keys(l.value[T.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:T[_.dataIndex],"onUpdate:value":S=>T[_.dataIndex]=S,allowClear:!0,options:f.value.options,onBlur:x[1]||(x[1]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Lr,n.toDisplayString(f.value.showLabel(F)),1))],10,Rr)):n.createCommentVNode("",!0)],64)):["convertName"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[T.name]||!Object.keys(l.value[T.name]).includes(_.dataIndex))&&!T.convert?.type&&"empty"]),onClick:S=>o(T,_.dataIndex)},[l.value[T.name]&&Object.keys(l.value[T.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:T.convert.type,"onUpdate:value":S=>T.convert.type=S,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:x[2]||(x[2]=S=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[T.convert?.type?(n.openBlock(),n.createElementBlock("span",zr,n.toDisplayString(T.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),T.convert?.type?(n.openBlock(),n.createBlock(k,{key:1,type:"link",onClick:n.withModifiers(S=>v(T),["stop"])},{default:n.withCtx(()=>x[23]||(x[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,jr)):["isQuery","isForm","isView","isList","isSort"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",qr,[n.createVNode(B,{checked:T[_.dataIndex],onClick:S=>d(T,_.dataIndex)},null,8,["checked","onClick"]),n.createVNode(k,{type:"link",onClick:S=>c(T,_.dataIndex)},{default:n.withCtx(()=>x[24]||(x[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(A,{visible:h.value.visible,"onUpdate:visible":x[9]||(x[9]=_=>h.value.visible=_),title:h.value.title,onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(y,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(C,{value:h.value.show.index,"onUpdate:value":x[3]||(x[3]=_=>h.value.show.index=_)},null,8,["value"])]),_:1}),["isQuery"].includes(h.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(y,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.width,"onUpdate:value":x[4]||(x[4]=_=>h.value.show.width=_)},null,8,["value"])]),_:1})),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.labelWidth,"onUpdate:value":x[5]||(x[5]=_=>h.value.show.labelWidth=_)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.valueWidth,"onUpdate:value":x[6]||(x[6]=_=>h.value.show.valueWidth=_)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(p,{value:h.value.show.fixed,"onUpdate:value":x[7]||(x[7]=_=>h.value.show.fixed=_),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(y,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(p,{value:h.value.show.align,"onUpdate:value":x[8]||(x[8]=_=>h.value.show.align=_),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(A,{visible:g.value.visible,"onUpdate:visible":x[11]||(x[11]=_=>g.value.visible=_),title:g.value.convert.type=="dict"?"字典设置":"选项设置",onOk:g.value.toSetting},{default:n.withCtx(()=>[g.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",Ur,[n.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:g.value.toAddOption},{default:n.withCtx(()=>x[25]||(x[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(V,{columns:g.value.optionColumn,"data-source":g.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:_,text:F,record:T,index:S})=>[_.dataIndex==="label"?(n.openBlock(),n.createBlock(N,{key:0,value:T.label,"onUpdate:value":q=>T.label=q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),_.dataIndex==="value"?(n.openBlock(),n.createBlock(N,{key:1,value:T.value,"onUpdate:value":q=>T.value=q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),_.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:q=>g.value.toDelOption(S,T)},"删除",8,Wr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),g.value.convert.type=="dict"?(n.openBlock(),n.createBlock(M,{key:1,model:g.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(D,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(E,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(y,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(N,{value:g.value.convert.dict,"onUpdate:value":x[10]||(x[10]=_=>g.value.convert.dict=_)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(A,{visible:b.value.visible,"onUpdate:visible":x[13]||(x[13]=_=>b.value.visible=_),title:"控件设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[b.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(y,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(p,{value:b.value.props.mode,"onUpdate:value":x[12]||(x[12]=_=>b.value.props.mode=_),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(z,{value:"multiple"},{default:n.withCtx(()=>x[26]||(x[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(z,{value:"tags"},{default:n.withCtx(()=>x[27]||(x[27]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(A,{visible:u.value.visible,"onUpdate:visible":x[21]||(x[21]=_=>u.value.visible=_),title:"规则设置",onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(P,{orientation:"left"},{default:n.withCtx(()=>x[28]||(x[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(y,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(U,{value:u.value.props.trigger,"onUpdate:value":x[14]||(x[14]=_=>u.value.props.trigger=_),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(y,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.whitespace,"onUpdate:value":x[15]||(x[15]=_=>u.value.props.whitespace=_),checked:u.value.props.whitespace},{default:n.withCtx(()=>x[29]||(x[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(P,{orientation:"left"},{default:n.withCtx(()=>x[30]||(x[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(y,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(C,{value:u.value.props.rangeMin,"onUpdate:value":x[16]||(x[16]=_=>u.value.props.rangeMin=_)},null,8,["value"]),x[31]||(x[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(C,{value:u.value.props.rangeMax,"onUpdate:value":x[17]||(x[17]=_=>u.value.props.rangeMax=_)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.rangeMessage,"onUpdate:value":x[18]||(x[18]=_=>u.value.props.rangeMessage=_)},null,8,["value"])]),_:1}),n.createVNode(P,{orientation:"left"},{default:n.withCtx(()=>x[32]||(x[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(y,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regExpress,"onUpdate:value":x[19]||(x[19]=_=>u.value.props.regExpress=_)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regMessage,"onUpdate:value":x[20]||(x[20]=_=>u.value.props.regMessage=_)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Kr={class:"unione-props-setting data-field"},Qr=Z(n.defineComponent({__name:"dataField",props:n.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=n.useModel(a,"modelValue");return(t,i)=>{const l=n.resolveComponent("OrderedListOutlined"),s=n.resolveComponent("a-tab-pane"),o=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Kr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(s,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(l),i[2]||(i[2]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(Ar,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=d=>e.value=d)},null,8,["modelValue"])]),_:1}),n.createVNode(s,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(o),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Hr,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Gr={key:0,class:"data-model-list"},Yr=["onClick"],Xr=Z(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const t=n.computed(()=>l.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const l=a;function s(f){i.value=f}function o(){if(t.value.length>=l.limit){G.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=sa.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),l.editor.dataModel(f,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},d=n.ref(),h=n.inject("closeSetting");function c(){d.value.validate().then(f=>{h&&h()})}return e({toSaving:c}),(f,u)=>{const m=n.resolveComponent("a-input"),b=n.resolveComponent("a-form-item"),g=n.resolveComponent("a-textarea"),v=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(n.openBlock(),n.createElementBlock("div",Gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,w=>(n.openBlock(),n.createElementBlock("div",{key:w.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==w.sn&&"slt"]),onClick:x=>s(w)},n.toDisplayString(w.title),11,Yr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:o},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[n.createVNode(v,{ref_key:"formObj",ref:d,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:n.withCtx(()=>[n.createVNode(b,{label:"数据标题",name:"title",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.title,"onUpdate:value":u[0]||(u[0]=w=>i.value.title=w)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.name,"onUpdate:value":u[1]||(u[1]=w=>i.value.name=w)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.url,"onUpdate:value":u[2]||(u[2]=w=>i.value.url=w)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(g,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=w=>i.value.descs=w)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Qr,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=w=>i.value.fields=w)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Jr={class:"unione-props-setting unione-page-setting"},zt=Z(n.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,t=n.ref({});return n.onMounted(()=>{t.value=e.editor.define.value}),(i,l)=>{const s=n.resolveComponent("a-form-item"),o=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),h=n.resolveComponent("a-form"),c=n.resolveComponent("a-tab-pane"),f=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Jr,[n.createVNode(f,{type:"card"},{default:n.withCtx(()=>[n.createVNode(c,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(h,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(n.openBlock(),n.createBlock(s,{key:0,label:"页面编码"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.value.sn)+"/V"+n.toDisplayString(t.value.vers),1)]),_:1})):n.createCommentVNode("",!0),n.createVNode(s,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(o,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=u=>t.value.title=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(o,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=u=>t.value.component=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(o,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=u=>t.value.icon=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"是否全局"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>t.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"是否模版"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>t.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=u=>t.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),n.createVNode(c,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Xr,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Sl=Z(n.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){console.log("unione page view setup .....");const e=a,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new wt,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,o=>{o&&i.load(s.value,o)});const s=n.ref("new_");return n.onMounted(()=>{const o=n.inject("route");console.log("unione page view route",o),s.value=e.psn||o?.query?.psn||o?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel("run"),i.load(s.value,e.pageDefine||t)}),(o,r)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Zr={class:"form-btns"},Nl=n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){const e=n.inject("router"),t=a,i={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new wt,s=n.computed(()=>l.$widgetList.value||[]),o=n.computed(()=>{const f=l.define.value?.configs?.btns||[],u=f.map(m=>m.name);if(!u.includes("save")){const m={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};f.splice(m.index,0,m)}if(!u.includes("submit")){const m={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let b=m.index||1;f.splice(b,0,m)}if(!u.includes("reset")){const m={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};f.splice(m.index,0,m)}if(!u.includes("back")){const m={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};f.splice(m.index,0,m)}return l.model.value=="view"&&f.filter(m=>["save","submit","reset"].includes(m.name)).forEach(m=>{m.visible=!1}),f});function r({btn:f,event:u}){f.name=="save"&&d(),f.name=="reset",f.name=="back"&&h()}async function d(){const f=l.dataManager().form();let u={};for(let m in f){const b=await f[m].validate();if(l.dataManager().psn()==m){for(let g in u)b[g]=u[g];u=b}else u[m]=b}console.log("=======form data=====",u),l.dataManager().primary().save({data:u,params:l.dataManager().params}).then(m=>{console.log("save result:",m)})}function h(){e.back()}n.watch(()=>t.pageDefine,f=>{f&&l.load(c.value,f)});const c=n.ref("new_");return n.onMounted(()=>{const f=n.inject("route");console.log("unione page view route",f),c.value=t.psn||f?.query?.psn||f?.meta?.psn||"new_",console.log("unione page view,psn:"+c.value),l.setModel(f?.query?.model||f?.meta?.model||"run"),f?.query&&l.dataManager().params(f.query),l.load(c.value,t.pageDefine||i)}),(f,u)=>{const m=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(jt,{class:"unione-page-form","setting-title":"页面设置",editor:n.unref(l)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,b=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:n.unref(l)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",Zr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,b=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b.name},[b.visible!=!1?(n.openBlock(),n.createBlock(m,{key:0,widget:b,editor:n.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(l)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),ed=["onMouseover"],td={key:0,class:"node-opts"},id={class:"form-warp"},nd={class:"form-btns"},Bl=n.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},setting:{type:Object,required:!0},btns:{type:Array,required:!1},event:{type:Object,required:!1}},setup(a){const e=K.useDialog(),t=n.inject("router"),i=a,l={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function s(){if(i.fields?.length){const _={widget:"unione-form",dsn:"primary",primary:!0,widgets:i.fields};l.configs.widgets=[_],l.configs.dsnList=["primary"],o.dataManager().use("primary","form").store(i.storage)}l.configs.btns=i.btns||[],l.configs.setting=i.setting||{}}const o=new wt,r=n.ref(!1),d=n.ref([]),h=n.ref({}),c=n.ref(null),f=n.ref(null),u=n.ref([]),m=n.ref([]),b=n.ref(0),g=n.computed(()=>{const _={disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"parentId",labelField:"title",leafField:"isLeaf",...i.setting?.tree||{}};return o.define.value?.configs?.tree||_}),v=n.computed(()=>{const _=g.value.btns?.map(T=>typeof T=="string"?{name:T,visible:!1}:T)||[],F=[];return _.forEach(T=>{F.push(T.name)}),_.filter(T=>T.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),w=n.computed(()=>{const _=g.value.btns?.map(S=>typeof S=="string"?{name:S,visible:!1}:S)||[],F=[],T=[];return _.forEach(S=>{T.push(S.name),S.name!="add"&&F.push(S)}),T.includes("delete")||F.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),T.includes("child")||F.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),F});function x({btn:_,event:F},T){F.stopPropagation();const S=h.value[T[g.value.idField]];if(console.log("onTreeMenuClick,btn:",_),console.log("onTreeMenuClick,node:",T),console.log("onTreeMenuClick,curentNode:",S),_.name=="child"){const q=h.value[S[g.value.idField]];q.isLeaf=!1,c.value={},c.value[g.value.pidField]=q[g.value.idField],c.value[g.value.labelField]="新建...",c.value[g.value.idField]="new_"+b.value,c.value.parentNode=q,b.value=b.value+1,q.children||(q.children=[],m.value.push(q[g.value.idField])),M.value.createNode&&M.value.createNode(c.value,q,o.dataManager().params()),h.value[c.value[g.value.idField]]=c.value,q.children.push(c.value),u.value=[c.value[g.value.idField]],o.dataManager().primary().setValue(c.value)}_.name=="delete"&&(S[g.value.idField]&&(S[g.value.idField]+"").startsWith("new_")?(S.parentNode?S.parentNode.children=S.parentNode.children.filter(q=>q[g.value.idField]!=S[g.value.idField]):d.value=d.value.filter(q=>q[g.value.idField]!=S[g.value.idField]),delete h.value[S[g.value.idField]]):o.dataManager().primary().deleteByIds([S[g.value.idField]]).then(()=>{if(S.parentNode){const q=h.value[S[g.value.pidField]];q.children=q.children.filter(I=>I[g.value.idField]!=S[g.value.idField])}else d.value=d.value.filter(q=>q[g.value.idField]!=S[g.value.idField]);delete h.value[S[g.value.idField]]}))}function O(_,{expanded:F,node:T}){F&&(c.value=T.dataRef,o.dataManager().primary().setValue(c.value),y())}function k(_,{selected:F,node:T}){F?(c.value=T.dataRef,o.dataManager().primary().setValue(c.value)):c.value&&(u.value=[c.value[g.value.idField]])}n.watch(()=>i.params,()=>{r.value&&(d.value=[],h.value={},c.value=null,u.value=[],m.value=[],b.value=0,o.dataManager().params(i.params||{}),console.log("params changed props.params",i.params),y())}),n.watch(()=>c.value,()=>{console.log("active node changed",c.value),p(!c.value)});function p(_=!0){const F=o.dataManager().form();for(let T in F)F[T].setDisabled(_)}function B(){if(c.value={},c.value[g.value.pidField]=-1,c.value[g.value.labelField]="新建...",c.value[g.value.idField]="new_"+b.value,b.value=b.value+1,M.value.createNode&&M.value.createNode(c.value,null,o.dataManager().params()),c.value[g.value.pidField]==-1)d.value.push(c.value);else{const _=h.value[c.value[g.value.pidField]];_.children||(_.children=[]),_.children.push(c.value)}u.value=[c.value[g.value.idField]],h.value[c.value[g.value.idField]]=c.value,o.dataManager().primary().setValue(c.value)}const V=n.ref(""),C=xl(()=>{o.dataManager().primary().find({page:1,pageSize:9999,keywords:V.value,needCount:!1,body:{}}).then(_=>{if(h.value={},d.value=[],_.body?.length){const F={};_.body.forEach(T=>{F[T[g.value.idField]]=T}),_.body.forEach(T=>{const S=F[T[g.value.pidField]];S?(S.children||(S.children=[],S.isLeaf=!1),S.children.push(T)):d.value.push(T)})}})},400);function y(){const _={};if(_[g.value.pidField]=-1,c.value){if(c.value.children?.length)return;_[g.value.pidField]=c.value[g.value.idField],o.dataManager().primary().find({page:1,pageSize:999,body:_}).then(F=>{c.value.children=F.body||[],c.value.children.forEach(T=>{T.isLeaf=!!T[g.value.leafField],h.value[T[g.value.idField]]=T,T.parentNode=h.value[T[g.value.pidField]]})})}else o.dataManager().primary().find({page:1,pageSize:999,body:_}).then(F=>{d.value=F.body||[],d.value.forEach(T=>{T.isLeaf=!!T[g.value.leafField],h.value[T[g.value.idField]]=T})})}const N=n.computed(()=>o.$widgetList.value||[]),M=n.computed(()=>{const _={...i.event||o.define.value?.configs?.event||{}};for(const F in _)_[F]&&typeof _[F]!="function"&&_[F].enable&&_[F].scriptText&&(F=="createNode"?_[F]=new Function("node","parent","params",_[F].scriptText):_[F]=new Function("data","event",_[F].scriptText));return _}),A=n.computed(()=>o.define.value?.configs?.setting||i.setting||{});n.provide("pageSetting",A.value);const E=n.computed(()=>{const _=o.define.value?.configs?.btns?.map(T=>typeof T=="string"?{name:T,visible:!1}:T)||i.btns?.map(T=>typeof T=="string"?{name:T,visible:!1}:T)||[],F=_.map(T=>T.name);if(!F.includes("save")){const T={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};_.splice(T.index,0,T)}if(!F.includes("reset")){const T={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};_.splice(T.index,0,T)}if(!F.includes("back")){const T={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};_.splice(T.index,0,T)}return o.model.value=="view"&&_.filter(T=>["save","submit","reset"].includes(T.name)).forEach(T=>{T.visible=!1}),_});function D({btn:_,event:F}){_.name=="save"&&z({btn:_,event:F}),_.name=="reset",_.name=="back"&&P()}async function z(_){const F=o.dataManager().form();let T={...c.value};for(let S in F){const q=await F[S].validate();if(o.dataManager().psn()==S)for(let I in q)T[I]=q[I];else T[S]=q}if(T[g.value.pidField]&&(T[g.value.pidField]+"").startsWith("new_")){e.error({content:"请先保存父节点!"});return}T[g.value.idField]&&(T[g.value.idField]+"").startsWith("new_")&&delete T[g.value.idField],delete T.parentNode,delete T.children,T[g.value.leafField]=T[g.value.leafField]?1:0,M.value.preSave&&M.value.preSave(T,_),console.log("=======form data=====",T),o.dataManager().primary().save({data:T}).then(S=>{console.log("save result:",S),c.value[g.value.idField]=S.body,u.value=[S.body],h.value[S.body]=c.value,c.value.children?.forEach(q=>{q[g.value.pidField]=S.body}),M.value.postSaved&&M.value.postSaved(T,_)})}function P(){t.back()}const U=n.ref("new_");return n.onMounted(()=>{const _=n.inject("route");console.log("unione page tree route",_),U.value=i.psn||_?.query?.psn||_?.meta?.psn||"new_",console.log("unione page tree,psn:"+U.value),o.setModel(_?.query?.model||_?.meta?.model||"run");const F={...i.params||{},..._?.query||{},..._?.params||{}};o.dataManager().params(F),s(),o.load(U.value,l),n.nextTick(()=>{p(!0)}),y(),r.value=!0}),(_,F)=>{const T=n.resolveComponent("SearchOutlined"),S=n.resolveComponent("a-input"),q=n.resolveComponent("unione-btn"),I=n.resolveComponent("a-tree");return n.openBlock(),n.createBlock(jt,{class:"unione-page-tree","setting-title":"页面设置",editor:n.unref(o)},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",{class:"tree-warp",onContextmenu:F[4]||(F[4]=n.withModifiers(()=>{},["prevent"]))},[n.createVNode(S,{size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:V.value,"onUpdate:value":F[0]||(F[0]=$=>V.value=$),onChange:n.unref(C),onPressEnter:n.unref(C)},{suffix:n.withCtx(()=>[n.createVNode(T)]),_:1},8,["value","onChange","onPressEnter"]),n.createVNode(q,{widget:v.value,onClick:B},null,8,["widget"]),n.createVNode(I,{"show-line":g.value.showLine,"show-icon":g.value.showIcon,disabled:g.value.disabled,blockNode:!0,draggable:g.value.draggable,multiple:g.value.multiple,selectable:g.value.selectable,checkable:g.value.checkable,fieldNames:{title:g.value.labelField,key:g.value.idField},selectedKeys:u.value,"onUpdate:selectedKeys":F[2]||(F[2]=$=>u.value=$),expandedKeys:m.value,"onUpdate:expandedKeys":F[3]||(F[3]=$=>m.value=$),"tree-data":d.value,onExpand:O,onSelect:k},n.createSlots({icon:n.withCtx(({dataRef:$})=>[$.iconName?(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.iconName),{key:0})):n.createCommentVNode("",!0)]),_:2},[w.value?.length?{name:"title",fn:n.withCtx(({dataRef:$})=>[n.createElementVNode("div",{class:"node-label",onMouseover:()=>f.value=$,onMouseleave:F[1]||(F[1]=()=>f.value=null)},[n.createElementVNode("span",null,n.toDisplayString($[g.value.labelField]),1),c.value&&c.value[g.value.idField]==$[g.value.idField]||f.value&&f.value[g.value.idField]==$[g.value.idField]?(n.openBlock(),n.createElementBlock("div",td,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(w.value,ae=>(n.openBlock(),n.createBlock(q,{key:ae.name,widget:ae,ctx:{node:$},onClick:Rt=>x(Rt,$)},null,8,["widget","ctx","onClick"]))),128))])):n.createCommentVNode("",!0)],40,ed)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),n.createElementVNode("div",id,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,$=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.widget),{key:$.wid,wid:$.wid,widget:$,editor:n.unref(o)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",nd,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(E.value,$=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:$.name},[$.visible!=!1?(n.openBlock(),n.createBlock(q,{key:0,widget:$,editor:n.unref(o),disabled:!c.value,ctx:{},onClick:D},null,8,["widget","editor","disabled"])):n.createCommentVNode("",!0)],64))),128))])])]),_:2},[n.unref(o)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(o)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Ol=n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},leftBtns:{type:Array,required:!1},rightBtns:{type:Array,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:t}){const i=a,l={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function s(){if(i.fields?.length){l.configs.widgets[0].dsn="primary",l.configs.widgets[0].fields=i.fields.filter(b=>b.isQuery),l.configs.widgets[0].btns=i.queryBtns||[],l.configs.widgets[0].params=i.params||{},l.configs.dsnList=["primary"],l.configs.widgets[1].dsn="primary";const m=i.fields.filter(b=>b.isPk)[0];m&&m.name&&(l.configs.widgets[1].dataKey=m.name),l.configs.widgets[1].columns=i.fields.filter(b=>b.hidden!=!0),l.configs.widgets[1].operation=K.utils.obj.ext(l.configs.widgets[1].operation,i.operation||{}),l.configs.widgets[1].leftBtns=i.leftBtns||[],l.configs.widgets[1].rightBtns=i.rightBtns||[],o.dataManager().use("primary","list").store(i.storage)}}const o=new wt,r=n.computed(()=>o.$widgetList.value||[]),d=t;function h(m){d("btnClick",m)}const c=n.ref("new_");n.onMounted(()=>{const m=n.inject("route");console.log("unione page view route",m),c.value=i.psn||m?.query?.psn||m?.meta?.psn||"new_",console.log("unione page view,psn:"+c.value),o.setModel(m?.query?.model||m?.meta?.model||"run");const b={...i.params||{},...m?.query||{},...m?.params||{}};o.dataManager().params(b),s(),o.load(c.value,l)});function f(){return o.dataManager().use("primary","list")}function u(){o.ebus.$emit("table-list-reload")}return e({storage:f,editor:o,reload:u}),(m,b)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(o)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,g=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(g.widget),{key:g.wid,wid:g.wid,widget:g,editor:n.unref(o),onBtnClick:h},null,40,["wid","widget","editor"]))),128))]),_:2},[n.unref(o)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(o)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),ct={release(a){return K.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return K.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return K.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return K.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return K.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return K.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return K.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},ld={class:"unione-page list-page"},sd=Z(n.defineComponent({__name:"list",setup(a){const e=Ae(),t=K.useDialog(),i=n.inject("router"),l=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),s=n.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});n.onMounted(()=>{r()});const o=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){o.value.loading=!0,ct.find({page:o.value.pagination.current,pageSize:o.value.pagination.pageSize,body:o.value.params,keywords:o.value.keywords}).then(k=>{o.value.data=k.body,o.value.pagination.total=k.total*1}).finally(()=>{o.value.loading=!1})}function d(k){o.value.pagination.current=k.pagination.current,o.value.pagination.pageSize=k.pagination.pageSize,r()}function h({params:k,keywords:p}){o.value.pagination.current=1,o.value.params=k,o.value.keywords=p,r()}function c({btn:k,event:p,row:B}){console.log("table btn click",k,p,B),(k.name=="add"||k.name=="edit")&&i.push({path:"/system/data/define/edit",query:B?{id:B.id}:{}}),k.name=="impFromDb"&&(u.value=!0),k.name=="release"&&f(B),k.name=="view"&&i.push({path:e.listPageUrl,query:{psn:B.sn+":list",model:"preview"}})}function f(k){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([k.id]).then(p=>{p.success?(t.success({title:"发布成功",content:p.body}),r()):t.error({title:"发布失败",content:p.body})})}})}const u=n.ref(!1),m=n.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),b=n.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),g=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function v(k){!k||!Object.keys(k).length||!k.dsId||(G.message.loading("数据加载中..."),g.value.params=k,g.value.loading=!0,ct.loadFromDb(k).then(p=>{g.value.loading=!1,G.message.destroy(),p.success?(p.body.forEach(B=>{B.checkable=!!B.id}),g.value.data=p.body,g.value.pagination.total=p.body.length):G.message.error(p.message)}))}function w(k){g.value.pagination.current=k.pagination.current,g.value.pagination.pageSize=k.pagination.pageSize}const x=n.ref();function O({btn:k}){if(k.name!="imp")return;const p=x.value.getSelected();p?.keys?.length?t.confirm({content:"确定导入选中的"+p.keys.length+"条记录么?",onOk:()=>{G.message.loading("数据导入中..."),ct.impFromDb({dsId:g.value.params.dsId,tables:p.keys.join()}).then(B=>{G.message.destroy(),B.success?(t.success({content:B.message}),o.value.pagination.current=1,r()):t.error({context:B.message})})}}):t.error({content:"请选择目标记录!"})}return(k,p)=>{const B=n.resolveComponent("UnioneQuery"),V=n.resolveComponent("UnioneTable"),C=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",ld,[n.createVNode(B,{widget:l.value,onQuery:h,onReset:h},null,8,["widget"]),n.createVNode(V,{widget:s.value,dataList:o.value.data,loading:o.value.loading,pagination:o.value.pagination,onChange:d,onBtnClick:c},null,8,["widget","dataList","loading","pagination"]),n.createVNode(C,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":p[0]||(p[0]=y=>u.value=y),placement:"left"},{default:n.withCtx(()=>[n.createVNode(B,{widget:m.value,onQuery:v,onReset:v,onBtnClick:O,class:"load-table-form"},null,8,["widget"]),n.createVNode(V,{widget:b.value,dataList:g.value.data,loading:g.value.loading,pagination:g.value.pagination,onChange:w,rowKey:"name",ref_key:"loadTableObj",ref:x},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-483acb94"]]),od={class:"unione-props-setting data-field-manage"},ad={key:0},rd={key:1},dd=["onClick"],cd=["onClick"],hd=["onClick"],fd={key:1},ud=Z(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:m})=>m+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=n.useModel(a,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(b=>{i.value.selectedRowKeys.includes(b)||i.value.selectedRowKeys.push(b);const g=[];t.value.forEach(v=>{!m.includes(v.name)&&i.value.selectedRowKeys.includes(v.name)&&g.push(v.name)}),g.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(v=>!g.includes(v)))})}}),l={mounted:m=>m.focus()},s=n.ref({});function o(){const m=Object.keys(s.value);if(m.length)for(let b in m){const g=t.value.filter(v=>v.name==b);if(g&&g[0]){let v=s.value[b];Object.keys(v).forEach(w=>{g[0][w]=v[w]})}}s.value={}}function r(m,b){o();const g={};g[b]=m[b]||"",s.value[m.name]=g}function d(m,b){if(!m||!b){s.value={};return}const g=s.value[m.name][b];if(b=="name"&&t.value.filter(w=>w[b]==g&&w.name!=m.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+g+"]已存在"});return}m[b]=g,s.value={}}function h(m,b){const g=t.value.filter(v=>v.name==m.name)[0];return b=="isFk"?g.configs?.fkey?.enable:g[b]==1}function c(m,b){const g=t.value.filter(v=>v.name==m.name)[0];b=="isFk"?(g.configs||(g.configs={}),g.configs.fkey||(g.configs.fkey={}),g.configs.fkey.enable=!g.configs.fkey.enable):g[b]!=1?g[b]=1:g[b]=0}function f(){if(o(),t.value.filter(g=>g.name=="new_").length>0){s.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),s.value[b.name]={name:"new_"}}function u(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(m=>!i.value.selectedRowKeys.includes(m.name)),i.value.selectedRowKeys=[]}})}return(m,b)=>{const g=n.resolveComponent("a-button"),v=n.resolveComponent("a-tooltip"),w=n.resolveComponent("a-input"),x=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-select-option"),k=n.resolveComponent("a-select"),p=n.resolveComponent("a-checkbox"),B=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",od,[n.createVNode(g,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>b[1]||(b[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(g,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:n.withCtx(()=>b[2]||(b[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(B,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:V})=>[["name","title"].includes(V.key)?(n.openBlock(),n.createElementBlock("span",ad,[b[3]||(b[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(V.title),1)])):n.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(V.key)?(n.openBlock(),n.createElementBlock("span",rd,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(V.title),1)])):n.createCommentVNode("",!0),V.key==="isPk"?(n.openBlock(),n.createBlock(v,{key:2,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[b[4]||(b[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0),V.key==="isFk"?(n.openBlock(),n.createBlock(v,{key:3,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0),V.key==="isNull"?(n.openBlock(),n.createBlock(v,{key:4,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0),V.key==="syncEnable"?(n.openBlock(),n.createBlock(v,{key:5,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:V,text:C,record:y})=>[["name","title","descs","dataValue"].includes(V.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[y.name]||!Object.keys(s.value[y.name]).includes(V.dataIndex))&&!C&&"empty"]),onClick:N=>r(y,V.dataIndex)},[s.value[y.name]&&Object.keys(s.value[y.name]).includes(V.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[y.name][V.dataIndex],"onUpdate:value":N=>s.value[y.name][V.dataIndex]=N,onBlur:N=>d(y,V.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,dd)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(V.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[y.name]||!Object.keys(s.value[y.name]).includes(V.dataIndex))&&!C&&"empty"]),onClick:N=>r(y,V.dataIndex)},[s.value[y.name]&&Object.keys(s.value[y.name]).includes(V.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:s.value[y.name][V.dataIndex],"onUpdate:value":N=>s.value[y.name][V.dataIndex]=N,onBlur:N=>d(y,V.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,cd)):["dataType"].includes(V.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[y.name]||!Object.keys(s.value[y.name]).includes(V.dataIndex))&&!C&&"empty"]),onClick:N=>r(y,V.dataIndex)},[s.value[y.name]&&Object.keys(s.value[y.name]).includes(V.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(k,{key:0,value:y[V.dataIndex],"onUpdate:value":N=>y[V.dataIndex]=N,onBlur:b[0]||(b[0]=N=>d())},{default:n.withCtx(()=>[n.createVNode(O,{key:"String",value:"String"}),n.createVNode(O,{key:"Long",value:"Long"}),n.createVNode(O,{key:"Short",value:"Short"}),n.createVNode(O,{key:"Integer",value:"Integer"}),n.createVNode(O,{key:"Float",value:"Float"}),n.createVNode(O,{key:"Double",value:"Double"}),n.createVNode(O,{key:"Date",value:"Date"}),n.createVNode(O,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",fd,n.toDisplayString(C),1))],10,hd)):["syncEnable","isFk","isPk"].includes(V.dataIndex)?(n.openBlock(),n.createBlock(p,{key:3,checked:h(y,V.dataIndex),onClick:N=>c(y,V.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(V.dataIndex)?(n.openBlock(),n.createBlock(p,{key:4,checked:!h(y,V.dataIndex),onClick:N=>c(y,V.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Vl=1024;let pd=0,nn=class{constructor(e,t){this.from=e,this.to=t}};class Y{constructor(e={}){this.id=pd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ce.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Y.closedBy=new Y({deserialize:a=>a.split(" ")}),Y.openedBy=new Y({deserialize:a=>a.split(" ")}),Y.group=new Y({deserialize:a=>a.split(" ")}),Y.isolate=new Y({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),Y.contextHash=new Y({perNode:!0}),Y.lookAhead=new Y({perNode:!0}),Y.mounted=new Y({perNode:!0});class hi{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[Y.mounted.id]}}const md=Object.create(null);class Ce{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):md,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Ce(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(l)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Y.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(Y.group),s=-1;s<(l?l.length:0);s++){let o=t[s<0?i.name:l[s]];if(o)return o}}}}Ce.none=new Ce("",Object.create(null),0,8);class ln{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let l=null;for(let s of e){let o=s(i);o&&(l||(l=Object.assign({},i.props)),l[o[0].id]=o[1])}t.push(l?new Ce(i.name,l,i.id,i.flags):i)}return new ln(t)}}const fi=new WeakMap,_l=new WeakMap;var fe;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(fe||(fe={}));class de{constructor(e,t,i,l,s){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,r]of s)this.props[typeof o=="number"?o:o.id]=r}}toString(){let e=hi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.toString();l&&(t&&(t+=","),t+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new an(this.topNode,e)}cursorAt(e,t=0,i=0){let l=fi.get(this)||this.topNode,s=new an(l);return s.moveTo(e,t),fi.set(this,s._tree),s}get topNode(){return new Ve(this,0,0,null)}resolve(e,t=0){let i=qt(fi.get(this)||this.topNode,e,t,!1);return fi.set(this,i),i}resolveInner(e,t=0){let i=qt(_l.get(this)||this.topNode,e,t,!0);return _l.set(this,i),i}resolveStack(e,t=0){return bd(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:s=this.length}=e,o=e.mode||0,r=(o&fe.IncludeAnonymous)>0;for(let d=this.cursor(o|fe.IncludeAnonymous);;){let h=!1;if(d.from<=s&&d.to>=l&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:dn(Ce.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new de(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new de(Ce.none,t,i,l)))}static build(e){return yd(e)}}de.empty=new de(Ce.none,[],[],0);class sn{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new sn(this.buffer,this.index)}}class Ze{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ce.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],l=this.set.types[t],s=l.name;if(/\W/.test(s)&&!l.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,l,s){let{buffer:o}=this,r=-1;for(let d=e;d!=t&&!(Ml(s,l,o[d+1],o[d+2])&&(r=d,i>0));d=o[d+3]);return r}slice(e,t,i){let l=this.buffer,s=new Uint16Array(t-e),o=0;for(let r=e,d=0;r<t;){s[d++]=l[r++],s[d++]=l[r++]-i;let h=s[d++]=l[r++]-i;s[d++]=l[r++]-e,o=Math.max(o,h)}return new Ze(s,o,this.set)}}function Ml(a,e,t,i){switch(a){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function qt(a,e,t,i){for(var l;a.from==a.to||(t<1?a.from>=e:a.from>e)||(t>-1?a.to<=e:a.to<e);){let o=!i&&a instanceof Ve&&a.index<0?null:a.parent;if(!o)return a;a=o}let s=i?0:fe.IgnoreOverlays;if(i)for(let o=a,r=o.parent;r;o=r,r=o.parent)o instanceof Ve&&o.index<0&&((l=r.enter(e,t,s))===null||l===void 0?void 0:l.from)!=o.from&&(a=r);for(;;){let o=a.enter(e,t,s);if(!o)return a;a=o}}class Tl{cursor(e=0){return new an(this,e)}getChild(e,t=null,i=null){let l=Al(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return Al(this,e,t,i)}resolve(e,t=0){return qt(this,e,t,!1)}resolveInner(e,t=0){return qt(this,e,t,!0)}matchContext(e){return on(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class Ve extends Tl{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,l,s=0){for(let o=this;;){for(let{children:r,positions:d}=o._tree,h=t>0?r.length:-1;e!=h;e+=t){let c=r[e],f=d[e]+o.from;if(Ml(l,i,f,f+c.length)){if(c instanceof Ze){if(s&fe.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,l);if(u>-1)return new et(new gd(o,c,e,f),null,u)}else if(s&fe.IncludeAnonymous||!c.type.isAnonymous||rn(c)){let u;if(!(s&fe.IgnoreMounts)&&(u=hi.get(c))&&!u.overlay)return new Ve(u.tree,f,e,o);let m=new Ve(c,f,e,o);return s&fe.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?c.children.length-1:0,t,i,l)}}}if(s&fe.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let l;if(!(i&fe.IgnoreOverlays)&&(l=hi.get(this._tree))&&l.overlay){let s=e-this.from;for(let{from:o,to:r}of l.overlay)if((t>0?o<=s:o<s)&&(t<0?r>=s:r>s))return new Ve(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Al(a,e,t,i){let l=a.cursor(),s=[];if(!l.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=l.type.is(t),!l.nextSibling())return s}for(;;){if(i!=null&&l.type.is(i))return s;if(l.type.is(e)&&s.push(l.node),!l.nextSibling())return i==null?s:[]}}function on(a,e,t=e.length-1){for(let i=a.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class gd{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class et extends Tl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new et(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&fe.ExcludeBuffers)return null;let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new et(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new et(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new et(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,s=i.buffer[this.index+3];if(s>l){let o=i.buffer[this.index+1];e.push(i.slice(l,s,o)),t.push(0)}return new de(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function El(a){if(!a.length)return null;let e=0,t=a[0];for(let s=1;s<a.length;s++){let o=a[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof Ve&&t.index<0?null:t.parent,l=a.slice();return i?l[e]=i:l.splice(e,1),new kd(l,t)}class kd{constructor(e,t){this.heads=e,this.node=t}get next(){return El(this.heads)}}function bd(a,e,t){let i=a.resolveInner(e,t),l=null;for(let s=i instanceof Ve?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(l||(l=[i])).push(o.resolve(e,t)),s=o}else{let o=hi.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let r=new Ve(o.tree,o.overlay[0].from+s.from,-1,s);(l||(l=[i])).push(qt(r,e,t,!1))}}return l?El(l):i}class an{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ve)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Ve?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&fe.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(l.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let r=i._tree.children[s];if(this.mode&fe.IncludeAnonymous||r instanceof Ze||!r.type.isAnonymous||rn(r))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==l){if(l==this.index)return o;t=o,i=s+1;break e}l=this.stack[--s]}for(let l=i;l<this.stack.length;l++)t=new et(this.buffer,t,this.stack[l]);return this.bufferNode=new et(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return on(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,s=this.stack.length-1;l>=0;s--){if(s<0)return on(this.node,e,l);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[l]&&e[l]!=o.name)return!1;l--}}return!0}}function rn(a){return a.children.some(e=>e instanceof Ze||!e.type.isAnonymous||rn(e))}function yd(a){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=Vl,reused:s=[],minRepeatType:o=i.types.length}=a,r=Array.isArray(t)?new sn(t,t.length):t,d=i.types,h=0,c=0;function f(p,B,V,C,y,N){let{id:M,start:A,end:E,size:D}=r,z=c;for(;D<0;)if(r.next(),D==-1){let T=s[M];V.push(T),C.push(A-p);return}else if(D==-3){h=M;return}else if(D==-4){c=M;return}else throw new RangeError(`Unrecognized record size: ${D}`);let P=d[M],U,_,F=A-p;if(E-A<=l&&(_=v(r.pos-B,y))){let T=new Uint16Array(_.size-_.skip),S=r.pos-_.size,q=T.length;for(;r.pos>S;)q=w(_.start,T,q);U=new Ze(T,E-_.start,i),F=_.start-p}else{let T=r.pos-D;r.next();let S=[],q=[],I=M>=o?M:-1,$=0,ae=E;for(;r.pos>T;)I>=0&&r.id==I&&r.size>=0?(r.end<=ae-l&&(b(S,q,A,$,r.end,ae,I,z),$=S.length,ae=r.end),r.next()):N>2500?u(A,T,S,q):f(A,T,S,q,I,N+1);if(I>=0&&$>0&&$<S.length&&b(S,q,A,$,A,ae,I,z),S.reverse(),q.reverse(),I>-1&&$>0){let Rt=m(P);U=dn(P,S,q,0,S.length,0,E-A,Rt,Rt)}else U=g(P,S,q,E-A,z-E)}V.push(U),C.push(F)}function u(p,B,V,C){let y=[],N=0,M=-1;for(;r.pos>B;){let{id:A,start:E,end:D,size:z}=r;if(z>4)r.next();else{if(M>-1&&E<M)break;M<0&&(M=D-l),y.push(A,E,D),N++,r.next()}}if(N){let A=new Uint16Array(N*4),E=y[y.length-2];for(let D=y.length-3,z=0;D>=0;D-=3)A[z++]=y[D],A[z++]=y[D+1]-E,A[z++]=y[D+2]-E,A[z++]=z;V.push(new Ze(A,y[2]-E,i)),C.push(E-p)}}function m(p){return(B,V,C)=>{let y=0,N=B.length-1,M,A;if(N>=0&&(M=B[N])instanceof de){if(!N&&M.type==p&&M.length==C)return M;(A=M.prop(Y.lookAhead))&&(y=V[N]+M.length+A)}return g(p,B,V,C,y)}}function b(p,B,V,C,y,N,M,A){let E=[],D=[];for(;p.length>C;)E.push(p.pop()),D.push(B.pop()+V-y);p.push(g(i.types[M],E,D,N-y,A-N)),B.push(y-V)}function g(p,B,V,C,y=0,N){if(h){let M=[Y.contextHash,h];N=N?[M].concat(N):[M]}if(y>25){let M=[Y.lookAhead,y];N=N?[M].concat(N):[M]}return new de(p,B,V,C,N)}function v(p,B){let V=r.fork(),C=0,y=0,N=0,M=V.end-l,A={size:0,start:0,skip:0};e:for(let E=V.pos-p;V.pos>E;){let D=V.size;if(V.id==B&&D>=0){A.size=C,A.start=y,A.skip=N,N+=4,C+=4,V.next();continue}let z=V.pos-D;if(D<0||z<E||V.start<M)break;let P=V.id>=o?4:0,U=V.start;for(V.next();V.pos>z;){if(V.size<0)if(V.size==-3)P+=4;else break e;else V.id>=o&&(P+=4);V.next()}y=U,C+=D,N+=P}return(B<0||C==p)&&(A.size=C,A.start=y,A.skip=N),A.size>4?A:void 0}function w(p,B,V){let{id:C,start:y,end:N,size:M}=r;if(r.next(),M>=0&&C<o){let A=V;if(M>4){let E=r.pos-(M-4);for(;r.pos>E;)V=w(p,B,V)}B[--V]=A,B[--V]=N-p,B[--V]=y-p,B[--V]=C}else M==-3?h=C:M==-4&&(c=C);return V}let x=[],O=[];for(;r.pos>0;)f(a.start||0,a.bufferStart||0,x,O,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:x.length?O[0]+x[0].length:0;return new de(d[a.topID],x.reverse(),O.reverse(),k)}const Il=new WeakMap;function ui(a,e){if(!a.isAnonymous||e instanceof Ze||e.type!=a)return 1;let t=Il.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=a||!(i instanceof de)){t=1;break}t+=ui(a,i)}Il.set(e,t)}return t}function dn(a,e,t,i,l,s,o,r,d){let h=0;for(let b=i;b<l;b++)h+=ui(a,e[b]);let c=Math.ceil(h*1.5/8),f=[],u=[];function m(b,g,v,w,x){for(let O=v;O<w;){let k=O,p=g[O],B=ui(a,b[O]);for(O++;O<w;O++){let V=ui(a,b[O]);if(B+V>=c)break;B+=V}if(O==k+1){if(B>c){let V=b[k];m(V.children,V.positions,0,V.children.length,g[k]+x);continue}f.push(b[k])}else{let V=g[O-1]+b[O-1].length-p;f.push(dn(a,b,g,k,O,p,V,null,d))}u.push(p+x-s)}}return m(e,t,i,l,0),(r||d)(f,u,o)}class ht{constructor(e,t,i,l,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new ht(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&l.push(s);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],s=1,o=e.length?e[0]:null;for(let r=0,d=0,h=0;;r++){let c=r<t.length?t[r]:null,f=c?c.fromA:1e9;if(f-d>=i)for(;o&&o.from<f;){let u=o;if(d>=u.from||f<=u.to||h){let m=Math.max(u.from,d)-h,b=Math.min(u.to,f)-h;u=m>=b?null:new ht(m,b,u.tree,u.offset+h,r>0,!!c)}if(u&&l.push(u),o.to>f)break;o=s<e.length?e[s++]:null}if(!c)break;d=c.toA,h=c.toA-c.toB}return l}}class Dl{startParse(e,t,i){return typeof e=="string"&&(e=new wd(e)),i=i?i.length?i.map(l=>new nn(l.from,l.to)):[new nn(0,0)]:[new nn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let s=l.advance();if(s)return s}}}class wd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Y({perNode:!0});class pi{constructor(e,t,i,l,s,o,r,d,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=s,this.score=o,this.buffer=r,this.bufferBase=d,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new pi(e,[],t,i,i,0,[],0,l?new Pl(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,l=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let r=s.dynamicPrecedence(l);if(r&&(this.score+=r),i==0){this.pushState(s.getGoto(this.state,l,!0),this.reducePos),l<s.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(l,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),h=d?this.stack[d-2]:this.p.ranges[0].from,c=this.reducePos-h;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let f=d?this.stack[d-1]:0,u=this.bufferBase+this.buffer.length-f;if(l<s.minRepeatTerm||e&131072){let m=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,h,m,u+4,!0)}if(e&262144)this.state=this.stack[d];else{let m=this.stack[d-3];this.state=s.getGoto(m,l,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(l,h)}storeNode(e,t,i,l=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,r=this.buffer.length;if(r==0&&o.parent&&(r=o.bufferBase-o.parent.bufferBase,o=o.parent),r>0&&o.buffer[r-4]==0&&o.buffer[r-1]>-1){if(t==i)return;if(o.buffer[r-2]>=t){o.buffer[r-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,l);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let r=!1;for(let d=o;d>0&&this.buffer[d-2]>i;d-=4)if(this.buffer[d-1]>=0){r=!0;break}if(r)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,l>4&&(l-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4);else{let s=e,{parser:o}=this.p;(l>this.pos||t<=o.maxNode)&&(this.pos=l,o.stateFlag(s,1)||(this.reducePos=l)),this.pushState(s,i),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,l,4)}}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(i,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new pi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new xd(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&l.push(t[s],o);if(this.stack.length<120)for(let s=0;l.length<8&&s<t.length;s+=2){let o=t[s+1];l.some((r,d)=>d&1&&r==o)||l.push(t[s],o)}t=l}let i=[];for(let l=0;l<t.length&&i.length<4;l+=2){let s=t[l+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[l],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let i=t>>19,l=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],l,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(l,s)=>{if(!t.includes(l))return t.push(l),e.allActions(l,o=>{if(!(o&393216))if(o&65536){let r=(o>>19)-s;if(r>1){let d=o&65535,h=this.stack.length-r*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return r<<19|65536|d}}else{let r=i(o,s+1);if(r!=null)return r}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Pl(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Pl{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class xd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class mi{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new mi(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new mi(this.stack,this.pos,this.index)}}function gi(a,e=Uint16Array){if(typeof a!="string")return a;let t=null;for(let i=0,l=0;i<a.length;){let s=0;for(;;){let o=a.charCodeAt(i++),r=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let d=o-32;if(d>=46&&(d-=46,r=!0),s+=d,r)break;s*=46}t?t[l++]=s:t=new e(s)}return t}class ki{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Fl=new ki;class vd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Fl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,l=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!l)return null;let o=this.ranges[--l];s-=i.from-o.to,i=o}for(;t<0?s>i.to:s>=i.to;){if(l==this.ranges.length-1)return null;let o=this.ranges[++l];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Fl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class xt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Cd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}xt.prototype.contextual=xt.prototype.fallback=xt.prototype.extend=!1,xt.prototype.fallback=xt.prototype.extend=!1;function Cd(a,e,t,i,l,s){let o=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&a[o];){let h=a[o+1];for(let m=o+3;m<h;m+=2)if((a[m+1]&r)>0){let b=a[m];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||Sd(b,e.token.value,l,s))){e.acceptToken(b);break}}let c=e.next,f=0,u=a[o+2];if(e.next<0&&u>f&&a[h+u*3-3]==65535){o=a[h+u*3-1];continue e}for(;f<u;){let m=f+u>>1,b=h+m+(m<<1),g=a[b],v=a[b+1]||65536;if(c<g)u=m;else if(c>=v)f=m+1;else{o=a[b+2],e.advance();continue e}}break}}function $l(a,e,t){for(let i=e,l;(l=a[i])!=65535;i++)if(l==t)return i-e;return-1}function Sd(a,e,t,i){let l=$l(t,i,e);return l<0||$l(t,i,a)<l}const Ne=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let cn=null;function Rl(a,e,t){let i=a.cursor(fe.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(a.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:a.length}}class Nd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Rl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Rl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],l=this.index[t];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[l],o=this.start[t]+i.positions[l];if(o>e)return this.nextStart=o,null;if(s instanceof de){if(o==e){if(o<this.safeFrom)return null;let r=o+s.length;if(r<=this.safeTo){let d=s.prop(Y.lookAhead);if(!d||r+d<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class Bd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ki)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:s}=l,o=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let h=0;h<s.length;h++){if(!(1<<h&o))continue;let c=s[h],f=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||f.start!=e.pos||f.mask!=o||f.context!=r)&&(this.updateCachedToken(f,c,e),f.mask=o,f.context=r),f.lookAhead>f.end+25&&(d=Math.max(f.lookAhead,d)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return d&&e.setLookAhead(d),!i&&e.pos==this.stream.end&&(i=new ki,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ki,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let r=s.specializers[o](this.stream.read(e.start,e.end),i);if(r>=0&&i.p.parser.dialect.allows(r>>1)){r&1?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,i,l){for(let s=0;s<l;s+=3)if(this.actions[s]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=i,l}addActions(e,t,i,l){let{state:s}=e,{parser:o}=e.p,{data:r}=o;for(let d=0;d<2;d++)for(let h=o.stateSlot(s,d?2:1);;h+=3){if(r[h]==65535)if(r[h+1]==1)h=He(r,h+2);else{l==0&&r[h+1]==2&&(l=this.putAction(He(r,h+2),t,i,l));break}r[h]==t&&(l=this.putAction(He(r,h+1),t,i,l))}return l}}class Od{constructor(e,t,i,l){this.parser=e,this.input=t,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new vd(t,l),this.tokens=new Bd(e,this.stream),this.topTerm=e.top[1];let{from:s}=l[0];this.stacks=[pi.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Nd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let r=e[o];for(;;){if(this.tokens.mainToken=null,r.pos>t)i.push(r);else{if(this.advanceStack(r,i,e))continue;{l||(l=[],s=[]),l.push(r);let d=this.tokens.getMainToken(r);s.push(d.value,d.end)}}break}}if(!i.length){let o=l&&_d(l);if(o)return Ne&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ne&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let o=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,s,i);if(o)return Ne&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((r,d)=>d.score-r.score);i.length>o;)i.pop();i.some(r=>r.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let r=i[o];for(let d=o+1;d<i.length;d++){let h=i[d];if(r.sameState(h)||r.buffer.length>500&&h.buffer.length>500)if((r.score-h.score||r.buffer.length-h.buffer.length)>0)i.splice(d--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let l=e.pos,{parser:s}=this,o=Ne?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(Y.contextHash)||0)==c))return e.useNode(f,u),Ne&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof de)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof de&&f.positions[0]==0)f=m;else break}}let r=s.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ne&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;h<d.length;){let c=d[h++],f=d[h++],u=d[h++],m=h==d.length||!i,b=m?e:e.split(),g=this.tokens.mainToken;if(b.apply(c,f,g?g.start:b.pos,u),Ne&&console.log(o+this.stackID(b)+` (via ${c&65536?`reduce of ${s.getName(c&65535)}`:"shift"} for ${s.getName(f)} @ ${l}${b==e?"":", split"})`),m)return!0;b.pos>l?t.push(b):i.push(b)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Ll(e,t),!0}}runRecovery(e,t,i){let l=null,s=!1;for(let o=0;o<e.length;o++){let r=e[o],d=t[o<<1],h=t[(o<<1)+1],c=Ne?this.stackID(r)+" -> ":"";if(r.deadEnd&&(s||(s=!0,r.restart(),Ne&&console.log(c+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),u=c;for(let m=0;f.forceReduce()&&m<10&&(Ne&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)Ne&&(u=this.stackID(f)+" -> ");for(let m of r.recoverByInsert(d))Ne&&console.log(c+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>r.pos?(h==r.pos&&(h++,d=0),r.recoverByDelete(d,h),Ne&&console.log(c+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),Ll(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),de.build({buffer:mi.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(cn||(cn=new WeakMap)).get(e);return t||cn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Ll(a,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==a.pos&&i.sameState(a)){e[t].score<a.score&&(e[t]=a);return}}e.push(a)}class Vd{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class bi extends Dl{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function s(r,d,h){l[r].push([d,d.deserialize(String(h))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=Y[d]);for(let h=1;h<r.length;){let c=r[h++];if(c>=0)s(c,d,r[h++]);else{let f=r[h+-c];for(let u=-c;u>0;u--)s(r[h++],d,f);h++}}}this.nodeSet=new ln(t.map((r,d)=>Ce.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:l[d],top:i.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Vl;let o=gi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(jl),this.states=gi(e.states,Uint32Array),this.data=gi(e.stateData),this.goto=gi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new xt(o,r):r),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let l=new Od(this,e,t,i);for(let s of this.wrappers)l=s(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let s=l[t+1];;){let o=l[s++],r=o&1,d=l[s++];if(r&&i)return d;for(let h=s+(o>>1);s<h;s++)if(l[s]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let l=0;l<2;l++)for(let s=this.stateSlot(e,l?2:1),o;;s+=3){if((o=i[s])==65535)if(i[s+1]==1)o=i[s=He(i,s+2)];else{if(i[s+1]==2)return He(i,s+2);break}if(o==t||o==0)return He(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let s=this.stateSlot(e,1);l==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=He(this.data,s+2);else break;l=t(He(this.data,s+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=He(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];t.some((s,o)=>o&1&&s==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(bi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(s=>s.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let s=e.specializers.find(r=>r.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[l]=jl(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let l=null;for(let s=0;s<t.length;s++)if(!i[s])for(let o=this.dialects[t[s]],r;(r=this.data[o++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Vd(e,i,l)}static deserialize(e){return new bi(e)}}function He(a,e){return a[e]|a[e+1]<<16}function _d(a){let e=null;for(let t of a){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function jl(a){if(a.external){let e=a.extend?1:0;return(t,i)=>a.external(t,i)<<1|e}return a.get}let Md=0;class _e{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=Md++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof _e&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new _e(i,[],null,[]);if(l.set.push(l),t)for(let s of t.set)l.set.push(s);return l}static defineModifier(e){let t=new yi(e);return i=>i.modified.indexOf(t)>-1?i:yi.get(i.base||i,i.modified.concat(t).sort((l,s)=>l.id-s.id))}}let Td=0;class yi{constructor(e){this.name=e,this.instances=[],this.id=Td++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Ad(t,r.modified));if(i)return i;let l=[],s=new _e(e.name,l,e,t);for(let r of t)r.instances.push(s);let o=Ed(t);for(let r of e.set)if(!r.modified.length)for(let d of o)l.push(yi.get(r,d));return s}}function Ad(a,e){return a.length==e.length&&a.every((t,i)=>t==e[i])}function Ed(a){let e=[[]];for(let t=0;t<a.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(a[t]));return e.sort((t,i)=>i.length-t.length)}function zl(a){let e=Object.create(null);for(let t in a){let i=a[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let s=[],o=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==l.length)break;let m=l[f++];if(f==l.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let d=s.length-1,h=s[d];if(!h)throw new RangeError("Invalid path: "+l);let c=new hn(i,o,d>0?s.slice(0,d):null);e[h]=c.sort(e[h])}}return Id.add(e)}const Id=new Y;class hn{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}hn.empty=new hn([],2,null);function ql(a,e){let t=Object.create(null);for(let s of a)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:l=null}=e||{};return{style:s=>{let o=l;for(let r of s)for(let d of r.set){let h=t[d.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}const j=_e.define,wi=j(),tt=j(),Ul=j(tt),Wl=j(tt),it=j(),xi=j(it),fn=j(it),Pe=j(),ft=j(Pe),Fe=j(),$e=j(),un=j(),Ut=j(un),vi=j(),R={comment:wi,lineComment:j(wi),blockComment:j(wi),docComment:j(wi),name:tt,variableName:j(tt),typeName:Ul,tagName:j(Ul),propertyName:Wl,attributeName:j(Wl),className:j(tt),labelName:j(tt),namespace:j(tt),macroName:j(tt),literal:it,string:xi,docString:j(xi),character:j(xi),attributeValue:j(xi),number:fn,integer:j(fn),float:j(fn),bool:j(it),regexp:j(it),escape:j(it),color:j(it),url:j(it),keyword:Fe,self:j(Fe),null:j(Fe),atom:j(Fe),unit:j(Fe),modifier:j(Fe),operatorKeyword:j(Fe),controlKeyword:j(Fe),definitionKeyword:j(Fe),moduleKeyword:j(Fe),operator:$e,derefOperator:j($e),arithmeticOperator:j($e),logicOperator:j($e),bitwiseOperator:j($e),compareOperator:j($e),updateOperator:j($e),definitionOperator:j($e),typeOperator:j($e),controlOperator:j($e),punctuation:un,separator:j(un),bracket:Ut,angleBracket:j(Ut),squareBracket:j(Ut),paren:j(Ut),brace:j(Ut),content:Pe,heading:ft,heading1:j(ft),heading2:j(ft),heading3:j(ft),heading4:j(ft),heading5:j(ft),heading6:j(ft),contentSeparator:j(Pe),list:j(Pe),quote:j(Pe),emphasis:j(Pe),strong:j(Pe),link:j(Pe),monospace:j(Pe),strikethrough:j(Pe),inserted:j(),deleted:j(),changed:j(),invalid:j(),meta:vi,documentMeta:j(vi),annotation:j(vi),processingInstruction:j(vi),definition:_e.defineModifier("definition"),constant:_e.defineModifier("constant"),function:_e.defineModifier("function"),standard:_e.defineModifier("standard"),local:_e.defineModifier("local"),special:_e.defineModifier("special")};for(let a in R){let e=R[a];e instanceof _e&&(e.name=a)}ql([{tag:R.link,class:"tok-link"},{tag:R.heading,class:"tok-heading"},{tag:R.emphasis,class:"tok-emphasis"},{tag:R.strong,class:"tok-strong"},{tag:R.keyword,class:"tok-keyword"},{tag:R.atom,class:"tok-atom"},{tag:R.bool,class:"tok-bool"},{tag:R.url,class:"tok-url"},{tag:R.labelName,class:"tok-labelName"},{tag:R.inserted,class:"tok-inserted"},{tag:R.deleted,class:"tok-deleted"},{tag:R.literal,class:"tok-literal"},{tag:R.string,class:"tok-string"},{tag:R.number,class:"tok-number"},{tag:[R.regexp,R.escape,R.special(R.string)],class:"tok-string2"},{tag:R.variableName,class:"tok-variableName"},{tag:R.local(R.variableName),class:"tok-variableName tok-local"},{tag:R.definition(R.variableName),class:"tok-variableName tok-definition"},{tag:R.special(R.variableName),class:"tok-variableName2"},{tag:R.definition(R.propertyName),class:"tok-propertyName tok-definition"},{tag:R.typeName,class:"tok-typeName"},{tag:R.namespace,class:"tok-namespace"},{tag:R.className,class:"tok-className"},{tag:R.macroName,class:"tok-macroName"},{tag:R.propertyName,class:"tok-propertyName"},{tag:R.operator,class:"tok-operator"},{tag:R.comment,class:"tok-comment"},{tag:R.meta,class:"tok-meta"},{tag:R.invalid,class:"tok-invalid"},{tag:R.punctuation,class:"tok-punctuation"}]);const Dd=zl({String:R.string,Number:R.number,"True False":R.bool,PropertyName:R.propertyName,Null:R.null,",":R.separator,"[ ]":R.squareBracket,"{ }":R.brace}),Pd=bi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Dd],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});class X{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=vt(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Re.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=vt(this,e,t);let i=[];return this.decompose(e,t,i,0),Re.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Wt(this),s=new Wt(e);for(let o=t,r=t;;){if(l.next(o),s.next(o),o=0,l.lineBreak!=s.lineBreak||l.done!=s.done||l.value!=s.value)return!1;if(r+=l.value.length,l.done||r>=i)return!0}}iter(e=1){return new Wt(this,e)}iterRange(e,t=this.length){return new Kl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ql(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?X.empty:e.length<=32?new re(e):Re.from(re.split(e,[]))}}class re extends X{constructor(e,t=Fd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let s=0;;s++){let o=this.text[s],r=l+o.length;if((t?i:r)>=e)return new $d(l,r,i,o);l=r+1,i++}}decompose(e,t,i,l){let s=e<=0&&t>=this.length?this:new re(Hl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let o=i.pop(),r=Ci(s.text,o.text.slice(),0,s.length);if(r.length<=32)i.push(new re(r,o.length+s.length));else{let d=r.length>>1;i.push(new re(r.slice(0,d)),new re(r.slice(d)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);[e,t]=vt(this,e,t);let l=Ci(this.text,Ci(i.text,Hl(this.text,0,e)),t),s=this.length+i.length-(t-e);return l.length<=32?new re(l,s):Re.from(re.split(l,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=vt(this,e,t);let l="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let r=this.text[o],d=s+r.length;s>e&&o&&(l+=i),e<d&&t>s&&(l+=r.slice(Math.max(0,e-s),t-s)),s=d+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let s of e)i.push(s),l+=s.length+1,i.length==32&&(t.push(new re(i,l)),i=[],l=-1);return l>-1&&t.push(new re(i,l)),t}}class Re extends X{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let s=0;;s++){let o=this.children[s],r=l+o.length,d=i+o.lines-1;if((t?d:r)>=e)return o.lineInner(e,t,i,l);l=r+1,i=d+1}}decompose(e,t,i,l){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let r=this.children[s],d=o+r.length;if(e<=d&&t>=o){let h=l&((o<=e?1:0)|(d>=t?2:0));o>=e&&d<=t&&!h?i.push(r):r.decompose(e-o,t-o,i,h)}o=d+1}}replace(e,t,i){if([e,t]=vt(this,e,t),i.lines<this.lines)for(let l=0,s=0;l<this.children.length;l++){let o=this.children[l],r=s+o.length;if(e>=s&&t<=r){let d=o.replace(e-s,t-s,i),h=this.lines-o.lines+d.lines;if(d.lines<h>>4&&d.lines>h>>6){let c=this.children.slice();return c[l]=d,new Re(c,this.length-(t-e)+i.length)}return super.replace(s,r,d)}s=r+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
|
-
`){[e,t]=vt(this,e,t);let l="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let r=this.children[s],d=o+r.length;o>e&&s&&(l+=i),e<d&&t>o&&(l+=r.sliceString(e-o,t-o,i)),o=d+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Re))return 0;let i=0,[l,s,o,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,s+=t){if(l==o||s==r)return i;let d=this.children[l],h=e.children[s];if(d!=h)return i+d.scanIdentical(h,t);i+=d.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let
|
|
4
|
-
`,this;e--}else if(l instanceof re){let d=l.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,d.length>Math.max(0,e))return this.value=e==0?d:t>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=l.children[o+(t<0?-1:0)];e>d.length?(e-=d.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(d),this.offsets.push(t>0?1:(d instanceof re?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Kl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Wt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ql{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(X.prototype[Symbol.iterator]=function(){return this.iter()},Wt.prototype[Symbol.iterator]=Kl.prototype[Symbol.iterator]=Ql.prototype[Symbol.iterator]=function(){return this});class $d{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function vt(a,e,t){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,t))]}let Ct="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(a=>a?parseInt(a,36):1);for(let a=1;a<Ct.length;a++)Ct[a]+=Ct[a-1];function Rd(a){for(let e=1;e<Ct.length;e+=2)if(Ct[e]>a)return Ct[e-1]<=a;return!1}function Gl(a){return a>=127462&&a<=127487}const Yl=8205;function Ke(a,e,t=!0,i=!0){return(t?Xl:Ld)(a,e,i)}function Xl(a,e,t){if(e==a.length)return e;e&&Jl(a.charCodeAt(e))&&Zl(a.charCodeAt(e-1))&&e--;let i=pn(a,e);for(e+=es(i);e<a.length;){let l=pn(a,e);if(i==Yl||l==Yl||t&&Rd(l))e+=es(l),i=l;else if(Gl(l)){let s=0,o=e-2;for(;o>=0&&Gl(pn(a,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Ld(a,e,t){for(;e>0;){let i=Xl(a,e-2,t);if(i<e)return i;e--}return 0}function Jl(a){return a>=56320&&a<57344}function Zl(a){return a>=55296&&a<56320}function pn(a,e){let t=a.charCodeAt(e);if(!Zl(t)||e+1==a.length)return t;let i=a.charCodeAt(e+1);return Jl(i)?(t-55296<<10)+(i-56320)+65536:t}function es(a){return a<65536?1:2}const mn=/\r\n?|\n/;var Be=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Be||(Be={}));class Qe{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,l,s),l+=s):l+=o,i+=s}}iterChangedRanges(e,t=!1){gn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new Qe(e)}composeDesc(e){return this.empty?e:e.empty?this:ts(this,e)}mapDesc(e,t=!1){return e.empty?this:kn(this,e,t)}mapPos(e,t=-1,i=Be.Simple){let l=0,s=0;for(let o=0;o<this.sections.length;){let r=this.sections[o++],d=this.sections[o++],h=l+r;if(d<0){if(h>e)return s+(e-l);s+=r}else{if(i!=Be.Simple&&h>=e&&(i==Be.TrackDel&&l<e&&h>e||i==Be.TrackBefore&&l<e||i==Be.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!r)return e==l||t<0?s:s+d;s+=d}l=h}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return s}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let s=this.sections[i++],o=this.sections[i++],r=l+s;if(o>=0&&l<=t&&r>=e)return l<e&&r>t?"cover":!0;l=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Qe(e)}static create(e){return new Qe(e)}}class ue extends Qe{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return gn(this,(t,i,l,s,o)=>e=e.replace(l,l+(i-t),o),!1),e}mapDesc(e,t=!1){return kn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,s=0;l<t.length;l+=2){let o=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=o;let d=l>>1;for(;i.length<d;)i.push(X.empty);i.push(o?e.slice(s,s+o):X.empty)}s+=o}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:ts(this,e,!0)}map(e,t=!1){return e.empty?this:kn(this,e,t,!0)}iterChanges(e,t=!1){gn(this,e,t)}get desc(){return Qe.create(this.sections)}filter(e){let t=[],i=[],l=[],s=new Ht(this);e:for(let o=0,r=0;;){let d=o==e.length?1e9:e[o++];for(;r<d||r==d&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,d-r);ke(l,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ke(t,c,f),f>0&&nt(i,t,s.text),s.forward(c),r+=c}let h=e[o++];for(;r<h;){if(s.done)break e;let c=Math.min(s.len,h-r);ke(t,c,-1),ke(l,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),r+=c}}return{changes:new ue(t,i),filtered:Qe.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],s=[],o=0,r=null;function d(c=!1){if(!c&&!l.length)return;o<t&&ke(l,t-o,-1);let f=new ue(l,s);r=r?r.compose(f.map(r)):f,l=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ue){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);d(),r=r?r.compose(c.map(r)):c}else{let{from:f,to:u=f,insert:p}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let b=p?typeof p=="string"?X.of(p.split(i||mn)):p:X.empty,g=b.length;if(f==u&&g==0)return;f<o&&d(),f>o&&ke(l,f-o,-1),ke(l,u-f,g),nt(s,l,b),o=u}}return h(e),d(!r),r}static empty(e){return new ue(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let s=e[l];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,r)=>r&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<l;)i.push(X.empty);i[l]=X.of(s.slice(1)),t.push(s[0],i[l].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function ke(a,e,t,i=!1){if(e==0&&t<=0)return;let l=a.length-2;l>=0&&t<=0&&t==a[l+1]?a[l]+=e:e==0&&a[l]==0?a[l+1]+=t:i?(a[l]+=e,a[l+1]+=t):a.push(e,t)}function nt(a,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<a.length)a[a.length-1]=a[a.length-1].append(t);else{for(;a.length<i;)a.push(X.empty);a.push(t)}}function gn(a,e,t){let i=a.inserted;for(let l=0,s=0,o=0;o<a.sections.length;){let r=a.sections[o++],d=a.sections[o++];if(d<0)l+=r,s+=r;else{let h=l,c=s,f=X.empty;for(;h+=r,c+=d,d&&i&&(f=f.append(i[o-2>>1])),!(t||o==a.sections.length||a.sections[o+1]<0);)r=a.sections[o++],d=a.sections[o++];e(l,h,s,c,f),l=h,s=c}}}function kn(a,e,t,i=!1){let l=[],s=i?[]:null,o=new Ht(a),r=new Ht(e);for(let d=-1;;)if(o.ins==-1&&r.ins==-1){let h=Math.min(o.len,r.len);ke(l,h,-1),o.forward(h),r.forward(h)}else if(r.ins>=0&&(o.ins<0||d==o.i||o.off==0&&(r.len<o.len||r.len==o.len&&!t))){let h=r.len;for(ke(l,r.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&d<o.i&&o.len<=c&&(ke(l,0,o.ins),s&&nt(s,l,o.text),d=o.i),o.forward(c),h-=c}r.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(r.ins==-1){let f=Math.min(c,r.len);h+=f,c-=f,r.forward(f)}else if(r.ins==0&&r.len<c)c-=r.len,r.next();else break;ke(l,h,d<o.i?o.ins:0),s&&d<o.i&&nt(s,l,o.text),d=o.i,o.forward(o.len-c)}else{if(o.done&&r.done)return s?ue.createSet(l,s):Qe.create(l);throw new Error("Mismatched change set lengths")}}function ts(a,e,t=!1){let i=[],l=t?[]:null,s=new Ht(a),o=new Ht(e);for(let r=!1;;){if(s.done&&o.done)return l?ue.createSet(i,l):Qe.create(i);if(s.ins==0)ke(i,s.len,0,r),s.next();else if(o.len==0&&!o.done)ke(i,0,o.ins,r),l&&nt(l,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let d=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ke(i,d,c,r),l&&c&&nt(l,i,o.text)}else o.ins==-1?(ke(i,s.off?0:s.len,d,r),l&&nt(l,i,s.textBit(d))):(ke(i,s.off?0:s.len,o.off?0:o.ins,r),l&&!o.off&&nt(l,i,o.text));r=(s.ins>d||o.ins>=0&&o.len>d)&&(r||i.length>h),s.forward2(d),o.forward(d)}}}}class Ht{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?X.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?X.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ut{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new ut(i,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return H.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return H.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return H.range(e.anchor,e.head)}static create(e,t,i){return new ut(e,t,i)}}class H{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:H.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new H([this.main],0)}addRange(e,t=!0){return H.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,H.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new H(e.ranges.map(t=>ut.fromJSON(t)),e.main)}static single(e,t=e){return new H([H.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;l<e.length;l++){let s=e[l];if(s.empty?s.from<=i:s.from<i)return H.normalized(e.slice(),t);i=s.to}return new H(e,t)}static cursor(e,t=0,i,l){return ut.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,t,i,l){let s=(i??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?ut.create(t,e,48|s):ut.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((l,s)=>l.from-s.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let s=e[l],o=e[l-1];if(s.empty?s.from<=o.to:s.from<o.to){let r=o.from,d=Math.max(s.to,o.to);l<=t&&t--,e.splice(--l,2,s.anchor>s.head?H.range(d,r):H.range(r,d))}}return new H(e,t)}}function is(a,e){for(let t of a.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let bn=0;class Q{constructor(e,t,i,l,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=bn++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Q(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:yn),!!e.static,e.enables)}of(e){return new Si([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function yn(a,e){return a==e||a.length==e.length&&a.every((t,i)=>t===e[i])}class Si{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=bn++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,s=this.id,o=e[s]>>1,r=this.type==2,d=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?d=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(d&&u.docChanged||h&&(u.docChanged||u.selection)||wn(f,c)){let p=i(f);if(r?!ns(p,f.values[o],l):!l(p,f.values[o]))return f.values[o]=p,1}return 0},reconfigure:(f,u)=>{let p,b=u.config.address[s];if(b!=null){let g=Oi(u,b);if(this.dependencies.every(v=>v instanceof Q?u.facet(v)===f.facet(v):v instanceof pt?u.field(v,!1)==f.field(v,!1):!0)||(r?ns(p=i(f),g,l):l(p=i(f),g)))return f.values[o]=g,0}else p=i(f);return f.values[o]=p,1}}}}function ns(a,e,t){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(!t(a[i],e[i]))return!1;return!0}function wn(a,e){let t=!1;for(let i of e)Qt(a,i)&1&&(t=!0);return t}function jd(a,e,t){let i=t.map(d=>a[d.id]),l=t.map(d=>d.type),s=i.filter(d=>!(d&1)),o=a[e.id]>>1;function r(d){let h=[];for(let c=0;c<i.length;c++){let f=Oi(d,i[c]);if(l[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(d){for(let h of i)Qt(d,h);return d.values[o]=r(d),1},update(d,h){if(!wn(d,s))return 0;let c=r(d);return e.compare(c,d.values[o])?0:(d.values[o]=c,1)},reconfigure(d,h){let c=wn(d,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&yn(t,f))return d.values[o]=u,0;let p=r(d);return e.compare(p,u)?(d.values[o]=u,0):(d.values[o]=p,1)}}}const ls=Q.define({static:!0});class pt{constructor(e,t,i,l,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=s,this.provides=void 0}static define(e){let t=new pt(bn++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ls).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let s=i.values[t],o=this.updateF(s,l);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,l)=>l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ls.of({field:this,create:e})]}get extension(){return this}}const mt={lowest:4,low:3,default:2,high:1,highest:0};function Kt(a){return e=>new ss(e,a)}const zd={highest:Kt(mt.highest),high:Kt(mt.high),default:Kt(mt.default),low:Kt(mt.low),lowest:Kt(mt.lowest)};class ss{constructor(e,t){this.inner=e,this.prec=t}}class Ni{of(e){return new xn(this,e)}reconfigure(e){return Ni.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class xn{constructor(e,t){this.compartment=e,this.inner=t}}class Bi{constructor(e,t,i,l,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let l=[],s=Object.create(null),o=new Map;for(let u of qd(e,t,o))u instanceof pt?l.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let r=Object.create(null),d=[],h=[];for(let u of l)r[u.id]=h.length<<1,h.push(p=>u.slot(p));let c=i?.config.facets;for(let u in s){let p=s[u],b=p[0].facet,g=c&&c[u]||[];if(p.every(v=>v.type==0))if(r[b.id]=d.length<<1|1,yn(g,p))d.push(i.facet(b));else{let v=b.combine(p.map(x=>x.value));d.push(i&&b.compare(v,i.facet(b))?i.facet(b):v)}else{for(let v of p)v.type==0?(r[v.id]=d.length<<1|1,d.push(v.value)):(r[v.id]=h.length<<1,h.push(x=>v.dynamicSlot(x)));r[b.id]=h.length<<1,h.push(v=>jd(v,b,p))}}let f=h.map(u=>u(r));return new Bi(e,o,f,r,d,s)}}function qd(a,e,t){let i=[[],[],[],[],[]],l=new Map;function s(o,r){let d=l.get(o);if(d!=null){if(d<=r)return;let h=i[d].indexOf(o);h>-1&&i[d].splice(h,1),o instanceof xn&&t.delete(o.compartment)}if(l.set(o,r),Array.isArray(o))for(let h of o)s(h,r);else if(o instanceof xn){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,r)}else if(o instanceof ss)s(o.inner,o.prec);else if(o instanceof pt)i[r].push(o),o.provides&&s(o.provides,r);else if(o instanceof Si)i[r].push(o),o.facet.extensions&&s(o.facet.extensions,mt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,r)}}return s(a,mt.default),i.reduce((o,r)=>o.concat(r))}function Qt(a,e){if(e&1)return 2;let t=e>>1,i=a.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;a.status[t]=4;let l=a.computeSlot(a,a.config.dynamicSlots[t]);return a.status[t]=2|l}function Oi(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const os=Q.define(),vn=Q.define({combine:a=>a.some(e=>e),static:!0}),as=Q.define({combine:a=>a.length?a[0]:void 0,static:!0}),rs=Q.define(),ds=Q.define(),cs=Q.define(),hs=Q.define({combine:a=>a.length?a[0]:!1});class St{constructor(e,t){this.type=e,this.value=t}static define(){return new Ud}}class Ud{of(e){return new St(this,e)}}class Wd{constructor(e){this.map=e}of(e){return new he(this,e)}}class he{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new he(this.type,t)}is(e){return this.type==e}static define(e={}){return new Wd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let s=l.map(t);s&&i.push(s)}return i}}he.reconfigure=he.define(),he.appendConfig=he.define();class be{constructor(e,t,i,l,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&is(i,t.newLength),s.some(r=>r.type==be.time)||(this.annotations=s.concat(be.time.of(Date.now())))}static create(e,t,i,l,s,o){return new be(e,t,i,l,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(be.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}be.time=St.define(),be.userEvent=St.define(),be.addToHistory=St.define(),be.remote=St.define();function Hd(a,e){let t=[];for(let i=0,l=0;;){let s,o;if(i<a.length&&(l==e.length||e[l]>=a[i]))s=a[i++],o=a[i++];else if(l<e.length)s=e[l++],o=e[l++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function fs(a,e,t){var i;let l,s,o;return t?(l=e.changes,s=ue.empty(e.changes.length),o=a.changes.compose(e.changes)):(l=e.changes.map(a.changes),s=a.changes.mapDesc(e.changes,!0),o=a.changes.compose(l)),{changes:o,selection:e.selection?e.selection.map(s):(i=a.selection)===null||i===void 0?void 0:i.map(l),effects:he.mapEffects(a.effects,l).concat(he.mapEffects(e.effects,s)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Cn(a,e,t){let i=e.selection,l=Nt(e.annotations);return e.userEvent&&(l=l.concat(be.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,a.facet(as)),selection:i&&(i instanceof H?i:H.single(i.anchor,i.head)),effects:Nt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function us(a,e,t){let i=Cn(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=fs(i,Cn(a,e[s],o?i.changes.newLength:a.doc.length),o)}let l=be.create(a,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Qd(t?Kd(l):l)}function Kd(a){let e=a.startState,t=!0;for(let l of e.facet(rs)){let s=l(a);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Hd(t,s))}if(t!==!0){let l,s;if(t===!1)s=a.changes.invertedDesc,l=ue.empty(e.doc.length);else{let o=a.changes.filter(t);l=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}a=be.create(e,l,a.selection&&a.selection.map(s),he.mapEffects(a.effects,s),a.annotations,a.scrollIntoView)}let i=e.facet(ds);for(let l=i.length-1;l>=0;l--){let s=i[l](a);s instanceof be?a=s:Array.isArray(s)&&s.length==1&&s[0]instanceof be?a=s[0]:a=us(e,Nt(s),!1)}return a}function Qd(a){let e=a.startState,t=e.facet(cs),i=a;for(let l=t.length-1;l>=0;l--){let s=t[l](a);s&&Object.keys(s).length&&(i=fs(i,Cn(e,s,a.changes.newLength),!0))}return i==a?a:be.create(e,a.changes,a.selection,i.effects,i.annotations,i.scrollIntoView)}const Gd=[];function Nt(a){return a==null?Gd:Array.isArray(a)?a:[a]}var Ge=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(Ge||(Ge={}));const Yd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Sn;try{Sn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Xd(a){if(Sn)return Sn.test(a);for(let e=0;e<a.length;e++){let t=a[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||Yd.test(t)))return!0}return!1}function Jd(a){return e=>{if(!/\S/.test(e))return Ge.Space;if(Xd(e))return Ge.Word;for(let t=0;t<a.length;t++)if(e.indexOf(a[t])>-1)return Ge.Word;return Ge.Other}}class te{constructor(e,t,i,l,s,o){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Qt(this,r<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Qt(this,i),Oi(this,i)}update(...e){return us(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let r of e.effects)r.is(Ni.reconfigure)?(t&&(l=new Map,t.compartments.forEach((d,h)=>l.set(h,d)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(he.reconfigure)?(t=null,i=r.value):r.is(he.appendConfig)&&(t=null,i=Nt(i).concat(r.value));let s;t?s=e.startState.values.slice():(t=Bi.resolve(i,l,this),s=new te(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let o=e.startState.facet(vn)?e.newSelection:e.newSelection.asSingle();new te(t,e.newDoc,o,s,(r,d)=>d.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:H.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),s=[i.range],o=Nt(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),h=this.changes(d.changes),c=h.map(l);for(let u=0;u<r;u++)s[u]=s[u].map(c);let f=l.mapDesc(h,!0);s.push(d.range.map(f)),l=l.compose(c),o=he.mapEffects(o,c).concat(he.mapEffects(Nt(d.effects),f))}return{changes:l,selection:H.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(te.lineSeparator))}toText(e){return X.of(e.split(this.facet(te.lineSeparator)||mn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Qt(this,t),Oi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof pt&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],r=e[s];l.push(o.init(d=>o.spec.fromJSON(r,d)))}}return te.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Bi.resolve(e.extensions||[],new Map),i=e.doc instanceof X?e.doc:X.of((e.doc||"").split(t.staticFacet(te.lineSeparator)||mn)),l=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return is(l,i.length),t.staticFacet(vn)||(l=l.asSingle()),new te(t,i,l,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(te.tabSize)}get lineBreak(){return this.facet(te.lineSeparator)||`
|
|
5
|
-
`}get readOnly(){return this.facet(hs)}phrase(e,...t){for(let i of this.facet(te.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let s=+(l||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let s of this.facet(os))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&l.push(o[e]);return l}charCategorizer(e){return Jd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,r=e-i;for(;o>0;){let d=Ke(t,o,!1);if(s(t.slice(d,o))!=Ge.Word)break;o=d}for(;r<l;){let d=Ke(t,r);if(s(t.slice(r,d))!=Ge.Word)break;r=d}return o==r?null:H.range(o+i,r+i)}}te.allowMultipleSelections=vn,te.tabSize=Q.define({combine:a=>a.length?a[0]:4}),te.lineSeparator=as,te.readOnly=hs,te.phrases=Q.define({compare(a,e){let t=Object.keys(a),i=Object.keys(e);return t.length==i.length&&t.every(l=>a[l]==e[l])}}),te.languageData=os,te.changeFilter=rs,te.transactionFilter=ds,te.transactionExtender=cs,Ni.reconfigure=he.define();class Bt{eq(e){return this==e}range(e,t=e){return Gt.create(e,t,this)}}Bt.prototype.startSide=Bt.prototype.endSide=0,Bt.prototype.point=!1,Bt.prototype.mapMode=Be.TrackDel;class Gt{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Gt(e,t,i)}}function Nn(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class Bn{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let s=i?this.to:this.from;for(let o=l,r=s.length;;){if(o==r)return o;let d=o+r>>1,h=s[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==o)return h>=0?o:r;h>=0?r=d:o=d+1}}between(e,t,i,l){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(l(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],l=[],s=[],o=-1,r=-1;for(let d=0;d<this.value.length;d++){let h=this.value[d],c=this.from[d]+e,f=this.to[d]+e,u,p;if(c==f){let b=t.mapPos(c,h.startSide,h.mapMode);if(b==null||(u=p=b,h.startSide!=h.endSide&&(p=t.mapPos(c,h.endSide),p<u)))continue}else if(u=t.mapPos(c,h.startSide),p=t.mapPos(f,h.endSide),u>p||u==p&&h.startSide>0&&h.endSide<=0)continue;(p-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(r=Math.max(r,p-u)),i.push(h),l.push(u-o),s.push(p-o))}return{mapped:i.length?new Bn(l,s,i,r):null,pos:o}}}class se{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new se(e,t,i,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:l=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Nn)),this.isEmpty)return t.length?se.of(t):this;let r=new ms(this,null,-1).goto(0),d=0,h=[],c=new Vi;for(;r.value||d<t.length;)if(d<t.length&&(r.from-t[d].from||r.startSide-t[d].value.startSide)>=0){let f=t[d++];c.addInner(f.from,f.to,f.value)||h.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!o||l>this.chunkEnd(r.chunkIndex)||s<this.chunkPos[r.chunkIndex])&&c.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!o||l>r.to||s<r.from||o(r.from,r.to,r.value))&&(c.addInner(r.from,r.to,r.value)||h.push(Gt.create(r.from,r.to,r.value))),r.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?se.empty:this.nextLayer.update({add:h,filter:o,filterFrom:l,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let o=0;o<this.chunk.length;o++){let r=this.chunkPos[o],d=this.chunk[o],h=e.touchesRange(r,r+d.length);if(h===!1)l=Math.max(l,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(h===!0){let{mapped:c,pos:f}=d.map(r,e);c&&(l=Math.max(l,c.maxPoint),t.push(c),i.push(f))}}let s=this.nextLayer.map(e);return t.length==0?s:new se(i,t,s||se.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let s=this.chunkPos[l],o=this.chunk[l];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Yt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Yt.from(e).goto(t)}static compare(e,t,i,l,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),r=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),d=ps(o,r,i),h=new Xt(o,d,s),c=new Xt(r,d,s);i.iterGaps((f,u,p)=>gs(h,f,c,u,p,l)),i.empty&&i.length==0&&gs(h,0,c,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let s=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let r=ps(s,o),d=new Xt(s,r,0).goto(i),h=new Xt(o,r,0).goto(i);for(;;){if(d.to!=h.to||!Vn(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>l)return!0;d.next(),h.next()}}static spans(e,t,i,l,s=-1){let o=new Xt(e,null,s).goto(t),r=t,d=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFrom<t?c.length+1:o.point.startSide<0?c.length:Math.min(c.length,d);l.point(r,h,o.point,c,f,o.pointRank),d=Math.min(o.openEnd(h),c.length)}else h>r&&(l.span(r,h,o.active,d),d=o.openEnd(h));if(o.to>i)return d+(o.point&&o.to>i?1:0);r=o.to,o.next()}}static of(e,t=!1){let i=new Vi;for(let l of e instanceof Gt?[e]:t?Zd(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return se.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=se.empty;l=l.nextLayer)t=new se(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}se.empty=new se([],[],null,-1);function Zd(a){if(a.length>1)for(let e=a[0],t=1;t<a.length;t++){let i=a[t];if(Nn(e,i)>0)return a.slice().sort(Nn);e=i}return a}se.empty.nextLayer=se.empty;class Vi{finishChunk(e){this.chunks.push(new Bn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Vi)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(se.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=se.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function ps(a,e,t){let i=new Map;for(let s of a)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&i.set(s.chunk[o],s.chunkPos[o]);let l=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let r=i.get(s.chunk[o]);r!=null&&(t?t.mapPos(r):r)==s.chunkPos[o]&&!t?.touchesRange(r,r+s.chunk[o].length)&&l.add(s.chunk[o])}return l}class ms{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Yt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&l.push(new ms(o,t,i,s));return l.length==1?l[0]:new Yt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),On(this.heap,0)}}}function On(a,e){for(let t=a[e];;){let i=(e<<1)+1;if(i>=a.length)break;let l=a[i];if(i+1<a.length&&l.compare(a[i+1])>=0&&(l=a[i+1],i++),t.compare(l)<0)break;a[i]=t,a[e]=l,e=i}}class Xt{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Yt.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){_i(this.active,e),_i(this.activeTo,e),_i(this.activeRank,e),this.minActive=ks(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Mi(this.active,t,i),Mi(this.activeTo,t,l),Mi(this.activeRank,t,s),e&&Mi(e,t,this.cursor.from),this.minActive=ks(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&_i(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function gs(a,e,t,i,l,s){a.goto(e),t.goto(i);let o=i+l,r=i,d=i-e;for(;;){let h=a.to+d-t.to||a.endSide-t.endSide,c=h<0?a.to+d:t.to,f=Math.min(c,o);if(a.point||t.point?a.point&&t.point&&(a.point==t.point||a.point.eq(t.point))&&Vn(a.activeForPoint(a.to),t.activeForPoint(t.to))||s.comparePoint(r,f,a.point,t.point):f>r&&!Vn(a.active,t.active)&&s.compareRange(r,f,a.active,t.active),c>o)break;r=c,h<=0&&a.next(),h>=0&&t.next()}}function Vn(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++)if(a[t]!=e[t]&&!a[t].eq(e[t]))return!1;return!0}function _i(a,e){for(let t=e,i=a.length-1;t<i;t++)a[t]=a[t+1];a.pop()}function Mi(a,e,t){for(let i=a.length-1;i>=e;i--)a[i+1]=a[i];a[e]=t}function ks(a,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||a[l].endSide-a[t].endSide)<0&&(t=l,i=e[l]);return t}function ec(a,e,t,i){for(let l=0,s=0;;){if(s>=e)return l;if(l==a.length)break;s+=a.charCodeAt(l)==9?t-s%t:1,l=Ke(a,l)}return i===!0?-1:a.length}const _n="ͼ",bs=typeof Symbol>"u"?"__"+_n:Symbol.for(_n),Mn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ys=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class lt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,r,d,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return d.push(o[0]+";");for(let p in r){let b=r[p];if(/&/.test(p))s(p.split(/,\s*/).map(g=>o.map(v=>g.replace(/&/,v))).reduce((g,v)=>g.concat(v)),b,d);else if(b&&typeof b=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(l(p),b,c,u)}else b!=null&&c.push(p.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+b+";")}(c.length||u)&&d.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(l(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
3
|
+
`){[e,t]=vt(this,e,t);let l="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let r=this.children[s],d=o+r.length;o>e&&s&&(l+=i),e<d&&t>o&&(l+=r.sliceString(e-o,t-o,i)),o=d+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Re))return 0;let i=0,[l,s,o,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,s+=t){if(l==o||s==r)return i;let d=this.children[l],h=e.children[s];if(d!=h)return i+d.scanIdentical(h,t);i+=d.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let m of e)i+=m.lines;if(i<32){let m=[];for(let b of e)b.flatten(m);return new re(m,t)}let l=Math.max(32,i>>5),s=l<<1,o=l>>1,r=[],d=0,h=-1,c=[];function f(m){let b;if(m.lines>s&&m instanceof Re)for(let g of m.children)f(g);else m.lines>o&&(d>o||!d)?(u(),r.push(m)):m instanceof re&&d&&(b=c[c.length-1])instanceof re&&m.lines+b.lines<=32?(d+=m.lines,h+=m.length+1,c[c.length-1]=new re(b.text.concat(m.text),b.length+1+m.length)):(d+m.lines>l&&u(),d+=m.lines,h+=m.length+1,c.push(m))}function u(){d!=0&&(r.push(c.length==1?c[0]:Re.from(c,h)),h=-1,d=c.length=0)}for(let m of e)f(m);return u(),r.length==1?r[0]:new Re(r,t)}}X.empty=new re([""],0);function Fd(a){let e=-1;for(let t of a)e+=t.length+1;return e}function Ci(a,e,t=0,i=1e9){for(let l=0,s=0,o=!0;s<a.length&&l<=i;s++){let r=a[s],d=l+r.length;d>=t&&(d>i&&(r=r.slice(0,i-l)),l<t&&(r=r.slice(t-l)),o?(e[e.length-1]+=r,o=!1):e.push(r)),l=d+1}return e}function Hl(a,e,t){return Ci(a,[""],e,t)}class Wt{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof re?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],s=this.offsets[i],o=s>>1,r=l instanceof re?l.text.length:l.children.length;if(o==(t>0?r:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
|
+
`,this;e--}else if(l instanceof re){let d=l.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,d.length>Math.max(0,e))return this.value=e==0?d:t>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=l.children[o+(t<0?-1:0)];e>d.length?(e-=d.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(d),this.offsets.push(t>0?1:(d instanceof re?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Kl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Wt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ql{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(X.prototype[Symbol.iterator]=function(){return this.iter()},Wt.prototype[Symbol.iterator]=Kl.prototype[Symbol.iterator]=Ql.prototype[Symbol.iterator]=function(){return this});class $d{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function vt(a,e,t){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,t))]}let Ct="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(a=>a?parseInt(a,36):1);for(let a=1;a<Ct.length;a++)Ct[a]+=Ct[a-1];function Rd(a){for(let e=1;e<Ct.length;e+=2)if(Ct[e]>a)return Ct[e-1]<=a;return!1}function Gl(a){return a>=127462&&a<=127487}const Yl=8205;function Ke(a,e,t=!0,i=!0){return(t?Xl:Ld)(a,e,i)}function Xl(a,e,t){if(e==a.length)return e;e&&Jl(a.charCodeAt(e))&&Zl(a.charCodeAt(e-1))&&e--;let i=pn(a,e);for(e+=es(i);e<a.length;){let l=pn(a,e);if(i==Yl||l==Yl||t&&Rd(l))e+=es(l),i=l;else if(Gl(l)){let s=0,o=e-2;for(;o>=0&&Gl(pn(a,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Ld(a,e,t){for(;e>0;){let i=Xl(a,e-2,t);if(i<e)return i;e--}return 0}function Jl(a){return a>=56320&&a<57344}function Zl(a){return a>=55296&&a<56320}function pn(a,e){let t=a.charCodeAt(e);if(!Zl(t)||e+1==a.length)return t;let i=a.charCodeAt(e+1);return Jl(i)?(t-55296<<10)+(i-56320)+65536:t}function es(a){return a<65536?1:2}const mn=/\r\n?|\n/;var Be=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Be||(Be={}));class Qe{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,l,s),l+=s):l+=o,i+=s}}iterChangedRanges(e,t=!1){gn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new Qe(e)}composeDesc(e){return this.empty?e:e.empty?this:ts(this,e)}mapDesc(e,t=!1){return e.empty?this:kn(this,e,t)}mapPos(e,t=-1,i=Be.Simple){let l=0,s=0;for(let o=0;o<this.sections.length;){let r=this.sections[o++],d=this.sections[o++],h=l+r;if(d<0){if(h>e)return s+(e-l);s+=r}else{if(i!=Be.Simple&&h>=e&&(i==Be.TrackDel&&l<e&&h>e||i==Be.TrackBefore&&l<e||i==Be.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!r)return e==l||t<0?s:s+d;s+=d}l=h}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return s}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let s=this.sections[i++],o=this.sections[i++],r=l+s;if(o>=0&&l<=t&&r>=e)return l<e&&r>t?"cover":!0;l=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Qe(e)}static create(e){return new Qe(e)}}class ue extends Qe{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return gn(this,(t,i,l,s,o)=>e=e.replace(l,l+(i-t),o),!1),e}mapDesc(e,t=!1){return kn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,s=0;l<t.length;l+=2){let o=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=o;let d=l>>1;for(;i.length<d;)i.push(X.empty);i.push(o?e.slice(s,s+o):X.empty)}s+=o}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:ts(this,e,!0)}map(e,t=!1){return e.empty?this:kn(this,e,t,!0)}iterChanges(e,t=!1){gn(this,e,t)}get desc(){return Qe.create(this.sections)}filter(e){let t=[],i=[],l=[],s=new Ht(this);e:for(let o=0,r=0;;){let d=o==e.length?1e9:e[o++];for(;r<d||r==d&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,d-r);ke(l,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ke(t,c,f),f>0&&nt(i,t,s.text),s.forward(c),r+=c}let h=e[o++];for(;r<h;){if(s.done)break e;let c=Math.min(s.len,h-r);ke(t,c,-1),ke(l,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),r+=c}}return{changes:new ue(t,i),filtered:Qe.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],s=[],o=0,r=null;function d(c=!1){if(!c&&!l.length)return;o<t&&ke(l,t-o,-1);let f=new ue(l,s);r=r?r.compose(f.map(r)):f,l=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ue){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);d(),r=r?r.compose(c.map(r)):c}else{let{from:f,to:u=f,insert:m}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let b=m?typeof m=="string"?X.of(m.split(i||mn)):m:X.empty,g=b.length;if(f==u&&g==0)return;f<o&&d(),f>o&&ke(l,f-o,-1),ke(l,u-f,g),nt(s,l,b),o=u}}return h(e),d(!r),r}static empty(e){return new ue(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let s=e[l];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,r)=>r&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<l;)i.push(X.empty);i[l]=X.of(s.slice(1)),t.push(s[0],i[l].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function ke(a,e,t,i=!1){if(e==0&&t<=0)return;let l=a.length-2;l>=0&&t<=0&&t==a[l+1]?a[l]+=e:e==0&&a[l]==0?a[l+1]+=t:i?(a[l]+=e,a[l+1]+=t):a.push(e,t)}function nt(a,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<a.length)a[a.length-1]=a[a.length-1].append(t);else{for(;a.length<i;)a.push(X.empty);a.push(t)}}function gn(a,e,t){let i=a.inserted;for(let l=0,s=0,o=0;o<a.sections.length;){let r=a.sections[o++],d=a.sections[o++];if(d<0)l+=r,s+=r;else{let h=l,c=s,f=X.empty;for(;h+=r,c+=d,d&&i&&(f=f.append(i[o-2>>1])),!(t||o==a.sections.length||a.sections[o+1]<0);)r=a.sections[o++],d=a.sections[o++];e(l,h,s,c,f),l=h,s=c}}}function kn(a,e,t,i=!1){let l=[],s=i?[]:null,o=new Ht(a),r=new Ht(e);for(let d=-1;;)if(o.ins==-1&&r.ins==-1){let h=Math.min(o.len,r.len);ke(l,h,-1),o.forward(h),r.forward(h)}else if(r.ins>=0&&(o.ins<0||d==o.i||o.off==0&&(r.len<o.len||r.len==o.len&&!t))){let h=r.len;for(ke(l,r.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&d<o.i&&o.len<=c&&(ke(l,0,o.ins),s&&nt(s,l,o.text),d=o.i),o.forward(c),h-=c}r.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(r.ins==-1){let f=Math.min(c,r.len);h+=f,c-=f,r.forward(f)}else if(r.ins==0&&r.len<c)c-=r.len,r.next();else break;ke(l,h,d<o.i?o.ins:0),s&&d<o.i&&nt(s,l,o.text),d=o.i,o.forward(o.len-c)}else{if(o.done&&r.done)return s?ue.createSet(l,s):Qe.create(l);throw new Error("Mismatched change set lengths")}}function ts(a,e,t=!1){let i=[],l=t?[]:null,s=new Ht(a),o=new Ht(e);for(let r=!1;;){if(s.done&&o.done)return l?ue.createSet(i,l):Qe.create(i);if(s.ins==0)ke(i,s.len,0,r),s.next();else if(o.len==0&&!o.done)ke(i,0,o.ins,r),l&&nt(l,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let d=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ke(i,d,c,r),l&&c&&nt(l,i,o.text)}else o.ins==-1?(ke(i,s.off?0:s.len,d,r),l&&nt(l,i,s.textBit(d))):(ke(i,s.off?0:s.len,o.off?0:o.ins,r),l&&!o.off&&nt(l,i,o.text));r=(s.ins>d||o.ins>=0&&o.len>d)&&(r||i.length>h),s.forward2(d),o.forward(d)}}}}class Ht{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?X.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?X.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ut{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new ut(i,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return H.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return H.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return H.range(e.anchor,e.head)}static create(e,t,i){return new ut(e,t,i)}}class H{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:H.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new H([this.main],0)}addRange(e,t=!0){return H.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,H.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new H(e.ranges.map(t=>ut.fromJSON(t)),e.main)}static single(e,t=e){return new H([H.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;l<e.length;l++){let s=e[l];if(s.empty?s.from<=i:s.from<i)return H.normalized(e.slice(),t);i=s.to}return new H(e,t)}static cursor(e,t=0,i,l){return ut.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,t,i,l){let s=(i??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?ut.create(t,e,48|s):ut.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((l,s)=>l.from-s.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let s=e[l],o=e[l-1];if(s.empty?s.from<=o.to:s.from<o.to){let r=o.from,d=Math.max(s.to,o.to);l<=t&&t--,e.splice(--l,2,s.anchor>s.head?H.range(d,r):H.range(r,d))}}return new H(e,t)}}function is(a,e){for(let t of a.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let bn=0;class Q{constructor(e,t,i,l,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=bn++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Q(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:yn),!!e.static,e.enables)}of(e){return new Si([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function yn(a,e){return a==e||a.length==e.length&&a.every((t,i)=>t===e[i])}class Si{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=bn++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,s=this.id,o=e[s]>>1,r=this.type==2,d=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?d=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(d&&u.docChanged||h&&(u.docChanged||u.selection)||wn(f,c)){let m=i(f);if(r?!ns(m,f.values[o],l):!l(m,f.values[o]))return f.values[o]=m,1}return 0},reconfigure:(f,u)=>{let m,b=u.config.address[s];if(b!=null){let g=Oi(u,b);if(this.dependencies.every(v=>v instanceof Q?u.facet(v)===f.facet(v):v instanceof pt?u.field(v,!1)==f.field(v,!1):!0)||(r?ns(m=i(f),g,l):l(m=i(f),g)))return f.values[o]=g,0}else m=i(f);return f.values[o]=m,1}}}}function ns(a,e,t){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(!t(a[i],e[i]))return!1;return!0}function wn(a,e){let t=!1;for(let i of e)Qt(a,i)&1&&(t=!0);return t}function jd(a,e,t){let i=t.map(d=>a[d.id]),l=t.map(d=>d.type),s=i.filter(d=>!(d&1)),o=a[e.id]>>1;function r(d){let h=[];for(let c=0;c<i.length;c++){let f=Oi(d,i[c]);if(l[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(d){for(let h of i)Qt(d,h);return d.values[o]=r(d),1},update(d,h){if(!wn(d,s))return 0;let c=r(d);return e.compare(c,d.values[o])?0:(d.values[o]=c,1)},reconfigure(d,h){let c=wn(d,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&yn(t,f))return d.values[o]=u,0;let m=r(d);return e.compare(m,u)?(d.values[o]=u,0):(d.values[o]=m,1)}}}const ls=Q.define({static:!0});class pt{constructor(e,t,i,l,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=s,this.provides=void 0}static define(e){let t=new pt(bn++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ls).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let s=i.values[t],o=this.updateF(s,l);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,l)=>l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ls.of({field:this,create:e})]}get extension(){return this}}const mt={lowest:4,low:3,default:2,high:1,highest:0};function Kt(a){return e=>new ss(e,a)}const zd={highest:Kt(mt.highest),high:Kt(mt.high),default:Kt(mt.default),low:Kt(mt.low),lowest:Kt(mt.lowest)};class ss{constructor(e,t){this.inner=e,this.prec=t}}class Ni{of(e){return new xn(this,e)}reconfigure(e){return Ni.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class xn{constructor(e,t){this.compartment=e,this.inner=t}}class Bi{constructor(e,t,i,l,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let l=[],s=Object.create(null),o=new Map;for(let u of qd(e,t,o))u instanceof pt?l.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let r=Object.create(null),d=[],h=[];for(let u of l)r[u.id]=h.length<<1,h.push(m=>u.slot(m));let c=i?.config.facets;for(let u in s){let m=s[u],b=m[0].facet,g=c&&c[u]||[];if(m.every(v=>v.type==0))if(r[b.id]=d.length<<1|1,yn(g,m))d.push(i.facet(b));else{let v=b.combine(m.map(w=>w.value));d.push(i&&b.compare(v,i.facet(b))?i.facet(b):v)}else{for(let v of m)v.type==0?(r[v.id]=d.length<<1|1,d.push(v.value)):(r[v.id]=h.length<<1,h.push(w=>v.dynamicSlot(w)));r[b.id]=h.length<<1,h.push(v=>jd(v,b,m))}}let f=h.map(u=>u(r));return new Bi(e,o,f,r,d,s)}}function qd(a,e,t){let i=[[],[],[],[],[]],l=new Map;function s(o,r){let d=l.get(o);if(d!=null){if(d<=r)return;let h=i[d].indexOf(o);h>-1&&i[d].splice(h,1),o instanceof xn&&t.delete(o.compartment)}if(l.set(o,r),Array.isArray(o))for(let h of o)s(h,r);else if(o instanceof xn){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,r)}else if(o instanceof ss)s(o.inner,o.prec);else if(o instanceof pt)i[r].push(o),o.provides&&s(o.provides,r);else if(o instanceof Si)i[r].push(o),o.facet.extensions&&s(o.facet.extensions,mt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,r)}}return s(a,mt.default),i.reduce((o,r)=>o.concat(r))}function Qt(a,e){if(e&1)return 2;let t=e>>1,i=a.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;a.status[t]=4;let l=a.computeSlot(a,a.config.dynamicSlots[t]);return a.status[t]=2|l}function Oi(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const os=Q.define(),vn=Q.define({combine:a=>a.some(e=>e),static:!0}),as=Q.define({combine:a=>a.length?a[0]:void 0,static:!0}),rs=Q.define(),ds=Q.define(),cs=Q.define(),hs=Q.define({combine:a=>a.length?a[0]:!1});class St{constructor(e,t){this.type=e,this.value=t}static define(){return new Ud}}class Ud{of(e){return new St(this,e)}}class Wd{constructor(e){this.map=e}of(e){return new he(this,e)}}class he{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new he(this.type,t)}is(e){return this.type==e}static define(e={}){return new Wd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let s=l.map(t);s&&i.push(s)}return i}}he.reconfigure=he.define(),he.appendConfig=he.define();class be{constructor(e,t,i,l,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&is(i,t.newLength),s.some(r=>r.type==be.time)||(this.annotations=s.concat(be.time.of(Date.now())))}static create(e,t,i,l,s,o){return new be(e,t,i,l,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(be.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}be.time=St.define(),be.userEvent=St.define(),be.addToHistory=St.define(),be.remote=St.define();function Hd(a,e){let t=[];for(let i=0,l=0;;){let s,o;if(i<a.length&&(l==e.length||e[l]>=a[i]))s=a[i++],o=a[i++];else if(l<e.length)s=e[l++],o=e[l++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function fs(a,e,t){var i;let l,s,o;return t?(l=e.changes,s=ue.empty(e.changes.length),o=a.changes.compose(e.changes)):(l=e.changes.map(a.changes),s=a.changes.mapDesc(e.changes,!0),o=a.changes.compose(l)),{changes:o,selection:e.selection?e.selection.map(s):(i=a.selection)===null||i===void 0?void 0:i.map(l),effects:he.mapEffects(a.effects,l).concat(he.mapEffects(e.effects,s)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Cn(a,e,t){let i=e.selection,l=Nt(e.annotations);return e.userEvent&&(l=l.concat(be.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,a.facet(as)),selection:i&&(i instanceof H?i:H.single(i.anchor,i.head)),effects:Nt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function us(a,e,t){let i=Cn(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=fs(i,Cn(a,e[s],o?i.changes.newLength:a.doc.length),o)}let l=be.create(a,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Qd(t?Kd(l):l)}function Kd(a){let e=a.startState,t=!0;for(let l of e.facet(rs)){let s=l(a);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Hd(t,s))}if(t!==!0){let l,s;if(t===!1)s=a.changes.invertedDesc,l=ue.empty(e.doc.length);else{let o=a.changes.filter(t);l=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}a=be.create(e,l,a.selection&&a.selection.map(s),he.mapEffects(a.effects,s),a.annotations,a.scrollIntoView)}let i=e.facet(ds);for(let l=i.length-1;l>=0;l--){let s=i[l](a);s instanceof be?a=s:Array.isArray(s)&&s.length==1&&s[0]instanceof be?a=s[0]:a=us(e,Nt(s),!1)}return a}function Qd(a){let e=a.startState,t=e.facet(cs),i=a;for(let l=t.length-1;l>=0;l--){let s=t[l](a);s&&Object.keys(s).length&&(i=fs(i,Cn(e,s,a.changes.newLength),!0))}return i==a?a:be.create(e,a.changes,a.selection,i.effects,i.annotations,i.scrollIntoView)}const Gd=[];function Nt(a){return a==null?Gd:Array.isArray(a)?a:[a]}var Ge=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(Ge||(Ge={}));const Yd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Sn;try{Sn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Xd(a){if(Sn)return Sn.test(a);for(let e=0;e<a.length;e++){let t=a[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||Yd.test(t)))return!0}return!1}function Jd(a){return e=>{if(!/\S/.test(e))return Ge.Space;if(Xd(e))return Ge.Word;for(let t=0;t<a.length;t++)if(e.indexOf(a[t])>-1)return Ge.Word;return Ge.Other}}class te{constructor(e,t,i,l,s,o){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Qt(this,r<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Qt(this,i),Oi(this,i)}update(...e){return us(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let r of e.effects)r.is(Ni.reconfigure)?(t&&(l=new Map,t.compartments.forEach((d,h)=>l.set(h,d)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(he.reconfigure)?(t=null,i=r.value):r.is(he.appendConfig)&&(t=null,i=Nt(i).concat(r.value));let s;t?s=e.startState.values.slice():(t=Bi.resolve(i,l,this),s=new te(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let o=e.startState.facet(vn)?e.newSelection:e.newSelection.asSingle();new te(t,e.newDoc,o,s,(r,d)=>d.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:H.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),s=[i.range],o=Nt(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),h=this.changes(d.changes),c=h.map(l);for(let u=0;u<r;u++)s[u]=s[u].map(c);let f=l.mapDesc(h,!0);s.push(d.range.map(f)),l=l.compose(c),o=he.mapEffects(o,c).concat(he.mapEffects(Nt(d.effects),f))}return{changes:l,selection:H.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(te.lineSeparator))}toText(e){return X.of(e.split(this.facet(te.lineSeparator)||mn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Qt(this,t),Oi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof pt&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],r=e[s];l.push(o.init(d=>o.spec.fromJSON(r,d)))}}return te.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Bi.resolve(e.extensions||[],new Map),i=e.doc instanceof X?e.doc:X.of((e.doc||"").split(t.staticFacet(te.lineSeparator)||mn)),l=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return is(l,i.length),t.staticFacet(vn)||(l=l.asSingle()),new te(t,i,l,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(te.tabSize)}get lineBreak(){return this.facet(te.lineSeparator)||`
|
|
5
|
+
`}get readOnly(){return this.facet(hs)}phrase(e,...t){for(let i of this.facet(te.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let s=+(l||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let s of this.facet(os))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&l.push(o[e]);return l}charCategorizer(e){return Jd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,r=e-i;for(;o>0;){let d=Ke(t,o,!1);if(s(t.slice(d,o))!=Ge.Word)break;o=d}for(;r<l;){let d=Ke(t,r);if(s(t.slice(r,d))!=Ge.Word)break;r=d}return o==r?null:H.range(o+i,r+i)}}te.allowMultipleSelections=vn,te.tabSize=Q.define({combine:a=>a.length?a[0]:4}),te.lineSeparator=as,te.readOnly=hs,te.phrases=Q.define({compare(a,e){let t=Object.keys(a),i=Object.keys(e);return t.length==i.length&&t.every(l=>a[l]==e[l])}}),te.languageData=os,te.changeFilter=rs,te.transactionFilter=ds,te.transactionExtender=cs,Ni.reconfigure=he.define();class Bt{eq(e){return this==e}range(e,t=e){return Gt.create(e,t,this)}}Bt.prototype.startSide=Bt.prototype.endSide=0,Bt.prototype.point=!1,Bt.prototype.mapMode=Be.TrackDel;class Gt{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Gt(e,t,i)}}function Nn(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class Bn{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let s=i?this.to:this.from;for(let o=l,r=s.length;;){if(o==r)return o;let d=o+r>>1,h=s[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==o)return h>=0?o:r;h>=0?r=d:o=d+1}}between(e,t,i,l){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(l(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],l=[],s=[],o=-1,r=-1;for(let d=0;d<this.value.length;d++){let h=this.value[d],c=this.from[d]+e,f=this.to[d]+e,u,m;if(c==f){let b=t.mapPos(c,h.startSide,h.mapMode);if(b==null||(u=m=b,h.startSide!=h.endSide&&(m=t.mapPos(c,h.endSide),m<u)))continue}else if(u=t.mapPos(c,h.startSide),m=t.mapPos(f,h.endSide),u>m||u==m&&h.startSide>0&&h.endSide<=0)continue;(m-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(r=Math.max(r,m-u)),i.push(h),l.push(u-o),s.push(m-o))}return{mapped:i.length?new Bn(l,s,i,r):null,pos:o}}}class se{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new se(e,t,i,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:l=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Nn)),this.isEmpty)return t.length?se.of(t):this;let r=new ms(this,null,-1).goto(0),d=0,h=[],c=new Vi;for(;r.value||d<t.length;)if(d<t.length&&(r.from-t[d].from||r.startSide-t[d].value.startSide)>=0){let f=t[d++];c.addInner(f.from,f.to,f.value)||h.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!o||l>this.chunkEnd(r.chunkIndex)||s<this.chunkPos[r.chunkIndex])&&c.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!o||l>r.to||s<r.from||o(r.from,r.to,r.value))&&(c.addInner(r.from,r.to,r.value)||h.push(Gt.create(r.from,r.to,r.value))),r.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?se.empty:this.nextLayer.update({add:h,filter:o,filterFrom:l,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let o=0;o<this.chunk.length;o++){let r=this.chunkPos[o],d=this.chunk[o],h=e.touchesRange(r,r+d.length);if(h===!1)l=Math.max(l,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(h===!0){let{mapped:c,pos:f}=d.map(r,e);c&&(l=Math.max(l,c.maxPoint),t.push(c),i.push(f))}}let s=this.nextLayer.map(e);return t.length==0?s:new se(i,t,s||se.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let s=this.chunkPos[l],o=this.chunk[l];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Yt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Yt.from(e).goto(t)}static compare(e,t,i,l,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),r=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),d=ps(o,r,i),h=new Xt(o,d,s),c=new Xt(r,d,s);i.iterGaps((f,u,m)=>gs(h,f,c,u,m,l)),i.empty&&i.length==0&&gs(h,0,c,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let s=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let r=ps(s,o),d=new Xt(s,r,0).goto(i),h=new Xt(o,r,0).goto(i);for(;;){if(d.to!=h.to||!Vn(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>l)return!0;d.next(),h.next()}}static spans(e,t,i,l,s=-1){let o=new Xt(e,null,s).goto(t),r=t,d=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFrom<t?c.length+1:o.point.startSide<0?c.length:Math.min(c.length,d);l.point(r,h,o.point,c,f,o.pointRank),d=Math.min(o.openEnd(h),c.length)}else h>r&&(l.span(r,h,o.active,d),d=o.openEnd(h));if(o.to>i)return d+(o.point&&o.to>i?1:0);r=o.to,o.next()}}static of(e,t=!1){let i=new Vi;for(let l of e instanceof Gt?[e]:t?Zd(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return se.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=se.empty;l=l.nextLayer)t=new se(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}se.empty=new se([],[],null,-1);function Zd(a){if(a.length>1)for(let e=a[0],t=1;t<a.length;t++){let i=a[t];if(Nn(e,i)>0)return a.slice().sort(Nn);e=i}return a}se.empty.nextLayer=se.empty;class Vi{finishChunk(e){this.chunks.push(new Bn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Vi)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(se.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=se.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function ps(a,e,t){let i=new Map;for(let s of a)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&i.set(s.chunk[o],s.chunkPos[o]);let l=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let r=i.get(s.chunk[o]);r!=null&&(t?t.mapPos(r):r)==s.chunkPos[o]&&!t?.touchesRange(r,r+s.chunk[o].length)&&l.add(s.chunk[o])}return l}class ms{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Yt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&l.push(new ms(o,t,i,s));return l.length==1?l[0]:new Yt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),On(this.heap,0)}}}function On(a,e){for(let t=a[e];;){let i=(e<<1)+1;if(i>=a.length)break;let l=a[i];if(i+1<a.length&&l.compare(a[i+1])>=0&&(l=a[i+1],i++),t.compare(l)<0)break;a[i]=t,a[e]=l,e=i}}class Xt{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Yt.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){_i(this.active,e),_i(this.activeTo,e),_i(this.activeRank,e),this.minActive=ks(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Mi(this.active,t,i),Mi(this.activeTo,t,l),Mi(this.activeRank,t,s),e&&Mi(e,t,this.cursor.from),this.minActive=ks(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&_i(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function gs(a,e,t,i,l,s){a.goto(e),t.goto(i);let o=i+l,r=i,d=i-e;for(;;){let h=a.to+d-t.to||a.endSide-t.endSide,c=h<0?a.to+d:t.to,f=Math.min(c,o);if(a.point||t.point?a.point&&t.point&&(a.point==t.point||a.point.eq(t.point))&&Vn(a.activeForPoint(a.to),t.activeForPoint(t.to))||s.comparePoint(r,f,a.point,t.point):f>r&&!Vn(a.active,t.active)&&s.compareRange(r,f,a.active,t.active),c>o)break;r=c,h<=0&&a.next(),h>=0&&t.next()}}function Vn(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++)if(a[t]!=e[t]&&!a[t].eq(e[t]))return!1;return!0}function _i(a,e){for(let t=e,i=a.length-1;t<i;t++)a[t]=a[t+1];a.pop()}function Mi(a,e,t){for(let i=a.length-1;i>=e;i--)a[i+1]=a[i];a[e]=t}function ks(a,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||a[l].endSide-a[t].endSide)<0&&(t=l,i=e[l]);return t}function ec(a,e,t,i){for(let l=0,s=0;;){if(s>=e)return l;if(l==a.length)break;s+=a.charCodeAt(l)==9?t-s%t:1,l=Ke(a,l)}return i===!0?-1:a.length}const _n="ͼ",bs=typeof Symbol>"u"?"__"+_n:Symbol.for(_n),Mn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ys=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class lt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,r,d,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return d.push(o[0]+";");for(let m in r){let b=r[m];if(/&/.test(m))s(m.split(/,\s*/).map(g=>o.map(v=>g.replace(/&/,v))).reduce((g,v)=>g.concat(v)),b,d);else if(b&&typeof b=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(l(m),b,c,u)}else b!=null&&c.push(m.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+b+";")}(c.length||u)&&d.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(l(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
6
6
|
`)}static newName(){let e=ys[bs]||1;return ys[bs]=e+1,_n+e.toString(36)}static mount(e,t,i){let l=e[Mn],s=i&&i.nonce;l?s&&l.setNonce(s):l=new tc(e,s),l.mount(Array.isArray(t)?t:[t],e)}}let ws=new Map;class tc{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let s=ws.get(i);if(s)return e[Mn]=s;this.sheet=new l.CSSStyleSheet,ws.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Mn]=this}mount(e,t){let i=this.sheet,l=0,s=0;for(let o=0;o<e.length;o++){let r=e[o],d=this.modules.indexOf(r);if(d<s&&d>-1&&(this.modules.splice(d,1),s--,d=-1),d==-1){if(this.modules.splice(s++,0,r),i)for(let h=0;h<r.rules.length;h++)i.insertRule(r.rules[h],l++)}else{for(;s<d;)l+=this.modules[s++].rules.length;l+=r.rules.length,s++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let d=0;d<this.modules.length;d++)o+=this.modules[d].getRules()+`
|
|
7
|
-
`;this.styleTag.textContent=o;let r=t.head||t;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Ot={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Tn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pe=0;pe<10;pe++)Ot[48+pe]=Ot[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Ot[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Ot[pe]=String.fromCharCode(pe+32),Tn[pe]=String.fromCharCode(pe);for(var An in Ot)Tn.hasOwnProperty(An)||(Tn[An]=Ot[An]);function Jt(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function En(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function ic(a){let e=a.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ti(a,e){if(!e.anchorNode)return!1;try{return En(a,e.anchorNode)}catch{return!1}}function Zt(a){return a.nodeType==3?kt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function ei(a,e,t,i){return t?xs(a,e,t,i,-1)||xs(a,e,t,i,1):!1}function gt(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function Ai(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function xs(a,e,t,i,l){for(;;){if(a==t&&e==i)return!0;if(e==(l<0?0:Ye(a))){if(a.nodeName=="DIV")return!1;let s=a.parentNode;if(!s||s.nodeType!=1)return!1;e=gt(a)+(l<0?0:1),a=s}else if(a.nodeType==1){if(a=a.childNodes[e+(l<0?-1:0)],a.nodeType==1&&a.contentEditable=="false")return!1;e=l<0?Ye(a):0}else return!1}}function Ye(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Ei(a,e){let t=e?a.left:a.right;return{left:t,right:t,top:a.top,bottom:a.bottom}}function nc(a){let e=a.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:a.innerWidth,top:0,bottom:a.innerHeight}}function vs(a,e){let t=e.width/a.offsetWidth,i=e.height/a.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-a.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-a.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function lc(a,e,t,i,l,s,o,r){let d=a.ownerDocument,h=d.defaultView||window;for(let c=a,f=!1;c&&!f;)if(c.nodeType==1){let u,p=c==d.body,b=1,g=1;if(p)u=nc(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let w=c.getBoundingClientRect();({scaleX:b,scaleY:g}=vs(c,w)),u={left:w.left,right:w.left+c.clientWidth*b,top:w.top,bottom:w.top+c.clientHeight*g}}let v=0,x=0;if(l=="nearest")e.top<u.top?(x=-(u.top-e.top+o),t>0&&e.bottom>u.bottom+x&&(x=e.bottom-u.bottom+x+o)):e.bottom>u.bottom&&(x=e.bottom-u.bottom+o,t<0&&e.top-x<u.top&&(x=-(u.top+x-e.top+o)));else{let w=e.bottom-e.top,O=u.bottom-u.top;x=(l=="center"&&w<=O?e.top+w/2-O/2:l=="start"||l=="center"&&t<0?e.top-o:e.bottom-O+o)-u.top}if(i=="nearest"?e.left<u.left?(v=-(u.left-e.left+s),t>0&&e.right>u.right+v&&(v=e.right-u.right+v+s)):e.right>u.right&&(v=e.right-u.right+s,t<0&&e.left<u.left+v&&(v=-(u.left+v-e.left+s))):v=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-s:e.right-(u.right-u.left)+s)-u.left,v||x)if(p)h.scrollBy(v,x);else{let w=0,O=0;if(x){let k=c.scrollTop;c.scrollTop+=x/g,O=(c.scrollTop-k)*g}if(v){let k=c.scrollLeft;c.scrollLeft+=v/b,w=(c.scrollLeft-k)*b}e={left:e.left-w,top:e.top-O,right:e.right-w,bottom:e.bottom-O},w&&Math.abs(w-v)<1&&(i="nearest"),O&&Math.abs(O-x)<1&&(l="nearest")}if(p)break;c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function sc(a){let e=a.ownerDocument,t,i;for(let l=a.parentNode;l&&!(l==e.body||t&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=l),!t&&l.scrollWidth>l.clientWidth&&(t=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:t,y:i}}class oc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Ye(t):0),i,Math.min(e.focusOffset,i?Ye(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let Vt=null;function Cs(a){if(a.setActive)return a.setActive();if(Vt)return a.focus(Vt);let e=[];for(let t=a;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(a.focus(Vt==null?{get preventScroll(){return Vt={preventScroll:!0},!0}}:void 0),!Vt){Vt=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],s=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=s&&(i.scrollLeft=s)}}}let Ss;function kt(a,e,t=e){let i=Ss||(Ss=document.createRange());return i.setEnd(a,t),i.setStart(a,e),i}function _t(a,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let s=new KeyboardEvent("keydown",l);s.synthetic=!0,a.dispatchEvent(s);let o=new KeyboardEvent("keyup",l);return o.synthetic=!0,a.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function ac(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Ns(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function rc(a,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Ye(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Ye(t))}else{if(t==a)return!0;i=gt(t),t=t.parentNode}}function Bs(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function Os(a,e){for(let t=a,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Ye(t)}else if(t.parentNode&&!Ai(t))i=gt(t),t=t.parentNode;else return null}}function Vs(a,e){for(let t=a,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!Ai(t))i=gt(t)+1,t=t.parentNode;else return null}}class ye{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ye(e.parentNode,gt(e),t)}static after(e,t){return new ye(e.parentNode,gt(e)+1,t)}}const In=[];class ne{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,l=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=l?l.nextSibling:i.firstChild)){let r=ne.get(s);(!r||!r.parent&&r.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=l?l.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&s!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;s&&s!=o.dom;)s=_s(s);else i.insertBefore(o.dom,s);l=o.dom}for(s=l?l.nextSibling:i.firstChild,s&&t&&t.node==i&&(t.written=!0);s;)s=_s(s)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let l=Ye(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;l==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?l=-1:l=1),e=s}l<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!ne.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,s=0;;l++){let o=this.children[l];if(o.dom==i)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,i=0){let l=-1,s=-1,o=-1,r=-1;for(let d=0,h=i,c=i;d<this.children.length;d++){let f=this.children[d],u=h+f.length;if(h<e&&u>t)return f.domBoundsAround(e,t,h);if(u>=e&&l==-1&&(l=d,s=h),h>t&&f.dom.parentNode==this.dom){o=d,r=c;break}c=u,h=u+f.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=In){this.markDirty();for(let l=e;l<t;l++){let s=this.children[l];s.parent==this&&i.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...i);for(let l=0;l<i.length;l++)i[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ms(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,i,l,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}ne.prototype.breakAfter=0;function _s(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Ms{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Ts(a,e,t,i,l,s,o,r,d){let{children:h}=a,c=h.length?h[e]:null,f=s.length?s[s.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&s.length<2&&c.merge(t,l,s.length?f:null,t==0,r,d))){if(i<h.length){let p=h[i];p&&(l<p.length||p.breakAfter&&f?.breakAfter)?(e==i&&(p=p.split(l),l=0),!u&&f&&p.merge(0,l,f,!0,0,d)?s[s.length-1]=p:((l||p.children.length&&!p.children[0].length)&&p.merge(0,l,null,!1,0,d),s.push(p))):p?.breakAfter&&(f?f.breakAfter=1:o=1),i++}for(c&&(c.breakAfter=o,t>0&&(!o&&s.length&&c.merge(t,c.length,s[0],!1,r,0)?c.breakAfter=s.shift().breakAfter:(t<c.length||c.children.length&&c.children[c.children.length-1].length==0)&&c.merge(t,c.length,null,!1,r,0),e++));e<i&&s.length;)if(h[i-1].become(s[s.length-1]))i--,s.pop(),d=s.length?0:r;else if(h[e].become(s[0]))e++,s.shift(),r=s.length?0:d;else break;!s.length&&e&&i<h.length&&!h[e-1].breakAfter&&h[i].merge(0,0,h[e-1],!1,r,d)&&e--,(e<i||s.length)&&a.replaceChildren(e,i,s)}}function As(a,e,t,i,l,s){let o=a.childCursor(),{i:r,off:d}=o.findPos(t,1),{i:h,off:c}=o.findPos(e,-1),f=e-t;for(let u of i)f+=u.length;a.length+=f,Ts(a,h,c,r,d,i,0,l,s)}let Se=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Dn=typeof document<"u"?document:{documentElement:{style:{}}};const Pn=/Edge\/(\d+)/.exec(Se.userAgent),Es=/MSIE \d/.test(Se.userAgent),Fn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Se.userAgent),Ii=!!(Es||Fn||Pn),Is=!Ii&&/gecko\/(\d+)/i.test(Se.userAgent),$n=!Ii&&/Chrome\/(\d+)/.exec(Se.userAgent),Ds="webkitFontSmoothing"in Dn.documentElement.style,Ps=!Ii&&/Apple Computer/.test(Se.vendor),Fs=Ps&&(/Mobile\/\w+/.test(Se.userAgent)||Se.maxTouchPoints>2);var W={mac:Fs||/Mac/.test(Se.platform),windows:/Win/.test(Se.platform),linux:/Linux|X11/.test(Se.platform),ie:Ii,ie_version:Es?Dn.documentMode||6:Fn?+Fn[1]:Pn?+Pn[1]:0,gecko:Is,gecko_version:Is?+(/Firefox\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,chrome:!!$n,chrome_version:$n?+$n[1]:0,ios:Fs,android:/Android\b/.test(Se.userAgent),webkit:Ds,safari:Ps,webkit_version:Ds?+(/\bAppleWebKit\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,tabSize:Dn.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const dc=256;class Ee extends ne{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof Ee)||this.length-(t-e)+i.length>dc||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ee(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return cc(this.dom,e,t)}}class Xe extends ne{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let l of t)l.setParent(this)}setAttrs(e){if(Ns(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,l,s,o){return i&&(!(i instanceof Xe&&i.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(As(this,e,t,i?i.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],i=0,l=-1,s=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=s),i=d,s++}let o=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new Xe(this.mark,t,o)}domAtPos(e){return $s(this,e)}coordsAt(e,t){return Ls(this,e,t)}}function cc(a,e,t){let i=a.nodeValue.length;e>i&&(e=i);let l=e,s=e,o=0;e==0&&t<0||e==i&&t>=0?W.chrome||W.gecko||(e?(l--,o=1):s<i&&(s++,o=-1)):t<0?l--:s<i&&s++;let r=kt(a,l,s).getClientRects();if(!r.length)return null;let d=r[(o?o<0:t>=0)?0:r.length-1];return W.safari&&!o&&d.width==0&&(d=Array.prototype.find.call(r,h=>h.width)||d),o?Ei(d,o<0):d||null}class bt extends ne{static create(e,t,i){return new bt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=bt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,l,s,o){return i&&(!(i instanceof bt)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e instanceof bt&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return X.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):X.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let l=this.dom.getClientRects(),s=null;if(!l.length)return null;let o=this.side?this.side<0:e>0;for(let r=o?l.length-1:0;s=l[r],!(e>0?r==0:r==l.length-1||s.top<s.bottom);r+=o?-1:1);return Ei(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Mt extends ne{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Mt&&e.side==this.side}split(){return new Mt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return X.empty}get isHidden(){return!0}}Ee.prototype.children=bt.prototype.children=Mt.prototype.children=In;function $s(a,e){let t=a.dom,{children:i}=a,l=0;for(let s=0;l<i.length;l++){let o=i[l],r=s+o.length;if(!(r==s&&o.getSide()<=0)){if(e>s&&e<r&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=r}}for(let s=l;s>0;s--){let o=i[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=l;s<i.length;s++){let o=i[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new ye(t,0)}function Rs(a,e,t){let i,{children:l}=a;t>0&&e instanceof Xe&&l.length&&(i=l[l.length-1])instanceof Xe&&i.mark.eq(e.mark)?Rs(i,e.children[0],t-1):(l.push(e),e.setParent(a)),a.length+=e.length}function Ls(a,e,t){let i=null,l=-1,s=null,o=-1;function r(h,c){for(let f=0,u=0;f<h.children.length&&u<=c;f++){let p=h.children[f],b=u+p.length;b>=c&&(p.children.length?r(p,c-u):(!s||s.isHidden&&t>0)&&(b>c||u==b&&p.getSide()>0)?(s=p,o=c-u):(u<c||u==b&&p.getSide()<0&&!p.isHidden)&&(i=p,l=c-u)),u=b}}r(a,e);let d=(t<0?i:s)||i||s;return d?d.coordsAt(Math.max(0,d==i?l:o),t):hc(a)}function hc(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let t=Zt(e);return t[t.length-1]||null}function Rn(a,e){for(let t in a)t=="class"&&e.class?e.class+=" "+a.class:t=="style"&&e.style?e.style+=";"+a.style:e[t]=a[t];return e}const js=Object.create(null);function Di(a,e,t){if(a==e)return!0;a||(a=js),e||(e=js);let i=Object.keys(a),l=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(l.indexOf(s)==-1||a[s]!==e[s]))return!1;return!0}function Ln(a,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?a.style.cssText=t[l]:a.setAttribute(l,t[l]));return i}function fc(a){let e=Object.create(null);for(let t=0;t<a.attributes.length;t++){let i=a.attributes[t];e[i.name]=i.value}return e}class jn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Le=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Le||(Le={}));class we extends Bt{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new ti(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new st(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:s,end:o}=zs(e,t);i=(s?t?-3e8:-1:5e8)-1,l=(o?t?2e8:1:-6e8)+1}return new st(e,i,l,t,e.widget||null,!0)}static line(e){return new ii(e)}static set(e,t=!1){return se.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=se.empty;class ti extends we{constructor(e){let{start:t,end:i}=zs(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof ti&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Di(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ti.prototype.point=!1;class ii extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ii&&this.spec.class==e.spec.class&&Di(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}ii.prototype.mapMode=Be.TrackBefore,ii.prototype.point=!0;class st extends we{constructor(e,t,i,l,s,o){super(t,i,s,e),this.block=l,this.isReplace=o,this.mapMode=l?t<=0?Be.TrackBefore:Be.TrackAfter:Be.TrackDel}get type(){return this.startSide!=this.endSide?Le.WidgetRange:this.startSide<=0?Le.WidgetBefore:Le.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof st&&uc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}st.prototype.point=!0;function zs(a,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=a;return t==null&&(t=a.inclusive),i==null&&(i=a.inclusive),{start:t??e,end:i??e}}function uc(a,e){return a==e||!!(a&&e&&a.compare(e))}function zn(a,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=a?t[l]=Math.max(t[l],e):t.push(a,e)}class ce extends ne{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,l,s,o){if(i){if(!(i instanceof ce))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),As(this,e,t,i?i.children.slice():[],s,o),!0}split(e){let t=new ce;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:l}=this.childPos(e);l&&(t.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let s=i;s<this.children.length;s++)t.append(this.children[s],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Di(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Rs(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Rn(t,this.attrs||{})),i&&(this.attrs=Rn({class:i},this.attrs||{}))}domAtPos(e){return $s(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Ns(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Ln(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let l=this.dom.lastChild;for(;l&&ne.get(l)instanceof Xe;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=ne.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!W.ios||!this.children.some(s=>s instanceof Ee))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ee)||/[^ -~]/.test(i.text))return null;let l=Zt(i.dom);if(l.length!=1)return null;e+=l[0].width,t=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Ls(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-l.lineHeight)<2&&l.textHeight<s){let o=(s-l.textHeight)/2;return{top:i.top+o,bottom:i.bottom-o,left:i.left,right:i.left}}}return i}become(e){return e instanceof ce&&this.children.length==0&&e.children.length==0&&Di(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,l=0;i<e.children.length;i++){let s=e.children[i],o=l+s.length;if(o>=t){if(s instanceof ce)return s;if(o>t)break}l=o+s.breakAfter}return null}}class Je extends ne{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,l,s,o){return i&&(!(i instanceof Je)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?ye.before(this.dom):ye.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let i=new Je(this.widget,t,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return In}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):X.empty}domBoundsAround(){return null}become(e){return e instanceof Je&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);return i||(this.widget instanceof qn?null:Ei(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:i}=this.deco;return t==i?!1:e<0?t<0:i>0}}class qn extends jn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class ni{constructor(e,t,i,l){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Je&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ce),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Pi(new Mt(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Je)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Pi(new Ee(this.text.slice(this.textOff,this.textOff+l)),t),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,t,i,l){this.buildText(t-e,i,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,i,l,s,o){if(this.disallowBlockEffectsFor[o]&&i instanceof st){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=t-e;if(i instanceof st)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Je(i.widget||Tt.block,r,i));else{let d=bt.create(i.widget||Tt.inline,r,r?0:i.startSide),h=this.atCursorPos&&!d.isEditable&&s<=l.length&&(e<t||i.startSide>0),c=!d.isEditable&&(e<t||s>l.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),h&&(f.append(Pi(new Mt(1),l),s),s=l.length+Math.max(0,s-l.length)),f.append(Pi(d,l),s),this.atCursorPos=c,this.pendingBuffer=c?e<t||s>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,i,l,s){let o=new ni(e,t,i,s);return o.openEnd=se.spans(l,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Pi(a,e){for(let t of e)a=new Xe(t,[a],a.length);return a}class Tt extends jn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Tt.inline=new Tt("span"),Tt.block=new Tt("div");var me=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(me||(me={}));const yt=me.LTR,Un=me.RTL;function qs(a){let e=[];for(let t=0;t<a.length;t++)e.push(1<<+a[t]);return e}const pc=qs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),mc=qs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Wn=Object.create(null),je=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),t=a.charCodeAt(1);Wn[e]=t,Wn[t]=-e}function Us(a){return a<=247?pc[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?mc[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const gc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ot{get dir(){return this.level%2?Un:yt}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,l){let s=-1;for(let o=0;o<e.length;o++){let r=e[o];if(r.from<=t&&r.to>=t){if(r.level==i)return o;(s<0||(l!=0?l<0?r.from<t:r.to>t:e[s].level>r.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Ws(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++){let i=a[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!Ws(i.inner,l.inner))return!1}return!0}const le=[];function kc(a,e,t,i,l){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:e,r=s<i.length?i[s].from:t,d=s?256:l;for(let h=o,c=d,f=d;h<r;h++){let u=Us(a.charCodeAt(h));u==512?u=c:u==8&&f==4&&(u=16),le[h]=u==4?2:u,u&7&&(f=u),c=u}for(let h=o,c=d,f=d;h<r;h++){let u=le[h];if(u==128)h<r-1&&c==le[h+1]&&c&24?u=le[h]=c:le[h]=256;else if(u==64){let p=h+1;for(;p<r&&le[p]==64;)p++;let b=h&&c==8||p<t&&le[p]==8?f==1?1:8:256;for(let g=h;g<p;g++)le[g]=b;h=p-1}else u==8&&f==1&&(le[h]=1);c=u,u&7&&(f=u)}}}function bc(a,e,t,i,l){let s=l==1?2:1;for(let o=0,r=0,d=0;o<=i.length;o++){let h=o?i[o-1].to:e,c=o<i.length?i[o].from:t;for(let f=h,u,p,b;f<c;f++)if(p=Wn[u=a.charCodeAt(f)])if(p<0){for(let g=r-3;g>=0;g-=3)if(je[g+1]==-p){let v=je[g+2],x=v&2?l:v&4?v&1?s:l:0;x&&(le[f]=le[je[g]]=x),r=g;break}}else{if(je.length==189)break;je[r++]=f,je[r++]=u,je[r++]=d}else if((b=le[f])==2||b==1){let g=b==l;d=g?0:1;for(let v=r-3;v>=0;v-=3){let x=je[v+2];if(x&2)break;if(g)je[v+2]|=2;else{if(x&4)break;je[v+2]|=4}}}}}function yc(a,e,t,i){for(let l=0,s=i;l<=t.length;l++){let o=l?t[l-1].to:a,r=l<t.length?t[l].from:e;for(let d=o;d<r;){let h=le[d];if(h==256){let c=d+1;for(;;)if(c==r){if(l==t.length)break;c=t[l++].to,r=l<t.length?t[l].from:e}else if(le[c]==256)c++;else break;let f=s==1,u=(c<e?le[c]:i)==1,p=f==u?f?1:2:i;for(let b=c,g=l,v=g?t[g-1].to:a;b>d;)b==v&&(b=t[--g].from,v=g?t[g-1].to:a),le[--b]=p;d=c}else s=h,d++}}}function Hn(a,e,t,i,l,s,o){let r=i%2?2:1;if(i%2==l%2)for(let d=e,h=0;d<t;){let c=!0,f=!1;if(h==s.length||d<s[h].from){let g=le[d];g!=r&&(c=!1,f=g==16)}let u=!c&&r==1?[]:null,p=c?i:i+1,b=d;e:for(;;)if(h<s.length&&b==s[h].from){if(f)break e;let g=s[h];if(!c)for(let v=g.to,x=h+1;;){if(v==t)break e;if(x<s.length&&s[x].from==v)v=s[x++].to;else{if(le[v]==r)break e;break}}if(h++,u)u.push(g);else{g.from>d&&o.push(new ot(d,g.from,p));let v=g.direction==yt!=!(p%2);Kn(a,v?i+1:i,l,g.inner,g.from,g.to,o),d=g.to}b=g.to}else{if(b==t||(c?le[b]!=r:le[b]==r))break;b++}u?Hn(a,d,b,i+1,l,u,o):d<b&&o.push(new ot(d,b,p)),d=b}else for(let d=t,h=s.length;d>e;){let c=!0,f=!1;if(!h||d>s[h-1].to){let g=le[d-1];g!=r&&(c=!1,f=g==16)}let u=!c&&r==1?[]:null,p=c?i:i+1,b=d;e:for(;;)if(h&&b==s[h-1].to){if(f)break e;let g=s[--h];if(!c)for(let v=g.from,x=h;;){if(v==e)break e;if(x&&s[x-1].to==v)v=s[--x].from;else{if(le[v-1]==r)break e;break}}if(u)u.push(g);else{g.to<d&&o.push(new ot(g.to,d,p));let v=g.direction==yt!=!(p%2);Kn(a,v?i+1:i,l,g.inner,g.from,g.to,o),d=g.from}b=g.from}else{if(b==e||(c?le[b-1]!=r:le[b-1]==r))break;b--}u?Hn(a,b,d,i+1,l,u,o):b<d&&o.push(new ot(b,d,p)),d=b}}function Kn(a,e,t,i,l,s,o){let r=e%2?2:1;kc(a,l,s,i,r),bc(a,l,s,i,r),yc(l,s,i,r),Hn(a,l,s,e,t,i,o)}function wc(a,e,t){if(!a)return[new ot(0,0,e==Un?1:0)];if(e==yt&&!t.length&&!gc.test(a))return Hs(a.length);if(t.length)for(;a.length>le.length;)le[le.length]=256;let i=[],l=e==yt?0:1;return Kn(a,l,l,t,0,a.length,i),i}function Hs(a){return[new ot(0,a,0)]}let Ks="";function xc(a,e,t,i,l){var s;let o=i.head-a.from,r=ot.find(e,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),d=e[r],h=d.side(l,t);if(o==h){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;d=e[r=u],o=d.side(!l,t),h=d.side(l,t)}let c=Ke(a.text,o,d.forward(l,t));(c<d.from||c>d.to)&&(c=h),Ks=a.text.slice(Math.min(o,c),Math.max(o,c));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&c==h&&f.level+(l?0:1)<d.level?H.cursor(f.side(!l,t)+a.from,f.forward(l,t)?1:-1,f.level):H.cursor(c+a.from,d.forward(l,t)?-1:1,d.level)}function vc(a,e,t){for(let i=e;i<t;i++){let l=Us(a.charCodeAt(i));if(l==1)return yt;if(l==2||l==4)return Un}return yt}const Qs=Q.define(),Gs=Q.define(),Ys=Q.define(),Xs=Q.define(),Qn=Q.define(),Js=Q.define(),Zs=Q.define(),Gn=Q.define(),Yn=Q.define(),eo=Q.define({combine:a=>a.some(e=>e)}),Cc=Q.define({combine:a=>a.some(e=>e)}),to=Q.define();class At{constructor(e,t="nearest",i="nearest",l=5,s=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new At(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new At(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Fi=he.define({map:(a,e)=>a.map(e)}),io=he.define();function ze(a,e,t){let i=a.facet(Xs);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const at=Q.define({combine:a=>a.length?a[0]:!0});let Sc=0;const li=Q.define();class Et{constructor(e,t,i,l,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:s,decorations:o}=t||{};return new Et(Sc++,e,i,l,r=>{let d=[li.of(r)];return o&&d.push(si.of(h=>{let c=h.plugin(r);return c?o(c):we.none})),s&&d.push(s(r)),d})}static fromClass(e,t){return Et.define(i=>new e(i),t)}}class Xn{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(ze(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){ze(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){ze(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const no=Q.define(),Jn=Q.define(),si=Q.define(),lo=Q.define(),Zn=Q.define(),so=Q.define();function oo(a,e){let t=a.state.facet(so);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(a):s),l=[];return se.spans(i,e.from,e.to,{point(){},span(s,o,r,d){let h=s-e.from,c=o-e.from,f=l;for(let u=r.length-1;u>=0;u--,d--){let p=r[u].spec.bidiIsolate,b;if(p==null&&(p=vc(e.text,h,c)),d>0&&f.length&&(b=f[f.length-1]).to==h&&b.direction==p)b.to=c,f=b.inner;else{let g={from:h,to:c,direction:p,inner:[]};f.push(g),f=g.inner}}}}),l}const ao=Q.define();function ro(a){let e=0,t=0,i=0,l=0;for(let s of a.state.facet(ao)){let o=s(a);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(l=Math.max(l,o.bottom)))}return{left:e,right:t,top:i,bottom:l}}const oi=Q.define();class Me{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}join(e){return new Me(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,s=0,o=0,r=0;;l++){let d=l==e.length?null:e[l],h=o-r,c=d?d.fromB:1e9;for(;s<t.length&&t[s]<c;){let f=t[s],u=t[s+1],p=Math.max(r,f),b=Math.min(c,u);if(p<=b&&new Me(p+h,b+h,p,b).addToSet(i),u>c)break;s+=2}if(!d)return i;new Me(d.fromA,d.toA,d.fromB,d.toB).addToSet(i),o=d.toA,r=d.toB}}}class $i{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ue.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let l=[];this.changes.iterChangedRanges((s,o,r,d)=>l.push(new Me(s,o,r,d))),this.changedRanges=l}static create(e,t,i){return new $i(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class co extends ne{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=we.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ce],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Me(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>c<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!Tc(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let s=l>-1?Bc(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Me(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(W.ie||W.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,r=this.updateDeco(),d=_c(o,r,e.changes);return i=Me.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=W.chrome||W.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||l.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Je&&o.widget instanceof qn&&s.push(o.dom);l.updateGaps(s)}updateChildren(e,t,i){let l=i?i.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=l.length-1;;o--){let r=o>=0?l[o]:null;if(!r)break;let{fromA:d,toA:h,fromB:c,toB:f}=r,u,p,b,g;if(i&&i.range.fromB<f&&i.range.toB>c){let k=ni.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),m=ni.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);p=k.breakAtStart,b=k.openStart,g=m.openEnd;let N=this.compositionView(i);m.breakAtStart?N.breakAfter=1:m.content.length&&N.merge(N.length,N.length,m.content[0],!1,m.openStart,0)&&(N.breakAfter=m.content[0].breakAfter,m.content.shift()),k.content.length&&N.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),u=k.content.concat(N).concat(m.content)}else({content:u,breakAtStart:p,openStart:b,openEnd:g}=ni.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:v,off:x}=s.findPos(h,1),{i:w,off:O}=s.findPos(d,-1);Ts(this,w,O,v,x,u,p,b,g)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(io)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ee(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new Xe(l,[t],t.length);let i=new ce;return i.append(t,0),i}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(o);let r=ne.get(s);r&&r!=o&&(r.dom=null),o.setDOM(s)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];t(e.line,l);for(let s=e.marks.length-1;s>=-1;s--)i=l.childPos(i.off,1),l=l.children[i.i],t(s>=0?e.marks[s].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,s=!l&&Ti(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&Nc(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=h=new ye(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!ei(d.node,d.offset,c.anchorNode,c.anchorOffset)||!ei(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(c.focusNode)&&Mc(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Jt(this.view.root);if(f)if(r.empty){if(W.gecko){let u=Oc(d.node,d.offset);if(u&&u!=3){let p=(u==1?Os:Vs)(d.node,d.offset);p&&(d=new ye(p.node,p.offset))}}f.collapse(d.node,d.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(d.node,d.offset);try{f.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([d,h]=[h,d]),u.setEnd(h.node,h.offset),u.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ye(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ye(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ei(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Jt(e.root),{anchorNode:l,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=ce.find(this,t.head);if(!o)return;let r=o.posAtStart;if(t.head==r||t.head==r+o.length)return;let d=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!d||!h||d.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(l,s)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let l=e.offset;!i&&l<t.childNodes.length;l++){let s=ne.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let s=ne.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(s.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=ne.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(i<l.length||l instanceof ce)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,l=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let r=this.children[o],d=s-r.breakAfter,h=d-r.length;if(d<e)break;if(h<=e&&(h<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof ce&&!(i instanceof ce&&t>=0)))i=r,l=h;else if(i&&h==e&&d==e&&r instanceof Je&&Math.abs(t)<2){if(r.deco.startSide<0)break;o&&(i=null)}s=h}return i?i.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),l=this.children[t];if(!(l instanceof ce))return null;for(;l.children.length;){let{i:r,off:d}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=d}if(!(l instanceof Ee))return null;let s=Ke(l.text,i);if(s==i)return null;let o=kt(l.dom,i,s).getClientRects();for(let r=0;r<o.length;r++){let d=o[r];if(r==o.length-1||d.top<d.bottom&&d.left<d.right)return d}return null}measureVisibleLineHeights(e){let t=[],{from:i,to:l}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let h=0,c=0;c<this.children.length;c++){let f=this.children[c],u=h+f.length;if(u>l)break;if(h>=i){let p=f.dom.getBoundingClientRect();if(t.push(p.height),o){let b=f.dom.lastChild,g=b?Zt(b):[];if(g.length){let v=g[g.length-1],x=d?v.right-p.left:p.right-v.left;x>r&&(r=x,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?me.RTL:me.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ce){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Zt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,l=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ms(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let s=l==t.viewports.length?null:t.viewports[l],o=s?s.from-1:this.length;if(o>i){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(we.replace({widget:new qn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return we.set(e)}updateDeco(){let e=1,t=this.view.state.facet(si).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,l=this.view.state.facet(lo).map((s,o)=>{let r=typeof s=="function";return r&&(i=!0),r?s(this.view):s});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(se.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(to))try{if(h(this.view,e.range,e))return!0}catch(c){ze(this.view.state,c,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let s=ro(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;lc(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,d),-d),this.view.textDirection==me.LTR)}}function Nc(a){return a.node.nodeType==1&&a.node.firstChild&&(a.offset==0||a.node.childNodes[a.offset-1].contentEditable=="false")&&(a.offset==a.node.childNodes.length||a.node.childNodes[a.offset].contentEditable=="false")}function ho(a,e){let t=a.observer.selectionRange;if(!t.focusNode)return null;let i=Os(t.focusNode,t.focusOffset),l=Vs(t.focusNode,t.focusOffset),s=i||l;if(l&&i&&l.node!=i.node){let r=ne.get(l.node);if(!r||r instanceof Ee&&r.text!=l.node.nodeValue)s=l;else if(a.docView.lastCompositionAfterCursor){let d=ne.get(i.node);!d||d instanceof Ee&&d.text!=i.node.nodeValue||(s=l)}}if(a.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function Bc(a,e,t){let i=ho(a,t);if(!i)return null;let{node:l,from:s,to:o}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,h=new Me(d.mapPos(s),d.mapPos(o),s,o),c=[];for(let f=l.parentNode;;f=f.parentNode){let u=ne.get(f);if(u instanceof Xe)c.push({node:f,deco:u.mark});else{if(u instanceof ce||f.nodeName=="DIV"&&f.parentNode==a.contentDOM)return{range:h,text:l,marks:c,line:f};if(f!=a.contentDOM)c.push({node:f,deco:new ti({inclusive:!0,attributes:fc(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Oc(a,e){return a.nodeType!=1?0:(e&&a.childNodes[e-1].contentEditable=="false"?1:0)|(e<a.childNodes.length&&a.childNodes[e].contentEditable=="false"?2:0)}let Vc=class{constructor(){this.changes=[]}compareRange(e,t){zn(e,t,this.changes)}comparePoint(e,t){zn(e,t,this.changes)}};function _c(a,e,t){let i=new Vc;return se.compare(a,e,t,i),i.changes}function Mc(a,e){for(let t=a;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Tc(a,e){let t=!1;return e&&a.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}function Ac(a,e,t=1){let i=a.charCategorizer(e),l=a.doc.lineAt(e),s=e-l.from;if(l.length==0)return H.cursor(e);s==0?t=1:s==l.length&&(t=-1);let o=s,r=s;t<0?o=Ke(l.text,s,!1):r=Ke(l.text,s);let d=i(l.text.slice(o,r));for(;o>0;){let h=Ke(l.text,o,!1);if(i(l.text.slice(h,o))!=d)break;o=h}for(;r<l.length;){let h=Ke(l.text,r);if(i(l.text.slice(r,h))!=d)break;r=h}return H.range(o+l.from,r+l.from)}function Ec(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function Ic(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function el(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function fo(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function uo(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function tl(a,e,t){let i,l,s,o,r=!1,d,h,c,f;for(let b=a.firstChild;b;b=b.nextSibling){let g=Zt(b);for(let v=0;v<g.length;v++){let x=g[v];l&&el(l,x)&&(x=fo(uo(x,l.bottom),l.top));let w=Ec(e,x),O=Ic(t,x);if(w==0&&O==0)return b.nodeType==3?po(b,e,t):tl(b,e,t);if(!i||o>O||o==O&&s>w){i=b,l=x,s=w,o=O;let k=O?t<x.top?-1:1:w?e<x.left?-1:1:0;r=!k||(k>0?v<g.length-1:v>0)}w==0?t>x.bottom&&(!c||c.bottom<x.bottom)?(d=b,c=x):t<x.top&&(!f||f.top>x.top)&&(h=b,f=x):c&&el(c,x)?c=uo(c,x.bottom):f&&el(f,x)&&(f=fo(f,x.top))}}if(c&&c.bottom>=t?(i=d,l=c):f&&f.top<=t&&(i=h,l=f),!i)return{node:a,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return po(i,u,t);if(r&&i.contentEditable!="false")return tl(i,u,t);let p=Array.prototype.indexOf.call(a.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:p}}function po(a,e,t){let i=a.nodeValue.length,l=-1,s=1e9,o=0;for(let r=0;r<i;r++){let d=kt(a,r,r+1).getClientRects();for(let h=0;h<d.length;h++){let c=d[h];if(c.top==c.bottom)continue;o||(o=e-c.left);let f=(c.top>t?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f<s){let u=e>=(c.left+c.right)/2,p=u;if((W.chrome||W.gecko)&&kt(a,r).getBoundingClientRect().left==c.right&&(p=!u),f<=0)return{node:a,offset:r+(p?1:0)};l=r+(p?1:0),s=f}}}return{node:a,offset:l>-1?l:o>0?a.nodeValue.length:0}}function mo(a,e,t,i=-1){var l,s;let o=a.contentDOM.getBoundingClientRect(),r=o.top+a.viewState.paddingTop,d,{docHeight:h}=a.viewState,{x:c,y:f}=e,u=f-r;if(u<0)return 0;if(u>h)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,m=!1;d=a.elementAtHeight(u),d.type!=Le.Text;)for(;u=i>0?d.bottom+k:d.top-k,!(u>=0&&u<=h);){if(m)return t?null:0;m=!0,i=-i}f=r+u;let p=d.from;if(p<a.viewport.from)return a.viewport.from==0?0:t?null:go(a,o,d,c,f);if(p>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:t?null:go(a,o,d,c,f);let b=a.dom.ownerDocument,g=a.root.elementFromPoint?a.root:b,v=g.elementFromPoint(c,f);v&&!a.contentDOM.contains(v)&&(v=null),v||(c=Math.max(o.left+1,Math.min(o.right-1,c)),v=g.elementFromPoint(c,f),v&&!a.contentDOM.contains(v)&&(v=null));let x,w=-1;if(v&&((l=a.docView.nearest(v))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let k=b.caretPositionFromPoint(c,f);k&&({offsetNode:x,offset:w}=k)}else if(b.caretRangeFromPoint){let k=b.caretRangeFromPoint(c,f);k&&({startContainer:x,startOffset:w}=k,(!a.contentDOM.contains(x)||W.safari&&Dc(x,w,c)||W.chrome&&Pc(x,w,c))&&(x=void 0))}}if(!x||!a.docView.dom.contains(x)){let k=ce.find(a.docView,p);if(!k)return u>d.top+d.height/2?d.to:d.from;({node:x,offset:w}=tl(k.dom,c,f))}let O=a.docView.nearest(x);if(!O)return null;if(O.isWidget&&((s=O.dom)===null||s===void 0?void 0:s.nodeType)==1){let k=O.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?O.posAtStart:O.posAtEnd}else return O.localPosFromDOM(x,w)+O.posAtStart}function go(a,e,t,i,l){let s=Math.round((i-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&t.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,d=Math.floor((l-t.top-(a.defaultLineHeight-r)*.5)/r);s+=d*a.viewState.heightOracle.lineLength}let o=a.state.sliceDoc(t.from,t.to);return t.from+ec(o,s,a.state.tabSize)}function Dc(a,e,t){let i;if(a.nodeType!=3||e!=(i=a.nodeValue.length))return!1;for(let l=a.nextSibling;l;l=l.nextSibling)if(l.nodeType!=1||l.nodeName!="BR")return!1;return kt(a,i-1,i).getBoundingClientRect().left>t}function Pc(a,e,t){if(e!=0)return!1;for(let l=a;;){let s=l.parentNode;if(!s||s.nodeType!=1||s.firstChild!=l)return!1;if(s.classList.contains("cm-line"))break;l=s}let i=a.nodeType==1?a.getBoundingClientRect():kt(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Fc(a,e){let t=a.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==Le.Text))return i}return t}function $c(a,e,t,i){let l=Fc(a,e.head),s=!i||l.type!=Le.Text||!(a.lineWrapping||l.widgetLineBreaks)?null:a.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(s){let o=a.dom.getBoundingClientRect(),r=a.textDirectionAt(l.from),d=a.posAtCoords({x:t==(r==me.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(d!=null)return H.cursor(d,t?-1:1)}return H.cursor(t?l.to:l.from,t?-1:1)}function ko(a,e,t,i){let l=a.state.doc.lineAt(e.head),s=a.bidiSpans(l),o=a.textDirectionAt(l.from);for(let r=e,d=null;;){let h=xc(l,s,o,r,t),c=Ks;if(!h){if(l.number==(t?a.state.doc.lines:1))return r;c=`
|
|
8
|
-
`,l=a.state.doc.line(l.number+(t?1:-1)),s=a.bidiSpans(l),h=a.visualLineSide(l,!t)}if(d){if(!d(c))return r}else{if(!i)return h;d=i(c)}r=h}}function Rc(a,e,t){let i=a.state.charCategorizer(e),l=i(t);return s=>{let o=i(s);return l==Ge.Space&&(l=o),l==o}}function Lc(a,e,t,i){let l=e.head,s=t?1:-1;if(l==(t?a.state.doc.length:0))return H.cursor(l,e.assoc);let o=e.goalColumn,r,d=a.contentDOM.getBoundingClientRect(),h=a.coordsAtPos(l,e.assoc||-1),c=a.documentTop;if(h)o==null&&(o=h.left-d.left),r=s<0?h.top:h.bottom;else{let
|
|
9
|
-
`&&a.lineWrapping&&(i&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:X.of([" "])}),t)return nl(a,t,i,s);if(i&&!i.main.eq(l)){let o=!1,r="select";return a.inputState.lastSelectionTime>Date.now()-50&&(a.inputState.lastSelectionOrigin=="select"&&(o=!0),r=a.inputState.lastSelectionOrigin),a.dispatch({selection:i,scrollIntoView:o,userEvent:r}),!0}else return!1}function nl(a,e,t,i=-1){if(W.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(W.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&a.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&_t(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&_t(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&_t(a.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let o,r=()=>o||(o=Uc(a,e,t));return a.state.facet(Js).some(d=>d(a,e.from,e.to,s,r))||a.dispatch(r()),!0}function Uc(a,e,t){let i,l=a.state,s=l.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&a.inputState.composing<0){let r=s.from<e.from?l.sliceDoc(s.from,e.from):"",d=s.to>e.to?l.sliceDoc(e.to,s.to):"";i=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+d))}else{let r=l.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let h=a.state.sliceDoc(e.from,e.to),c,f=t&&ho(a,t.main.head);if(f){let b=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-b}}else c=a.state.doc.lineAt(s.head);let u=s.to-e.to,p=s.to-s.from;i=l.changeByRange(b=>{if(b.from==s.from&&b.to==s.to)return{changes:r,range:d||b.map(r)};let g=b.to-u,v=g-h.length;if(b.to-b.from!=p||a.state.sliceDoc(v,g)!=h||b.to>=c.from&&b.from<=c.to)return{range:b};let x=l.changes({from:v,to:g,insert:e.insert}),w=b.to-s.to;return{changes:x,range:d?H.range(Math.max(0,d.anchor+w),Math.max(0,d.head+w)):b.map(x)}})}else i={changes:r,selection:d&&l.selection.replaceRange(d)}}let o="input.type";return(a.composing||a.inputState.compositionPendingChange&&a.inputState.compositionEndedAt>Date.now()-50)&&(a.inputState.compositionPendingChange=!1,o+=".compose",a.inputState.compositionFirstChange&&(o+=".start",a.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:o,scrollIntoView:!0})}function Wc(a,e,t,i){let l=Math.min(a.length,e.length),s=0;for(;s<l&&a.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==l&&a.length==e.length)return null;let o=a.length,r=e.length;for(;o>0&&r>0&&a.charCodeAt(o-1)==e.charCodeAt(r-1);)o--,r--;if(i=="end"){let d=Math.max(0,s-Math.min(o,r));t-=o+d-s}if(o<s&&a.length<e.length){let d=t<=s&&t>=o?s-t:0;s-=d,r=s+(r-o),o=s}else if(r<s){let d=t<=s&&t>=r?s-t:0;s-=d,o=s+(o-r),r=s}return{from:s,toA:o,toB:r}}function Hc(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}=a.observer.selectionRange;return t&&(e.push(new bo(t,i)),(l!=t||s!=i)&&e.push(new bo(l,s))),e}function Kc(a,e){if(a.length==0)return null;let t=a[0].pos,i=a.length==2?a[1].pos:t;return t>-1&&i>-1?H.single(t+e,i+e):null}class Qc{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&hh(e.contentDOM.ownerDocument)}handleEvent(e){!nh(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Gc(e),i=this.handlers,l=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,r=i[s];r&&o!=!r.handlers.length&&(l.removeEventListener(s,this.handleEvent),r=null),r||l.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!t[s]&&l.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Xc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=xo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Yc.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,_t(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:W.safari&&!W.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wo(a,e){return(t,i)=>{try{return e.call(a,i,t)}catch(l){ze(t.state,l)}}}function Gc(a){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of a){let l=i.spec;if(l&&l.domEventHandlers)for(let s in l.domEventHandlers){let o=l.domEventHandlers[s];o&&t(s).handlers.push(wo(i.value,o))}if(l&&l.domEventObservers)for(let s in l.domEventObservers){let o=l.domEventObservers[s];o&&t(s).observers.push(wo(i.value,o))}}for(let i in Ie)t(i).handlers.push(Ie[i]);for(let i in Te)t(i).observers.push(Te[i]);return e}const xo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Yc="dthko",Xc=[16,17,18,20,91,92,224,225],Li=6;function ji(a){return Math.max(0,a)*.7+8}function Jc(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class Zc{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=sc(e.contentDOM),this.atoms=e.state.facet(Zn).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(te.allowMultipleSelections)&&eh(e,t),this.dragging=ih(e,t)&&Mo(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Jc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,s=0,o=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=ro(this.view);e.clientX-d.left<=l+Li?t=-ji(l-e.clientX):e.clientX+d.right>=o-Li&&(t=ji(e.clientX-o)),e.clientY-d.top<=s+Li?i=-ji(s-e.clientY):e.clientY+d.bottom>=r-Li&&(i=ji(e.clientY-r)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],s=null;if(l.empty){let o=Ri(this.atoms,l.from,0);o!=l.from&&(s=H.cursor(o,-1))}else{let o=Ri(this.atoms,l.from,-1),r=Ri(this.atoms,l.to,1);(o!=l.from||r!=l.to)&&(s=H.range(l.from==l.anchor?o:r,l.from==l.head?o:r))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?H.create(t,e.mainIndex):e}select(e){let{view:t}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function eh(a,e){let t=a.state.facet(Qs);return t.length?t[0](e):W.mac?e.metaKey:e.ctrlKey}function th(a,e){let t=a.state.facet(Gs);return t.length?t[0](e):W.mac?!e.altKey:!e.ctrlKey}function ih(a,e){let{main:t}=a.state.selection;if(t.empty)return!1;let i=Jt(a.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let s=0;s<l.length;s++){let o=l[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function nh(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=a.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=ne.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ie=Object.create(null),Te=Object.create(null),vo=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function lh(a){let e=a.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{a.focus(),t.remove(),Co(a,t.value)},50)}function zi(a,e,t){for(let i of a.facet(e))t=i(t,a);return t}function Co(a,e){e=zi(a.state,Gn,e);let{state:t}=a,i,l=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(ll!=null&&t.selection.ranges.every(d=>d.empty)&&ll==s.toString()){let d=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==d)return{range:h};d=c.from;let f=t.toText((o?s.line(l++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:H.cursor(h.from+f.length)}})}else o?i=t.changeByRange(d=>{let h=s.line(l++);return{changes:{from:d.from,to:d.to,insert:h.text},range:H.cursor(d.from+h.length)}}):i=t.replaceSelection(s);a.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Te.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},Ie.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Te.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Te.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},Ie.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of a.state.facet(Ys))if(t=i(a,e),t)break;if(!t&&e.button==0&&(t=ah(a,e)),t){let i=!a.hasFocus;a.inputState.startMouseSelection(new Zc(a,e,t,i)),i&&a.observer.ignore(()=>{Cs(a.contentDOM);let s=a.root.activeElement;s&&!s.contains(a.contentDOM)&&s.blur()});let l=a.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function So(a,e,t,i){if(i==1)return H.cursor(e,t);if(i==2)return Ac(a.state,e,t);{let l=ce.find(a.docView,e),s=a.state.doc.lineAt(l?l.posAtEnd:e),o=l?l.posAtStart:s.from,r=l?l.posAtEnd:s.to;return r<a.state.doc.length&&r==s.to&&r++,H.range(o,r)}}let No=(a,e,t)=>e>=t.top&&e<=t.bottom&&a>=t.left&&a<=t.right;function sh(a,e,t,i){let l=ce.find(a.docView,e);if(!l)return 1;let s=e-l.posAtStart;if(s==0)return 1;if(s==l.length)return-1;let o=l.coordsAt(s,-1);if(o&&No(t,i,o))return-1;let r=l.coordsAt(s,1);return r&&No(t,i,r)?1:o&&o.bottom>=i?-1:1}function Bo(a,e){let t=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:sh(a,t,e.clientX,e.clientY)}}const oh=W.ie&&W.ie_version<=11;let Oo=null,Vo=0,_o=0;function Mo(a){if(!oh)return a.detail;let e=Oo,t=_o;return Oo=a,_o=Date.now(),Vo=!e||t>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(Vo+1)%3:1}function ah(a,e){let t=Bo(a,e),i=Mo(e),l=a.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),l=l.map(s.changes))},get(s,o,r){let d=Bo(a,s),h,c=So(a,d.pos,d.bias,i);if(t.pos!=d.pos&&!o){let f=So(a,t.pos,t.bias,i),u=Math.min(f.from,c.from),p=Math.max(f.to,c.to);c=u<c.from?H.range(u,p):H.range(p,u)}return o?l.replaceRange(l.main.extend(c.from,c.to)):r&&i==1&&l.ranges.length>1&&(h=rh(l,d.pos))?h:r?l.addRange(c):H.create([c])}}}function rh(a,e){for(let t=0;t<a.ranges.length;t++){let{from:i,to:l}=a.ranges[t];if(i<=e&&l>=e)return H.create(a.ranges.slice(0,t).concat(a.ranges.slice(t+1)),a.mainIndex==t?0:a.mainIndex-(a.mainIndex>t?1:0))}return null}Ie.dragstart=(a,e)=>{let{selection:{main:t}}=a.state;if(e.target.draggable){let l=a.docView.nearest(e.target);if(l&&l.isWidget){let s=l.posAtStart,o=s+l.length;(s>=t.to||o<=t.from)&&(t=H.range(s,o))}}let{inputState:i}=a;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",zi(a.state,Yn,a.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Ie.dragend=a=>(a.inputState.draggedContent=null,!1);function To(a,e,t,i){if(t=zi(a.state,Gn,t),!t)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=a.inputState,o=i&&s&&th(a,e)?{from:s.from,to:s.to}:null,r={from:l,insert:t},d=a.state.changes(o?[o,r]:r);a.focus(),a.dispatch({changes:d,selection:{anchor:d.mapPos(l,-1),head:d.mapPos(l,1)},userEvent:o?"move.drop":"input.drop"}),a.inputState.draggedContent=null}Ie.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,s=()=>{++l==t.length&&To(a,e,i.filter(o=>o!=null).join(a.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let r=new FileReader;r.onerror=s,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[o]=r.result),s()},r.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return To(a,e,i,!0),!0}return!1},Ie.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let t=vo?null:e.clipboardData;return t?(Co(a,t.getData("text/plain")||t.getData("text/uri-list")),!0):(lh(a),!1)};function dh(a,e){let t=a.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),a.focus()},50)}function ch(a){let e=[],t=[],i=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:s}of a.selection.ranges){let o=a.doc.lineAt(s);o.number>l&&(e.push(o.text),t.push({from:o.from,to:Math.min(a.doc.length,o.to+1)})),l=o.number}i=!0}return{text:zi(a,Yn,e.join(a.lineBreak)),ranges:t,linewise:i}}let ll=null;Ie.copy=Ie.cut=(a,e)=>{let{text:t,ranges:i,linewise:l}=ch(a.state);if(!t&&!l)return!1;ll=l?t:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=vo?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(dh(a,t),!1)};const Ao=St.define();function Eo(a,e){let t=[];for(let i of a.facet(Zs)){let l=i(a,e);l&&t.push(l)}return t?a.update({effects:t,annotations:Ao.of(!0)}):null}function Io(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let t=Eo(a.state,e);t?a.dispatch(t):a.update([])}},10)}Te.focus=a=>{a.inputState.lastFocusTime=Date.now(),!a.scrollDOM.scrollTop&&(a.inputState.lastScrollTop||a.inputState.lastScrollLeft)&&(a.scrollDOM.scrollTop=a.inputState.lastScrollTop,a.scrollDOM.scrollLeft=a.inputState.lastScrollLeft),Io(a)},Te.blur=a=>{a.observer.clearSelectionRange(),Io(a)},Te.compositionstart=Te.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Te.compositionend=a=>{a.observer.editContext||(a.inputState.composing=-1,a.inputState.compositionEndedAt=Date.now(),a.inputState.compositionPendingKey=!0,a.inputState.compositionPendingChange=a.observer.pendingRecords().length>0,a.inputState.compositionFirstChange=null,W.chrome&&W.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Te.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},Ie.beforeinput=(a,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let r=o[0],d=a.posAtDOM(r.startContainer,r.startOffset),h=a.posAtDOM(r.endContainer,r.endOffset);return nl(a,{from:d,to:h,insert:a.state.toText(s)},null),!0}}let l;if(W.chrome&&W.android&&(l=xo.find(s=>s.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&a.hasFocus&&(a.contentDOM.blur(),a.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Te.compositionend(a,e),20),!1};const Do=new Set;function hh(a){Do.has(a)||(Do.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const Po=["pre-wrap","normal","pre-line","break-spaces"];let It=!1;function Fo(){It=!1}class fh{constructor(e){this.lineWrapping=e,this.doc=X.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Po.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,s,o){let r=Po.indexOf(e)>-1,d=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=s,d){this.heightSamples={};for(let h=0;h<o.length;h++){let c=o[h];c<0?h++:this.heightSamples[Math.floor(c*10)]=!0}}return d}}class uh{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class qe{constructor(e,t,i,l,s){this.from=e,this.length=t,this.top=i,this.height=l,this._content=s}get type(){return typeof this._content=="number"?Le.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof st?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new qe(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var oe=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(oe||(oe={}));const qi=.001;class ve{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>qi&&(It=!0),this.height=e)}replace(e,t,i){return ve.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let s=this,o=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:d,toA:h,fromB:c,toB:f}=l[r],u=s.lineAt(d,oe.ByPosNoHeight,i.setDoc(t),0,0),p=u.to>=h?u:s.lineAt(h,oe.ByPosNoHeight,i,0,0);for(f+=p.to-h,h=p.to;r>0&&u.from<=l[r-1].toA;)d=l[r-1].fromA,c=l[r-1].fromB,r--,d<u.from&&(u=s.lineAt(d,oe.ByPosNoHeight,i,0,0));c+=u.from-d,d=u.from;let b=sl.build(i.setDoc(o),e,c,f);s=Ui(s,s.replace(d,h,b))}return s.updateHeight(i,0)}static empty(){return new Oe(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,s=0;for(;;)if(t==i)if(l>s*2){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),i+=1+r.break,l-=r.size}else if(s>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,s-=r.size}else break;else if(l<s){let r=e[t++];r&&(l+=r.size)}else{let r=e[--i];r&&(s+=r.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new ph(ve.of(e.slice(0,t)),o,ve.of(e.slice(i)))}}function Ui(a,e){return a==e?a:(a.constructor!=e.constructor&&(It=!0),e)}ve.prototype.size=1;class $o extends ve{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,l,s){return this.blockAt(0,i,l,s)}forEachLine(e,t,i,l,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,i,l,s))}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oe extends $o{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Oe||l instanceof ge&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof ge?l=new Oe(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):ve.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ge extends ve{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,s=l-i+1,o,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*s);o=d/s,this.length>s+1&&(r=(this.height-d)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:l,perLine:o,perChar:r}}blockAt(e,t,i,l){let{firstLine:s,lastLine:o,perLine:r,perChar:d}=this.heightMetrics(t,l);if(t.lineWrapping){let h=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),c=t.doc.lineAt(h),f=r+c.length*d,u=Math.max(i,e-f/2);return new qe(c.from,c.length,u,f,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((e-i)/r))),{from:c,length:f}=t.doc.line(s+h);return new qe(c,f,i+r*h,r,0)}}lineAt(e,t,i,l,s){if(t==oe.ByHeight)return this.blockAt(e,i,l,s);if(t==oe.ByPosNoHeight){let{from:p,to:b}=i.doc.lineAt(e);return new qe(p,b-p,0,0,0)}let{firstLine:o,perLine:r,perChar:d}=this.heightMetrics(i,s),h=i.doc.lineAt(e),c=r+h.length*d,f=h.number-o,u=l+r*f+d*(h.from-s-f);return new qe(h.from,h.length,Math.max(l,Math.min(u,l+this.height-c)),c,0)}forEachLine(e,t,i,l,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:r,perLine:d,perChar:h}=this.heightMetrics(i,s);for(let c=e,f=l;c<=t;){let u=i.doc.lineAt(c);if(c==e){let b=u.number-r;f+=d*b+h*(e-s-b)}let p=d+h*u.length;o(new qe(u.from,u.length,f,p,0)),f+=p,c=u.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let s=i[i.length-1];s instanceof ge?i[i.length-1]=new ge(s.length+l):i.push(null,new ge(l-1))}if(e>0){let s=i[0];s instanceof ge?i[0]=new ge(e+s.length):i.unshift(new ge(e-1),null)}return ve.of(i)}decomposeLeft(e,t){t.push(new ge(e-1),null)}decomposeRight(e,t){t.push(null,new ge(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let s=t+this.length;if(l&&l.from<=t+this.length&&l.more){let o=[],r=Math.max(t,l.from),d=-1;for(l.from>t&&o.push(new ge(l.from-t-1).updateHeight(e,t));r<=s&&l.more;){let c=e.doc.lineAt(r).length;o.length&&o.push(null);let f=l.heights[l.index++];d==-1?d=f:Math.abs(f-d)>=qi&&(d=-2);let u=new Oe(c,f);u.outdated=!1,o.push(u),r+=c+1}r<=s&&o.push(null,new ge(s-r).updateHeight(e,r));let h=ve.of(o);return(d<0||Math.abs(h.height-this.height)>=qi||Math.abs(d-this.heightMetrics(e,t).perLine)>=qi)&&(It=!0),Ui(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ph extends ve{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,s,l+this.left.length+this.break)}lineAt(e,t,i,l,s){let o=l+this.left.height,r=s+this.left.length+this.break,d=t==oe.ByHeight?e<o:e<r,h=d?this.left.lineAt(e,t,i,l,s):this.right.lineAt(e,t,i,o,r);if(this.break||(d?h.to<r:h.from>r))return h;let c=t==oe.ByPosNoHeight?oe.ByPosNoHeight:oe.ByPos;return d?h.join(this.right.lineAt(r,c,i,o,r)):this.left.lineAt(r,c,i,l,s).join(h)}forEachLine(e,t,i,l,s,o){let r=l+this.left.height,d=s+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,l,s,o),t>=d&&this.right.forEachLine(e,t,i,r,d,o);else{let h=this.lineAt(d,oe.ByPos,i,l,s);e<h.from&&this.left.forEachLine(e,h.from-1,i,l,s,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,r,d,o)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let r of i)s.push(r);if(e>0&&Ro(s,o-1),t<this.length){let r=s.length;this.decomposeRight(t,s),Ro(s,r)}return ve.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ve.of(this.break?[e,null,t]:[e,t]):(this.left=Ui(this.left,e),this.right=Ui(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,l){let{left:s,right:o}=this,r=t+s.length+this.break,d=null;return l&&l.from<=t+s.length&&l.more?d=s=s.updateHeight(e,t,i,l):s.updateHeight(e,t,i),l&&l.from<=r+o.length&&l.more?d=o=o.updateHeight(e,r,i,l):o.updateHeight(e,r,i),d?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ro(a,e){let t,i;a[e]==null&&(t=a[e-1])instanceof ge&&(i=a[e+1])instanceof ge&&a.splice(e-1,3,new ge(t.length+1+i.length))}const mh=5;class sl{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Oe?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Oe(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let o=t-e;i.block?this.addBlock(new $o(o,l,i)):(o||s||l>=mh)&&this.addLineDeco(l,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Oe(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new ge(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Oe)return e;let t=new Oe(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Oe)&&!this.isCovered?this.nodes.push(new Oe(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Oe&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let s=new sl(i,e);return se.spans(t,i,l,s,0),s.finish(i)}}function gh(a,e,t){let i=new kh;return se.compare(a,e,t,i,0),i.changes}class kh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&zn(e,t,this.changes,5)}}function bh(a,e){let t=a.getBoundingClientRect(),i=a.ownerDocument,l=i.defaultView||window,s=Math.max(0,t.left),o=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(l.innerHeight,t.bottom);for(let h=a.parentNode;h&&h!=i.body;)if(h.nodeType==1){let c=h,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),r=Math.max(r,u.top),d=Math.min(h==a.parentNode?l.innerHeight:d,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function yh(a,e){let t=a.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ol{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],s=t[i];if(l.from!=s.from||l.to!=s.to||l.size!=s.size)return!1}return!0}draw(e,t){return we.replace({widget:new wh(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class wh extends jn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Lo{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=jo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Jn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new fh(t),this.stateDeco=e.facet(si).filter(i=>typeof i!="function"),this.heightMap=ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle.setDoc(e.doc),[new Me(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:s,to:o})=>l>=s&&l<=o)){let{from:s,to:o}=this.lineBlockAt(l);e.push(new Wi(s,o))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?jo:new al(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ri(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(si).filter(c=>typeof c!="function");let l=e.changedRanges,s=Me.extendWithRanges(l,gh(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),o=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Fo(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||It)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let d=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<d.from||t.range.head>d.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,t));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Cc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),r=t.getBoundingClientRect(),d=o||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,c=0;if(r.width&&r.height){let{scaleX:k,scaleY:m}=vs(t,r);(k>.005&&Math.abs(this.scaleX-k)>.005||m>.005&&Math.abs(this.scaleY-m)>.005)&&(this.scaleX=k,this.scaleY=m,h|=8,o=d=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Bs(e.scrollDOM);let b=(this.printing?yh:bh)(t,this.paddingTop),g=b.top-this.pixelViewport.top,v=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(d=!0)),!this.inView&&!this.scrollTarget)return 0;let w=r.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),d){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(o=!0),o||l.lineWrapping&&Math.abs(w-this.contentDOMWidth)>l.charWidth){let{lineHeight:m,charWidth:N,textHeight:_}=e.docView.measureTextSize();o=m>0&&l.refresh(s,m,N,_,w/N,k),o&&(e.docView.minWidth=0,h|=8)}g>0&&v>0?c=Math.max(g,v):g<0&&v<0&&(c=Math.min(g,v)),Fo();for(let m of this.viewports){let N=m.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(m);this.heightMap=(o?ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle,[new Me(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,o,new uh(m.from,N))}It&&(h|=2)}let O=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:r}=this,d=new Wi(l.lineAt(o-i*1e3,oe.ByHeight,s,0,0).from,l.lineAt(r+(1-i)*1e3,oe.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(h<d.from||h>d.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(h,oe.ByPos,s,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h<d.from?u=f.top:u=f.bottom-c,d=new Wi(l.lineAt(u-1e3/2,oe.ByHeight,s,0,0).from,l.lineAt(u+c+1e3/2,oe.ByHeight,s,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Wi(this.heightMap.lineAt(i,oe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,oe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,oe.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:r}=this;return(e==0||l<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=r+Math.max(10,Math.min(i,250)))&&l>o-2*1e3&&s<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new ol(t.mapPos(l.from),t.mapPos(l.to),l.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,s=l>>1,o=l<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(c,f,u,p)=>{if(f-c<s)return;let b=this.state.selection.main,g=[b.from];b.empty||g.push(b.to);for(let x of g)if(x>c&&x<f){d(c,x-10,u,p),d(x+10,f,u,p);return}let v=vh(e,x=>x.from>=u.from&&x.to<=u.to&&Math.abs(x.from-c)<s&&Math.abs(x.to-f)<s&&!g.some(w=>x.from<w&&x.to>w));if(!v){if(f<u.to&&t&&i&&t.visibleRanges.some(x=>x.from<=f&&x.to>=f)){let x=t.moveToLineBoundary(H.cursor(f),!1,!0).head;x>c&&(f=x)}v=new ol(c,f,this.gapSize(u,c,f,p))}r.push(v)},h=c=>{if(c.length<o||c.type!=Le.Text)return;let f=xh(c.from,c.to,this.stateDeco);if(f.total<o)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,p,b;if(i){let g=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,x;if(u!=null){let w=Ki(f,u),O=((this.visibleBottom-this.visibleTop)/2+g)/c.height;v=w-O,x=w+O}else v=(this.visibleTop-c.top-g)/c.height,x=(this.visibleBottom-c.top+g)/c.height;p=Hi(f,v),b=Hi(f,x)}else{let g=f.total*this.heightOracle.charWidth,v=l*this.heightOracle.charWidth,x,w;if(u!=null){let O=Ki(f,u),k=((this.pixelViewport.right-this.pixelViewport.left)/2+v)/g;x=O-k,w=O+k}else x=(this.pixelViewport.left-v)/g,w=(this.pixelViewport.right+v)/g;p=Hi(f,x),b=Hi(f,w)}p>c.from&&d(c.from,p,c,f),b<c.to&&d(b,c.to,c,f)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(h):h(c);return r}gapSize(e,t,i,l){let s=Ki(l,i)-Ki(l,t);return this.heightOracle.lineWrapping?e.height*s:l.total*this.heightOracle.charWidth*s}updateLineGaps(e){ol.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];se.spans(e,this.viewport.from,this.viewport.to,{span(l,s){t.push({from:l,to:s})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((l,s)=>l.from!=t[s].from||l.to!=t[s].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ri(this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||ri(this.heightMap.lineAt(this.scaler.fromDOM(e),oe.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return ri(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Wi{constructor(e,t){this.from=e,this.to=t}}function xh(a,e,t){let i=[],l=a,s=0;return se.spans(t,a,e,{span(){},point(o,r){o>l&&(i.push({from:l,to:o}),s+=o-l),l=r}},20),l<e&&(i.push({from:l,to:e}),s+=e-l),{total:s,ranges:i}}function Hi({total:a,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(a*t);for(let l=0;;l++){let{from:s,to:o}=e[l],r=o-s;if(i<=r)return s+i;i-=r}}function Ki(a,e){let t=0;for(let{from:i,to:l}of a.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/a.total}function vh(a,e){for(let t of a)if(e(t))return t}const jo={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class al{constructor(e,t,i){let l=0,s=0,o=0;this.viewports=i.map(({from:r,to:d})=>{let h=t.lineAt(r,oe.ByPos,e,0,0).top,c=t.lineAt(d,oe.ByPos,e,0,0).bottom;return l+=c-h,{from:r,to:d,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=o+(r.top-s)*this.scale,o=r.domBottom=r.domTop+(r.bottom-r.top),s=r.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return l+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,l=s.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-l)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,l=s.domBottom}}eq(e){return e instanceof al?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function ri(a,e){if(e.scale==1)return a;let t=e.toDOM(a.top),i=e.toDOM(a.bottom);return new qe(a.from,a.length,t,i-t,Array.isArray(a._content)?a._content.map(l=>ri(l,e)):a._content)}const Qi=Q.define({combine:a=>a.join(" ")}),rl=Q.define({combine:a=>a.indexOf(!0)>-1}),dl=lt.newName(),zo=lt.newName(),qo=lt.newName(),Uo={"&light":"."+zo,"&dark":"."+qo};function cl(a,e,t){return new lt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return a;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):a+" "+i}})}const Ch=cl("."+dl,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Uo),Sh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hl=W.ie&&W.ie_version<=11;class Nh{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new oc,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new Oh(e),e.state.facet(at)&&(e.contentDOM.editContext=this.editContext.editContext)),hl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(at)?i.root.activeElement!=this.dom:!Ti(i.dom,l))return;let s=l.anchorNode&&i.docView.nearest(l.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!i.state.selection.main.empty&&l.focusNode&&ei(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Jt(e.root);if(!t)return!1;let i=W.safari&&e.root.nodeType==11&&ic(this.dom.ownerDocument)==this.dom&&Bh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Ti(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&rc(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Sh),hl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),hl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&_t(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,l=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(l=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Ti(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new qc(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,l=yo(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Wo(t,e.previousSibling||e.target.previousSibling,-1),l=Wo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(at)!=e.state.facet(at)&&(e.view.contentDOM.editContext=e.state.facet(at)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Wo(a,e,t){for(;e;){let i=ne.get(e);if(i&&i.parent==a)return i;let l=e.parentNode;e=l!=a.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function Ho(a,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,s=e.endOffset,o=a.docView.domAtPos(a.state.selection.main.anchor);return ei(o.node,o.offset,l,s)&&([t,i,l,s]=[l,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}}function Bh(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return Ho(a,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",i,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",i,!0),t?Ho(a,t):null}class Oh{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let{anchor:l}=e.state.selection.main,s={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:X.of(i.text.split(`
|
|
10
|
-
`))};s.from==this.from&&l<this.from?s.from=l:s.to==this.to&&l>this.to&&(s.to=l),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||nl(e,s,H.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let l=[],s=null;for(let o=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);o<r;o++){let d=e.coordsForChar(o);s=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||s||new DOMRect,l.push(s)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,r=s.underlineThickness;if(o!="None"&&r!="None"){let d=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(we.mark({attributes:{style:d}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:io.of(we.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=Jt(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((s,o,r,d,h)=>{if(i)return;let c=h.length-(o-s);if(l&&o>=l.to)if(l.from==s&&l.to==o&&l.insert.eq(h)){l=this.pendingContextChange=null,t+=c,this.to+=c;return}else l=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ee{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(s=>i(s,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ac(e.parent)||document,this.viewState=new Lo(e.state||te.create(e)),e.scrollTo&&e.scrollTo.is(Fi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(li).map(l=>new Xn(l));for(let l of this.plugins)l.update(this);this.observer=new Nh(this),this.inputState=new Qc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new co(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof be?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,s=this.state;for(let u of e){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,r=0,d=null;e.some(u=>u.annotation(Ao))?(this.inputState.notifiedFocused=o,r=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,d=Eo(s,o),d||(r=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(te.phrases)!=this.state.facet(te.phrases))return this.setState(s);l=$i.create(this,s,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:p}=u.state.selection;f=new At(p.empty?p:H.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of u.effects)p.is(Fi)&&(f=p.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=Gi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(oi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Qi)!=l.state.facet(Qi)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(Qn))try{u(l)}catch(p){ze(this.state,p,"update listener")}(d||c)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),c&&!yo(this,c)&&h.force&&_t(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Lo(e),this.plugins=e.facet(li).map(i=>new Xn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new co(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(li),i=e.state.facet(li);if(t!=i){let l=[];for(let s of i){let o=t.indexOf(s);if(o<0)l.push(new Xn(s));else{let r=this.plugins[o];r.mustUpdate=e,l.push(r)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){ze(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,l=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(o<0)if(Bs(i))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(l);s=p.from,o=p.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(p=>{try{return p.read(this)}catch(b){return ze(this.state,b),Ko}}),f=$i.create(this,this.state,[]),u=!1;f.flags|=d,t?t.flags|=d:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let p=0;p<h.length;p++)if(c[p]!=Ko)try{let b=h[p];b.write&&b.write(c[p],this)}catch(b){ze(this.state,b)}if(u&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let b=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(b>1||b<-1){l=l+b,i.scrollTop=l/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Qn))r(t)}get themeClasses(){return dl+" "+(this.state.facet(rl)?qo:zo)+" "+this.state.facet(Qi)}updateAttrs(){let e=Qo(this,no,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(at)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Qo(this,Jn,t);let i=this.observer.ignore(()=>{let l=Ln(this.contentDOM,this.contentAttrs,t),s=Ln(this.dom,this.editorAttrs,e);return l||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(ee.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(oi);let e=this.state.facet(ee.cspNonce);lt.mount(this.root,this.styleModules.concat(Ch).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return il(this,e,ko(this,e,t,i))}moveByGroup(e,t){return il(this,e,ko(this,e,t,i=>Rc(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return H.cursor(s.side(t,l)+e.from,s.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return $c(this,e,t,i)}moveVertically(e,t,i){return il(this,e,Lc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),mo(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),s=this.bidiSpans(l),o=s[ot.find(s,e-l.from,-1,t)];return Ei(i,o.dir==me.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(eo)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Vh)return Hs(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Ws(s.isolates,i=oo(this,e))))return s.order;i||(i=oo(this,e));let l=wc(e.text,t,i);return this.bidiCache.push(new Gi(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Cs(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Fi.of(new At(typeof e=="number"?H.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Fi.of(new At(H.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Et.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Et.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=lt.newName(),l=[Qi.of(i),oi.of(cl(`.${i}`,e))];return t&&t.dark&&l.push(rl.of(!0)),l}static baseTheme(e){return zd.lowest(oi.of(cl("."+dl,e,Uo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&ne.get(i)||ne.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}ee.styleModule=oi,ee.inputHandler=Js,ee.clipboardInputFilter=Gn,ee.clipboardOutputFilter=Yn,ee.scrollHandler=to,ee.focusChangeEffect=Zs,ee.perLineTextDirection=eo,ee.exceptionSink=Xs,ee.updateListener=Qn,ee.editable=at,ee.mouseSelectionStyle=Ys,ee.dragMovesSelection=Gs,ee.clickAddsSelectionRange=Qs,ee.decorations=si,ee.outerDecorations=lo,ee.atomicRanges=Zn,ee.bidiIsolatedRanges=so,ee.scrollMargins=ao,ee.darkTheme=rl,ee.cspNonce=Q.define({combine:a=>a.length?a[0]:""}),ee.contentAttributes=Jn,ee.editorAttributes=no,ee.lineWrapping=ee.contentAttributes.of({class:"cm-lineWrapping"}),ee.announce=he.define();const Vh=4096,Ko={};class Gi{constructor(e,t,i,l,s,o){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:me.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==l&&!t.touchesRange(o.from,o.to)&&i.push(new Gi(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function Qo(a,e,t){for(let i=a.state.facet(e),l=i.length-1;l>=0;l--){let s=i[l],o=typeof s=="function"?s(a):s;o&&Rn(o,t)}return t}const _h=!W.ios,Go={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};_h&&(Go[".cm-line"].caretColor=Go[".cm-content"].caretColor="transparent !important");class Dt extends Bt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Dt.prototype.elementClass="",Dt.prototype.toDOM=void 0,Dt.prototype.mapMode=Be.TrackBefore,Dt.prototype.startSide=Dt.prototype.endSide=-1,Dt.prototype.point=!0;var fl;const Pt=new Y;function Mh(a){return Q.define({combine:a?e=>e.concat(a):void 0})}const Th=new Y;class De{constructor(e,t,i=[],l=""){this.data=e,this.name=l,te.prototype.hasOwnProperty("tree")||Object.defineProperty(te.prototype,"tree",{get(){return ul(this)}}),this.parser=t,this.extension=[$t.of(this),te.languageData.of((s,o,r)=>{let d=Yo(s,o,r),h=d.type.prop(Pt);if(!h)return[];let c=s.facet(h),f=d.type.prop(Th);if(f){let u=d.resolve(o-d.from,r);for(let p of f)if(p.test(u,s)){let b=s.facet(p.facet);return p.type=="replace"?b:b.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Yo(e,t,i).type.prop(Pt)==this.data}findRegions(e){let t=e.facet($t);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(s,o)=>{if(s.prop(Pt)==this.data){i.push({from:o,to:o+s.length});return}let r=s.prop(Y.mounted);if(r){if(r.tree.prop(Pt)==this.data){if(r.overlay)for(let d of r.overlay)i.push({from:d.from+o,to:d.to+o});else i.push({from:o,to:o+s.length});return}else if(r.overlay){let d=i.length;if(l(r.tree,r.overlay[0].from+o),i.length>d)return}}for(let d=0;d<s.children.length;d++){let h=s.children[d];h instanceof de&&l(h,s.positions[d]+o)}};return l(ul(e),0),i}get allowsNesting(){return!0}}De.setState=he.define();function Yo(a,e,t){let i=a.facet($t),l=ul(a).topNode;if(!i||i.allowsNesting)for(let s=l;s;s=s.enter(e,t,fe.ExcludeBuffers))s.type.isTop&&(l=s);return l}class Yi extends De{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Mh(e.languageData);return new Yi(t,e.parser.configure({props:[Pt.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Yi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ul(a){let e=a.field(De.state,!1);return e?e.tree:de.empty}class Ah{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let di=null;class Xi{constructor(e,t,i=[],l,s,o,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=s,this.viewport=o,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Xi(e,t,[],de.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Ah(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=de.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(ht.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ht.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=di;di=this;try{return e()}finally{di=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Xo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:s,viewport:o,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,c,f,u)=>d.push({fromA:h,toA:c,fromB:f,toB:u})),i=ht.applyChanges(i,d),l=de.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){r=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);c<f&&r.push({from:c,to:f})}}}return new Xi(this.parser,t,i,l,s,o,r,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:l,to:s}=this.skipped[i];l<e.to&&s>e.from&&(this.fragments=Xo(this.fragments,l,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Dl{createParse(t,i,l){let s=l[0].from,o=l[l.length-1].to;return{parsedPos:s,advance(){let d=di;if(d){for(let h of l)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=o,new de(Ce.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return di}}function Xo(a,e,t){return ht.applyChanges(a,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ft{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ft(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Xi.create(e.facet($t).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ft(i)}}De.state=pt.define({create:Ft.init,update(a,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet($t)!=e.state.facet($t)?Ft.init(e.state):a.apply(e)}});let Jo=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Jo=a=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const pl=typeof navigator<"u"&&(!((fl=navigator.scheduling)===null||fl===void 0)&&fl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Eh=Et.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(De.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(De.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Jo(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:l}}=this.view,s=i.field(De.state);if(s.tree==s.context.tree&&s.context.isDone(l+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!pl?Math.max(25,e.timeRemaining()-5):1e9),r=s.context.treeLen<l&&i.doc.length>l+1e3,d=s.context.work(()=>pl&&pl()||Date.now()>o,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:De.setState.of(new Ft(s.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ze(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),$t=Q.define({combine(a){return a.length?a[0]:null},enables:a=>[De.state,Eh,ee.contentAttributes.compute([a],e=>{let t=e.facet(a);return t&&t.name?{"data-language":t.name}:{}})]});class Ih{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Dh=new Y;function Zo({except:a,units:e=1}={}){return t=>{let i=a&&a.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Ph=new Y;function Fh(a){let e=a.firstChild,t=a.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?a.to:t.from}:null}class ml{constructor(e,t){this.specs=e;let i;function l(r){let d=lt.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const s=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,o=t.scope;this.scope=o instanceof De?r=>r.prop(Pt)==o.data:o?r=>r==o:void 0,this.style=ql(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:s}).style,this.module=i?new lt(i):null,this.themeType=t.themeType}static define(e,t){return new ml(e,t||{})}}L.meta,L.link,L.heading,L.emphasis,L.strong,L.strikethrough,L.keyword,L.atom,L.bool,L.url,L.contentSeparator,L.labelName,L.literal,L.inserted,L.string,L.deleted,L.regexp,L.escape,L.string,L.variableName,L.variableName,L.typeName,L.namespace,L.className,L.variableName,L.macroName,L.propertyName,L.comment,L.invalid;const $h=Object.create(null),ea=[Ce.none],ta=[],ia=Object.create(null),Rh=Object.create(null);for(let[a,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Rh[a]=Lh($h,e);function gl(a,e){ta.indexOf(a)>-1||(ta.push(a),console.warn(e))}function Lh(a,e){let t=[];for(let r of e.split(" ")){let d=[];for(let h of r.split(".")){let c=a[h]||L[h];c?typeof c=="function"?d.length?d=d.map(c):gl(h,`Modifier ${h} used at start of tag`):d.length?gl(h,`Tag ${h} used as modifier`):d=Array.isArray(c)?c:[c]:gl(h,`Unknown highlighting tag ${h}`)}for(let h of d)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(r=>r.id),s=ia[l];if(s)return s.id;let o=ia[l]=Ce.define({id:ea.length,name:i,props:[zl({[i]:t})]});return ea.push(o),o.id}me.RTL,me.LTR;const jh=Yi.define({name:"json",parser:Pd.configure({props:[Dh.add({Object:Zo({except:/^\s*\}/}),Array:Zo({except:/^\s*\]/})}),Ph.add({"Object Array":Fh})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function zh(){return new Ih(jh)}const kl=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function qh(){const a=Ae();if(a.formRules?.length){const e={};kl.forEach(i=>{e[i.name]=i});const t=[...kl];return a.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):t.push(l)}),t}return kl}const Uh={loadAdvances:qh},Wh={class:"unione-props-setting data-field-setting"},Hh={key:0},Kh=["onClick"],Qh={class:"field-txt"},Gh=["onClick"],Yh={key:1,class:"field-txt"},Xh=["onClick"],Jh={key:0,class:"field-txt"},Zh={key:3,class:"edit-field"},ef=["onClick"],tf=Z(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([zh()]),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"form",key:"form",width:"40px",align:"center"},{title:"详情",dataIndex:"view",key:"view",width:"40px",align:"center"},{title:"列表",dataIndex:"list",key:"list",width:"40px",align:"center"},{title:"排序",dataIndex:"sort",key:"sort",width:"40px",align:"center"},{title:"查询",dataIndex:"query",key:"query",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=n.useModel(a,"modelValue"),l={mounted:k=>k.focus()},s=n.ref({});function o(){const k=Object.keys(s.value);if(k.length)for(let m in k){const N=i.value.filter(_=>_.name==m);if(N&&N[0]){let _=s.value[m];Object.keys(_).forEach(C=>{C=="convertName"?(N[0].convert||(N[0].convert={}),N[0].convert.type=_[C]):N[0][C]=_[C]})}}s.value={}}function r(k,m){o();const N={};m=="convertName"?(k.convert||(k.convert={}),N[m]=k.convert?.type):N[m]=k[m]||"",s.value[k.name]=N}function d(k,m){{s.value={};return}}function h(k,m){switch(m){case"query":return k.configs?.query?.enable;case"form":return k.configs?.show?.form?.enable;case"view":return k.configs?.show?.view?.enable;case"list":return k.configs?.show?.list?.enable;case"sort":return k.configs?.sort?.enable}}function c(k,m){switch(m){case"query":k.configs=K.utils.obj.ext(k.configs,{query:{enable:!1}}),k.configs.query.enable=!k.configs.query.enable;break;case"form":k.configs=K.utils.obj.ext(k.configs,{show:{form:{enable:!1}}}),k.configs.show.form.enable=!k.configs.show.form.enable;break;case"view":k.configs=K.utils.obj.ext(k.configs,{show:{view:{enable:!1}}}),k.configs.show.view.enable=!k.configs.show.view.enable;break;case"list":k.configs=K.utils.obj.ext(k.configs,{show:{list:{enable:!1}}}),k.configs.show.list.enable=!k.configs.show.list.enable;break;case"sort":k.configs=K.utils.obj.ext(k.configs,{sort:{enable:!1}}),k.configs.sort.enable=!k.configs.sort.enable;break}console.log("record.configs",k.configs)}const f=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(k,m){switch(f.value.prop=m,f.value.field=k,k.configs||(k.configs={}),k.configs.show||(k.configs.show={}),m){case"query":k.configs.query||(k.configs.query={}),k.configs.query.types||(k.configs.query.types="EQ"),f.value.show=k.configs.query,f.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),f.value.show=k.configs.show.form,f.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),f.value.show=k.configs.show.view,f.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),f.value.show=k.configs.show.list,f.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),f.value.show=k.configs.sort,f.value.title=`排序设置/${k.title}(${k.name})`;break}f.value.visible=!0}const p=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:k=>{const m=p.value.options.filter(N=>N.value==k);return m[0]?m[0].label:k}}),b=n.ref({visible:!1,field:{},props:{},advances:Uh.loadAdvances(),showInfo:k=>{let m=0;if(k.configs?.rule){const N=k.configs.rule;N.advance&&m++,typeof N.rangeMin<"u"&&m++,typeof N.rangeMax<"u"&&m++,typeof N.regExpress<"u"&&m++}if(m>0)return"("+m+")"},toSetting:()=>{const k=b.value.props;b.value.field.configs=K.utils.obj.ext(b.value.field.configs,{rule:{...k}}),b.value.visible=!1,b.value.props={}}});function g(k){b.value.visible=!0,b.value.field=k,b.value.props=k.configs?.rule||{}}const v=n.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:k=>{const m=k.configs?.widget?.name,N=v.value.widgets.filter(_=>_.value==m);return N[0]?N[0].label:m},toSetting:(k,m)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=m},toclose:()=>{v.value.visible=!1}});function x(k){v.value.field=k,k.configs=K.utils.obj.ext(k.configs,{widget:{props:{}}}),v.value.widget=k.configs.widget,v.value.visible=!0}const w=n.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(k,m="--")=>w.value.types.filter(N=>N.value==k)[0]?.label||m,toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(k,m)=>{w.value.convert.options.splice(k,1)},toSetting:()=>{w.value.visible=!1}});function O(k){w.value.visible=!0,w.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),w.value.convert=k.configs.convert}return(k,m)=>{const N=n.resolveComponent("ToolOutlined"),_=n.resolveComponent("a-button"),C=n.resolveComponent("a-select"),y=n.resolveComponent("a-checkbox"),B=n.resolveComponent("a-table"),M=n.resolveComponent("a-switch"),V=n.resolveComponent("a-form-item"),F=n.resolveComponent("a-select-option"),I=n.resolveComponent("a-input-number"),D=n.resolveComponent("a-form"),q=n.resolveComponent("a-modal"),R=n.resolveComponent("a-input"),T=n.resolveComponent("unione-select-box"),P=n.resolveComponent("a-checkbox-group"),A=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",Wh,[n.createVNode(B,{columns:t.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["widget","queryType","rules","convertName"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",Hh,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:U,record:E})=>[["rules"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!b.value.showInfo(E)&&"empty"]),onClick:$=>g(E)},[n.createElementVNode("span",Qh,n.toDisplayString(b.value.showInfo(E)),1),b.value.showInfo(E)?(n.openBlock(),n.createBlock(_,{key:0,type:"link"},{default:n.withCtx(()=>m[50]||(m[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Kh)):["widget"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[E.name]||!Object.keys(s.value[E.name]).includes(S.dataIndex))&&!U&&"empty"]),onClick:$=>r(E,S.dataIndex)},[s.value[E.name]&&Object.keys(s.value[E.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:E.configs?.widget?.name,allowClear:!0,options:v.value.widgets,onChange:$=>v.value.toSetting(E,$),onBlur:m[0]||(m[0]=$=>d())},null,8,["value","options","onChange"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Yh,n.toDisplayString(v.value.widgetName(E)),1)),n.createVNode(_,{type:"link",onClick:n.withModifiers($=>x(E),["stop"])},{default:n.withCtx(()=>m[51]||(m[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Gh)):["convertName"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[E.name]||!Object.keys(s.value[E.name]).includes(S.dataIndex))&&!E.convert?.type&&"empty"]),onClick:$=>O(E)},[E.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Jh,n.toDisplayString(w.value.getTypes(E.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Xh)):["query","form","view","list","sort"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",Zh,[n.createVNode(y,{checked:h(E,S.dataIndex),onClick:$=>c(E,S.dataIndex)},null,8,["checked","onClick"]),n.createVNode(_,{type:"link",onClick:$=>u(E,S.dataIndex)},{default:n.withCtx(()=>m[52]||(m[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(q,{visible:f.value.visible,"onUpdate:visible":m[14]||(m[14]=S=>f.value.visible=S),width:600,title:f.value.title,onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(D,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:n.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:n.withCtx(()=>[n.createVNode(V,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.enable,"onUpdate:checked":m[1]||(m[1]=S=>f.value.show.enable=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(n.openBlock(),n.createBlock(V,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.defoult,"onUpdate:checked":m[2]||(m[2]=S=>f.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="sort"?(n.openBlock(),n.createBlock(V,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.asc,"onUpdate:checked":m[3]||(m[3]=S=>f.value.show.asc=S),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(V,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.defoult,"onUpdate:checked":m[4]||(m[4]=S=>f.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.visible,"onUpdate:checked":m[5]||(m[5]=S=>f.value.show.visible=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.types,"onUpdate:value":m[6]||(m[6]=S=>f.value.show.types=S)},{default:n.withCtx(()=>[n.createVNode(F,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>m[53]||(m[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(F,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>m[54]||(m[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(F,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>m[55]||(m[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(F,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>m[56]||(m[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(F,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>m[57]||(m[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(F,{key:"ADVANCE",value:"ADVANCE"},{default:n.withCtx(()=>m[58]||(m[58]=[n.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(V,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(I,{value:f.value.show.index,"onUpdate:value":m[7]||(m[7]=S=>f.value.show.index=S)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(I,{min:0,max:24,value:f.value.show.width,"onUpdate:value":m[8]||(m[8]=S=>f.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(I,{min:0,value:f.value.show.width,"onUpdate:value":m[9]||(m[9]=S=>f.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(I,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":m[10]||(m[10]=S=>f.value.show.labelWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(I,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":m[11]||(m[11]=S=>f.value.show.valueWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.fixed,"onUpdate:value":m[12]||(m[12]=S=>f.value.show.fixed=S),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.align,"onUpdate:value":m[13]||(m[13]=S=>f.value.show.align=S),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),n.createVNode(q,{visible:w.value.visible,"onUpdate:visible":m[33]||(m[33]=S=>w.value.visible=S),width:600,title:w.value.getTypes(w.value.convert.types,"转换")+"设置",onOk:w.value.toSetting},{default:n.withCtx(()=>[n.createVNode(D,{model:w.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(V,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:w.value.convert.types,"onUpdate:value":m[15]||(m[15]=S=>w.value.convert.types=S),allowClear:!0,options:w.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(w.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.convert.search,"onUpdate:checked":m[16]||(m[16]=S=>f.value.convert.search=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="option"?(n.openBlock(),n.createBlock(V,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(_,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:n.withCtx(()=>m[59]||(m[59]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(B,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:S,record:U,index:E})=>[S.dataIndex==="label"?(n.openBlock(),n.createBlock(R,{key:0,value:U.label,"onUpdate:value":$=>U.label=$,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="value"?(n.openBlock(),n.createBlock(R,{key:1,value:U.value,"onUpdate:value":$=>U.value=$,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:$=>w.value.toDelOption(E,U)},"删除",8,ef)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(w.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(T,{value:w.value.convert.dsId,"onUpdate:value":m[17]||(m[17]=S=>w.value.convert.dsId=S),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.tableName,"onUpdate:value":m[18]||(m[18]=S=>w.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.tableName,"onUpdate:value":m[19]||(m[19]=S=>w.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.idField,"onUpdate:value":m[20]||(m[20]=S=>w.value.convert.idField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.pidField,"onUpdate:value":m[21]||(m[21]=S=>w.value.convert.pidField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.valueField,"onUpdate:value":m[22]||(m[22]=S=>w.value.convert.valueField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.labelField,"onUpdate:value":m[23]||(m[23]=S=>w.value.convert.labelField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.tableField,"onUpdate:value":m[24]||(m[24]=S=>w.value.convert.tableField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.tableWhere,"onUpdate:value":m[25]||(m[25]=S=>w.value.convert.tableWhere=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.tableOrder,"onUpdate:value":m[26]||(m[26]=S=>w.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.tableOrder,"onUpdate:value":m[27]||(m[27]=S=>w.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:w.value.convert.isAsync,"onUpdate:checked":m[28]||(m[28]=S=>w.value.convert.isAsync=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:w.value.convert.isPaging,"onUpdate:checked":m[29]||(m[29]=S=>w.value.convert.isPaging=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dict"?(n.openBlock(),n.createBlock(V,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.dictName,"onUpdate:value":m[30]||(m[30]=S=>w.value.convert.dictName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode(R,{value:w.value.convert.url,"onUpdate:value":m[31]||(m[31]=S=>w.value.convert.url=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:w.value.convert.params,"onUpdate:modelValue":m[32]||(m[32]=S=>w.value.convert.params=S),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(q,{visible:v.value.visible,"onUpdate:visible":m[40]||(m[40]=S=>v.value.visible=S),width:600,title:"控件设置",onOk:v.value.toclose},{default:n.withCtx(()=>[n.createVNode(D,{model:v.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(V,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(C,{value:v.value.widget.name,"onUpdate:value":m[34]||(m[34]=S=>v.value.widget.name=S),allowClear:!0,options:v.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),n.createVNode(V,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode(R,{value:v.value.widget.placeholder,"onUpdate:value":m[35]||(m[35]=S=>v.value.widget.placeholder=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode(R,{value:v.value.widget.help,"onUpdate:value":m[36]||(m[36]=S=>v.value.widget.help=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode(R,{value:v.value.widget.tooltip,"onUpdate:value":m[37]||(m[37]=S=>v.value.widget.tooltip=S)},null,8,["value"])]),_:1}),["a-date-picker"].includes(v.value.widget.name)?(n.openBlock(),n.createBlock(V,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode(R,{value:v.value.field.dataFormat,"onUpdate:value":m[38]||(m[38]=S=>v.value.field.dataFormat=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(V,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:v.value.widget.props.mode,"onUpdate:value":m[39]||(m[39]=S=>v.value.widget.props.mode=S),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(F,{value:"multiple"},{default:n.withCtx(()=>m[60]||(m[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(F,{value:"tags"},{default:n.withCtx(()=>m[61]||(m[61]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(q,{visible:b.value.visible,"onUpdate:visible":m[49]||(m[49]=S=>b.value.visible=S),width:600,title:"规则设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(D,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(A,{title:"基本设置",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(P,{value:b.value.props.trigger,"onUpdate:value":m[41]||(m[41]=S=>b.value.props.trigger=S),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(V,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(y,{checked:b.value.props.whitespace,"onUpdate:checked":m[42]||(m[42]=S=>b.value.props.whitespace=S)},{default:n.withCtx(()=>m[62]||(m[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(V,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(C,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":m[43]||(m[43]=S=>b.value.props.advance=S)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(n.openBlock(),n.createBlock(A,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(I,{value:b.value.props.rangeMin,"onUpdate:value":m[44]||(m[44]=S=>b.value.props.rangeMin=S)},null,8,["value"]),m[63]||(m[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(I,{value:b.value.props.rangeMax,"onUpdate:value":m[45]||(m[45]=S=>b.value.props.rangeMax=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(R,{value:b.value.props.rangeMessage,"onUpdate:value":m[46]||(m[46]=S=>b.value.props.rangeMessage=S)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(A,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(R,{value:b.value.props.regExpress,"onUpdate:value":m[47]||(m[47]=S=>b.value.props.regExpress=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(R,{value:b.value.props.regMessage,"onUpdate:value":m[48]||(m[48]=S=>b.value.props.regMessage=S)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),nf={class:"unione-props-setting data-field-fkey"},lf={key:0},sf=["onClick"],of=["onClick"],af=["onClick"],rf=["onClick"],df=["onClick"],cf=["onClick"],hf=["onClick"],ff=["onClick"],uf=Z(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),i=n.useModel(a,"modelValue"),l=n.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),s=n.ref({});function o(){s.value={}}function r(u,p){o();const b={};b[p]=u.configs.fkey[p]||"",s.value[u.name]=b}function d(u,p,b){u.configs.fkey.dsn=p,u.configs.fkey.dsnName=b.name,u.configs.fkey.dsnTitle=b.title,u.configs.fkey.dsnId=b.id}function h(u,p,b,g){u.configs.fkey[p]=b,p=="fieldName"&&(u.configs.fkey.fieldTitle=g.title),p=="labelName"&&(u.configs.fkey.labelTitle=g.title)}function c(u){f.value.record=u,f.value.visible=!0,f.value.fields=u.configs?.fkey?.fields||[]}const f=n.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(u,p)=>{f.value.editField[u]=p},onShowFieldChange:(u,p,b)=>{u.name=b.name,u.title=b.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(u,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=K.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,p)=>{const b=n.resolveComponent("FormOutlined"),g=n.resolveComponent("unione-select-box"),v=n.resolveComponent("a-button"),x=n.resolveComponent("a-table"),w=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",nf,[n.createVNode(x,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:n.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(n.openBlock(),n.createElementBlock("span",lf,[n.createVNode(b),n.createTextVNode(" "+n.toDisplayString(k.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:k,record:m})=>[["dsnName"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(k.dataIndex))&&!m.configs?.fkey?.dsnName&&"empty"]),onClick:N=>r(m,k.dataIndex)},[s.value[m.name]&&Object.keys(s.value[m.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[m.name][k.dataIndex],"onUpdate:value":N=>s.value[m.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:o,onSelect:(N,_)=>d(m,N,_)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.dsnName),1)],64))],10,sf)):["dsnTitle"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(k.dataIndex))&&!m.configs?.fkey?.dsnTitle&&"empty"]),onClick:N=>r(m,k.dataIndex)},[s.value[m.name]&&Object.keys(s.value[m.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[m.name][k.dataIndex],"onUpdate:value":N=>s.value[m.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:o,onSelect:(N,_)=>d(m,N,_)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.dsnTitle),1)],64))],10,of)):n.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(k.dataIndex))&&!m.configs?.fkey?.fieldName&&"empty"]),onClick:N=>r(m,k.dataIndex)},[s.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(s.value[m.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[m.name][k.dataIndex],"onUpdate:value":N=>s.value[m.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:o,onSelect:(N,_)=>h(m,"fieldName",N,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.fieldTitle),1)],64))],10,af)):["labelName"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(k.dataIndex))&&!m.configs?.fkey?.labelName&&"empty"]),onClick:N=>r(m,k.dataIndex)},[s.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(s.value[m.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[m.name][k.dataIndex],"onUpdate:value":N=>s.value[m.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:o,onSelect:(N,_)=>h(m,"labelName",N,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.labelTitle)+" ",1),m.configs?.fkey?.labelName?(n.openBlock(),n.createBlock(v,{key:0,type:"link",onClick:n.withModifiers(N=>c(m),["stop"])},{default:n.withCtx(()=>p[4]||(p[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,rf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(O,{visible:f.value.visible,"onUpdate:visible":p[3]||(p[3]=k=>f.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(v,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:n.withCtx(()=>p[5]||(p[5]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(x,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:n.withCtx(({column:k,record:m,index:N,text:_})=>[k.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",f.value.editField!="title"&&!_&&"empty"]),onClick:C=>f.value.toEditField(N,k.dataIndex)},[f.value.editField[N]=="title"?(n.openBlock(),n.createBlock(g,{key:0,value:m[m.dataIndex],"onUpdate:value":C=>m[m.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:p[0]||(p[0]=C=>f.value.editField={}),onSelect:(C,y)=>f.value.onShowFieldChange(m,C,y)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,df)):n.createCommentVNode("",!0),k.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",f.value.editField!="width"&&!_&&"empty"]),onClick:C=>f.value.toEditField(N,k.dataIndex)},[f.value.editField[N]=="width"?(n.openBlock(),n.createBlock(w,{key:0,onBlur:p[1]||(p[1]=C=>f.value.editField={}),value:m.width,"onUpdate:value":C=>m.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,cf)):n.createCommentVNode("",!0),k.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!_&&"empty"]),onClick:C=>f.value.toEditField(N,k.dataIndex)},[f.value.editField[N]=="index"?(n.openBlock(),n.createBlock(w,{key:0,onBlur:p[2]||(p[2]=C=>f.value.editField={}),value:m.index,"onUpdate:value":C=>m.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,hf)):n.createCommentVNode("",!0),k.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:C=>f.value.toDelField(N)},"删除",8,ff)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),pf={class:"unione-props-setting data-filter"},mf={class:"title"},gf={class:"name"},kf={class:"action"},bf=Z(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),t=n.useModel(a,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(h){r.value.visible=!0,r.value.filter={...h},r.value.name=h.name}function s(h){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(h,1)}})}const o=n.ref(),r=n.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{o.value.validate().then(h=>{if(r.value.name){const c=t.value.filter(f=>f.name==r.value.name)[0];if(!c){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(h).forEach(f=>{c[f]=h[f]})}else{if(t.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(h)}r.value.visible=!1})}});function d(){const h=[];r.value.filter.filter||(r.value.filter.filter=""),h.push("-- @if(isNotEmpty(params."),h.push(r.value.filter.name||"xxx"),h.push(") && !isBlank(params."),h.push(r.value.filter.name||"xxx"),h.push(`)
|
|
7
|
+
`;this.styleTag.textContent=o;let r=t.head||t;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Ot={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Tn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pe=0;pe<10;pe++)Ot[48+pe]=Ot[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Ot[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Ot[pe]=String.fromCharCode(pe+32),Tn[pe]=String.fromCharCode(pe);for(var An in Ot)Tn.hasOwnProperty(An)||(Tn[An]=Ot[An]);function Jt(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function En(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function ic(a){let e=a.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ti(a,e){if(!e.anchorNode)return!1;try{return En(a,e.anchorNode)}catch{return!1}}function Zt(a){return a.nodeType==3?kt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function ei(a,e,t,i){return t?xs(a,e,t,i,-1)||xs(a,e,t,i,1):!1}function gt(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function Ai(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function xs(a,e,t,i,l){for(;;){if(a==t&&e==i)return!0;if(e==(l<0?0:Ye(a))){if(a.nodeName=="DIV")return!1;let s=a.parentNode;if(!s||s.nodeType!=1)return!1;e=gt(a)+(l<0?0:1),a=s}else if(a.nodeType==1){if(a=a.childNodes[e+(l<0?-1:0)],a.nodeType==1&&a.contentEditable=="false")return!1;e=l<0?Ye(a):0}else return!1}}function Ye(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Ei(a,e){let t=e?a.left:a.right;return{left:t,right:t,top:a.top,bottom:a.bottom}}function nc(a){let e=a.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:a.innerWidth,top:0,bottom:a.innerHeight}}function vs(a,e){let t=e.width/a.offsetWidth,i=e.height/a.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-a.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-a.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function lc(a,e,t,i,l,s,o,r){let d=a.ownerDocument,h=d.defaultView||window;for(let c=a,f=!1;c&&!f;)if(c.nodeType==1){let u,m=c==d.body,b=1,g=1;if(m)u=nc(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let x=c.getBoundingClientRect();({scaleX:b,scaleY:g}=vs(c,x)),u={left:x.left,right:x.left+c.clientWidth*b,top:x.top,bottom:x.top+c.clientHeight*g}}let v=0,w=0;if(l=="nearest")e.top<u.top?(w=-(u.top-e.top+o),t>0&&e.bottom>u.bottom+w&&(w=e.bottom-u.bottom+w+o)):e.bottom>u.bottom&&(w=e.bottom-u.bottom+o,t<0&&e.top-w<u.top&&(w=-(u.top+w-e.top+o)));else{let x=e.bottom-e.top,O=u.bottom-u.top;w=(l=="center"&&x<=O?e.top+x/2-O/2:l=="start"||l=="center"&&t<0?e.top-o:e.bottom-O+o)-u.top}if(i=="nearest"?e.left<u.left?(v=-(u.left-e.left+s),t>0&&e.right>u.right+v&&(v=e.right-u.right+v+s)):e.right>u.right&&(v=e.right-u.right+s,t<0&&e.left<u.left+v&&(v=-(u.left+v-e.left+s))):v=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-s:e.right-(u.right-u.left)+s)-u.left,v||w)if(m)h.scrollBy(v,w);else{let x=0,O=0;if(w){let k=c.scrollTop;c.scrollTop+=w/g,O=(c.scrollTop-k)*g}if(v){let k=c.scrollLeft;c.scrollLeft+=v/b,x=(c.scrollLeft-k)*b}e={left:e.left-x,top:e.top-O,right:e.right-x,bottom:e.bottom-O},x&&Math.abs(x-v)<1&&(i="nearest"),O&&Math.abs(O-w)<1&&(l="nearest")}if(m)break;c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function sc(a){let e=a.ownerDocument,t,i;for(let l=a.parentNode;l&&!(l==e.body||t&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=l),!t&&l.scrollWidth>l.clientWidth&&(t=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:t,y:i}}class oc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Ye(t):0),i,Math.min(e.focusOffset,i?Ye(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let Vt=null;function Cs(a){if(a.setActive)return a.setActive();if(Vt)return a.focus(Vt);let e=[];for(let t=a;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(a.focus(Vt==null?{get preventScroll(){return Vt={preventScroll:!0},!0}}:void 0),!Vt){Vt=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],s=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=s&&(i.scrollLeft=s)}}}let Ss;function kt(a,e,t=e){let i=Ss||(Ss=document.createRange());return i.setEnd(a,t),i.setStart(a,e),i}function _t(a,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let s=new KeyboardEvent("keydown",l);s.synthetic=!0,a.dispatchEvent(s);let o=new KeyboardEvent("keyup",l);return o.synthetic=!0,a.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function ac(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Ns(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function rc(a,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Ye(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Ye(t))}else{if(t==a)return!0;i=gt(t),t=t.parentNode}}function Bs(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function Os(a,e){for(let t=a,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Ye(t)}else if(t.parentNode&&!Ai(t))i=gt(t),t=t.parentNode;else return null}}function Vs(a,e){for(let t=a,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!Ai(t))i=gt(t)+1,t=t.parentNode;else return null}}class ye{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ye(e.parentNode,gt(e),t)}static after(e,t){return new ye(e.parentNode,gt(e)+1,t)}}const In=[];class ne{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,l=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=l?l.nextSibling:i.firstChild)){let r=ne.get(s);(!r||!r.parent&&r.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=l?l.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&s!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;s&&s!=o.dom;)s=_s(s);else i.insertBefore(o.dom,s);l=o.dom}for(s=l?l.nextSibling:i.firstChild,s&&t&&t.node==i&&(t.written=!0);s;)s=_s(s)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let l=Ye(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;l==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?l=-1:l=1),e=s}l<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!ne.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,s=0;;l++){let o=this.children[l];if(o.dom==i)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,i=0){let l=-1,s=-1,o=-1,r=-1;for(let d=0,h=i,c=i;d<this.children.length;d++){let f=this.children[d],u=h+f.length;if(h<e&&u>t)return f.domBoundsAround(e,t,h);if(u>=e&&l==-1&&(l=d,s=h),h>t&&f.dom.parentNode==this.dom){o=d,r=c;break}c=u,h=u+f.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=In){this.markDirty();for(let l=e;l<t;l++){let s=this.children[l];s.parent==this&&i.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...i);for(let l=0;l<i.length;l++)i[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ms(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,i,l,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}ne.prototype.breakAfter=0;function _s(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Ms{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Ts(a,e,t,i,l,s,o,r,d){let{children:h}=a,c=h.length?h[e]:null,f=s.length?s[s.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&s.length<2&&c.merge(t,l,s.length?f:null,t==0,r,d))){if(i<h.length){let m=h[i];m&&(l<m.length||m.breakAfter&&f?.breakAfter)?(e==i&&(m=m.split(l),l=0),!u&&f&&m.merge(0,l,f,!0,0,d)?s[s.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,d),s.push(m))):m?.breakAfter&&(f?f.breakAfter=1:o=1),i++}for(c&&(c.breakAfter=o,t>0&&(!o&&s.length&&c.merge(t,c.length,s[0],!1,r,0)?c.breakAfter=s.shift().breakAfter:(t<c.length||c.children.length&&c.children[c.children.length-1].length==0)&&c.merge(t,c.length,null,!1,r,0),e++));e<i&&s.length;)if(h[i-1].become(s[s.length-1]))i--,s.pop(),d=s.length?0:r;else if(h[e].become(s[0]))e++,s.shift(),r=s.length?0:d;else break;!s.length&&e&&i<h.length&&!h[e-1].breakAfter&&h[i].merge(0,0,h[e-1],!1,r,d)&&e--,(e<i||s.length)&&a.replaceChildren(e,i,s)}}function As(a,e,t,i,l,s){let o=a.childCursor(),{i:r,off:d}=o.findPos(t,1),{i:h,off:c}=o.findPos(e,-1),f=e-t;for(let u of i)f+=u.length;a.length+=f,Ts(a,h,c,r,d,i,0,l,s)}let Se=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Dn=typeof document<"u"?document:{documentElement:{style:{}}};const Pn=/Edge\/(\d+)/.exec(Se.userAgent),Es=/MSIE \d/.test(Se.userAgent),Fn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Se.userAgent),Ii=!!(Es||Fn||Pn),Is=!Ii&&/gecko\/(\d+)/i.test(Se.userAgent),$n=!Ii&&/Chrome\/(\d+)/.exec(Se.userAgent),Ds="webkitFontSmoothing"in Dn.documentElement.style,Ps=!Ii&&/Apple Computer/.test(Se.vendor),Fs=Ps&&(/Mobile\/\w+/.test(Se.userAgent)||Se.maxTouchPoints>2);var W={mac:Fs||/Mac/.test(Se.platform),windows:/Win/.test(Se.platform),linux:/Linux|X11/.test(Se.platform),ie:Ii,ie_version:Es?Dn.documentMode||6:Fn?+Fn[1]:Pn?+Pn[1]:0,gecko:Is,gecko_version:Is?+(/Firefox\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,chrome:!!$n,chrome_version:$n?+$n[1]:0,ios:Fs,android:/Android\b/.test(Se.userAgent),webkit:Ds,safari:Ps,webkit_version:Ds?+(/\bAppleWebKit\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,tabSize:Dn.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const dc=256;class Ee extends ne{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof Ee)||this.length-(t-e)+i.length>dc||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ee(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return cc(this.dom,e,t)}}class Xe extends ne{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let l of t)l.setParent(this)}setAttrs(e){if(Ns(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,l,s,o){return i&&(!(i instanceof Xe&&i.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(As(this,e,t,i?i.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],i=0,l=-1,s=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=s),i=d,s++}let o=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new Xe(this.mark,t,o)}domAtPos(e){return $s(this,e)}coordsAt(e,t){return Ls(this,e,t)}}function cc(a,e,t){let i=a.nodeValue.length;e>i&&(e=i);let l=e,s=e,o=0;e==0&&t<0||e==i&&t>=0?W.chrome||W.gecko||(e?(l--,o=1):s<i&&(s++,o=-1)):t<0?l--:s<i&&s++;let r=kt(a,l,s).getClientRects();if(!r.length)return null;let d=r[(o?o<0:t>=0)?0:r.length-1];return W.safari&&!o&&d.width==0&&(d=Array.prototype.find.call(r,h=>h.width)||d),o?Ei(d,o<0):d||null}class bt extends ne{static create(e,t,i){return new bt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=bt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,l,s,o){return i&&(!(i instanceof bt)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e instanceof bt&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return X.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):X.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let l=this.dom.getClientRects(),s=null;if(!l.length)return null;let o=this.side?this.side<0:e>0;for(let r=o?l.length-1:0;s=l[r],!(e>0?r==0:r==l.length-1||s.top<s.bottom);r+=o?-1:1);return Ei(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Mt extends ne{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Mt&&e.side==this.side}split(){return new Mt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return X.empty}get isHidden(){return!0}}Ee.prototype.children=bt.prototype.children=Mt.prototype.children=In;function $s(a,e){let t=a.dom,{children:i}=a,l=0;for(let s=0;l<i.length;l++){let o=i[l],r=s+o.length;if(!(r==s&&o.getSide()<=0)){if(e>s&&e<r&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=r}}for(let s=l;s>0;s--){let o=i[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=l;s<i.length;s++){let o=i[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new ye(t,0)}function Rs(a,e,t){let i,{children:l}=a;t>0&&e instanceof Xe&&l.length&&(i=l[l.length-1])instanceof Xe&&i.mark.eq(e.mark)?Rs(i,e.children[0],t-1):(l.push(e),e.setParent(a)),a.length+=e.length}function Ls(a,e,t){let i=null,l=-1,s=null,o=-1;function r(h,c){for(let f=0,u=0;f<h.children.length&&u<=c;f++){let m=h.children[f],b=u+m.length;b>=c&&(m.children.length?r(m,c-u):(!s||s.isHidden&&t>0)&&(b>c||u==b&&m.getSide()>0)?(s=m,o=c-u):(u<c||u==b&&m.getSide()<0&&!m.isHidden)&&(i=m,l=c-u)),u=b}}r(a,e);let d=(t<0?i:s)||i||s;return d?d.coordsAt(Math.max(0,d==i?l:o),t):hc(a)}function hc(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let t=Zt(e);return t[t.length-1]||null}function Rn(a,e){for(let t in a)t=="class"&&e.class?e.class+=" "+a.class:t=="style"&&e.style?e.style+=";"+a.style:e[t]=a[t];return e}const js=Object.create(null);function Di(a,e,t){if(a==e)return!0;a||(a=js),e||(e=js);let i=Object.keys(a),l=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(l.indexOf(s)==-1||a[s]!==e[s]))return!1;return!0}function Ln(a,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?a.style.cssText=t[l]:a.setAttribute(l,t[l]));return i}function fc(a){let e=Object.create(null);for(let t=0;t<a.attributes.length;t++){let i=a.attributes[t];e[i.name]=i.value}return e}class jn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Le=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Le||(Le={}));class we extends Bt{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new ti(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new st(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:s,end:o}=zs(e,t);i=(s?t?-3e8:-1:5e8)-1,l=(o?t?2e8:1:-6e8)+1}return new st(e,i,l,t,e.widget||null,!0)}static line(e){return new ii(e)}static set(e,t=!1){return se.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=se.empty;class ti extends we{constructor(e){let{start:t,end:i}=zs(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof ti&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Di(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ti.prototype.point=!1;class ii extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ii&&this.spec.class==e.spec.class&&Di(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}ii.prototype.mapMode=Be.TrackBefore,ii.prototype.point=!0;class st extends we{constructor(e,t,i,l,s,o){super(t,i,s,e),this.block=l,this.isReplace=o,this.mapMode=l?t<=0?Be.TrackBefore:Be.TrackAfter:Be.TrackDel}get type(){return this.startSide!=this.endSide?Le.WidgetRange:this.startSide<=0?Le.WidgetBefore:Le.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof st&&uc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}st.prototype.point=!0;function zs(a,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=a;return t==null&&(t=a.inclusive),i==null&&(i=a.inclusive),{start:t??e,end:i??e}}function uc(a,e){return a==e||!!(a&&e&&a.compare(e))}function zn(a,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=a?t[l]=Math.max(t[l],e):t.push(a,e)}class ce extends ne{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,l,s,o){if(i){if(!(i instanceof ce))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),As(this,e,t,i?i.children.slice():[],s,o),!0}split(e){let t=new ce;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:l}=this.childPos(e);l&&(t.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let s=i;s<this.children.length;s++)t.append(this.children[s],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Di(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Rs(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Rn(t,this.attrs||{})),i&&(this.attrs=Rn({class:i},this.attrs||{}))}domAtPos(e){return $s(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Ns(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Ln(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let l=this.dom.lastChild;for(;l&&ne.get(l)instanceof Xe;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=ne.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!W.ios||!this.children.some(s=>s instanceof Ee))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ee)||/[^ -~]/.test(i.text))return null;let l=Zt(i.dom);if(l.length!=1)return null;e+=l[0].width,t=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Ls(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-l.lineHeight)<2&&l.textHeight<s){let o=(s-l.textHeight)/2;return{top:i.top+o,bottom:i.bottom-o,left:i.left,right:i.left}}}return i}become(e){return e instanceof ce&&this.children.length==0&&e.children.length==0&&Di(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,l=0;i<e.children.length;i++){let s=e.children[i],o=l+s.length;if(o>=t){if(s instanceof ce)return s;if(o>t)break}l=o+s.breakAfter}return null}}class Je extends ne{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,l,s,o){return i&&(!(i instanceof Je)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?ye.before(this.dom):ye.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let i=new Je(this.widget,t,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return In}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):X.empty}domBoundsAround(){return null}become(e){return e instanceof Je&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);return i||(this.widget instanceof qn?null:Ei(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:i}=this.deco;return t==i?!1:e<0?t<0:i>0}}class qn extends jn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class ni{constructor(e,t,i,l){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Je&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ce),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Pi(new Mt(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Je)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Pi(new Ee(this.text.slice(this.textOff,this.textOff+l)),t),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,t,i,l){this.buildText(t-e,i,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,i,l,s,o){if(this.disallowBlockEffectsFor[o]&&i instanceof st){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=t-e;if(i instanceof st)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Je(i.widget||Tt.block,r,i));else{let d=bt.create(i.widget||Tt.inline,r,r?0:i.startSide),h=this.atCursorPos&&!d.isEditable&&s<=l.length&&(e<t||i.startSide>0),c=!d.isEditable&&(e<t||s>l.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),h&&(f.append(Pi(new Mt(1),l),s),s=l.length+Math.max(0,s-l.length)),f.append(Pi(d,l),s),this.atCursorPos=c,this.pendingBuffer=c?e<t||s>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,i,l,s){let o=new ni(e,t,i,s);return o.openEnd=se.spans(l,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Pi(a,e){for(let t of e)a=new Xe(t,[a],a.length);return a}class Tt extends jn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Tt.inline=new Tt("span"),Tt.block=new Tt("div");var me=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(me||(me={}));const yt=me.LTR,Un=me.RTL;function qs(a){let e=[];for(let t=0;t<a.length;t++)e.push(1<<+a[t]);return e}const pc=qs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),mc=qs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Wn=Object.create(null),je=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),t=a.charCodeAt(1);Wn[e]=t,Wn[t]=-e}function Us(a){return a<=247?pc[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?mc[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const gc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ot{get dir(){return this.level%2?Un:yt}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,l){let s=-1;for(let o=0;o<e.length;o++){let r=e[o];if(r.from<=t&&r.to>=t){if(r.level==i)return o;(s<0||(l!=0?l<0?r.from<t:r.to>t:e[s].level>r.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Ws(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++){let i=a[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!Ws(i.inner,l.inner))return!1}return!0}const le=[];function kc(a,e,t,i,l){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:e,r=s<i.length?i[s].from:t,d=s?256:l;for(let h=o,c=d,f=d;h<r;h++){let u=Us(a.charCodeAt(h));u==512?u=c:u==8&&f==4&&(u=16),le[h]=u==4?2:u,u&7&&(f=u),c=u}for(let h=o,c=d,f=d;h<r;h++){let u=le[h];if(u==128)h<r-1&&c==le[h+1]&&c&24?u=le[h]=c:le[h]=256;else if(u==64){let m=h+1;for(;m<r&&le[m]==64;)m++;let b=h&&c==8||m<t&&le[m]==8?f==1?1:8:256;for(let g=h;g<m;g++)le[g]=b;h=m-1}else u==8&&f==1&&(le[h]=1);c=u,u&7&&(f=u)}}}function bc(a,e,t,i,l){let s=l==1?2:1;for(let o=0,r=0,d=0;o<=i.length;o++){let h=o?i[o-1].to:e,c=o<i.length?i[o].from:t;for(let f=h,u,m,b;f<c;f++)if(m=Wn[u=a.charCodeAt(f)])if(m<0){for(let g=r-3;g>=0;g-=3)if(je[g+1]==-m){let v=je[g+2],w=v&2?l:v&4?v&1?s:l:0;w&&(le[f]=le[je[g]]=w),r=g;break}}else{if(je.length==189)break;je[r++]=f,je[r++]=u,je[r++]=d}else if((b=le[f])==2||b==1){let g=b==l;d=g?0:1;for(let v=r-3;v>=0;v-=3){let w=je[v+2];if(w&2)break;if(g)je[v+2]|=2;else{if(w&4)break;je[v+2]|=4}}}}}function yc(a,e,t,i){for(let l=0,s=i;l<=t.length;l++){let o=l?t[l-1].to:a,r=l<t.length?t[l].from:e;for(let d=o;d<r;){let h=le[d];if(h==256){let c=d+1;for(;;)if(c==r){if(l==t.length)break;c=t[l++].to,r=l<t.length?t[l].from:e}else if(le[c]==256)c++;else break;let f=s==1,u=(c<e?le[c]:i)==1,m=f==u?f?1:2:i;for(let b=c,g=l,v=g?t[g-1].to:a;b>d;)b==v&&(b=t[--g].from,v=g?t[g-1].to:a),le[--b]=m;d=c}else s=h,d++}}}function Hn(a,e,t,i,l,s,o){let r=i%2?2:1;if(i%2==l%2)for(let d=e,h=0;d<t;){let c=!0,f=!1;if(h==s.length||d<s[h].from){let g=le[d];g!=r&&(c=!1,f=g==16)}let u=!c&&r==1?[]:null,m=c?i:i+1,b=d;e:for(;;)if(h<s.length&&b==s[h].from){if(f)break e;let g=s[h];if(!c)for(let v=g.to,w=h+1;;){if(v==t)break e;if(w<s.length&&s[w].from==v)v=s[w++].to;else{if(le[v]==r)break e;break}}if(h++,u)u.push(g);else{g.from>d&&o.push(new ot(d,g.from,m));let v=g.direction==yt!=!(m%2);Kn(a,v?i+1:i,l,g.inner,g.from,g.to,o),d=g.to}b=g.to}else{if(b==t||(c?le[b]!=r:le[b]==r))break;b++}u?Hn(a,d,b,i+1,l,u,o):d<b&&o.push(new ot(d,b,m)),d=b}else for(let d=t,h=s.length;d>e;){let c=!0,f=!1;if(!h||d>s[h-1].to){let g=le[d-1];g!=r&&(c=!1,f=g==16)}let u=!c&&r==1?[]:null,m=c?i:i+1,b=d;e:for(;;)if(h&&b==s[h-1].to){if(f)break e;let g=s[--h];if(!c)for(let v=g.from,w=h;;){if(v==e)break e;if(w&&s[w-1].to==v)v=s[--w].from;else{if(le[v-1]==r)break e;break}}if(u)u.push(g);else{g.to<d&&o.push(new ot(g.to,d,m));let v=g.direction==yt!=!(m%2);Kn(a,v?i+1:i,l,g.inner,g.from,g.to,o),d=g.from}b=g.from}else{if(b==e||(c?le[b-1]!=r:le[b-1]==r))break;b--}u?Hn(a,b,d,i+1,l,u,o):b<d&&o.push(new ot(b,d,m)),d=b}}function Kn(a,e,t,i,l,s,o){let r=e%2?2:1;kc(a,l,s,i,r),bc(a,l,s,i,r),yc(l,s,i,r),Hn(a,l,s,e,t,i,o)}function wc(a,e,t){if(!a)return[new ot(0,0,e==Un?1:0)];if(e==yt&&!t.length&&!gc.test(a))return Hs(a.length);if(t.length)for(;a.length>le.length;)le[le.length]=256;let i=[],l=e==yt?0:1;return Kn(a,l,l,t,0,a.length,i),i}function Hs(a){return[new ot(0,a,0)]}let Ks="";function xc(a,e,t,i,l){var s;let o=i.head-a.from,r=ot.find(e,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),d=e[r],h=d.side(l,t);if(o==h){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;d=e[r=u],o=d.side(!l,t),h=d.side(l,t)}let c=Ke(a.text,o,d.forward(l,t));(c<d.from||c>d.to)&&(c=h),Ks=a.text.slice(Math.min(o,c),Math.max(o,c));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&c==h&&f.level+(l?0:1)<d.level?H.cursor(f.side(!l,t)+a.from,f.forward(l,t)?1:-1,f.level):H.cursor(c+a.from,d.forward(l,t)?-1:1,d.level)}function vc(a,e,t){for(let i=e;i<t;i++){let l=Us(a.charCodeAt(i));if(l==1)return yt;if(l==2||l==4)return Un}return yt}const Qs=Q.define(),Gs=Q.define(),Ys=Q.define(),Xs=Q.define(),Qn=Q.define(),Js=Q.define(),Zs=Q.define(),Gn=Q.define(),Yn=Q.define(),eo=Q.define({combine:a=>a.some(e=>e)}),Cc=Q.define({combine:a=>a.some(e=>e)}),to=Q.define();class At{constructor(e,t="nearest",i="nearest",l=5,s=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new At(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new At(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Fi=he.define({map:(a,e)=>a.map(e)}),io=he.define();function ze(a,e,t){let i=a.facet(Xs);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const at=Q.define({combine:a=>a.length?a[0]:!0});let Sc=0;const li=Q.define();class Et{constructor(e,t,i,l,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:s,decorations:o}=t||{};return new Et(Sc++,e,i,l,r=>{let d=[li.of(r)];return o&&d.push(si.of(h=>{let c=h.plugin(r);return c?o(c):we.none})),s&&d.push(s(r)),d})}static fromClass(e,t){return Et.define(i=>new e(i),t)}}class Xn{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(ze(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){ze(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){ze(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const no=Q.define(),Jn=Q.define(),si=Q.define(),lo=Q.define(),Zn=Q.define(),so=Q.define();function oo(a,e){let t=a.state.facet(so);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(a):s),l=[];return se.spans(i,e.from,e.to,{point(){},span(s,o,r,d){let h=s-e.from,c=o-e.from,f=l;for(let u=r.length-1;u>=0;u--,d--){let m=r[u].spec.bidiIsolate,b;if(m==null&&(m=vc(e.text,h,c)),d>0&&f.length&&(b=f[f.length-1]).to==h&&b.direction==m)b.to=c,f=b.inner;else{let g={from:h,to:c,direction:m,inner:[]};f.push(g),f=g.inner}}}}),l}const ao=Q.define();function ro(a){let e=0,t=0,i=0,l=0;for(let s of a.state.facet(ao)){let o=s(a);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(l=Math.max(l,o.bottom)))}return{left:e,right:t,top:i,bottom:l}}const oi=Q.define();class Me{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}join(e){return new Me(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,s=0,o=0,r=0;;l++){let d=l==e.length?null:e[l],h=o-r,c=d?d.fromB:1e9;for(;s<t.length&&t[s]<c;){let f=t[s],u=t[s+1],m=Math.max(r,f),b=Math.min(c,u);if(m<=b&&new Me(m+h,b+h,m,b).addToSet(i),u>c)break;s+=2}if(!d)return i;new Me(d.fromA,d.toA,d.fromB,d.toB).addToSet(i),o=d.toA,r=d.toB}}}class $i{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ue.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let l=[];this.changes.iterChangedRanges((s,o,r,d)=>l.push(new Me(s,o,r,d))),this.changedRanges=l}static create(e,t,i){return new $i(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class co extends ne{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=we.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ce],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Me(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>c<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!Tc(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let s=l>-1?Bc(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Me(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(W.ie||W.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,r=this.updateDeco(),d=_c(o,r,e.changes);return i=Me.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=W.chrome||W.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||l.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Je&&o.widget instanceof qn&&s.push(o.dom);l.updateGaps(s)}updateChildren(e,t,i){let l=i?i.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=l.length-1;;o--){let r=o>=0?l[o]:null;if(!r)break;let{fromA:d,toA:h,fromB:c,toB:f}=r,u,m,b,g;if(i&&i.range.fromB<f&&i.range.toB>c){let k=ni.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),p=ni.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);m=k.breakAtStart,b=k.openStart,g=p.openEnd;let B=this.compositionView(i);p.breakAtStart?B.breakAfter=1:p.content.length&&B.merge(B.length,B.length,p.content[0],!1,p.openStart,0)&&(B.breakAfter=p.content[0].breakAfter,p.content.shift()),k.content.length&&B.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),u=k.content.concat(B).concat(p.content)}else({content:u,breakAtStart:m,openStart:b,openEnd:g}=ni.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:v,off:w}=s.findPos(h,1),{i:x,off:O}=s.findPos(d,-1);Ts(this,x,O,v,w,u,m,b,g)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(io)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ee(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new Xe(l,[t],t.length);let i=new ce;return i.append(t,0),i}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(o);let r=ne.get(s);r&&r!=o&&(r.dom=null),o.setDOM(s)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];t(e.line,l);for(let s=e.marks.length-1;s>=-1;s--)i=l.childPos(i.off,1),l=l.children[i.i],t(s>=0?e.marks[s].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,s=!l&&Ti(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&Nc(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=h=new ye(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!ei(d.node,d.offset,c.anchorNode,c.anchorOffset)||!ei(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(c.focusNode)&&Mc(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Jt(this.view.root);if(f)if(r.empty){if(W.gecko){let u=Oc(d.node,d.offset);if(u&&u!=3){let m=(u==1?Os:Vs)(d.node,d.offset);m&&(d=new ye(m.node,m.offset))}}f.collapse(d.node,d.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(d.node,d.offset);try{f.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([d,h]=[h,d]),u.setEnd(h.node,h.offset),u.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ye(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ye(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ei(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Jt(e.root),{anchorNode:l,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=ce.find(this,t.head);if(!o)return;let r=o.posAtStart;if(t.head==r||t.head==r+o.length)return;let d=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!d||!h||d.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(l,s)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let l=e.offset;!i&&l<t.childNodes.length;l++){let s=ne.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let s=ne.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(s.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=ne.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(i<l.length||l instanceof ce)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,l=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let r=this.children[o],d=s-r.breakAfter,h=d-r.length;if(d<e)break;if(h<=e&&(h<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof ce&&!(i instanceof ce&&t>=0)))i=r,l=h;else if(i&&h==e&&d==e&&r instanceof Je&&Math.abs(t)<2){if(r.deco.startSide<0)break;o&&(i=null)}s=h}return i?i.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),l=this.children[t];if(!(l instanceof ce))return null;for(;l.children.length;){let{i:r,off:d}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=d}if(!(l instanceof Ee))return null;let s=Ke(l.text,i);if(s==i)return null;let o=kt(l.dom,i,s).getClientRects();for(let r=0;r<o.length;r++){let d=o[r];if(r==o.length-1||d.top<d.bottom&&d.left<d.right)return d}return null}measureVisibleLineHeights(e){let t=[],{from:i,to:l}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let h=0,c=0;c<this.children.length;c++){let f=this.children[c],u=h+f.length;if(u>l)break;if(h>=i){let m=f.dom.getBoundingClientRect();if(t.push(m.height),o){let b=f.dom.lastChild,g=b?Zt(b):[];if(g.length){let v=g[g.length-1],w=d?v.right-m.left:m.right-v.left;w>r&&(r=w,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?me.RTL:me.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ce){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Zt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,l=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ms(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let s=l==t.viewports.length?null:t.viewports[l],o=s?s.from-1:this.length;if(o>i){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(we.replace({widget:new qn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return we.set(e)}updateDeco(){let e=1,t=this.view.state.facet(si).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,l=this.view.state.facet(lo).map((s,o)=>{let r=typeof s=="function";return r&&(i=!0),r?s(this.view):s});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(se.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(to))try{if(h(this.view,e.range,e))return!0}catch(c){ze(this.view.state,c,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let s=ro(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;lc(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,d),-d),this.view.textDirection==me.LTR)}}function Nc(a){return a.node.nodeType==1&&a.node.firstChild&&(a.offset==0||a.node.childNodes[a.offset-1].contentEditable=="false")&&(a.offset==a.node.childNodes.length||a.node.childNodes[a.offset].contentEditable=="false")}function ho(a,e){let t=a.observer.selectionRange;if(!t.focusNode)return null;let i=Os(t.focusNode,t.focusOffset),l=Vs(t.focusNode,t.focusOffset),s=i||l;if(l&&i&&l.node!=i.node){let r=ne.get(l.node);if(!r||r instanceof Ee&&r.text!=l.node.nodeValue)s=l;else if(a.docView.lastCompositionAfterCursor){let d=ne.get(i.node);!d||d instanceof Ee&&d.text!=i.node.nodeValue||(s=l)}}if(a.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function Bc(a,e,t){let i=ho(a,t);if(!i)return null;let{node:l,from:s,to:o}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,h=new Me(d.mapPos(s),d.mapPos(o),s,o),c=[];for(let f=l.parentNode;;f=f.parentNode){let u=ne.get(f);if(u instanceof Xe)c.push({node:f,deco:u.mark});else{if(u instanceof ce||f.nodeName=="DIV"&&f.parentNode==a.contentDOM)return{range:h,text:l,marks:c,line:f};if(f!=a.contentDOM)c.push({node:f,deco:new ti({inclusive:!0,attributes:fc(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Oc(a,e){return a.nodeType!=1?0:(e&&a.childNodes[e-1].contentEditable=="false"?1:0)|(e<a.childNodes.length&&a.childNodes[e].contentEditable=="false"?2:0)}let Vc=class{constructor(){this.changes=[]}compareRange(e,t){zn(e,t,this.changes)}comparePoint(e,t){zn(e,t,this.changes)}};function _c(a,e,t){let i=new Vc;return se.compare(a,e,t,i),i.changes}function Mc(a,e){for(let t=a;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Tc(a,e){let t=!1;return e&&a.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}function Ac(a,e,t=1){let i=a.charCategorizer(e),l=a.doc.lineAt(e),s=e-l.from;if(l.length==0)return H.cursor(e);s==0?t=1:s==l.length&&(t=-1);let o=s,r=s;t<0?o=Ke(l.text,s,!1):r=Ke(l.text,s);let d=i(l.text.slice(o,r));for(;o>0;){let h=Ke(l.text,o,!1);if(i(l.text.slice(h,o))!=d)break;o=h}for(;r<l.length;){let h=Ke(l.text,r);if(i(l.text.slice(r,h))!=d)break;r=h}return H.range(o+l.from,r+l.from)}function Ec(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function Ic(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function el(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function fo(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function uo(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function tl(a,e,t){let i,l,s,o,r=!1,d,h,c,f;for(let b=a.firstChild;b;b=b.nextSibling){let g=Zt(b);for(let v=0;v<g.length;v++){let w=g[v];l&&el(l,w)&&(w=fo(uo(w,l.bottom),l.top));let x=Ec(e,w),O=Ic(t,w);if(x==0&&O==0)return b.nodeType==3?po(b,e,t):tl(b,e,t);if(!i||o>O||o==O&&s>x){i=b,l=w,s=x,o=O;let k=O?t<w.top?-1:1:x?e<w.left?-1:1:0;r=!k||(k>0?v<g.length-1:v>0)}x==0?t>w.bottom&&(!c||c.bottom<w.bottom)?(d=b,c=w):t<w.top&&(!f||f.top>w.top)&&(h=b,f=w):c&&el(c,w)?c=uo(c,w.bottom):f&&el(f,w)&&(f=fo(f,w.top))}}if(c&&c.bottom>=t?(i=d,l=c):f&&f.top<=t&&(i=h,l=f),!i)return{node:a,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return po(i,u,t);if(r&&i.contentEditable!="false")return tl(i,u,t);let m=Array.prototype.indexOf.call(a.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function po(a,e,t){let i=a.nodeValue.length,l=-1,s=1e9,o=0;for(let r=0;r<i;r++){let d=kt(a,r,r+1).getClientRects();for(let h=0;h<d.length;h++){let c=d[h];if(c.top==c.bottom)continue;o||(o=e-c.left);let f=(c.top>t?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f<s){let u=e>=(c.left+c.right)/2,m=u;if((W.chrome||W.gecko)&&kt(a,r).getBoundingClientRect().left==c.right&&(m=!u),f<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),s=f}}}return{node:a,offset:l>-1?l:o>0?a.nodeValue.length:0}}function mo(a,e,t,i=-1){var l,s;let o=a.contentDOM.getBoundingClientRect(),r=o.top+a.viewState.paddingTop,d,{docHeight:h}=a.viewState,{x:c,y:f}=e,u=f-r;if(u<0)return 0;if(u>h)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,p=!1;d=a.elementAtHeight(u),d.type!=Le.Text;)for(;u=i>0?d.bottom+k:d.top-k,!(u>=0&&u<=h);){if(p)return t?null:0;p=!0,i=-i}f=r+u;let m=d.from;if(m<a.viewport.from)return a.viewport.from==0?0:t?null:go(a,o,d,c,f);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:t?null:go(a,o,d,c,f);let b=a.dom.ownerDocument,g=a.root.elementFromPoint?a.root:b,v=g.elementFromPoint(c,f);v&&!a.contentDOM.contains(v)&&(v=null),v||(c=Math.max(o.left+1,Math.min(o.right-1,c)),v=g.elementFromPoint(c,f),v&&!a.contentDOM.contains(v)&&(v=null));let w,x=-1;if(v&&((l=a.docView.nearest(v))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let k=b.caretPositionFromPoint(c,f);k&&({offsetNode:w,offset:x}=k)}else if(b.caretRangeFromPoint){let k=b.caretRangeFromPoint(c,f);k&&({startContainer:w,startOffset:x}=k,(!a.contentDOM.contains(w)||W.safari&&Dc(w,x,c)||W.chrome&&Pc(w,x,c))&&(w=void 0))}}if(!w||!a.docView.dom.contains(w)){let k=ce.find(a.docView,m);if(!k)return u>d.top+d.height/2?d.to:d.from;({node:w,offset:x}=tl(k.dom,c,f))}let O=a.docView.nearest(w);if(!O)return null;if(O.isWidget&&((s=O.dom)===null||s===void 0?void 0:s.nodeType)==1){let k=O.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?O.posAtStart:O.posAtEnd}else return O.localPosFromDOM(w,x)+O.posAtStart}function go(a,e,t,i,l){let s=Math.round((i-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&t.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,d=Math.floor((l-t.top-(a.defaultLineHeight-r)*.5)/r);s+=d*a.viewState.heightOracle.lineLength}let o=a.state.sliceDoc(t.from,t.to);return t.from+ec(o,s,a.state.tabSize)}function Dc(a,e,t){let i;if(a.nodeType!=3||e!=(i=a.nodeValue.length))return!1;for(let l=a.nextSibling;l;l=l.nextSibling)if(l.nodeType!=1||l.nodeName!="BR")return!1;return kt(a,i-1,i).getBoundingClientRect().left>t}function Pc(a,e,t){if(e!=0)return!1;for(let l=a;;){let s=l.parentNode;if(!s||s.nodeType!=1||s.firstChild!=l)return!1;if(s.classList.contains("cm-line"))break;l=s}let i=a.nodeType==1?a.getBoundingClientRect():kt(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Fc(a,e){let t=a.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==Le.Text))return i}return t}function $c(a,e,t,i){let l=Fc(a,e.head),s=!i||l.type!=Le.Text||!(a.lineWrapping||l.widgetLineBreaks)?null:a.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(s){let o=a.dom.getBoundingClientRect(),r=a.textDirectionAt(l.from),d=a.posAtCoords({x:t==(r==me.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(d!=null)return H.cursor(d,t?-1:1)}return H.cursor(t?l.to:l.from,t?-1:1)}function ko(a,e,t,i){let l=a.state.doc.lineAt(e.head),s=a.bidiSpans(l),o=a.textDirectionAt(l.from);for(let r=e,d=null;;){let h=xc(l,s,o,r,t),c=Ks;if(!h){if(l.number==(t?a.state.doc.lines:1))return r;c=`
|
|
8
|
+
`,l=a.state.doc.line(l.number+(t?1:-1)),s=a.bidiSpans(l),h=a.visualLineSide(l,!t)}if(d){if(!d(c))return r}else{if(!i)return h;d=i(c)}r=h}}function Rc(a,e,t){let i=a.state.charCategorizer(e),l=i(t);return s=>{let o=i(s);return l==Ge.Space&&(l=o),l==o}}function Lc(a,e,t,i){let l=e.head,s=t?1:-1;if(l==(t?a.state.doc.length:0))return H.cursor(l,e.assoc);let o=e.goalColumn,r,d=a.contentDOM.getBoundingClientRect(),h=a.coordsAtPos(l,e.assoc||-1),c=a.documentTop;if(h)o==null&&(o=h.left-d.left),r=s<0?h.top:h.bottom;else{let m=a.viewState.lineBlockAt(l);o==null&&(o=Math.min(d.right-d.left,a.defaultCharacterWidth*(l-m.from))),r=(s<0?m.top:m.bottom)+c}let f=d.left+o,u=i??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=r+(u+m)*s,g=mo(a,{x:f,y:b},!1,s);if(b<d.top||b>d.bottom||(s<0?g<l:g>l)){let v=a.docView.coordsForChar(g),w=!v||b<v.top?-1:1;return H.cursor(g,w,void 0,o)}}}function Ri(a,e,t){for(;;){let i=0;for(let l of a)l.between(e-1,e+1,(s,o,r)=>{if(e>s&&e<o){let d=i||t||(e-s<o-e?-1:1);e=d<0?s:o,i=d}});if(!i)return e}}function il(a,e,t){let i=Ri(a.state.facet(Zn).map(l=>l(a)),t.from,e.head>t.from?-1:1);return i==t.from?t:H.cursor(i,i<t.from?1:-1)}const ai="";class jc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(te.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ai}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let s=this.text.length;this.readNode(l);let o=l.nextSibling;if(o==t)break;let r=ne.get(l),d=ne.get(o);(r&&d?r.breakAfter:(r?r.breakAfter:Ai(l))||Ai(o)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>s)&&this.lineBreak(),l=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,r;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(r=l.exec(t))&&(s=r.index,o=r[0].length),this.append(t.slice(i,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=o-1);i=s+o}}readNode(e){if(e.cmIgnore)return;let t=ne.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(zc(e,i.node,i.offset)?t:0))}}function zc(a,e,t){for(;;){if(!e||t<Ye(e))return!1;if(e==a)return!0;t=gt(e)+1,e=e.parentNode}}class bo{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class qc{constructor(e,t,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let r=s||o?[]:Hc(e),d=new jc(r,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Kc(r,this.bounds.from)}else{let r=e.observer.selectionRange,d=s&&s.node==r.focusNode&&s.offset==r.focusOffset||!En(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),h=o&&o.node==r.anchorNode&&o.offset==r.anchorOffset||!En(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),c=e.viewport;if((W.ios||W.chrome)&&e.state.selection.main.empty&&d!=h&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(d,h),u=Math.max(d,h),m=c.from-f,b=c.to-u;(m==0||m==1||f==0)&&(b==0||b==-1||u==e.state.doc.length)&&(d=0,h=e.state.doc.length)}this.newSel=H.single(h,d)}}}function yo(a,e){let t,{newSel:i}=e,l=a.state.selection.main,s=a.inputState.lastKeyTime>Date.now()-100?a.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:r}=e.bounds,d=l.from,h=null;(s===8||W.android&&e.text.length<r-o)&&(d=l.to,h="end");let c=Wc(a.state.doc.sliceString(o,r,ai),e.text,d-o,h);c&&(W.chrome&&s==13&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==ai+ai&&c.toB--,t={from:o+c.from,to:o+c.toA,insert:X.of(e.text.slice(c.from,c.toB).split(ai))})}else i&&(!a.hasFocus&&a.state.facet(at)||i.main.eq(l))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!l.empty&&i&&i.main.empty?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,l.to)}:t&&t.from>=l.from&&t.to<=l.to&&(t.from!=l.from||t.to!=l.to)&&l.to-l.from-(t.to-t.from)<=4?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,t.from).append(t.insert).append(a.state.doc.slice(t.to,l.to))}:(W.mac||W.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:X.of([" "])}):W.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
|
|
9
|
+
`&&a.lineWrapping&&(i&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:X.of([" "])}),t)return nl(a,t,i,s);if(i&&!i.main.eq(l)){let o=!1,r="select";return a.inputState.lastSelectionTime>Date.now()-50&&(a.inputState.lastSelectionOrigin=="select"&&(o=!0),r=a.inputState.lastSelectionOrigin),a.dispatch({selection:i,scrollIntoView:o,userEvent:r}),!0}else return!1}function nl(a,e,t,i=-1){if(W.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(W.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&a.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&_t(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&_t(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&_t(a.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let o,r=()=>o||(o=Uc(a,e,t));return a.state.facet(Js).some(d=>d(a,e.from,e.to,s,r))||a.dispatch(r()),!0}function Uc(a,e,t){let i,l=a.state,s=l.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&a.inputState.composing<0){let r=s.from<e.from?l.sliceDoc(s.from,e.from):"",d=s.to>e.to?l.sliceDoc(e.to,s.to):"";i=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+d))}else{let r=l.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let h=a.state.sliceDoc(e.from,e.to),c,f=t&&ho(a,t.main.head);if(f){let b=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-b}}else c=a.state.doc.lineAt(s.head);let u=s.to-e.to,m=s.to-s.from;i=l.changeByRange(b=>{if(b.from==s.from&&b.to==s.to)return{changes:r,range:d||b.map(r)};let g=b.to-u,v=g-h.length;if(b.to-b.from!=m||a.state.sliceDoc(v,g)!=h||b.to>=c.from&&b.from<=c.to)return{range:b};let w=l.changes({from:v,to:g,insert:e.insert}),x=b.to-s.to;return{changes:w,range:d?H.range(Math.max(0,d.anchor+x),Math.max(0,d.head+x)):b.map(w)}})}else i={changes:r,selection:d&&l.selection.replaceRange(d)}}let o="input.type";return(a.composing||a.inputState.compositionPendingChange&&a.inputState.compositionEndedAt>Date.now()-50)&&(a.inputState.compositionPendingChange=!1,o+=".compose",a.inputState.compositionFirstChange&&(o+=".start",a.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:o,scrollIntoView:!0})}function Wc(a,e,t,i){let l=Math.min(a.length,e.length),s=0;for(;s<l&&a.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==l&&a.length==e.length)return null;let o=a.length,r=e.length;for(;o>0&&r>0&&a.charCodeAt(o-1)==e.charCodeAt(r-1);)o--,r--;if(i=="end"){let d=Math.max(0,s-Math.min(o,r));t-=o+d-s}if(o<s&&a.length<e.length){let d=t<=s&&t>=o?s-t:0;s-=d,r=s+(r-o),o=s}else if(r<s){let d=t<=s&&t>=r?s-t:0;s-=d,o=s+(o-r),r=s}return{from:s,toA:o,toB:r}}function Hc(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}=a.observer.selectionRange;return t&&(e.push(new bo(t,i)),(l!=t||s!=i)&&e.push(new bo(l,s))),e}function Kc(a,e){if(a.length==0)return null;let t=a[0].pos,i=a.length==2?a[1].pos:t;return t>-1&&i>-1?H.single(t+e,i+e):null}class Qc{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&hh(e.contentDOM.ownerDocument)}handleEvent(e){!nh(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Gc(e),i=this.handlers,l=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,r=i[s];r&&o!=!r.handlers.length&&(l.removeEventListener(s,this.handleEvent),r=null),r||l.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!t[s]&&l.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Xc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=xo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Yc.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,_t(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:W.safari&&!W.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wo(a,e){return(t,i)=>{try{return e.call(a,i,t)}catch(l){ze(t.state,l)}}}function Gc(a){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of a){let l=i.spec;if(l&&l.domEventHandlers)for(let s in l.domEventHandlers){let o=l.domEventHandlers[s];o&&t(s).handlers.push(wo(i.value,o))}if(l&&l.domEventObservers)for(let s in l.domEventObservers){let o=l.domEventObservers[s];o&&t(s).observers.push(wo(i.value,o))}}for(let i in Ie)t(i).handlers.push(Ie[i]);for(let i in Te)t(i).observers.push(Te[i]);return e}const xo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Yc="dthko",Xc=[16,17,18,20,91,92,224,225],Li=6;function ji(a){return Math.max(0,a)*.7+8}function Jc(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class Zc{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=sc(e.contentDOM),this.atoms=e.state.facet(Zn).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(te.allowMultipleSelections)&&eh(e,t),this.dragging=ih(e,t)&&Mo(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Jc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,s=0,o=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=ro(this.view);e.clientX-d.left<=l+Li?t=-ji(l-e.clientX):e.clientX+d.right>=o-Li&&(t=ji(e.clientX-o)),e.clientY-d.top<=s+Li?i=-ji(s-e.clientY):e.clientY+d.bottom>=r-Li&&(i=ji(e.clientY-r)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],s=null;if(l.empty){let o=Ri(this.atoms,l.from,0);o!=l.from&&(s=H.cursor(o,-1))}else{let o=Ri(this.atoms,l.from,-1),r=Ri(this.atoms,l.to,1);(o!=l.from||r!=l.to)&&(s=H.range(l.from==l.anchor?o:r,l.from==l.head?o:r))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?H.create(t,e.mainIndex):e}select(e){let{view:t}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function eh(a,e){let t=a.state.facet(Qs);return t.length?t[0](e):W.mac?e.metaKey:e.ctrlKey}function th(a,e){let t=a.state.facet(Gs);return t.length?t[0](e):W.mac?!e.altKey:!e.ctrlKey}function ih(a,e){let{main:t}=a.state.selection;if(t.empty)return!1;let i=Jt(a.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let s=0;s<l.length;s++){let o=l[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function nh(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=a.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=ne.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ie=Object.create(null),Te=Object.create(null),vo=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function lh(a){let e=a.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{a.focus(),t.remove(),Co(a,t.value)},50)}function zi(a,e,t){for(let i of a.facet(e))t=i(t,a);return t}function Co(a,e){e=zi(a.state,Gn,e);let{state:t}=a,i,l=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(ll!=null&&t.selection.ranges.every(d=>d.empty)&&ll==s.toString()){let d=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==d)return{range:h};d=c.from;let f=t.toText((o?s.line(l++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:H.cursor(h.from+f.length)}})}else o?i=t.changeByRange(d=>{let h=s.line(l++);return{changes:{from:d.from,to:d.to,insert:h.text},range:H.cursor(d.from+h.length)}}):i=t.replaceSelection(s);a.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Te.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},Ie.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Te.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Te.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},Ie.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of a.state.facet(Ys))if(t=i(a,e),t)break;if(!t&&e.button==0&&(t=ah(a,e)),t){let i=!a.hasFocus;a.inputState.startMouseSelection(new Zc(a,e,t,i)),i&&a.observer.ignore(()=>{Cs(a.contentDOM);let s=a.root.activeElement;s&&!s.contains(a.contentDOM)&&s.blur()});let l=a.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function So(a,e,t,i){if(i==1)return H.cursor(e,t);if(i==2)return Ac(a.state,e,t);{let l=ce.find(a.docView,e),s=a.state.doc.lineAt(l?l.posAtEnd:e),o=l?l.posAtStart:s.from,r=l?l.posAtEnd:s.to;return r<a.state.doc.length&&r==s.to&&r++,H.range(o,r)}}let No=(a,e,t)=>e>=t.top&&e<=t.bottom&&a>=t.left&&a<=t.right;function sh(a,e,t,i){let l=ce.find(a.docView,e);if(!l)return 1;let s=e-l.posAtStart;if(s==0)return 1;if(s==l.length)return-1;let o=l.coordsAt(s,-1);if(o&&No(t,i,o))return-1;let r=l.coordsAt(s,1);return r&&No(t,i,r)?1:o&&o.bottom>=i?-1:1}function Bo(a,e){let t=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:sh(a,t,e.clientX,e.clientY)}}const oh=W.ie&&W.ie_version<=11;let Oo=null,Vo=0,_o=0;function Mo(a){if(!oh)return a.detail;let e=Oo,t=_o;return Oo=a,_o=Date.now(),Vo=!e||t>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(Vo+1)%3:1}function ah(a,e){let t=Bo(a,e),i=Mo(e),l=a.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),l=l.map(s.changes))},get(s,o,r){let d=Bo(a,s),h,c=So(a,d.pos,d.bias,i);if(t.pos!=d.pos&&!o){let f=So(a,t.pos,t.bias,i),u=Math.min(f.from,c.from),m=Math.max(f.to,c.to);c=u<c.from?H.range(u,m):H.range(m,u)}return o?l.replaceRange(l.main.extend(c.from,c.to)):r&&i==1&&l.ranges.length>1&&(h=rh(l,d.pos))?h:r?l.addRange(c):H.create([c])}}}function rh(a,e){for(let t=0;t<a.ranges.length;t++){let{from:i,to:l}=a.ranges[t];if(i<=e&&l>=e)return H.create(a.ranges.slice(0,t).concat(a.ranges.slice(t+1)),a.mainIndex==t?0:a.mainIndex-(a.mainIndex>t?1:0))}return null}Ie.dragstart=(a,e)=>{let{selection:{main:t}}=a.state;if(e.target.draggable){let l=a.docView.nearest(e.target);if(l&&l.isWidget){let s=l.posAtStart,o=s+l.length;(s>=t.to||o<=t.from)&&(t=H.range(s,o))}}let{inputState:i}=a;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",zi(a.state,Yn,a.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Ie.dragend=a=>(a.inputState.draggedContent=null,!1);function To(a,e,t,i){if(t=zi(a.state,Gn,t),!t)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=a.inputState,o=i&&s&&th(a,e)?{from:s.from,to:s.to}:null,r={from:l,insert:t},d=a.state.changes(o?[o,r]:r);a.focus(),a.dispatch({changes:d,selection:{anchor:d.mapPos(l,-1),head:d.mapPos(l,1)},userEvent:o?"move.drop":"input.drop"}),a.inputState.draggedContent=null}Ie.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,s=()=>{++l==t.length&&To(a,e,i.filter(o=>o!=null).join(a.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let r=new FileReader;r.onerror=s,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[o]=r.result),s()},r.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return To(a,e,i,!0),!0}return!1},Ie.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let t=vo?null:e.clipboardData;return t?(Co(a,t.getData("text/plain")||t.getData("text/uri-list")),!0):(lh(a),!1)};function dh(a,e){let t=a.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),a.focus()},50)}function ch(a){let e=[],t=[],i=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:s}of a.selection.ranges){let o=a.doc.lineAt(s);o.number>l&&(e.push(o.text),t.push({from:o.from,to:Math.min(a.doc.length,o.to+1)})),l=o.number}i=!0}return{text:zi(a,Yn,e.join(a.lineBreak)),ranges:t,linewise:i}}let ll=null;Ie.copy=Ie.cut=(a,e)=>{let{text:t,ranges:i,linewise:l}=ch(a.state);if(!t&&!l)return!1;ll=l?t:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=vo?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(dh(a,t),!1)};const Ao=St.define();function Eo(a,e){let t=[];for(let i of a.facet(Zs)){let l=i(a,e);l&&t.push(l)}return t?a.update({effects:t,annotations:Ao.of(!0)}):null}function Io(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let t=Eo(a.state,e);t?a.dispatch(t):a.update([])}},10)}Te.focus=a=>{a.inputState.lastFocusTime=Date.now(),!a.scrollDOM.scrollTop&&(a.inputState.lastScrollTop||a.inputState.lastScrollLeft)&&(a.scrollDOM.scrollTop=a.inputState.lastScrollTop,a.scrollDOM.scrollLeft=a.inputState.lastScrollLeft),Io(a)},Te.blur=a=>{a.observer.clearSelectionRange(),Io(a)},Te.compositionstart=Te.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Te.compositionend=a=>{a.observer.editContext||(a.inputState.composing=-1,a.inputState.compositionEndedAt=Date.now(),a.inputState.compositionPendingKey=!0,a.inputState.compositionPendingChange=a.observer.pendingRecords().length>0,a.inputState.compositionFirstChange=null,W.chrome&&W.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Te.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},Ie.beforeinput=(a,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let r=o[0],d=a.posAtDOM(r.startContainer,r.startOffset),h=a.posAtDOM(r.endContainer,r.endOffset);return nl(a,{from:d,to:h,insert:a.state.toText(s)},null),!0}}let l;if(W.chrome&&W.android&&(l=xo.find(s=>s.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&a.hasFocus&&(a.contentDOM.blur(),a.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Te.compositionend(a,e),20),!1};const Do=new Set;function hh(a){Do.has(a)||(Do.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const Po=["pre-wrap","normal","pre-line","break-spaces"];let It=!1;function Fo(){It=!1}class fh{constructor(e){this.lineWrapping=e,this.doc=X.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Po.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,s,o){let r=Po.indexOf(e)>-1,d=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=s,d){this.heightSamples={};for(let h=0;h<o.length;h++){let c=o[h];c<0?h++:this.heightSamples[Math.floor(c*10)]=!0}}return d}}class uh{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class qe{constructor(e,t,i,l,s){this.from=e,this.length=t,this.top=i,this.height=l,this._content=s}get type(){return typeof this._content=="number"?Le.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof st?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new qe(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var oe=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(oe||(oe={}));const qi=.001;class ve{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>qi&&(It=!0),this.height=e)}replace(e,t,i){return ve.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let s=this,o=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:d,toA:h,fromB:c,toB:f}=l[r],u=s.lineAt(d,oe.ByPosNoHeight,i.setDoc(t),0,0),m=u.to>=h?u:s.lineAt(h,oe.ByPosNoHeight,i,0,0);for(f+=m.to-h,h=m.to;r>0&&u.from<=l[r-1].toA;)d=l[r-1].fromA,c=l[r-1].fromB,r--,d<u.from&&(u=s.lineAt(d,oe.ByPosNoHeight,i,0,0));c+=u.from-d,d=u.from;let b=sl.build(i.setDoc(o),e,c,f);s=Ui(s,s.replace(d,h,b))}return s.updateHeight(i,0)}static empty(){return new Oe(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,s=0;for(;;)if(t==i)if(l>s*2){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),i+=1+r.break,l-=r.size}else if(s>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,s-=r.size}else break;else if(l<s){let r=e[t++];r&&(l+=r.size)}else{let r=e[--i];r&&(s+=r.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new ph(ve.of(e.slice(0,t)),o,ve.of(e.slice(i)))}}function Ui(a,e){return a==e?a:(a.constructor!=e.constructor&&(It=!0),e)}ve.prototype.size=1;class $o extends ve{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,l,s){return this.blockAt(0,i,l,s)}forEachLine(e,t,i,l,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,i,l,s))}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oe extends $o{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Oe||l instanceof ge&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof ge?l=new Oe(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):ve.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ge extends ve{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,s=l-i+1,o,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*s);o=d/s,this.length>s+1&&(r=(this.height-d)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:l,perLine:o,perChar:r}}blockAt(e,t,i,l){let{firstLine:s,lastLine:o,perLine:r,perChar:d}=this.heightMetrics(t,l);if(t.lineWrapping){let h=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),c=t.doc.lineAt(h),f=r+c.length*d,u=Math.max(i,e-f/2);return new qe(c.from,c.length,u,f,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((e-i)/r))),{from:c,length:f}=t.doc.line(s+h);return new qe(c,f,i+r*h,r,0)}}lineAt(e,t,i,l,s){if(t==oe.ByHeight)return this.blockAt(e,i,l,s);if(t==oe.ByPosNoHeight){let{from:m,to:b}=i.doc.lineAt(e);return new qe(m,b-m,0,0,0)}let{firstLine:o,perLine:r,perChar:d}=this.heightMetrics(i,s),h=i.doc.lineAt(e),c=r+h.length*d,f=h.number-o,u=l+r*f+d*(h.from-s-f);return new qe(h.from,h.length,Math.max(l,Math.min(u,l+this.height-c)),c,0)}forEachLine(e,t,i,l,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:r,perLine:d,perChar:h}=this.heightMetrics(i,s);for(let c=e,f=l;c<=t;){let u=i.doc.lineAt(c);if(c==e){let b=u.number-r;f+=d*b+h*(e-s-b)}let m=d+h*u.length;o(new qe(u.from,u.length,f,m,0)),f+=m,c=u.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let s=i[i.length-1];s instanceof ge?i[i.length-1]=new ge(s.length+l):i.push(null,new ge(l-1))}if(e>0){let s=i[0];s instanceof ge?i[0]=new ge(e+s.length):i.unshift(new ge(e-1),null)}return ve.of(i)}decomposeLeft(e,t){t.push(new ge(e-1),null)}decomposeRight(e,t){t.push(null,new ge(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let s=t+this.length;if(l&&l.from<=t+this.length&&l.more){let o=[],r=Math.max(t,l.from),d=-1;for(l.from>t&&o.push(new ge(l.from-t-1).updateHeight(e,t));r<=s&&l.more;){let c=e.doc.lineAt(r).length;o.length&&o.push(null);let f=l.heights[l.index++];d==-1?d=f:Math.abs(f-d)>=qi&&(d=-2);let u=new Oe(c,f);u.outdated=!1,o.push(u),r+=c+1}r<=s&&o.push(null,new ge(s-r).updateHeight(e,r));let h=ve.of(o);return(d<0||Math.abs(h.height-this.height)>=qi||Math.abs(d-this.heightMetrics(e,t).perLine)>=qi)&&(It=!0),Ui(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ph extends ve{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,s,l+this.left.length+this.break)}lineAt(e,t,i,l,s){let o=l+this.left.height,r=s+this.left.length+this.break,d=t==oe.ByHeight?e<o:e<r,h=d?this.left.lineAt(e,t,i,l,s):this.right.lineAt(e,t,i,o,r);if(this.break||(d?h.to<r:h.from>r))return h;let c=t==oe.ByPosNoHeight?oe.ByPosNoHeight:oe.ByPos;return d?h.join(this.right.lineAt(r,c,i,o,r)):this.left.lineAt(r,c,i,l,s).join(h)}forEachLine(e,t,i,l,s,o){let r=l+this.left.height,d=s+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,l,s,o),t>=d&&this.right.forEachLine(e,t,i,r,d,o);else{let h=this.lineAt(d,oe.ByPos,i,l,s);e<h.from&&this.left.forEachLine(e,h.from-1,i,l,s,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,r,d,o)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let r of i)s.push(r);if(e>0&&Ro(s,o-1),t<this.length){let r=s.length;this.decomposeRight(t,s),Ro(s,r)}return ve.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ve.of(this.break?[e,null,t]:[e,t]):(this.left=Ui(this.left,e),this.right=Ui(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,l){let{left:s,right:o}=this,r=t+s.length+this.break,d=null;return l&&l.from<=t+s.length&&l.more?d=s=s.updateHeight(e,t,i,l):s.updateHeight(e,t,i),l&&l.from<=r+o.length&&l.more?d=o=o.updateHeight(e,r,i,l):o.updateHeight(e,r,i),d?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ro(a,e){let t,i;a[e]==null&&(t=a[e-1])instanceof ge&&(i=a[e+1])instanceof ge&&a.splice(e-1,3,new ge(t.length+1+i.length))}const mh=5;class sl{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Oe?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Oe(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let o=t-e;i.block?this.addBlock(new $o(o,l,i)):(o||s||l>=mh)&&this.addLineDeco(l,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Oe(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new ge(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Oe)return e;let t=new Oe(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Oe)&&!this.isCovered?this.nodes.push(new Oe(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Oe&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let s=new sl(i,e);return se.spans(t,i,l,s,0),s.finish(i)}}function gh(a,e,t){let i=new kh;return se.compare(a,e,t,i,0),i.changes}class kh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&zn(e,t,this.changes,5)}}function bh(a,e){let t=a.getBoundingClientRect(),i=a.ownerDocument,l=i.defaultView||window,s=Math.max(0,t.left),o=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(l.innerHeight,t.bottom);for(let h=a.parentNode;h&&h!=i.body;)if(h.nodeType==1){let c=h,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),r=Math.max(r,u.top),d=Math.min(h==a.parentNode?l.innerHeight:d,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function yh(a,e){let t=a.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ol{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],s=t[i];if(l.from!=s.from||l.to!=s.to||l.size!=s.size)return!1}return!0}draw(e,t){return we.replace({widget:new wh(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class wh extends jn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Lo{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=jo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Jn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new fh(t),this.stateDeco=e.facet(si).filter(i=>typeof i!="function"),this.heightMap=ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle.setDoc(e.doc),[new Me(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:s,to:o})=>l>=s&&l<=o)){let{from:s,to:o}=this.lineBlockAt(l);e.push(new Wi(s,o))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?jo:new al(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ri(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(si).filter(c=>typeof c!="function");let l=e.changedRanges,s=Me.extendWithRanges(l,gh(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),o=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Fo(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||It)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let d=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<d.from||t.range.head>d.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,t));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Cc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),r=t.getBoundingClientRect(),d=o||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,c=0;if(r.width&&r.height){let{scaleX:k,scaleY:p}=vs(t,r);(k>.005&&Math.abs(this.scaleX-k)>.005||p>.005&&Math.abs(this.scaleY-p)>.005)&&(this.scaleX=k,this.scaleY=p,h|=8,o=d=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Bs(e.scrollDOM);let b=(this.printing?yh:bh)(t,this.paddingTop),g=b.top-this.pixelViewport.top,v=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(d=!0)),!this.inView&&!this.scrollTarget)return 0;let x=r.width;if((this.contentDOMWidth!=x||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),d){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(o=!0),o||l.lineWrapping&&Math.abs(x-this.contentDOMWidth)>l.charWidth){let{lineHeight:p,charWidth:B,textHeight:V}=e.docView.measureTextSize();o=p>0&&l.refresh(s,p,B,V,x/B,k),o&&(e.docView.minWidth=0,h|=8)}g>0&&v>0?c=Math.max(g,v):g<0&&v<0&&(c=Math.min(g,v)),Fo();for(let p of this.viewports){let B=p.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(p);this.heightMap=(o?ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle,[new Me(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,o,new uh(p.from,B))}It&&(h|=2)}let O=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:r}=this,d=new Wi(l.lineAt(o-i*1e3,oe.ByHeight,s,0,0).from,l.lineAt(r+(1-i)*1e3,oe.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(h<d.from||h>d.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(h,oe.ByPos,s,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h<d.from?u=f.top:u=f.bottom-c,d=new Wi(l.lineAt(u-1e3/2,oe.ByHeight,s,0,0).from,l.lineAt(u+c+1e3/2,oe.ByHeight,s,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Wi(this.heightMap.lineAt(i,oe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,oe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,oe.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:r}=this;return(e==0||l<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=r+Math.max(10,Math.min(i,250)))&&l>o-2*1e3&&s<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new ol(t.mapPos(l.from),t.mapPos(l.to),l.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,s=l>>1,o=l<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(c,f,u,m)=>{if(f-c<s)return;let b=this.state.selection.main,g=[b.from];b.empty||g.push(b.to);for(let w of g)if(w>c&&w<f){d(c,w-10,u,m),d(w+10,f,u,m);return}let v=vh(e,w=>w.from>=u.from&&w.to<=u.to&&Math.abs(w.from-c)<s&&Math.abs(w.to-f)<s&&!g.some(x=>w.from<x&&w.to>x));if(!v){if(f<u.to&&t&&i&&t.visibleRanges.some(w=>w.from<=f&&w.to>=f)){let w=t.moveToLineBoundary(H.cursor(f),!1,!0).head;w>c&&(f=w)}v=new ol(c,f,this.gapSize(u,c,f,m))}r.push(v)},h=c=>{if(c.length<o||c.type!=Le.Text)return;let f=xh(c.from,c.to,this.stateDeco);if(f.total<o)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(i){let g=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,w;if(u!=null){let x=Ki(f,u),O=((this.visibleBottom-this.visibleTop)/2+g)/c.height;v=x-O,w=x+O}else v=(this.visibleTop-c.top-g)/c.height,w=(this.visibleBottom-c.top+g)/c.height;m=Hi(f,v),b=Hi(f,w)}else{let g=f.total*this.heightOracle.charWidth,v=l*this.heightOracle.charWidth,w,x;if(u!=null){let O=Ki(f,u),k=((this.pixelViewport.right-this.pixelViewport.left)/2+v)/g;w=O-k,x=O+k}else w=(this.pixelViewport.left-v)/g,x=(this.pixelViewport.right+v)/g;m=Hi(f,w),b=Hi(f,x)}m>c.from&&d(c.from,m,c,f),b<c.to&&d(b,c.to,c,f)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(h):h(c);return r}gapSize(e,t,i,l){let s=Ki(l,i)-Ki(l,t);return this.heightOracle.lineWrapping?e.height*s:l.total*this.heightOracle.charWidth*s}updateLineGaps(e){ol.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];se.spans(e,this.viewport.from,this.viewport.to,{span(l,s){t.push({from:l,to:s})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((l,s)=>l.from!=t[s].from||l.to!=t[s].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ri(this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||ri(this.heightMap.lineAt(this.scaler.fromDOM(e),oe.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return ri(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Wi{constructor(e,t){this.from=e,this.to=t}}function xh(a,e,t){let i=[],l=a,s=0;return se.spans(t,a,e,{span(){},point(o,r){o>l&&(i.push({from:l,to:o}),s+=o-l),l=r}},20),l<e&&(i.push({from:l,to:e}),s+=e-l),{total:s,ranges:i}}function Hi({total:a,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(a*t);for(let l=0;;l++){let{from:s,to:o}=e[l],r=o-s;if(i<=r)return s+i;i-=r}}function Ki(a,e){let t=0;for(let{from:i,to:l}of a.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/a.total}function vh(a,e){for(let t of a)if(e(t))return t}const jo={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class al{constructor(e,t,i){let l=0,s=0,o=0;this.viewports=i.map(({from:r,to:d})=>{let h=t.lineAt(r,oe.ByPos,e,0,0).top,c=t.lineAt(d,oe.ByPos,e,0,0).bottom;return l+=c-h,{from:r,to:d,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=o+(r.top-s)*this.scale,o=r.domBottom=r.domTop+(r.bottom-r.top),s=r.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return l+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,l=s.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-l)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,l=s.domBottom}}eq(e){return e instanceof al?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function ri(a,e){if(e.scale==1)return a;let t=e.toDOM(a.top),i=e.toDOM(a.bottom);return new qe(a.from,a.length,t,i-t,Array.isArray(a._content)?a._content.map(l=>ri(l,e)):a._content)}const Qi=Q.define({combine:a=>a.join(" ")}),rl=Q.define({combine:a=>a.indexOf(!0)>-1}),dl=lt.newName(),zo=lt.newName(),qo=lt.newName(),Uo={"&light":"."+zo,"&dark":"."+qo};function cl(a,e,t){return new lt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return a;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):a+" "+i}})}const Ch=cl("."+dl,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Uo),Sh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hl=W.ie&&W.ie_version<=11;class Nh{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new oc,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new Oh(e),e.state.facet(at)&&(e.contentDOM.editContext=this.editContext.editContext)),hl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(at)?i.root.activeElement!=this.dom:!Ti(i.dom,l))return;let s=l.anchorNode&&i.docView.nearest(l.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!i.state.selection.main.empty&&l.focusNode&&ei(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Jt(e.root);if(!t)return!1;let i=W.safari&&e.root.nodeType==11&&ic(this.dom.ownerDocument)==this.dom&&Bh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Ti(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&rc(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Sh),hl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),hl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&_t(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,l=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(l=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Ti(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new qc(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,l=yo(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Wo(t,e.previousSibling||e.target.previousSibling,-1),l=Wo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(at)!=e.state.facet(at)&&(e.view.contentDOM.editContext=e.state.facet(at)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Wo(a,e,t){for(;e;){let i=ne.get(e);if(i&&i.parent==a)return i;let l=e.parentNode;e=l!=a.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function Ho(a,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,s=e.endOffset,o=a.docView.domAtPos(a.state.selection.main.anchor);return ei(o.node,o.offset,l,s)&&([t,i,l,s]=[l,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}}function Bh(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return Ho(a,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",i,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",i,!0),t?Ho(a,t):null}class Oh{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let{anchor:l}=e.state.selection.main,s={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:X.of(i.text.split(`
|
|
10
|
+
`))};s.from==this.from&&l<this.from?s.from=l:s.to==this.to&&l>this.to&&(s.to=l),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||nl(e,s,H.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let l=[],s=null;for(let o=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);o<r;o++){let d=e.coordsForChar(o);s=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||s||new DOMRect,l.push(s)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,r=s.underlineThickness;if(o!="None"&&r!="None"){let d=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(we.mark({attributes:{style:d}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:io.of(we.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=Jt(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((s,o,r,d,h)=>{if(i)return;let c=h.length-(o-s);if(l&&o>=l.to)if(l.from==s&&l.to==o&&l.insert.eq(h)){l=this.pendingContextChange=null,t+=c,this.to+=c;return}else l=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ee{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(s=>i(s,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ac(e.parent)||document,this.viewState=new Lo(e.state||te.create(e)),e.scrollTo&&e.scrollTo.is(Fi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(li).map(l=>new Xn(l));for(let l of this.plugins)l.update(this);this.observer=new Nh(this),this.inputState=new Qc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new co(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof be?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,s=this.state;for(let u of e){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,r=0,d=null;e.some(u=>u.annotation(Ao))?(this.inputState.notifiedFocused=o,r=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,d=Eo(s,o),d||(r=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(te.phrases)!=this.state.facet(te.phrases))return this.setState(s);l=$i.create(this,s,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:m}=u.state.selection;f=new At(m.empty?m:H.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of u.effects)m.is(Fi)&&(f=m.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=Gi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(oi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Qi)!=l.state.facet(Qi)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(Qn))try{u(l)}catch(m){ze(this.state,m,"update listener")}(d||c)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),c&&!yo(this,c)&&h.force&&_t(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Lo(e),this.plugins=e.facet(li).map(i=>new Xn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new co(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(li),i=e.state.facet(li);if(t!=i){let l=[];for(let s of i){let o=t.indexOf(s);if(o<0)l.push(new Xn(s));else{let r=this.plugins[o];r.mustUpdate=e,l.push(r)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){ze(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,l=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(o<0)if(Bs(i))s=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);s=m.from,o=m.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(m=>{try{return m.read(this)}catch(b){return ze(this.state,b),Ko}}),f=$i.create(this,this.state,[]),u=!1;f.flags|=d,t?t.flags|=d:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let m=0;m<h.length;m++)if(c[m]!=Ko)try{let b=h[m];b.write&&b.write(c[m],this)}catch(b){ze(this.state,b)}if(u&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let b=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(b>1||b<-1){l=l+b,i.scrollTop=l/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Qn))r(t)}get themeClasses(){return dl+" "+(this.state.facet(rl)?qo:zo)+" "+this.state.facet(Qi)}updateAttrs(){let e=Qo(this,no,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(at)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Qo(this,Jn,t);let i=this.observer.ignore(()=>{let l=Ln(this.contentDOM,this.contentAttrs,t),s=Ln(this.dom,this.editorAttrs,e);return l||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(ee.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(oi);let e=this.state.facet(ee.cspNonce);lt.mount(this.root,this.styleModules.concat(Ch).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return il(this,e,ko(this,e,t,i))}moveByGroup(e,t){return il(this,e,ko(this,e,t,i=>Rc(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return H.cursor(s.side(t,l)+e.from,s.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return $c(this,e,t,i)}moveVertically(e,t,i){return il(this,e,Lc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),mo(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),s=this.bidiSpans(l),o=s[ot.find(s,e-l.from,-1,t)];return Ei(i,o.dir==me.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(eo)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Vh)return Hs(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Ws(s.isolates,i=oo(this,e))))return s.order;i||(i=oo(this,e));let l=wc(e.text,t,i);return this.bidiCache.push(new Gi(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Cs(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Fi.of(new At(typeof e=="number"?H.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Fi.of(new At(H.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Et.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Et.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=lt.newName(),l=[Qi.of(i),oi.of(cl(`.${i}`,e))];return t&&t.dark&&l.push(rl.of(!0)),l}static baseTheme(e){return zd.lowest(oi.of(cl("."+dl,e,Uo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&ne.get(i)||ne.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}ee.styleModule=oi,ee.inputHandler=Js,ee.clipboardInputFilter=Gn,ee.clipboardOutputFilter=Yn,ee.scrollHandler=to,ee.focusChangeEffect=Zs,ee.perLineTextDirection=eo,ee.exceptionSink=Xs,ee.updateListener=Qn,ee.editable=at,ee.mouseSelectionStyle=Ys,ee.dragMovesSelection=Gs,ee.clickAddsSelectionRange=Qs,ee.decorations=si,ee.outerDecorations=lo,ee.atomicRanges=Zn,ee.bidiIsolatedRanges=so,ee.scrollMargins=ao,ee.darkTheme=rl,ee.cspNonce=Q.define({combine:a=>a.length?a[0]:""}),ee.contentAttributes=Jn,ee.editorAttributes=no,ee.lineWrapping=ee.contentAttributes.of({class:"cm-lineWrapping"}),ee.announce=he.define();const Vh=4096,Ko={};class Gi{constructor(e,t,i,l,s,o){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:me.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==l&&!t.touchesRange(o.from,o.to)&&i.push(new Gi(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function Qo(a,e,t){for(let i=a.state.facet(e),l=i.length-1;l>=0;l--){let s=i[l],o=typeof s=="function"?s(a):s;o&&Rn(o,t)}return t}const _h=!W.ios,Go={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};_h&&(Go[".cm-line"].caretColor=Go[".cm-content"].caretColor="transparent !important");class Dt extends Bt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Dt.prototype.elementClass="",Dt.prototype.toDOM=void 0,Dt.prototype.mapMode=Be.TrackBefore,Dt.prototype.startSide=Dt.prototype.endSide=-1,Dt.prototype.point=!0;var fl;const Pt=new Y;function Mh(a){return Q.define({combine:a?e=>e.concat(a):void 0})}const Th=new Y;class De{constructor(e,t,i=[],l=""){this.data=e,this.name=l,te.prototype.hasOwnProperty("tree")||Object.defineProperty(te.prototype,"tree",{get(){return ul(this)}}),this.parser=t,this.extension=[$t.of(this),te.languageData.of((s,o,r)=>{let d=Yo(s,o,r),h=d.type.prop(Pt);if(!h)return[];let c=s.facet(h),f=d.type.prop(Th);if(f){let u=d.resolve(o-d.from,r);for(let m of f)if(m.test(u,s)){let b=s.facet(m.facet);return m.type=="replace"?b:b.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Yo(e,t,i).type.prop(Pt)==this.data}findRegions(e){let t=e.facet($t);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(s,o)=>{if(s.prop(Pt)==this.data){i.push({from:o,to:o+s.length});return}let r=s.prop(Y.mounted);if(r){if(r.tree.prop(Pt)==this.data){if(r.overlay)for(let d of r.overlay)i.push({from:d.from+o,to:d.to+o});else i.push({from:o,to:o+s.length});return}else if(r.overlay){let d=i.length;if(l(r.tree,r.overlay[0].from+o),i.length>d)return}}for(let d=0;d<s.children.length;d++){let h=s.children[d];h instanceof de&&l(h,s.positions[d]+o)}};return l(ul(e),0),i}get allowsNesting(){return!0}}De.setState=he.define();function Yo(a,e,t){let i=a.facet($t),l=ul(a).topNode;if(!i||i.allowsNesting)for(let s=l;s;s=s.enter(e,t,fe.ExcludeBuffers))s.type.isTop&&(l=s);return l}class Yi extends De{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Mh(e.languageData);return new Yi(t,e.parser.configure({props:[Pt.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Yi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ul(a){let e=a.field(De.state,!1);return e?e.tree:de.empty}class Ah{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let di=null;class Xi{constructor(e,t,i=[],l,s,o,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=s,this.viewport=o,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Xi(e,t,[],de.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Ah(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=de.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(ht.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ht.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=di;di=this;try{return e()}finally{di=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Xo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:s,viewport:o,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,c,f,u)=>d.push({fromA:h,toA:c,fromB:f,toB:u})),i=ht.applyChanges(i,d),l=de.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){r=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);c<f&&r.push({from:c,to:f})}}}return new Xi(this.parser,t,i,l,s,o,r,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:l,to:s}=this.skipped[i];l<e.to&&s>e.from&&(this.fragments=Xo(this.fragments,l,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Dl{createParse(t,i,l){let s=l[0].from,o=l[l.length-1].to;return{parsedPos:s,advance(){let d=di;if(d){for(let h of l)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=o,new de(Ce.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return di}}function Xo(a,e,t){return ht.applyChanges(a,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ft{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ft(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Xi.create(e.facet($t).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ft(i)}}De.state=pt.define({create:Ft.init,update(a,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet($t)!=e.state.facet($t)?Ft.init(e.state):a.apply(e)}});let Jo=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Jo=a=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const pl=typeof navigator<"u"&&(!((fl=navigator.scheduling)===null||fl===void 0)&&fl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Eh=Et.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(De.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(De.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Jo(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:l}}=this.view,s=i.field(De.state);if(s.tree==s.context.tree&&s.context.isDone(l+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!pl?Math.max(25,e.timeRemaining()-5):1e9),r=s.context.treeLen<l&&i.doc.length>l+1e3,d=s.context.work(()=>pl&&pl()||Date.now()>o,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:De.setState.of(new Ft(s.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ze(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),$t=Q.define({combine(a){return a.length?a[0]:null},enables:a=>[De.state,Eh,ee.contentAttributes.compute([a],e=>{let t=e.facet(a);return t&&t.name?{"data-language":t.name}:{}})]});class Ih{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Dh=new Y;function Zo({except:a,units:e=1}={}){return t=>{let i=a&&a.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Ph=new Y;function Fh(a){let e=a.firstChild,t=a.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?a.to:t.from}:null}class ml{constructor(e,t){this.specs=e;let i;function l(r){let d=lt.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const s=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,o=t.scope;this.scope=o instanceof De?r=>r.prop(Pt)==o.data:o?r=>r==o:void 0,this.style=ql(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:s}).style,this.module=i?new lt(i):null,this.themeType=t.themeType}static define(e,t){return new ml(e,t||{})}}R.meta,R.link,R.heading,R.emphasis,R.strong,R.strikethrough,R.keyword,R.atom,R.bool,R.url,R.contentSeparator,R.labelName,R.literal,R.inserted,R.string,R.deleted,R.regexp,R.escape,R.string,R.variableName,R.variableName,R.typeName,R.namespace,R.className,R.variableName,R.macroName,R.propertyName,R.comment,R.invalid;const $h=Object.create(null),ea=[Ce.none],ta=[],ia=Object.create(null),Rh=Object.create(null);for(let[a,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Rh[a]=Lh($h,e);function gl(a,e){ta.indexOf(a)>-1||(ta.push(a),console.warn(e))}function Lh(a,e){let t=[];for(let r of e.split(" ")){let d=[];for(let h of r.split(".")){let c=a[h]||R[h];c?typeof c=="function"?d.length?d=d.map(c):gl(h,`Modifier ${h} used at start of tag`):d.length?gl(h,`Tag ${h} used as modifier`):d=Array.isArray(c)?c:[c]:gl(h,`Unknown highlighting tag ${h}`)}for(let h of d)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(r=>r.id),s=ia[l];if(s)return s.id;let o=ia[l]=Ce.define({id:ea.length,name:i,props:[zl({[i]:t})]});return ea.push(o),o.id}me.RTL,me.LTR;const jh=Yi.define({name:"json",parser:Pd.configure({props:[Dh.add({Object:Zo({except:/^\s*\}/}),Array:Zo({except:/^\s*\]/})}),Ph.add({"Object Array":Fh})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function zh(){return new Ih(jh)}const kl=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function qh(){const a=Ae();if(a.formRules?.length){const e={};kl.forEach(i=>{e[i.name]=i});const t=[...kl];return a.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):t.push(l)}),t}return kl}const Uh={loadAdvances:qh},Wh={class:"unione-props-setting data-field-setting"},Hh={key:0},Kh=["onClick"],Qh={class:"field-txt"},Gh=["onClick"],Yh={key:1,class:"field-txt"},Xh=["onClick"],Jh={key:0,class:"field-txt"},Zh={key:3,class:"edit-field"},ef=["onClick"],tf=Z(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=n.ref([zh()]),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"form",key:"form",width:"40px",align:"center"},{title:"详情",dataIndex:"view",key:"view",width:"40px",align:"center"},{title:"列表",dataIndex:"list",key:"list",width:"40px",align:"center"},{title:"排序",dataIndex:"sort",key:"sort",width:"40px",align:"center"},{title:"查询",dataIndex:"query",key:"query",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=n.useModel(a,"modelValue"),l={mounted:k=>k.focus()},s=n.ref({});function o(){const k=Object.keys(s.value);if(k.length)for(let p in k){const B=i.value.filter(V=>V.name==p);if(B&&B[0]){let V=s.value[p];Object.keys(V).forEach(C=>{C=="convertName"?(B[0].convert||(B[0].convert={}),B[0].convert.type=V[C]):B[0][C]=V[C]})}}s.value={}}function r(k,p){o();const B={};p=="convertName"?(k.convert||(k.convert={}),B[p]=k.convert?.type):B[p]=k[p]||"",s.value[k.name]=B}function d(k,p){{s.value={};return}}function h(k,p){switch(p){case"query":return k.configs?.query?.enable;case"form":return k.configs?.show?.form?.enable;case"view":return k.configs?.show?.view?.enable;case"list":return k.configs?.show?.list?.enable;case"sort":return k.configs?.sort?.enable}}function c(k,p){switch(p){case"query":k.configs=K.utils.obj.ext(k.configs,{query:{enable:!1}}),k.configs.query.enable=!k.configs.query.enable;break;case"form":k.configs=K.utils.obj.ext(k.configs,{show:{form:{enable:!1}}}),k.configs.show.form.enable=!k.configs.show.form.enable;break;case"view":k.configs=K.utils.obj.ext(k.configs,{show:{view:{enable:!1}}}),k.configs.show.view.enable=!k.configs.show.view.enable;break;case"list":k.configs=K.utils.obj.ext(k.configs,{show:{list:{enable:!1}}}),k.configs.show.list.enable=!k.configs.show.list.enable;break;case"sort":k.configs=K.utils.obj.ext(k.configs,{sort:{enable:!1}}),k.configs.sort.enable=!k.configs.sort.enable;break}console.log("record.configs",k.configs)}const f=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(k,p){switch(f.value.prop=p,f.value.field=k,k.configs||(k.configs={}),k.configs.show||(k.configs.show={}),p){case"query":k.configs.query||(k.configs.query={}),k.configs.query.types||(k.configs.query.types="EQ"),f.value.show=k.configs.query,f.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),f.value.show=k.configs.show.form,f.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),f.value.show=k.configs.show.view,f.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),f.value.show=k.configs.show.list,f.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),f.value.show=k.configs.sort,f.value.title=`排序设置/${k.title}(${k.name})`;break}f.value.visible=!0}const m=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:k=>{const p=m.value.options.filter(B=>B.value==k);return p[0]?p[0].label:k}}),b=n.ref({visible:!1,field:{},props:{},advances:Uh.loadAdvances(),showInfo:k=>{let p=0;if(k.configs?.rule){const B=k.configs.rule;B.advance&&p++,typeof B.rangeMin<"u"&&p++,typeof B.rangeMax<"u"&&p++,typeof B.regExpress<"u"&&p++}if(p>0)return"("+p+")"},toSetting:()=>{const k=b.value.props;b.value.field.configs=K.utils.obj.ext(b.value.field.configs,{rule:{...k}}),b.value.visible=!1,b.value.props={}}});function g(k){b.value.visible=!0,b.value.field=k,b.value.props=k.configs?.rule||{}}const v=n.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:k=>{const p=k.configs?.widget?.name,B=v.value.widgets.filter(V=>V.value==p);return B[0]?B[0].label:p},toSetting:(k,p)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=p},toclose:()=>{v.value.visible=!1}});function w(k){v.value.field=k,k.configs=K.utils.obj.ext(k.configs,{widget:{props:{}}}),v.value.widget=k.configs.widget,v.value.visible=!0}const x=n.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(k,p="--")=>x.value.types.filter(B=>B.value==k)[0]?.label||p,toAddOption:()=>{x.value.convert.options||(x.value.convert.options=[]),x.value.convert.options.push({label:"",value:""})},toDelOption:(k,p)=>{x.value.convert.options.splice(k,1)},toSetting:()=>{x.value.visible=!1}});function O(k){x.value.visible=!0,x.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),x.value.convert=k.configs.convert}return(k,p)=>{const B=n.resolveComponent("ToolOutlined"),V=n.resolveComponent("a-button"),C=n.resolveComponent("a-select"),y=n.resolveComponent("a-checkbox"),N=n.resolveComponent("a-table"),M=n.resolveComponent("a-switch"),A=n.resolveComponent("a-form-item"),E=n.resolveComponent("a-select-option"),D=n.resolveComponent("a-input-number"),z=n.resolveComponent("a-form"),P=n.resolveComponent("a-modal"),U=n.resolveComponent("a-input"),_=n.resolveComponent("unione-select-box"),F=n.resolveComponent("a-checkbox-group"),T=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",Wh,[n.createVNode(N,{columns:t.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["widget","queryType","rules","convertName"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",Hh,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:q,record:I})=>[["rules"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!b.value.showInfo(I)&&"empty"]),onClick:$=>g(I)},[n.createElementVNode("span",Qh,n.toDisplayString(b.value.showInfo(I)),1),b.value.showInfo(I)?(n.openBlock(),n.createBlock(V,{key:0,type:"link"},{default:n.withCtx(()=>p[50]||(p[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Kh)):["widget"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[I.name]||!Object.keys(s.value[I.name]).includes(S.dataIndex))&&!q&&"empty"]),onClick:$=>r(I,S.dataIndex)},[s.value[I.name]&&Object.keys(s.value[I.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:I.configs?.widget?.name,allowClear:!0,options:v.value.widgets,onChange:$=>v.value.toSetting(I,$),onBlur:p[0]||(p[0]=$=>d())},null,8,["value","options","onChange"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Yh,n.toDisplayString(v.value.widgetName(I)),1)),n.createVNode(V,{type:"link",onClick:n.withModifiers($=>w(I),["stop"])},{default:n.withCtx(()=>p[51]||(p[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Gh)):["convertName"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[I.name]||!Object.keys(s.value[I.name]).includes(S.dataIndex))&&!I.convert?.type&&"empty"]),onClick:$=>O(I)},[I.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Jh,n.toDisplayString(x.value.getTypes(I.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Xh)):["query","form","view","list","sort"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",Zh,[n.createVNode(y,{checked:h(I,S.dataIndex),onClick:$=>c(I,S.dataIndex)},null,8,["checked","onClick"]),n.createVNode(V,{type:"link",onClick:$=>u(I,S.dataIndex)},{default:n.withCtx(()=>p[52]||(p[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(P,{visible:f.value.visible,"onUpdate:visible":p[14]||(p[14]=S=>f.value.visible=S),width:600,title:f.value.title,onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(z,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:n.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:n.withCtx(()=>[n.createVNode(A,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.enable,"onUpdate:checked":p[1]||(p[1]=S=>f.value.show.enable=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(n.openBlock(),n.createBlock(A,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.defoult,"onUpdate:checked":p[2]||(p[2]=S=>f.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="sort"?(n.openBlock(),n.createBlock(A,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.asc,"onUpdate:checked":p[3]||(p[3]=S=>f.value.show.asc=S),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(A,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(A,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.defoult,"onUpdate:checked":p[4]||(p[4]=S=>f.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(A,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.show.visible,"onUpdate:checked":p[5]||(p[5]=S=>f.value.show.visible=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(A,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.types,"onUpdate:value":p[6]||(p[6]=S=>f.value.show.types=S)},{default:n.withCtx(()=>[n.createVNode(E,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>p[53]||(p[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(E,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>p[54]||(p[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(E,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>p[55]||(p[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(E,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>p[56]||(p[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(E,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>p[57]||(p[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(E,{key:"ADVANCE",value:"ADVANCE"},{default:n.withCtx(()=>p[58]||(p[58]=[n.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(A,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(D,{value:f.value.show.index,"onUpdate:value":p[7]||(p[7]=S=>f.value.show.index=S)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(A,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:f.value.show.width,"onUpdate:value":p[8]||(p[8]=S=>f.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(A,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,value:f.value.show.width,"onUpdate:value":p[9]||(p[9]=S=>f.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(A,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":p[10]||(p[10]=S=>f.value.show.labelWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(A,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":p[11]||(p[11]=S=>f.value.show.valueWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(A,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.fixed,"onUpdate:value":p[12]||(p[12]=S=>f.value.show.fixed=S),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(A,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.align,"onUpdate:value":p[13]||(p[13]=S=>f.value.show.align=S),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),n.createVNode(P,{visible:x.value.visible,"onUpdate:visible":p[33]||(p[33]=S=>x.value.visible=S),width:600,title:x.value.getTypes(x.value.convert.types,"转换")+"设置",onOk:x.value.toSetting},{default:n.withCtx(()=>[n.createVNode(z,{model:x.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(A,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:x.value.convert.types,"onUpdate:value":p[15]||(p[15]=S=>x.value.convert.types=S),allowClear:!0,options:x.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(x.value.field.widget?.name)?(n.openBlock(),n.createBlock(A,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(M,{checked:f.value.convert.search,"onUpdate:checked":p[16]||(p[16]=S=>f.value.convert.search=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="option"?(n.openBlock(),n.createBlock(A,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(V,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:x.value.toAddOption},{default:n.withCtx(()=>p[59]||(p[59]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(N,{columns:x.value.optionColumn,"data-source":x.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:S,record:q,index:I})=>[S.dataIndex==="label"?(n.openBlock(),n.createBlock(U,{key:0,value:q.label,"onUpdate:value":$=>q.label=$,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="value"?(n.openBlock(),n.createBlock(U,{key:1,value:q.value,"onUpdate:value":$=>q.value=$,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:$=>x.value.toDelOption(I,q)},"删除",8,ef)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(x.value.convert.types)?(n.openBlock(),n.createBlock(A,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(_,{value:x.value.convert.dsId,"onUpdate:value":p[17]||(p[17]=S=>x.value.convert.dsId=S),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.tableName,"onUpdate:value":p[18]||(p[18]=S=>x.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.tableName,"onUpdate:value":p[19]||(p[19]=S=>x.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"&&["unione-tree-box"].includes(x.value.field.widget?.name)?(n.openBlock(),n.createBlock(A,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.idField,"onUpdate:value":p[20]||(p[20]=S=>x.value.convert.idField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"&&["unione-tree-box"].includes(x.value.field.widget?.name)?(n.openBlock(),n.createBlock(A,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.pidField,"onUpdate:value":p[21]||(p[21]=S=>x.value.convert.pidField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.valueField,"onUpdate:value":p[22]||(p[22]=S=>x.value.convert.valueField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.labelField,"onUpdate:value":p[23]||(p[23]=S=>x.value.convert.labelField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.tableField,"onUpdate:value":p[24]||(p[24]=S=>x.value.convert.tableField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.tableWhere,"onUpdate:value":p[25]||(p[25]=S=>x.value.convert.tableWhere=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.tableOrder,"onUpdate:value":p[26]||(p[26]=S=>x.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.tableOrder,"onUpdate:value":p[27]||(p[27]=S=>x.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:x.value.convert.isAsync,"onUpdate:checked":p[28]||(p[28]=S=>x.value.convert.isAsync=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(A,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:x.value.convert.isPaging,"onUpdate:checked":p[29]||(p[29]=S=>x.value.convert.isPaging=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dict"?(n.openBlock(),n.createBlock(A,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.dictName,"onUpdate:value":p[30]||(p[30]=S=>x.value.convert.dictName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(x.value.convert.types)?(n.openBlock(),n.createBlock(A,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode(U,{value:x.value.convert.url,"onUpdate:value":p[31]||(p[31]=S=>x.value.convert.url=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(x.value.convert.types)?(n.openBlock(),n.createBlock(A,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:x.value.convert.params,"onUpdate:modelValue":p[32]||(p[32]=S=>x.value.convert.params=S),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(P,{visible:v.value.visible,"onUpdate:visible":p[40]||(p[40]=S=>v.value.visible=S),width:600,title:"控件设置",onOk:v.value.toclose},{default:n.withCtx(()=>[n.createVNode(z,{model:v.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(A,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(C,{value:v.value.widget.name,"onUpdate:value":p[34]||(p[34]=S=>v.value.widget.name=S),allowClear:!0,options:v.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),n.createVNode(A,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode(U,{value:v.value.widget.placeholder,"onUpdate:value":p[35]||(p[35]=S=>v.value.widget.placeholder=S)},null,8,["value"])]),_:1}),n.createVNode(A,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode(U,{value:v.value.widget.help,"onUpdate:value":p[36]||(p[36]=S=>v.value.widget.help=S)},null,8,["value"])]),_:1}),n.createVNode(A,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode(U,{value:v.value.widget.tooltip,"onUpdate:value":p[37]||(p[37]=S=>v.value.widget.tooltip=S)},null,8,["value"])]),_:1}),["a-date-picker"].includes(v.value.widget.name)?(n.openBlock(),n.createBlock(A,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode(U,{value:v.value.field.dataFormat,"onUpdate:value":p[38]||(p[38]=S=>v.value.field.dataFormat=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(A,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:v.value.widget.props.mode,"onUpdate:value":p[39]||(p[39]=S=>v.value.widget.props.mode=S),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(E,{value:"multiple"},{default:n.withCtx(()=>p[60]||(p[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(E,{value:"tags"},{default:n.withCtx(()=>p[61]||(p[61]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(P,{visible:b.value.visible,"onUpdate:visible":p[49]||(p[49]=S=>b.value.visible=S),width:600,title:"规则设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(z,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(T,{title:"基本设置",type:"line"},{default:n.withCtx(()=>[n.createVNode(A,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(F,{value:b.value.props.trigger,"onUpdate:value":p[41]||(p[41]=S=>b.value.props.trigger=S),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(A,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(y,{checked:b.value.props.whitespace,"onUpdate:checked":p[42]||(p[42]=S=>b.value.props.whitespace=S)},{default:n.withCtx(()=>p[62]||(p[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(A,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(C,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":p[43]||(p[43]=S=>b.value.props.advance=S)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(n.openBlock(),n.createBlock(T,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(A,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(D,{value:b.value.props.rangeMin,"onUpdate:value":p[44]||(p[44]=S=>b.value.props.rangeMin=S)},null,8,["value"]),p[63]||(p[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(D,{value:b.value.props.rangeMax,"onUpdate:value":p[45]||(p[45]=S=>b.value.props.rangeMax=S)},null,8,["value"])]),_:1}),n.createVNode(A,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(U,{value:b.value.props.rangeMessage,"onUpdate:value":p[46]||(p[46]=S=>b.value.props.rangeMessage=S)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(T,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(A,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(U,{value:b.value.props.regExpress,"onUpdate:value":p[47]||(p[47]=S=>b.value.props.regExpress=S)},null,8,["value"])]),_:1}),n.createVNode(A,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(U,{value:b.value.props.regMessage,"onUpdate:value":p[48]||(p[48]=S=>b.value.props.regMessage=S)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),nf={class:"unione-props-setting data-field-fkey"},lf={key:0},sf=["onClick"],of=["onClick"],af=["onClick"],rf=["onClick"],df=["onClick"],cf=["onClick"],hf=["onClick"],ff=["onClick"],uf=Z(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),i=n.useModel(a,"modelValue"),l=n.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),s=n.ref({});function o(){s.value={}}function r(u,m){o();const b={};b[m]=u.configs.fkey[m]||"",s.value[u.name]=b}function d(u,m,b){u.configs.fkey.dsn=m,u.configs.fkey.dsnName=b.name,u.configs.fkey.dsnTitle=b.title,u.configs.fkey.dsnId=b.id}function h(u,m,b,g){u.configs.fkey[m]=b,m=="fieldName"&&(u.configs.fkey.fieldTitle=g.title),m=="labelName"&&(u.configs.fkey.labelTitle=g.title)}function c(u){f.value.record=u,f.value.visible=!0,f.value.fields=u.configs?.fkey?.fields||[]}const f=n.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(u,m)=>{f.value.editField[u]=m},onShowFieldChange:(u,m,b)=>{u.name=b.name,u.title=b.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(u,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=K.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,m)=>{const b=n.resolveComponent("FormOutlined"),g=n.resolveComponent("unione-select-box"),v=n.resolveComponent("a-button"),w=n.resolveComponent("a-table"),x=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",nf,[n.createVNode(w,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:n.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(n.openBlock(),n.createElementBlock("span",lf,[n.createVNode(b),n.createTextVNode(" "+n.toDisplayString(k.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:k,record:p})=>[["dsnName"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.dsnName&&"empty"]),onClick:B=>r(p,k.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[p.name][k.dataIndex],"onUpdate:value":B=>s.value[p.name][k.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:o,onSelect:(B,V)=>d(p,B,V)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnName),1)],64))],10,sf)):["dsnTitle"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.dsnTitle&&"empty"]),onClick:B=>r(p,k.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[p.name][k.dataIndex],"onUpdate:value":B=>s.value[p.name][k.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:o,onSelect:(B,V)=>d(p,B,V)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnTitle),1)],64))],10,of)):n.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.fieldName&&"empty"]),onClick:B=>r(p,k.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[p.name][k.dataIndex],"onUpdate:value":B=>s.value[p.name][k.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:o,onSelect:(B,V)=>h(p,"fieldName",B,V)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.fieldTitle),1)],64))],10,af)):["labelName"].includes(k.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.labelName&&"empty"]),onClick:B=>r(p,k.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(k.dataIndex)?(n.openBlock(),n.createBlock(g,{key:0,value:s.value[p.name][k.dataIndex],"onUpdate:value":B=>s.value[p.name][k.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:o,onSelect:(B,V)=>h(p,"labelName",B,V)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.labelTitle)+" ",1),p.configs?.fkey?.labelName?(n.openBlock(),n.createBlock(v,{key:0,type:"link",onClick:n.withModifiers(B=>c(p),["stop"])},{default:n.withCtx(()=>m[4]||(m[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,rf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(O,{visible:f.value.visible,"onUpdate:visible":m[3]||(m[3]=k=>f.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(v,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:n.withCtx(()=>m[5]||(m[5]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(w,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:n.withCtx(({column:k,record:p,index:B,text:V})=>[k.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",f.value.editField!="title"&&!V&&"empty"]),onClick:C=>f.value.toEditField(B,k.dataIndex)},[f.value.editField[B]=="title"?(n.openBlock(),n.createBlock(g,{key:0,value:p[p.dataIndex],"onUpdate:value":C=>p[p.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=C=>f.value.editField={}),onSelect:(C,y)=>f.value.onShowFieldChange(p,C,y)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V),1)],64))],10,df)):n.createCommentVNode("",!0),k.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",f.value.editField!="width"&&!V&&"empty"]),onClick:C=>f.value.toEditField(B,k.dataIndex)},[f.value.editField[B]=="width"?(n.openBlock(),n.createBlock(x,{key:0,onBlur:m[1]||(m[1]=C=>f.value.editField={}),value:p.width,"onUpdate:value":C=>p.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V),1)],64))],10,cf)):n.createCommentVNode("",!0),k.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!V&&"empty"]),onClick:C=>f.value.toEditField(B,k.dataIndex)},[f.value.editField[B]=="index"?(n.openBlock(),n.createBlock(x,{key:0,onBlur:m[2]||(m[2]=C=>f.value.editField={}),value:p.index,"onUpdate:value":C=>p.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V),1)],64))],10,hf)):n.createCommentVNode("",!0),k.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:C=>f.value.toDelField(B)},"删除",8,ff)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),pf={class:"unione-props-setting data-filter"},mf={class:"title"},gf={class:"name"},kf={class:"action"},bf=Z(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),t=n.useModel(a,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(h){r.value.visible=!0,r.value.filter={...h},r.value.name=h.name}function s(h){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(h,1)}})}const o=n.ref(),r=n.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{o.value.validate().then(h=>{if(r.value.name){const c=t.value.filter(f=>f.name==r.value.name)[0];if(!c){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(h).forEach(f=>{c[f]=h[f]})}else{if(t.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(h)}r.value.visible=!1})}});function d(){const h=[];r.value.filter.filter||(r.value.filter.filter=""),h.push("-- @if(isNotEmpty(params."),h.push(r.value.filter.name||"xxx"),h.push(") && !isBlank(params."),h.push(r.value.filter.name||"xxx"),h.push(`)
|
|
11
11
|
`),h.push(" AND XXX=#{params."),h.push(r.value.filter.name||"xxx"),h.push(`}
|
|
12
12
|
`),h.push(`-- @}
|
|
13
|
-
`),r.value.filter.filter=r.value.filter.filter+h.join("")}return(h,c)=>{const f=n.resolveComponent("a-button"),u=n.resolveComponent("a-card"),
|
|
13
|
+
`),r.value.filter.filter=r.value.filter.filter+h.join("")}return(h,c)=>{const f=n.resolveComponent("a-button"),u=n.resolveComponent("a-card"),m=n.resolveComponent("PlusOutlined"),b=n.resolveComponent("a-empty"),g=n.resolveComponent("a-input"),v=n.resolveComponent("a-form-item"),w=n.resolveComponent("a-textarea"),x=n.resolveComponent("a-tag"),O=n.resolveComponent("a-form"),k=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",pf,[(t.value.length,n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,(p,B)=>(n.openBlock(),n.createBlock(u,{class:"filter-box",size:"small",key:B},{default:n.withCtx(()=>[n.createElementVNode("div",mf,"过滤标题:"+n.toDisplayString(p.title),1),n.createElementVNode("div",gf,"过滤名称:"+n.toDisplayString(p.name),1),n.createElementVNode("div",kf,[n.createVNode(f,{size:"small",onClick:V=>l(p)},{default:n.withCtx(()=>c[4]||(c[4]=[n.createTextVNode("编辑")])),_:2},1032,["onClick"]),n.createVNode(f,{danger:"",size:"small",onClick:V=>s(B)},{default:n.withCtx(()=>c[5]||(c[5]=[n.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),n.createVNode(u,{class:"filter-box btn-add",size:"small",onClick:i},{default:n.withCtx(()=>[n.createVNode(m,{class:"btn"})]),_:1})],64)),n.createVNode(k,{visible:r.value.visible,"onUpdate:visible":c[3]||(c[3]=p=>r.value.visible=p),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:n.withCtx(()=>[n.createVNode(O,{ref_key:"filterForm",ref:o,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(v,{label:"过滤标题",name:"title"},{default:n.withCtx(()=>[n.createVNode(g,{value:r.value.filter.title,"onUpdate:value":c[0]||(c[0]=p=>r.value.filter.title=p)},null,8,["value"])]),_:1}),n.createVNode(v,{label:"过滤名称",name:"name"},{default:n.withCtx(()=>[n.createVNode(g,{value:r.value.filter.name,"onUpdate:value":c[1]||(c[1]=p=>r.value.filter.name=p)},null,8,["value"])]),_:1}),n.createVNode(v,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:n.withCtx(()=>[n.createVNode(w,{value:r.value.filter.filter,"onUpdate:value":c[2]||(c[2]=p=>r.value.filter.filter=p),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),n.createVNode(x,{class:"btn-tmpl",color:"blue",onClick:d},{default:n.withCtx(()=>c[6]||(c[6]=[n.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),yf={class:"unione-page form-page data-define-edit"},wf={class:"actions"},xf=Z(n.defineComponent({__name:"edit",setup(a){const e=K.useDialog(),t=n.inject("route"),i=n.inject("router"),l=n.ref(),s=n.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),o=n.ref(),r=n.ref({isPrimary:!1,fields:[{title:"列表模版",name:"listTmpl",control:"unione-select-box",value:"normal",convert:{types:"option",options:[{value:"normal",label:"标准"}]},props:{required:!0}},{title:"表单风格",name:"showColumn",control:"unione-select-box",value:2,convert:{types:"option",options:[{value:1,label:"一列"},{value:2,label:"二列"},{value:3,label:"三列"}]},props:{required:!0}},{title:"标题宽度",name:"labelWidth",control:"a-input-number",value:9,rule:{rangeMin:1,rangeMax:24},props:{required:!0}}],setting:{showColumn:2,labelWidth:6}}),d=n.ref({configs:{fields:[],filters:[]}}),h=n.ref(!1);function c(){i.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([d.value.id]).then(g=>{g.success?(e.success({title:"发布成功",content:g.body}),b(d.value.id)):e.error({title:"发布失败",content:g.body})})}})}async function u(){const g=await l.value.validate(),v={...d.value,...g};v.configs.show=await o.value.getValue(),console.log("formData",v),G.message.loading({content:"提交中..."}),h.value=!0,ct.save(v).then(w=>{G.message.destroy(),w.success?(d.value=w.body,l.value.setValue(w.body),o.value.setValue(w.body.configs?.show||{}),G.message.success("保存成功!")):G.message.error(w.message)}).finally(()=>{h.value=!1})}const m=n.ref(!1);n.onMounted(()=>{t.query.id&&b(t.query.id)});function b(g){G.message.loading({content:"加载中..."}),ct.detail(g).then(v=>{v.success?(d.value=v.body,l.value.setValue(v.body),o.value.setValue(v.body.configs?.show||{}),G.message.destroy()):G.message.error(v.message)})}return(g,v)=>{const w=n.resolveComponent("unione-form"),x=n.resolveComponent("unione-section"),O=n.resolveComponent("OrderedListOutlined"),k=n.resolveComponent("a-tab-pane"),p=n.resolveComponent("ToolOutlined"),B=n.resolveComponent("ApiOutlined"),V=n.resolveComponent("FunnelPlotOutlined"),C=n.resolveComponent("a-tabs"),y=n.resolveComponent("a-button");return n.openBlock(),n.createElementBlock("div",yf,[n.createVNode(x,{title:"基础信息",type:"line"},{default:n.withCtx(()=>[n.createVNode(w,{form:s.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),n.createVNode(x,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":v[0]||(v[0]=N=>m.value=N)},{default:n.withCtx(()=>[n.createVNode(w,{form:r.value,ref_key:"pageSettingObj",ref:o},null,8,["form"])]),_:1},8,["type","location","modelValue"]),n.createVNode(C,null,{default:n.withCtx(()=>[n.createVNode(k,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(O),v[5]||(v[5]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(ud,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[1]||(v[1]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(k,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(p),v[6]||(v[6]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(tf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[2]||(v[2]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(k,{key:"field-fkeys"},{tab:n.withCtx(()=>[n.createVNode(B),v[7]||(v[7]=n.createTextVNode("外键设置 "))]),default:n.withCtx(()=>[n.createVNode(uf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[3]||(v[3]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(k,{key:"data-filter"},{tab:n.withCtx(()=>[n.createVNode(V),v[8]||(v[8]=n.createTextVNode("数据过滤 "))]),default:n.withCtx(()=>[n.createVNode(bf,{modelValue:d.value.configs.filters,"onUpdate:modelValue":v[4]||(v[4]=N=>d.value.configs.filters=N)},null,8,["modelValue"])]),_:1})]),_:1}),n.createElementVNode("div",wf,[n.createVNode(y,{type:"primary",onClick:u,loading:h.value},{default:n.withCtx(()=>v[9]||(v[9]=[n.createTextVNode("保存")])),_:1},8,["loading"]),d.value.id?(n.openBlock(),n.createBlock(y,{key:0,danger:"",onClick:f,loading:h.value},{default:n.withCtx(()=>v[10]||(v[10]=[n.createTextVNode("发布")])),_:1},8,["loading"])):n.createCommentVNode("",!0),n.createVNode(y,{onClick:c},{default:n.withCtx(()=>v[11]||(v[11]=[n.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),vf={UnioneEditor:wt,locales:Zi,loadConfig:Ae,DataStorage:en,install(a,e){K.loadConfig(e);const t=Ae(e);t.axios&&K.axios.create(t.axios),a.component("UnioneBtn",ya),a.component("UnioneTabs",xa),a.component("UnioneSection",Oa),a.component("UnioneQuery",vl),a.component("UnioneTable",Cl),a.component("UnioneFormItem",Ua),a.component("UnioneForm",ja),a.component("UnioneSelectBox",Wa),a.component("UnioneSwitchBox",Ha),a.component("UnioneRadioBox",Ka),a.component("UnioneCheckBox",Qa),a.component("UnionePwdBox",Ga),a.component("UnionePageEditor",Sl),a.component("UnionePageForm",Nl),a.component("UnionePageTree",Bl),a.component("UnionePageList",Ol)}};J.DataStorage=en,J.UnioneDataDefineEdit=xf,J.UnioneDataDefineList=sd,J.UnioneEditor=wt,J.UnionePage=jt,J.UnionePageEditor=Sl,J.UnionePageForm=Nl,J.UnionePageList=Ol,J.UnionePageSetting=zt,J.UnionePageTree=Bl,J.UnioneQueryForm=vl,J.UnioneTableList=Cl,J.default=vf,J.loadConfig=Ae,J.locales=Zi,J.utils=mr,Object.defineProperties(J,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|