unione-form-vue 0.0.5 → 0.0.7

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(ie,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("unione-base-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","vue","unione-base-vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],n):(ie=typeof globalThis<"u"?globalThis:ie||self,n(ie.index={},ie.Vue,ie.UnioneBaseVue,ie.antDesignVue,ie.lodashEs,ie.vueCodemirror,ie.langJavascript,ie.iconsVue,ie.uuid))})(this,function(ie,n,W,G,ea,Ft,ta,We,ia){"use strict";const na={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(na);function Me(o){return o&&(Ji.value=W.utils.obj.ext(Ji.value,o)),Ji.value}const sa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},la={...{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"}},oa=n.ref([sa,la]);function aa(o,e){return W.locales.loadLanguage(o,()=>new Promise((t,i)=>{const s=oa.value.filter(l=>l.localeName==o);if(e)if(typeof e=="function")e().then(l=>{if(s.length==0){const a={...l,localeName:o};t(a)}else{const a={...s[0],...l};t(a)}});else if(s.length==0){const l={...e,localeName:o};t(l)}else{const l={...s[0],...e};t(l)}else s.length>0?t(s[0]):i("local language not defined ,lang:"+o)}))}const Zi={...W.locales};Zi.loadLanguage=aa;class ra{$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){return 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))),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 s=this.$store.value[e];return s||(s=new da(e,t,this.$model),this.$store.value[e]=s),i&&(this.$forms.value[e]=i),s}useForm(e,t,i){const s=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&s.detail(this.$pid.value).then(l=>{i&&i(l)}),s}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 da{$dsn;$type;$data;$dialog;$model;constructor(e,t,i){this.$dsn=e,this.$type=t,this.$data=n.ref(t=="form"?{}:[]),this.$dialog=W.useDialog(),this.$model=i}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}find(e){const t="/api/data/storage/v1/find";return e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),new Promise((i,s)=>{const l=G.message.loading("数据加载中...");W.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$data.value=a.body,i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),s({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),s({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:a})}).finally(()=>{l()})})}save(e){const t="/api/data/storage/v1/save";return e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),new Promise((i,s)=>{const l=G.message.loading("数据提交中...");W.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body||{}),i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),s({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),s({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:a})}).finally(()=>{l()})})}loadByIds(e){return new Promise((t,i)=>{const s=G.message.loading("数据加载中...");W.axios.form({url:"/api/data/storage/v1/loadByIds",method:"post",data:{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:a})}).finally(()=>{s()})})}detail(e){return new Promise((t,i)=>{const s=G.message.loading("数据加载中..."),l="/api/data/storage/v1/detail";W.axios.form({url:l,method:"post",data:{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body),t(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:l,id:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:l,id:e,err:a})}).finally(()=>{s()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const s=G.message.loading("数据处理中..."),l="/api/data/storage/v1/delete";W.axios.form({url:l,method:"post",data:{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:l,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:l,ids:e,err:a})}).finally(()=>{s()})}})})}}class ca{$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 Rt{define;ebus;model;$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.define=n.ref(e),this.ebus=new ca,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ra(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=W.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.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}W.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(s=>{s.success?(this.define.value=s.body,s.body.configs?this.define.value.configs=s.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()},s={...this.define.value};s.configs=JSON.stringify(i),W.axios.form({url:"/api/page/define/save",method:"post",data:s}).then(l=>{this.$axiosProccess.value.save=!1,l.success?(G.message.success(l.message),this.define.value=l.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(l.body)):(this.$dialog.error({content:l.message}),t())}).catch(l=>{console.error("页面配置保存失败",l),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:"+ea.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ha={class:"widget-setting-dialog"},fa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=e,i=n.ref(),s=n.ref(!1);function l(){i.value&&(s.value=!0),t("setting")}function a(){t("saving"),s.value=!1}return(r,d)=>{const c=n.resolveComponent("SettingOutlined"),h=n.resolveComponent("a-tooltip"),f=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",o.model])},[n.createVNode(h,{title:o.settingTitle},{default:n.withCtx(()=>[o.model=="edit"&&(r.$slots["widget-setting"]||o.custome)?(n.openBlock(),n.createBlock(c,{key:0,class:"widget-setting",onClick:l})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),o.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(f,{key:0,title:o.settingTitle,ref_key:"settingModal",ref:i,open:s.value,"onUpdate:open":d[0]||(d[0]=u=>s.value=u),centered:"",width:"80%",onOk:a},{default:n.withCtx(()=>[n.createElementVNode("div",ha,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),Y=(o,e)=>{const t=o.__vccOpts||o;for(const[i,s]of e)t[i]=s;return t},rt=Y(fa,[["__scopeId","data-v-3a88c0c0"]]),ua={key:0},pa=["onClick"],ai=Y(n.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(o,{expose:e}){const t=o,i=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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"}]),s=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:g=>{s.value.selectedRowKeys=g}}),l={mounted:g=>g.focus()},a=n.ref({});function r(){const g=Object.keys(a.value);if(g.length)for(let m in g){const S=k.value.form.action.params[m];S&&a.value[m]&&Object.keys(a.value[m]).forEach(_=>{S[_]=a.value[m][_]})}a.value={}}function d(g,m,S){r();const _={};_[S]=m[S]||"",S=="showIndex"&&(_[S]=m.show?.query?.index),a.value[g]=_}function c(g,m,S){if(!m||!S){a.value={};return}const _=a.value[g][S];m[S]=_,a.value={}}function h(){k.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:(g,m)=>u.value!=m&&t.preset.includes(m)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=n.ref([ta.javascript()]),k=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),v=n.ref();function C(g,m,S={}){g=JSON.parse(JSON.stringify(g)),g.event||(g.event={}),g.props||(g.props={}),g.action||(g.action={}),Object.keys(g.action).includes("maskClosable")||(g.action.maskClosable=!0),g.action.params||(g.action.params=[]),u.value=g.name,k.value.form=g,k.value.helps=S,k.value.visible=!0,v.value=m}const x=n.ref(null);function V(){x.value&&x.value.validate().then(()=>{k.value.visible=!1,v.value(k.value.form)})}return e({open:C,close}),(g,m)=>{const S=n.resolveComponent("a-input"),_=n.resolveComponent("a-form-item"),y=n.resolveComponent("a-select"),w=n.resolveComponent("a-input-number"),N=n.resolveComponent("a-checkbox"),A=n.resolveComponent("a-tab-pane"),O=n.resolveComponent("a-switch"),D=n.resolveComponent("a-button"),M=n.resolveComponent("a-divider"),E=n.resolveComponent("ToolOutlined"),z=n.resolveComponent("a-tooltip"),$=n.resolveComponent("a-table"),I=n.resolveComponent("a-tabs"),K=n.resolveComponent("a-form"),L=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock(L,{visible:k.value.visible,"onUpdate:visible":m[23]||(m[23]=B=>k.value.visible=B),title:k.value.title,centered:"",width:"50%",onOk:V},{default:n.withCtx(()=>[n.createVNode(K,{name:"basic",ref_key:"form",ref:x,rules:p.value,model:k.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(I,null,{default:n.withCtx(()=>[n.createVNode(A,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.title,"onUpdate:value":m[0]||(m[0]=B=>k.value.form.title=B)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.name,"onUpdate:value":m[1]||(m[1]=B=>k.value.form.name=B),disabled:t.preset.includes(k.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(_,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.icon,"onUpdate:value":m[2]||(m[2]=B=>k.value.form.icon=B)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(y,{value:k.value.form.type,"onUpdate:value":m[3]||(m[3]=B=>k.value.form.type=B),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(w,{value:k.value.form.index,"onUpdate:value":m[4]||(m[4]=B=>k.value.form.index=B)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(y,{value:k.value.form.size,"onUpdate:value":m[5]||(m[5]=B=>k.value.form.size=B),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(N,{checked:k.value.form.props.block,"onUpdate:checked":m[6]||(m[6]=B=>k.value.form.props.block=B)},{default:n.withCtx(()=>m[24]||(m[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:k.value.form.props.danger,"onUpdate:checked":m[7]||(m[7]=B=>k.value.form.props.danger=B)},{default:n.withCtx(()=>m[25]||(m[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:k.value.form.props.ghost,"onUpdate:checked":m[8]||(m[8]=B=>k.value.form.props.ghost=B)},{default:n.withCtx(()=>m[26]||(m[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(A,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(y,{value:k.value.form.action.type,"onUpdate:value":m[9]||(m[9]=B=>k.value.form.action.type=B),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.psn,"onUpdate:value":m[10]||(m[10]=B=>k.value.form.action.psn=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.component,"onUpdate:value":m[11]||(m[11]=B=>k.value.form.action.component=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(_,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.href,"onUpdate:value":m[12]||(m[12]=B=>k.value.form.action.href=B)},null,8,["value"])]),_:1}),["link","route"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(y,{value:k.value.form.action.target,"onUpdate:value":m[13]||(m[13]=B=>k.value.form.action.target=B),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(y,{value:k.value.form.action.position,"onUpdate:value":m[14]||(m[14]=B=>k.value.form.action.position=B),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.title,"onUpdate:value":m[15]||(m[15]=B=>k.value.form.action.title=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(O,{checked:k.value.form.action.maskClosable,"onUpdate:checked":m[16]||(m[16]=B=>k.value.form.action.maskClosable=B),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(w,{value:k.value.form.action.width,"onUpdate:value":m[17]||(m[17]=B=>k.value.form.action.width=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(w,{value:k.value.form.action.height,"onUpdate:value":m[18]||(m[18]=B=>k.value.form.action.height=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(M,{orientation:"left"},{default:n.withCtx(()=>[m[29]||(m[29]=n.createTextVNode("参数列表 ")),n.createVNode(D,{size:"small",class:"param-btn",onClick:h},{default:n.withCtx(()=>m[27]||(m[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(D,{size:"small",class:"param-btn",danger:"",onClick:f},{default:n.withCtx(()=>m[28]||(m[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode($,{columns:i.value,"data-source":k.value.form.action.params,bordered:"",pagination:!1,"row-selection":s.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:B})=>[["name","title"].includes(B.key)?(n.openBlock(),n.createElementBlock("span",ua,[n.createVNode(E),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),["value"].includes(B.key)?(n.openBlock(),n.createBlock(z,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(E),n.createTextVNode(" "+n.toDisplayString(B.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:B,text:Q,record:T,index:j})=>[["name","title","value"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!a.value[j]||!Object.keys(a.value[j]).includes(B.dataIndex))&&!Q&&"empty"]),onClick:he=>d(j,T,B.dataIndex)},[a.value[j]&&Object.keys(a.value[j]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(S,{key:0,value:a.value[j][B.dataIndex],"onUpdate:value":he=>a.value[j][B.dataIndex]=he,onBlur:he=>c(j,T,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(Q),1)],64))],10,pa)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(A,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"点击事件",help:k.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.clickScript,"onUpdate:modelValue":m[19]||(m[19]=B=>k.value.form.event.clickScript=B),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:k.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.disableScript,"onUpdate:modelValue":m[20]||(m[20]=B=>k.value.form.event.disableScript=B),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:k.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.visibleScript,"onUpdate:modelValue":m[21]||(m[21]=B=>k.value.form.event.visibleScript=B),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:k.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.titleScript,"onUpdate:modelValue":m[22]||(m[22]=B=>k.value.form.event.titleScript=B),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"]]),ma=["src"],ga=["src"],ka=Y(n.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(o,{emit:e}){const t=Me(),i=o,s=W.useSession();n.watch(()=>i.widget?.event,()=>{a()}),n.onMounted(()=>{a()});const l=n.ref({});function a(){i.widget?.event&&(i.widget.event.clickScript&&(l.value.click=new Function("ctx","btn","event",i.widget.event.clickScript)),i.widget.event.disableScript&&(l.value.disable=new Function("ctx","btn",i.widget.event.disableScript)),i.widget.event.visibleScript&&(l.value.visible=new Function("ctx","btn",i.widget.event.visibleScript)),i.widget.event.titleScript&&(l.value.title=new Function("ctx","btn",i.widget.event.titleScript)))}const r=n.computed(()=>l.value.title?l.value.title(u.value,i.widget):i.widget.title),d=n.computed(()=>l.value.visible?l.value.visible(u.value,i.widget)!=!1:!0),c=n.computed(()=>l.value.disable?l.value.disable(u.value,i.widget):!1),h=n.ref(null);function f(){h.value?.open(i.widget,V=>{console.log("btn props",V),Object.keys(V).forEach(g=>{i.widget[g]=V[g]}),console.log("props btn",i.widget)})}const u=n.computed(()=>({...i.ctx,user:s.getPrincipal(),token:s.getToken()})),p=n.ref({open:!1}),b=n.computed(()=>{if(i.widget.action?.href){let V=i.widget.action.href;const g=V.matchAll("{[a-zA-Z.]*}"),m=[];let S=null;for(;S=g.next();){if(S&&S.value&&S.value[0]){let _=S.value[0].substring(1,S.value[0].length-1);m.includes(_)||m.push(_)}if(S.done)break}if(m.length>0)for(let _=0;_<m.length;_++){let y=m[_],w=W.utils.obj.getValue(u.value,y);w?w instanceof Object?V=V.replaceAll("{"+y+"}",JSON.stringify(w)):Array.isArray(w)?V=V.replaceAll("{"+y+"}",w.join(",")):V=V.replaceAll("{"+y+"}",w):V=V.replaceAll("{"+y+"}","")}return V}return""}),k=n.computed(()=>{const V={};if(i.widget.action?.href){let g=i.widget.action.href;const m=g.matchAll("{[a-zA-Z0-9.]*}"),S=[];let _=null;for(;_=m.next();){if(_&&_.value&&_.value[0]){let w=_.value[0].substring(1,_.value[0].length-1);S.includes(w)||S.push(w)}if(_.done)break}if(S.length>0)for(let w=0;w<S.length;w++){let N=S[w],A=W.utils.obj.getValue(u.value,N);A?A instanceof Object?g=g.replaceAll("{"+N+"}",JSON.stringify(A)):Array.isArray(A)?g=g.replaceAll("{"+N+"}",A.join(",")):g=g.replaceAll("{"+N+"}",A):g=g.replaceAll("{"+N+"}","")}const y=g.split("?")[1];y&&y.split("&").forEach(w=>{const N=w.split("=");N[0]&&N[1]&&(V[N[0]]=N[1])})}return i.widget.action?.params&&i.widget.action.params.filter(g=>g.value+"").forEach(g=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(g.value)){let S=W.utils.obj.getValue(u.value,g.value);V[g.name]=S}else V[g.name]=g.value}),V}),v=e,C=n.inject("router");function x(V){t.isDebug&&console.log("unione btn click",i.widget,V),!(l.value.click&&l.value.click(u.value,i.widget,V)==!1)&&(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog"?p.value.open=!0:i.widget.action?.type=="route"&&i.widget.action?.href&&C.push({path:i.widget.action.href,query:k.value}),v("click",{btn:i.widget,event:V}))}return(V,g)=>{const m=n.resolveComponent("a-button"),S=n.resolveComponent("a-drawer"),_=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(rt,{key:0,class:n.normalizeClass(["unione-btn",o.widget.props?.block&&"unione-btn-block"]),model:o.editor?.model.value,onSetting:f,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[n.createVNode(m,n.mergeProps({disabled:c.value,size:o.widget.size||"small",type:o.type||o.widget.type,shape:o.widget.shape,class:"unione-btn-"+o.widget.name,loading:o.widget.loading,target:o.widget.action?.target,onClick:x},o.widget.props),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value)+" ",1)]),_:2},[o.widget.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target"]),o.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(S,{key:0,open:p.value.open,"onUpdate:open":g[0]||(g[0]=y=>p.value.open=y),title:o.widget.action?.title,placement:o.widget.action?.position,maskClosable:o.widget.action?.maskClosable,width:o.widget.action?.width,bodyStyle:{padding:0,overflow:!o.widget.action.component||o.widget.action.component=="iframe"?"hidden":"auto"}},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value},null,8,ma)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),o.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(_,{key:1,open:p.value.open,"onUpdate:open":g[1]||(g[1]=y=>p.value.open=y),title:o.widget.action?.title,width:o.widget.action?.width,maskClosable:o.widget.action?.maskClosable,centered:"",footer:null},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value,style:n.normalizeStyle({height:o.widget.action?.height?o.widget.action?.height+"px":""})},null,12,ga)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(ai,{ref_key:"btnSetting",ref:h,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-672f13d5"]]),ba={key:0,class:"unione-widget-empty-tip"},wa=Y(n.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(o){const e=o,t=n.ref(),i=n.computed(()=>e.editor?.widget(e.wid)||e.widget);return(s,l)=>{const a=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":l[0]||(l[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,c)=>(n.openBlock(),n.createBlock(a,{key:c,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,(h,f)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",ba,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),ya={class:"title"},xa={class:"text"},va={key:0,class:"reactive"},Ca={key:1,class:"opts"},Sa={class:"warp"},Na=Y(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(o){const e=o,t=n.computed(()=>e.editor?.widget(e.wid)||e.widget),i=n.computed(()=>t.value?.title||e.title),s=n.computed(()=>t.value?.icon||e.icon),l=n.computed(()=>t.value?.type||e.type),a=n.useModel(o,"modelValue");function r(){e.reactive&&(a.value=!a.value)}return(d,c)=>(n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-section",a.value?"open":"close"]),model:e.editor?.model},{default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["head",o.location,o.reactive&&"reactive"]),onClick:r},[n.createElementVNode("div",ya,[l.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",l.value])},null,2)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",xa,n.toDisplayString(i.value),1)]),o.reactive?(n.openBlock(),n.createElementBlock("div",va,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),o.location=="left"?(n.openBlock(),n.createElementBlock("div",Ca,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Sa,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,a.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Ba={class:"unione-props-setting unione-form-setting"},Oa={class:"unione-form-btns"},Va={key:0},_a=["onClick"],Aa={class:"field-txt"},Ta=["onClick"],Ma={key:1,class:"field-txt"},Ea=["onClick"],Ia={key:0,class:"field-txt"},Da={key:3,class:"edit-field"},Pa={key:0},$a=["onClick"],Fa=Y(n.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:y})=>y+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 y=e.editor.widget(e.wid)||{};return y.configs||(y.configs={}),y.configs.settings||(y.configs.settings={}),y.configs.settings.btns||(y.configs.settings.btns=[]),y}),s=n.computed(()=>(e.editor.dataModels()||[]).map(w=>({value:w.sn,label:w.title+"("+w.name+")"}))),l=n.computed(()=>{const y=i.value.configs.settings.btns,w=y.map(N=>N.name);if(!w.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};y.splice(N.index,0,N)}if(!w.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let A=N.index||1;y.splice(A,0,N)}if(!w.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};y.splice(N.index,0,N)}if(!w.includes("back")){const N={title:"返回",type:"default",index:3,visible:!0,name:"back"};y.splice(N.index,0,N)}return y}),a=n.ref(null);function r(y){a.value&&a.value.open(y,w=>{w.visible=!0,Object.keys(w).forEach(N=>{y[N]=w[N]}),i.value.configs.settings.btns.sort((N,A)=>{const O=N.index||1,D=A.index||1;return O-D}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const y=i.value.configs.settings.btns.length+1;let w={title:"新增",name:"new_"+y,index:y,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};w.name="new_"+i.value.configs.settings.btns.length;const N=i.value.configs.settings.btns.filter(A=>A.name==w.name).length;N>0&&(w.name=w.name+N),i.value.configs.settings.btns.push(w),e.editor.widget(e.wid,i.value),a.value.open(w,A=>{Object.keys(A).forEach(O=>{w[O]=A[O]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(y){const w=()=>{if(["save","submit","reset","back"].includes(y.name))y.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const N=[];i.value.configs.settings.btns.forEach(A=>{A.name!=y.name&&N.push(A)}),i.value.configs.settings.btns=N}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{w()}})}const h=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:y=>{const w=h.value.widgets.filter(N=>N.value==y);return w[0]?w[0].label:y},toSetting:()=>{}}),f=n.ref({visible:!1,field:{},props:{},showInfo:y=>{let w="";return y.rules&&(w=y.rules.filter(N=>N.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const y=f.value.props,w={name:"range",trigger:y.trigger,whitespace:y.whitespace,message:y.rangeMessage};y.rangeMin!=null&&y.rangeMin!=null&&(w.min=y.rangeMin,w.enable=!0),y.rangeMax!=null&&y.rangeMax!=null&&(w.max=y.rangeMax,w.enable=!0);const N={name:"reg",trigger:y.trigger,whitespace:y.whitespace,message:y.regMessage};y.regExpress&&(N.pattern=y.regExpress,N.enable=!0),f.value.field.rules=[w,N],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(y){f.value.visible=!0,f.value.field=y;const w=y.rules||[],N={trigger:"change",whitespace:!0};w.forEach(A=>{A.name=="reg"&&(N.trigger=A.trigger,N.whitespace=A.whitespace,N.regExpress=A.pattern,N.regMessage=A.message),A.name=="range"&&(N.rangeMin=A.min,N.rangeMax=A.max,N.rangeMessage=A.message)}),f.value.props=N}const p=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{p.value.visible=!1}});function b(y,w){const N=x.value.filter(O=>O.name==y.name);N.forEach(O=>{w!="isSort"?O[w]=!0:O[w]=!O[w]});const A=N[0];if(!(!A||w=="isSort")){switch(p.value.prop=w,p.value.field=y,A.show||(A.show={}),w){case"isQuery":A.show.query||(A.show.query={}),p.value.show=A.show.query,p.value.title=`查询设置/${y.title}(${y.name})`;break;case"isForm":A.show.form||(A.show.form={}),p.value.show=A.show.form,p.value.title=`表单设置/${y.title}(${y.name})`;break;case"isView":A.show.view||(A.show.view={}),p.value.show=A.show.view,p.value.title=`详情设置/${y.title}(${y.name})`;break;case"isList":A.show.list||(A.show.list={}),p.value.show=A.show.list,p.value.title=`列头设置/${y.title}(${y.name})`;break}p.value.visible=!0}}const k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(y,w)=>{k.value.convert.options.splice(y,1)},toSetting:()=>{k.value.visible=!1}});function v(y){k.value.visible=!0,k.value.field=y,k.value.convert=y.convert||{}}const C=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),x=n.computed(()=>C.value.fields?.length?C.value.fields:[]),V={mounted:y=>y.focus()},g=n.ref({});function m(y,w){const N={};w=="convertName"?N[w]=y.convert?.type:N[w]=y[w]||"",g.value={},g.value[y.name]=N}function S(y,w){{g.value={};return}}function _(y,w){x.value.filter(A=>A.name==y.name).forEach(A=>{A[w]=!A[w]})}return(y,w)=>{const N=n.resolveComponent("a-divider"),A=n.resolveComponent("CloseOutlined"),O=n.resolveComponent("a-button"),D=n.resolveComponent("PlusOutlined"),M=n.resolveComponent("a-select"),E=n.resolveComponent("ToolOutlined"),z=n.resolveComponent("a-checkbox"),$=n.resolveComponent("a-table"),I=n.resolveComponent("a-select-option"),K=n.resolveComponent("a-form-item"),L=n.resolveComponent("a-form"),B=n.resolveComponent("a-modal"),Q=n.resolveComponent("a-checkbox-group"),T=n.resolveComponent("a-input-number"),j=n.resolveComponent("a-input"),he=n.resolveComponent("a-col"),Xi=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Ba,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[23]||(w[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",Oa,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,F=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:F.name,class:["btn",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size,ref_for:!0},F.props||{},{onClick:Ue=>r(F)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(F.title)+" ",1),F.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"btn-del",onClick:n.withModifiers(Ue=>c(F),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(O,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:w[0]||(w[0]=F=>d())},{default:n.withCtx(()=>[n.createVNode(D)]),_:1})]),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[24]||(w[24]=[n.createTextVNode("表单设置")])),_:1}),w[36]||(w[36]=n.createTextVNode(" 数据模型:")),n.createVNode(M,{class:"data-model-list",options:s.value,value:i.value.dataModel,"onUpdate:value":w[1]||(w[1]=F=>i.value.dataModel=F)},null,8,["options","value"]),n.createVNode($,{columns:t.value,"data-source":x.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:F})=>[["widget","rules","convertName"].includes(F.key)?(n.openBlock(),n.createElementBlock("span",Va,[n.createVNode(E),n.createTextVNode(" "+n.toDisplayString(F.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:F,text:Ue,record:te})=>[["rules"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!f.value.showInfo(te)&&"empty"]),onClick:xe=>u(te)},[n.createElementVNode("span",Aa,n.toDisplayString(f.value.showInfo(te)),1),f.value.showInfo(te)?(n.openBlock(),n.createBlock(O,{key:0,type:"link"},{default:n.withCtx(()=>w[25]||(w[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,_a)):["widget"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!g.value[te.name]||!Object.keys(g.value[te.name]).includes(F.dataIndex))&&!Ue&&"empty"]),onClick:xe=>m(te,F.dataIndex)},[g.value[te.name]&&Object.keys(g.value[te.name]).includes(F.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(M,{key:0,value:te[F.dataIndex],"onUpdate:value":xe=>te[F.dataIndex]=xe,options:h.value.widgets,onBlur:w[2]||(w[2]=xe=>S())},null,8,["value","onUpdate:value","options"])),[[V]]):(n.openBlock(),n.createElementBlock("span",Ma,n.toDisplayString(h.value.widgetName(Ue)),1))],10,Ta)):["convertName"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!g.value[te.name]||!Object.keys(g.value[te.name]).includes(F.dataIndex))&&!te.convert?.type&&"empty"]),onClick:xe=>m(te,F.dataIndex)},[g.value[te.name]&&Object.keys(g.value[te.name]).includes(F.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(M,{key:0,value:te[F.dataIndex],"onUpdate:value":xe=>te[F.dataIndex]=xe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:w[3]||(w[3]=xe=>S())},null,8,["value","onUpdate:value"])),[[V]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[te.convert?.type?(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(te.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),te.convert?.type?(n.openBlock(),n.createBlock(O,{key:1,type:"link",onClick:n.withModifiers(xe=>v(te),["stop"])},{default:n.withCtx(()=>w[26]||(w[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Ea)):["isForm","isView"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",Da,[n.createVNode(z,{checked:te[F.dataIndex],onClick:xe=>_(te,F.dataIndex)},null,8,["checked","onClick"]),n.createVNode(O,{type:"link",onClick:xe=>b(te,F.dataIndex)},{default:n.withCtx(()=>w[27]||(w[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(B,{visible:h.value.visible,"onUpdate:visible":w[5]||(w[5]=F=>h.value.visible=F),title:"控件设置",onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{model:h.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[h.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(K,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(M,{value:h.value.props.mode,"onUpdate:value":w[4]||(w[4]=F=>h.value.props.mode=F),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(I,{value:"multiple"},{default:n.withCtx(()=>w[28]||(w[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(I,{value:"tags"},{default:n.withCtx(()=>w[29]||(w[29]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(B,{visible:f.value.visible,"onUpdate:visible":w[13]||(w[13]=F=>f.value.visible=F),title:"规则设置",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{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(()=>w[30]||(w[30]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(K,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(Q,{value:f.value.props.trigger,"onUpdate:value":w[6]||(w[6]=F=>f.value.props.trigger=F),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(K,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(z,{value:f.value.props.whitespace,"onUpdate:value":w[7]||(w[7]=F=>f.value.props.whitespace=F),checked:f.value.props.whitespace},{default:n.withCtx(()=>w[31]||(w[31]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[32]||(w[32]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(K,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(T,{value:f.value.props.rangeMin,"onUpdate:value":w[8]||(w[8]=F=>f.value.props.rangeMin=F)},null,8,["value"]),w[33]||(w[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(T,{value:f.value.props.rangeMax,"onUpdate:value":w[9]||(w[9]=F=>f.value.props.rangeMax=F)},null,8,["value"])]),_:1}),n.createVNode(K,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(j,{value:f.value.props.rangeMessage,"onUpdate:value":w[10]||(w[10]=F=>f.value.props.rangeMessage=F)},null,8,["value"])]),_:1}),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[34]||(w[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(K,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(j,{value:f.value.props.regExpress,"onUpdate:value":w[11]||(w[11]=F=>f.value.props.regExpress=F)},null,8,["value"])]),_:1}),n.createVNode(K,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(j,{value:f.value.props.regMessage,"onUpdate:value":w[12]||(w[12]=F=>f.value.props.regMessage=F)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(B,{visible:p.value.visible,"onUpdate:visible":w[20]||(w[20]=F=>p.value.visible=F),title:p.value.title,onOk:p.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{model:p.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(K,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(T,{value:p.value.show.index,"onUpdate:value":w[14]||(w[14]=F=>p.value.show.index=F)},null,8,["value"])]),_:1}),["isQuery"].includes(p.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(K,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(j,{value:p.value.show.width,"onUpdate:value":w[15]||(w[15]=F=>p.value.show.width=F)},null,8,["value"])]),_:1})),["isForm","isView"].includes(p.value.prop)?(n.openBlock(),n.createBlock(K,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(j,{value:p.value.show.labelWidth,"onUpdate:value":w[16]||(w[16]=F=>p.value.show.labelWidth=F)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(p.value.prop)?(n.openBlock(),n.createBlock(K,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(j,{value:p.value.show.valueWidth,"onUpdate:value":w[17]||(w[17]=F=>p.value.show.valueWidth=F)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(p.value.prop)?(n.openBlock(),n.createBlock(K,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(M,{value:p.value.show.fixed,"onUpdate:value":w[18]||(w[18]=F=>p.value.show.fixed=F),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(K,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(M,{value:p.value.show.align,"onUpdate:value":w[19]||(w[19]=F=>p.value.show.align=F),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(B,{visible:k.value.visible,"onUpdate:visible":w[22]||(w[22]=F=>k.value.visible=F),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",Pa,[n.createVNode(O,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>w[35]||(w[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode($,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:F,record:Ue,index:te})=>[F.dataIndex==="label"?(n.openBlock(),n.createBlock(j,{key:0,value:Ue.label,"onUpdate:value":xe=>Ue.label=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),F.dataIndex==="value"?(n.openBlock(),n.createBlock(j,{key:1,value:Ue.value,"onUpdate:value":xe=>Ue.value=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),F.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:xe=>k.value.toDelOption(te,Ue)},"删除",8,$a)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock(L,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Xi,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(he,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(K,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(j,{value:k.value.convert.dict,"onUpdate:value":w[21]||(w[21]=F=>k.value.convert.dict=F)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(ai,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),Ra=Y(n.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(o,{expose:e}){const t=o,i=n.ref(),s=n.ref({}),l=n.ref(null);n.onMounted(()=>{if(t.editor&&a.value.dsn){const u=t.editor.dataManager();a.value.primary&&u.psn(a.value.dsn),i.value=u.useForm(a.value.dsn,l.value,p=>{s.value=p.body||{}})}});const a=n.computed(()=>t.widget||t.form||{}),r=n.computed(()=>{let u=a.value.widgets||[];return!u.length&&t.form?.fields&&(u=t.form.fields,u.forEach(p=>{p.widget||(p.widget="unione-form-item"),p.control||(p.control="a-input")})),u}),d=n.computed(()=>a.value.setting||{});n.provide("formSetting",d.value);function c(){return s.value}function h(u){s.value={...s.value,...u}}function f(){return l.value.validate()}return e({validate:f,getValue:c,setValue:h}),(u,p)=>{const b=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-form-widget","setting-title":"表单设置",model:o.editor?.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(b,{ref_key:"formObj",ref:l,model:s.value,class:n.normalizeClass(["unione-form",o.editor?.model.value,"form-layout-col-"+(d.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,k=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(k.widget),{key:k.wid,wid:k.wid,widget:k,editor:o.editor,value:s.value[k.name],"onUpdate:value":v=>s.value[k.name]=v,formValue:s.value},null,40,["wid","widget","editor","value","onUpdate:value","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[o.editor&&a.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(Fa,{wid:a.value.wid,editor:o.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-afd7fb6a"]]);function ks(o,e=!1){const t=Me();if(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+o+",force:"+e),!o)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+o);return i&&e==!1?Promise.resolve(JSON.parse(i)):new Promise((s,l)=>{W.axios.admin({url:"/api/system/dict/load/"+o}).then(a=>{if(a.success){const r=a.body.filter(d=>d.dictName!=d.dictKey);r.forEach(d=>{d.value=d.dictKey,d.label=d.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+o,JSON.stringify(r)),s(r)):l("字典加载失败,dict:"+o+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+o,a),l("字典加载失败,dict:"+o+",error:"+a.message)})})}async function bs(o,e){const t=Me();if(t.isDebug&&console.log("进入:根据获取字典选项方法,dict name:"+o+",key:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await ks(o),s=i.filter(l=>l.dictKey==e);return s.length>0?Promise.resolve(s[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+o+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+o+",key:"+e))}async function La(o,e){const t=await bs(o,e);return Promise.resolve(t.dictValue)}const ws={load:ks,getLabel:La,getOption:bs};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=Me()}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,s)=>{if(!this.convertObj.dictName){s("字典名称不能为空,id:"+this.convertObj.id);return}ws.load(this.convertObj.dictName,t).then(l=>{this.options=l,typeof e=="number"&&this.options.forEach(a=>{a.value=parseInt(a.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,s)=>{const l=this.convertObj.params||{body:{}};this.convertObj.pidField&&(l.pid=-1);const a=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;W.axios.admin({url:a,data:l,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),s("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(c=>c.value==e).length?i(this.options):(l.body||(l.body={}),l.body[this.convertObj.valueField]=e,W.axios.admin({url:a,data:l,method:"POST"}).then(c=>{if(c.success){const h={};this.options.forEach(f=>{h[e]=!0}),c.body.forEach(f=>{h[f.value]||this.options.push(f)}),i(this.options)}else s("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),s("数据选项加载失败,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?ws.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(s=>{const l=s.filter(a=>a.value==e);if(l.length)return t(l[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,s)=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;W.axios.admin({url:l,data:e,method:"POST"}).then(a=>{a.success?(this.$processOptions(a.body),this.options=[...this.options,...a.body],i(a.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,a),s("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+a.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;W.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),t(s.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 ja={key:1,class:"text-view"},za=Y(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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.inject("formSetting");n.onMounted(()=>{l.value.value!=null&&typeof l.value.value<"u"&&(e.formValue[l.value.name]==null||e.formValue[l.value.name]==null||typeof e.formValue[l.value.name]>"u")&&(t.value=l.value.value,l.value.widget=="unione-check-box"&&(Array.isArray(l.value.value)||(typeof l.value.value=="string"?t.value=l.value.value.split(","):t.value=[l.value.value])))});const s=n.ref({}),l=n.computed(()=>{const b=e.editor?.widget(e.wid)||e.widget||{};return b.event&&Object.keys(b.event).forEach(k=>{const v=b.event[k];s.value[k]=null,v.enable&&v.scriptText&&(s.value[k]=new Function("value","ctx",v.scriptText))}),b}),a=n.computed(()=>!(s.value.visible&&s.value.visible(e.formValue[l.value.name],e.formValue)==!1)),r=n.computed(()=>s.value.title&&s.value.title(e.formValue[l.value.name],e.formValue)||l.value.title),d=n.ref({}),c=n.computed(()=>{const b=[],k=l.value.rule||{};if(l.value.props?.required&&b.push({required:!0,whitespace:k?.whitespace||!1,trigger:k?.trigger||i.ruleTrigger||"change",validator:(v,C)=>(k?.whitespace&&C&&typeof C=="string"&&(C=C.trim()),C&&(C+"").length>0?Promise.resolve():Promise.reject(l.value.title+"不能为空!"))}),k.advance&&d.value[k.advance]){const v=d.value[k.advance];b.push({pattern:v.pattern,message:v.message||"表单验证不通过!",trigger:k.trigger||i.ruleTrigger||"change"})}return k.regExpress&&b.push({pattern:k.regExpress,message:k.regMessage||"表单验证不通过!",trigger:k.trigger||i.ruleTrigger||"change"}),l.value.dataLen&&b.push({validator:(v,C)=>C&&(C+"").length>l.value.dataLen?Promise.reject("最大长度["+l.value.dataLen+"],当前:["+(C+"").length+"]"):Promise.resolve(),trigger:k?.trigger||i.ruleTrigger||"change"}),b}),h=n.computed(()=>{const b=l.value.props||{};if(l.value.control=="a-input-number"){const k=l.value.rule||{};k.rangeMin!=null&&k.rangeMin!=null&&(b.min=k.rangeMin),k.rangeMax!=null&&k.rangeMax!=null&&(b.max=k.rangeMax)}return l.value.control=="a-date-picker"&&l.value.view?.dataFormat&&(b.format=l.value.view.dataFormat,b.valueFormat=l.value.view.dataFormat),b}),f=n.computed(()=>{const b=l.value.css||{},k=[];return b.cssName&&k.push(b.cssName),i.platform=="app"?b.cssName?typeof b.cssName=="string"&&b.cssName.indexOf("all-line")<0&&k.push("all-line"):k.push("all-line"):l.value.view?.width&&(l.value.view.width>=3?(!b.cssName||typeof b.cssName=="string"&&b.cssName.indexOf("all-line")<0)&&k.push("all-line"):l.value.view.width==2&&k.push("2in-line")),k}),u=n.computed(()=>{const b=i.showColumn||3;let k=l.value.view?.labelWidth||i.labelWidth||9;return l.value.css?.cssName&&b>1&&typeof l.value.css.cssName=="string"&&l.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(k/b)}:l.value.view?.width>=3&&b>1?{span:Math.round(k/b)}:{span:k}}),p=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&l.value.convert&&new dt(l.value.convert).convert(t.value.toString()).then(b=>{p.value=b})}),(b,k)=>{const v=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-form-item",f.value]),style:n.normalizeStyle(l.value.css?.cssText)},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createBlock(v,{key:0,label:r.value,name:l.value.name,labelCol:u.value,required:l.value.props?.required,rules:c.value,help:(!e.editor||e.editor.model.value!="view")&&l.value.props?.help,tooltip:l.value.props?.tooltip},{default:n.withCtx(()=>[!o.editor||o.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value.control||"a-input"),n.mergeProps({key:0,wid:l.value.wid,widget:l.value,editor:e.editor,value:t.value,"onUpdate:value":k[0]||(k[0]=C=>t.value=C)},h.value,{style:l.value.css?.props}),null,16,["wid","widget","editor","value","style"])):t.value?(n.openBlock(),n.createElementBlock("div",ja,n.toDisplayString(p.value?p.value:t.value),1)):n.createCommentVNode("",!0)]),_:1},8,["label","name","labelCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-1a91c715"]]);function qa(o,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{o(i)},e)}}const Ua=Y(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(o){Me();const e=o,t=n.useModel(o,"value"),i=n.ref([]),s=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),l=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),a=qa(h=>{c.value.search(h).then(f=>{i.value=f})},500);n.onMounted(()=>{c.value.load(t.value).then(h=>{i.value=h})});const r=n.ref({}),d=n.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const u=h.event[f];r.value[f]=null,u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText))}),h}),c=n.computed(()=>{const h=d.value.convert||e.convert||{};return new dt(h)});return n.watch(t,()=>{t.value&&c.value.load(t.value).then(h=>{i.value=h})}),n.watch(()=>d.value.convert||e.convert||{},()=>{c.value.load().then(h=>{i.value=h})}),(h,f)=>{const u=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(u,{class:"unione-form-select",options:s.value,showSearch:l.value,value:t.value,"onUpdate:value":f[0]||(f[0]=p=>t.value=p),onSearch:n.unref(a)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Wa=Y(n.defineComponent({__name:"switchBox",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.ref({});n.onMounted(()=>{a.value.load(t.value).then(r=>{r.forEach(d=>{d.value&&d.value!="0"&&d.value!="false"&&d.value!="FALSE"?(i.value.checkedChildren=d.label,i.value.checkedValue=d.value):(i.value.unCheckedChildren=d.label,i.value.unCheckedValue=d.value)})})});const s=n.ref({}),l=n.computed(()=>{const r=e.editor?.widget(e.wid)||e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const c=r.event[d];s.value[d]=null,c.enable&&c.scriptText&&(s.value[d]=new Function("value","ctx",c.scriptText))}),r}),a=n.computed(()=>{const r=l.value.convert||e.convert||{};return new dt(r)});return(r,d)=>{const c=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(c,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=h=>t.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-c9a968d8"]]),Ha=Y(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(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),s=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const l=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];l.value[c]=null,h.enable&&h.scriptText&&(l.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-radio",options:s.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Ka=Y(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(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),s=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const l=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];l.value[c]=null,h.enable&&h.scriptText&&(l.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-checkbox",options:s.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Qa={class:"unione-props-setting unione-query-setting"},Ga={class:"unione-query-opts"},Ya={key:0},Xa=["onClick"],Ja={key:1},Za={key:1,class:"edit-field"},er=["onClick"],tr=Y(n.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:V})=>V+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 V=e.editor.widget(e.wid)||{};return V.configs||(V.configs={}),V.configs.btns||(V.configs.btns=[]),V}),s=n.computed(()=>(e.editor.dataModels()||[]).map(g=>({value:g.sn,label:g.title+"("+g.name+")"}))),l=n.computed(()=>{const V=[],g=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(m=>{V.push(m),g.push(m.name)}),g.includes("query")||V.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),g.includes("reset")||V.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),g.includes("reset")||V.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),V.sort((m,S)=>{const _=m.index||1,y=S.index||1;return _-y}),V}),a=n.ref(null);function r(V){a.value&&a.value.open(V,g=>{g.visible=!0,Object.keys(g).forEach(m=>{V[m]=g[m]}),i.value.configs.btns.sort((m,S)=>{const _=m.index||1,y=S.index||1;return _-y}),i.value.configs.btns=[...i.value.configs.btns]})}function d(){const V=i.value.configs.btns.length+1;let g={title:"新增",name:"new_"+V,size:"default",index:V,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(g),e.editor.widget(e.wid,i.value),a.value.open(g,m=>{Object.keys(m).forEach(S=>{g[S]=m[S]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(V){const g=()=>{if(["query","reset","advanced"].includes(V.name))V.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const m=[];i.value.configs.btns.forEach(S=>{S.name!=V.name&&m.push(S)}),i.value.configs.btns=m}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{g()}})}const h=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=n.computed(()=>h.value.fields?.length?h.value.fields:[]),u={mounted:V=>V.focus()},p=n.ref({});function b(){const V=Object.keys(p.value);if(V.length)for(let g in V){const m=f.value.filter(S=>S.name==g);if(m&&m[0]){let S=p.value[g];Object.keys(S).forEach(_=>{if(_=="showIndex"){const y=m[0].show?.query||{};m[0].show||(m[0].show={}),m[0].show.query={...y,index:S[_]}}else m[0][_]=S[_]})}}p.value={}}function k(V,g){b();const m={};m[g]=V[g]||"",g=="showIndex"&&(m[g]=V.show?.query?.index),p.value[V.name]=m}function v(V,g){if(!V||!g){p.value={};return}const m=p.value[V.name][g];if(g=="showIndex"){const S=V.show?.query||{};V.show||(V.show={}),V.show.query={...S,index:m}}else V[g]=m;p.value={}}function C(V,g){f.value.filter(S=>S.name==V.name).forEach(S=>{S[g]=!S[g]})}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:V=>{const g=x.value.options.filter(m=>m.value==V);return g[0]?g[0].label:V}});return(V,g)=>{const m=n.resolveComponent("a-divider"),S=n.resolveComponent("CloseOutlined"),_=n.resolveComponent("a-button"),y=n.resolveComponent("PlusOutlined"),w=n.resolveComponent("a-select"),N=n.resolveComponent("ToolOutlined"),A=n.resolveComponent("a-checkbox"),O=n.resolveComponent("a-input-number"),D=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Qa,[n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>g[3]||(g[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Ga,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,M=>(n.openBlock(),n.createBlock(_,n.mergeProps({key:M.name,class:["btn",M.name,!M.visible&&"deleted"],type:M.visible?M.type:"default",size:M.size||"default",ref_for:!0},M.props||{},{onClick:E=>r(M)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(M.title)+" ",1),M.visible?(n.openBlock(),n.createBlock(S,{key:0,class:"btn-del",onClick:n.withModifiers(E=>c(M),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[M.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(M.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(_,{class:n.normalizeClass(["btn","btn-add"]),onClick:g[0]||(g[0]=M=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(y)]),_:1})]),n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>g[4]||(g[4]=[n.createTextVNode("查询字段")])),_:1}),g[5]||(g[5]=n.createTextVNode(" 数据模型:")),n.createVNode(w,{class:"data-model-list",options:s.value,value:i.value.dataModel,"onUpdate:value":g[1]||(g[1]=M=>i.value.dataModel=M)},null,8,["options","value"]),n.createVNode(D,{columns:t.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:M})=>[["showIndex","queryType"].includes(M.key)?(n.openBlock(),n.createElementBlock("span",Ya,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(M.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:M,text:E,record:z})=>[["queryType"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!p.value[z.name]||!Object.keys(p.value[z.name]).includes(M.dataIndex))&&!E&&"empty"]),onClick:$=>k(z,M.dataIndex)},[p.value[z.name]&&Object.keys(p.value[z.name]).includes(M.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:z[M.dataIndex],"onUpdate:value":$=>z[M.dataIndex]=$,allowClear:!0,options:x.value.options,onBlur:g[2]||(g[2]=$=>v())},null,8,["value","onUpdate:value","options"])),[[u]]):(n.openBlock(),n.createElementBlock("span",Ja,n.toDisplayString(x.value.showLabel(E)),1))],10,Xa)):["isQuery"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",Za,[n.createVNode(A,{checked:z[M.dataIndex],onClick:$=>C(z,M.dataIndex)},null,8,["checked","onClick"])])):M.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!p.value[z.name]||!Object.keys(p.value[z.name]).includes(M.dataIndex))&&!E&&"empty"]),onClick:$=>k(z,M.dataIndex)},[p.value[z.name]&&Object.keys(p.value[z.name]).includes(M.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(O,{key:0,value:p.value[z.name][M.dataIndex],"onUpdate:value":$=>p.value[z.name][M.dataIndex]=$,onBlur:$=>v(z,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(z.show?.query?.index||" "),1)],64))],10,er)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ai,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),ir={class:"query-btn"},nr={class:"btn-advanced-overlay"},ys=Y(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(o,{emit:e}){const t=o,i=n.computed(()=>{const k=t.editor?.widget(t.wid)||t.widget||{};return k.btns||(k.btns=[]),k}),s=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),l=n.computed(()=>{let k=[];return i.value.fields?.length&&(k=i.value.fields),k.sort((v,C)=>{const x=v.show?.query?.index||1,V=C.show?.query?.index||1;return x-V}),k.forEach(v=>{v.widget=v.widget||"a-input",v.value!=null&&v.value!="undefined"&&typeof v.value<"u"&&(h.value[v.name]=v.value)}),k}),a=n.computed(()=>i.value.labelWidth||7),r=n.computed(()=>{const k=i.value.btns.filter(v=>v.name=="advanced")[0]||{};return k.event?.clickScript&&(k.event.click=new Function("ctx","btn","event",k.event.clickScript)),k.event?.disableScript&&(k.event.disable=new Function("ctx","btn",k.event.disableScript)),k.event?.visibleScript&&(k.event.visible=new Function("ctx","btn",k.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...k}}),d=["query","reset","advanced"],c=n.computed(()=>{const k=i.value.btns.filter(C=>C.name!="advanced"),v=[];return k.forEach(C=>{C.size||(C.size="default"),v.push(C.name)}),v.includes("query")||k.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),v.includes("reset")||k.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),k.sort((C,x)=>{const V=C.index||1,g=x.index||1;return V-g}),k}),h=n.ref({});n.onMounted(()=>{t.editor?.ebus.$emit("table-list-search",h.value)});const f=e;function u({btn:k,event:v}){console.log("unione query form btn click",k,v),k.name=="query"&&p(),k.name=="reset"&&b(),f("btnClick",{btn:k,event:v})}function p(){const k=[];s.value.visible&&k.push(s.value.name),l.value.forEach(C=>{C.visible&&k.push(C.name)});const v={};Object.keys(h.value).forEach(C=>{k.includes(C)&&(v[C]=h.value[C])}),f("query",v),t.editor?.ebus.$emit("table-list-search",v)}function b(){h.value={},l.value.forEach(k=>{k.visible=!1}),f("reset"),t.editor?.ebus.$emit("table-list-reset")}return(k,v)=>{const C=n.resolveComponent("a-input"),x=n.resolveComponent("a-form-item"),V=n.resolveComponent("unione-btn"),g=n.resolveComponent("a-checkbox"),m=n.resolveComponent("DownOutlined"),S=n.resolveComponent("a-button"),_=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:h.value,layout:"horizontal","label-col":{span:a.value}},{default:n.withCtx(()=>[s.value.visible?(n.openBlock(),n.createBlock(x,{key:0,label:s.value.title,class:"query-field keywords",name:s.value.name,style:n.normalizeStyle({width:a.value})},{default:n.withCtx(()=>[n.createVNode(C,{placeholder:s.value.placeholder,value:h.value[s.value.name],"onUpdate:value":v[0]||(v[0]=w=>h.value[s.value.name]=w)},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,w=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:w.name},[w.visible?(n.openBlock(),n.createBlock(x,{key:0,label:w.title,class:n.normalizeClass(["query-field",w.name]),style:n.normalizeStyle({width:a.value}),name:w.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(w.widget),n.mergeProps({placeholder:w.placeholder,value:h.value[w.name],"onUpdate:value":N=>h.value[w.name]=N,ref_for:!0},w.props||{},{widget:w}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",ir,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,w=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:w.name},[w.visible!=!1?(n.openBlock(),n.createBlock(V,{key:0,widget:w,editor:o.editor,onClick:u,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&l.value.length?(n.openBlock(),n.createBlock(_,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",nr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,w=>(n.openBlock(),n.createBlock(g,{key:w.name,class:"item",checked:w.visible,onClick:N=>w.visible=!w.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(w.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(S,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(tr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-bf93af8d"]]),sr={class:"unione-props-setting unione-table-setting"},lr={class:"unione-table-tools"},or={key:1,class:"unione-table-opts"},ar={key:0},rr=["onClick"],dr={key:1,class:"edit-field"},cr=["onClick"],hr={key:1},fr=Y(n.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:y})=>y+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(y,w){let N=y.filter(A=>A.value==w);return N&&N[0]&&N[0].label||w}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(y,w){let N=y.filter(A=>A.value==w);return N&&N[0]&&N[0].label||w}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const y=e.editor.widget(e.wid)||{};return y.configs||(y.configs={}),y.configs.leftBtns||(y.configs.leftBtns=[]),y.configs.rightBtns||(y.configs.rightBtns=[]),y.configs.operation||(y.configs.operation={}),y.configs.operation.btns||(y.configs.operation.btns=[]),y.configs.operation.more||(y.configs.operation.more={}),y}),s=n.computed(()=>(e.editor.dataModels()||[]).map(w=>({value:w.sn,label:w.title+"("+w.name+")"}))),l=n.computed(()=>{if(!i.value)return[];const y=[],w=i.value.configs.leftBtns;if(w.forEach(N=>{y.push(N.name)}),!y.includes("add")){const N={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};w.splice(0,0,N)}if(!y.includes("delBatch")){const N={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};w.splice(1,0,N)}return w}),a=n.computed(()=>{if(!i.value)return[];const y=[],w=i.value.configs.rightBtns;if(w.forEach(N=>{y.push(N.name)}),!y.includes("downData")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};w.splice(0,0,N)}if(!y.includes("impData")){const N={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};w.splice(1,0,N)}if(!y.includes("expData")){const N={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};w.splice(2,0,N)}if(!y.includes("downTmpl")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};w.splice(3,0,N)}return w});function r(y,w){y=="left"?h.value.open(w,N=>{N.visible=!0,Object.keys(N).forEach(A=>{w[A]=N[A]}),i.value.configs.leftBtns.sort((A,O)=>{const D=A.index||1,M=O.index||1;return D-M}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):h.value.open(w,N=>{N.visible=!0,Object.keys(N).forEach(A=>{w[A]=N[A]}),i.value.configs.rightBtns.sort((A,O)=>{const D=A.index||1,M=O.index||1;return D-M}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(y){const w=y=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let N={title:"新增"+w,name:"new_"+w,index:w,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};y=="left"?i.value.configs.leftBtns.push(N):i.value.configs.rightBtns.push(N),e.editor.widget(e.wid,i.value),r(y,N)}function c(y,w){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(w.name))w.visible=!1,y=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(y=="left"){const A=[];i.value.configs.leftBtns.forEach(O=>{O.name!=w.name&&A.push(O)}),i.value.configs.leftBtns=A}else{const A=[];i.value.configs.rightBtns.forEach(O=>{O.name!=w.name&&A.push(O)}),i.value.configs.rightBtns=A}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const h=n.ref(null);function f(y){h.value.open(y,w=>{w.visible=!0,Object.keys(w).forEach(N=>{y[N]=w[N]}),i.value.configs.operation.btns.sort((N,A)=>{const O=N.index||1,D=A.index||1;return O-D}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const y=i.value.configs.operation.btns.length+1;let w={title:"新增"+y,name:"new_"+y,index:y,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(w),e.editor.widget(e.wid,i.value),h.value.open(w,N=>{Object.keys(N).forEach(A=>{w[A]=N[A]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function p(y){const w=()=>{if(["delete","view","edit"].includes(y.name))y.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const N=[];i.value.configs.operation.btns.forEach(A=>{A.name!=y.name&&N.push(A)}),i.value.configs.operation.btns=N}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{w()}})}const b=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),k=n.computed(()=>b.value.fields?.length?(b.value.fields.forEach(y=>{y.show||(y.show={}),y.show.list||(y.show.list={})}),b.value.fields):[]),v={mounted:y=>y.focus()},C=n.ref({});function x(){const y=Object.keys(C.value);if(y.length)for(let w in y){const N=k.value.filter(A=>A.name==w);if(N&&N[0]){let A=C.value[w];Object.keys(A).forEach(O=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),O=="showIndex"?N[0].show.list.index=A[O]:O=="showWidth"?N[0].show.list.width=A[O]:O=="fixed"?N[0].show.list.fixed=A[O]:O=="align"?N[0].show.list.align=A[O]:N[0][O]=A[O]})}}C.value={}}function V(y,w){x();const N={};w=="showIndex"?N[w]=y.show?.list?.index:w=="showWidth"?N[w]=y.show?.list?.width:w=="fixed"?N[w]=y.show?.list?.fixed:w=="align"?N[w]=y.show?.list?.align:N[w]=y[w]||"",C.value[y.name]=N}function g(y,w){if(!y||!w){C.value={};return}const N=C.value[y.name][w];y.show||(y.show={}),y.show.list||(y.show.list={}),w=="showIndex"?y.show.list.index=N:w=="showWidth"?y.show.list.width=N:w=="fixed"?y.show.list.fixed=N:w=="align"?y.show.list.align=N:y[w]=N,C.value={}}function m(y,w){return w=="showIndex"?y.show?.list?.index:w=="showWidth"?y.show?.list?.width:w=="fixed"?y.show?.list?.fixed:w=="align"?y.show?.list?.align:y[w]}function S(y,w){k.value.filter(A=>A.name==y.name).forEach(A=>{A[w]=!A[w]})}const _=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:y=>{const w=_.value.options.filter(N=>N.value==y);return w[0]?w[0].label:y}});return(y,w)=>{const N=n.resolveComponent("a-divider"),A=n.resolveComponent("CloseOutlined"),O=n.resolveComponent("a-button"),D=n.resolveComponent("PlusOutlined"),M=n.resolveComponent("a-input"),E=n.resolveComponent("a-form-item"),z=n.resolveComponent("a-col"),$=n.resolveComponent("a-input-number"),I=n.resolveComponent("a-checkbox"),K=n.resolveComponent("a-row"),L=n.resolveComponent("a-select"),B=n.resolveComponent("ToolOutlined"),Q=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",sr,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[8]||(w[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",lr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,T=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:j=>r("left",T)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(T.title)+" ",1),T.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"bool-del",onClick:n.withModifiers(j=>c("left",T),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(O,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:w[0]||(w[0]=T=>d("left"))},{default:n.withCtx(()=>[n.createVNode(D)]),_:1}),n.createVNode(O,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:w[1]||(w[1]=T=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(D)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,T=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:T.name,class:["btn","right",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:j=>r("right",T)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(T.title)+" ",1),T.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"bool-del",onClick:n.withModifiers(j=>c("right",T),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[9]||(w[9]=[n.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createBlock(K,{key:0},{default:n.withCtx(()=>[n.createVNode(z,{span:7},{default:n.withCtx(()=>[n.createVNode(E,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(M,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(z,{span:5},{default:n.withCtx(()=>[n.createVNode(E,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode($,{value:i.value.configs.operation.width,"onUpdate:value":w[2]||(w[2]=T=>i.value.configs.operation.width=T)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(z,{span:6},{default:n.withCtx(()=>[n.createVNode(E,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode($,{value:i.value.configs.operation.count,"onUpdate:value":w[3]||(w[3]=T=>i.value.configs.operation.count=T)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(z,{span:5},{default:n.withCtx(()=>[n.createVNode(E,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(I,{checked:i.value.configs.operation.visible,"onUpdate:checked":w[4]||(w[4]=T=>i.value.configs.operation.visible=T)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[10]||(w[10]=[n.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createElementBlock("div",or,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,T=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"small",ref_for:!0},T.props||{},{onClick:j=>f(T)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(T.title)+" ",1),T.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"btn-del",onClick:n.withModifiers(j=>p(T),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(O,{class:n.normalizeClass(["btn","btn-add"]),onClick:w[5]||(w[5]=T=>u()),size:"small"},{default:n.withCtx(()=>[n.createVNode(D)]),_:1})])):n.createCommentVNode("",!0),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[11]||(w[11]=[n.createTextVNode("表头设置")])),_:1}),w[12]||(w[12]=n.createTextVNode(" 数据模型:")),n.createVNode(L,{class:"data-model-list",options:s.value,value:i.value.dataModel,"onUpdate:value":w[6]||(w[6]=T=>i.value.dataModel=T)},null,8,["options","value"]),n.createVNode(Q,{columns:t.value,"data-source":k.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:T})=>[["showIndex","showWidth","align","fixed"].includes(T.key)?(n.openBlock(),n.createElementBlock("span",ar,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(T.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:T,record:j})=>[["showIndex","showWidth"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!C.value[j.name]||!Object.keys(C.value[j.name]).includes(T.dataIndex))&&!m(j,T.dataIndex)&&"empty"]),onClick:he=>V(j,T.dataIndex)},[C.value[j.name]&&Object.keys(C.value[j.name]).includes(T.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock($,{key:0,value:C.value[j.name][T.dataIndex],"onUpdate:value":he=>C.value[j.name][T.dataIndex]=he,onBlur:he=>g(j,T.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(j,T.dataIndex)),1)],64))],10,rr)):["isList","isQuery","isSort"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",dr,[n.createVNode(I,{checked:j[T.dataIndex],onClick:he=>S(j,T.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!C.value[j.name]||!Object.keys(C.value[j.name]).includes(T.dataIndex))&&!m(j,T.dataIndex)&&"empty"]),onClick:he=>V(j,T.dataIndex)},[C.value[j.name]&&Object.keys(C.value[j.name]).includes(T.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(L,{key:0,value:j.show.list[T.dataIndex],"onUpdate:value":he=>j.show.list[T.dataIndex]=he,allowClear:!0,options:T.options,onBlur:w[7]||(w[7]=he=>g())},null,8,["value","onUpdate:value","options"])),[[v]]):(n.openBlock(),n.createElementBlock("span",hr,n.toDisplayString(T.showLabel(T.options,m(j,T.dataIndex))),1))],10,cr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ai,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function en(o){const e=o.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const s=e[i];s&&(t.push(s.charAt(0).toUpperCase()),s.length>1&&t.push(s.substring(1)))}return t.join("")}const ur={toHump:en},pr={class:"unione-table-tools"},mr={class:"unione-table-data"},gr={key:0,class:"unione-table-opts"},xs=Y(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(o,{expose:e,emit:t}){const i=Me(),s=o,l=n.computed(()=>s.editor?.widget(s.wid)||s.widget||{}),a=n.computed(()=>l.value.props||{}),r=n.computed(()=>l.value.rowKey||s.rowKey||"id"),d=n.computed(()=>l.value.dsn?s.editor?.dataManager().use(l.value.dsn,"list"):null),c=n.computed(()=>{const O=s.dataList||[];return!O.length&&d.value?d.value.data()||[]:O}),h=n.computed(()=>{if(l.value.operation==!1)return{visible:!1};const O=W.utils.obj.ext(l.value.operation||{},{title:"操作",visible:!0,width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),D=[];let M=l.value.operation?.btns||[];if(M.forEach(E=>{D.push(E.name)}),D.includes("edit")||M.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),D.includes("view")||M.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),D.includes("delete")||M.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),s.editor){const E=M.filter($=>$.name=="edit")[0];if(E.visible&&(E.action||(E.action={}),E.action.type||(E.action.type="route"),!E.action.href)){const $=(s.editor.sn().endsWith(":list")?s.editor.sn().substring(0,s.editor.sn().length-5):s.editor.sn())+":form",I=s.editor.model.value;E.action.href=i.editPageUrl+"?psn="+$+"&model="+I+"&id={row."+s.rowKey+"}"}const z=M.filter($=>$.name=="view")[0];if(z.visible&&(z.action||(z.action={}),z.action.type||(z.action.type="route"),!z.action.href)){const $=(s.editor.sn().endsWith(":list")?s.editor.sn().substring(0,s.editor.sn().length-5):s.editor.sn())+":form";z.action.href=i.viewPageUrl+"?psn="+$+"&model=view&id={row."+s.rowKey+"}"}}return M=M.filter(E=>E.visible!=!1).sort((E,z)=>{const $=E.index||1,I=z.index||1;return $-I}),O.count&&(M.length>O.count+1?(O.btns=M.slice(0,O.count),O.more.items=M.slice(O.count,M.length),O.more.visible=!0):(O.btns=M,O.more.visible=!1)),O}),f=n.computed(()=>{let O=[];l.value.columns?.length&&(O=[...l.value.columns]);const D=[];O.forEach((E,z)=>{E.dataIndex=E.name,E.convert&&(E.convertObj=new dt(E.convert)),E.sort?.enable&&(E.sorter=!0,E.sort.defoult&&(E.defaultSortOrder=E.sort.asc?"ascend":"descend")),E.customRender=({text:$})=>E.convertObj?E.convertObj.convert($)||$:$||"--",E.fkey?.enable&&(E.fkey.labelName&&(E.dataIndex=en(E.fkey.labelName)),E.fkey.labelTitle&&(E.title=E.fkey.labelTitle),E.customRender=({record:$,column:I})=>$&&$[I.name+"FEntry"]&&$[I.name+"FEntry"][I.dataIndex]||"--",E.fkey.fields?.forEach(($,I)=>{if(!$.name)return;const K=en($.name),L={fkName:E.name,title:$.title,name:K,dataIndex:$.name,width:$.width,index:$.index||z+I+1,customRender:({record:B,column:Q})=>{if(B&&B[Q.fkName+"FEntry"]){const T=B[Q.fkName+"FEntry"][Q.name];if(T)return $.convertObj&&$.convertObj.convert(T)||T}return"--"}};$.convert&&($.convertObj=new dt($.convert)),D.push(L)}))}),D.forEach(E=>{O.splice(E.index,0,E)});const M=W.utils.obj.ext(l.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return M&&M.visible!=!1&&(M.customRender=E=>x.value?(x.value.current-1)*x.value.pageSize+E.index+1:E.index,O=[M,...O]),h.value&&h.value.visible!=!1&&O.push({fixed:"right",align:"center",...h.value,name:"operation"}),O}),u=n.computed(()=>{if(l.value.leftBtns==!1)return[];const O=[],D=[];if((l.value.leftBtns||[]).forEach(E=>{E.visible!=!1&&O.push(E),D.push(E.name),E.name=="delBatch"&&!V.value&&(E.visible=!1)}),!D.includes("add")){const E={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};O.splice(0,0,E)}if(!D.includes("delBatch")&&V.value){const E={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};O.splice(1,0,E)}if(s.editor){const E=O.filter(z=>z.name=="add")[0];if(E.visible&&(E.action||(E.action={}),E.action.type||(E.action.type="route"),!E.action.href)){const z=(s.editor.sn().endsWith(":list")?s.editor.sn().substring(0,s.editor.sn().length-5):s.editor.sn())+":form",$=s.editor.model.value;E.action.href=i.addPageUrl+"?psn="+z+"&model="+$}}return O});function p({btn:O,event:D}){if(i.isDebug&&console.log("unione table left btn click",O,D),O.name=="delBatch"){if(!g.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.loadByIds(g.value.selectedRowKeys);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+g.value.selectedRowKeys.length+")数据",onOk:()=>{S("delBatch",{btn:O,event:D,keys:g.value.selectedRowKeys}),S("leftBtnClick",{btn:O,event:D,keys:g.value.selectedRowKeys}),S("btnClick",{btn:O,event:D,keys:g.value.selectedRowKeys})}});return}S(O.name,{btn:O,event:D}),S("leftBtnClick",{btn:O,event:D}),S("btnClick",{btn:O,event:D})}const b=n.computed(()=>{if(l.value.rightBtns==!1)return[];const O=[],D=[];if((l.value.rightBtns||[]).forEach(E=>{E.visible!=!1&&O.push(E),D.push(E.name)}),!D.includes("impData")){const E={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};O.splice(1,0,E)}if(!D.includes("expData")){const E={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};O.splice(2,0,E)}if(!D.includes("downTmpl")){const E={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};O.splice(3,0,E)}return O});function k({btn:O,event:D}){i.isDebug&&console.log("unione table right btn click",O,D),S(O.name,{btn:O,event:D}),S("rightBtnClick",{btn:O,event:D}),S("btnClick",{btn:O,event:D})}const v=n.computed(()=>({bordered:!0,size:"small",...l.value.attrs||{}})),C=n.ref({}),x=n.computed(()=>W.utils.obj.ext(s.pagination||l.value.pagination,{showTotal:O=>"共"+O+"记录",pageSize:10,current:1,total:0,position:["bottomCenter"]})),V=n.computed(()=>typeof l.value.selection<"u"?l.value.selection:!0),g=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(O,D)=>{g.value.selectedRowKeys=O,g.value.selectedRowList=D},getCheckboxProps:O=>({disabled:O.checkable})}),m=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],S=t;function _({btn:O,event:D},M){if(i.isDebug&&console.log("unione table opt btn click",O,D),O.name=="delete"){if(d.value){d.value.deleteByIds([M[r.value]]);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{S(O.name,{btn:O,event:D,row:M}),S("optBtnClick",{btn:O,event:D,row:M}),S("btnClick",{btn:O,event:D,row:M})}});return}S(O.name,{btn:O,event:D,row:M}),S("optBtnClick",{btn:O,event:D,row:M}),S("btnClick",{btn:O,event:D,row:M})}function y(O,D,M,E){N(),S("change",{pagination:O,filters:D,sorter:M,event:E})}function w(){G.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${g.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{g.value.selectedRowKeys=[],g.value.selectedRowList=[]}})}function N(){console.log("dataStorage.value",d.value),d.value?.find({body:C.value,page:x.value.current,pageSize:x.value.pageSize})}n.onMounted(()=>{s.editor?.ebus.$on("table-list-search",O=>{console.log("table-list-search",O),C.value=O||{},N()})});function A(){return{keys:g.value.selectedRowKeys,rows:g.value.selectedRowList}}return e({getSelected:A,clearSelected:w}),(O,D)=>{const M=n.resolveComponent("unione-btn"),E=n.resolveComponent("DownOutlined"),z=n.resolveComponent("a-button"),$=n.resolveComponent("a-dropdown"),I=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(rt,{class:"unione-table-list",model:s.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",pr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,K=>(n.openBlock(),n.createBlock(M,{key:K.name,class:"btn",widget:K,editor:o.editor,onClick:p,preset:m,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),g.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:w},"当前选中记录("+n.toDisplayString(g.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,K=>(n.openBlock(),n.createBlock(M,{key:K.name,class:"btn right",widget:K,editor:o.editor,onClick:k,preset:m,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",mr,[f.value&&f.value.length?(n.openBlock(),n.createBlock(I,n.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":c.value,"row-selection":V.value?g.value:null,scroll:{x:a.value.scrollX||"max-content",y:a.value.scrollY},pagination:x.value,onChange:y},v.value),{bodyCell:n.withCtx(({column:K,record:L})=>[K.name==="operation"?(n.openBlock(),n.createElementBlock("div",gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.btns,B=>(n.openBlock(),n.createBlock(M,{key:B.name,class:"opt",widget:B,editor:o.editor,onClick:Q=>_(Q,L),preset:m,ctx:{row:L}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(n.openBlock(),n.createBlock($,{key:0,trigger:[h.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.more.items,B=>(n.openBlock(),n.createBlock(M,{key:B.name,class:"item",widget:B,editor:o.editor,onClick:Q=>_(Q,L),type:"text",preset:m,ctx:{row:L}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(z,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(h.value.more.title)+" ",1),n.createVNode(E)]),_: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},[s.editor&&s.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(fr,{editor:s.editor,wid:s.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-b75267b4"]]),kr={class:"page-setting-dialog"},ri=Y(n.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=o,i=n.computed(()=>t.editor?.model?.value),s=W.useSession(),l=n.computed(()=>s.getPrincipal()),a=n.ref(!1);n.provide("closeSetting",()=>{t.editor?.save().then(u=>{a.value=!1})});function r(){a.value=!0}function d(){t.editor?.save().then(u=>{console.log("res",u)})}function c(){t.editor?.save().then(u=>{console.log("res",u)})}const h=n.ref("");function f(u){h.value||(h.value=i.value),u?t.editor?.setModel("edit"):t.editor?.setModel(h.value)}return(u,p)=>{const b=n.resolveComponent("SettingOutlined"),k=n.resolveComponent("a-tooltip"),v=n.resolveComponent("SaveOutlined"),C=n.resolveComponent("FormOutlined"),x=n.resolveComponent("StopOutlined"),V=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:0,title:o.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"]&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(C,{class:"btn-edit",onClick:p[0]||(p[0]=g=>f(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(x,{class:"btn-edit",onClick:p[1]||(p[1]=g=>f(!1))})]),_:1})):n.createCommentVNode("",!0),n.renderSlot(u.$slots,"default",{},void 0,!0),i.value=="edit"?(n.openBlock(),n.createBlock(V,{key:4,title:t.settingTitle,open:a.value,"onUpdate:open":p[2]||(p[2]=g=>a.value=g),centered:"",width:"85%",onOk:c},{default:n.withCtx(()=>[n.createElementVNode("div",kr,[n.renderSlot(u.$slots,"page-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),[["__scopeId","data-v-49c94288"]]),br={class:"unione-props-setting data-field-manage"},wr={key:0},yr={key:1},xr={key:2},vr={key:3},Cr={key:4},Sr={key:5},Nr={key:6},Br=["onClick"],Or=["onClick"],Vr=["onClick"],_r={key:1},Ar=Y(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){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(o,"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(k=>{!u.includes(k.name)&&i.value.selectedRowKeys.includes(k.name)&&b.push(k.name)}),b.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(k=>!b.includes(k)))})}}),s={mounted:u=>u.focus()},l=n.ref({});function a(){const u=Object.keys(l.value);if(u.length)for(let p in u){const b=t.value.filter(k=>k.name==p);if(b&&b[0]){let k=l.value[p];Object.keys(k).forEach(v=>{b[0][v]=k[v]})}}l.value={}}function r(u,p){a();const b={};b[p]=u[p]||"",l.value[u.name]=b}function d(u,p){if(!u||!p){l.value={};return}const b=l.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,l.value={}}function c(u,p){t.value.filter(k=>k.name==u.name).forEach(k=>{k[p]=!k[p]})}function h(){if(a(),t.value.filter(b=>b.name=="new_").length>0){l.value.new_={name:"new_"};return}const p={title:"",name:"new_",isPk:!1};t.value.push(p),l.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"),k=n.resolveComponent("a-tooltip"),v=n.resolveComponent("a-input"),C=n.resolveComponent("a-input-number"),x=n.resolveComponent("a-select-option"),V=n.resolveComponent("a-select"),g=n.resolveComponent("a-checkbox"),m=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",br,[n.createVNode(b,{class:"btn btn-add",type:"primary",onClick:h,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:S})=>[S.key==="name"?(n.openBlock(),n.createElementBlock("span",wr,[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(S.title),1)])):n.createCommentVNode("",!0),S.key==="title"?(n.openBlock(),n.createElementBlock("span",yr,[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(S.title),1)])):n.createCommentVNode("",!0),S.key==="descs"?(n.openBlock(),n.createElementBlock("span",xr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",vr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Cr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="isPk"?(n.openBlock(),n.createBlock(k,{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(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isFk"?(n.openBlock(),n.createBlock(k,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isNull"?(n.openBlock(),n.createBlock(k,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="syncDbEnable"?(n.openBlock(),n.createBlock(k,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:_,record:y})=>[["name","title","descs","defaultValue"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[y.name]||!Object.keys(l.value[y.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:w=>r(y,S.dataIndex)},[l.value[y.name]&&Object.keys(l.value[y.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:l.value[y.name][S.dataIndex],"onUpdate:value":w=>l.value[y.name][S.dataIndex]=w,onBlur:w=>d(y,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(_||" "),1)],64))],10,Br)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[y.name]||!Object.keys(l.value[y.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:w=>r(y,S.dataIndex)},[l.value[y.name]&&Object.keys(l.value[y.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:l.value[y.name][S.dataIndex],"onUpdate:value":w=>l.value[y.name][S.dataIndex]=w,onBlur:w=>d(y,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(_||" "),1)],64))],10,Or)):["dataType"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[y.name]||!Object.keys(l.value[y.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:w=>r(y,S.dataIndex)},[l.value[y.name]&&Object.keys(l.value[y.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(V,{key:0,value:y[S.dataIndex],"onUpdate:value":w=>y[S.dataIndex]=w,onBlur:p[0]||(p[0]=w=>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"])),[[s]]):(n.openBlock(),n.createElementBlock("span",_r,n.toDisplayString(_),1))],10,Vr)):["syncDbEnable","isFk","isPk"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:3,checked:y[S.dataIndex],onClick:w=>c(y,S.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:4,checked:!y[S.dataIndex],onClick:w=>c(y,S.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Tr={class:"unione-props-setting data-field-setting"},Mr={key:0},Er=["onClick"],Ir={class:"field-txt"},Dr=["onClick"],Pr={key:1,class:"field-txt"},$r=["onClick"],Fr={key:1},Rr=["onClick"],Lr={key:0,class:"field-txt"},jr={key:4,class:"edit-field"},zr={key:0},qr=["onClick"],Ur=Y(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=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:"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(o,"modelValue"),i={mounted:C=>C.focus()},s=n.ref({});function l(){const C=Object.keys(s.value);if(C.length)for(let x in C){const V=t.value.filter(g=>g.name==x);if(V&&V[0]){let g=s.value[x];Object.keys(g).forEach(m=>{m=="convertName"?(V[0].convert||(V[0].convert={}),V[0].convert.type=g[m]):V[0][m]=g[m]})}}s.value={}}function a(C,x){l();const V={};x=="convertName"?(C.convert||(C.convert={}),V[x]=C.convert?.type):V[x]=C[x]||"",s.value[C.name]=V}function r(C,x){{s.value={};return}}function d(C,x){t.value.filter(g=>g.name==C.name).forEach(g=>{g[x]=!g[x]})}const c=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{c.value.visible=!1}});function h(C,x){const V=t.value.filter(m=>m.name==C.name);V.forEach(m=>{x!="isSort"?m[x]=!0:m[x]=!m[x]});const g=V[0];if(!(!g||x=="isSort")){switch(c.value.prop=x,c.value.field=C,g.show||(g.show={}),x){case"isQuery":g.show.query||(g.show.query={}),c.value.show=g.show.query,c.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":g.show.form||(g.show.form={}),c.value.show=g.show.form,c.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":g.show.view||(g.show.view={}),c.value.show=g.show.view,c.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":g.show.list||(g.show.list={}),c.value.show=g.show.list,c.value.title=`列头设置/${C.title}(${C.name})`;break}c.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:C=>{const x=f.value.options.filter(V=>V.value==C);return x[0]?x[0].label:C}}),u=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let x="";return C.rules&&(x=C.rules.filter(V=>V.enable).length||""),x&&(x="("+x+")"),x},toSetting:()=>{const C=u.value.props,x={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(x.min=C.rangeMin,x.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(x.max=C.rangeMax,x.enable=!0);const V={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(V.pattern=C.regExpress,V.enable=!0),u.value.field.rules=[x,V],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function p(C){u.value.visible=!0,u.value.field=C;const x=C.rules||[],V={trigger:"change",whitespace:!0};x.forEach(g=>{g.name=="reg"&&(V.trigger=g.trigger,V.whitespace=g.whitespace,V.regExpress=g.pattern,V.regMessage=g.message),g.name=="range"&&(V.rangeMin=g.min,V.rangeMax=g.max,V.rangeMessage=g.message)}),u.value.props=V}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:C=>{const x=b.value.widgets.filter(V=>V.value==C);return x[0]?x[0].label:C},toSetting:()=>{}}),k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(C,x)=>{k.value.convert.options.splice(C,1)},toSetting:()=>{k.value.visible=!1}});function v(C){k.value.visible=!0,k.value.field=C,k.value.convert=C.convert||{}}return(C,x)=>{const V=n.resolveComponent("ToolOutlined"),g=n.resolveComponent("a-button"),m=n.resolveComponent("a-select"),S=n.resolveComponent("a-checkbox"),_=n.resolveComponent("a-table"),y=n.resolveComponent("a-input-number"),w=n.resolveComponent("a-form-item"),N=n.resolveComponent("a-input"),A=n.resolveComponent("a-form"),O=n.resolveComponent("a-modal"),D=n.resolveComponent("a-col"),M=n.resolveComponent("a-row"),E=n.resolveComponent("a-select-option"),z=n.resolveComponent("a-divider"),$=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Tr,[n.createVNode(_,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:I})=>[["widget","queryType","rules","convertName"].includes(I.key)?(n.openBlock(),n.createElementBlock("span",Mr,[n.createVNode(V),n.createTextVNode(" "+n.toDisplayString(I.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:I,text:K,record:L})=>[["rules"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!u.value.showInfo(L)&&"empty"]),onClick:B=>p(L)},[n.createElementVNode("span",Ir,n.toDisplayString(u.value.showInfo(L)),1),u.value.showInfo(L)?(n.openBlock(),n.createBlock(g,{key:0,type:"link"},{default:n.withCtx(()=>x[22]||(x[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Er)):["widget"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[L.name]||!Object.keys(s.value[L.name]).includes(I.dataIndex))&&!K&&"empty"]),onClick:B=>a(L,I.dataIndex)},[s.value[L.name]&&Object.keys(s.value[L.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:L[I.dataIndex],"onUpdate:value":B=>L[I.dataIndex]=B,allowClear:!0,options:b.value.widgets,onBlur:x[0]||(x[0]=B=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Pr,n.toDisplayString(b.value.widgetName(K)),1))],10,Dr)):["queryType"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[L.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[L.name]||!Object.keys(s.value[L.name]).includes(I.dataIndex))&&!K&&"empty"]),onClick:B=>a(L,I.dataIndex)},[s.value[L.name]&&Object.keys(s.value[L.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:L[I.dataIndex],"onUpdate:value":B=>L[I.dataIndex]=B,allowClear:!0,options:f.value.options,onBlur:x[1]||(x[1]=B=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Fr,n.toDisplayString(f.value.showLabel(K)),1))],10,$r)):n.createCommentVNode("",!0)],64)):["convertName"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[L.name]||!Object.keys(s.value[L.name]).includes(I.dataIndex))&&!L.convert?.type&&"empty"]),onClick:B=>a(L,I.dataIndex)},[s.value[L.name]&&Object.keys(s.value[L.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:L.convert.type,"onUpdate:value":B=>L.convert.type=B,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:x[2]||(x[2]=B=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[L.convert?.type?(n.openBlock(),n.createElementBlock("span",Lr,n.toDisplayString(L.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),L.convert?.type?(n.openBlock(),n.createBlock(g,{key:1,type:"link",onClick:n.withModifiers(B=>v(L),["stop"])},{default:n.withCtx(()=>x[23]||(x[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Rr)):["isQuery","isForm","isView","isList","isSort"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",jr,[n.createVNode(S,{checked:L[I.dataIndex],onClick:B=>d(L,I.dataIndex)},null,8,["checked","onClick"]),n.createVNode(g,{type:"link",onClick:B=>h(L,I.dataIndex)},{default:n.withCtx(()=>x[24]||(x[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(O,{visible:c.value.visible,"onUpdate:visible":x[9]||(x[9]=I=>c.value.visible=I),title:c.value.title,onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:c.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(w,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(y,{value:c.value.show.index,"onUpdate:value":x[3]||(x[3]=I=>c.value.show.index=I)},null,8,["value"])]),_:1}),["isQuery"].includes(c.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(w,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:c.value.show.width,"onUpdate:value":x[4]||(x[4]=I=>c.value.show.width=I)},null,8,["value"])]),_:1})),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:c.value.show.labelWidth,"onUpdate:value":x[5]||(x[5]=I=>c.value.show.labelWidth=I)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:c.value.show.valueWidth,"onUpdate:value":x[6]||(x[6]=I=>c.value.show.valueWidth=I)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(m,{value:c.value.show.fixed,"onUpdate:value":x[7]||(x[7]=I=>c.value.show.fixed=I),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(m,{value:c.value.show.align,"onUpdate:value":x[8]||(x[8]=I=>c.value.show.align=I),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(O,{visible:k.value.visible,"onUpdate:visible":x[11]||(x[11]=I=>k.value.visible=I),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",zr,[n.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>x[25]||(x[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(_,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:I,text:K,record:L,index:B})=>[I.dataIndex==="label"?(n.openBlock(),n.createBlock(N,{key:0,value:L.label,"onUpdate:value":Q=>L.label=Q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),I.dataIndex==="value"?(n.openBlock(),n.createBlock(N,{key:1,value:L.value,"onUpdate:value":Q=>L.value=Q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),I.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:Q=>k.value.toDelOption(B,L)},"删除",8,qr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock(A,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(M,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(D,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(w,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(N,{value:k.value.convert.dict,"onUpdate:value":x[10]||(x[10]=I=>k.value.convert.dict=I)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(O,{visible:b.value.visible,"onUpdate:visible":x[13]||(x[13]=I=>b.value.visible=I),title:"控件设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{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(w,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(m,{value:b.value.props.mode,"onUpdate:value":x[12]||(x[12]=I=>b.value.props.mode=I),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(E,{value:"multiple"},{default:n.withCtx(()=>x[26]||(x[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(E,{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(O,{visible:u.value.visible,"onUpdate:visible":x[21]||(x[21]=I=>u.value.visible=I),title:"规则设置",onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(z,{orientation:"left"},{default:n.withCtx(()=>x[28]||(x[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(w,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode($,{value:u.value.props.trigger,"onUpdate:value":x[14]||(x[14]=I=>u.value.props.trigger=I),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(w,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(S,{value:u.value.props.whitespace,"onUpdate:value":x[15]||(x[15]=I=>u.value.props.whitespace=I),checked:u.value.props.whitespace},{default:n.withCtx(()=>x[29]||(x[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(z,{orientation:"left"},{default:n.withCtx(()=>x[30]||(x[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(w,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(y,{value:u.value.props.rangeMin,"onUpdate:value":x[16]||(x[16]=I=>u.value.props.rangeMin=I)},null,8,["value"]),x[31]||(x[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(y,{value:u.value.props.rangeMax,"onUpdate:value":x[17]||(x[17]=I=>u.value.props.rangeMax=I)},null,8,["value"])]),_:1}),n.createVNode(w,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.rangeMessage,"onUpdate:value":x[18]||(x[18]=I=>u.value.props.rangeMessage=I)},null,8,["value"])]),_:1}),n.createVNode(z,{orientation:"left"},{default:n.withCtx(()=>x[32]||(x[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(w,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regExpress,"onUpdate:value":x[19]||(x[19]=I=>u.value.props.regExpress=I)},null,8,["value"])]),_:1}),n.createVNode(w,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regMessage,"onUpdate:value":x[20]||(x[20]=I=>u.value.props.regMessage=I)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Wr={class:"unione-props-setting data-field"},Hr=Y(n.defineComponent({__name:"dataField",props:n.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=n.useModel(o,"modelValue");return(t,i)=>{const s=n.resolveComponent("OrderedListOutlined"),l=n.resolveComponent("a-tab-pane"),a=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Wr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(l,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(s),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(l,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(a),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Ur,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Kr={key:0,class:"data-model-list"},Qr=["onClick"],Gr=Y(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(o,{expose:e}){const t=n.computed(()=>s.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const s=o;function l(f){i.value=f}function a(){if(t.value.length>=s.limit){G.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=ia.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),s.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(),c=n.inject("closeSetting");function h(){d.value.validate().then(f=>{c&&c()})}return e({toSaving:h}),(f,u)=>{const p=n.resolveComponent("a-input"),b=n.resolveComponent("a-form-item"),k=n.resolveComponent("a-textarea"),v=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",s.limit<=1&&"center"])},[s.limit>1?(n.openBlock(),n.createElementBlock("div",Kr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,C=>(n.openBlock(),n.createElementBlock("div",{key:C.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==C.sn&&"slt"]),onClick:x=>l(C)},n.toDisplayString(C.title),11,Qr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:a},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",s.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]=C=>i.value.title=C)},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]=C=>i.value.name=C)},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]=C=>i.value.url=C)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(k,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=C=>i.value.descs=C)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Hr,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=C=>i.value.fields=C)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Yr={class:"unione-props-setting unione-page-setting"},di=Y(n.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref({});return n.onMounted(()=>{t.value=e.editor.define.value}),(i,s)=>{const l=n.resolveComponent("a-form-item"),a=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),c=n.resolveComponent("a-form"),h=n.resolveComponent("a-tab-pane"),f=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Yr,[n.createVNode(f,{type:"card"},{default:n.withCtx(()=>[n.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(c,{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(l,{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(l,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.title,"onUpdate:value":s[0]||(s[0]=u=>t.value.title=u)},null,8,["value"])]),_:1}),n.createVNode(l,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.component,"onUpdate:value":s[1]||(s[1]=u=>t.value.component=u)},null,8,["value"])]),_:1}),n.createVNode(l,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.icon,"onUpdate:value":s[2]||(s[2]=u=>t.value.icon=u)},null,8,["value"])]),_:1}),n.createVNode(l,{label:"是否全局"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":s[3]||(s[3]=u=>t.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(l,{label:"是否模版"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":s[4]||(s[4]=u=>t.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(l,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{value:t.value.descs,"onUpdate:value":s[5]||(s[5]=u=>t.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),n.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Gr,{editor:o.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),vs=Y(n.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new Rt,s=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(l.value,a)});const l=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),l.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+l.value),i.setModel("run"),i.load(l.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(ri,{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(s.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(di,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Xr={class:"form-btns"},Cs=Y(n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},s=new Rt,l=n.computed(()=>s.$widgetList.value||[]),a=n.computed(()=>{const f=s.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 s.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"&&c()}async function d(){const f=s.dataManager().form();let u={};for(let p in f){const b=await f[p].validate();if(s.dataManager().psn()==p){for(let k in u)b[k]=u[k];u=b}else u[p]=b}console.log("=======form data=====",u),s.dataManager().primary().save({data:u,params:s.dataManager().params}).then(p=>{console.log("save result:",p)})}function c(){e.back()}n.watch(()=>t.pageDefine,f=>{f&&s.load(h.value,f)});const h=n.ref("new_");return n.onMounted(()=>{const f=n.inject("route");console.log("unione page view route",f),h.value=t.psn||f?.query?.psn||f?.meta?.psn||"new_",console.log("unione page view,psn:"+h.value),s.setModel(f?.query?.model||f?.meta?.model||"run"),f?.query&&s.dataManager().params(f.query),s.load(h.value,t.pageDefine||i)}),(f,u)=>{const p=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(ri,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(s)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,b=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:n.unref(s)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",Xr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.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(s),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(s)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(di,{editor:n.unref(s)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-15f9f222"]]),Ss=Y(n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[{wid:"query-form",widget:"unione-query-form",dataModel:"",configs:{keywords:{},fields:[],labelWidth:8}},{wid:"table-list",widget:"unione-table-list",dataModel:"",configs:{leftBtns:[],rightBtns:[],columns:[],operation:{title:"操作",visible:!0,width:150,btns:[],more:{layout:"horizontal"},count:2}}}],dsnList:[]},component:"unione-page-list"},i=new Rt,s=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(l.value,a)});const l=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),l.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+l.value),i.setModel(a?.query?.model||a?.meta?.model||"run"),i.load(l.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(ri,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.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(di,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-3255459d"]]),ct={release(o){return W.axios.admin({url:"/api/data/define/release",method:"post",data:o})},find(o){return W.axios.admin({url:"/api/data/define/find",method:"post",data:o})},save(o){return W.axios.admin({url:"/api/data/define/save",method:"post",data:o})},delete(o){return W.axios.admin({url:"/api/data/define/delete",method:"post",data:o})},detail(o){return W.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:o})},loadFromDb(o){return W.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})},impFromDb(o){return W.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})}},Jr={class:"unione-page list-page"},Zr=Y(n.defineComponent({__name:"list",setup(o){const e=Me(),t=W.useDialog(),i=n.inject("router"),s=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),l=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 a=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){a.value.loading=!0,ct.find({page:a.value.pagination.current,pageSize:a.value.pagination.pageSize,body:a.value.params}).then(g=>{a.value.data=g.body,a.value.pagination.total=g.total*1}).finally(()=>{a.value.loading=!1})}function d(g){a.value.pagination.current=g.pagination.current,a.value.pagination.pageSize=g.pagination.pageSize,r()}function c(g){a.value.pagination.current=1,a.value.params=g||{},r()}function h({btn:g,event:m,row:S}){console.log("table btn click",g,m,S),(g.name=="add"||g.name=="edit")&&i.push({path:"/system/data/define/edit",query:S?{id:S.id}:{}}),g.name=="impFromDb"&&(u.value=!0),g.name=="release"&&f(S),g.name=="view"&&i.push({path:e.listPageUrl,query:{psn:S.sn+":list",model:"preview"}})}function f(g){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([g.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}),k=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function v(g){!g||!Object.keys(g).length||!g.dsId||(G.message.loading("数据加载中..."),k.value.params=g,k.value.loading=!0,ct.loadFromDb(g).then(m=>{k.value.loading=!1,G.message.destroy(),m.success?(m.body.forEach(S=>{S.checkable=!!S.id}),k.value.data=m.body,k.value.pagination.total=m.body.length):G.message.error(m.message)}))}function C(g){k.value.pagination.current=g.pagination.current,k.value.pagination.pageSize=g.pagination.pageSize}const x=n.ref();function V({btn:g}){if(g.name!="imp")return;const m=x.value.getSelected();m?.keys?.length?t.confirm({content:"确定导入选中的"+m.keys.length+"条记录么?",onOk:()=>{G.message.loading("数据导入中..."),ct.impFromDb({dsId:k.value.params.dsId,tables:m.keys.join()}).then(S=>{G.message.destroy(),S.success?(t.success({content:S.message}),c()):t.error({context:S.message})})}}):t.error({content:"请选择目标记录!"})}return(g,m)=>{const S=n.resolveComponent("UnioneQuery"),_=n.resolveComponent("UnioneTable"),y=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",Jr,[n.createVNode(S,{widget:s.value,onQuery:c,onReset:c},null,8,["widget"]),n.createVNode(_,{widget:l.value,dataList:a.value.data,loading:a.value.loading,pagination:a.value.pagination,onChange:d,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),n.createVNode(y,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":m[0]||(m[0]=w=>u.value=w),placement:"left"},{default:n.withCtx(()=>[n.createVNode(S,{widget:p.value,onQuery:v,onReset:v,onBtnClick:V,class:"load-table-form"},null,8,["widget"]),n.createVNode(_,{widget:b.value,dataList:k.value.data,loading:k.value.loading,pagination:k.value.pagination,onChange:C,rowKey:"name",ref_key:"loadTableObj",ref:x},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-d7658b67"]]),ed={class:"unione-props-setting data-field-manage"},td={key:0},id={key:1},nd=["onClick"],sd=["onClick"],ld=["onClick"],od={key:1},ad=Y(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){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(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(b=>{i.value.selectedRowKeys.includes(b)||i.value.selectedRowKeys.push(b);const k=[];t.value.forEach(v=>{!p.includes(v.name)&&i.value.selectedRowKeys.includes(v.name)&&k.push(v.name)}),k.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(v=>!k.includes(v)))})}}),s={mounted:p=>p.focus()},l=n.ref({});function a(){const p=Object.keys(l.value);if(p.length)for(let b in p){const k=t.value.filter(v=>v.name==b);if(k&&k[0]){let v=l.value[b];Object.keys(v).forEach(C=>{k[0][C]=v[C]})}}l.value={}}function r(p,b){a();const k={};k[b]=p[b]||"",l.value[p.name]=k}function d(p,b){if(!p||!b){l.value={};return}const k=l.value[p.name][b];if(b=="name"&&t.value.filter(C=>C[b]==k&&C.name!=p.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+k+"]已存在"});return}p[b]=k,l.value={}}function c(p,b){const k=t.value.filter(v=>v.name==p.name)[0];return b=="isFk"?k.configs?.fkey?.enable:k[b]==1}function h(p,b){const k=t.value.filter(v=>v.name==p.name)[0];b=="isFk"?(k.configs||(k.configs={}),k.configs.fkey||(k.configs.fkey={}),k.configs.fkey.enable=!k.configs.fkey.enable):k[b]!=1?k[b]=1:k[b]=0}function f(){if(a(),t.value.filter(k=>k.name=="new_").length>0){l.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),l.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 k=n.resolveComponent("a-button"),v=n.resolveComponent("a-tooltip"),C=n.resolveComponent("a-input"),x=n.resolveComponent("a-input-number"),V=n.resolveComponent("a-select-option"),g=n.resolveComponent("a-select"),m=n.resolveComponent("a-checkbox"),S=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",ed,[n.createVNode(k,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>b[1]||(b[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(k,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:n.withCtx(()=>b[2]||(b[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(S,{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",td,[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",id,[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:y,record:w})=>[["name","title","descs","dataValue"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[w.name]||!Object.keys(l.value[w.name]).includes(_.dataIndex))&&!y&&"empty"]),onClick:N=>r(w,_.dataIndex)},[l.value[w.name]&&Object.keys(l.value[w.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:l.value[w.name][_.dataIndex],"onUpdate:value":N=>l.value[w.name][_.dataIndex]=N,onBlur:N=>d(w,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(y||" "),1)],64))],10,nd)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[w.name]||!Object.keys(l.value[w.name]).includes(_.dataIndex))&&!y&&"empty"]),onClick:N=>r(w,_.dataIndex)},[l.value[w.name]&&Object.keys(l.value[w.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:l.value[w.name][_.dataIndex],"onUpdate:value":N=>l.value[w.name][_.dataIndex]=N,onBlur:N=>d(w,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(y||" "),1)],64))],10,sd)):["dataType"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[w.name]||!Object.keys(l.value[w.name]).includes(_.dataIndex))&&!y&&"empty"]),onClick:N=>r(w,_.dataIndex)},[l.value[w.name]&&Object.keys(l.value[w.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(g,{key:0,value:w[_.dataIndex],"onUpdate:value":N=>w[_.dataIndex]=N,onBlur:b[0]||(b[0]=N=>d())},{default:n.withCtx(()=>[n.createVNode(V,{key:"String",value:"String"}),n.createVNode(V,{key:"Long",value:"Long"}),n.createVNode(V,{key:"Short",value:"Short"}),n.createVNode(V,{key:"Integer",value:"Integer"}),n.createVNode(V,{key:"Float",value:"Float"}),n.createVNode(V,{key:"Double",value:"Double"}),n.createVNode(V,{key:"Date",value:"Date"}),n.createVNode(V,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[s]]):(n.openBlock(),n.createElementBlock("span",od,n.toDisplayString(y),1))],10,ld)):["syncEnable","isFk","isPk"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:3,checked:c(w,_.dataIndex),onClick:N=>h(w,_.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:4,checked:!c(w,_.dataIndex),onClick:N=>h(w,_.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Ns=1024;let rd=0,tn=class{constructor(e,t){this.from=e,this.to=t}};class X{constructor(e={}){this.id=rd++,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]}}}X.closedBy=new X({deserialize:o=>o.split(" ")}),X.openedBy=new X({deserialize:o=>o.split(" ")}),X.group=new X({deserialize:o=>o.split(" ")}),X.isolate=new X({deserialize:o=>{if(o&&o!="rtl"&&o!="ltr"&&o!="auto")throw new RangeError("Invalid value for isolate: "+o);return o||"auto"}}),X.contextHash=new X({perNode:!0}),X.lookAhead=new X({perNode:!0}),X.mounted=new X({perNode:!0});class ci{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[X.mounted.id]}}const dd=Object.create(null);class Ce{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):dd,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Ce(e.name||"",t,e.id,i);if(e.props){for(let l of e.props)if(Array.isArray(l)||(l=l(s)),l){if(l[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[l[0].id]=l[1]}}return s}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(X.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 s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(X.group),l=-1;l<(s?s.length:0);l++){let a=t[l<0?i.name:s[l]];if(a)return a}}}}Ce.none=new Ce("",Object.create(null),0,8);class nn{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 s=null;for(let l of e){let a=l(i);a&&(s||(s=Object.assign({},i.props)),s[a[0].id]=a[1])}t.push(s?new Ce(i.name,s,i.id,i.flags):i)}return new nn(t)}}const hi=new WeakMap,Bs=new WeakMap;var fe;(function(o){o[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays"})(fe||(fe={}));class re{constructor(e,t,i,s,l){if(this.type=e,this.children=t,this.positions=i,this.length=s,this.props=null,l&&l.length){this.props=Object.create(null);for(let[a,r]of l)this.props[typeof a=="number"?a:a.id]=r}}toString(){let e=ci.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let s=i.toString();s&&(t&&(t+=","),t+=s)}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 on(this.topNode,e)}cursorAt(e,t=0,i=0){let s=hi.get(this)||this.topNode,l=new on(s);return l.moveTo(e,t),hi.set(this,l._tree),l}get topNode(){return new Ve(this,0,0,null)}resolve(e,t=0){let i=Lt(hi.get(this)||this.topNode,e,t,!1);return hi.set(this,i),i}resolveInner(e,t=0){let i=Lt(Bs.get(this)||this.topNode,e,t,!0);return Bs.set(this,i),i}resolveStack(e,t=0){return fd(this,e,t)}iterate(e){let{enter:t,leave:i,from:s=0,to:l=this.length}=e,a=e.mode||0,r=(a&fe.IncludeAnonymous)>0;for(let d=this.cursor(a|fe.IncludeAnonymous);;){let c=!1;if(d.from<=l&&d.to>=s&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;c=!0}for(;c&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;c=!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:rn(Ce.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new re(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new re(Ce.none,t,i,s)))}static build(e){return ud(e)}}re.empty=new re(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],s=this.set.types[t],l=s.name;if(/\W/.test(l)&&!s.isError&&(l=JSON.stringify(l)),e+=4,i==e)return l;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return l+"("+a.join(",")+")"}findChild(e,t,i,s,l){let{buffer:a}=this,r=-1;for(let d=e;d!=t&&!(Os(l,s,a[d+1],a[d+2])&&(r=d,i>0));d=a[d+3]);return r}slice(e,t,i){let s=this.buffer,l=new Uint16Array(t-e),a=0;for(let r=e,d=0;r<t;){l[d++]=s[r++],l[d++]=s[r++]-i;let c=l[d++]=s[r++]-i;l[d++]=s[r++]-e,a=Math.max(a,c)}return new Ze(l,a,this.set)}}function Os(o,e,t,i){switch(o){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 Lt(o,e,t,i){for(var s;o.from==o.to||(t<1?o.from>=e:o.from>e)||(t>-1?o.to<=e:o.to<e);){let a=!i&&o instanceof Ve&&o.index<0?null:o.parent;if(!a)return o;o=a}let l=i?0:fe.IgnoreOverlays;if(i)for(let a=o,r=a.parent;r;a=r,r=a.parent)a instanceof Ve&&a.index<0&&((s=r.enter(e,t,l))===null||s===void 0?void 0:s.from)!=a.from&&(o=r);for(;;){let a=o.enter(e,t,l);if(!a)return o;o=a}}class Vs{cursor(e=0){return new on(this,e)}getChild(e,t=null,i=null){let s=_s(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return _s(this,e,t,i)}resolve(e,t=0){return Lt(this,e,t,!1)}resolveInner(e,t=0){return Lt(this,e,t,!0)}matchContext(e){return ln(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(i=t,t=s.prevSibling):t=s}return i}get node(){return this}get next(){return this.parent}}class Ve extends Vs{constructor(e,t,i,s){super(),this._tree=e,this.from=t,this.index=i,this._parent=s}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,s,l=0){for(let a=this;;){for(let{children:r,positions:d}=a._tree,c=t>0?r.length:-1;e!=c;e+=t){let h=r[e],f=d[e]+a.from;if(Os(s,i,f,f+h.length)){if(h instanceof Ze){if(l&fe.ExcludeBuffers)continue;let u=h.findChild(0,h.buffer.length,t,i-f,s);if(u>-1)return new et(new cd(a,h,e,f),null,u)}else if(l&fe.IncludeAnonymous||!h.type.isAnonymous||an(h)){let u;if(!(l&fe.IgnoreMounts)&&(u=ci.get(h))&&!u.overlay)return new Ve(u.tree,f,e,a);let p=new Ve(h,f,e,a);return l&fe.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?h.children.length-1:0,t,i,s)}}}if(l&fe.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))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 s;if(!(i&fe.IgnoreOverlays)&&(s=ci.get(this._tree))&&s.overlay){let l=e-this.from;for(let{from:a,to:r}of s.overlay)if((t>0?a<=l:a<l)&&(t<0?r>=l:r>l))return new Ve(s.tree,s.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 _s(o,e,t,i){let s=o.cursor(),l=[];if(!s.firstChild())return l;if(t!=null){for(let a=!1;!a;)if(a=s.type.is(t),!s.nextSibling())return l}for(;;){if(i!=null&&s.type.is(i))return l;if(s.type.is(e)&&l.push(s.node),!s.nextSibling())return i==null?l:[]}}function ln(o,e,t=e.length-1){for(let i=o.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 cd{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class et extends Vs{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:s}=this.context,l=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return l<0?null:new et(this.context,this,l)}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:s}=this.context,l=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return l<0?null:new et(this.context,this,l)}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,s=this.index+4,l=i.buffer[this.index+3];if(l>s){let a=i.buffer[this.index+1];e.push(i.slice(s,l,a)),t.push(0)}return new re(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function As(o){if(!o.length)return null;let e=0,t=o[0];for(let l=1;l<o.length;l++){let a=o[l];(a.from>t.from||a.to<t.to)&&(t=a,e=l)}let i=t instanceof Ve&&t.index<0?null:t.parent,s=o.slice();return i?s[e]=i:s.splice(e,1),new hd(s,t)}class hd{constructor(e,t){this.heads=e,this.node=t}get next(){return As(this.heads)}}function fd(o,e,t){let i=o.resolveInner(e,t),s=null;for(let l=i instanceof Ve?i:i.context.parent;l;l=l.parent)if(l.index<0){let a=l.parent;(s||(s=[i])).push(a.resolve(e,t)),l=a}else{let a=ci.get(l.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let r=new Ve(a.tree,a.overlay[0].from+l.from,-1,l);(s||(s=[i])).push(Lt(r,e,t,!1))}}return s?As(s):i}class on{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:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.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:s}=this.buffer,l=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return l<0?!1:(this.stack.push(this.index),this.yieldBuf(l))}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 s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}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:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let l=0;l<this.index;l++)if(s.buffer.buffer[l+3]<this.index)return!1;({index:t,parent:i}=s)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let l=t+e,a=e<0?-1:i._tree.children.length;l!=a;l+=e){let r=i._tree.children[l];if(this.mode&fe.IncludeAnonymous||r instanceof Ze||!r.type.isAnonymous||an(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 s=this.index,l=this.stack.length;l>=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;t=a,i=l+1;break e}s=this.stack[--l]}for(let s=i;s<this.stack.length;s++)t=new et(this.buffer,t,this.stack[s]);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 s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(s=!0)}for(;s&&t&&t(this),s=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,s=!0}}}matchContext(e){if(!this.buffer)return ln(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let s=e.length-1,l=this.stack.length-1;s>=0;l--){if(l<0)return ln(this.node,e,s);let a=i[t.buffer[this.stack[l]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function an(o){return o.children.some(e=>e instanceof Ze||!e.type.isAnonymous||an(e))}function ud(o){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Ns,reused:l=[],minRepeatType:a=i.types.length}=o,r=Array.isArray(t)?new sn(t,t.length):t,d=i.types,c=0,h=0;function f(m,S,_,y,w,N){let{id:A,start:O,end:D,size:M}=r,E=h;for(;M<0;)if(r.next(),M==-1){let L=l[A];_.push(L),y.push(O-m);return}else if(M==-3){c=A;return}else if(M==-4){h=A;return}else throw new RangeError(`Unrecognized record size: ${M}`);let z=d[A],$,I,K=O-m;if(D-O<=s&&(I=v(r.pos-S,w))){let L=new Uint16Array(I.size-I.skip),B=r.pos-I.size,Q=L.length;for(;r.pos>B;)Q=C(I.start,L,Q);$=new Ze(L,D-I.start,i),K=I.start-m}else{let L=r.pos-M;r.next();let B=[],Q=[],T=A>=a?A:-1,j=0,he=D;for(;r.pos>L;)T>=0&&r.id==T&&r.size>=0?(r.end<=he-s&&(b(B,Q,O,j,r.end,he,T,E),j=B.length,he=r.end),r.next()):N>2500?u(O,L,B,Q):f(O,L,B,Q,T,N+1);if(T>=0&&j>0&&j<B.length&&b(B,Q,O,j,O,he,T,E),B.reverse(),Q.reverse(),T>-1&&j>0){let Xi=p(z);$=rn(z,B,Q,0,B.length,0,D-O,Xi,Xi)}else $=k(z,B,Q,D-O,E-D)}_.push($),y.push(K)}function u(m,S,_,y){let w=[],N=0,A=-1;for(;r.pos>S;){let{id:O,start:D,end:M,size:E}=r;if(E>4)r.next();else{if(A>-1&&D<A)break;A<0&&(A=M-s),w.push(O,D,M),N++,r.next()}}if(N){let O=new Uint16Array(N*4),D=w[w.length-2];for(let M=w.length-3,E=0;M>=0;M-=3)O[E++]=w[M],O[E++]=w[M+1]-D,O[E++]=w[M+2]-D,O[E++]=E;_.push(new Ze(O,w[2]-D,i)),y.push(D-m)}}function p(m){return(S,_,y)=>{let w=0,N=S.length-1,A,O;if(N>=0&&(A=S[N])instanceof re){if(!N&&A.type==m&&A.length==y)return A;(O=A.prop(X.lookAhead))&&(w=_[N]+A.length+O)}return k(m,S,_,y,w)}}function b(m,S,_,y,w,N,A,O){let D=[],M=[];for(;m.length>y;)D.push(m.pop()),M.push(S.pop()+_-w);m.push(k(i.types[A],D,M,N-w,O-N)),S.push(w-_)}function k(m,S,_,y,w=0,N){if(c){let A=[X.contextHash,c];N=N?[A].concat(N):[A]}if(w>25){let A=[X.lookAhead,w];N=N?[A].concat(N):[A]}return new re(m,S,_,y,N)}function v(m,S){let _=r.fork(),y=0,w=0,N=0,A=_.end-s,O={size:0,start:0,skip:0};e:for(let D=_.pos-m;_.pos>D;){let M=_.size;if(_.id==S&&M>=0){O.size=y,O.start=w,O.skip=N,N+=4,y+=4,_.next();continue}let E=_.pos-M;if(M<0||E<D||_.start<A)break;let z=_.id>=a?4:0,$=_.start;for(_.next();_.pos>E;){if(_.size<0)if(_.size==-3)z+=4;else break e;else _.id>=a&&(z+=4);_.next()}w=$,y+=M,N+=z}return(S<0||y==m)&&(O.size=y,O.start=w,O.skip=N),O.size>4?O:void 0}function C(m,S,_){let{id:y,start:w,end:N,size:A}=r;if(r.next(),A>=0&&y<a){let O=_;if(A>4){let D=r.pos-(A-4);for(;r.pos>D;)_=C(m,S,_)}S[--_]=O,S[--_]=N-m,S[--_]=w-m,S[--_]=y}else A==-3?c=y:A==-4&&(h=y);return _}let x=[],V=[];for(;r.pos>0;)f(o.start||0,o.bufferStart||0,x,V,-1,0);let g=(e=o.length)!==null&&e!==void 0?e:x.length?V[0]+x[0].length:0;return new re(d[o.topID],x.reverse(),V.reverse(),g)}const Ts=new WeakMap;function fi(o,e){if(!o.isAnonymous||e instanceof Ze||e.type!=o)return 1;let t=Ts.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=o||!(i instanceof re)){t=1;break}t+=fi(o,i)}Ts.set(e,t)}return t}function rn(o,e,t,i,s,l,a,r,d){let c=0;for(let b=i;b<s;b++)c+=fi(o,e[b]);let h=Math.ceil(c*1.5/8),f=[],u=[];function p(b,k,v,C,x){for(let V=v;V<C;){let g=V,m=k[V],S=fi(o,b[V]);for(V++;V<C;V++){let _=fi(o,b[V]);if(S+_>=h)break;S+=_}if(V==g+1){if(S>h){let _=b[g];p(_.children,_.positions,0,_.children.length,k[g]+x);continue}f.push(b[g])}else{let _=k[V-1]+b[V-1].length-m;f.push(rn(o,b,k,g,V,m,_,null,d))}u.push(m+x-l)}}return p(e,t,i,s,0),(r||d)(f,u,a)}class ht{constructor(e,t,i,s,l=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(l?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new ht(0,e.length,e,0,!1,i)];for(let l of t)l.to>e.length&&s.push(l);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],l=1,a=e.length?e[0]:null;for(let r=0,d=0,c=0;;r++){let h=r<t.length?t[r]:null,f=h?h.fromA:1e9;if(f-d>=i)for(;a&&a.from<f;){let u=a;if(d>=u.from||f<=u.to||c){let p=Math.max(u.from,d)-c,b=Math.min(u.to,f)-c;u=p>=b?null:new ht(p,b,u.tree,u.offset+c,r>0,!!h)}if(u&&s.push(u),a.to>f)break;a=l<e.length?e[l++]:null}if(!h)break;d=h.toA,c=h.toA-h.toB}return s}}class Ms{startParse(e,t,i){return typeof e=="string"&&(e=new pd(e)),i=i?i.length?i.map(s=>new tn(s.from,s.to)):[new tn(0,0)]:[new tn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let l=s.advance();if(l)return l}}}class pd{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 X({perNode:!0});class ui{constructor(e,t,i,s,l,a,r,d,c,h=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=l,this.score=a,this.buffer=r,this.bufferBase=d,this.curContext=c,this.lookAhead=h,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 s=e.parser.context;return new ui(e,[],t,i,i,0,[],0,s?new Es(s,s.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,s=e&65535,{parser:l}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let r=l.dynamicPrecedence(s);if(r&&(this.score+=r),i==0){this.pushState(l.getGoto(this.state,s,!0),this.reducePos),s<l.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(s,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),c=d?this.stack[d-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let f=d?this.stack[d-1]:0,u=this.bufferBase+this.buffer.length-f;if(s<l.minRepeatTerm||e&131072){let p=l.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,c,p,u+4,!0)}if(e&262144)this.state=this.stack[d];else{let p=this.stack[d-3];this.state=l.getGoto(p,s,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(s,c)}storeNode(e,t,i,s=4,l=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,r=this.buffer.length;if(r==0&&a.parent&&(r=a.bufferBase-a.parent.bufferBase,a=a.parent),r>0&&a.buffer[r-4]==0&&a.buffer[r-1]>-1){if(t==i)return;if(a.buffer[r-2]>=t){a.buffer[r-2]=i;return}}}if(!l||this.pos==i)this.buffer.push(e,t,i,s);else{let a=this.buffer.length;if(a>0&&this.buffer[a-4]!=0){let r=!1;for(let d=a;d>0&&this.buffer[d-2]>i;d-=4)if(this.buffer[d-1]>=0){r=!0;break}if(r)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4);else{let l=e,{parser:a}=this.p;(s>this.pos||t<=a.maxNode)&&(this.pos=s,a.stateFlag(l,1)||(this.reducePos=s)),this.pushState(l,i),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,s,4)}}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,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),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new ui(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,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 md(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 s=[];for(let l=0,a;l<t.length;l+=2)(a=t[l+1])!=this.state&&this.p.parser.hasAction(a,e)&&s.push(t[l],a);if(this.stack.length<120)for(let l=0;s.length<8&&l<t.length;l+=2){let a=t[l+1];s.some((r,d)=>d&1&&r==a)||s.push(t[l],a)}t=s}let i=[];for(let s=0;s<t.length&&i.length<4;s+=2){let l=t[s+1];if(l==this.state)continue;let a=this.split();a.pushState(l,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[s],this.pos),a.reducePos=this.pos,a.score-=200,i.push(a)}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,s=t&65535,l=this.stack.length-i*3;if(l<0||e.getGoto(this.stack[l],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}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=(s,l)=>{if(!t.includes(s))return t.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let r=(a>>19)-l;if(r>1){let d=a&65535,c=this.stack.length-r*3;if(c>=0&&e.getGoto(this.stack[c],d,!1)>=0)return r<<19|65536|d}}else{let r=i(a,l+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 Es(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 Es{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class md{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 s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class pi{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 pi(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 pi(this.stack,this.pos,this.index)}}function mi(o,e=Uint16Array){if(typeof o!="string")return o;let t=null;for(let i=0,s=0;i<o.length;){let l=0;for(;;){let a=o.charCodeAt(i++),r=!1;if(a==126){l=65535;break}a>=92&&a--,a>=34&&a--;let d=a-32;if(d>=46&&(d-=46,r=!0),l+=d,r)break;l*=46}t?t[s++]=l:t=new e(l)}return t}class gi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Is=new gi;class gd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Is,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,s=this.rangeIndex,l=this.pos+e;for(;l<i.from;){if(!s)return null;let a=this.ranges[--s];l-=i.from-a.to,i=a}for(;t<0?l>i.to:l>=i.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];l+=a.from-i.to,i=a}return l}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,s;if(t>=0&&t<this.chunk.length)i=this.pos+e,s=this.chunk.charCodeAt(t);else{let l=this.resolveOffset(e,1);if(l==null)return-1;if(i=l,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let a=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}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=Is,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 s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class yt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;kd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}yt.prototype.contextual=yt.prototype.fallback=yt.prototype.extend=!1,yt.prototype.fallback=yt.prototype.extend=!1;function kd(o,e,t,i,s,l){let a=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&o[a];){let c=o[a+1];for(let p=a+3;p<c;p+=2)if((o[p+1]&r)>0){let b=o[p];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||bd(b,e.token.value,s,l))){e.acceptToken(b);break}}let h=e.next,f=0,u=o[a+2];if(e.next<0&&u>f&&o[c+u*3-3]==65535){a=o[c+u*3-1];continue e}for(;f<u;){let p=f+u>>1,b=c+p+(p<<1),k=o[b],v=o[b+1]||65536;if(h<k)u=p;else if(h>=v)f=p+1;else{a=o[b+2],e.advance();continue e}}break}}function Ds(o,e,t){for(let i=e,s;(s=o[i])!=65535;i++)if(s==t)return i-e;return-1}function bd(o,e,t,i){let s=Ds(t,i,e);return s<0||Ds(t,i,o)<s}const Ne=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let dn=null;function Ps(o,e,t){let i=o.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(o.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:o.length}}class wd{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?Ps(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ps(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],s=this.index[t];if(s==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let l=i.children[s],a=this.start[t]+i.positions[s];if(a>e)return this.nextStart=a,null;if(l instanceof re){if(a==e){if(a<this.safeFrom)return null;let r=a+l.length;if(r<=this.safeTo){let d=l.prop(X.lookAhead);if(!d||r+d<this.fragment.to)return l}}this.index[t]++,a+l.length>=Math.max(this.safeFrom,e)&&(this.trees.push(l),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+l.length}}}class yd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new gi)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:l}=s,a=s.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let c=0;c<l.length;c++){if(!(1<<c&a))continue;let h=l[c],f=this.tokens[c];if(!(i&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=a||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=a,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),!h.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 gi,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 gi,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:l}=i.p;for(let a=0;a<l.specialized.length;a++)if(l.specialized[a]==e.value){let r=l.specializers[a](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(s+1)}putAction(e,t,i,s){for(let l=0;l<s;l+=3)if(this.actions[l]==e)return s;return this.actions[s++]=e,this.actions[s++]=t,this.actions[s++]=i,s}addActions(e,t,i,s){let{state:l}=e,{parser:a}=e.p,{data:r}=a;for(let d=0;d<2;d++)for(let c=a.stateSlot(l,d?2:1);;c+=3){if(r[c]==65535)if(r[c+1]==1)c=He(r,c+2);else{s==0&&r[c+1]==2&&(s=this.putAction(He(r,c+2),t,i,s));break}r[c]==t&&(s=this.putAction(He(r,c+1),t,i,s))}return s}}class xd{constructor(e,t,i,s){this.parser=e,this.input=t,this.ranges=s,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 gd(t,s),this.tokens=new yd(e,this.stream),this.topTerm=e.top[1];let{from:l}=s[0];this.stacks=[ui.start(this,e.top[0],l)],this.fragments=i.length&&this.stream.end-l>e.bufferLength*4?new wd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,l;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let r=e[a];for(;;){if(this.tokens.mainToken=null,r.pos>t)i.push(r);else{if(this.advanceStack(r,i,e))continue;{s||(s=[],l=[]),s.push(r);let d=this.tokens.getMainToken(r);l.push(d.value,d.end)}}break}}if(!i.length){let a=s&&Cd(s);if(a)return Ne&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Ne&&s&&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&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,l,i);if(a)return Ne&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((r,d)=>d.score-r.score);i.length>a;)i.pop();i.some(r=>r.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a<i.length-1;a++){let r=i[a];for(let d=a+1;d<i.length;d++){let c=i[d];if(r.sameState(c)||r.buffer.length>500&&c.buffer.length>500)if((r.score-c.score||r.buffer.length-c.buffer.length)>0)i.splice(d--,1);else{i.splice(a--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let a=1;a<i.length;a++)i[a].pos<this.minStackPos&&(this.minStackPos=i[a].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 s=e.pos,{parser:l}=this,a=Ne?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?l.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!c||(f.prop(X.contextHash)||0)==h))return e.useNode(f,u),Ne&&console.log(a+this.stackID(e)+` (via reuse of ${l.getName(f.type.id)})`),!0;if(!(f instanceof re)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof re&&f.positions[0]==0)f=p;else break}}let r=l.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ne&&console.log(a+this.stackID(e)+` (via always-reduce ${l.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let c=0;c<d.length;){let h=d[c++],f=d[c++],u=d[c++],p=c==d.length||!i,b=p?e:e.split(),k=this.tokens.mainToken;if(b.apply(h,f,k?k.start:b.pos,u),Ne&&console.log(a+this.stackID(b)+` (via ${h&65536?`reduce of ${l.getName(h&65535)}`:"shift"} for ${l.getName(f)} @ ${s}${b==e?"":", split"})`),p)return!0;b.pos>s?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 $s(e,t),!0}}runRecovery(e,t,i){let s=null,l=!1;for(let a=0;a<e.length;a++){let r=e[a],d=t[a<<1],c=t[(a<<1)+1],h=Ne?this.stackID(r)+" -> ":"";if(r.deadEnd&&(l||(l=!0,r.restart(),Ne&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),u=h;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(h+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,i);this.stream.end>r.pos?(c==r.pos&&(c++,d=0),r.recoverByDelete(d,c),Ne&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),$s(r,i)):(!s||s.score<r.score)&&(s=r)}return s}stackToTree(e){return e.close(),re.build({buffer:pi.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=(dn||(dn=new WeakMap)).get(e);return t||dn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function $s(o,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==o.pos&&i.sameState(o)){e[t].score<o.score&&(e[t]=o);return}}e.push(o)}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 ki extends Ms{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]),s=[];for(let r=0;r<t.length;r++)s.push([]);function l(r,d,c){s[r].push([d,d.deserialize(String(c))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=X[d]);for(let c=1;c<r.length;){let h=r[c++];if(h>=0)l(h,d,r[c++]);else{let f=r[c+-h];for(let u=-h;u>0;u--)l(r[c++],d,f);c++}}}this.nodeSet=new nn(t.map((r,d)=>Ce.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:s[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=Ns;let a=mi(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(Fs),this.states=mi(e.states,Uint32Array),this.data=mi(e.stateData),this.goto=mi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new yt(a,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 s=new xd(this,e,t,i);for(let l of this.wrappers)s=l(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let l=s[t+1];;){let a=s[l++],r=a&1,d=s[l++];if(r&&i)return d;for(let c=l+(a>>1);l<c;l++)if(s[l]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let s=0;s<2;s++)for(let l=this.stateSlot(e,s?2:1),a;;l+=3){if((a=i[l])==65535)if(i[l+1]==1)a=i[l=He(i,l+2)];else{if(i[l+1]==2)return He(i,l+2);break}if(a==t||a==0)return He(i,l+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),s=i?t(i):void 0;for(let l=this.stateSlot(e,1);s==null;l+=3){if(this.data[l]==65535)if(this.data[l+1]==1)l=He(this.data,l+2);else break;s=t(He(this.data,l+1))}return s}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 s=this.data[i+1];t.some((l,a)=>a&1&&l==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(ki.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 s=e.tokenizers.find(l=>l.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let l=e.specializers.find(r=>r.from==i.external);if(!l)return i;let a=Object.assign(Object.assign({},i),{external:l.to});return t.specializers[s]=Fs(a),a})),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 l of e.split(" ")){let a=t.indexOf(l);a>=0&&(i[a]=!0)}let s=null;for(let l=0;l<t.length;l++)if(!i[l])for(let a=this.dialects[t[l]],r;(r=this.data[a++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[r]=1;return new vd(e,i,s)}static deserialize(e){return new ki(e)}}function He(o,e){return o[e]|o[e+1]<<16}function Cd(o){let e=null;for(let t of o){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 Fs(o){if(o.external){let e=o.extend?1:0;return(t,i)=>o.external(t,i)<<1|e}return o.get}let Sd=0;class _e{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=Sd++}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 s=new _e(i,[],null,[]);if(s.set.push(s),t)for(let l of t.set)s.set.push(l);return s}static defineModifier(e){let t=new bi(e);return i=>i.modified.indexOf(t)>-1?i:bi.get(i.base||i,i.modified.concat(t).sort((s,l)=>s.id-l.id))}}let Nd=0;class bi{constructor(e){this.name=e,this.instances=[],this.id=Nd++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Bd(t,r.modified));if(i)return i;let s=[],l=new _e(e.name,s,e,t);for(let r of t)r.instances.push(l);let a=Od(t);for(let r of e.set)if(!r.modified.length)for(let d of a)s.push(bi.get(r,d));return l}}function Bd(o,e){return o.length==e.length&&o.every((t,i)=>t==e[i])}function Od(o){let e=[[]];for(let t=0;t<o.length;t++)for(let i=0,s=e.length;i<s;i++)e.push(e[i].concat(o[t]));return e.sort((t,i)=>i.length-t.length)}function Rs(o){let e=Object.create(null);for(let t in o){let i=o[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let l=[],a=2,r=s;for(let f=0;;){if(r=="..."&&f>0&&f+3==s.length){a=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+s);if(l.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let p=s[f++];if(f==s.length&&p=="!"){a=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);r=s.slice(f)}let d=l.length-1,c=l[d];if(!c)throw new RangeError("Invalid path: "+s);let h=new cn(i,a,d>0?l.slice(0,d):null);e[c]=h.sort(e[c])}}return Vd.add(e)}const Vd=new X;class cn{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}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}}cn.empty=new cn([],2,null);function Ls(o,e){let t=Object.create(null);for(let l of o)if(!Array.isArray(l.tag))t[l.tag.id]=l.class;else for(let a of l.tag)t[a.id]=l.class;let{scope:i,all:s=null}=e||{};return{style:l=>{let a=s;for(let r of l)for(let d of r.set){let c=t[d.id];if(c){a=a?a+" "+c:c;break}}return a},scope:i}}const R=_e.define,wi=R(),tt=R(),js=R(tt),zs=R(tt),it=R(),yi=R(it),hn=R(it),Pe=R(),ft=R(Pe),$e=R(),Fe=R(),fn=R(),jt=R(fn),xi=R(),P={comment:wi,lineComment:R(wi),blockComment:R(wi),docComment:R(wi),name:tt,variableName:R(tt),typeName:js,tagName:R(js),propertyName:zs,attributeName:R(zs),className:R(tt),labelName:R(tt),namespace:R(tt),macroName:R(tt),literal:it,string:yi,docString:R(yi),character:R(yi),attributeValue:R(yi),number:hn,integer:R(hn),float:R(hn),bool:R(it),regexp:R(it),escape:R(it),color:R(it),url:R(it),keyword:$e,self:R($e),null:R($e),atom:R($e),unit:R($e),modifier:R($e),operatorKeyword:R($e),controlKeyword:R($e),definitionKeyword:R($e),moduleKeyword:R($e),operator:Fe,derefOperator:R(Fe),arithmeticOperator:R(Fe),logicOperator:R(Fe),bitwiseOperator:R(Fe),compareOperator:R(Fe),updateOperator:R(Fe),definitionOperator:R(Fe),typeOperator:R(Fe),controlOperator:R(Fe),punctuation:fn,separator:R(fn),bracket:jt,angleBracket:R(jt),squareBracket:R(jt),paren:R(jt),brace:R(jt),content:Pe,heading:ft,heading1:R(ft),heading2:R(ft),heading3:R(ft),heading4:R(ft),heading5:R(ft),heading6:R(ft),contentSeparator:R(Pe),list:R(Pe),quote:R(Pe),emphasis:R(Pe),strong:R(Pe),link:R(Pe),monospace:R(Pe),strikethrough:R(Pe),inserted:R(),deleted:R(),changed:R(),invalid:R(),meta:xi,documentMeta:R(xi),annotation:R(xi),processingInstruction:R(xi),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 o in P){let e=P[o];e instanceof _e&&(e.name=o)}Ls([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]);const _d=Rs({String:P.string,Number:P.number,"True False":P.bool,PropertyName:P.propertyName,Null:P.null,",":P.separator,"[ ]":P.squareBracket,"{ }":P.brace}),Ad=ki.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:[_d],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 J{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]=xt(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Re.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=xt(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),s=new zt(this),l=new zt(e);for(let a=t,r=t;;){if(s.next(a),l.next(a),a=0,s.lineBreak!=l.lineBreak||s.done!=l.done||s.value!=l.value)return!1;if(r+=s.value.length,s.done||r>=i)return!0}}iter(e=1){return new zt(this,e)}iterRange(e,t=this.length){return new Us(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ws(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]?J.empty:e.length<=32?new ae(e):Re.from(ae.split(e,[]))}}class ae extends J{constructor(e,t=Td(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let l=0;;l++){let a=this.text[l],r=s+a.length;if((t?i:r)>=e)return new Md(s,r,i,a);s=r+1,i++}}decompose(e,t,i,s){let l=e<=0&&t>=this.length?this:new ae(qs(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let a=i.pop(),r=vi(l.text,a.text.slice(),0,l.length);if(r.length<=32)i.push(new ae(r,a.length+l.length));else{let d=r.length>>1;i.push(new ae(r.slice(0,d)),new ae(r.slice(d)))}}else i.push(l)}replace(e,t,i){if(!(i instanceof ae))return super.replace(e,t,i);[e,t]=xt(this,e,t);let s=vi(this.text,vi(i.text,qs(this.text,0,e)),t),l=this.length+i.length-(t-e);return s.length<=32?new ae(s,l):Re.from(ae.split(s,[]),l)}sliceString(e,t=this.length,i=`
2
- `){[e,t]=xt(this,e,t);let s="";for(let l=0,a=0;l<=t&&a<this.text.length;a++){let r=this.text[a],d=l+r.length;l>e&&a&&(s+=i),e<d&&t>l&&(s+=r.slice(Math.max(0,e-l),t-l)),l=d+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let l of e)i.push(l),s+=l.length+1,i.length==32&&(t.push(new ae(i,s)),i=[],s=-1);return s>-1&&t.push(new ae(i,s)),t}}class Re extends J{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,s){for(let l=0;;l++){let a=this.children[l],r=s+a.length,d=i+a.lines-1;if((t?d:r)>=e)return a.lineInner(e,t,i,s);s=r+1,i=d+1}}decompose(e,t,i,s){for(let l=0,a=0;a<=t&&l<this.children.length;l++){let r=this.children[l],d=a+r.length;if(e<=d&&t>=a){let c=s&((a<=e?1:0)|(d>=t?2:0));a>=e&&d<=t&&!c?i.push(r):r.decompose(e-a,t-a,i,c)}a=d+1}}replace(e,t,i){if([e,t]=xt(this,e,t),i.lines<this.lines)for(let s=0,l=0;s<this.children.length;s++){let a=this.children[s],r=l+a.length;if(e>=l&&t<=r){let d=a.replace(e-l,t-l,i),c=this.lines-a.lines+d.lines;if(d.lines<c>>4&&d.lines>c>>6){let h=this.children.slice();return h[s]=d,new Re(h,this.length-(t-e)+i.length)}return super.replace(l,r,d)}l=r+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
- `){[e,t]=xt(this,e,t);let s="";for(let l=0,a=0;l<this.children.length&&a<=t;l++){let r=this.children[l],d=a+r.length;a>e&&l&&(s+=i),e<d&&t>a&&(s+=r.sliceString(e-a,t-a,i)),a=d+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Re))return 0;let i=0,[s,l,a,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,l+=t){if(s==a||l==r)return i;let d=this.children[s],c=e.children[l];if(d!=c)return i+d.scanIdentical(c,t);i+=d.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let p of e)i+=p.lines;if(i<32){let p=[];for(let b of e)b.flatten(p);return new ae(p,t)}let s=Math.max(32,i>>5),l=s<<1,a=s>>1,r=[],d=0,c=-1,h=[];function f(p){let b;if(p.lines>l&&p instanceof Re)for(let k of p.children)f(k);else p.lines>a&&(d>a||!d)?(u(),r.push(p)):p instanceof ae&&d&&(b=h[h.length-1])instanceof ae&&p.lines+b.lines<=32?(d+=p.lines,c+=p.length+1,h[h.length-1]=new ae(b.text.concat(p.text),b.length+1+p.length)):(d+p.lines>s&&u(),d+=p.lines,c+=p.length+1,h.push(p))}function u(){d!=0&&(r.push(h.length==1?h[0]:Re.from(h,c)),c=-1,d=h.length=0)}for(let p of e)f(p);return u(),r.length==1?r[0]:new Re(r,t)}}J.empty=new ae([""],0);function Td(o){let e=-1;for(let t of o)e+=t.length+1;return e}function vi(o,e,t=0,i=1e9){for(let s=0,l=0,a=!0;l<o.length&&s<=i;l++){let r=o[l],d=s+r.length;d>=t&&(d>i&&(r=r.slice(0,i-s)),s<t&&(r=r.slice(t-s)),a?(e[e.length-1]+=r,a=!1):e.push(r)),s=d+1}return e}function qs(o,e,t){return vi(o,[""],e,t)}class zt{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 ae?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],l=this.offsets[i],a=l>>1,r=s instanceof ae?s.text.length:s.children.length;if(a==(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((l&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
- `,this;e--}else if(s instanceof ae){let d=s.text[a+(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=s.children[a+(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 ae?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 Us{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new zt(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:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.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 Ws{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=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=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(J.prototype[Symbol.iterator]=function(){return this.iter()},zt.prototype[Symbol.iterator]=Us.prototype[Symbol.iterator]=Ws.prototype[Symbol.iterator]=function(){return this});class Md{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function xt(o,e,t){return e=Math.max(0,Math.min(o.length,e)),[e,Math.max(e,Math.min(o.length,t))]}let vt="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(o=>o?parseInt(o,36):1);for(let o=1;o<vt.length;o++)vt[o]+=vt[o-1];function Ed(o){for(let e=1;e<vt.length;e+=2)if(vt[e]>o)return vt[e-1]<=o;return!1}function Hs(o){return o>=127462&&o<=127487}const Ks=8205;function Ke(o,e,t=!0,i=!0){return(t?Qs:Id)(o,e,i)}function Qs(o,e,t){if(e==o.length)return e;e&&Gs(o.charCodeAt(e))&&Ys(o.charCodeAt(e-1))&&e--;let i=un(o,e);for(e+=Xs(i);e<o.length;){let s=un(o,e);if(i==Ks||s==Ks||t&&Ed(s))e+=Xs(s),i=s;else if(Hs(s)){let l=0,a=e-2;for(;a>=0&&Hs(un(o,a));)l++,a-=2;if(l%2==0)break;e+=2}else break}return e}function Id(o,e,t){for(;e>0;){let i=Qs(o,e-2,t);if(i<e)return i;e--}return 0}function Gs(o){return o>=56320&&o<57344}function Ys(o){return o>=55296&&o<56320}function un(o,e){let t=o.charCodeAt(e);if(!Ys(t)||e+1==o.length)return t;let i=o.charCodeAt(e+1);return Gs(i)?(t-55296<<10)+(i-56320)+65536:t}function Xs(o){return o<65536?1:2}const pn=/\r\n?|\n/;var Be=function(o){return o[o.Simple=0]="Simple",o[o.TrackDel=1]="TrackDel",o[o.TrackBefore=2]="TrackBefore",o[o.TrackAfter=3]="TrackAfter",o}(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,s=0;t<this.sections.length;){let l=this.sections[t++],a=this.sections[t++];a<0?(e(i,s,l),s+=l):s+=a,i+=l}}iterChangedRanges(e,t=!1){mn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new Qe(e)}composeDesc(e){return this.empty?e:e.empty?this:Js(this,e)}mapDesc(e,t=!1){return e.empty?this:gn(this,e,t)}mapPos(e,t=-1,i=Be.Simple){let s=0,l=0;for(let a=0;a<this.sections.length;){let r=this.sections[a++],d=this.sections[a++],c=s+r;if(d<0){if(c>e)return l+(e-s);l+=r}else{if(i!=Be.Simple&&c>=e&&(i==Be.TrackDel&&s<e&&c>e||i==Be.TrackBefore&&s<e||i==Be.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!r)return e==s||t<0?l:l+d;l+=d}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return l}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let l=this.sections[i++],a=this.sections[i++],r=s+l;if(a>=0&&s<=t&&r>=e)return s<e&&r>t?"cover":!0;s=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}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 mn(this,(t,i,s,l,a)=>e=e.replace(s,s+(i-t),a),!1),e}mapDesc(e,t=!1){return gn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,l=0;s<t.length;s+=2){let a=t[s],r=t[s+1];if(r>=0){t[s]=r,t[s+1]=a;let d=s>>1;for(;i.length<d;)i.push(J.empty);i.push(a?e.slice(l,l+a):J.empty)}l+=a}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:Js(this,e,!0)}map(e,t=!1){return e.empty?this:gn(this,e,t,!0)}iterChanges(e,t=!1){mn(this,e,t)}get desc(){return Qe.create(this.sections)}filter(e){let t=[],i=[],s=[],l=new qt(this);e:for(let a=0,r=0;;){let d=a==e.length?1e9:e[a++];for(;r<d||r==d&&l.len==0;){if(l.done)break e;let h=Math.min(l.len,d-r);ke(s,h,-1);let f=l.ins==-1?-1:l.off==0?l.ins:0;ke(t,h,f),f>0&&nt(i,t,l.text),l.forward(h),r+=h}let c=e[a++];for(;r<c;){if(l.done)break e;let h=Math.min(l.len,c-r);ke(t,h,-1),ke(s,h,l.ins==-1?-1:l.off==0?l.ins:0),l.forward(h),r+=h}}return{changes:new ue(t,i),filtered:Qe.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],l=[],a=0,r=null;function d(h=!1){if(!h&&!s.length)return;a<t&&ke(s,t-a,-1);let f=new ue(s,l);r=r?r.compose(f.map(r)):f,s=[],l=[],a=0}function c(h){if(Array.isArray(h))for(let f of h)c(f);else if(h instanceof ue){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);d(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:u=f,insert:p}=h;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"?J.of(p.split(i||pn)):p:J.empty,k=b.length;if(f==u&&k==0)return;f<a&&d(),f>a&&ke(s,f-a,-1),ke(s,u-f,k),nt(l,s,b),a=u}}return c(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 s=0;s<e.length;s++){let l=e[s];if(typeof l=="number")t.push(l,-1);else{if(!Array.isArray(l)||typeof l[0]!="number"||l.some((a,r)=>r&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(l.length==1)t.push(l[0],0);else{for(;i.length<s;)i.push(J.empty);i[s]=J.of(l.slice(1)),t.push(l[0],i[s].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function ke(o,e,t,i=!1){if(e==0&&t<=0)return;let s=o.length-2;s>=0&&t<=0&&t==o[s+1]?o[s]+=e:e==0&&o[s]==0?o[s+1]+=t:i?(o[s]+=e,o[s+1]+=t):o.push(e,t)}function nt(o,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<o.length)o[o.length-1]=o[o.length-1].append(t);else{for(;o.length<i;)o.push(J.empty);o.push(t)}}function mn(o,e,t){let i=o.inserted;for(let s=0,l=0,a=0;a<o.sections.length;){let r=o.sections[a++],d=o.sections[a++];if(d<0)s+=r,l+=r;else{let c=s,h=l,f=J.empty;for(;c+=r,h+=d,d&&i&&(f=f.append(i[a-2>>1])),!(t||a==o.sections.length||o.sections[a+1]<0);)r=o.sections[a++],d=o.sections[a++];e(s,c,l,h,f),s=c,l=h}}}function gn(o,e,t,i=!1){let s=[],l=i?[]:null,a=new qt(o),r=new qt(e);for(let d=-1;;)if(a.ins==-1&&r.ins==-1){let c=Math.min(a.len,r.len);ke(s,c,-1),a.forward(c),r.forward(c)}else if(r.ins>=0&&(a.ins<0||d==a.i||a.off==0&&(r.len<a.len||r.len==a.len&&!t))){let c=r.len;for(ke(s,r.ins,-1);c;){let h=Math.min(a.len,c);a.ins>=0&&d<a.i&&a.len<=h&&(ke(s,0,a.ins),l&&nt(l,s,a.text),d=a.i),a.forward(h),c-=h}r.next()}else if(a.ins>=0){let c=0,h=a.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);c+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;ke(s,c,d<a.i?a.ins:0),l&&d<a.i&&nt(l,s,a.text),d=a.i,a.forward(a.len-h)}else{if(a.done&&r.done)return l?ue.createSet(s,l):Qe.create(s);throw new Error("Mismatched change set lengths")}}function Js(o,e,t=!1){let i=[],s=t?[]:null,l=new qt(o),a=new qt(e);for(let r=!1;;){if(l.done&&a.done)return s?ue.createSet(i,s):Qe.create(i);if(l.ins==0)ke(i,l.len,0,r),l.next();else if(a.len==0&&!a.done)ke(i,0,a.ins,r),s&&nt(s,i,a.text),a.next();else{if(l.done||a.done)throw new Error("Mismatched change set lengths");{let d=Math.min(l.len2,a.len),c=i.length;if(l.ins==-1){let h=a.ins==-1?-1:a.off?0:a.ins;ke(i,d,h,r),s&&h&&nt(s,i,a.text)}else a.ins==-1?(ke(i,l.off?0:l.len,d,r),s&&nt(s,i,l.textBit(d))):(ke(i,l.off?0:l.len,a.off?0:a.ins,r),s&&!a.off&&nt(s,i,a.text));r=(l.ins>d||a.ins>=0&&a.len>d)&&(r||i.length>c),l.forward2(d),a.forward(d)}}}}class qt{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?J.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?J.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,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new ut(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return U.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return U.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 U.range(e.anchor,e.head)}static create(e,t,i){return new ut(e,t,i)}}class U{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:U.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 U([this.main],0)}addRange(e,t=!0){return U.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,U.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 U(e.ranges.map(t=>ut.fromJSON(t)),e.main)}static single(e,t=e){return new U([U.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,s=0;s<e.length;s++){let l=e[s];if(l.empty?l.from<=i:l.from<i)return U.normalized(e.slice(),t);i=l.to}return new U(e,t)}static cursor(e,t=0,i,s){return ut.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(e,t,i,s){let l=(i??16777215)<<6|(s==null?7:Math.min(6,s));return t<e?ut.create(t,e,48|l):ut.create(e,t,(t>e?8:0)|l)}static normalized(e,t=0){let i=e[t];e.sort((s,l)=>s.from-l.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let l=e[s],a=e[s-1];if(l.empty?l.from<=a.to:l.from<a.to){let r=a.from,d=Math.max(l.to,a.to);s<=t&&t--,e.splice(--s,2,l.anchor>l.head?U.range(d,r):U.range(r,d))}}return new U(e,t)}}function Zs(o,e){for(let t of o.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let kn=0;class H{constructor(e,t,i,s,l){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=kn++,this.default=e([]),this.extensions=typeof l=="function"?l(this):l}get reader(){return this}static define(e={}){return new H(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:bn),!!e.static,e.enables)}of(e){return new Ci([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function bn(o,e){return o==e||o.length==e.length&&o.every((t,i)=>t===e[i])}class Ci{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=kn++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,l=this.id,a=e[l]>>1,r=this.type==2,d=!1,c=!1,h=[];for(let f of this.dependencies)f=="doc"?d=!0:f=="selection"?c=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||h.push(e[f.id]);return{create(f){return f.values[a]=i(f),1},update(f,u){if(d&&u.docChanged||c&&(u.docChanged||u.selection)||wn(f,h)){let p=i(f);if(r?!el(p,f.values[a],s):!s(p,f.values[a]))return f.values[a]=p,1}return 0},reconfigure:(f,u)=>{let p,b=u.config.address[l];if(b!=null){let k=Bi(u,b);if(this.dependencies.every(v=>v instanceof H?u.facet(v)===f.facet(v):v instanceof pt?u.field(v,!1)==f.field(v,!1):!0)||(r?el(p=i(f),k,s):s(p=i(f),k)))return f.values[a]=k,0}else p=i(f);return f.values[a]=p,1}}}}function el(o,e,t){if(o.length!=e.length)return!1;for(let i=0;i<o.length;i++)if(!t(o[i],e[i]))return!1;return!0}function wn(o,e){let t=!1;for(let i of e)Wt(o,i)&1&&(t=!0);return t}function Dd(o,e,t){let i=t.map(d=>o[d.id]),s=t.map(d=>d.type),l=i.filter(d=>!(d&1)),a=o[e.id]>>1;function r(d){let c=[];for(let h=0;h<i.length;h++){let f=Bi(d,i[h]);if(s[h]==2)for(let u of f)c.push(u);else c.push(f)}return e.combine(c)}return{create(d){for(let c of i)Wt(d,c);return d.values[a]=r(d),1},update(d,c){if(!wn(d,l))return 0;let h=r(d);return e.compare(h,d.values[a])?0:(d.values[a]=h,1)},reconfigure(d,c){let h=wn(d,i),f=c.config.facets[e.id],u=c.facet(e);if(f&&!h&&bn(t,f))return d.values[a]=u,0;let p=r(d);return e.compare(p,u)?(d.values[a]=u,0):(d.values[a]=p,1)}}}const tl=H.define({static:!0});class pt{constructor(e,t,i,s,l){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=l,this.provides=void 0}static define(e){let t=new pt(kn++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(tl).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,s)=>{let l=i.values[t],a=this.updateF(l,s);return this.compareF(l,a)?0:(i.values[t]=a,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,tl.of({field:this,create:e})]}get extension(){return this}}const mt={lowest:4,low:3,default:2,high:1,highest:0};function Ut(o){return e=>new il(e,o)}const Pd={highest:Ut(mt.highest),high:Ut(mt.high),default:Ut(mt.default),low:Ut(mt.low),lowest:Ut(mt.lowest)};class il{constructor(e,t){this.inner=e,this.prec=t}}class Si{of(e){return new yn(this,e)}reconfigure(e){return Si.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class yn{constructor(e,t){this.compartment=e,this.inner=t}}class Ni{constructor(e,t,i,s,l,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=l,this.facets=a,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 s=[],l=Object.create(null),a=new Map;for(let u of $d(e,t,a))u instanceof pt?s.push(u):(l[u.facet.id]||(l[u.facet.id]=[])).push(u);let r=Object.create(null),d=[],c=[];for(let u of s)r[u.id]=c.length<<1,c.push(p=>u.slot(p));let h=i?.config.facets;for(let u in l){let p=l[u],b=p[0].facet,k=h&&h[u]||[];if(p.every(v=>v.type==0))if(r[b.id]=d.length<<1|1,bn(k,p))d.push(i.facet(b));else{let v=b.combine(p.map(C=>C.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]=c.length<<1,c.push(C=>v.dynamicSlot(C)));r[b.id]=c.length<<1,c.push(v=>Dd(v,b,p))}}let f=c.map(u=>u(r));return new Ni(e,a,f,r,d,l)}}function $d(o,e,t){let i=[[],[],[],[],[]],s=new Map;function l(a,r){let d=s.get(a);if(d!=null){if(d<=r)return;let c=i[d].indexOf(a);c>-1&&i[d].splice(c,1),a instanceof yn&&t.delete(a.compartment)}if(s.set(a,r),Array.isArray(a))for(let c of a)l(c,r);else if(a instanceof yn){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(a.compartment)||a.inner;t.set(a.compartment,c),l(c,r)}else if(a instanceof il)l(a.inner,a.prec);else if(a instanceof pt)i[r].push(a),a.provides&&l(a.provides,r);else if(a instanceof Ci)i[r].push(a),a.facet.extensions&&l(a.facet.extensions,mt.default);else{let c=a.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);l(c,r)}}return l(o,mt.default),i.reduce((a,r)=>a.concat(r))}function Wt(o,e){if(e&1)return 2;let t=e>>1,i=o.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;o.status[t]=4;let s=o.computeSlot(o,o.config.dynamicSlots[t]);return o.status[t]=2|s}function Bi(o,e){return e&1?o.config.staticValues[e>>1]:o.values[e>>1]}const nl=H.define(),xn=H.define({combine:o=>o.some(e=>e),static:!0}),sl=H.define({combine:o=>o.length?o[0]:void 0,static:!0}),ll=H.define(),ol=H.define(),al=H.define(),rl=H.define({combine:o=>o.length?o[0]:!1});class Ct{constructor(e,t){this.type=e,this.value=t}static define(){return new Fd}}class Fd{of(e){return new Ct(this,e)}}class Rd{constructor(e){this.map=e}of(e){return new ce(this,e)}}class ce{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 ce(this.type,t)}is(e){return this.type==e}static define(e={}){return new Rd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let l=s.map(t);l&&i.push(l)}return i}}ce.reconfigure=ce.define(),ce.appendConfig=ce.define();class be{constructor(e,t,i,s,l,a){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=l,this.scrollIntoView=a,this._doc=null,this._state=null,i&&Zs(i,t.newLength),l.some(r=>r.type==be.time)||(this.annotations=l.concat(be.time.of(Date.now())))}static create(e,t,i,s,l,a){return new be(e,t,i,s,l,a)}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=Ct.define(),be.userEvent=Ct.define(),be.addToHistory=Ct.define(),be.remote=Ct.define();function Ld(o,e){let t=[];for(let i=0,s=0;;){let l,a;if(i<o.length&&(s==e.length||e[s]>=o[i]))l=o[i++],a=o[i++];else if(s<e.length)l=e[s++],a=e[s++];else return t;!t.length||t[t.length-1]<l?t.push(l,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function dl(o,e,t){var i;let s,l,a;return t?(s=e.changes,l=ue.empty(e.changes.length),a=o.changes.compose(e.changes)):(s=e.changes.map(o.changes),l=o.changes.mapDesc(e.changes,!0),a=o.changes.compose(s)),{changes:a,selection:e.selection?e.selection.map(l):(i=o.selection)===null||i===void 0?void 0:i.map(s),effects:ce.mapEffects(o.effects,s).concat(ce.mapEffects(e.effects,l)),annotations:o.annotations.length?o.annotations.concat(e.annotations):e.annotations,scrollIntoView:o.scrollIntoView||e.scrollIntoView}}function vn(o,e,t){let i=e.selection,s=St(e.annotations);return e.userEvent&&(s=s.concat(be.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,o.facet(sl)),selection:i&&(i instanceof U?i:U.single(i.anchor,i.head)),effects:St(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function cl(o,e,t){let i=vn(o,e.length?e[0]:{},o.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let l=1;l<e.length;l++){e[l].filter===!1&&(t=!1);let a=!!e[l].sequential;i=dl(i,vn(o,e[l],a?i.changes.newLength:o.doc.length),a)}let s=be.create(o,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return zd(t?jd(s):s)}function jd(o){let e=o.startState,t=!0;for(let s of e.facet(ll)){let l=s(o);if(l===!1){t=!1;break}Array.isArray(l)&&(t=t===!0?l:Ld(t,l))}if(t!==!0){let s,l;if(t===!1)l=o.changes.invertedDesc,s=ue.empty(e.doc.length);else{let a=o.changes.filter(t);s=a.changes,l=a.filtered.mapDesc(a.changes).invertedDesc}o=be.create(e,s,o.selection&&o.selection.map(l),ce.mapEffects(o.effects,l),o.annotations,o.scrollIntoView)}let i=e.facet(ol);for(let s=i.length-1;s>=0;s--){let l=i[s](o);l instanceof be?o=l:Array.isArray(l)&&l.length==1&&l[0]instanceof be?o=l[0]:o=cl(e,St(l),!1)}return o}function zd(o){let e=o.startState,t=e.facet(al),i=o;for(let s=t.length-1;s>=0;s--){let l=t[s](o);l&&Object.keys(l).length&&(i=dl(i,vn(e,l,o.changes.newLength),!0))}return i==o?o:be.create(e,o.changes,o.selection,i.effects,i.annotations,i.scrollIntoView)}const qd=[];function St(o){return o==null?qd:Array.isArray(o)?o:[o]}var Ge=function(o){return o[o.Word=0]="Word",o[o.Space=1]="Space",o[o.Other=2]="Other",o}(Ge||(Ge={}));const Ud=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Cn;try{Cn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Wd(o){if(Cn)return Cn.test(o);for(let e=0;e<o.length;e++){let t=o[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ud.test(t)))return!0}return!1}function Hd(o){return e=>{if(!/\S/.test(e))return Ge.Space;if(Wd(e))return Ge.Word;for(let t=0;t<o.length;t++)if(e.indexOf(o[t])>-1)return Ge.Word;return Ge.Other}}class ee{constructor(e,t,i,s,l,a){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=l,a&&(a._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Wt(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 Wt(this,i),Bi(this,i)}update(...e){return cl(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let r of e.effects)r.is(Si.reconfigure)?(t&&(s=new Map,t.compartments.forEach((d,c)=>s.set(c,d)),t=null),s.set(r.value.compartment,r.value.extension)):r.is(ce.reconfigure)?(t=null,i=r.value):r.is(ce.appendConfig)&&(t=null,i=St(i).concat(r.value));let l;t?l=e.startState.values.slice():(t=Ni.resolve(i,s,this),l=new ee(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,c)=>c.reconfigure(d,this),null).values);let a=e.startState.facet(xn)?e.newSelection:e.newSelection.asSingle();new ee(t,e.newDoc,a,l,(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:U.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),l=[i.range],a=St(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),c=this.changes(d.changes),h=c.map(s);for(let u=0;u<r;u++)l[u]=l[u].map(h);let f=s.mapDesc(c,!0);l.push(d.range.map(f)),s=s.compose(h),a=ce.mapEffects(a,h).concat(ce.mapEffects(St(d.effects),f))}return{changes:s,selection:U.create(l,t.mainIndex),effects:a}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(ee.lineSeparator))}toText(e){return J.of(e.split(this.facet(ee.lineSeparator)||pn))}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:(Wt(this,t),Bi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof pt&&this.config.address[s.id]!=null&&(t[i]=s.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 s=[];if(i){for(let l in i)if(Object.prototype.hasOwnProperty.call(e,l)){let a=i[l],r=e[l];s.push(a.init(d=>a.spec.fromJSON(r,d)))}}return ee.create({doc:e.doc,selection:U.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Ni.resolve(e.extensions||[],new Map),i=e.doc instanceof J?e.doc:J.of((e.doc||"").split(t.staticFacet(ee.lineSeparator)||pn)),s=e.selection?e.selection instanceof U?e.selection:U.single(e.selection.anchor,e.selection.head):U.single(0);return Zs(s,i.length),t.staticFacet(xn)||(s=s.asSingle()),new ee(t,i,s,t.dynamicSlots.map(()=>null),(l,a)=>a.create(l),null)}get tabSize(){return this.facet(ee.tabSize)}get lineBreak(){return this.facet(ee.lineSeparator)||`
5
- `}get readOnly(){return this.facet(rl)}phrase(e,...t){for(let i of this.facet(ee.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let l=+(s||1);return!l||l>t.length?i:t[l-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let l of this.facet(nl))for(let a of l(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Hd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),l=this.charCategorizer(e),a=e-i,r=e-i;for(;a>0;){let d=Ke(t,a,!1);if(l(t.slice(d,a))!=Ge.Word)break;a=d}for(;r<s;){let d=Ke(t,r);if(l(t.slice(r,d))!=Ge.Word)break;r=d}return a==r?null:U.range(a+i,r+i)}}ee.allowMultipleSelections=xn,ee.tabSize=H.define({combine:o=>o.length?o[0]:4}),ee.lineSeparator=sl,ee.readOnly=rl,ee.phrases=H.define({compare(o,e){let t=Object.keys(o),i=Object.keys(e);return t.length==i.length&&t.every(s=>o[s]==e[s])}}),ee.languageData=nl,ee.changeFilter=ll,ee.transactionFilter=ol,ee.transactionExtender=al,Si.reconfigure=ce.define();class Nt{eq(e){return this==e}range(e,t=e){return Ht.create(e,t,this)}}Nt.prototype.startSide=Nt.prototype.endSide=0,Nt.prototype.point=!1,Nt.prototype.mapMode=Be.TrackDel;class Ht{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Ht(e,t,i)}}function Sn(o,e){return o.from-e.from||o.value.startSide-e.value.startSide}class Nn{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let l=i?this.to:this.from;for(let a=s,r=l.length;;){if(a==r)return a;let d=a+r>>1,c=l[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==a)return c>=0?a:r;c>=0?r=d:a=d+1}}between(e,t,i,s){for(let l=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,l);l<a;l++)if(s(this.from[l]+e,this.to[l]+e,this.value[l])===!1)return!1}map(e,t){let i=[],s=[],l=[],a=-1,r=-1;for(let d=0;d<this.value.length;d++){let c=this.value[d],h=this.from[d]+e,f=this.to[d]+e,u,p;if(h==f){let b=t.mapPos(h,c.startSide,c.mapMode);if(b==null||(u=p=b,c.startSide!=c.endSide&&(p=t.mapPos(h,c.endSide),p<u)))continue}else if(u=t.mapPos(h,c.startSide),p=t.mapPos(f,c.endSide),u>p||u==p&&c.startSide>0&&c.endSide<=0)continue;(p-u||c.endSide-c.startSide)<0||(a<0&&(a=u),c.point&&(r=Math.max(r,p-u)),i.push(c),s.push(u-a),l.push(p-a))}return{mapped:i.length?new Nn(s,l,i,r):null,pos:a}}}class le{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new le(e,t,i,s)}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:s=0,filterTo:l=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Sn)),this.isEmpty)return t.length?le.of(t):this;let r=new fl(this,null,-1).goto(0),d=0,c=[],h=new Oi;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++];h.addInner(f.from,f.to,f.value)||c.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!a||s>this.chunkEnd(r.chunkIndex)||l<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!a||s>r.to||l<r.from||a(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||c.push(Ht.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?le.empty:this.nextLayer.update({add:c,filter:a,filterFrom:s,filterTo:l}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],s=-1;for(let a=0;a<this.chunk.length;a++){let r=this.chunkPos[a],d=this.chunk[a],c=e.touchesRange(r,r+d.length);if(c===!1)s=Math.max(s,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(c===!0){let{mapped:h,pos:f}=d.map(r,e);h&&(s=Math.max(s,h.maxPoint),t.push(h),i.push(f))}}let l=this.nextLayer.map(e);return t.length==0?l:new le(i,t,l||le.empty,s)}between(e,t,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let l=this.chunkPos[s],a=this.chunk[s];if(t>=l&&e<=l+a.length&&a.between(l,e-l,t-l,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Kt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Kt.from(e).goto(t)}static compare(e,t,i,s,l=-1){let a=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=l),r=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=l),d=hl(a,r,i),c=new Qt(a,d,l),h=new Qt(r,d,l);i.iterGaps((f,u,p)=>ul(c,f,h,u,p,s)),i.empty&&i.length==0&&ul(c,0,h,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let l=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),a=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(l.length!=a.length)return!1;if(!l.length)return!0;let r=hl(l,a),d=new Qt(l,r,0).goto(i),c=new Qt(a,r,0).goto(i);for(;;){if(d.to!=c.to||!On(d.active,c.active)||d.point&&(!c.point||!d.point.eq(c.point)))return!1;if(d.to>s)return!0;d.next(),c.next()}}static spans(e,t,i,s,l=-1){let a=new Qt(e,null,l).goto(t),r=t,d=a.openStart;for(;;){let c=Math.min(a.to,i);if(a.point){let h=a.activeForPoint(a.to),f=a.pointFrom<t?h.length+1:a.point.startSide<0?h.length:Math.min(h.length,d);s.point(r,c,a.point,h,f,a.pointRank),d=Math.min(a.openEnd(c),h.length)}else c>r&&(s.span(r,c,a.active,d),d=a.openEnd(c));if(a.to>i)return d+(a.point&&a.to>i?1:0);r=a.to,a.next()}}static of(e,t=!1){let i=new Oi;for(let s of e instanceof Ht?[e]:t?Kd(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return le.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=le.empty;s=s.nextLayer)t=new le(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}le.empty=new le([],[],null,-1);function Kd(o){if(o.length>1)for(let e=o[0],t=1;t<o.length;t++){let i=o[t];if(Sn(e,i)>0)return o.slice().sort(Sn);e=i}return o}le.empty.nextLayer=le.empty;class Oi{finishChunk(e){this.chunks.push(new Nn(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 Oi)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<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(le.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=le.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function hl(o,e,t){let i=new Map;for(let l of o)for(let a=0;a<l.chunk.length;a++)l.chunk[a].maxPoint<=0&&i.set(l.chunk[a],l.chunkPos[a]);let s=new Set;for(let l of e)for(let a=0;a<l.chunk.length;a++){let r=i.get(l.chunk[a]);r!=null&&(t?t.mapPos(r):r)==l.chunkPos[a]&&!t?.touchesRange(r,r+l.chunk[a].length)&&s.add(l.chunk[a])}return s}class fl{constructor(e,t,i,s=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=s}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 s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<s)&&this.setRangeIndex(s)}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 Kt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let s=[];for(let l=0;l<e.length;l++)for(let a=e[l];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&s.push(new fl(a,t,i,l));return s.length==1?s[0]:new Kt(s)}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--)Bn(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--)Bn(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(),Bn(this.heap,0)}}}function Bn(o,e){for(let t=o[e];;){let i=(e<<1)+1;if(i>=o.length)break;let s=o[i];if(i+1<o.length&&s.compare(o[i+1])>=0&&(s=o[i+1],i++),t.compare(s)<0)break;o[i]=t,o[e]=s,e=i}}class Qt{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=Kt.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){Vi(this.active,e),Vi(this.activeTo,e),Vi(this.activeRank,e),this.minActive=pl(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:l}=this.cursor;for(;t<this.activeRank.length&&(l-this.activeRank[t]||s-this.activeTo[t])>0;)t++;_i(this.active,t,i),_i(this.activeTo,t,s),_i(this.activeRank,t,l),e&&_i(e,t,this.cursor.from),this.minActive=pl(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&Vi(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let l=this.cursor.value;if(!l.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=l,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=l.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 s=i.length-1;s>=0&&i[s]<e;s--)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 ul(o,e,t,i,s,l){o.goto(e),t.goto(i);let a=i+s,r=i,d=i-e;for(;;){let c=o.to+d-t.to||o.endSide-t.endSide,h=c<0?o.to+d:t.to,f=Math.min(h,a);if(o.point||t.point?o.point&&t.point&&(o.point==t.point||o.point.eq(t.point))&&On(o.activeForPoint(o.to),t.activeForPoint(t.to))||l.comparePoint(r,f,o.point,t.point):f>r&&!On(o.active,t.active)&&l.compareRange(r,f,o.active,t.active),h>a)break;r=h,c<=0&&o.next(),c>=0&&t.next()}}function On(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++)if(o[t]!=e[t]&&!o[t].eq(e[t]))return!1;return!0}function Vi(o,e){for(let t=e,i=o.length-1;t<i;t++)o[t]=o[t+1];o.pop()}function _i(o,e,t){for(let i=o.length-1;i>=e;i--)o[i+1]=o[i];o[e]=t}function pl(o,e){let t=-1,i=1e9;for(let s=0;s<e.length;s++)(e[s]-i||o[s].endSide-o[t].endSide)<0&&(t=s,i=e[s]);return t}function Qd(o,e,t,i){for(let s=0,l=0;;){if(l>=e)return s;if(s==o.length)break;l+=o.charCodeAt(s)==9?t-l%t:1,s=Ke(o,s)}return i===!0?-1:o.length}const Vn="ͼ",ml=typeof Symbol>"u"?"__"+Vn:Symbol.for(Vn),_n=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),gl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class st{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function l(a,r,d,c){let h=[],f=/^@(\w+)\b/.exec(a[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return d.push(a[0]+";");for(let p in r){let b=r[p];if(/&/.test(p))l(p.split(/,\s*/).map(k=>a.map(v=>k.replace(/&/,v))).reduce((k,v)=>k.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.");l(s(p),b,h,u)}else b!=null&&h.push(p.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+b+";")}(h.length||u)&&d.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+h.join(" ")+"}")}for(let a in e)l(s(a),e[a],this.rules)}getRules(){return this.rules.join(`
1
+ (function(ie,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("unione-base-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","vue","unione-base-vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],n):(ie=typeof globalThis<"u"?globalThis:ie||self,n(ie.index={},ie.Vue,ie.UnioneBaseVue,ie.antDesignVue,ie.lodashEs,ie.vueCodemirror,ie.langJavascript,ie.iconsVue,ie.uuid))})(this,function(ie,n,W,G,ea,Ft,ta,We,ia){"use strict";const na={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(na);function Me(o){return o&&(Ji.value=W.utils.obj.ext(Ji.value,o)),Ji.value}const sa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},la={...{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"}},oa=n.ref([sa,la]);function aa(o,e){return W.locales.loadLanguage(o,()=>new Promise((t,i)=>{const s=oa.value.filter(l=>l.localeName==o);if(e)if(typeof e=="function")e().then(l=>{if(s.length==0){const a={...l,localeName:o};t(a)}else{const a={...s[0],...l};t(a)}});else if(s.length==0){const l={...e,localeName:o};t(l)}else{const l={...s[0],...e};t(l)}else s.length>0?t(s[0]):i("local language not defined ,lang:"+o)}))}const Zi={...W.locales};Zi.loadLanguage=aa;class ra{$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){return 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))),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 s=this.$store.value[e];return s||(s=new da(e,t,this.$model),this.$store.value[e]=s),i&&(this.$forms.value[e]=i),s}useForm(e,t,i){const s=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&s.detail(this.$pid.value).then(l=>{i&&i(l)}),s}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 da{$dsn;$type;$data;$dialog;$model;constructor(e,t,i){this.$dsn=e,this.$type=t,this.$data=n.ref(t=="form"?{}:[]),this.$dialog=W.useDialog(),this.$model=i}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}find(e){const t="/api/data/storage/v1/find";return e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),new Promise((i,s)=>{const l=G.message.loading("数据加载中...");W.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$data.value=a.body,i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),s({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),s({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:a})}).finally(()=>{l()})})}save(e){const t="/api/data/storage/v1/save";return e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),new Promise((i,s)=>{const l=G.message.loading("数据提交中...");W.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body||{}),i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),s({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),s({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:a})}).finally(()=>{l()})})}loadByIds(e){return new Promise((t,i)=>{const s=G.message.loading("数据加载中...");W.axios.form({url:"/api/data/storage/v1/loadByIds",method:"post",data:{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:a})}).finally(()=>{s()})})}detail(e){return new Promise((t,i)=>{const s=G.message.loading("数据加载中..."),l="/api/data/storage/v1/detail";W.axios.form({url:l,method:"post",data:{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body),t(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:l,id:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:l,id:e,err:a})}).finally(()=>{s()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const s=G.message.loading("数据处理中..."),l="/api/data/storage/v1/delete";W.axios.form({url:l,method:"post",data:{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:l,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:l,ids:e,err:a})}).finally(()=>{s()})}})})}}class ca{$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 Rt{define;ebus;model;$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.define=n.ref(e),this.ebus=new ca,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ra(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=W.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.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}W.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(s=>{s.success?(this.define.value=s.body,s.body.configs?this.define.value.configs=s.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()},s={...this.define.value};s.configs=JSON.stringify(i),W.axios.form({url:"/api/page/define/save",method:"post",data:s}).then(l=>{this.$axiosProccess.value.save=!1,l.success?(G.message.success(l.message),this.define.value=l.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(l.body)):(this.$dialog.error({content:l.message}),t())}).catch(l=>{console.error("页面配置保存失败",l),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:"+ea.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ha={class:"widget-setting-dialog"},fa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=e,i=n.ref(),s=n.ref(!1);function l(){i.value&&(s.value=!0),t("setting")}function a(){t("saving"),s.value=!1}return(r,d)=>{const c=n.resolveComponent("SettingOutlined"),h=n.resolveComponent("a-tooltip"),f=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",o.model])},[n.createVNode(h,{title:o.settingTitle},{default:n.withCtx(()=>[o.model=="edit"&&(r.$slots["widget-setting"]||o.custome)?(n.openBlock(),n.createBlock(c,{key:0,class:"widget-setting",onClick:l})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),o.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(f,{key:0,title:o.settingTitle,ref_key:"settingModal",ref:i,open:s.value,"onUpdate:open":d[0]||(d[0]=u=>s.value=u),centered:"",width:"80%",onOk:a},{default:n.withCtx(()=>[n.createElementVNode("div",ha,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),Z=(o,e)=>{const t=o.__vccOpts||o;for(const[i,s]of e)t[i]=s;return t},rt=Z(fa,[["__scopeId","data-v-3a88c0c0"]]),ua={key:0},pa=["onClick"],ai=Z(n.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(o,{expose:e}){const t=o,i=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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"}]),s=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:g=>{s.value.selectedRowKeys=g}}),l={mounted:g=>g.focus()},a=n.ref({});function r(){const g=Object.keys(a.value);if(g.length)for(let m in g){const S=k.value.form.action.params[m];S&&a.value[m]&&Object.keys(a.value[m]).forEach(_=>{S[_]=a.value[m][_]})}a.value={}}function d(g,m,S){r();const _={};_[S]=m[S]||"",S=="showIndex"&&(_[S]=m.show?.query?.index),a.value[g]=_}function c(g,m,S){if(!m||!S){a.value={};return}const _=a.value[g][S];m[S]=_,a.value={}}function h(){k.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:(g,m)=>u.value!=m&&t.preset.includes(m)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=n.ref([ta.javascript()]),k=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),v=n.ref();function C(g,m,S={}){g=JSON.parse(JSON.stringify(g)),g.event||(g.event={}),g.props||(g.props={}),g.action||(g.action={}),Object.keys(g.action).includes("maskClosable")||(g.action.maskClosable=!0),g.action.params||(g.action.params=[]),u.value=g.name,k.value.form=g,k.value.helps=S,k.value.visible=!0,v.value=m}const y=n.ref(null);function V(){y.value&&y.value.validate().then(()=>{k.value.visible=!1,v.value(k.value.form)})}return e({open:C,close}),(g,m)=>{const S=n.resolveComponent("a-input"),_=n.resolveComponent("a-form-item"),x=n.resolveComponent("a-select"),w=n.resolveComponent("a-input-number"),B=n.resolveComponent("a-checkbox"),A=n.resolveComponent("a-tab-pane"),O=n.resolveComponent("a-switch"),D=n.resolveComponent("a-button"),M=n.resolveComponent("a-divider"),E=n.resolveComponent("ToolOutlined"),z=n.resolveComponent("a-tooltip"),P=n.resolveComponent("a-table"),I=n.resolveComponent("a-tabs"),H=n.resolveComponent("a-form"),L=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock(L,{visible:k.value.visible,"onUpdate:visible":m[23]||(m[23]=N=>k.value.visible=N),title:k.value.title,centered:"",width:"50%",onOk:V},{default:n.withCtx(()=>[n.createVNode(H,{name:"basic",ref_key:"form",ref:y,rules:p.value,model:k.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(I,null,{default:n.withCtx(()=>[n.createVNode(A,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.title,"onUpdate:value":m[0]||(m[0]=N=>k.value.form.title=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.name,"onUpdate:value":m[1]||(m[1]=N=>k.value.form.name=N),disabled:t.preset.includes(k.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(_,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.icon,"onUpdate:value":m[2]||(m[2]=N=>k.value.form.icon=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(x,{value:k.value.form.type,"onUpdate:value":m[3]||(m[3]=N=>k.value.form.type=N),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(w,{value:k.value.form.index,"onUpdate:value":m[4]||(m[4]=N=>k.value.form.index=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(x,{value:k.value.form.size,"onUpdate:value":m[5]||(m[5]=N=>k.value.form.size=N),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(B,{checked:k.value.form.props.block,"onUpdate:checked":m[6]||(m[6]=N=>k.value.form.props.block=N)},{default:n.withCtx(()=>m[24]||(m[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:k.value.form.props.danger,"onUpdate:checked":m[7]||(m[7]=N=>k.value.form.props.danger=N)},{default:n.withCtx(()=>m[25]||(m[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:k.value.form.props.ghost,"onUpdate:checked":m[8]||(m[8]=N=>k.value.form.props.ghost=N)},{default:n.withCtx(()=>m[26]||(m[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(A,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(x,{value:k.value.form.action.type,"onUpdate:value":m[9]||(m[9]=N=>k.value.form.action.type=N),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.psn,"onUpdate:value":m[10]||(m[10]=N=>k.value.form.action.psn=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.component,"onUpdate:value":m[11]||(m[11]=N=>k.value.form.action.component=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(_,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.href,"onUpdate:value":m[12]||(m[12]=N=>k.value.form.action.href=N)},null,8,["value"])]),_:1}),["link","route"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(x,{value:k.value.form.action.target,"onUpdate:value":m[13]||(m[13]=N=>k.value.form.action.target=N),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(x,{value:k.value.form.action.position,"onUpdate:value":m[14]||(m[14]=N=>k.value.form.action.position=N),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.title,"onUpdate:value":m[15]||(m[15]=N=>k.value.form.action.title=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(O,{checked:k.value.form.action.maskClosable,"onUpdate:checked":m[16]||(m[16]=N=>k.value.form.action.maskClosable=N),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(w,{value:k.value.form.action.width,"onUpdate:value":m[17]||(m[17]=N=>k.value.form.action.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(w,{value:k.value.form.action.height,"onUpdate:value":m[18]||(m[18]=N=>k.value.form.action.height=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(M,{orientation:"left"},{default:n.withCtx(()=>[m[29]||(m[29]=n.createTextVNode("参数列表 ")),n.createVNode(D,{size:"small",class:"param-btn",onClick:h},{default:n.withCtx(()=>m[27]||(m[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(D,{size:"small",class:"param-btn",danger:"",onClick:f},{default:n.withCtx(()=>m[28]||(m[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode(P,{columns:i.value,"data-source":k.value.form.action.params,bordered:"",pagination:!1,"row-selection":s.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:N})=>[["name","title"].includes(N.key)?(n.openBlock(),n.createElementBlock("span",ua,[n.createVNode(E),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),["value"].includes(N.key)?(n.openBlock(),n.createBlock(z,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(E),n.createTextVNode(" "+n.toDisplayString(N.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:N,text:Q,record:T,index:j})=>[["name","title","value"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!a.value[j]||!Object.keys(a.value[j]).includes(N.dataIndex))&&!Q&&"empty"]),onClick:he=>d(j,T,N.dataIndex)},[a.value[j]&&Object.keys(a.value[j]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(S,{key:0,value:a.value[j][N.dataIndex],"onUpdate:value":he=>a.value[j][N.dataIndex]=he,onBlur:he=>c(j,T,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(Q),1)],64))],10,pa)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(A,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"点击事件",help:k.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.clickScript,"onUpdate:modelValue":m[19]||(m[19]=N=>k.value.form.event.clickScript=N),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:k.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.disableScript,"onUpdate:modelValue":m[20]||(m[20]=N=>k.value.form.event.disableScript=N),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:k.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.visibleScript,"onUpdate:modelValue":m[21]||(m[21]=N=>k.value.form.event.visibleScript=N),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:k.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:k.value.form.event.titleScript,"onUpdate:modelValue":m[22]||(m[22]=N=>k.value.form.event.titleScript=N),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"]]),ma=["src"],ga=["src"],ka=Z(n.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(o,{emit:e}){const t=Me(),i=o,s=W.useSession();n.watch(()=>i.widget?.event,()=>{a()}),n.onMounted(()=>{a()});const l=n.ref({});function a(){i.widget?.event&&(i.widget.event.clickScript?l.value.click=new Function("ctx","btn","event",i.widget.event.clickScript):i.widget.event.click&&(l.value.click=i.widget.event.click),i.widget.event.disableScript?l.value.disable=new Function("ctx","btn",i.widget.event.disableScript):i.widget.event.disable&&(l.value.disable=i.widget.event.disable),i.widget.event.visibleScript?l.value.visible=new Function("ctx","btn",i.widget.event.visibleScript):i.widget.event.visible&&(l.value.visible=i.widget.event.visible),i.widget.event.titleScript?l.value.title=new Function("ctx","btn",i.widget.event.titleScript):i.widget.event.title&&(l.value.title=i.widget.event.title))}const r=n.computed(()=>l.value.title?l.value.title(u.value,i.widget):i.widget.title),d=n.computed(()=>l.value.visible?l.value.visible(u.value,i.widget)!=!1:!0),c=n.computed(()=>l.value.disable?l.value.disable(u.value,i.widget):!1),h=n.ref(null);function f(){h.value?.open(i.widget,V=>{console.log("btn props",V),Object.keys(V).forEach(g=>{i.widget[g]=V[g]}),console.log("props btn",i.widget)})}const u=n.computed(()=>({...i.ctx,user:s.getPrincipal(),token:s.getToken()})),p=n.ref({open:!1}),b=n.computed(()=>{if(i.widget.action?.href){let V=i.widget.action.href;const g=V.matchAll("{[a-zA-Z.]*}"),m=[];let S=null;for(;S=g.next();){if(S&&S.value&&S.value[0]){let _=S.value[0].substring(1,S.value[0].length-1);m.includes(_)||m.push(_)}if(S.done)break}if(m.length>0)for(let _=0;_<m.length;_++){let x=m[_],w=W.utils.obj.getValue(u.value,x);w?w instanceof Object?V=V.replaceAll("{"+x+"}",JSON.stringify(w)):Array.isArray(w)?V=V.replaceAll("{"+x+"}",w.join(",")):V=V.replaceAll("{"+x+"}",w):V=V.replaceAll("{"+x+"}","")}return V}return""}),k=n.computed(()=>{const V={};if(i.widget.action?.href){let g=i.widget.action.href;const m=g.matchAll("{[a-zA-Z0-9.]*}"),S=[];let _=null;for(;_=m.next();){if(_&&_.value&&_.value[0]){let w=_.value[0].substring(1,_.value[0].length-1);S.includes(w)||S.push(w)}if(_.done)break}if(S.length>0)for(let w=0;w<S.length;w++){let B=S[w],A=W.utils.obj.getValue(u.value,B);A?A instanceof Object?g=g.replaceAll("{"+B+"}",JSON.stringify(A)):Array.isArray(A)?g=g.replaceAll("{"+B+"}",A.join(",")):g=g.replaceAll("{"+B+"}",A):g=g.replaceAll("{"+B+"}","")}const x=g.split("?")[1];x&&x.split("&").forEach(w=>{const B=w.split("=");B[0]&&B[1]&&(V[B[0]]=B[1])})}return i.widget.action?.params&&i.widget.action.params.filter(g=>g.value+"").forEach(g=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(g.value)){let S=W.utils.obj.getValue(u.value,g.value);V[g.name]=S}else V[g.name]=g.value}),V}),v=e,C=n.inject("router");function y(V){t.isDebug&&console.log("unione btn click",i.widget,V),!(l.value.click&&l.value.click(u.value,i.widget,V)==!1)&&(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog"?p.value.open=!0:i.widget.action?.type=="route"&&i.widget.action?.href&&C.push({path:i.widget.action.href,query:k.value}),v("click",{btn:i.widget,event:V}))}return(V,g)=>{const m=n.resolveComponent("a-button"),S=n.resolveComponent("a-drawer"),_=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(rt,{key:0,class:n.normalizeClass(["unione-btn",o.widget.props?.block&&"unione-btn-block"]),model:o.editor?.model.value,onSetting:f,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[n.createVNode(m,n.mergeProps({disabled:c.value,size:o.widget.size||"small",type:o.type||o.widget.type,shape:o.widget.shape,class:"unione-btn-"+o.widget.name,loading:o.widget.loading,target:o.widget.action?.target,onClick:y},o.widget.props),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value)+" ",1)]),_:2},[o.widget.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target"]),o.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(S,{key:0,open:p.value.open,"onUpdate:open":g[0]||(g[0]=x=>p.value.open=x),title:o.widget.action?.title,placement:o.widget.action?.position,maskClosable:o.widget.action?.maskClosable,width:o.widget.action?.width,bodyStyle:{padding:0,overflow:!o.widget.action.component||o.widget.action.component=="iframe"?"hidden":"auto"}},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value},null,8,ma)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),o.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(_,{key:1,open:p.value.open,"onUpdate:open":g[1]||(g[1]=x=>p.value.open=x),title:o.widget.action?.title,width:o.widget.action?.width,maskClosable:o.widget.action?.maskClosable,centered:"",footer:null},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value,style:n.normalizeStyle({height:o.widget.action?.height?o.widget.action?.height+"px":""})},null,12,ga)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(ai,{ref_key:"btnSetting",ref:h,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-6513b442"]]),ba={key:0,class:"unione-widget-empty-tip"},wa=Z(n.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(o){const e=o,t=n.ref(),i=n.computed(()=>e.editor?.widget(e.wid)||e.widget);return(s,l)=>{const a=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":l[0]||(l[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,c)=>(n.openBlock(),n.createBlock(a,{key:c,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,(h,f)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",ba,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),ya={class:"title"},xa={class:"text"},va={key:0,class:"reactive"},Ca={key:1,class:"opts"},Sa={class:"warp"},Na=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(o){const e=o,t=n.computed(()=>e.editor?.widget(e.wid)||e.widget),i=n.computed(()=>t.value?.title||e.title),s=n.computed(()=>t.value?.icon||e.icon),l=n.computed(()=>t.value?.type||e.type),a=n.useModel(o,"modelValue");function r(){e.reactive&&(a.value=!a.value)}return(d,c)=>(n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-section",a.value?"open":"close"]),model:e.editor?.model},{default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["head",o.location,o.reactive&&"reactive"]),onClick:r},[n.createElementVNode("div",ya,[l.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",l.value])},null,2)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",xa,n.toDisplayString(i.value),1)]),o.reactive?(n.openBlock(),n.createElementBlock("div",va,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),o.location=="left"?(n.openBlock(),n.createElementBlock("div",Ca,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Sa,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,a.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Ba={class:"unione-props-setting unione-form-setting"},Oa={class:"unione-form-btns"},Va={key:0},_a=["onClick"],Aa={class:"field-txt"},Ta=["onClick"],Ma={key:1,class:"field-txt"},Ea=["onClick"],Ia={key:0,class:"field-txt"},Da={key:3,class:"edit-field"},Pa={key:0},$a=["onClick"],Fa=Z(n.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=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:"convertName",key:"convertName",width:"50px",align:"center"}]),i=n.computed(()=>{const x=e.editor.widget(e.wid)||{};return x.configs||(x.configs={}),x.configs.settings||(x.configs.settings={}),x.configs.settings.btns||(x.configs.settings.btns=[]),x}),s=n.computed(()=>(e.editor.dataModels()||[]).map(w=>({value:w.sn,label:w.title+"("+w.name+")"}))),l=n.computed(()=>{const x=i.value.configs.settings.btns,w=x.map(B=>B.name);if(!w.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};x.splice(B.index,0,B)}if(!w.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let A=B.index||1;x.splice(A,0,B)}if(!w.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};x.splice(B.index,0,B)}if(!w.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};x.splice(B.index,0,B)}return x}),a=n.ref(null);function r(x){a.value&&a.value.open(x,w=>{w.visible=!0,Object.keys(w).forEach(B=>{x[B]=w[B]}),i.value.configs.settings.btns.sort((B,A)=>{const O=B.index||1,D=A.index||1;return O-D}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const x=i.value.configs.settings.btns.length+1;let w={title:"新增",name:"new_"+x,index:x,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};w.name="new_"+i.value.configs.settings.btns.length;const B=i.value.configs.settings.btns.filter(A=>A.name==w.name).length;B>0&&(w.name=w.name+B),i.value.configs.settings.btns.push(w),e.editor.widget(e.wid,i.value),a.value.open(w,A=>{Object.keys(A).forEach(O=>{w[O]=A[O]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(x){const w=()=>{if(["save","submit","reset","back"].includes(x.name))x.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const B=[];i.value.configs.settings.btns.forEach(A=>{A.name!=x.name&&B.push(A)}),i.value.configs.settings.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{w()}})}const h=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=h.value.widgets.filter(B=>B.value==x);return w[0]?w[0].label:x},toSetting:()=>{}}),f=n.ref({visible:!1,field:{},props:{},showInfo:x=>{let w="";return x.rules&&(w=x.rules.filter(B=>B.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const x=f.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 B={name:"reg",trigger:x.trigger,whitespace:x.whitespace,message:x.regMessage};x.regExpress&&(B.pattern=x.regExpress,B.enable=!0),f.value.field.rules=[w,B],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(x){f.value.visible=!0,f.value.field=x;const w=x.rules||[],B={trigger:"change",whitespace:!0};w.forEach(A=>{A.name=="reg"&&(B.trigger=A.trigger,B.whitespace=A.whitespace,B.regExpress=A.pattern,B.regMessage=A.message),A.name=="range"&&(B.rangeMin=A.min,B.rangeMax=A.max,B.rangeMessage=A.message)}),f.value.props=B}const p=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{p.value.visible=!1}});function b(x,w){const B=y.value.filter(O=>O.name==x.name);B.forEach(O=>{w!="isSort"?O[w]=!0:O[w]=!O[w]});const A=B[0];if(!(!A||w=="isSort")){switch(p.value.prop=w,p.value.field=x,A.show||(A.show={}),w){case"isQuery":A.show.query||(A.show.query={}),p.value.show=A.show.query,p.value.title=`查询设置/${x.title}(${x.name})`;break;case"isForm":A.show.form||(A.show.form={}),p.value.show=A.show.form,p.value.title=`表单设置/${x.title}(${x.name})`;break;case"isView":A.show.view||(A.show.view={}),p.value.show=A.show.view,p.value.title=`详情设置/${x.title}(${x.name})`;break;case"isList":A.show.list||(A.show.list={}),p.value.show=A.show.list,p.value.title=`列头设置/${x.title}(${x.name})`;break}p.value.visible=!0}}const k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(x,w)=>{k.value.convert.options.splice(x,1)},toSetting:()=>{k.value.visible=!1}});function v(x){k.value.visible=!0,k.value.field=x,k.value.convert=x.convert||{}}const C=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),y=n.computed(()=>C.value.fields?.length?C.value.fields:[]),V={mounted:x=>x.focus()},g=n.ref({});function m(x,w){const B={};w=="convertName"?B[w]=x.convert?.type:B[w]=x[w]||"",g.value={},g.value[x.name]=B}function S(x,w){{g.value={};return}}function _(x,w){y.value.filter(A=>A.name==x.name).forEach(A=>{A[w]=!A[w]})}return(x,w)=>{const B=n.resolveComponent("a-divider"),A=n.resolveComponent("CloseOutlined"),O=n.resolveComponent("a-button"),D=n.resolveComponent("PlusOutlined"),M=n.resolveComponent("a-select"),E=n.resolveComponent("ToolOutlined"),z=n.resolveComponent("a-checkbox"),P=n.resolveComponent("a-table"),I=n.resolveComponent("a-select-option"),H=n.resolveComponent("a-form-item"),L=n.resolveComponent("a-form"),N=n.resolveComponent("a-modal"),Q=n.resolveComponent("a-checkbox-group"),T=n.resolveComponent("a-input-number"),j=n.resolveComponent("a-input"),he=n.resolveComponent("a-col"),Xi=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Ba,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[23]||(w[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",Oa,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,F=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:F.name,class:["btn",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size,ref_for:!0},F.props||{},{onClick:Ue=>r(F)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(F.title)+" ",1),F.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"btn-del",onClick:n.withModifiers(Ue=>c(F),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(O,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:w[0]||(w[0]=F=>d())},{default:n.withCtx(()=>[n.createVNode(D)]),_:1})]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[24]||(w[24]=[n.createTextVNode("表单设置")])),_:1}),w[36]||(w[36]=n.createTextVNode(" 数据模型:")),n.createVNode(M,{class:"data-model-list",options:s.value,value:i.value.dataModel,"onUpdate:value":w[1]||(w[1]=F=>i.value.dataModel=F)},null,8,["options","value"]),n.createVNode(P,{columns:t.value,"data-source":y.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:F})=>[["widget","rules","convertName"].includes(F.key)?(n.openBlock(),n.createElementBlock("span",Va,[n.createVNode(E),n.createTextVNode(" "+n.toDisplayString(F.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:F,text:Ue,record:te})=>[["rules"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!f.value.showInfo(te)&&"empty"]),onClick:xe=>u(te)},[n.createElementVNode("span",Aa,n.toDisplayString(f.value.showInfo(te)),1),f.value.showInfo(te)?(n.openBlock(),n.createBlock(O,{key:0,type:"link"},{default:n.withCtx(()=>w[25]||(w[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,_a)):["widget"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!g.value[te.name]||!Object.keys(g.value[te.name]).includes(F.dataIndex))&&!Ue&&"empty"]),onClick:xe=>m(te,F.dataIndex)},[g.value[te.name]&&Object.keys(g.value[te.name]).includes(F.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(M,{key:0,value:te[F.dataIndex],"onUpdate:value":xe=>te[F.dataIndex]=xe,options:h.value.widgets,onBlur:w[2]||(w[2]=xe=>S())},null,8,["value","onUpdate:value","options"])),[[V]]):(n.openBlock(),n.createElementBlock("span",Ma,n.toDisplayString(h.value.widgetName(Ue)),1))],10,Ta)):["convertName"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!g.value[te.name]||!Object.keys(g.value[te.name]).includes(F.dataIndex))&&!te.convert?.type&&"empty"]),onClick:xe=>m(te,F.dataIndex)},[g.value[te.name]&&Object.keys(g.value[te.name]).includes(F.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(M,{key:0,value:te[F.dataIndex],"onUpdate:value":xe=>te[F.dataIndex]=xe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:w[3]||(w[3]=xe=>S())},null,8,["value","onUpdate:value"])),[[V]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[te.convert?.type?(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(te.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),te.convert?.type?(n.openBlock(),n.createBlock(O,{key:1,type:"link",onClick:n.withModifiers(xe=>v(te),["stop"])},{default:n.withCtx(()=>w[26]||(w[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Ea)):["isForm","isView"].includes(F.dataIndex)?(n.openBlock(),n.createElementBlock("div",Da,[n.createVNode(z,{checked:te[F.dataIndex],onClick:xe=>_(te,F.dataIndex)},null,8,["checked","onClick"]),n.createVNode(O,{type:"link",onClick:xe=>b(te,F.dataIndex)},{default:n.withCtx(()=>w[27]||(w[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(N,{visible:h.value.visible,"onUpdate:visible":w[5]||(w[5]=F=>h.value.visible=F),title:"控件设置",onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{model:h.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[h.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(H,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(M,{value:h.value.props.mode,"onUpdate:value":w[4]||(w[4]=F=>h.value.props.mode=F),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(I,{value:"multiple"},{default:n.withCtx(()=>w[28]||(w[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(I,{value:"tags"},{default:n.withCtx(()=>w[29]||(w[29]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(N,{visible:f.value.visible,"onUpdate:visible":w[13]||(w[13]=F=>f.value.visible=F),title:"规则设置",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{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(()=>w[30]||(w[30]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(H,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(Q,{value:f.value.props.trigger,"onUpdate:value":w[6]||(w[6]=F=>f.value.props.trigger=F),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(H,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(z,{value:f.value.props.whitespace,"onUpdate:value":w[7]||(w[7]=F=>f.value.props.whitespace=F),checked:f.value.props.whitespace},{default:n.withCtx(()=>w[31]||(w[31]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[32]||(w[32]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(H,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(T,{value:f.value.props.rangeMin,"onUpdate:value":w[8]||(w[8]=F=>f.value.props.rangeMin=F)},null,8,["value"]),w[33]||(w[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(T,{value:f.value.props.rangeMax,"onUpdate:value":w[9]||(w[9]=F=>f.value.props.rangeMax=F)},null,8,["value"])]),_:1}),n.createVNode(H,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(j,{value:f.value.props.rangeMessage,"onUpdate:value":w[10]||(w[10]=F=>f.value.props.rangeMessage=F)},null,8,["value"])]),_:1}),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[34]||(w[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(H,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(j,{value:f.value.props.regExpress,"onUpdate:value":w[11]||(w[11]=F=>f.value.props.regExpress=F)},null,8,["value"])]),_:1}),n.createVNode(H,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(j,{value:f.value.props.regMessage,"onUpdate:value":w[12]||(w[12]=F=>f.value.props.regMessage=F)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(N,{visible:p.value.visible,"onUpdate:visible":w[20]||(w[20]=F=>p.value.visible=F),title:p.value.title,onOk:p.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{model:p.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(H,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(T,{value:p.value.show.index,"onUpdate:value":w[14]||(w[14]=F=>p.value.show.index=F)},null,8,["value"])]),_:1}),["isQuery"].includes(p.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(H,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(j,{value:p.value.show.width,"onUpdate:value":w[15]||(w[15]=F=>p.value.show.width=F)},null,8,["value"])]),_:1})),["isForm","isView"].includes(p.value.prop)?(n.openBlock(),n.createBlock(H,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(j,{value:p.value.show.labelWidth,"onUpdate:value":w[16]||(w[16]=F=>p.value.show.labelWidth=F)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(p.value.prop)?(n.openBlock(),n.createBlock(H,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(j,{value:p.value.show.valueWidth,"onUpdate:value":w[17]||(w[17]=F=>p.value.show.valueWidth=F)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(p.value.prop)?(n.openBlock(),n.createBlock(H,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(M,{value:p.value.show.fixed,"onUpdate:value":w[18]||(w[18]=F=>p.value.show.fixed=F),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(H,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(M,{value:p.value.show.align,"onUpdate:value":w[19]||(w[19]=F=>p.value.show.align=F),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(N,{visible:k.value.visible,"onUpdate:visible":w[22]||(w[22]=F=>k.value.visible=F),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",Pa,[n.createVNode(O,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>w[35]||(w[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(P,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:F,record:Ue,index:te})=>[F.dataIndex==="label"?(n.openBlock(),n.createBlock(j,{key:0,value:Ue.label,"onUpdate:value":xe=>Ue.label=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),F.dataIndex==="value"?(n.openBlock(),n.createBlock(j,{key:1,value:Ue.value,"onUpdate:value":xe=>Ue.value=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),F.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:xe=>k.value.toDelOption(te,Ue)},"删除",8,$a)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock(L,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Xi,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(he,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(H,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(j,{value:k.value.convert.dict,"onUpdate:value":w[21]||(w[21]=F=>k.value.convert.dict=F)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(ai,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),Ra=Z(n.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(o,{expose:e}){const t=o,i=n.ref(),s=n.ref({}),l=n.ref(null);n.onMounted(()=>{if(t.editor&&a.value.dsn){const p=t.editor.dataManager();a.value.primary&&p.psn(a.value.dsn),i.value=p.useForm(a.value.dsn,l.value,b=>{s.value=b.body||{}})}});const a=n.computed(()=>t.widget||t.form||{}),r=n.computed(()=>{let p=a.value.widgets||[];return!p.length&&t.form?.fields&&(p=t.form.fields,p.forEach(b=>{b.widget||(b.widget="unione-form-item"),b.control||(b.control="a-input")})),p}),d=n.computed(()=>a.value.setting||{});n.provide("formSetting",d.value);function c(){return s.value}function h(p){s.value={...s.value,...p}}function f(){s.value={};const p=b=>{b.widget=="unione-form-item"&&b.name&&b.value!=null&&b.value!=null&&b.value!=""&&(s.value[b.name]=b.value),b.widgets?.forEach(k=>{p(k)})};r.value.forEach(b=>{p(b)})}function u(){return l.value.validate()}return e({validate:u,getValue:c,setValue:h,reset:f}),(p,b)=>{const k=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-form-widget","setting-title":"表单设置",model:o.editor?.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(k,{ref_key:"formObj",ref:l,model:s.value,class:n.normalizeClass(["unione-form",o.editor?.model.value,"form-layout-col-"+(d.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,(v,C)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(v.widget),{key:C,widget:v,editor:o.editor,value:s.value[v.name],"onUpdate:value":y=>s.value[v.name]=y,formValue:s.value},null,40,["widget","editor","value","onUpdate:value","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[o.editor&&a.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(Fa,{wid:a.value.wid,editor:o.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-ab7f53e8"]]);function ks(o,e=!1){const t=Me();if(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+o+",force:"+e),!o)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+o);return i&&e==!1?Promise.resolve(JSON.parse(i)):new Promise((s,l)=>{W.axios.admin({url:"/api/system/dict/load/"+o}).then(a=>{if(a.success){const r=a.body.filter(d=>d.dictName!=d.dictKey);r.forEach(d=>{d.value=d.dictKey,d.label=d.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+o,JSON.stringify(r)),s(r)):l("字典加载失败,dict:"+o+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+o,a),l("字典加载失败,dict:"+o+",error:"+a.message)})})}async function bs(o,e){const t=Me();if(t.isDebug&&console.log("进入:根据获取字典选项方法,dict name:"+o+",key:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await ks(o),s=i.filter(l=>l.dictKey==e);return s.length>0?Promise.resolve(s[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+o+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+o+",key:"+e))}async function La(o,e){const t=await bs(o,e);return Promise.resolve(t.dictValue)}const ws={load:ks,getLabel:La,getOption:bs};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=Me()}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,s)=>{if(!this.convertObj.dictName){s("字典名称不能为空,id:"+this.convertObj.id);return}ws.load(this.convertObj.dictName,t).then(l=>{this.options=l,typeof e=="number"&&this.options.forEach(a=>{a.value=parseInt(a.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,s)=>{const l=this.convertObj.params||{body:{}};this.convertObj.pidField&&(l.pid=-1);const a=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;W.axios.admin({url:a,data:l,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),s("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(c=>c.value==e).length?i(this.options):(l.body||(l.body={}),l.body[this.convertObj.valueField]=e,W.axios.admin({url:a,data:l,method:"POST"}).then(c=>{if(c.success){const h={};this.options.forEach(f=>{h[e]=!0}),c.body.forEach(f=>{h[f.value]||this.options.push(f)}),i(this.options)}else s("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),s("数据选项加载失败,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?ws.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(s=>{const l=s.filter(a=>a.value==e);if(l.length)return t(l[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,s)=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;W.axios.admin({url:l,data:e,method:"POST"}).then(a=>{a.success?(this.$processOptions(a.body),this.options=[...this.options,...a.body],i(a.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,a),s("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+a.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;W.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),t(s.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 ja={key:1,class:"text-view"},za=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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.inject("formSetting");n.onMounted(()=>{l.value.value!=null&&typeof l.value.value<"u"&&(e.formValue[l.value.name]==null||e.formValue[l.value.name]==null||typeof e.formValue[l.value.name]>"u")&&(t.value=l.value.value,l.value.widget=="unione-check-box"&&(Array.isArray(l.value.value)||(typeof l.value.value=="string"?t.value=l.value.value.split(","):t.value=[l.value.value])))});const s=n.ref({}),l=n.computed(()=>{const b=e.editor?.widget(e.wid)||e.widget||{};return b.event&&Object.keys(b.event).forEach(k=>{const v=b.event[k];s.value[k]=null,v.enable&&v.scriptText&&(s.value[k]=new Function("value","ctx",v.scriptText))}),b}),a=n.computed(()=>!(s.value.visible&&s.value.visible(e.formValue[l.value.name],e.formValue)==!1)),r=n.computed(()=>s.value.title&&s.value.title(e.formValue[l.value.name],e.formValue)||l.value.title),d=n.ref({}),c=n.computed(()=>{const b=[],k=l.value.rule||{};if(l.value.props?.required&&b.push({required:!0,whitespace:k?.whitespace||!1,trigger:k?.trigger||i.ruleTrigger||"change",validator:(v,C)=>(k?.whitespace&&C&&typeof C=="string"&&(C=C.trim()),C&&(C+"").length>0?Promise.resolve():Promise.reject(l.value.title+"不能为空!"))}),k.advance&&d.value[k.advance]){const v=d.value[k.advance];b.push({pattern:v.pattern,message:v.message||"表单验证不通过!",trigger:k.trigger||i.ruleTrigger||"change"})}return k.regExpress&&b.push({pattern:k.regExpress,message:k.regMessage||"表单验证不通过!",trigger:k.trigger||i.ruleTrigger||"change"}),l.value.dataLen&&b.push({validator:(v,C)=>C&&(C+"").length>l.value.dataLen?Promise.reject("最大长度["+l.value.dataLen+"],当前:["+(C+"").length+"]"):Promise.resolve(),trigger:k?.trigger||i.ruleTrigger||"change"}),b}),h=n.computed(()=>{const b=l.value.props||{};if(l.value.control=="a-input-number"){const k=l.value.rule||{};k.rangeMin!=null&&k.rangeMin!=null&&(b.min=k.rangeMin),k.rangeMax!=null&&k.rangeMax!=null&&(b.max=k.rangeMax)}return l.value.control=="a-date-picker"&&l.value.view?.dataFormat&&(b.format=l.value.view.dataFormat,b.valueFormat=l.value.view.dataFormat),b}),f=n.computed(()=>{const b=l.value.css||{},k=[];return b.cssName&&k.push(b.cssName),i.platform=="app"?b.cssName?typeof b.cssName=="string"&&b.cssName.indexOf("all-line")<0&&k.push("all-line"):k.push("all-line"):l.value.view?.width&&(l.value.view.width>=3?(!b.cssName||typeof b.cssName=="string"&&b.cssName.indexOf("all-line")<0)&&k.push("all-line"):l.value.view.width==2&&k.push("2in-line")),k}),u=n.computed(()=>{const b=i.showColumn||3;let k=l.value.view?.labelWidth||i.labelWidth||9;return l.value.css?.cssName&&b>1&&typeof l.value.css.cssName=="string"&&l.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(k/b)}:l.value.view?.width>=3&&b>1?{span:Math.round(k/b)}:{span:k}}),p=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&l.value.convert&&new dt(l.value.convert).convert(t.value.toString()).then(b=>{p.value=b})}),(b,k)=>{const v=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-form-item",f.value]),style:n.normalizeStyle(l.value.css?.cssText)},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createBlock(v,{key:0,label:r.value,name:l.value.name,labelCol:u.value,required:l.value.props?.required,rules:c.value,help:(!e.editor||e.editor.model.value!="view")&&l.value.props?.help,tooltip:l.value.props?.tooltip},{default:n.withCtx(()=>[!o.editor||o.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value.control||"a-input"),n.mergeProps({key:0,wid:l.value.wid,widget:l.value,editor:e.editor,value:t.value,"onUpdate:value":k[0]||(k[0]=C=>t.value=C)},h.value,{style:l.value.css?.props}),null,16,["wid","widget","editor","value","style"])):t.value?(n.openBlock(),n.createElementBlock("div",ja,n.toDisplayString(p.value?p.value:t.value),1)):n.createCommentVNode("",!0)]),_:1},8,["label","name","labelCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-1a91c715"]]);function qa(o,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{o(i)},e)}}const Ua=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(o){Me();const e=o,t=n.useModel(o,"value"),i=n.ref([]),s=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),l=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),a=qa(h=>{c.value.search(h).then(f=>{i.value=f})},500);n.onMounted(()=>{c.value.load(t.value).then(h=>{i.value=h})});const r=n.ref({}),d=n.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const u=h.event[f];r.value[f]=null,u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText))}),h}),c=n.computed(()=>{const h=d.value.convert||e.convert||{};return new dt(h)});return n.watch(t,()=>{t.value&&c.value.load(t.value).then(h=>{i.value=h})}),n.watch(()=>d.value.convert||e.convert||{},()=>{c.value.load().then(h=>{i.value=h})}),(h,f)=>{const u=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(u,{class:"unione-form-select",options:s.value,showSearch:l.value,value:t.value,"onUpdate:value":f[0]||(f[0]=p=>t.value=p),onSearch:n.unref(a)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Wa=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(o){const e=o,t=n.useModel(o,"value"),i=n.ref({});n.onMounted(()=>{a.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 s=n.ref({}),l=n.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const c=r.event[d];s.value[d]=null,c.enable&&c.scriptText&&(s.value[d]=new Function("value","ctx",c.scriptText))}),r}),a=n.computed(()=>{const r=l.value.convert||e.convert;return r?new dt(r):null});return(r,d)=>{const c=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(c,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=h=>t.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-a56d945e"]]),Ha=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(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),s=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const l=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];l.value[c]=null,h.enable&&h.scriptText&&(l.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-radio",options:s.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Ka=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(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),s=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const l=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];l.value[c]=null,h.enable&&h.scriptText&&(l.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-checkbox",options:s.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Qa={class:"unione-props-setting unione-query-setting"},Ga={class:"unione-query-opts"},Ya={key:0},Xa=["onClick"],Ja={key:1},Za={key:1,class:"edit-field"},er=["onClick"],tr=Z(n.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:V})=>V+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 V=e.editor.widget(e.wid)||{};return V.configs||(V.configs={}),V.configs.btns||(V.configs.btns=[]),V}),s=n.computed(()=>(e.editor.dataModels()||[]).map(g=>({value:g.sn,label:g.title+"("+g.name+")"}))),l=n.computed(()=>{const V=[],g=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(m=>{V.push(m),g.push(m.name)}),g.includes("query")||V.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),g.includes("reset")||V.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),g.includes("reset")||V.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),V.sort((m,S)=>{const _=m.index||1,x=S.index||1;return _-x}),V}),a=n.ref(null);function r(V){a.value&&a.value.open(V,g=>{g.visible=!0,Object.keys(g).forEach(m=>{V[m]=g[m]}),i.value.configs.btns.sort((m,S)=>{const _=m.index||1,x=S.index||1;return _-x}),i.value.configs.btns=[...i.value.configs.btns]})}function d(){const V=i.value.configs.btns.length+1;let g={title:"新增",name:"new_"+V,size:"default",index:V,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(g),e.editor.widget(e.wid,i.value),a.value.open(g,m=>{Object.keys(m).forEach(S=>{g[S]=m[S]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(V){const g=()=>{if(["query","reset","advanced"].includes(V.name))V.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const m=[];i.value.configs.btns.forEach(S=>{S.name!=V.name&&m.push(S)}),i.value.configs.btns=m}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{g()}})}const h=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=n.computed(()=>h.value.fields?.length?h.value.fields:[]),u={mounted:V=>V.focus()},p=n.ref({});function b(){const V=Object.keys(p.value);if(V.length)for(let g in V){const m=f.value.filter(S=>S.name==g);if(m&&m[0]){let S=p.value[g];Object.keys(S).forEach(_=>{if(_=="showIndex"){const x=m[0].show?.query||{};m[0].show||(m[0].show={}),m[0].show.query={...x,index:S[_]}}else m[0][_]=S[_]})}}p.value={}}function k(V,g){b();const m={};m[g]=V[g]||"",g=="showIndex"&&(m[g]=V.show?.query?.index),p.value[V.name]=m}function v(V,g){if(!V||!g){p.value={};return}const m=p.value[V.name][g];if(g=="showIndex"){const S=V.show?.query||{};V.show||(V.show={}),V.show.query={...S,index:m}}else V[g]=m;p.value={}}function C(V,g){f.value.filter(S=>S.name==V.name).forEach(S=>{S[g]=!S[g]})}const y=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:V=>{const g=y.value.options.filter(m=>m.value==V);return g[0]?g[0].label:V}});return(V,g)=>{const m=n.resolveComponent("a-divider"),S=n.resolveComponent("CloseOutlined"),_=n.resolveComponent("a-button"),x=n.resolveComponent("PlusOutlined"),w=n.resolveComponent("a-select"),B=n.resolveComponent("ToolOutlined"),A=n.resolveComponent("a-checkbox"),O=n.resolveComponent("a-input-number"),D=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Qa,[n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>g[3]||(g[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Ga,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,M=>(n.openBlock(),n.createBlock(_,n.mergeProps({key:M.name,class:["btn",M.name,!M.visible&&"deleted"],type:M.visible?M.type:"default",size:M.size||"default",ref_for:!0},M.props||{},{onClick:E=>r(M)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(M.title)+" ",1),M.visible?(n.openBlock(),n.createBlock(S,{key:0,class:"btn-del",onClick:n.withModifiers(E=>c(M),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[M.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(M.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(_,{class:n.normalizeClass(["btn","btn-add"]),onClick:g[0]||(g[0]=M=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(x)]),_:1})]),n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>g[4]||(g[4]=[n.createTextVNode("查询字段")])),_:1}),g[5]||(g[5]=n.createTextVNode(" 数据模型:")),n.createVNode(w,{class:"data-model-list",options:s.value,value:i.value.dataModel,"onUpdate:value":g[1]||(g[1]=M=>i.value.dataModel=M)},null,8,["options","value"]),n.createVNode(D,{columns:t.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:M})=>[["showIndex","queryType"].includes(M.key)?(n.openBlock(),n.createElementBlock("span",Ya,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(M.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:M,text:E,record:z})=>[["queryType"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!p.value[z.name]||!Object.keys(p.value[z.name]).includes(M.dataIndex))&&!E&&"empty"]),onClick:P=>k(z,M.dataIndex)},[p.value[z.name]&&Object.keys(p.value[z.name]).includes(M.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:z[M.dataIndex],"onUpdate:value":P=>z[M.dataIndex]=P,allowClear:!0,options:y.value.options,onBlur:g[2]||(g[2]=P=>v())},null,8,["value","onUpdate:value","options"])),[[u]]):(n.openBlock(),n.createElementBlock("span",Ja,n.toDisplayString(y.value.showLabel(E)),1))],10,Xa)):["isQuery"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",Za,[n.createVNode(A,{checked:z[M.dataIndex],onClick:P=>C(z,M.dataIndex)},null,8,["checked","onClick"])])):M.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!p.value[z.name]||!Object.keys(p.value[z.name]).includes(M.dataIndex))&&!E&&"empty"]),onClick:P=>k(z,M.dataIndex)},[p.value[z.name]&&Object.keys(p.value[z.name]).includes(M.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(O,{key:0,value:p.value[z.name][M.dataIndex],"onUpdate:value":P=>p.value[z.name][M.dataIndex]=P,onBlur:P=>v(z,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(z.show?.query?.index||" "),1)],64))],10,er)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ai,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),ir={class:"query-btn"},nr={class:"btn-advanced-overlay"},ys=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(o,{emit:e}){const t=o,i=n.computed(()=>{const k=t.editor?.widget(t.wid)||t.widget||{};return k.btns||(k.btns=[]),k}),s=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),l=n.computed(()=>{let k=[];return i.value.fields?.length&&(k=i.value.fields),k.sort((v,C)=>{const y=v.show?.query?.index||1,V=C.show?.query?.index||1;return y-V}),k.forEach(v=>{v.widget=v.widget||"a-input",v.value!=null&&v.value!="undefined"&&typeof v.value<"u"&&(h.value[v.name]=v.value)}),k}),a=n.computed(()=>i.value.labelWidth||7),r=n.computed(()=>{const k=i.value.btns.filter(v=>v.name=="advanced")[0]||{};return k.event?.clickScript&&(k.event.click=new Function("ctx","btn","event",k.event.clickScript)),k.event?.disableScript&&(k.event.disable=new Function("ctx","btn",k.event.disableScript)),k.event?.visibleScript&&(k.event.visible=new Function("ctx","btn",k.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...k}}),d=["query","reset","advanced"],c=n.computed(()=>{const k=i.value.btns.filter(C=>C.name!="advanced"),v=[];return k.forEach(C=>{C.size||(C.size="default"),v.push(C.name)}),v.includes("query")||k.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),v.includes("reset")||k.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),k.sort((C,y)=>{const V=C.index||1,g=y.index||1;return V-g}),k}),h=n.ref({});n.onMounted(()=>{t.editor?.ebus.$emit("table-list-search",h.value)});const f=e;function u({btn:k,event:v}){console.log("unione query form btn click",k,v),k.name=="query"&&p(),k.name=="reset"&&b(),f("btnClick",{btn:k,event:v})}function p(){const k=[];s.value.visible&&k.push(s.value.name),l.value.forEach(C=>{C.visible&&k.push(C.name)});const v={};Object.keys(h.value).forEach(C=>{k.includes(C)&&(v[C]=h.value[C])}),f("query",v),t.editor?.ebus.$emit("table-list-search",v)}function b(){h.value={},l.value.forEach(k=>{k.visible=!1}),f("reset"),t.editor?.ebus.$emit("table-list-reset")}return(k,v)=>{const C=n.resolveComponent("a-input"),y=n.resolveComponent("a-form-item"),V=n.resolveComponent("unione-btn"),g=n.resolveComponent("a-checkbox"),m=n.resolveComponent("DownOutlined"),S=n.resolveComponent("a-button"),_=n.resolveComponent("a-dropdown"),x=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(x,{model:h.value,layout:"horizontal","label-col":{span:a.value}},{default:n.withCtx(()=>[s.value.visible?(n.openBlock(),n.createBlock(y,{key:0,label:s.value.title,class:"query-field keywords",name:s.value.name,style:n.normalizeStyle({width:a.value})},{default:n.withCtx(()=>[n.createVNode(C,{placeholder:s.value.placeholder,value:h.value[s.value.name],"onUpdate:value":v[0]||(v[0]=w=>h.value[s.value.name]=w)},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,w=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:w.name},[w.visible?(n.openBlock(),n.createBlock(y,{key:0,label:w.title,class:n.normalizeClass(["query-field",w.name]),style:n.normalizeStyle({width:a.value}),name:w.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(w.widget),n.mergeProps({placeholder:w.placeholder,value:h.value[w.name],"onUpdate:value":B=>h.value[w.name]=B,ref_for:!0},w.props||{},{widget:w}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",ir,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,w=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:w.name},[w.visible!=!1?(n.openBlock(),n.createBlock(V,{key:0,widget:w,editor:o.editor,onClick:u,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&l.value.length?(n.openBlock(),n.createBlock(_,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",nr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,w=>(n.openBlock(),n.createBlock(g,{key:w.name,class:"item",checked:w.visible,onClick:B=>w.visible=!w.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(w.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(S,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(tr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-bf93af8d"]]),sr={class:"unione-props-setting unione-table-setting"},lr={class:"unione-table-tools"},or={key:1,class:"unione-table-opts"},ar={key:0},rr=["onClick"],dr={key:1,class:"edit-field"},cr=["onClick"],hr={key:1},fr=Z(n.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=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:"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(x,w){let B=x.filter(A=>A.value==w);return B&&B[0]&&B[0].label||w}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(x,w){let B=x.filter(A=>A.value==w);return B&&B[0]&&B[0].label||w}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const x=e.editor.widget(e.wid)||{};return x.configs||(x.configs={}),x.configs.leftBtns||(x.configs.leftBtns=[]),x.configs.rightBtns||(x.configs.rightBtns=[]),x.configs.operation||(x.configs.operation={}),x.configs.operation.btns||(x.configs.operation.btns=[]),x.configs.operation.more||(x.configs.operation.more={}),x}),s=n.computed(()=>(e.editor.dataModels()||[]).map(w=>({value:w.sn,label:w.title+"("+w.name+")"}))),l=n.computed(()=>{if(!i.value)return[];const x=[],w=i.value.configs.leftBtns;if(w.forEach(B=>{x.push(B.name)}),!x.includes("add")){const B={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};w.splice(0,0,B)}if(!x.includes("delBatch")){const B={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};w.splice(1,0,B)}return w}),a=n.computed(()=>{if(!i.value)return[];const x=[],w=i.value.configs.rightBtns;if(w.forEach(B=>{x.push(B.name)}),!x.includes("downData")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};w.splice(0,0,B)}if(!x.includes("impData")){const B={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};w.splice(1,0,B)}if(!x.includes("expData")){const B={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};w.splice(2,0,B)}if(!x.includes("downTmpl")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};w.splice(3,0,B)}return w});function r(x,w){x=="left"?h.value.open(w,B=>{B.visible=!0,Object.keys(B).forEach(A=>{w[A]=B[A]}),i.value.configs.leftBtns.sort((A,O)=>{const D=A.index||1,M=O.index||1;return D-M}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):h.value.open(w,B=>{B.visible=!0,Object.keys(B).forEach(A=>{w[A]=B[A]}),i.value.configs.rightBtns.sort((A,O)=>{const D=A.index||1,M=O.index||1;return D-M}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(x){const w=x=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let B={title:"新增"+w,name:"new_"+w,index:w,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};x=="left"?i.value.configs.leftBtns.push(B):i.value.configs.rightBtns.push(B),e.editor.widget(e.wid,i.value),r(x,B)}function c(x,w){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(w.name))w.visible=!1,x=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(x=="left"){const A=[];i.value.configs.leftBtns.forEach(O=>{O.name!=w.name&&A.push(O)}),i.value.configs.leftBtns=A}else{const A=[];i.value.configs.rightBtns.forEach(O=>{O.name!=w.name&&A.push(O)}),i.value.configs.rightBtns=A}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const h=n.ref(null);function f(x){h.value.open(x,w=>{w.visible=!0,Object.keys(w).forEach(B=>{x[B]=w[B]}),i.value.configs.operation.btns.sort((B,A)=>{const O=B.index||1,D=A.index||1;return O-D}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const x=i.value.configs.operation.btns.length+1;let w={title:"新增"+x,name:"new_"+x,index:x,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(w),e.editor.widget(e.wid,i.value),h.value.open(w,B=>{Object.keys(B).forEach(A=>{w[A]=B[A]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function p(x){const w=()=>{if(["delete","view","edit"].includes(x.name))x.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const B=[];i.value.configs.operation.btns.forEach(A=>{A.name!=x.name&&B.push(A)}),i.value.configs.operation.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{w()}})}const b=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),k=n.computed(()=>b.value.fields?.length?(b.value.fields.forEach(x=>{x.show||(x.show={}),x.show.list||(x.show.list={})}),b.value.fields):[]),v={mounted:x=>x.focus()},C=n.ref({});function y(){const x=Object.keys(C.value);if(x.length)for(let w in x){const B=k.value.filter(A=>A.name==w);if(B&&B[0]){let A=C.value[w];Object.keys(A).forEach(O=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),O=="showIndex"?B[0].show.list.index=A[O]:O=="showWidth"?B[0].show.list.width=A[O]:O=="fixed"?B[0].show.list.fixed=A[O]:O=="align"?B[0].show.list.align=A[O]:B[0][O]=A[O]})}}C.value={}}function V(x,w){y();const B={};w=="showIndex"?B[w]=x.show?.list?.index:w=="showWidth"?B[w]=x.show?.list?.width:w=="fixed"?B[w]=x.show?.list?.fixed:w=="align"?B[w]=x.show?.list?.align:B[w]=x[w]||"",C.value[x.name]=B}function g(x,w){if(!x||!w){C.value={};return}const B=C.value[x.name][w];x.show||(x.show={}),x.show.list||(x.show.list={}),w=="showIndex"?x.show.list.index=B:w=="showWidth"?x.show.list.width=B:w=="fixed"?x.show.list.fixed=B:w=="align"?x.show.list.align=B:x[w]=B,C.value={}}function m(x,w){return w=="showIndex"?x.show?.list?.index:w=="showWidth"?x.show?.list?.width:w=="fixed"?x.show?.list?.fixed:w=="align"?x.show?.list?.align:x[w]}function S(x,w){k.value.filter(A=>A.name==x.name).forEach(A=>{A[w]=!A[w]})}const _=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:x=>{const w=_.value.options.filter(B=>B.value==x);return w[0]?w[0].label:x}});return(x,w)=>{const B=n.resolveComponent("a-divider"),A=n.resolveComponent("CloseOutlined"),O=n.resolveComponent("a-button"),D=n.resolveComponent("PlusOutlined"),M=n.resolveComponent("a-input"),E=n.resolveComponent("a-form-item"),z=n.resolveComponent("a-col"),P=n.resolveComponent("a-input-number"),I=n.resolveComponent("a-checkbox"),H=n.resolveComponent("a-row"),L=n.resolveComponent("a-select"),N=n.resolveComponent("ToolOutlined"),Q=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",sr,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[8]||(w[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",lr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,T=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:j=>r("left",T)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(T.title)+" ",1),T.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"bool-del",onClick:n.withModifiers(j=>c("left",T),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(O,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:w[0]||(w[0]=T=>d("left"))},{default:n.withCtx(()=>[n.createVNode(D)]),_:1}),n.createVNode(O,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:w[1]||(w[1]=T=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(D)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,T=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:T.name,class:["btn","right",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:j=>r("right",T)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(T.title)+" ",1),T.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"bool-del",onClick:n.withModifiers(j=>c("right",T),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[9]||(w[9]=[n.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createBlock(H,{key:0},{default:n.withCtx(()=>[n.createVNode(z,{span:7},{default:n.withCtx(()=>[n.createVNode(E,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(M,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(z,{span:5},{default:n.withCtx(()=>[n.createVNode(E,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(P,{value:i.value.configs.operation.width,"onUpdate:value":w[2]||(w[2]=T=>i.value.configs.operation.width=T)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(z,{span:6},{default:n.withCtx(()=>[n.createVNode(E,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(P,{value:i.value.configs.operation.count,"onUpdate:value":w[3]||(w[3]=T=>i.value.configs.operation.count=T)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(z,{span:5},{default:n.withCtx(()=>[n.createVNode(E,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(I,{checked:i.value.configs.operation.visible,"onUpdate:checked":w[4]||(w[4]=T=>i.value.configs.operation.visible=T)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[10]||(w[10]=[n.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createElementBlock("div",or,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,T=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"small",ref_for:!0},T.props||{},{onClick:j=>f(T)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(T.title)+" ",1),T.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"btn-del",onClick:n.withModifiers(j=>p(T),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(O,{class:n.normalizeClass(["btn","btn-add"]),onClick:w[5]||(w[5]=T=>u()),size:"small"},{default:n.withCtx(()=>[n.createVNode(D)]),_:1})])):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>w[11]||(w[11]=[n.createTextVNode("表头设置")])),_:1}),w[12]||(w[12]=n.createTextVNode(" 数据模型:")),n.createVNode(L,{class:"data-model-list",options:s.value,value:i.value.dataModel,"onUpdate:value":w[6]||(w[6]=T=>i.value.dataModel=T)},null,8,["options","value"]),n.createVNode(Q,{columns:t.value,"data-source":k.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:T})=>[["showIndex","showWidth","align","fixed"].includes(T.key)?(n.openBlock(),n.createElementBlock("span",ar,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(T.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:T,record:j})=>[["showIndex","showWidth"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!C.value[j.name]||!Object.keys(C.value[j.name]).includes(T.dataIndex))&&!m(j,T.dataIndex)&&"empty"]),onClick:he=>V(j,T.dataIndex)},[C.value[j.name]&&Object.keys(C.value[j.name]).includes(T.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(P,{key:0,value:C.value[j.name][T.dataIndex],"onUpdate:value":he=>C.value[j.name][T.dataIndex]=he,onBlur:he=>g(j,T.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(j,T.dataIndex)),1)],64))],10,rr)):["isList","isQuery","isSort"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",dr,[n.createVNode(I,{checked:j[T.dataIndex],onClick:he=>S(j,T.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(T.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!C.value[j.name]||!Object.keys(C.value[j.name]).includes(T.dataIndex))&&!m(j,T.dataIndex)&&"empty"]),onClick:he=>V(j,T.dataIndex)},[C.value[j.name]&&Object.keys(C.value[j.name]).includes(T.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(L,{key:0,value:j.show.list[T.dataIndex],"onUpdate:value":he=>j.show.list[T.dataIndex]=he,allowClear:!0,options:T.options,onBlur:w[7]||(w[7]=he=>g())},null,8,["value","onUpdate:value","options"])),[[v]]):(n.openBlock(),n.createElementBlock("span",hr,n.toDisplayString(T.showLabel(T.options,m(j,T.dataIndex))),1))],10,cr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ai,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function en(o){const e=o.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const s=e[i];s&&(t.push(s.charAt(0).toUpperCase()),s.length>1&&t.push(s.substring(1)))}return t.join("")}const ur={toHump:en},pr={class:"unione-table-tools"},mr={class:"unione-table-data"},gr={key:0,class:"unione-table-opts"},xs=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(o,{expose:e,emit:t}){const i=Me(),s=o,l=n.computed(()=>s.editor?.widget(s.wid)||s.widget||{}),a=n.computed(()=>l.value.props||{}),r=n.computed(()=>l.value.rowKey||s.rowKey||"id"),d=n.computed(()=>l.value.dsn?s.editor?.dataManager().use(l.value.dsn,"list"):null),c=n.computed(()=>{const O=s.dataList||[];return!O.length&&d.value?d.value.data()||[]:O}),h=n.computed(()=>{if(l.value.operation==!1)return{visible:!1};const O=W.utils.obj.ext(l.value.operation||{},{title:"操作",visible:!0,width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),D=[];let M=l.value.operation?.btns||[];if(M.forEach(E=>{D.push(E.name)}),D.includes("edit")||M.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),D.includes("view")||M.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),D.includes("delete")||M.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),s.editor){const E=M.filter(P=>P.name=="edit")[0];if(E.visible&&(E.action||(E.action={}),E.action.type||(E.action.type="route"),!E.action.href)){const P=(s.editor.sn().endsWith(":list")?s.editor.sn().substring(0,s.editor.sn().length-5):s.editor.sn())+":form",I=s.editor.model.value;E.action.href=i.editPageUrl+"?psn="+P+"&model="+I+"&id={row."+s.rowKey+"}"}const z=M.filter(P=>P.name=="view")[0];if(z.visible&&(z.action||(z.action={}),z.action.type||(z.action.type="route"),!z.action.href)){const P=(s.editor.sn().endsWith(":list")?s.editor.sn().substring(0,s.editor.sn().length-5):s.editor.sn())+":form";z.action.href=i.viewPageUrl+"?psn="+P+"&model=view&id={row."+s.rowKey+"}"}}return M=M.filter(E=>E.visible!=!1).sort((E,z)=>{const P=E.index||1,I=z.index||1;return P-I}),O.count&&(M.length>O.count+1?(O.btns=M.slice(0,O.count),O.more.items=M.slice(O.count,M.length),O.more.visible=!0):(O.btns=M,O.more.visible=!1)),O}),f=n.computed(()=>{let O=[];l.value.columns?.length&&(O=[...l.value.columns]);const D=[];O.forEach((E,z)=>{E.dataIndex=E.name,E.convert&&(E.dataIndex=E.name+"Label",E.convertObj=new dt(E.convert),E.customCell=(P,I,H)=>{const L=P[H.name];E.convertObj&&L!=null&&L!=null&&(L+"").length>0&&(P[H.dataIndex]=L,E.convertObj.convert(L).then(N=>{N&&(P[H.dataIndex]=N)}))}),E.sort?.enable&&(E.sorter=!0,E.sort.defoult&&(E.defaultSortOrder=E.sort.asc?"ascend":"descend")),E.customRender=({text:P})=>P||"--",E.fkey?.enable&&(E.fkey.labelName&&(E.dataIndex=en(E.fkey.labelName)),E.fkey.labelTitle&&(E.title=E.fkey.labelTitle),E.customRender=({record:P,column:I})=>P&&P[I.name+"FEntry"]&&P[I.name+"FEntry"][I.dataIndex]||"--",E.fkey.fields?.forEach((P,I)=>{if(!P.name)return;const H=en(P.name),L={fkName:E.name,title:P.title,name:H,dataIndex:P.name,width:P.width,index:P.index||z+I+1,customRender:({record:N,column:Q})=>{if(N&&N[Q.fkName+"FEntry"]){const T=N[Q.fkName+"FEntry"][Q.name];if(T)return P.convertObj&&P.convertObj.convert(T)||T}return"--"}};P.convert&&(P.convertObj=new dt(P.convert)),D.push(L)}))}),D.forEach(E=>{O.splice(E.index,0,E)});const M=W.utils.obj.ext(l.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return M&&M.visible!=!1&&(M.customRender=E=>y.value?(y.value.current-1)*y.value.pageSize+E.index+1:E.index,O=[M,...O]),h.value&&h.value.visible!=!1&&O.push({fixed:"right",align:"center",...h.value,name:"operation"}),O}),u=n.computed(()=>{if(l.value.leftBtns==!1)return[];const O=[],D=[];if((l.value.leftBtns||[]).forEach(E=>{E.visible!=!1&&O.push(E),D.push(E.name),E.name=="delBatch"&&!V.value&&(E.visible=!1)}),!D.includes("add")){const E={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};O.splice(0,0,E)}if(!D.includes("delBatch")&&V.value){const E={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};O.splice(1,0,E)}if(s.editor){const E=O.filter(z=>z.name=="add")[0];if(E.visible&&(E.action||(E.action={}),E.action.type||(E.action.type="route"),!E.action.href)){const z=(s.editor.sn().endsWith(":list")?s.editor.sn().substring(0,s.editor.sn().length-5):s.editor.sn())+":form",P=s.editor.model.value;E.action.href=i.addPageUrl+"?psn="+z+"&model="+P}}return O});function p({btn:O,event:D}){if(i.isDebug&&console.log("unione table left btn click",O,D),O.name=="delBatch"){if(!g.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.loadByIds(g.value.selectedRowKeys);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+g.value.selectedRowKeys.length+")数据",onOk:()=>{S("delBatch",{btn:O,event:D,keys:g.value.selectedRowKeys}),S("leftBtnClick",{btn:O,event:D,keys:g.value.selectedRowKeys}),S("btnClick",{btn:O,event:D,keys:g.value.selectedRowKeys})}});return}S(O.name,{btn:O,event:D}),S("leftBtnClick",{btn:O,event:D}),S("btnClick",{btn:O,event:D})}const b=n.computed(()=>{if(l.value.rightBtns==!1)return[];const O=[],D=[];if((l.value.rightBtns||[]).forEach(E=>{E.visible!=!1&&O.push(E),D.push(E.name)}),!D.includes("impData")){const E={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};O.splice(1,0,E)}if(!D.includes("expData")){const E={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};O.splice(2,0,E)}if(!D.includes("downTmpl")){const E={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};O.splice(3,0,E)}return O});function k({btn:O,event:D}){i.isDebug&&console.log("unione table right btn click",O,D),S(O.name,{btn:O,event:D}),S("rightBtnClick",{btn:O,event:D}),S("btnClick",{btn:O,event:D})}const v=n.computed(()=>({bordered:!0,size:"small",...l.value.attrs||{}})),C=n.ref({}),y=n.computed(()=>W.utils.obj.ext(s.pagination||l.value.pagination,{showTotal:O=>"共"+O+"记录",pageSize:10,current:1,total:0,position:["bottomCenter"]})),V=n.computed(()=>typeof l.value.selection<"u"?l.value.selection:!0),g=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(O,D)=>{g.value.selectedRowKeys=O,g.value.selectedRowList=D},getCheckboxProps:O=>({disabled:O.checkable})}),m=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],S=t;function _({btn:O,event:D},M){if(i.isDebug&&console.log("unione table opt btn click",O,D),O.name=="delete"){if(d.value){d.value.deleteByIds([M[r.value]]);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{S(O.name,{btn:O,event:D,row:M}),S("optBtnClick",{btn:O,event:D,row:M}),S("btnClick",{btn:O,event:D,row:M})}});return}S(O.name,{btn:O,event:D,row:M}),S("optBtnClick",{btn:O,event:D,row:M}),S("btnClick",{btn:O,event:D,row:M})}function x(O,D,M,E){B(),S("change",{pagination:O,filters:D,sorter:M,event:E})}function w(){G.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${g.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{g.value.selectedRowKeys=[],g.value.selectedRowList=[]}})}function B(){console.log("dataStorage.value",d.value),d.value?.find({body:C.value,page:y.value.current,pageSize:y.value.pageSize})}n.onMounted(()=>{s.editor?.ebus.$on("table-list-search",O=>{console.log("table-list-search",O),C.value=O||{},B()})});function A(){return{keys:g.value.selectedRowKeys,rows:g.value.selectedRowList}}return e({getSelected:A,clearSelected:w}),(O,D)=>{const M=n.resolveComponent("unione-btn"),E=n.resolveComponent("DownOutlined"),z=n.resolveComponent("a-button"),P=n.resolveComponent("a-dropdown"),I=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(rt,{class:"unione-table-list",model:s.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",pr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,H=>(n.openBlock(),n.createBlock(M,{key:H.name,class:"btn",widget:H,editor:o.editor,onClick:p,preset:m,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),g.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:w},"当前选中记录("+n.toDisplayString(g.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,H=>(n.openBlock(),n.createBlock(M,{key:H.name,class:"btn right",widget:H,editor:o.editor,onClick:k,preset:m,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",mr,[f.value&&f.value.length?(n.openBlock(),n.createBlock(I,n.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":c.value,"row-selection":V.value?g.value:null,scroll:{x:a.value.scrollX||"max-content",y:a.value.scrollY},pagination:y.value,onChange:x},v.value),{bodyCell:n.withCtx(({column:H,record:L})=>[H.name==="operation"?(n.openBlock(),n.createElementBlock("div",gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.btns,N=>(n.openBlock(),n.createBlock(M,{key:N.name,class:"opt",widget:N,editor:o.editor,onClick:Q=>_(Q,L),preset:m,ctx:{row:L}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(n.openBlock(),n.createBlock(P,{key:0,trigger:[h.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.more.items,N=>(n.openBlock(),n.createBlock(M,{key:N.name,class:"item",widget:N,editor:o.editor,onClick:Q=>_(Q,L),type:"text",preset:m,ctx:{row:L}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(z,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(h.value.more.title)+" ",1),n.createVNode(E)]),_: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},[s.editor&&s.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(fr,{editor:s.editor,wid:s.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-46ce7727"]]),kr={class:"page-setting-dialog"},ri=n.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=o,i=n.computed(()=>t.editor?.model?.value),s=W.useSession(),l=n.computed(()=>s.getPrincipal()),a=n.ref(!1);n.provide("closeSetting",()=>{t.editor?.save().then(u=>{a.value=!1})});function r(){a.value=!0}function d(){t.editor?.save().then(u=>{console.log("res",u)})}function c(){t.editor?.save().then(u=>{console.log("res",u)})}const h=n.ref("");function f(u){h.value||(h.value=i.value),u?t.editor?.setModel("edit"):t.editor?.setModel(h.value)}return(u,p)=>{const b=n.resolveComponent("SettingOutlined"),k=n.resolveComponent("a-tooltip"),v=n.resolveComponent("SaveOutlined"),C=n.resolveComponent("FormOutlined"),y=n.resolveComponent("StopOutlined"),V=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:0,title:o.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"]&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(C,{class:"btn-edit",onClick:p[0]||(p[0]=g=>f(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&l.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(y,{class:"btn-edit",onClick:p[1]||(p[1]=g=>f(!1))})]),_:1})):n.createCommentVNode("",!0),n.renderSlot(u.$slots,"default"),i.value=="edit"?(n.openBlock(),n.createBlock(V,{key:4,title:t.settingTitle,open:a.value,"onUpdate:open":p[2]||(p[2]=g=>a.value=g),centered:"",width:"85%",onOk:c},{default:n.withCtx(()=>[n.createElementVNode("div",kr,[n.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),br={class:"unione-props-setting data-field-manage"},wr={key:0},yr={key:1},xr={key:2},vr={key:3},Cr={key:4},Sr={key:5},Nr={key:6},Br=["onClick"],Or=["onClick"],Vr=["onClick"],_r={key:1},Ar=Z(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){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(o,"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(k=>{!u.includes(k.name)&&i.value.selectedRowKeys.includes(k.name)&&b.push(k.name)}),b.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(k=>!b.includes(k)))})}}),s={mounted:u=>u.focus()},l=n.ref({});function a(){const u=Object.keys(l.value);if(u.length)for(let p in u){const b=t.value.filter(k=>k.name==p);if(b&&b[0]){let k=l.value[p];Object.keys(k).forEach(v=>{b[0][v]=k[v]})}}l.value={}}function r(u,p){a();const b={};b[p]=u[p]||"",l.value[u.name]=b}function d(u,p){if(!u||!p){l.value={};return}const b=l.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,l.value={}}function c(u,p){t.value.filter(k=>k.name==u.name).forEach(k=>{k[p]=!k[p]})}function h(){if(a(),t.value.filter(b=>b.name=="new_").length>0){l.value.new_={name:"new_"};return}const p={title:"",name:"new_",isPk:!1};t.value.push(p),l.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"),k=n.resolveComponent("a-tooltip"),v=n.resolveComponent("a-input"),C=n.resolveComponent("a-input-number"),y=n.resolveComponent("a-select-option"),V=n.resolveComponent("a-select"),g=n.resolveComponent("a-checkbox"),m=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",br,[n.createVNode(b,{class:"btn btn-add",type:"primary",onClick:h,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:S})=>[S.key==="name"?(n.openBlock(),n.createElementBlock("span",wr,[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(S.title),1)])):n.createCommentVNode("",!0),S.key==="title"?(n.openBlock(),n.createElementBlock("span",yr,[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(S.title),1)])):n.createCommentVNode("",!0),S.key==="descs"?(n.openBlock(),n.createElementBlock("span",xr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",vr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Cr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="isPk"?(n.openBlock(),n.createBlock(k,{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(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isFk"?(n.openBlock(),n.createBlock(k,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isNull"?(n.openBlock(),n.createBlock(k,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="syncDbEnable"?(n.openBlock(),n.createBlock(k,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:_,record:x})=>[["name","title","descs","defaultValue"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[x.name]||!Object.keys(l.value[x.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:w=>r(x,S.dataIndex)},[l.value[x.name]&&Object.keys(l.value[x.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:l.value[x.name][S.dataIndex],"onUpdate:value":w=>l.value[x.name][S.dataIndex]=w,onBlur:w=>d(x,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(_||" "),1)],64))],10,Br)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[x.name]||!Object.keys(l.value[x.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:w=>r(x,S.dataIndex)},[l.value[x.name]&&Object.keys(l.value[x.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:l.value[x.name][S.dataIndex],"onUpdate:value":w=>l.value[x.name][S.dataIndex]=w,onBlur:w=>d(x,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(_||" "),1)],64))],10,Or)):["dataType"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[x.name]||!Object.keys(l.value[x.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:w=>r(x,S.dataIndex)},[l.value[x.name]&&Object.keys(l.value[x.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(V,{key:0,value:x[S.dataIndex],"onUpdate:value":w=>x[S.dataIndex]=w,onBlur:p[0]||(p[0]=w=>d())},{default:n.withCtx(()=>[n.createVNode(y,{key:"String",value:"String"}),n.createVNode(y,{key:"Long",value:"Long"}),n.createVNode(y,{key:"Short",value:"Short"}),n.createVNode(y,{key:"Integer",value:"Integer"}),n.createVNode(y,{key:"Float",value:"Float"}),n.createVNode(y,{key:"Double",value:"Double"}),n.createVNode(y,{key:"Date",value:"Date"}),n.createVNode(y,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[s]]):(n.openBlock(),n.createElementBlock("span",_r,n.toDisplayString(_),1))],10,Vr)):["syncDbEnable","isFk","isPk"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:3,checked:x[S.dataIndex],onClick:w=>c(x,S.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:4,checked:!x[S.dataIndex],onClick:w=>c(x,S.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Tr={class:"unione-props-setting data-field-setting"},Mr={key:0},Er=["onClick"],Ir={class:"field-txt"},Dr=["onClick"],Pr={key:1,class:"field-txt"},$r=["onClick"],Fr={key:1},Rr=["onClick"],Lr={key:0,class:"field-txt"},jr={key:4,class:"edit-field"},zr={key:0},qr=["onClick"],Ur=Z(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=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:"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(o,"modelValue"),i={mounted:C=>C.focus()},s=n.ref({});function l(){const C=Object.keys(s.value);if(C.length)for(let y in C){const V=t.value.filter(g=>g.name==y);if(V&&V[0]){let g=s.value[y];Object.keys(g).forEach(m=>{m=="convertName"?(V[0].convert||(V[0].convert={}),V[0].convert.type=g[m]):V[0][m]=g[m]})}}s.value={}}function a(C,y){l();const V={};y=="convertName"?(C.convert||(C.convert={}),V[y]=C.convert?.type):V[y]=C[y]||"",s.value[C.name]=V}function r(C,y){{s.value={};return}}function d(C,y){t.value.filter(g=>g.name==C.name).forEach(g=>{g[y]=!g[y]})}const c=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{c.value.visible=!1}});function h(C,y){const V=t.value.filter(m=>m.name==C.name);V.forEach(m=>{y!="isSort"?m[y]=!0:m[y]=!m[y]});const g=V[0];if(!(!g||y=="isSort")){switch(c.value.prop=y,c.value.field=C,g.show||(g.show={}),y){case"isQuery":g.show.query||(g.show.query={}),c.value.show=g.show.query,c.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":g.show.form||(g.show.form={}),c.value.show=g.show.form,c.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":g.show.view||(g.show.view={}),c.value.show=g.show.view,c.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":g.show.list||(g.show.list={}),c.value.show=g.show.list,c.value.title=`列头设置/${C.title}(${C.name})`;break}c.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:C=>{const y=f.value.options.filter(V=>V.value==C);return y[0]?y[0].label:C}}),u=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let y="";return C.rules&&(y=C.rules.filter(V=>V.enable).length||""),y&&(y="("+y+")"),y},toSetting:()=>{const C=u.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 V={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(V.pattern=C.regExpress,V.enable=!0),u.value.field.rules=[y,V],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function p(C){u.value.visible=!0,u.value.field=C;const y=C.rules||[],V={trigger:"change",whitespace:!0};y.forEach(g=>{g.name=="reg"&&(V.trigger=g.trigger,V.whitespace=g.whitespace,V.regExpress=g.pattern,V.regMessage=g.message),g.name=="range"&&(V.rangeMin=g.min,V.rangeMax=g.max,V.rangeMessage=g.message)}),u.value.props=V}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:C=>{const y=b.value.widgets.filter(V=>V.value==C);return y[0]?y[0].label:C},toSetting:()=>{}}),k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(C,y)=>{k.value.convert.options.splice(C,1)},toSetting:()=>{k.value.visible=!1}});function v(C){k.value.visible=!0,k.value.field=C,k.value.convert=C.convert||{}}return(C,y)=>{const V=n.resolveComponent("ToolOutlined"),g=n.resolveComponent("a-button"),m=n.resolveComponent("a-select"),S=n.resolveComponent("a-checkbox"),_=n.resolveComponent("a-table"),x=n.resolveComponent("a-input-number"),w=n.resolveComponent("a-form-item"),B=n.resolveComponent("a-input"),A=n.resolveComponent("a-form"),O=n.resolveComponent("a-modal"),D=n.resolveComponent("a-col"),M=n.resolveComponent("a-row"),E=n.resolveComponent("a-select-option"),z=n.resolveComponent("a-divider"),P=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Tr,[n.createVNode(_,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:I})=>[["widget","queryType","rules","convertName"].includes(I.key)?(n.openBlock(),n.createElementBlock("span",Mr,[n.createVNode(V),n.createTextVNode(" "+n.toDisplayString(I.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:I,text:H,record:L})=>[["rules"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!u.value.showInfo(L)&&"empty"]),onClick:N=>p(L)},[n.createElementVNode("span",Ir,n.toDisplayString(u.value.showInfo(L)),1),u.value.showInfo(L)?(n.openBlock(),n.createBlock(g,{key:0,type:"link"},{default:n.withCtx(()=>y[22]||(y[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Er)):["widget"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[L.name]||!Object.keys(s.value[L.name]).includes(I.dataIndex))&&!H&&"empty"]),onClick:N=>a(L,I.dataIndex)},[s.value[L.name]&&Object.keys(s.value[L.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:L[I.dataIndex],"onUpdate:value":N=>L[I.dataIndex]=N,allowClear:!0,options:b.value.widgets,onBlur:y[0]||(y[0]=N=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Pr,n.toDisplayString(b.value.widgetName(H)),1))],10,Dr)):["queryType"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[L.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[L.name]||!Object.keys(s.value[L.name]).includes(I.dataIndex))&&!H&&"empty"]),onClick:N=>a(L,I.dataIndex)},[s.value[L.name]&&Object.keys(s.value[L.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:L[I.dataIndex],"onUpdate:value":N=>L[I.dataIndex]=N,allowClear:!0,options:f.value.options,onBlur:y[1]||(y[1]=N=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Fr,n.toDisplayString(f.value.showLabel(H)),1))],10,$r)):n.createCommentVNode("",!0)],64)):["convertName"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[L.name]||!Object.keys(s.value[L.name]).includes(I.dataIndex))&&!L.convert?.type&&"empty"]),onClick:N=>a(L,I.dataIndex)},[s.value[L.name]&&Object.keys(s.value[L.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:L.convert.type,"onUpdate:value":N=>L.convert.type=N,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:y[2]||(y[2]=N=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[L.convert?.type?(n.openBlock(),n.createElementBlock("span",Lr,n.toDisplayString(L.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),L.convert?.type?(n.openBlock(),n.createBlock(g,{key:1,type:"link",onClick:n.withModifiers(N=>v(L),["stop"])},{default:n.withCtx(()=>y[23]||(y[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Rr)):["isQuery","isForm","isView","isList","isSort"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",jr,[n.createVNode(S,{checked:L[I.dataIndex],onClick:N=>d(L,I.dataIndex)},null,8,["checked","onClick"]),n.createVNode(g,{type:"link",onClick:N=>h(L,I.dataIndex)},{default:n.withCtx(()=>y[24]||(y[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(O,{visible:c.value.visible,"onUpdate:visible":y[9]||(y[9]=I=>c.value.visible=I),title:c.value.title,onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:c.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(w,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(x,{value:c.value.show.index,"onUpdate:value":y[3]||(y[3]=I=>c.value.show.index=I)},null,8,["value"])]),_:1}),["isQuery"].includes(c.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(w,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.width,"onUpdate:value":y[4]||(y[4]=I=>c.value.show.width=I)},null,8,["value"])]),_:1})),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.labelWidth,"onUpdate:value":y[5]||(y[5]=I=>c.value.show.labelWidth=I)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.valueWidth,"onUpdate:value":y[6]||(y[6]=I=>c.value.show.valueWidth=I)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(m,{value:c.value.show.fixed,"onUpdate:value":y[7]||(y[7]=I=>c.value.show.fixed=I),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(w,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(m,{value:c.value.show.align,"onUpdate:value":y[8]||(y[8]=I=>c.value.show.align=I),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(O,{visible:k.value.visible,"onUpdate:visible":y[11]||(y[11]=I=>k.value.visible=I),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",zr,[n.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>y[25]||(y[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(_,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:I,text:H,record:L,index:N})=>[I.dataIndex==="label"?(n.openBlock(),n.createBlock(B,{key:0,value:L.label,"onUpdate:value":Q=>L.label=Q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),I.dataIndex==="value"?(n.openBlock(),n.createBlock(B,{key:1,value:L.value,"onUpdate:value":Q=>L.value=Q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),I.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:Q=>k.value.toDelOption(N,L)},"删除",8,qr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock(A,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(M,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(D,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(w,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(B,{value:k.value.convert.dict,"onUpdate:value":y[10]||(y[10]=I=>k.value.convert.dict=I)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(O,{visible:b.value.visible,"onUpdate:visible":y[13]||(y[13]=I=>b.value.visible=I),title:"控件设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{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(w,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(m,{value:b.value.props.mode,"onUpdate:value":y[12]||(y[12]=I=>b.value.props.mode=I),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(E,{value:"multiple"},{default:n.withCtx(()=>y[26]||(y[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(E,{value:"tags"},{default:n.withCtx(()=>y[27]||(y[27]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(O,{visible:u.value.visible,"onUpdate:visible":y[21]||(y[21]=I=>u.value.visible=I),title:"规则设置",onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(z,{orientation:"left"},{default:n.withCtx(()=>y[28]||(y[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(w,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(P,{value:u.value.props.trigger,"onUpdate:value":y[14]||(y[14]=I=>u.value.props.trigger=I),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(w,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(S,{value:u.value.props.whitespace,"onUpdate:value":y[15]||(y[15]=I=>u.value.props.whitespace=I),checked:u.value.props.whitespace},{default:n.withCtx(()=>y[29]||(y[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(z,{orientation:"left"},{default:n.withCtx(()=>y[30]||(y[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(w,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(x,{value:u.value.props.rangeMin,"onUpdate:value":y[16]||(y[16]=I=>u.value.props.rangeMin=I)},null,8,["value"]),y[31]||(y[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(x,{value:u.value.props.rangeMax,"onUpdate:value":y[17]||(y[17]=I=>u.value.props.rangeMax=I)},null,8,["value"])]),_:1}),n.createVNode(w,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.rangeMessage,"onUpdate:value":y[18]||(y[18]=I=>u.value.props.rangeMessage=I)},null,8,["value"])]),_:1}),n.createVNode(z,{orientation:"left"},{default:n.withCtx(()=>y[32]||(y[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(w,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.regExpress,"onUpdate:value":y[19]||(y[19]=I=>u.value.props.regExpress=I)},null,8,["value"])]),_:1}),n.createVNode(w,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.regMessage,"onUpdate:value":y[20]||(y[20]=I=>u.value.props.regMessage=I)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Wr={class:"unione-props-setting data-field"},Hr=Z(n.defineComponent({__name:"dataField",props:n.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=n.useModel(o,"modelValue");return(t,i)=>{const s=n.resolveComponent("OrderedListOutlined"),l=n.resolveComponent("a-tab-pane"),a=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Wr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(l,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(s),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(l,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(a),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Ur,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Kr={key:0,class:"data-model-list"},Qr=["onClick"],Gr=Z(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(o,{expose:e}){const t=n.computed(()=>s.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const s=o;function l(f){i.value=f}function a(){if(t.value.length>=s.limit){G.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=ia.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),s.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(),c=n.inject("closeSetting");function h(){d.value.validate().then(f=>{c&&c()})}return e({toSaving:h}),(f,u)=>{const p=n.resolveComponent("a-input"),b=n.resolveComponent("a-form-item"),k=n.resolveComponent("a-textarea"),v=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",s.limit<=1&&"center"])},[s.limit>1?(n.openBlock(),n.createElementBlock("div",Kr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,C=>(n.openBlock(),n.createElementBlock("div",{key:C.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==C.sn&&"slt"]),onClick:y=>l(C)},n.toDisplayString(C.title),11,Qr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:a},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",s.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]=C=>i.value.title=C)},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]=C=>i.value.name=C)},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]=C=>i.value.url=C)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(k,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=C=>i.value.descs=C)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Hr,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=C=>i.value.fields=C)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Yr={class:"unione-props-setting unione-page-setting"},di=Z(n.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref({});return n.onMounted(()=>{t.value=e.editor.define.value}),(i,s)=>{const l=n.resolveComponent("a-form-item"),a=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),c=n.resolveComponent("a-form"),h=n.resolveComponent("a-tab-pane"),f=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Yr,[n.createVNode(f,{type:"card"},{default:n.withCtx(()=>[n.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(c,{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(l,{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(l,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.title,"onUpdate:value":s[0]||(s[0]=u=>t.value.title=u)},null,8,["value"])]),_:1}),n.createVNode(l,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.component,"onUpdate:value":s[1]||(s[1]=u=>t.value.component=u)},null,8,["value"])]),_:1}),n.createVNode(l,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.icon,"onUpdate:value":s[2]||(s[2]=u=>t.value.icon=u)},null,8,["value"])]),_:1}),n.createVNode(l,{label:"是否全局"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":s[3]||(s[3]=u=>t.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(l,{label:"是否模版"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":s[4]||(s[4]=u=>t.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(l,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{value:t.value.descs,"onUpdate:value":s[5]||(s[5]=u=>t.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),n.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Gr,{editor:o.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),vs=Z(n.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new Rt,s=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(l.value,a)});const l=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),l.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+l.value),i.setModel("run"),i.load(l.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(ri,{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(s.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(di,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Xr={class:"form-btns"},Cs=n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},s=new Rt,l=n.computed(()=>s.$widgetList.value||[]),a=n.computed(()=>{const f=s.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 s.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"&&c()}async function d(){const f=s.dataManager().form();let u={};for(let p in f){const b=await f[p].validate();if(s.dataManager().psn()==p){for(let k in u)b[k]=u[k];u=b}else u[p]=b}console.log("=======form data=====",u),s.dataManager().primary().save({data:u,params:s.dataManager().params}).then(p=>{console.log("save result:",p)})}function c(){e.back()}n.watch(()=>t.pageDefine,f=>{f&&s.load(h.value,f)});const h=n.ref("new_");return n.onMounted(()=>{const f=n.inject("route");console.log("unione page view route",f),h.value=t.psn||f?.query?.psn||f?.meta?.psn||"new_",console.log("unione page view,psn:"+h.value),s.setModel(f?.query?.model||f?.meta?.model||"run"),f?.query&&s.dataManager().params(f.query),s.load(h.value,t.pageDefine||i)}),(f,u)=>{const p=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(ri,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(s)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,b=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:n.unref(s)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",Xr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.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(s),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(s)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(di,{editor:n.unref(s)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Ss=n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[{wid:"query-form",widget:"unione-query-form",dataModel:"",configs:{keywords:{},fields:[],labelWidth:8}},{wid:"table-list",widget:"unione-table-list",dataModel:"",configs:{leftBtns:[],rightBtns:[],columns:[],operation:{title:"操作",visible:!0,width:150,btns:[],more:{layout:"horizontal"},count:2}}}],dsnList:[]},component:"unione-page-list"},i=new Rt,s=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(l.value,a)});const l=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),l.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+l.value),i.setModel(a?.query?.model||a?.meta?.model||"run"),i.load(l.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(ri,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.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(di,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),ct={release(o){return W.axios.admin({url:"/api/data/define/release",method:"post",data:o})},find(o){return W.axios.admin({url:"/api/data/define/find",method:"post",data:o})},save(o){return W.axios.admin({url:"/api/data/define/save",method:"post",data:o})},delete(o){return W.axios.admin({url:"/api/data/define/delete",method:"post",data:o})},detail(o){return W.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:o})},loadFromDb(o){return W.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})},impFromDb(o){return W.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})}},Jr={class:"unione-page list-page"},Zr=Z(n.defineComponent({__name:"list",setup(o){const e=Me(),t=W.useDialog(),i=n.inject("router"),s=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),l=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 a=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){a.value.loading=!0,ct.find({page:a.value.pagination.current,pageSize:a.value.pagination.pageSize,body:a.value.params}).then(g=>{a.value.data=g.body,a.value.pagination.total=g.total*1}).finally(()=>{a.value.loading=!1})}function d(g){a.value.pagination.current=g.pagination.current,a.value.pagination.pageSize=g.pagination.pageSize,r()}function c(g){a.value.pagination.current=1,a.value.params=g||{},r()}function h({btn:g,event:m,row:S}){console.log("table btn click",g,m,S),(g.name=="add"||g.name=="edit")&&i.push({path:"/system/data/define/edit",query:S?{id:S.id}:{}}),g.name=="impFromDb"&&(u.value=!0),g.name=="release"&&f(S),g.name=="view"&&i.push({path:e.listPageUrl,query:{psn:S.sn+":list",model:"preview"}})}function f(g){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([g.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}),k=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function v(g){!g||!Object.keys(g).length||!g.dsId||(G.message.loading("数据加载中..."),k.value.params=g,k.value.loading=!0,ct.loadFromDb(g).then(m=>{k.value.loading=!1,G.message.destroy(),m.success?(m.body.forEach(S=>{S.checkable=!!S.id}),k.value.data=m.body,k.value.pagination.total=m.body.length):G.message.error(m.message)}))}function C(g){k.value.pagination.current=g.pagination.current,k.value.pagination.pageSize=g.pagination.pageSize}const y=n.ref();function V({btn:g}){if(g.name!="imp")return;const m=y.value.getSelected();m?.keys?.length?t.confirm({content:"确定导入选中的"+m.keys.length+"条记录么?",onOk:()=>{G.message.loading("数据导入中..."),ct.impFromDb({dsId:k.value.params.dsId,tables:m.keys.join()}).then(S=>{G.message.destroy(),S.success?(t.success({content:S.message}),c()):t.error({context:S.message})})}}):t.error({content:"请选择目标记录!"})}return(g,m)=>{const S=n.resolveComponent("UnioneQuery"),_=n.resolveComponent("UnioneTable"),x=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",Jr,[n.createVNode(S,{widget:s.value,onQuery:c,onReset:c},null,8,["widget"]),n.createVNode(_,{widget:l.value,dataList:a.value.data,loading:a.value.loading,pagination:a.value.pagination,onChange:d,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),n.createVNode(x,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":m[0]||(m[0]=w=>u.value=w),placement:"left"},{default:n.withCtx(()=>[n.createVNode(S,{widget:p.value,onQuery:v,onReset:v,onBtnClick:V,class:"load-table-form"},null,8,["widget"]),n.createVNode(_,{widget:b.value,dataList:k.value.data,loading:k.value.loading,pagination:k.value.pagination,onChange:C,rowKey:"name",ref_key:"loadTableObj",ref:y},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-d7658b67"]]),ed={class:"unione-props-setting data-field-manage"},td={key:0},id={key:1},nd=["onClick"],sd=["onClick"],ld=["onClick"],od={key:1},ad=Z(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){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(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(b=>{i.value.selectedRowKeys.includes(b)||i.value.selectedRowKeys.push(b);const k=[];t.value.forEach(v=>{!p.includes(v.name)&&i.value.selectedRowKeys.includes(v.name)&&k.push(v.name)}),k.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(v=>!k.includes(v)))})}}),s={mounted:p=>p.focus()},l=n.ref({});function a(){const p=Object.keys(l.value);if(p.length)for(let b in p){const k=t.value.filter(v=>v.name==b);if(k&&k[0]){let v=l.value[b];Object.keys(v).forEach(C=>{k[0][C]=v[C]})}}l.value={}}function r(p,b){a();const k={};k[b]=p[b]||"",l.value[p.name]=k}function d(p,b){if(!p||!b){l.value={};return}const k=l.value[p.name][b];if(b=="name"&&t.value.filter(C=>C[b]==k&&C.name!=p.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+k+"]已存在"});return}p[b]=k,l.value={}}function c(p,b){const k=t.value.filter(v=>v.name==p.name)[0];return b=="isFk"?k.configs?.fkey?.enable:k[b]==1}function h(p,b){const k=t.value.filter(v=>v.name==p.name)[0];b=="isFk"?(k.configs||(k.configs={}),k.configs.fkey||(k.configs.fkey={}),k.configs.fkey.enable=!k.configs.fkey.enable):k[b]!=1?k[b]=1:k[b]=0}function f(){if(a(),t.value.filter(k=>k.name=="new_").length>0){l.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),l.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 k=n.resolveComponent("a-button"),v=n.resolveComponent("a-tooltip"),C=n.resolveComponent("a-input"),y=n.resolveComponent("a-input-number"),V=n.resolveComponent("a-select-option"),g=n.resolveComponent("a-select"),m=n.resolveComponent("a-checkbox"),S=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",ed,[n.createVNode(k,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>b[1]||(b[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(k,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:n.withCtx(()=>b[2]||(b[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(S,{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",td,[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",id,[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:x,record:w})=>[["name","title","descs","dataValue"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[w.name]||!Object.keys(l.value[w.name]).includes(_.dataIndex))&&!x&&"empty"]),onClick:B=>r(w,_.dataIndex)},[l.value[w.name]&&Object.keys(l.value[w.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:l.value[w.name][_.dataIndex],"onUpdate:value":B=>l.value[w.name][_.dataIndex]=B,onBlur:B=>d(w,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(x||" "),1)],64))],10,nd)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[w.name]||!Object.keys(l.value[w.name]).includes(_.dataIndex))&&!x&&"empty"]),onClick:B=>r(w,_.dataIndex)},[l.value[w.name]&&Object.keys(l.value[w.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(y,{key:0,value:l.value[w.name][_.dataIndex],"onUpdate:value":B=>l.value[w.name][_.dataIndex]=B,onBlur:B=>d(w,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(x||" "),1)],64))],10,sd)):["dataType"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[w.name]||!Object.keys(l.value[w.name]).includes(_.dataIndex))&&!x&&"empty"]),onClick:B=>r(w,_.dataIndex)},[l.value[w.name]&&Object.keys(l.value[w.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(g,{key:0,value:w[_.dataIndex],"onUpdate:value":B=>w[_.dataIndex]=B,onBlur:b[0]||(b[0]=B=>d())},{default:n.withCtx(()=>[n.createVNode(V,{key:"String",value:"String"}),n.createVNode(V,{key:"Long",value:"Long"}),n.createVNode(V,{key:"Short",value:"Short"}),n.createVNode(V,{key:"Integer",value:"Integer"}),n.createVNode(V,{key:"Float",value:"Float"}),n.createVNode(V,{key:"Double",value:"Double"}),n.createVNode(V,{key:"Date",value:"Date"}),n.createVNode(V,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[s]]):(n.openBlock(),n.createElementBlock("span",od,n.toDisplayString(x),1))],10,ld)):["syncEnable","isFk","isPk"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:3,checked:c(w,_.dataIndex),onClick:B=>h(w,_.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:4,checked:!c(w,_.dataIndex),onClick:B=>h(w,_.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Ns=1024;let rd=0,tn=class{constructor(e,t){this.from=e,this.to=t}};class Y{constructor(e={}){this.id=rd++,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:o=>o.split(" ")}),Y.openedBy=new Y({deserialize:o=>o.split(" ")}),Y.group=new Y({deserialize:o=>o.split(" ")}),Y.isolate=new Y({deserialize:o=>{if(o&&o!="rtl"&&o!="ltr"&&o!="auto")throw new RangeError("Invalid value for isolate: "+o);return o||"auto"}}),Y.contextHash=new Y({perNode:!0}),Y.lookAhead=new Y({perNode:!0}),Y.mounted=new Y({perNode:!0});class ci{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 dd=Object.create(null);class Ce{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):dd,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Ce(e.name||"",t,e.id,i);if(e.props){for(let l of e.props)if(Array.isArray(l)||(l=l(s)),l){if(l[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[l[0].id]=l[1]}}return s}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 s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(Y.group),l=-1;l<(s?s.length:0);l++){let a=t[l<0?i.name:s[l]];if(a)return a}}}}Ce.none=new Ce("",Object.create(null),0,8);class nn{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 s=null;for(let l of e){let a=l(i);a&&(s||(s=Object.assign({},i.props)),s[a[0].id]=a[1])}t.push(s?new Ce(i.name,s,i.id,i.flags):i)}return new nn(t)}}const hi=new WeakMap,Bs=new WeakMap;var fe;(function(o){o[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays"})(fe||(fe={}));class re{constructor(e,t,i,s,l){if(this.type=e,this.children=t,this.positions=i,this.length=s,this.props=null,l&&l.length){this.props=Object.create(null);for(let[a,r]of l)this.props[typeof a=="number"?a:a.id]=r}}toString(){let e=ci.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let s=i.toString();s&&(t&&(t+=","),t+=s)}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 on(this.topNode,e)}cursorAt(e,t=0,i=0){let s=hi.get(this)||this.topNode,l=new on(s);return l.moveTo(e,t),hi.set(this,l._tree),l}get topNode(){return new Ve(this,0,0,null)}resolve(e,t=0){let i=Lt(hi.get(this)||this.topNode,e,t,!1);return hi.set(this,i),i}resolveInner(e,t=0){let i=Lt(Bs.get(this)||this.topNode,e,t,!0);return Bs.set(this,i),i}resolveStack(e,t=0){return fd(this,e,t)}iterate(e){let{enter:t,leave:i,from:s=0,to:l=this.length}=e,a=e.mode||0,r=(a&fe.IncludeAnonymous)>0;for(let d=this.cursor(a|fe.IncludeAnonymous);;){let c=!1;if(d.from<=l&&d.to>=s&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;c=!0}for(;c&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;c=!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:rn(Ce.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new re(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new re(Ce.none,t,i,s)))}static build(e){return ud(e)}}re.empty=new re(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],s=this.set.types[t],l=s.name;if(/\W/.test(l)&&!s.isError&&(l=JSON.stringify(l)),e+=4,i==e)return l;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return l+"("+a.join(",")+")"}findChild(e,t,i,s,l){let{buffer:a}=this,r=-1;for(let d=e;d!=t&&!(Os(l,s,a[d+1],a[d+2])&&(r=d,i>0));d=a[d+3]);return r}slice(e,t,i){let s=this.buffer,l=new Uint16Array(t-e),a=0;for(let r=e,d=0;r<t;){l[d++]=s[r++],l[d++]=s[r++]-i;let c=l[d++]=s[r++]-i;l[d++]=s[r++]-e,a=Math.max(a,c)}return new Ze(l,a,this.set)}}function Os(o,e,t,i){switch(o){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 Lt(o,e,t,i){for(var s;o.from==o.to||(t<1?o.from>=e:o.from>e)||(t>-1?o.to<=e:o.to<e);){let a=!i&&o instanceof Ve&&o.index<0?null:o.parent;if(!a)return o;o=a}let l=i?0:fe.IgnoreOverlays;if(i)for(let a=o,r=a.parent;r;a=r,r=a.parent)a instanceof Ve&&a.index<0&&((s=r.enter(e,t,l))===null||s===void 0?void 0:s.from)!=a.from&&(o=r);for(;;){let a=o.enter(e,t,l);if(!a)return o;o=a}}class Vs{cursor(e=0){return new on(this,e)}getChild(e,t=null,i=null){let s=_s(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return _s(this,e,t,i)}resolve(e,t=0){return Lt(this,e,t,!1)}resolveInner(e,t=0){return Lt(this,e,t,!0)}matchContext(e){return ln(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(i=t,t=s.prevSibling):t=s}return i}get node(){return this}get next(){return this.parent}}class Ve extends Vs{constructor(e,t,i,s){super(),this._tree=e,this.from=t,this.index=i,this._parent=s}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,s,l=0){for(let a=this;;){for(let{children:r,positions:d}=a._tree,c=t>0?r.length:-1;e!=c;e+=t){let h=r[e],f=d[e]+a.from;if(Os(s,i,f,f+h.length)){if(h instanceof Ze){if(l&fe.ExcludeBuffers)continue;let u=h.findChild(0,h.buffer.length,t,i-f,s);if(u>-1)return new et(new cd(a,h,e,f),null,u)}else if(l&fe.IncludeAnonymous||!h.type.isAnonymous||an(h)){let u;if(!(l&fe.IgnoreMounts)&&(u=ci.get(h))&&!u.overlay)return new Ve(u.tree,f,e,a);let p=new Ve(h,f,e,a);return l&fe.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?h.children.length-1:0,t,i,s)}}}if(l&fe.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))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 s;if(!(i&fe.IgnoreOverlays)&&(s=ci.get(this._tree))&&s.overlay){let l=e-this.from;for(let{from:a,to:r}of s.overlay)if((t>0?a<=l:a<l)&&(t<0?r>=l:r>l))return new Ve(s.tree,s.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 _s(o,e,t,i){let s=o.cursor(),l=[];if(!s.firstChild())return l;if(t!=null){for(let a=!1;!a;)if(a=s.type.is(t),!s.nextSibling())return l}for(;;){if(i!=null&&s.type.is(i))return l;if(s.type.is(e)&&l.push(s.node),!s.nextSibling())return i==null?l:[]}}function ln(o,e,t=e.length-1){for(let i=o.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 cd{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class et extends Vs{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:s}=this.context,l=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return l<0?null:new et(this.context,this,l)}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:s}=this.context,l=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return l<0?null:new et(this.context,this,l)}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,s=this.index+4,l=i.buffer[this.index+3];if(l>s){let a=i.buffer[this.index+1];e.push(i.slice(s,l,a)),t.push(0)}return new re(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function As(o){if(!o.length)return null;let e=0,t=o[0];for(let l=1;l<o.length;l++){let a=o[l];(a.from>t.from||a.to<t.to)&&(t=a,e=l)}let i=t instanceof Ve&&t.index<0?null:t.parent,s=o.slice();return i?s[e]=i:s.splice(e,1),new hd(s,t)}class hd{constructor(e,t){this.heads=e,this.node=t}get next(){return As(this.heads)}}function fd(o,e,t){let i=o.resolveInner(e,t),s=null;for(let l=i instanceof Ve?i:i.context.parent;l;l=l.parent)if(l.index<0){let a=l.parent;(s||(s=[i])).push(a.resolve(e,t)),l=a}else{let a=ci.get(l.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let r=new Ve(a.tree,a.overlay[0].from+l.from,-1,l);(s||(s=[i])).push(Lt(r,e,t,!1))}}return s?As(s):i}class on{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:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.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:s}=this.buffer,l=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return l<0?!1:(this.stack.push(this.index),this.yieldBuf(l))}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 s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}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:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let l=0;l<this.index;l++)if(s.buffer.buffer[l+3]<this.index)return!1;({index:t,parent:i}=s)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let l=t+e,a=e<0?-1:i._tree.children.length;l!=a;l+=e){let r=i._tree.children[l];if(this.mode&fe.IncludeAnonymous||r instanceof Ze||!r.type.isAnonymous||an(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 s=this.index,l=this.stack.length;l>=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;t=a,i=l+1;break e}s=this.stack[--l]}for(let s=i;s<this.stack.length;s++)t=new et(this.buffer,t,this.stack[s]);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 s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(s=!0)}for(;s&&t&&t(this),s=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,s=!0}}}matchContext(e){if(!this.buffer)return ln(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let s=e.length-1,l=this.stack.length-1;s>=0;l--){if(l<0)return ln(this.node,e,s);let a=i[t.buffer[this.stack[l]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function an(o){return o.children.some(e=>e instanceof Ze||!e.type.isAnonymous||an(e))}function ud(o){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Ns,reused:l=[],minRepeatType:a=i.types.length}=o,r=Array.isArray(t)?new sn(t,t.length):t,d=i.types,c=0,h=0;function f(m,S,_,x,w,B){let{id:A,start:O,end:D,size:M}=r,E=h;for(;M<0;)if(r.next(),M==-1){let L=l[A];_.push(L),x.push(O-m);return}else if(M==-3){c=A;return}else if(M==-4){h=A;return}else throw new RangeError(`Unrecognized record size: ${M}`);let z=d[A],P,I,H=O-m;if(D-O<=s&&(I=v(r.pos-S,w))){let L=new Uint16Array(I.size-I.skip),N=r.pos-I.size,Q=L.length;for(;r.pos>N;)Q=C(I.start,L,Q);P=new Ze(L,D-I.start,i),H=I.start-m}else{let L=r.pos-M;r.next();let N=[],Q=[],T=A>=a?A:-1,j=0,he=D;for(;r.pos>L;)T>=0&&r.id==T&&r.size>=0?(r.end<=he-s&&(b(N,Q,O,j,r.end,he,T,E),j=N.length,he=r.end),r.next()):B>2500?u(O,L,N,Q):f(O,L,N,Q,T,B+1);if(T>=0&&j>0&&j<N.length&&b(N,Q,O,j,O,he,T,E),N.reverse(),Q.reverse(),T>-1&&j>0){let Xi=p(z);P=rn(z,N,Q,0,N.length,0,D-O,Xi,Xi)}else P=k(z,N,Q,D-O,E-D)}_.push(P),x.push(H)}function u(m,S,_,x){let w=[],B=0,A=-1;for(;r.pos>S;){let{id:O,start:D,end:M,size:E}=r;if(E>4)r.next();else{if(A>-1&&D<A)break;A<0&&(A=M-s),w.push(O,D,M),B++,r.next()}}if(B){let O=new Uint16Array(B*4),D=w[w.length-2];for(let M=w.length-3,E=0;M>=0;M-=3)O[E++]=w[M],O[E++]=w[M+1]-D,O[E++]=w[M+2]-D,O[E++]=E;_.push(new Ze(O,w[2]-D,i)),x.push(D-m)}}function p(m){return(S,_,x)=>{let w=0,B=S.length-1,A,O;if(B>=0&&(A=S[B])instanceof re){if(!B&&A.type==m&&A.length==x)return A;(O=A.prop(Y.lookAhead))&&(w=_[B]+A.length+O)}return k(m,S,_,x,w)}}function b(m,S,_,x,w,B,A,O){let D=[],M=[];for(;m.length>x;)D.push(m.pop()),M.push(S.pop()+_-w);m.push(k(i.types[A],D,M,B-w,O-B)),S.push(w-_)}function k(m,S,_,x,w=0,B){if(c){let A=[Y.contextHash,c];B=B?[A].concat(B):[A]}if(w>25){let A=[Y.lookAhead,w];B=B?[A].concat(B):[A]}return new re(m,S,_,x,B)}function v(m,S){let _=r.fork(),x=0,w=0,B=0,A=_.end-s,O={size:0,start:0,skip:0};e:for(let D=_.pos-m;_.pos>D;){let M=_.size;if(_.id==S&&M>=0){O.size=x,O.start=w,O.skip=B,B+=4,x+=4,_.next();continue}let E=_.pos-M;if(M<0||E<D||_.start<A)break;let z=_.id>=a?4:0,P=_.start;for(_.next();_.pos>E;){if(_.size<0)if(_.size==-3)z+=4;else break e;else _.id>=a&&(z+=4);_.next()}w=P,x+=M,B+=z}return(S<0||x==m)&&(O.size=x,O.start=w,O.skip=B),O.size>4?O:void 0}function C(m,S,_){let{id:x,start:w,end:B,size:A}=r;if(r.next(),A>=0&&x<a){let O=_;if(A>4){let D=r.pos-(A-4);for(;r.pos>D;)_=C(m,S,_)}S[--_]=O,S[--_]=B-m,S[--_]=w-m,S[--_]=x}else A==-3?c=x:A==-4&&(h=x);return _}let y=[],V=[];for(;r.pos>0;)f(o.start||0,o.bufferStart||0,y,V,-1,0);let g=(e=o.length)!==null&&e!==void 0?e:y.length?V[0]+y[0].length:0;return new re(d[o.topID],y.reverse(),V.reverse(),g)}const Ts=new WeakMap;function fi(o,e){if(!o.isAnonymous||e instanceof Ze||e.type!=o)return 1;let t=Ts.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=o||!(i instanceof re)){t=1;break}t+=fi(o,i)}Ts.set(e,t)}return t}function rn(o,e,t,i,s,l,a,r,d){let c=0;for(let b=i;b<s;b++)c+=fi(o,e[b]);let h=Math.ceil(c*1.5/8),f=[],u=[];function p(b,k,v,C,y){for(let V=v;V<C;){let g=V,m=k[V],S=fi(o,b[V]);for(V++;V<C;V++){let _=fi(o,b[V]);if(S+_>=h)break;S+=_}if(V==g+1){if(S>h){let _=b[g];p(_.children,_.positions,0,_.children.length,k[g]+y);continue}f.push(b[g])}else{let _=k[V-1]+b[V-1].length-m;f.push(rn(o,b,k,g,V,m,_,null,d))}u.push(m+y-l)}}return p(e,t,i,s,0),(r||d)(f,u,a)}class ht{constructor(e,t,i,s,l=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(l?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new ht(0,e.length,e,0,!1,i)];for(let l of t)l.to>e.length&&s.push(l);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],l=1,a=e.length?e[0]:null;for(let r=0,d=0,c=0;;r++){let h=r<t.length?t[r]:null,f=h?h.fromA:1e9;if(f-d>=i)for(;a&&a.from<f;){let u=a;if(d>=u.from||f<=u.to||c){let p=Math.max(u.from,d)-c,b=Math.min(u.to,f)-c;u=p>=b?null:new ht(p,b,u.tree,u.offset+c,r>0,!!h)}if(u&&s.push(u),a.to>f)break;a=l<e.length?e[l++]:null}if(!h)break;d=h.toA,c=h.toA-h.toB}return s}}class Ms{startParse(e,t,i){return typeof e=="string"&&(e=new pd(e)),i=i?i.length?i.map(s=>new tn(s.from,s.to)):[new tn(0,0)]:[new tn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let l=s.advance();if(l)return l}}}class pd{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 ui{constructor(e,t,i,s,l,a,r,d,c,h=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=l,this.score=a,this.buffer=r,this.bufferBase=d,this.curContext=c,this.lookAhead=h,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 s=e.parser.context;return new ui(e,[],t,i,i,0,[],0,s?new Es(s,s.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,s=e&65535,{parser:l}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let r=l.dynamicPrecedence(s);if(r&&(this.score+=r),i==0){this.pushState(l.getGoto(this.state,s,!0),this.reducePos),s<l.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(s,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),c=d?this.stack[d-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let f=d?this.stack[d-1]:0,u=this.bufferBase+this.buffer.length-f;if(s<l.minRepeatTerm||e&131072){let p=l.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,c,p,u+4,!0)}if(e&262144)this.state=this.stack[d];else{let p=this.stack[d-3];this.state=l.getGoto(p,s,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(s,c)}storeNode(e,t,i,s=4,l=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,r=this.buffer.length;if(r==0&&a.parent&&(r=a.bufferBase-a.parent.bufferBase,a=a.parent),r>0&&a.buffer[r-4]==0&&a.buffer[r-1]>-1){if(t==i)return;if(a.buffer[r-2]>=t){a.buffer[r-2]=i;return}}}if(!l||this.pos==i)this.buffer.push(e,t,i,s);else{let a=this.buffer.length;if(a>0&&this.buffer[a-4]!=0){let r=!1;for(let d=a;d>0&&this.buffer[d-2]>i;d-=4)if(this.buffer[d-1]>=0){r=!0;break}if(r)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4);else{let l=e,{parser:a}=this.p;(s>this.pos||t<=a.maxNode)&&(this.pos=s,a.stateFlag(l,1)||(this.reducePos=s)),this.pushState(l,i),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,s,4)}}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,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),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new ui(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,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 md(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 s=[];for(let l=0,a;l<t.length;l+=2)(a=t[l+1])!=this.state&&this.p.parser.hasAction(a,e)&&s.push(t[l],a);if(this.stack.length<120)for(let l=0;s.length<8&&l<t.length;l+=2){let a=t[l+1];s.some((r,d)=>d&1&&r==a)||s.push(t[l],a)}t=s}let i=[];for(let s=0;s<t.length&&i.length<4;s+=2){let l=t[s+1];if(l==this.state)continue;let a=this.split();a.pushState(l,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[s],this.pos),a.reducePos=this.pos,a.score-=200,i.push(a)}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,s=t&65535,l=this.stack.length-i*3;if(l<0||e.getGoto(this.stack[l],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}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=(s,l)=>{if(!t.includes(s))return t.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let r=(a>>19)-l;if(r>1){let d=a&65535,c=this.stack.length-r*3;if(c>=0&&e.getGoto(this.stack[c],d,!1)>=0)return r<<19|65536|d}}else{let r=i(a,l+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 Es(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 Es{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class md{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 s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class pi{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 pi(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 pi(this.stack,this.pos,this.index)}}function mi(o,e=Uint16Array){if(typeof o!="string")return o;let t=null;for(let i=0,s=0;i<o.length;){let l=0;for(;;){let a=o.charCodeAt(i++),r=!1;if(a==126){l=65535;break}a>=92&&a--,a>=34&&a--;let d=a-32;if(d>=46&&(d-=46,r=!0),l+=d,r)break;l*=46}t?t[s++]=l:t=new e(l)}return t}class gi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Is=new gi;class gd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Is,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,s=this.rangeIndex,l=this.pos+e;for(;l<i.from;){if(!s)return null;let a=this.ranges[--s];l-=i.from-a.to,i=a}for(;t<0?l>i.to:l>=i.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];l+=a.from-i.to,i=a}return l}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,s;if(t>=0&&t<this.chunk.length)i=this.pos+e,s=this.chunk.charCodeAt(t);else{let l=this.resolveOffset(e,1);if(l==null)return-1;if(i=l,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let a=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}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=Is,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 s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class yt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;kd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}yt.prototype.contextual=yt.prototype.fallback=yt.prototype.extend=!1,yt.prototype.fallback=yt.prototype.extend=!1;function kd(o,e,t,i,s,l){let a=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&o[a];){let c=o[a+1];for(let p=a+3;p<c;p+=2)if((o[p+1]&r)>0){let b=o[p];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||bd(b,e.token.value,s,l))){e.acceptToken(b);break}}let h=e.next,f=0,u=o[a+2];if(e.next<0&&u>f&&o[c+u*3-3]==65535){a=o[c+u*3-1];continue e}for(;f<u;){let p=f+u>>1,b=c+p+(p<<1),k=o[b],v=o[b+1]||65536;if(h<k)u=p;else if(h>=v)f=p+1;else{a=o[b+2],e.advance();continue e}}break}}function Ds(o,e,t){for(let i=e,s;(s=o[i])!=65535;i++)if(s==t)return i-e;return-1}function bd(o,e,t,i){let s=Ds(t,i,e);return s<0||Ds(t,i,o)<s}const Ne=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let dn=null;function Ps(o,e,t){let i=o.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(o.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:o.length}}class wd{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?Ps(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ps(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],s=this.index[t];if(s==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let l=i.children[s],a=this.start[t]+i.positions[s];if(a>e)return this.nextStart=a,null;if(l instanceof re){if(a==e){if(a<this.safeFrom)return null;let r=a+l.length;if(r<=this.safeTo){let d=l.prop(Y.lookAhead);if(!d||r+d<this.fragment.to)return l}}this.index[t]++,a+l.length>=Math.max(this.safeFrom,e)&&(this.trees.push(l),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+l.length}}}class yd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new gi)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:l}=s,a=s.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let c=0;c<l.length;c++){if(!(1<<c&a))continue;let h=l[c],f=this.tokens[c];if(!(i&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=a||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=a,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),!h.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 gi,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 gi,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:l}=i.p;for(let a=0;a<l.specialized.length;a++)if(l.specialized[a]==e.value){let r=l.specializers[a](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(s+1)}putAction(e,t,i,s){for(let l=0;l<s;l+=3)if(this.actions[l]==e)return s;return this.actions[s++]=e,this.actions[s++]=t,this.actions[s++]=i,s}addActions(e,t,i,s){let{state:l}=e,{parser:a}=e.p,{data:r}=a;for(let d=0;d<2;d++)for(let c=a.stateSlot(l,d?2:1);;c+=3){if(r[c]==65535)if(r[c+1]==1)c=He(r,c+2);else{s==0&&r[c+1]==2&&(s=this.putAction(He(r,c+2),t,i,s));break}r[c]==t&&(s=this.putAction(He(r,c+1),t,i,s))}return s}}class xd{constructor(e,t,i,s){this.parser=e,this.input=t,this.ranges=s,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 gd(t,s),this.tokens=new yd(e,this.stream),this.topTerm=e.top[1];let{from:l}=s[0];this.stacks=[ui.start(this,e.top[0],l)],this.fragments=i.length&&this.stream.end-l>e.bufferLength*4?new wd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,l;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let r=e[a];for(;;){if(this.tokens.mainToken=null,r.pos>t)i.push(r);else{if(this.advanceStack(r,i,e))continue;{s||(s=[],l=[]),s.push(r);let d=this.tokens.getMainToken(r);l.push(d.value,d.end)}}break}}if(!i.length){let a=s&&Cd(s);if(a)return Ne&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Ne&&s&&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&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,l,i);if(a)return Ne&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((r,d)=>d.score-r.score);i.length>a;)i.pop();i.some(r=>r.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a<i.length-1;a++){let r=i[a];for(let d=a+1;d<i.length;d++){let c=i[d];if(r.sameState(c)||r.buffer.length>500&&c.buffer.length>500)if((r.score-c.score||r.buffer.length-c.buffer.length)>0)i.splice(d--,1);else{i.splice(a--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let a=1;a<i.length;a++)i[a].pos<this.minStackPos&&(this.minStackPos=i[a].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 s=e.pos,{parser:l}=this,a=Ne?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?l.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!c||(f.prop(Y.contextHash)||0)==h))return e.useNode(f,u),Ne&&console.log(a+this.stackID(e)+` (via reuse of ${l.getName(f.type.id)})`),!0;if(!(f instanceof re)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof re&&f.positions[0]==0)f=p;else break}}let r=l.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ne&&console.log(a+this.stackID(e)+` (via always-reduce ${l.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let c=0;c<d.length;){let h=d[c++],f=d[c++],u=d[c++],p=c==d.length||!i,b=p?e:e.split(),k=this.tokens.mainToken;if(b.apply(h,f,k?k.start:b.pos,u),Ne&&console.log(a+this.stackID(b)+` (via ${h&65536?`reduce of ${l.getName(h&65535)}`:"shift"} for ${l.getName(f)} @ ${s}${b==e?"":", split"})`),p)return!0;b.pos>s?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 $s(e,t),!0}}runRecovery(e,t,i){let s=null,l=!1;for(let a=0;a<e.length;a++){let r=e[a],d=t[a<<1],c=t[(a<<1)+1],h=Ne?this.stackID(r)+" -> ":"";if(r.deadEnd&&(l||(l=!0,r.restart(),Ne&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),u=h;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(h+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,i);this.stream.end>r.pos?(c==r.pos&&(c++,d=0),r.recoverByDelete(d,c),Ne&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),$s(r,i)):(!s||s.score<r.score)&&(s=r)}return s}stackToTree(e){return e.close(),re.build({buffer:pi.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=(dn||(dn=new WeakMap)).get(e);return t||dn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function $s(o,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==o.pos&&i.sameState(o)){e[t].score<o.score&&(e[t]=o);return}}e.push(o)}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 ki extends Ms{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]),s=[];for(let r=0;r<t.length;r++)s.push([]);function l(r,d,c){s[r].push([d,d.deserialize(String(c))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=Y[d]);for(let c=1;c<r.length;){let h=r[c++];if(h>=0)l(h,d,r[c++]);else{let f=r[c+-h];for(let u=-h;u>0;u--)l(r[c++],d,f);c++}}}this.nodeSet=new nn(t.map((r,d)=>Ce.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:s[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=Ns;let a=mi(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(Fs),this.states=mi(e.states,Uint32Array),this.data=mi(e.stateData),this.goto=mi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new yt(a,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 s=new xd(this,e,t,i);for(let l of this.wrappers)s=l(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let l=s[t+1];;){let a=s[l++],r=a&1,d=s[l++];if(r&&i)return d;for(let c=l+(a>>1);l<c;l++)if(s[l]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let s=0;s<2;s++)for(let l=this.stateSlot(e,s?2:1),a;;l+=3){if((a=i[l])==65535)if(i[l+1]==1)a=i[l=He(i,l+2)];else{if(i[l+1]==2)return He(i,l+2);break}if(a==t||a==0)return He(i,l+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),s=i?t(i):void 0;for(let l=this.stateSlot(e,1);s==null;l+=3){if(this.data[l]==65535)if(this.data[l+1]==1)l=He(this.data,l+2);else break;s=t(He(this.data,l+1))}return s}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 s=this.data[i+1];t.some((l,a)=>a&1&&l==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(ki.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 s=e.tokenizers.find(l=>l.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let l=e.specializers.find(r=>r.from==i.external);if(!l)return i;let a=Object.assign(Object.assign({},i),{external:l.to});return t.specializers[s]=Fs(a),a})),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 l of e.split(" ")){let a=t.indexOf(l);a>=0&&(i[a]=!0)}let s=null;for(let l=0;l<t.length;l++)if(!i[l])for(let a=this.dialects[t[l]],r;(r=this.data[a++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[r]=1;return new vd(e,i,s)}static deserialize(e){return new ki(e)}}function He(o,e){return o[e]|o[e+1]<<16}function Cd(o){let e=null;for(let t of o){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 Fs(o){if(o.external){let e=o.extend?1:0;return(t,i)=>o.external(t,i)<<1|e}return o.get}let Sd=0;class _e{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=Sd++}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 s=new _e(i,[],null,[]);if(s.set.push(s),t)for(let l of t.set)s.set.push(l);return s}static defineModifier(e){let t=new bi(e);return i=>i.modified.indexOf(t)>-1?i:bi.get(i.base||i,i.modified.concat(t).sort((s,l)=>s.id-l.id))}}let Nd=0;class bi{constructor(e){this.name=e,this.instances=[],this.id=Nd++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Bd(t,r.modified));if(i)return i;let s=[],l=new _e(e.name,s,e,t);for(let r of t)r.instances.push(l);let a=Od(t);for(let r of e.set)if(!r.modified.length)for(let d of a)s.push(bi.get(r,d));return l}}function Bd(o,e){return o.length==e.length&&o.every((t,i)=>t==e[i])}function Od(o){let e=[[]];for(let t=0;t<o.length;t++)for(let i=0,s=e.length;i<s;i++)e.push(e[i].concat(o[t]));return e.sort((t,i)=>i.length-t.length)}function Rs(o){let e=Object.create(null);for(let t in o){let i=o[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let l=[],a=2,r=s;for(let f=0;;){if(r=="..."&&f>0&&f+3==s.length){a=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+s);if(l.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let p=s[f++];if(f==s.length&&p=="!"){a=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);r=s.slice(f)}let d=l.length-1,c=l[d];if(!c)throw new RangeError("Invalid path: "+s);let h=new cn(i,a,d>0?l.slice(0,d):null);e[c]=h.sort(e[c])}}return Vd.add(e)}const Vd=new Y;class cn{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}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}}cn.empty=new cn([],2,null);function Ls(o,e){let t=Object.create(null);for(let l of o)if(!Array.isArray(l.tag))t[l.tag.id]=l.class;else for(let a of l.tag)t[a.id]=l.class;let{scope:i,all:s=null}=e||{};return{style:l=>{let a=s;for(let r of l)for(let d of r.set){let c=t[d.id];if(c){a=a?a+" "+c:c;break}}return a},scope:i}}const R=_e.define,wi=R(),tt=R(),js=R(tt),zs=R(tt),it=R(),yi=R(it),hn=R(it),Pe=R(),ft=R(Pe),$e=R(),Fe=R(),fn=R(),jt=R(fn),xi=R(),$={comment:wi,lineComment:R(wi),blockComment:R(wi),docComment:R(wi),name:tt,variableName:R(tt),typeName:js,tagName:R(js),propertyName:zs,attributeName:R(zs),className:R(tt),labelName:R(tt),namespace:R(tt),macroName:R(tt),literal:it,string:yi,docString:R(yi),character:R(yi),attributeValue:R(yi),number:hn,integer:R(hn),float:R(hn),bool:R(it),regexp:R(it),escape:R(it),color:R(it),url:R(it),keyword:$e,self:R($e),null:R($e),atom:R($e),unit:R($e),modifier:R($e),operatorKeyword:R($e),controlKeyword:R($e),definitionKeyword:R($e),moduleKeyword:R($e),operator:Fe,derefOperator:R(Fe),arithmeticOperator:R(Fe),logicOperator:R(Fe),bitwiseOperator:R(Fe),compareOperator:R(Fe),updateOperator:R(Fe),definitionOperator:R(Fe),typeOperator:R(Fe),controlOperator:R(Fe),punctuation:fn,separator:R(fn),bracket:jt,angleBracket:R(jt),squareBracket:R(jt),paren:R(jt),brace:R(jt),content:Pe,heading:ft,heading1:R(ft),heading2:R(ft),heading3:R(ft),heading4:R(ft),heading5:R(ft),heading6:R(ft),contentSeparator:R(Pe),list:R(Pe),quote:R(Pe),emphasis:R(Pe),strong:R(Pe),link:R(Pe),monospace:R(Pe),strikethrough:R(Pe),inserted:R(),deleted:R(),changed:R(),invalid:R(),meta:xi,documentMeta:R(xi),annotation:R(xi),processingInstruction:R(xi),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 o in $){let e=$[o];e instanceof _e&&(e.name=o)}Ls([{tag:$.link,class:"tok-link"},{tag:$.heading,class:"tok-heading"},{tag:$.emphasis,class:"tok-emphasis"},{tag:$.strong,class:"tok-strong"},{tag:$.keyword,class:"tok-keyword"},{tag:$.atom,class:"tok-atom"},{tag:$.bool,class:"tok-bool"},{tag:$.url,class:"tok-url"},{tag:$.labelName,class:"tok-labelName"},{tag:$.inserted,class:"tok-inserted"},{tag:$.deleted,class:"tok-deleted"},{tag:$.literal,class:"tok-literal"},{tag:$.string,class:"tok-string"},{tag:$.number,class:"tok-number"},{tag:[$.regexp,$.escape,$.special($.string)],class:"tok-string2"},{tag:$.variableName,class:"tok-variableName"},{tag:$.local($.variableName),class:"tok-variableName tok-local"},{tag:$.definition($.variableName),class:"tok-variableName tok-definition"},{tag:$.special($.variableName),class:"tok-variableName2"},{tag:$.definition($.propertyName),class:"tok-propertyName tok-definition"},{tag:$.typeName,class:"tok-typeName"},{tag:$.namespace,class:"tok-namespace"},{tag:$.className,class:"tok-className"},{tag:$.macroName,class:"tok-macroName"},{tag:$.propertyName,class:"tok-propertyName"},{tag:$.operator,class:"tok-operator"},{tag:$.comment,class:"tok-comment"},{tag:$.meta,class:"tok-meta"},{tag:$.invalid,class:"tok-invalid"},{tag:$.punctuation,class:"tok-punctuation"}]);const _d=Rs({String:$.string,Number:$.number,"True False":$.bool,PropertyName:$.propertyName,Null:$.null,",":$.separator,"[ ]":$.squareBracket,"{ }":$.brace}),Ad=ki.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:[_d],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]=xt(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Re.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=xt(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),s=new zt(this),l=new zt(e);for(let a=t,r=t;;){if(s.next(a),l.next(a),a=0,s.lineBreak!=l.lineBreak||s.done!=l.done||s.value!=l.value)return!1;if(r+=s.value.length,s.done||r>=i)return!0}}iter(e=1){return new zt(this,e)}iterRange(e,t=this.length){return new Us(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ws(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 ae(e):Re.from(ae.split(e,[]))}}class ae extends X{constructor(e,t=Td(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let l=0;;l++){let a=this.text[l],r=s+a.length;if((t?i:r)>=e)return new Md(s,r,i,a);s=r+1,i++}}decompose(e,t,i,s){let l=e<=0&&t>=this.length?this:new ae(qs(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let a=i.pop(),r=vi(l.text,a.text.slice(),0,l.length);if(r.length<=32)i.push(new ae(r,a.length+l.length));else{let d=r.length>>1;i.push(new ae(r.slice(0,d)),new ae(r.slice(d)))}}else i.push(l)}replace(e,t,i){if(!(i instanceof ae))return super.replace(e,t,i);[e,t]=xt(this,e,t);let s=vi(this.text,vi(i.text,qs(this.text,0,e)),t),l=this.length+i.length-(t-e);return s.length<=32?new ae(s,l):Re.from(ae.split(s,[]),l)}sliceString(e,t=this.length,i=`
2
+ `){[e,t]=xt(this,e,t);let s="";for(let l=0,a=0;l<=t&&a<this.text.length;a++){let r=this.text[a],d=l+r.length;l>e&&a&&(s+=i),e<d&&t>l&&(s+=r.slice(Math.max(0,e-l),t-l)),l=d+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let l of e)i.push(l),s+=l.length+1,i.length==32&&(t.push(new ae(i,s)),i=[],s=-1);return s>-1&&t.push(new ae(i,s)),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,s){for(let l=0;;l++){let a=this.children[l],r=s+a.length,d=i+a.lines-1;if((t?d:r)>=e)return a.lineInner(e,t,i,s);s=r+1,i=d+1}}decompose(e,t,i,s){for(let l=0,a=0;a<=t&&l<this.children.length;l++){let r=this.children[l],d=a+r.length;if(e<=d&&t>=a){let c=s&((a<=e?1:0)|(d>=t?2:0));a>=e&&d<=t&&!c?i.push(r):r.decompose(e-a,t-a,i,c)}a=d+1}}replace(e,t,i){if([e,t]=xt(this,e,t),i.lines<this.lines)for(let s=0,l=0;s<this.children.length;s++){let a=this.children[s],r=l+a.length;if(e>=l&&t<=r){let d=a.replace(e-l,t-l,i),c=this.lines-a.lines+d.lines;if(d.lines<c>>4&&d.lines>c>>6){let h=this.children.slice();return h[s]=d,new Re(h,this.length-(t-e)+i.length)}return super.replace(l,r,d)}l=r+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
+ `){[e,t]=xt(this,e,t);let s="";for(let l=0,a=0;l<this.children.length&&a<=t;l++){let r=this.children[l],d=a+r.length;a>e&&l&&(s+=i),e<d&&t>a&&(s+=r.sliceString(e-a,t-a,i)),a=d+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Re))return 0;let i=0,[s,l,a,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,l+=t){if(s==a||l==r)return i;let d=this.children[s],c=e.children[l];if(d!=c)return i+d.scanIdentical(c,t);i+=d.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let p of e)i+=p.lines;if(i<32){let p=[];for(let b of e)b.flatten(p);return new ae(p,t)}let s=Math.max(32,i>>5),l=s<<1,a=s>>1,r=[],d=0,c=-1,h=[];function f(p){let b;if(p.lines>l&&p instanceof Re)for(let k of p.children)f(k);else p.lines>a&&(d>a||!d)?(u(),r.push(p)):p instanceof ae&&d&&(b=h[h.length-1])instanceof ae&&p.lines+b.lines<=32?(d+=p.lines,c+=p.length+1,h[h.length-1]=new ae(b.text.concat(p.text),b.length+1+p.length)):(d+p.lines>s&&u(),d+=p.lines,c+=p.length+1,h.push(p))}function u(){d!=0&&(r.push(h.length==1?h[0]:Re.from(h,c)),c=-1,d=h.length=0)}for(let p of e)f(p);return u(),r.length==1?r[0]:new Re(r,t)}}X.empty=new ae([""],0);function Td(o){let e=-1;for(let t of o)e+=t.length+1;return e}function vi(o,e,t=0,i=1e9){for(let s=0,l=0,a=!0;l<o.length&&s<=i;l++){let r=o[l],d=s+r.length;d>=t&&(d>i&&(r=r.slice(0,i-s)),s<t&&(r=r.slice(t-s)),a?(e[e.length-1]+=r,a=!1):e.push(r)),s=d+1}return e}function qs(o,e,t){return vi(o,[""],e,t)}class zt{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 ae?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],l=this.offsets[i],a=l>>1,r=s instanceof ae?s.text.length:s.children.length;if(a==(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((l&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
+ `,this;e--}else if(s instanceof ae){let d=s.text[a+(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=s.children[a+(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 ae?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 Us{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new zt(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:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.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 Ws{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=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=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(X.prototype[Symbol.iterator]=function(){return this.iter()},zt.prototype[Symbol.iterator]=Us.prototype[Symbol.iterator]=Ws.prototype[Symbol.iterator]=function(){return this});class Md{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function xt(o,e,t){return e=Math.max(0,Math.min(o.length,e)),[e,Math.max(e,Math.min(o.length,t))]}let vt="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(o=>o?parseInt(o,36):1);for(let o=1;o<vt.length;o++)vt[o]+=vt[o-1];function Ed(o){for(let e=1;e<vt.length;e+=2)if(vt[e]>o)return vt[e-1]<=o;return!1}function Hs(o){return o>=127462&&o<=127487}const Ks=8205;function Ke(o,e,t=!0,i=!0){return(t?Qs:Id)(o,e,i)}function Qs(o,e,t){if(e==o.length)return e;e&&Gs(o.charCodeAt(e))&&Ys(o.charCodeAt(e-1))&&e--;let i=un(o,e);for(e+=Xs(i);e<o.length;){let s=un(o,e);if(i==Ks||s==Ks||t&&Ed(s))e+=Xs(s),i=s;else if(Hs(s)){let l=0,a=e-2;for(;a>=0&&Hs(un(o,a));)l++,a-=2;if(l%2==0)break;e+=2}else break}return e}function Id(o,e,t){for(;e>0;){let i=Qs(o,e-2,t);if(i<e)return i;e--}return 0}function Gs(o){return o>=56320&&o<57344}function Ys(o){return o>=55296&&o<56320}function un(o,e){let t=o.charCodeAt(e);if(!Ys(t)||e+1==o.length)return t;let i=o.charCodeAt(e+1);return Gs(i)?(t-55296<<10)+(i-56320)+65536:t}function Xs(o){return o<65536?1:2}const pn=/\r\n?|\n/;var Be=function(o){return o[o.Simple=0]="Simple",o[o.TrackDel=1]="TrackDel",o[o.TrackBefore=2]="TrackBefore",o[o.TrackAfter=3]="TrackAfter",o}(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,s=0;t<this.sections.length;){let l=this.sections[t++],a=this.sections[t++];a<0?(e(i,s,l),s+=l):s+=a,i+=l}}iterChangedRanges(e,t=!1){mn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new Qe(e)}composeDesc(e){return this.empty?e:e.empty?this:Js(this,e)}mapDesc(e,t=!1){return e.empty?this:gn(this,e,t)}mapPos(e,t=-1,i=Be.Simple){let s=0,l=0;for(let a=0;a<this.sections.length;){let r=this.sections[a++],d=this.sections[a++],c=s+r;if(d<0){if(c>e)return l+(e-s);l+=r}else{if(i!=Be.Simple&&c>=e&&(i==Be.TrackDel&&s<e&&c>e||i==Be.TrackBefore&&s<e||i==Be.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!r)return e==s||t<0?l:l+d;l+=d}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return l}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let l=this.sections[i++],a=this.sections[i++],r=s+l;if(a>=0&&s<=t&&r>=e)return s<e&&r>t?"cover":!0;s=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}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 mn(this,(t,i,s,l,a)=>e=e.replace(s,s+(i-t),a),!1),e}mapDesc(e,t=!1){return gn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,l=0;s<t.length;s+=2){let a=t[s],r=t[s+1];if(r>=0){t[s]=r,t[s+1]=a;let d=s>>1;for(;i.length<d;)i.push(X.empty);i.push(a?e.slice(l,l+a):X.empty)}l+=a}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:Js(this,e,!0)}map(e,t=!1){return e.empty?this:gn(this,e,t,!0)}iterChanges(e,t=!1){mn(this,e,t)}get desc(){return Qe.create(this.sections)}filter(e){let t=[],i=[],s=[],l=new qt(this);e:for(let a=0,r=0;;){let d=a==e.length?1e9:e[a++];for(;r<d||r==d&&l.len==0;){if(l.done)break e;let h=Math.min(l.len,d-r);ke(s,h,-1);let f=l.ins==-1?-1:l.off==0?l.ins:0;ke(t,h,f),f>0&&nt(i,t,l.text),l.forward(h),r+=h}let c=e[a++];for(;r<c;){if(l.done)break e;let h=Math.min(l.len,c-r);ke(t,h,-1),ke(s,h,l.ins==-1?-1:l.off==0?l.ins:0),l.forward(h),r+=h}}return{changes:new ue(t,i),filtered:Qe.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],l=[],a=0,r=null;function d(h=!1){if(!h&&!s.length)return;a<t&&ke(s,t-a,-1);let f=new ue(s,l);r=r?r.compose(f.map(r)):f,s=[],l=[],a=0}function c(h){if(Array.isArray(h))for(let f of h)c(f);else if(h instanceof ue){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);d(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:u=f,insert:p}=h;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||pn)):p:X.empty,k=b.length;if(f==u&&k==0)return;f<a&&d(),f>a&&ke(s,f-a,-1),ke(s,u-f,k),nt(l,s,b),a=u}}return c(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 s=0;s<e.length;s++){let l=e[s];if(typeof l=="number")t.push(l,-1);else{if(!Array.isArray(l)||typeof l[0]!="number"||l.some((a,r)=>r&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(l.length==1)t.push(l[0],0);else{for(;i.length<s;)i.push(X.empty);i[s]=X.of(l.slice(1)),t.push(l[0],i[s].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function ke(o,e,t,i=!1){if(e==0&&t<=0)return;let s=o.length-2;s>=0&&t<=0&&t==o[s+1]?o[s]+=e:e==0&&o[s]==0?o[s+1]+=t:i?(o[s]+=e,o[s+1]+=t):o.push(e,t)}function nt(o,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<o.length)o[o.length-1]=o[o.length-1].append(t);else{for(;o.length<i;)o.push(X.empty);o.push(t)}}function mn(o,e,t){let i=o.inserted;for(let s=0,l=0,a=0;a<o.sections.length;){let r=o.sections[a++],d=o.sections[a++];if(d<0)s+=r,l+=r;else{let c=s,h=l,f=X.empty;for(;c+=r,h+=d,d&&i&&(f=f.append(i[a-2>>1])),!(t||a==o.sections.length||o.sections[a+1]<0);)r=o.sections[a++],d=o.sections[a++];e(s,c,l,h,f),s=c,l=h}}}function gn(o,e,t,i=!1){let s=[],l=i?[]:null,a=new qt(o),r=new qt(e);for(let d=-1;;)if(a.ins==-1&&r.ins==-1){let c=Math.min(a.len,r.len);ke(s,c,-1),a.forward(c),r.forward(c)}else if(r.ins>=0&&(a.ins<0||d==a.i||a.off==0&&(r.len<a.len||r.len==a.len&&!t))){let c=r.len;for(ke(s,r.ins,-1);c;){let h=Math.min(a.len,c);a.ins>=0&&d<a.i&&a.len<=h&&(ke(s,0,a.ins),l&&nt(l,s,a.text),d=a.i),a.forward(h),c-=h}r.next()}else if(a.ins>=0){let c=0,h=a.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);c+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;ke(s,c,d<a.i?a.ins:0),l&&d<a.i&&nt(l,s,a.text),d=a.i,a.forward(a.len-h)}else{if(a.done&&r.done)return l?ue.createSet(s,l):Qe.create(s);throw new Error("Mismatched change set lengths")}}function Js(o,e,t=!1){let i=[],s=t?[]:null,l=new qt(o),a=new qt(e);for(let r=!1;;){if(l.done&&a.done)return s?ue.createSet(i,s):Qe.create(i);if(l.ins==0)ke(i,l.len,0,r),l.next();else if(a.len==0&&!a.done)ke(i,0,a.ins,r),s&&nt(s,i,a.text),a.next();else{if(l.done||a.done)throw new Error("Mismatched change set lengths");{let d=Math.min(l.len2,a.len),c=i.length;if(l.ins==-1){let h=a.ins==-1?-1:a.off?0:a.ins;ke(i,d,h,r),s&&h&&nt(s,i,a.text)}else a.ins==-1?(ke(i,l.off?0:l.len,d,r),s&&nt(s,i,l.textBit(d))):(ke(i,l.off?0:l.len,a.off?0:a.ins,r),s&&!a.off&&nt(s,i,a.text));r=(l.ins>d||a.ins>=0&&a.len>d)&&(r||i.length>c),l.forward2(d),a.forward(d)}}}}class qt{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,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new ut(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return U.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return U.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 U.range(e.anchor,e.head)}static create(e,t,i){return new ut(e,t,i)}}class U{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:U.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 U([this.main],0)}addRange(e,t=!0){return U.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,U.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 U(e.ranges.map(t=>ut.fromJSON(t)),e.main)}static single(e,t=e){return new U([U.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,s=0;s<e.length;s++){let l=e[s];if(l.empty?l.from<=i:l.from<i)return U.normalized(e.slice(),t);i=l.to}return new U(e,t)}static cursor(e,t=0,i,s){return ut.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(e,t,i,s){let l=(i??16777215)<<6|(s==null?7:Math.min(6,s));return t<e?ut.create(t,e,48|l):ut.create(e,t,(t>e?8:0)|l)}static normalized(e,t=0){let i=e[t];e.sort((s,l)=>s.from-l.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let l=e[s],a=e[s-1];if(l.empty?l.from<=a.to:l.from<a.to){let r=a.from,d=Math.max(l.to,a.to);s<=t&&t--,e.splice(--s,2,l.anchor>l.head?U.range(d,r):U.range(r,d))}}return new U(e,t)}}function Zs(o,e){for(let t of o.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let kn=0;class K{constructor(e,t,i,s,l){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=kn++,this.default=e([]),this.extensions=typeof l=="function"?l(this):l}get reader(){return this}static define(e={}){return new K(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:bn),!!e.static,e.enables)}of(e){return new Ci([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function bn(o,e){return o==e||o.length==e.length&&o.every((t,i)=>t===e[i])}class Ci{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=kn++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,l=this.id,a=e[l]>>1,r=this.type==2,d=!1,c=!1,h=[];for(let f of this.dependencies)f=="doc"?d=!0:f=="selection"?c=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||h.push(e[f.id]);return{create(f){return f.values[a]=i(f),1},update(f,u){if(d&&u.docChanged||c&&(u.docChanged||u.selection)||wn(f,h)){let p=i(f);if(r?!el(p,f.values[a],s):!s(p,f.values[a]))return f.values[a]=p,1}return 0},reconfigure:(f,u)=>{let p,b=u.config.address[l];if(b!=null){let k=Bi(u,b);if(this.dependencies.every(v=>v instanceof K?u.facet(v)===f.facet(v):v instanceof pt?u.field(v,!1)==f.field(v,!1):!0)||(r?el(p=i(f),k,s):s(p=i(f),k)))return f.values[a]=k,0}else p=i(f);return f.values[a]=p,1}}}}function el(o,e,t){if(o.length!=e.length)return!1;for(let i=0;i<o.length;i++)if(!t(o[i],e[i]))return!1;return!0}function wn(o,e){let t=!1;for(let i of e)Wt(o,i)&1&&(t=!0);return t}function Dd(o,e,t){let i=t.map(d=>o[d.id]),s=t.map(d=>d.type),l=i.filter(d=>!(d&1)),a=o[e.id]>>1;function r(d){let c=[];for(let h=0;h<i.length;h++){let f=Bi(d,i[h]);if(s[h]==2)for(let u of f)c.push(u);else c.push(f)}return e.combine(c)}return{create(d){for(let c of i)Wt(d,c);return d.values[a]=r(d),1},update(d,c){if(!wn(d,l))return 0;let h=r(d);return e.compare(h,d.values[a])?0:(d.values[a]=h,1)},reconfigure(d,c){let h=wn(d,i),f=c.config.facets[e.id],u=c.facet(e);if(f&&!h&&bn(t,f))return d.values[a]=u,0;let p=r(d);return e.compare(p,u)?(d.values[a]=u,0):(d.values[a]=p,1)}}}const tl=K.define({static:!0});class pt{constructor(e,t,i,s,l){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=l,this.provides=void 0}static define(e){let t=new pt(kn++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(tl).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,s)=>{let l=i.values[t],a=this.updateF(l,s);return this.compareF(l,a)?0:(i.values[t]=a,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,tl.of({field:this,create:e})]}get extension(){return this}}const mt={lowest:4,low:3,default:2,high:1,highest:0};function Ut(o){return e=>new il(e,o)}const Pd={highest:Ut(mt.highest),high:Ut(mt.high),default:Ut(mt.default),low:Ut(mt.low),lowest:Ut(mt.lowest)};class il{constructor(e,t){this.inner=e,this.prec=t}}class Si{of(e){return new yn(this,e)}reconfigure(e){return Si.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class yn{constructor(e,t){this.compartment=e,this.inner=t}}class Ni{constructor(e,t,i,s,l,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=l,this.facets=a,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 s=[],l=Object.create(null),a=new Map;for(let u of $d(e,t,a))u instanceof pt?s.push(u):(l[u.facet.id]||(l[u.facet.id]=[])).push(u);let r=Object.create(null),d=[],c=[];for(let u of s)r[u.id]=c.length<<1,c.push(p=>u.slot(p));let h=i?.config.facets;for(let u in l){let p=l[u],b=p[0].facet,k=h&&h[u]||[];if(p.every(v=>v.type==0))if(r[b.id]=d.length<<1|1,bn(k,p))d.push(i.facet(b));else{let v=b.combine(p.map(C=>C.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]=c.length<<1,c.push(C=>v.dynamicSlot(C)));r[b.id]=c.length<<1,c.push(v=>Dd(v,b,p))}}let f=c.map(u=>u(r));return new Ni(e,a,f,r,d,l)}}function $d(o,e,t){let i=[[],[],[],[],[]],s=new Map;function l(a,r){let d=s.get(a);if(d!=null){if(d<=r)return;let c=i[d].indexOf(a);c>-1&&i[d].splice(c,1),a instanceof yn&&t.delete(a.compartment)}if(s.set(a,r),Array.isArray(a))for(let c of a)l(c,r);else if(a instanceof yn){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(a.compartment)||a.inner;t.set(a.compartment,c),l(c,r)}else if(a instanceof il)l(a.inner,a.prec);else if(a instanceof pt)i[r].push(a),a.provides&&l(a.provides,r);else if(a instanceof Ci)i[r].push(a),a.facet.extensions&&l(a.facet.extensions,mt.default);else{let c=a.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);l(c,r)}}return l(o,mt.default),i.reduce((a,r)=>a.concat(r))}function Wt(o,e){if(e&1)return 2;let t=e>>1,i=o.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;o.status[t]=4;let s=o.computeSlot(o,o.config.dynamicSlots[t]);return o.status[t]=2|s}function Bi(o,e){return e&1?o.config.staticValues[e>>1]:o.values[e>>1]}const nl=K.define(),xn=K.define({combine:o=>o.some(e=>e),static:!0}),sl=K.define({combine:o=>o.length?o[0]:void 0,static:!0}),ll=K.define(),ol=K.define(),al=K.define(),rl=K.define({combine:o=>o.length?o[0]:!1});class Ct{constructor(e,t){this.type=e,this.value=t}static define(){return new Fd}}class Fd{of(e){return new Ct(this,e)}}class Rd{constructor(e){this.map=e}of(e){return new ce(this,e)}}class ce{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 ce(this.type,t)}is(e){return this.type==e}static define(e={}){return new Rd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let l=s.map(t);l&&i.push(l)}return i}}ce.reconfigure=ce.define(),ce.appendConfig=ce.define();class be{constructor(e,t,i,s,l,a){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=l,this.scrollIntoView=a,this._doc=null,this._state=null,i&&Zs(i,t.newLength),l.some(r=>r.type==be.time)||(this.annotations=l.concat(be.time.of(Date.now())))}static create(e,t,i,s,l,a){return new be(e,t,i,s,l,a)}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=Ct.define(),be.userEvent=Ct.define(),be.addToHistory=Ct.define(),be.remote=Ct.define();function Ld(o,e){let t=[];for(let i=0,s=0;;){let l,a;if(i<o.length&&(s==e.length||e[s]>=o[i]))l=o[i++],a=o[i++];else if(s<e.length)l=e[s++],a=e[s++];else return t;!t.length||t[t.length-1]<l?t.push(l,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function dl(o,e,t){var i;let s,l,a;return t?(s=e.changes,l=ue.empty(e.changes.length),a=o.changes.compose(e.changes)):(s=e.changes.map(o.changes),l=o.changes.mapDesc(e.changes,!0),a=o.changes.compose(s)),{changes:a,selection:e.selection?e.selection.map(l):(i=o.selection)===null||i===void 0?void 0:i.map(s),effects:ce.mapEffects(o.effects,s).concat(ce.mapEffects(e.effects,l)),annotations:o.annotations.length?o.annotations.concat(e.annotations):e.annotations,scrollIntoView:o.scrollIntoView||e.scrollIntoView}}function vn(o,e,t){let i=e.selection,s=St(e.annotations);return e.userEvent&&(s=s.concat(be.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,o.facet(sl)),selection:i&&(i instanceof U?i:U.single(i.anchor,i.head)),effects:St(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function cl(o,e,t){let i=vn(o,e.length?e[0]:{},o.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let l=1;l<e.length;l++){e[l].filter===!1&&(t=!1);let a=!!e[l].sequential;i=dl(i,vn(o,e[l],a?i.changes.newLength:o.doc.length),a)}let s=be.create(o,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return zd(t?jd(s):s)}function jd(o){let e=o.startState,t=!0;for(let s of e.facet(ll)){let l=s(o);if(l===!1){t=!1;break}Array.isArray(l)&&(t=t===!0?l:Ld(t,l))}if(t!==!0){let s,l;if(t===!1)l=o.changes.invertedDesc,s=ue.empty(e.doc.length);else{let a=o.changes.filter(t);s=a.changes,l=a.filtered.mapDesc(a.changes).invertedDesc}o=be.create(e,s,o.selection&&o.selection.map(l),ce.mapEffects(o.effects,l),o.annotations,o.scrollIntoView)}let i=e.facet(ol);for(let s=i.length-1;s>=0;s--){let l=i[s](o);l instanceof be?o=l:Array.isArray(l)&&l.length==1&&l[0]instanceof be?o=l[0]:o=cl(e,St(l),!1)}return o}function zd(o){let e=o.startState,t=e.facet(al),i=o;for(let s=t.length-1;s>=0;s--){let l=t[s](o);l&&Object.keys(l).length&&(i=dl(i,vn(e,l,o.changes.newLength),!0))}return i==o?o:be.create(e,o.changes,o.selection,i.effects,i.annotations,i.scrollIntoView)}const qd=[];function St(o){return o==null?qd:Array.isArray(o)?o:[o]}var Ge=function(o){return o[o.Word=0]="Word",o[o.Space=1]="Space",o[o.Other=2]="Other",o}(Ge||(Ge={}));const Ud=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Cn;try{Cn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Wd(o){if(Cn)return Cn.test(o);for(let e=0;e<o.length;e++){let t=o[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ud.test(t)))return!0}return!1}function Hd(o){return e=>{if(!/\S/.test(e))return Ge.Space;if(Wd(e))return Ge.Word;for(let t=0;t<o.length;t++)if(e.indexOf(o[t])>-1)return Ge.Word;return Ge.Other}}class ee{constructor(e,t,i,s,l,a){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=l,a&&(a._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Wt(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 Wt(this,i),Bi(this,i)}update(...e){return cl(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let r of e.effects)r.is(Si.reconfigure)?(t&&(s=new Map,t.compartments.forEach((d,c)=>s.set(c,d)),t=null),s.set(r.value.compartment,r.value.extension)):r.is(ce.reconfigure)?(t=null,i=r.value):r.is(ce.appendConfig)&&(t=null,i=St(i).concat(r.value));let l;t?l=e.startState.values.slice():(t=Ni.resolve(i,s,this),l=new ee(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,c)=>c.reconfigure(d,this),null).values);let a=e.startState.facet(xn)?e.newSelection:e.newSelection.asSingle();new ee(t,e.newDoc,a,l,(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:U.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),l=[i.range],a=St(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),c=this.changes(d.changes),h=c.map(s);for(let u=0;u<r;u++)l[u]=l[u].map(h);let f=s.mapDesc(c,!0);l.push(d.range.map(f)),s=s.compose(h),a=ce.mapEffects(a,h).concat(ce.mapEffects(St(d.effects),f))}return{changes:s,selection:U.create(l,t.mainIndex),effects:a}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(ee.lineSeparator))}toText(e){return X.of(e.split(this.facet(ee.lineSeparator)||pn))}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:(Wt(this,t),Bi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof pt&&this.config.address[s.id]!=null&&(t[i]=s.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 s=[];if(i){for(let l in i)if(Object.prototype.hasOwnProperty.call(e,l)){let a=i[l],r=e[l];s.push(a.init(d=>a.spec.fromJSON(r,d)))}}return ee.create({doc:e.doc,selection:U.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Ni.resolve(e.extensions||[],new Map),i=e.doc instanceof X?e.doc:X.of((e.doc||"").split(t.staticFacet(ee.lineSeparator)||pn)),s=e.selection?e.selection instanceof U?e.selection:U.single(e.selection.anchor,e.selection.head):U.single(0);return Zs(s,i.length),t.staticFacet(xn)||(s=s.asSingle()),new ee(t,i,s,t.dynamicSlots.map(()=>null),(l,a)=>a.create(l),null)}get tabSize(){return this.facet(ee.tabSize)}get lineBreak(){return this.facet(ee.lineSeparator)||`
5
+ `}get readOnly(){return this.facet(rl)}phrase(e,...t){for(let i of this.facet(ee.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let l=+(s||1);return!l||l>t.length?i:t[l-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let l of this.facet(nl))for(let a of l(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Hd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),l=this.charCategorizer(e),a=e-i,r=e-i;for(;a>0;){let d=Ke(t,a,!1);if(l(t.slice(d,a))!=Ge.Word)break;a=d}for(;r<s;){let d=Ke(t,r);if(l(t.slice(r,d))!=Ge.Word)break;r=d}return a==r?null:U.range(a+i,r+i)}}ee.allowMultipleSelections=xn,ee.tabSize=K.define({combine:o=>o.length?o[0]:4}),ee.lineSeparator=sl,ee.readOnly=rl,ee.phrases=K.define({compare(o,e){let t=Object.keys(o),i=Object.keys(e);return t.length==i.length&&t.every(s=>o[s]==e[s])}}),ee.languageData=nl,ee.changeFilter=ll,ee.transactionFilter=ol,ee.transactionExtender=al,Si.reconfigure=ce.define();class Nt{eq(e){return this==e}range(e,t=e){return Ht.create(e,t,this)}}Nt.prototype.startSide=Nt.prototype.endSide=0,Nt.prototype.point=!1,Nt.prototype.mapMode=Be.TrackDel;class Ht{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Ht(e,t,i)}}function Sn(o,e){return o.from-e.from||o.value.startSide-e.value.startSide}class Nn{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let l=i?this.to:this.from;for(let a=s,r=l.length;;){if(a==r)return a;let d=a+r>>1,c=l[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==a)return c>=0?a:r;c>=0?r=d:a=d+1}}between(e,t,i,s){for(let l=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,l);l<a;l++)if(s(this.from[l]+e,this.to[l]+e,this.value[l])===!1)return!1}map(e,t){let i=[],s=[],l=[],a=-1,r=-1;for(let d=0;d<this.value.length;d++){let c=this.value[d],h=this.from[d]+e,f=this.to[d]+e,u,p;if(h==f){let b=t.mapPos(h,c.startSide,c.mapMode);if(b==null||(u=p=b,c.startSide!=c.endSide&&(p=t.mapPos(h,c.endSide),p<u)))continue}else if(u=t.mapPos(h,c.startSide),p=t.mapPos(f,c.endSide),u>p||u==p&&c.startSide>0&&c.endSide<=0)continue;(p-u||c.endSide-c.startSide)<0||(a<0&&(a=u),c.point&&(r=Math.max(r,p-u)),i.push(c),s.push(u-a),l.push(p-a))}return{mapped:i.length?new Nn(s,l,i,r):null,pos:a}}}class le{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new le(e,t,i,s)}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:s=0,filterTo:l=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Sn)),this.isEmpty)return t.length?le.of(t):this;let r=new fl(this,null,-1).goto(0),d=0,c=[],h=new Oi;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++];h.addInner(f.from,f.to,f.value)||c.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!a||s>this.chunkEnd(r.chunkIndex)||l<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!a||s>r.to||l<r.from||a(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||c.push(Ht.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?le.empty:this.nextLayer.update({add:c,filter:a,filterFrom:s,filterTo:l}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],s=-1;for(let a=0;a<this.chunk.length;a++){let r=this.chunkPos[a],d=this.chunk[a],c=e.touchesRange(r,r+d.length);if(c===!1)s=Math.max(s,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(c===!0){let{mapped:h,pos:f}=d.map(r,e);h&&(s=Math.max(s,h.maxPoint),t.push(h),i.push(f))}}let l=this.nextLayer.map(e);return t.length==0?l:new le(i,t,l||le.empty,s)}between(e,t,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let l=this.chunkPos[s],a=this.chunk[s];if(t>=l&&e<=l+a.length&&a.between(l,e-l,t-l,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Kt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Kt.from(e).goto(t)}static compare(e,t,i,s,l=-1){let a=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=l),r=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=l),d=hl(a,r,i),c=new Qt(a,d,l),h=new Qt(r,d,l);i.iterGaps((f,u,p)=>ul(c,f,h,u,p,s)),i.empty&&i.length==0&&ul(c,0,h,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let l=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),a=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(l.length!=a.length)return!1;if(!l.length)return!0;let r=hl(l,a),d=new Qt(l,r,0).goto(i),c=new Qt(a,r,0).goto(i);for(;;){if(d.to!=c.to||!On(d.active,c.active)||d.point&&(!c.point||!d.point.eq(c.point)))return!1;if(d.to>s)return!0;d.next(),c.next()}}static spans(e,t,i,s,l=-1){let a=new Qt(e,null,l).goto(t),r=t,d=a.openStart;for(;;){let c=Math.min(a.to,i);if(a.point){let h=a.activeForPoint(a.to),f=a.pointFrom<t?h.length+1:a.point.startSide<0?h.length:Math.min(h.length,d);s.point(r,c,a.point,h,f,a.pointRank),d=Math.min(a.openEnd(c),h.length)}else c>r&&(s.span(r,c,a.active,d),d=a.openEnd(c));if(a.to>i)return d+(a.point&&a.to>i?1:0);r=a.to,a.next()}}static of(e,t=!1){let i=new Oi;for(let s of e instanceof Ht?[e]:t?Kd(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return le.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=le.empty;s=s.nextLayer)t=new le(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}le.empty=new le([],[],null,-1);function Kd(o){if(o.length>1)for(let e=o[0],t=1;t<o.length;t++){let i=o[t];if(Sn(e,i)>0)return o.slice().sort(Sn);e=i}return o}le.empty.nextLayer=le.empty;class Oi{finishChunk(e){this.chunks.push(new Nn(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 Oi)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<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(le.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=le.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function hl(o,e,t){let i=new Map;for(let l of o)for(let a=0;a<l.chunk.length;a++)l.chunk[a].maxPoint<=0&&i.set(l.chunk[a],l.chunkPos[a]);let s=new Set;for(let l of e)for(let a=0;a<l.chunk.length;a++){let r=i.get(l.chunk[a]);r!=null&&(t?t.mapPos(r):r)==l.chunkPos[a]&&!t?.touchesRange(r,r+l.chunk[a].length)&&s.add(l.chunk[a])}return s}class fl{constructor(e,t,i,s=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=s}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 s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<s)&&this.setRangeIndex(s)}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 Kt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let s=[];for(let l=0;l<e.length;l++)for(let a=e[l];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&s.push(new fl(a,t,i,l));return s.length==1?s[0]:new Kt(s)}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--)Bn(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--)Bn(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(),Bn(this.heap,0)}}}function Bn(o,e){for(let t=o[e];;){let i=(e<<1)+1;if(i>=o.length)break;let s=o[i];if(i+1<o.length&&s.compare(o[i+1])>=0&&(s=o[i+1],i++),t.compare(s)<0)break;o[i]=t,o[e]=s,e=i}}class Qt{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=Kt.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){Vi(this.active,e),Vi(this.activeTo,e),Vi(this.activeRank,e),this.minActive=pl(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:l}=this.cursor;for(;t<this.activeRank.length&&(l-this.activeRank[t]||s-this.activeTo[t])>0;)t++;_i(this.active,t,i),_i(this.activeTo,t,s),_i(this.activeRank,t,l),e&&_i(e,t,this.cursor.from),this.minActive=pl(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&Vi(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let l=this.cursor.value;if(!l.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=l,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=l.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 s=i.length-1;s>=0&&i[s]<e;s--)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 ul(o,e,t,i,s,l){o.goto(e),t.goto(i);let a=i+s,r=i,d=i-e;for(;;){let c=o.to+d-t.to||o.endSide-t.endSide,h=c<0?o.to+d:t.to,f=Math.min(h,a);if(o.point||t.point?o.point&&t.point&&(o.point==t.point||o.point.eq(t.point))&&On(o.activeForPoint(o.to),t.activeForPoint(t.to))||l.comparePoint(r,f,o.point,t.point):f>r&&!On(o.active,t.active)&&l.compareRange(r,f,o.active,t.active),h>a)break;r=h,c<=0&&o.next(),c>=0&&t.next()}}function On(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++)if(o[t]!=e[t]&&!o[t].eq(e[t]))return!1;return!0}function Vi(o,e){for(let t=e,i=o.length-1;t<i;t++)o[t]=o[t+1];o.pop()}function _i(o,e,t){for(let i=o.length-1;i>=e;i--)o[i+1]=o[i];o[e]=t}function pl(o,e){let t=-1,i=1e9;for(let s=0;s<e.length;s++)(e[s]-i||o[s].endSide-o[t].endSide)<0&&(t=s,i=e[s]);return t}function Qd(o,e,t,i){for(let s=0,l=0;;){if(l>=e)return s;if(s==o.length)break;l+=o.charCodeAt(s)==9?t-l%t:1,s=Ke(o,s)}return i===!0?-1:o.length}const Vn="ͼ",ml=typeof Symbol>"u"?"__"+Vn:Symbol.for(Vn),_n=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),gl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class st{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function l(a,r,d,c){let h=[],f=/^@(\w+)\b/.exec(a[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return d.push(a[0]+";");for(let p in r){let b=r[p];if(/&/.test(p))l(p.split(/,\s*/).map(k=>a.map(v=>k.replace(/&/,v))).reduce((k,v)=>k.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.");l(s(p),b,h,u)}else b!=null&&h.push(p.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+b+";")}(h.length||u)&&d.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+h.join(" ")+"}")}for(let a in e)l(s(a),e[a],this.rules)}getRules(){return this.rules.join(`
6
6
  `)}static newName(){let e=gl[ml]||1;return gl[ml]=e+1,Vn+e.toString(36)}static mount(e,t,i){let s=e[_n],l=i&&i.nonce;s?l&&s.setNonce(l):s=new Gd(e,l),s.mount(Array.isArray(t)?t:[t],e)}}let kl=new Map;class Gd{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let l=kl.get(i);if(l)return e[_n]=l;this.sheet=new s.CSSStyleSheet,kl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[_n]=this}mount(e,t){let i=this.sheet,s=0,l=0;for(let a=0;a<e.length;a++){let r=e[a],d=this.modules.indexOf(r);if(d<l&&d>-1&&(this.modules.splice(d,1),l--,d=-1),d==-1){if(this.modules.splice(l++,0,r),i)for(let c=0;c<r.rules.length;c++)i.insertRule(r.rules[c],s++)}else{for(;l<d;)s+=this.modules[l++].rules.length;s+=r.rules.length,l++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let a="";for(let d=0;d<this.modules.length;d++)a+=this.modules[d].getRules()+`
7
- `;this.styleTag.textContent=a;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 Bt={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:"'"},An={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++)Bt[48+pe]=Bt[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Bt[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Bt[pe]=String.fromCharCode(pe+32),An[pe]=String.fromCharCode(pe);for(var Tn in Bt)An.hasOwnProperty(Tn)||(An[Tn]=Bt[Tn]);function Gt(o){let e;return o.nodeType==11?e=o.getSelection?o:o.ownerDocument:e=o,e.getSelection()}function Mn(o,e){return e?o==e||o.contains(e.nodeType!=1?e.parentNode:e):!1}function Yd(o){let e=o.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ai(o,e){if(!e.anchorNode)return!1;try{return Mn(o,e.anchorNode)}catch{return!1}}function Yt(o){return o.nodeType==3?kt(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function Xt(o,e,t,i){return t?bl(o,e,t,i,-1)||bl(o,e,t,i,1):!1}function gt(o){for(var e=0;;e++)if(o=o.previousSibling,!o)return e}function Ti(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function bl(o,e,t,i,s){for(;;){if(o==t&&e==i)return!0;if(e==(s<0?0:Ye(o))){if(o.nodeName=="DIV")return!1;let l=o.parentNode;if(!l||l.nodeType!=1)return!1;e=gt(o)+(s<0?0:1),o=l}else if(o.nodeType==1){if(o=o.childNodes[e+(s<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;e=s<0?Ye(o):0}else return!1}}function Ye(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function Mi(o,e){let t=e?o.left:o.right;return{left:t,right:t,top:o.top,bottom:o.bottom}}function Xd(o){let e=o.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:o.innerWidth,top:0,bottom:o.innerHeight}}function wl(o,e){let t=e.width/o.offsetWidth,i=e.height/o.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-o.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-o.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function Jd(o,e,t,i,s,l,a,r){let d=o.ownerDocument,c=d.defaultView||window;for(let h=o,f=!1;h&&!f;)if(h.nodeType==1){let u,p=h==d.body,b=1,k=1;if(p)u=Xd(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let x=h.getBoundingClientRect();({scaleX:b,scaleY:k}=wl(h,x)),u={left:x.left,right:x.left+h.clientWidth*b,top:x.top,bottom:x.top+h.clientHeight*k}}let v=0,C=0;if(s=="nearest")e.top<u.top?(C=-(u.top-e.top+a),t>0&&e.bottom>u.bottom+C&&(C=e.bottom-u.bottom+C+a)):e.bottom>u.bottom&&(C=e.bottom-u.bottom+a,t<0&&e.top-C<u.top&&(C=-(u.top+C-e.top+a)));else{let x=e.bottom-e.top,V=u.bottom-u.top;C=(s=="center"&&x<=V?e.top+x/2-V/2:s=="start"||s=="center"&&t<0?e.top-a:e.bottom-V+a)-u.top}if(i=="nearest"?e.left<u.left?(v=-(u.left-e.left+l),t>0&&e.right>u.right+v&&(v=e.right-u.right+v+l)):e.right>u.right&&(v=e.right-u.right+l,t<0&&e.left<u.left+v&&(v=-(u.left+v-e.left+l))):v=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-l:e.right-(u.right-u.left)+l)-u.left,v||C)if(p)c.scrollBy(v,C);else{let x=0,V=0;if(C){let g=h.scrollTop;h.scrollTop+=C/k,V=(h.scrollTop-g)*k}if(v){let g=h.scrollLeft;h.scrollLeft+=v/b,x=(h.scrollLeft-g)*b}e={left:e.left-x,top:e.top-V,right:e.right-x,bottom:e.bottom-V},x&&Math.abs(x-v)<1&&(i="nearest"),V&&Math.abs(V-C)<1&&(s="nearest")}if(p)break;h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function Zd(o){let e=o.ownerDocument,t,i;for(let s=o.parentNode;s&&!(s==e.body||t&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:i}}class ec{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,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Ot=null;function yl(o){if(o.setActive)return o.setActive();if(Ot)return o.focus(Ot);let e=[];for(let t=o;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(o.focus(Ot==null?{get preventScroll(){return Ot={preventScroll:!0},!0}}:void 0),!Ot){Ot=!1;for(let t=0;t<e.length;){let i=e[t++],s=e[t++],l=e[t++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=l&&(i.scrollLeft=l)}}}let xl;function kt(o,e,t=e){let i=xl||(xl=document.createRange());return i.setEnd(o,t),i.setStart(o,e),i}function Vt(o,e,t,i){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let l=new KeyboardEvent("keydown",s);l.synthetic=!0,o.dispatchEvent(l);let a=new KeyboardEvent("keyup",s);return a.synthetic=!0,o.dispatchEvent(a),l.defaultPrevented||a.defaultPrevented}function tc(o){for(;o;){if(o&&(o.nodeType==9||o.nodeType==11&&o.host))return o;o=o.assignedSlot||o.parentNode}return null}function vl(o){for(;o.attributes.length;)o.removeAttributeNode(o.attributes[0])}function ic(o,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 s=t.childNodes[i-1];s.contentEditable=="false"?i--:(t=s,i=Ye(t))}else{if(t==o)return!0;i=gt(t),t=t.parentNode}}function Cl(o){return o.scrollTop>Math.max(1,o.scrollHeight-o.clientHeight-4)}function Sl(o,e){for(let t=o,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&&!Ti(t))i=gt(t),t=t.parentNode;else return null}}function Nl(o,e){for(let t=o,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&&!Ti(t))i=gt(t)+1,t=t.parentNode;else return null}}class we{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new we(e.parentNode,gt(e),t)}static after(e,t){return new we(e.parentNode,gt(e)+1,t)}}const En=[];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,s=null,l;for(let a of this.children){if(a.flags&7){if(!a.dom&&(l=s?s.nextSibling:i.firstChild)){let r=ne.get(l);(!r||!r.parent&&r.canReuseDOM(a))&&a.reuseDOM(l)}a.sync(e,t),a.flags&=-8}if(l=s?s.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&l!=a.dom&&(t.written=!0),a.dom.parentNode==i)for(;l&&l!=a.dom;)l=Bl(l);else i.insertBefore(a.dom,l);s=a.dom}for(l=s?s.nextSibling:i.firstChild,l&&t&&t.node==i&&(t.written=!0);l;)l=Bl(l)}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 s=Ye(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==this.dom)break;s==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?s=-1:s=1),e=l}s<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 s=0,l=0;;s++){let a=this.children[s];if(a.dom==i)return l;l+=a.length+a.breakAfter}}domBoundsAround(e,t,i=0){let s=-1,l=-1,a=-1,r=-1;for(let d=0,c=i,h=i;d<this.children.length;d++){let f=this.children[d],u=c+f.length;if(c<e&&u>t)return f.domBoundsAround(e,t,c);if(u>=e&&s==-1&&(s=d,l=c),c>t&&f.dom.parentNode==this.dom){a=d,r=h;break}h=u,c=u+f.breakAfter}return{from:l,to:r<0?i+this.length:r,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a<this.children.length&&a>=0?this.children[a].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=En){this.markDirty();for(let s=e;s<t;s++){let l=this.children[s];l.parent==this&&i.indexOf(l)<0&&l.destroy()}this.children.splice(e,t-e,...i);for(let s=0;s<i.length;s++)i[s].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ol(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,s,l,a){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 Bl(o){let e=o.nextSibling;return o.parentNode.removeChild(o),e}class Ol{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 Vl(o,e,t,i,s,l,a,r,d){let{children:c}=o,h=c.length?c[e]:null,f=l.length?l[l.length-1]:null,u=f?f.breakAfter:a;if(!(e==i&&h&&!a&&!u&&l.length<2&&h.merge(t,s,l.length?f:null,t==0,r,d))){if(i<c.length){let p=c[i];p&&(s<p.length||p.breakAfter&&f?.breakAfter)?(e==i&&(p=p.split(s),s=0),!u&&f&&p.merge(0,s,f,!0,0,d)?l[l.length-1]=p:((s||p.children.length&&!p.children[0].length)&&p.merge(0,s,null,!1,0,d),l.push(p))):p?.breakAfter&&(f?f.breakAfter=1:a=1),i++}for(h&&(h.breakAfter=a,t>0&&(!a&&l.length&&h.merge(t,h.length,l[0],!1,r,0)?h.breakAfter=l.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,r,0),e++));e<i&&l.length;)if(c[i-1].become(l[l.length-1]))i--,l.pop(),d=l.length?0:r;else if(c[e].become(l[0]))e++,l.shift(),r=l.length?0:d;else break;!l.length&&e&&i<c.length&&!c[e-1].breakAfter&&c[i].merge(0,0,c[e-1],!1,r,d)&&e--,(e<i||l.length)&&o.replaceChildren(e,i,l)}}function _l(o,e,t,i,s,l){let a=o.childCursor(),{i:r,off:d}=a.findPos(t,1),{i:c,off:h}=a.findPos(e,-1),f=e-t;for(let u of i)f+=u.length;o.length+=f,Vl(o,c,h,r,d,i,0,s,l)}let Se=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},In=typeof document<"u"?document:{documentElement:{style:{}}};const Dn=/Edge\/(\d+)/.exec(Se.userAgent),Al=/MSIE \d/.test(Se.userAgent),Pn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Se.userAgent),Ei=!!(Al||Pn||Dn),Tl=!Ei&&/gecko\/(\d+)/i.test(Se.userAgent),$n=!Ei&&/Chrome\/(\d+)/.exec(Se.userAgent),Ml="webkitFontSmoothing"in In.documentElement.style,El=!Ei&&/Apple Computer/.test(Se.vendor),Il=El&&(/Mobile\/\w+/.test(Se.userAgent)||Se.maxTouchPoints>2);var q={mac:Il||/Mac/.test(Se.platform),windows:/Win/.test(Se.platform),linux:/Linux|X11/.test(Se.platform),ie:Ei,ie_version:Al?In.documentMode||6:Pn?+Pn[1]:Dn?+Dn[1]:0,gecko:Tl,gecko_version:Tl?+(/Firefox\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,chrome:!!$n,chrome_version:$n?+$n[1]:0,ios:Il,android:/Android\b/.test(Se.userAgent),webkit:Ml,safari:El,webkit_version:Ml?+(/\bAppleWebKit\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,tabSize:In.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const nc=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>nc||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 we(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 sc(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 s of t)s.setParent(this)}setAttrs(e){if(vl(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,s,l,a){return i&&(!(i instanceof Xe&&i.mark.eq(this.mark))||e&&l<=0||t<this.length&&a<=0)?!1:(_l(this,e,t,i?i.children.slice():[],l-1,a-1),this.markDirty(),!0)}split(e){let t=[],i=0,s=-1,l=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),s<0&&i>=e&&(s=l),i=d,l++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Xe(this.mark,t,a)}domAtPos(e){return Dl(this,e)}coordsAt(e,t){return $l(this,e,t)}}function sc(o,e,t){let i=o.nodeValue.length;e>i&&(e=i);let s=e,l=e,a=0;e==0&&t<0||e==i&&t>=0?q.chrome||q.gecko||(e?(s--,a=1):l<i&&(l++,a=-1)):t<0?s--:l<i&&l++;let r=kt(o,s,l).getClientRects();if(!r.length)return null;let d=r[(a?a<0:t>=0)?0:r.length-1];return q.safari&&!a&&d.width==0&&(d=Array.prototype.find.call(r,c=>c.width)||d),a?Mi(d,a<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,s,l,a){return i&&(!(i instanceof bt)||!this.widget.compare(i.widget)||e>0&&l<=0||t<this.length&&a<=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 J.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,s=this.posAtStart;return i?i.slice(s,s+this.length):J.empty}domAtPos(e){return(this.length?e==0:this.side>0)?we.before(this.dom):we.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 s=this.dom.getClientRects(),l=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let r=a?s.length-1:0;l=s[r],!(e>0?r==0:r==s.length-1||l.top<l.bottom);r+=a?-1:1);return Mi(l,!a)}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 _t extends ne{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof _t&&e.side==this.side}split(){return new _t(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?we.before(this.dom):we.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return J.empty}get isHidden(){return!0}}Ee.prototype.children=bt.prototype.children=_t.prototype.children=En;function Dl(o,e){let t=o.dom,{children:i}=o,s=0;for(let l=0;s<i.length;s++){let a=i[s],r=l+a.length;if(!(r==l&&a.getSide()<=0)){if(e>l&&e<r&&a.dom.parentNode==t)return a.domAtPos(e-l);if(e<=l)break;l=r}}for(let l=s;l>0;l--){let a=i[l-1];if(a.dom.parentNode==t)return a.domAtPos(a.length)}for(let l=s;l<i.length;l++){let a=i[l];if(a.dom.parentNode==t)return a.domAtPos(0)}return new we(t,0)}function Pl(o,e,t){let i,{children:s}=o;t>0&&e instanceof Xe&&s.length&&(i=s[s.length-1])instanceof Xe&&i.mark.eq(e.mark)?Pl(i,e.children[0],t-1):(s.push(e),e.setParent(o)),o.length+=e.length}function $l(o,e,t){let i=null,s=-1,l=null,a=-1;function r(c,h){for(let f=0,u=0;f<c.children.length&&u<=h;f++){let p=c.children[f],b=u+p.length;b>=h&&(p.children.length?r(p,h-u):(!l||l.isHidden&&t>0)&&(b>h||u==b&&p.getSide()>0)?(l=p,a=h-u):(u<h||u==b&&p.getSide()<0&&!p.isHidden)&&(i=p,s=h-u)),u=b}}r(o,e);let d=(t<0?i:l)||i||l;return d?d.coordsAt(Math.max(0,d==i?s:a),t):lc(o)}function lc(o){let e=o.dom.lastChild;if(!e)return o.dom.getBoundingClientRect();let t=Yt(e);return t[t.length-1]||null}function Fn(o,e){for(let t in o)t=="class"&&e.class?e.class+=" "+o.class:t=="style"&&e.style?e.style+=";"+o.style:e[t]=o[t];return e}const Fl=Object.create(null);function Ii(o,e,t){if(o==e)return!0;o||(o=Fl),e||(e=Fl);let i=Object.keys(o),s=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let l of i)if(l!=t&&(s.indexOf(l)==-1||o[l]!==e[l]))return!1;return!0}function Rn(o,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?o.style.cssText="":o.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?o.style.cssText=t[s]:o.setAttribute(s,t[s]));return i}function oc(o){let e=Object.create(null);for(let t=0;t<o.attributes.length;t++){let i=o.attributes[t];e[i.name]=i.value}return e}class Ln{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(o){return o[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o}(Le||(Le={}));class ye extends Nt{constructor(e,t,i,s){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(e){return new Jt(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 lt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:l,end:a}=Rl(e,t);i=(l?t?-3e8:-1:5e8)-1,s=(a?t?2e8:1:-6e8)+1}return new lt(e,i,s,t,e.widget||null,!0)}static line(e){return new Zt(e)}static set(e,t=!1){return le.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ye.none=le.empty;class Jt extends ye{constructor(e){let{start:t,end:i}=Rl(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 Jt&&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))&&Ii(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)}}Jt.prototype.point=!1;class Zt extends ye{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Zt&&this.spec.class==e.spec.class&&Ii(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)}}Zt.prototype.mapMode=Be.TrackBefore,Zt.prototype.point=!0;class lt extends ye{constructor(e,t,i,s,l,a){super(t,i,l,e),this.block=s,this.isReplace=a,this.mapMode=s?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 lt&&ac(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)}}lt.prototype.point=!0;function Rl(o,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=o;return t==null&&(t=o.inclusive),i==null&&(i=o.inclusive),{start:t??e,end:i??e}}function ac(o,e){return o==e||!!(o&&e&&o.compare(e))}function jn(o,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=o?t[s]=Math.max(t[s],e):t.push(o,e)}class de extends ne{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,l,a){if(i){if(!(i instanceof de))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),_l(this,e,t,i?i.children.slice():[],l,a),!0}split(e){let t=new de;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let l=i;l<this.children.length;l++)t.append(this.children[l],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){Ii(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Pl(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Fn(t,this.attrs||{})),i&&(this.attrs=Fn({class:i},this.attrs||{}))}domAtPos(e){return Dl(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(vl(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&&(Rn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&ne.get(s)instanceof Xe;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=ne.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!q.ios||!this.children.some(l=>l instanceof Ee))){let l=document.createElement("BR");l.cmIgnore=!0,this.dom.appendChild(l)}}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 s=Yt(i.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=$l(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,l=i.bottom-i.top;if(Math.abs(l-s.lineHeight)<2&&s.textHeight<l){let a=(l-s.textHeight)/2;return{top:i.top+a,bottom:i.bottom-a,left:i.left,right:i.left}}}return i}become(e){return e instanceof de&&this.children.length==0&&e.children.length==0&&Ii(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,s=0;i<e.children.length;i++){let l=e.children[i],a=s+l.length;if(a>=t){if(l instanceof de)return l;if(a>t)break}s=a+l.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,s,l,a){return i&&(!(i instanceof Je)||!this.widget.compare(i.widget)||e>0&&l<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?we.before(this.dom):we.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 En}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):J.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 zn?null:Mi(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 zn extends Ln{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 ei{constructor(e,t,i,s){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=s,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 de),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Di(new _t(-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:l,lineBreak:a,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(a){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=l,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Di(new Ee(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,l,a){if(this.disallowBlockEffectsFor[a]&&i instanceof lt){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 lt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Je(i.widget||At.block,r,i));else{let d=bt.create(i.widget||At.inline,r,r?0:i.startSide),c=this.atCursorPos&&!d.isEditable&&l<=s.length&&(e<t||i.startSide>0),h=!d.isEditable&&(e<t||l>s.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!c&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),c&&(f.append(Di(new _t(1),s),l),l=s.length+Math.max(0,l-s.length)),f.append(Di(d,s),l),this.atCursorPos=h,this.pendingBuffer=h?e<t||l>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.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=l)}static build(e,t,i,s,l){let a=new ei(e,t,i,l);return a.openEnd=le.spans(s,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Di(o,e){for(let t of e)o=new Xe(t,[o],o.length);return o}class At extends Ln{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}}At.inline=new At("span"),At.block=new At("div");var me=function(o){return o[o.LTR=0]="LTR",o[o.RTL=1]="RTL",o}(me||(me={}));const wt=me.LTR,qn=me.RTL;function Ll(o){let e=[];for(let t=0;t<o.length;t++)e.push(1<<+o[t]);return e}const rc=Ll("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),dc=Ll("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Un=Object.create(null),je=[];for(let o of["()","[]","{}"]){let e=o.charCodeAt(0),t=o.charCodeAt(1);Un[e]=t,Un[t]=-e}function jl(o){return o<=247?rc[o]:1424<=o&&o<=1524?2:1536<=o&&o<=1785?dc[o-1536]:1774<=o&&o<=2220?4:8192<=o&&o<=8204?256:64336<=o&&o<=65023?4:1}const cc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ot{get dir(){return this.level%2?qn:wt}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,s){let l=-1;for(let a=0;a<e.length;a++){let r=e[a];if(r.from<=t&&r.to>=t){if(r.level==i)return a;(l<0||(s!=0?s<0?r.from<t:r.to>t:e[l].level>r.level))&&(l=a)}}if(l<0)throw new RangeError("Index out of range");return l}}function zl(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++){let i=o[t],s=e[t];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!zl(i.inner,s.inner))return!1}return!0}const se=[];function hc(o,e,t,i,s){for(let l=0;l<=i.length;l++){let a=l?i[l-1].to:e,r=l<i.length?i[l].from:t,d=l?256:s;for(let c=a,h=d,f=d;c<r;c++){let u=jl(o.charCodeAt(c));u==512?u=h:u==8&&f==4&&(u=16),se[c]=u==4?2:u,u&7&&(f=u),h=u}for(let c=a,h=d,f=d;c<r;c++){let u=se[c];if(u==128)c<r-1&&h==se[c+1]&&h&24?u=se[c]=h:se[c]=256;else if(u==64){let p=c+1;for(;p<r&&se[p]==64;)p++;let b=c&&h==8||p<t&&se[p]==8?f==1?1:8:256;for(let k=c;k<p;k++)se[k]=b;c=p-1}else u==8&&f==1&&(se[c]=1);h=u,u&7&&(f=u)}}}function fc(o,e,t,i,s){let l=s==1?2:1;for(let a=0,r=0,d=0;a<=i.length;a++){let c=a?i[a-1].to:e,h=a<i.length?i[a].from:t;for(let f=c,u,p,b;f<h;f++)if(p=Un[u=o.charCodeAt(f)])if(p<0){for(let k=r-3;k>=0;k-=3)if(je[k+1]==-p){let v=je[k+2],C=v&2?s:v&4?v&1?l:s:0;C&&(se[f]=se[je[k]]=C),r=k;break}}else{if(je.length==189)break;je[r++]=f,je[r++]=u,je[r++]=d}else if((b=se[f])==2||b==1){let k=b==s;d=k?0:1;for(let v=r-3;v>=0;v-=3){let C=je[v+2];if(C&2)break;if(k)je[v+2]|=2;else{if(C&4)break;je[v+2]|=4}}}}}function uc(o,e,t,i){for(let s=0,l=i;s<=t.length;s++){let a=s?t[s-1].to:o,r=s<t.length?t[s].from:e;for(let d=a;d<r;){let c=se[d];if(c==256){let h=d+1;for(;;)if(h==r){if(s==t.length)break;h=t[s++].to,r=s<t.length?t[s].from:e}else if(se[h]==256)h++;else break;let f=l==1,u=(h<e?se[h]:i)==1,p=f==u?f?1:2:i;for(let b=h,k=s,v=k?t[k-1].to:o;b>d;)b==v&&(b=t[--k].from,v=k?t[k-1].to:o),se[--b]=p;d=h}else l=c,d++}}}function Wn(o,e,t,i,s,l,a){let r=i%2?2:1;if(i%2==s%2)for(let d=e,c=0;d<t;){let h=!0,f=!1;if(c==l.length||d<l[c].from){let k=se[d];k!=r&&(h=!1,f=k==16)}let u=!h&&r==1?[]:null,p=h?i:i+1,b=d;e:for(;;)if(c<l.length&&b==l[c].from){if(f)break e;let k=l[c];if(!h)for(let v=k.to,C=c+1;;){if(v==t)break e;if(C<l.length&&l[C].from==v)v=l[C++].to;else{if(se[v]==r)break e;break}}if(c++,u)u.push(k);else{k.from>d&&a.push(new ot(d,k.from,p));let v=k.direction==wt!=!(p%2);Hn(o,v?i+1:i,s,k.inner,k.from,k.to,a),d=k.to}b=k.to}else{if(b==t||(h?se[b]!=r:se[b]==r))break;b++}u?Wn(o,d,b,i+1,s,u,a):d<b&&a.push(new ot(d,b,p)),d=b}else for(let d=t,c=l.length;d>e;){let h=!0,f=!1;if(!c||d>l[c-1].to){let k=se[d-1];k!=r&&(h=!1,f=k==16)}let u=!h&&r==1?[]:null,p=h?i:i+1,b=d;e:for(;;)if(c&&b==l[c-1].to){if(f)break e;let k=l[--c];if(!h)for(let v=k.from,C=c;;){if(v==e)break e;if(C&&l[C-1].to==v)v=l[--C].from;else{if(se[v-1]==r)break e;break}}if(u)u.push(k);else{k.to<d&&a.push(new ot(k.to,d,p));let v=k.direction==wt!=!(p%2);Hn(o,v?i+1:i,s,k.inner,k.from,k.to,a),d=k.from}b=k.from}else{if(b==e||(h?se[b-1]!=r:se[b-1]==r))break;b--}u?Wn(o,b,d,i+1,s,u,a):b<d&&a.push(new ot(b,d,p)),d=b}}function Hn(o,e,t,i,s,l,a){let r=e%2?2:1;hc(o,s,l,i,r),fc(o,s,l,i,r),uc(s,l,i,r),Wn(o,s,l,e,t,i,a)}function pc(o,e,t){if(!o)return[new ot(0,0,e==qn?1:0)];if(e==wt&&!t.length&&!cc.test(o))return ql(o.length);if(t.length)for(;o.length>se.length;)se[se.length]=256;let i=[],s=e==wt?0:1;return Hn(o,s,s,t,0,o.length,i),i}function ql(o){return[new ot(0,o,0)]}let Ul="";function mc(o,e,t,i,s){var l;let a=i.head-o.from,r=ot.find(e,a,(l=i.bidiLevel)!==null&&l!==void 0?l:-1,i.assoc),d=e[r],c=d.side(s,t);if(a==c){let u=r+=s?1:-1;if(u<0||u>=e.length)return null;d=e[r=u],a=d.side(!s,t),c=d.side(s,t)}let h=Ke(o.text,a,d.forward(s,t));(h<d.from||h>d.to)&&(h=c),Ul=o.text.slice(Math.min(a,h),Math.max(a,h));let f=r==(s?e.length-1:0)?null:e[r+(s?1:-1)];return f&&h==c&&f.level+(s?0:1)<d.level?U.cursor(f.side(!s,t)+o.from,f.forward(s,t)?1:-1,f.level):U.cursor(h+o.from,d.forward(s,t)?-1:1,d.level)}function gc(o,e,t){for(let i=e;i<t;i++){let s=jl(o.charCodeAt(i));if(s==1)return wt;if(s==2||s==4)return qn}return wt}const Wl=H.define(),Hl=H.define(),Kl=H.define(),Ql=H.define(),Kn=H.define(),Gl=H.define(),Yl=H.define(),Qn=H.define(),Gn=H.define(),Xl=H.define({combine:o=>o.some(e=>e)}),kc=H.define({combine:o=>o.some(e=>e)}),Jl=H.define();class Tt{constructor(e,t="nearest",i="nearest",s=5,l=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=l,this.isSnapshot=a}map(e){return e.empty?this:new Tt(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 Tt(U.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Pi=ce.define({map:(o,e)=>o.map(e)}),Zl=ce.define();function ze(o,e,t){let i=o.facet(Ql);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=H.define({combine:o=>o.length?o[0]:!0});let bc=0;const ti=H.define();class Mt{constructor(e,t,i,s,l){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=s,this.extension=l(this)}static define(e,t){const{eventHandlers:i,eventObservers:s,provide:l,decorations:a}=t||{};return new Mt(bc++,e,i,s,r=>{let d=[ti.of(r)];return a&&d.push(ii.of(c=>{let h=c.plugin(r);return h?a(h):ye.none})),l&&d.push(l(r)),d})}static fromClass(e,t){return Mt.define(i=>new e(i),t)}}class Yn{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 eo=H.define(),Xn=H.define(),ii=H.define(),to=H.define(),Jn=H.define(),io=H.define();function no(o,e){let t=o.state.facet(io);if(!t.length)return t;let i=t.map(l=>l instanceof Function?l(o):l),s=[];return le.spans(i,e.from,e.to,{point(){},span(l,a,r,d){let c=l-e.from,h=a-e.from,f=s;for(let u=r.length-1;u>=0;u--,d--){let p=r[u].spec.bidiIsolate,b;if(p==null&&(p=gc(e.text,c,h)),d>0&&f.length&&(b=f[f.length-1]).to==c&&b.direction==p)b.to=h,f=b.inner;else{let k={from:c,to:h,direction:p,inner:[]};f.push(k),f=k.inner}}}}),s}const so=H.define();function lo(o){let e=0,t=0,i=0,s=0;for(let l of o.state.facet(so)){let a=l(o);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(i=Math.max(i,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:t,top:i,bottom:s}}const ni=H.define();class Ae{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Ae(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 s=e[t-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),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 s=0,l=0,a=0,r=0;;s++){let d=s==e.length?null:e[s],c=a-r,h=d?d.fromB:1e9;for(;l<t.length&&t[l]<h;){let f=t[l],u=t[l+1],p=Math.max(r,f),b=Math.min(h,u);if(p<=b&&new Ae(p+c,b+c,p,b).addToSet(i),u>h)break;l+=2}if(!d)return i;new Ae(d.fromA,d.toA,d.fromB,d.toB).addToSet(i),a=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 l of i)this.changes=this.changes.compose(l.changes);let s=[];this.changes.iterChangedRanges((l,a,r,d)=>s.push(new Ae(l,a,r,d))),this.changedRanges=s}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 oo 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=ye.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 de],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ae(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:c,toA:h})=>h<this.minWidthFrom||c>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 s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!Nc(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let l=s>-1?yc(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:h}=this.hasComposition;i=new Ae(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=l?{from:l.range.fromB,to:l.range.toB}:null,(q.ie||q.chrome)&&!l&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,r=this.updateDeco(),d=Cc(a,r,e.changes);return i=Ae.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,l),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=q.chrome||q.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let l=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.children)a instanceof Je&&a.widget instanceof zn&&l.push(a.dom);s.updateGaps(l)}updateChildren(e,t,i){let s=i?i.range.addToSet(e.slice()):e,l=this.childCursor(t);for(let a=s.length-1;;a--){let r=a>=0?s[a]:null;if(!r)break;let{fromA:d,toA:c,fromB:h,toB:f}=r,u,p,b,k;if(i&&i.range.fromB<f&&i.range.toB>h){let g=ei.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),m=ei.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);p=g.breakAtStart,b=g.openStart,k=m.openEnd;let S=this.compositionView(i);m.breakAtStart?S.breakAfter=1:m.content.length&&S.merge(S.length,S.length,m.content[0],!1,m.openStart,0)&&(S.breakAfter=m.content[0].breakAfter,m.content.shift()),g.content.length&&S.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),u=g.content.concat(S).concat(m.content)}else({content:u,breakAtStart:p,openStart:b,openEnd:k}=ei.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:v,off:C}=l.findPos(c,1),{i:x,off:V}=l.findPos(d,-1);Vl(this,x,V,v,C,u,p,b,k)}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(Zl)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ee(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new Xe(s,[t],t.length);let i=new de;return i.append(t,0),i}fixCompositionDOM(e){let t=(l,a)=>{a.flags|=8|(a.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(a);let r=ne.get(l);r&&r!=a&&(r.dom=null),a.setDOM(l)},i=this.childPos(e.range.fromB,1),s=this.children[i.i];t(e.line,s);for(let l=e.marks.length-1;l>=-1;l--)i=s.childPos(i.off,1),s=s.children[i.i],t(l>=0?e.marks[l].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,l=!s&&Ai(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||l))return;let a=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),c=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(q.gecko&&r.empty&&!this.hasComposition&&wc(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=c=new we(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!Xt(d.node,d.offset,h.anchorNode,h.anchorOffset)||!Xt(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&this.dom.contains(h.focusNode)&&Sc(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Gt(this.view.root);if(f)if(r.empty){if(q.gecko){let u=xc(d.node,d.offset);if(u&&u!=3){let p=(u==1?Sl:Nl)(d.node,d.offset);p&&(d=new we(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(c.node,c.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([d,c]=[c,d]),u.setEnd(c.node,c.offset),u.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(u)}l&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,c)),this.impreciseAnchor=d.precise?null:new we(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new we(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Xt(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=Gt(e.root),{anchorNode:s,anchorOffset:l}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=de.find(this,t.head);if(!a)return;let r=a.posAtStart;if(t.head==r||t.head==r+a.length)return;let d=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!d||!c||d.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);i.collapse(h.node,h.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(s,l)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let s=e.offset;!i&&s<t.childNodes.length;s++){let l=ne.get(t.childNodes[s]);l instanceof de&&(i=l.domAtPos(0))}for(let s=e.offset-1;!i&&s>=0;s--){let l=ne.get(t.childNodes[s]);l instanceof de&&(i=l.domAtPos(l.length))}return i?new we(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 s=this.children[t];if(i<s.length||s instanceof de)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,s=0;for(let l=this.length,a=this.children.length-1;a>=0;a--){let r=this.children[a],d=l-r.breakAfter,c=d-r.length;if(d<e)break;if(c<=e&&(c<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof de&&!(i instanceof de&&t>=0)))i=r,s=c;else if(i&&c==e&&d==e&&r instanceof Je&&Math.abs(t)<2){if(r.deco.startSide<0)break;a&&(i=null)}l=c}return i?i.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof de))return null;for(;s.children.length;){let{i:r,off:d}=s.childPos(i,1);for(;;r++){if(r==s.children.length)return null;if((s=s.children[r]).length)break}i=d}if(!(s instanceof Ee))return null;let l=Ke(s.text,i);if(l==i)return null;let a=kt(s.dom,i,l).getClientRects();for(let r=0;r<a.length;r++){let d=a[r];if(r==a.length-1||d.top<d.bottom&&d.left<d.right)return d}return null}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,l=this.view.contentDOM.clientWidth,a=l>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let c=0,h=0;h<this.children.length;h++){let f=this.children[h],u=c+f.length;if(u>s)break;if(c>=i){let p=f.dom.getBoundingClientRect();if(t.push(p.height),a){let b=f.dom.lastChild,k=b?Yt(b):[];if(k.length){let v=k[k.length-1],C=d?v.right-p.left:p.right-v.left;C>r&&(r=C,this.minWidth=l,this.minWidthFrom=c,this.minWidthTo=u)}}}c=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 l of this.children)if(l instanceof de){let a=l.measureTextSize();if(a)return a}let e=document.createElement("div"),t,i,s;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 l=Yt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=l?l.width/27:7,s=l?l.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ol(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let l=s==t.viewports.length?null:t.viewports[s],a=l?l.from-1:this.length;if(a>i){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(ye.replace({widget:new zn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!l)break;i=l.to+1}return ye.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ii).map(l=>(this.dynamicDecorationMap[e++]=typeof l=="function")?l(this.view):l),i=!1,s=this.view.state.facet(to).map((l,a)=>{let r=typeof l=="function";return r&&(i=!0),r?l(this.view):l});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(le.join(s))),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 c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(Jl))try{if(c(this.view,e.range,e))return!0}catch(h){ze(this.view.state,h,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let l=lo(this.view),a={left:i.left-l.left,top:i.top-l.top,right:i.right+l.right,bottom:i.bottom+l.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;Jd(this.view.scrollDOM,a,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 wc(o){return o.node.nodeType==1&&o.node.firstChild&&(o.offset==0||o.node.childNodes[o.offset-1].contentEditable=="false")&&(o.offset==o.node.childNodes.length||o.node.childNodes[o.offset].contentEditable=="false")}function ao(o,e){let t=o.observer.selectionRange;if(!t.focusNode)return null;let i=Sl(t.focusNode,t.focusOffset),s=Nl(t.focusNode,t.focusOffset),l=i||s;if(s&&i&&s.node!=i.node){let r=ne.get(s.node);if(!r||r instanceof Ee&&r.text!=s.node.nodeValue)l=s;else if(o.docView.lastCompositionAfterCursor){let d=ne.get(i.node);!d||d instanceof Ee&&d.text!=i.node.nodeValue||(l=s)}}if(o.docView.lastCompositionAfterCursor=l!=i,!l)return null;let a=e-l.offset;return{from:a,to:a+l.node.nodeValue.length,node:l.node}}function yc(o,e,t){let i=ao(o,t);if(!i)return null;let{node:s,from:l,to:a}=i,r=s.nodeValue;if(/[\n\r]/.test(r)||o.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,c=new Ae(d.mapPos(l),d.mapPos(a),l,a),h=[];for(let f=s.parentNode;;f=f.parentNode){let u=ne.get(f);if(u instanceof Xe)h.push({node:f,deco:u.mark});else{if(u instanceof de||f.nodeName=="DIV"&&f.parentNode==o.contentDOM)return{range:c,text:s,marks:h,line:f};if(f!=o.contentDOM)h.push({node:f,deco:new Jt({inclusive:!0,attributes:oc(f),tagName:f.tagName.toLowerCase()})});else return null}}}function xc(o,e){return o.nodeType!=1?0:(e&&o.childNodes[e-1].contentEditable=="false"?1:0)|(e<o.childNodes.length&&o.childNodes[e].contentEditable=="false"?2:0)}let vc=class{constructor(){this.changes=[]}compareRange(e,t){jn(e,t,this.changes)}comparePoint(e,t){jn(e,t,this.changes)}};function Cc(o,e,t){let i=new vc;return le.compare(o,e,t,i),i.changes}function Sc(o,e){for(let t=o;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Nc(o,e){let t=!1;return e&&o.iterChangedRanges((i,s)=>{i<e.to&&s>e.from&&(t=!0)}),t}function Bc(o,e,t=1){let i=o.charCategorizer(e),s=o.doc.lineAt(e),l=e-s.from;if(s.length==0)return U.cursor(e);l==0?t=1:l==s.length&&(t=-1);let a=l,r=l;t<0?a=Ke(s.text,l,!1):r=Ke(s.text,l);let d=i(s.text.slice(a,r));for(;a>0;){let c=Ke(s.text,a,!1);if(i(s.text.slice(c,a))!=d)break;a=c}for(;r<s.length;){let c=Ke(s.text,r);if(i(s.text.slice(r,c))!=d)break;r=c}return U.range(a+s.from,r+s.from)}function Oc(o,e){return e.left>o?e.left-o:Math.max(0,o-e.right)}function Vc(o,e){return e.top>o?e.top-o:Math.max(0,o-e.bottom)}function Zn(o,e){return o.top<e.bottom-1&&o.bottom>e.top+1}function ro(o,e){return e<o.top?{top:e,left:o.left,right:o.right,bottom:o.bottom}:o}function co(o,e){return e>o.bottom?{top:o.top,left:o.left,right:o.right,bottom:e}:o}function es(o,e,t){let i,s,l,a,r=!1,d,c,h,f;for(let b=o.firstChild;b;b=b.nextSibling){let k=Yt(b);for(let v=0;v<k.length;v++){let C=k[v];s&&Zn(s,C)&&(C=ro(co(C,s.bottom),s.top));let x=Oc(e,C),V=Vc(t,C);if(x==0&&V==0)return b.nodeType==3?ho(b,e,t):es(b,e,t);if(!i||a>V||a==V&&l>x){i=b,s=C,l=x,a=V;let g=V?t<C.top?-1:1:x?e<C.left?-1:1:0;r=!g||(g>0?v<k.length-1:v>0)}x==0?t>C.bottom&&(!h||h.bottom<C.bottom)?(d=b,h=C):t<C.top&&(!f||f.top>C.top)&&(c=b,f=C):h&&Zn(h,C)?h=co(h,C.bottom):f&&Zn(f,C)&&(f=ro(f,C.top))}}if(h&&h.bottom>=t?(i=d,s=h):f&&f.top<=t&&(i=c,s=f),!i)return{node:o,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return ho(i,u,t);if(r&&i.contentEditable!="false")return es(i,u,t);let p=Array.prototype.indexOf.call(o.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:o,offset:p}}function ho(o,e,t){let i=o.nodeValue.length,s=-1,l=1e9,a=0;for(let r=0;r<i;r++){let d=kt(o,r,r+1).getClientRects();for(let c=0;c<d.length;c++){let h=d[c];if(h.top==h.bottom)continue;a||(a=e-h.left);let f=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<l){let u=e>=(h.left+h.right)/2,p=u;if((q.chrome||q.gecko)&&kt(o,r).getBoundingClientRect().left==h.right&&(p=!u),f<=0)return{node:o,offset:r+(p?1:0)};s=r+(p?1:0),l=f}}}return{node:o,offset:s>-1?s:a>0?o.nodeValue.length:0}}function fo(o,e,t,i=-1){var s,l;let a=o.contentDOM.getBoundingClientRect(),r=a.top+o.viewState.paddingTop,d,{docHeight:c}=o.viewState,{x:h,y:f}=e,u=f-r;if(u<0)return 0;if(u>c)return o.state.doc.length;for(let g=o.viewState.heightOracle.textHeight/2,m=!1;d=o.elementAtHeight(u),d.type!=Le.Text;)for(;u=i>0?d.bottom+g:d.top-g,!(u>=0&&u<=c);){if(m)return t?null:0;m=!0,i=-i}f=r+u;let p=d.from;if(p<o.viewport.from)return o.viewport.from==0?0:t?null:uo(o,a,d,h,f);if(p>o.viewport.to)return o.viewport.to==o.state.doc.length?o.state.doc.length:t?null:uo(o,a,d,h,f);let b=o.dom.ownerDocument,k=o.root.elementFromPoint?o.root:b,v=k.elementFromPoint(h,f);v&&!o.contentDOM.contains(v)&&(v=null),v||(h=Math.max(a.left+1,Math.min(a.right-1,h)),v=k.elementFromPoint(h,f),v&&!o.contentDOM.contains(v)&&(v=null));let C,x=-1;if(v&&((s=o.docView.nearest(v))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let g=b.caretPositionFromPoint(h,f);g&&({offsetNode:C,offset:x}=g)}else if(b.caretRangeFromPoint){let g=b.caretRangeFromPoint(h,f);g&&({startContainer:C,startOffset:x}=g,(!o.contentDOM.contains(C)||q.safari&&_c(C,x,h)||q.chrome&&Ac(C,x,h))&&(C=void 0))}}if(!C||!o.docView.dom.contains(C)){let g=de.find(o.docView,p);if(!g)return u>d.top+d.height/2?d.to:d.from;({node:C,offset:x}=es(g.dom,h,f))}let V=o.docView.nearest(C);if(!V)return null;if(V.isWidget&&((l=V.dom)===null||l===void 0?void 0:l.nodeType)==1){let g=V.dom.getBoundingClientRect();return e.y<g.top||e.y<=g.bottom&&e.x<=(g.left+g.right)/2?V.posAtStart:V.posAtEnd}else return V.localPosFromDOM(C,x)+V.posAtStart}function uo(o,e,t,i,s){let l=Math.round((i-e.left)*o.defaultCharacterWidth);if(o.lineWrapping&&t.height>o.defaultLineHeight*1.5){let r=o.viewState.heightOracle.textHeight,d=Math.floor((s-t.top-(o.defaultLineHeight-r)*.5)/r);l+=d*o.viewState.heightOracle.lineLength}let a=o.state.sliceDoc(t.from,t.to);return t.from+Qd(a,l,o.state.tabSize)}function _c(o,e,t){let i;if(o.nodeType!=3||e!=(i=o.nodeValue.length))return!1;for(let s=o.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return kt(o,i-1,i).getBoundingClientRect().left>t}function Ac(o,e,t){if(e!=0)return!1;for(let s=o;;){let l=s.parentNode;if(!l||l.nodeType!=1||l.firstChild!=s)return!1;if(l.classList.contains("cm-line"))break;s=l}let i=o.nodeType==1?o.getBoundingClientRect():kt(o,0,Math.max(o.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Tc(o,e){let t=o.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 Mc(o,e,t,i){let s=Tc(o,e.head),l=!i||s.type!=Le.Text||!(o.lineWrapping||s.widgetLineBreaks)?null:o.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(l){let a=o.dom.getBoundingClientRect(),r=o.textDirectionAt(s.from),d=o.posAtCoords({x:t==(r==me.LTR)?a.right-1:a.left+1,y:(l.top+l.bottom)/2});if(d!=null)return U.cursor(d,t?-1:1)}return U.cursor(t?s.to:s.from,t?-1:1)}function po(o,e,t,i){let s=o.state.doc.lineAt(e.head),l=o.bidiSpans(s),a=o.textDirectionAt(s.from);for(let r=e,d=null;;){let c=mc(s,l,a,r,t),h=Ul;if(!c){if(s.number==(t?o.state.doc.lines:1))return r;h=`
8
- `,s=o.state.doc.line(s.number+(t?1:-1)),l=o.bidiSpans(s),c=o.visualLineSide(s,!t)}if(d){if(!d(h))return r}else{if(!i)return c;d=i(h)}r=c}}function Ec(o,e,t){let i=o.state.charCategorizer(e),s=i(t);return l=>{let a=i(l);return s==Ge.Space&&(s=a),s==a}}function Ic(o,e,t,i){let s=e.head,l=t?1:-1;if(s==(t?o.state.doc.length:0))return U.cursor(s,e.assoc);let a=e.goalColumn,r,d=o.contentDOM.getBoundingClientRect(),c=o.coordsAtPos(s,e.assoc||-1),h=o.documentTop;if(c)a==null&&(a=c.left-d.left),r=l<0?c.top:c.bottom;else{let p=o.viewState.lineBlockAt(s);a==null&&(a=Math.min(d.right-d.left,o.defaultCharacterWidth*(s-p.from))),r=(l<0?p.top:p.bottom)+h}let f=d.left+a,u=i??o.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let b=r+(u+p)*l,k=fo(o,{x:f,y:b},!1,l);if(b<d.top||b>d.bottom||(l<0?k<s:k>s)){let v=o.docView.coordsForChar(k),C=!v||b<v.top?-1:1;return U.cursor(k,C,void 0,a)}}}function Fi(o,e,t){for(;;){let i=0;for(let s of o)s.between(e-1,e+1,(l,a,r)=>{if(e>l&&e<a){let d=i||t||(e-l<a-e?-1:1);e=d<0?l:a,i=d}});if(!i)return e}}function ts(o,e,t){let i=Fi(o.state.facet(Jn).map(s=>s(o)),t.from,e.head>t.from?-1:1);return i==t.from?t:U.cursor(i,i<t.from?1:-1)}const si="￿";class Dc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(ee.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=si}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let l=this.text.length;this.readNode(s);let a=s.nextSibling;if(a==t)break;let r=ne.get(s),d=ne.get(a);(r&&d?r.breakAfter:(r?r.breakAfter:Ti(s))||Ti(a)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>l)&&this.lineBreak(),s=a}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,s=this.lineSeparator?null:/\r\n?|\n/g;;){let l=-1,a=1,r;if(this.lineSeparator?(l=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(r=s.exec(t))&&(l=r.index,a=r[0].length),this.append(t.slice(i,l<0?t.length:l)),l<0)break;if(this.lineBreak(),a>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=a-1);i=l+a}}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 s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.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+(Pc(e,i.node,i.offset)?t:0))}}function Pc(o,e,t){for(;;){if(!e||t<Ye(e))return!1;if(e==o)return!0;t=gt(e)+1,e=e.parentNode}}class mo{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class $c{constructor(e,t,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:l,impreciseAnchor:a}=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=l||a?[]:Lc(e),d=new Dc(r,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=jc(r,this.bounds.from)}else{let r=e.observer.selectionRange,d=l&&l.node==r.focusNode&&l.offset==r.focusOffset||!Mn(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),c=a&&a.node==r.anchorNode&&a.offset==r.anchorOffset||!Mn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((q.ios||q.chrome)&&e.state.selection.main.empty&&d!=c&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(d,c),u=Math.max(d,c),p=h.from-f,b=h.to-u;(p==0||p==1||f==0)&&(b==0||b==-1||u==e.state.doc.length)&&(d=0,c=e.state.doc.length)}this.newSel=U.single(c,d)}}}function go(o,e){let t,{newSel:i}=e,s=o.state.selection.main,l=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:r}=e.bounds,d=s.from,c=null;(l===8||q.android&&e.text.length<r-a)&&(d=s.to,c="end");let h=Rc(o.state.doc.sliceString(a,r,si),e.text,d-a,c);h&&(q.chrome&&l==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==si+si&&h.toB--,t={from:a+h.from,to:a+h.toA,insert:J.of(e.text.slice(h.from,h.toB).split(si))})}else i&&(!o.hasFocus&&o.state.facet(at)||i.main.eq(s))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!s.empty&&i&&i.main.empty?t={from:s.from,to:s.to,insert:o.state.doc.slice(s.from,s.to)}:t&&t.from>=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:o.state.doc.slice(s.from,t.from).append(t.insert).append(o.state.doc.slice(t.to,s.to))}:(q.mac||q.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&o.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=U.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:J.of([" "])}):q.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
9
- `&&o.lineWrapping&&(i&&(i=U.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:J.of([" "])}),t)return is(o,t,i,l);if(i&&!i.main.eq(s)){let a=!1,r="select";return o.inputState.lastSelectionTime>Date.now()-50&&(o.inputState.lastSelectionOrigin=="select"&&(a=!0),r=o.inputState.lastSelectionOrigin),o.dispatch({selection:i,scrollIntoView:a,userEvent:r}),!0}else return!1}function is(o,e,t,i=-1){if(q.ios&&o.inputState.flushIOSKey(e))return!0;let s=o.state.selection.main;if(q.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&o.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Vt(o.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Vt(o.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Vt(o.contentDOM,"Delete",46)))return!0;let l=e.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let a,r=()=>a||(a=Fc(o,e,t));return o.state.facet(Gl).some(d=>d(o,e.from,e.to,l,r))||o.dispatch(r()),!0}function Fc(o,e,t){let i,s=o.state,l=s.selection.main;if(e.from>=l.from&&e.to<=l.to&&e.to-e.from>=(l.to-l.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&o.inputState.composing<0){let r=l.from<e.from?s.sliceDoc(l.from,e.from):"",d=l.to>e.to?s.sliceDoc(e.to,l.to):"";i=s.replaceSelection(o.state.toText(r+e.insert.sliceString(0,void 0,o.state.lineBreak)+d))}else{let r=s.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(s.selection.ranges.length>1&&o.inputState.composing>=0&&e.to<=l.to&&e.to>=l.to-10){let c=o.state.sliceDoc(e.from,e.to),h,f=t&&ao(o,t.main.head);if(f){let b=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-b}}else h=o.state.doc.lineAt(l.head);let u=l.to-e.to,p=l.to-l.from;i=s.changeByRange(b=>{if(b.from==l.from&&b.to==l.to)return{changes:r,range:d||b.map(r)};let k=b.to-u,v=k-c.length;if(b.to-b.from!=p||o.state.sliceDoc(v,k)!=c||b.to>=h.from&&b.from<=h.to)return{range:b};let C=s.changes({from:v,to:k,insert:e.insert}),x=b.to-l.to;return{changes:C,range:d?U.range(Math.max(0,d.anchor+x),Math.max(0,d.head+x)):b.map(C)}})}else i={changes:r,selection:d&&s.selection.replaceRange(d)}}let a="input.type";return(o.composing||o.inputState.compositionPendingChange&&o.inputState.compositionEndedAt>Date.now()-50)&&(o.inputState.compositionPendingChange=!1,a+=".compose",o.inputState.compositionFirstChange&&(a+=".start",o.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:a,scrollIntoView:!0})}function Rc(o,e,t,i){let s=Math.min(o.length,e.length),l=0;for(;l<s&&o.charCodeAt(l)==e.charCodeAt(l);)l++;if(l==s&&o.length==e.length)return null;let a=o.length,r=e.length;for(;a>0&&r>0&&o.charCodeAt(a-1)==e.charCodeAt(r-1);)a--,r--;if(i=="end"){let d=Math.max(0,l-Math.min(a,r));t-=a+d-l}if(a<l&&o.length<e.length){let d=t<=l&&t>=a?l-t:0;l-=d,r=l+(r-a),a=l}else if(r<l){let d=t<=l&&t>=r?l-t:0;l-=d,a=l+(a-r),r=l}return{from:l,toA:a,toB:r}}function Lc(o){let e=[];if(o.root.activeElement!=o.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:l}=o.observer.selectionRange;return t&&(e.push(new mo(t,i)),(s!=t||l!=i)&&e.push(new mo(s,l))),e}function jc(o,e){if(o.length==0)return null;let t=o[0].pos,i=o.length==2?o[1].pos:t;return t>-1&&i>-1?U.single(t+e,i+e):null}class zc{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,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&lh(e.contentDOM.ownerDocument)}handleEvent(e){!Xc(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 s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=qc(e),i=this.handlers,s=this.view.contentDOM;for(let l in t)if(l!="scroll"){let a=!t[l].handlers.length,r=i[l];r&&a!=!r.handlers.length&&(s.removeEventListener(l,this.handleEvent),r=null),r||s.addEventListener(l,this.handleEvent,{passive:a})}for(let l in i)l!="scroll"&&!t[l]&&s.removeEventListener(l,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&&Wc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=bo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Uc.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,Vt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:q.safari&&!q.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 ko(o,e){return(t,i)=>{try{return e.call(o,i,t)}catch(s){ze(t.state,s)}}}function qc(o){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of o){let s=i.spec;if(s&&s.domEventHandlers)for(let l in s.domEventHandlers){let a=s.domEventHandlers[l];a&&t(l).handlers.push(ko(i.value,a))}if(s&&s.domEventObservers)for(let l in s.domEventObservers){let a=s.domEventObservers[l];a&&t(l).observers.push(ko(i.value,a))}}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 bo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Uc="dthko",Wc=[16,17,18,20,91,92,224,225],Ri=6;function Li(o){return Math.max(0,o)*.7+8}function Hc(o,e){return Math.max(Math.abs(o.clientX-e.clientX),Math.abs(o.clientY-e.clientY))}class Kc{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Zd(e.contentDOM),this.atoms=e.state.facet(Jn).map(a=>a(e));let l=e.contentDOM.ownerDocument;l.addEventListener("mousemove",this.move=this.move.bind(this)),l.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(ee.allowMultipleSelections)&&Qc(e,t),this.dragging=Yc(e,t)&&Oo(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&&Hc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,l=0,a=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:l,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=lo(this.view);e.clientX-d.left<=s+Ri?t=-Li(s-e.clientX):e.clientX+d.right>=a-Ri&&(t=Li(e.clientX-a)),e.clientY-d.top<=l+Ri?i=-Li(l-e.clientY):e.clientY+d.bottom>=r-Ri&&(i=Li(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 s=e.ranges[i],l=null;if(s.empty){let a=Fi(this.atoms,s.from,0);a!=s.from&&(l=U.cursor(a,-1))}else{let a=Fi(this.atoms,s.from,-1),r=Fi(this.atoms,s.to,1);(a!=s.from||r!=s.to)&&(l=U.range(s.from==s.anchor?a:r,s.from==s.head?a:r))}l&&(t||(t=e.ranges.slice()),t[i]=l)}return t?U.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 Qc(o,e){let t=o.state.facet(Wl);return t.length?t[0](e):q.mac?e.metaKey:e.ctrlKey}function Gc(o,e){let t=o.state.facet(Hl);return t.length?t[0](e):q.mac?!e.altKey:!e.ctrlKey}function Yc(o,e){let{main:t}=o.state.selection;if(t.empty)return!1;let i=Gt(o.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let l=0;l<s.length;l++){let a=s[l];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Xc(o,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=o.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),wo=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function Jc(o){let e=o.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{o.focus(),t.remove(),yo(o,t.value)},50)}function ji(o,e,t){for(let i of o.facet(e))t=i(t,o);return t}function yo(o,e){e=ji(o.state,Qn,e);let{state:t}=o,i,s=1,l=t.toText(e),a=l.lines==t.selection.ranges.length;if(ns!=null&&t.selection.ranges.every(d=>d.empty)&&ns==l.toString()){let d=-1;i=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==d)return{range:c};d=h.from;let f=t.toText((a?l.line(s++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:f},range:U.cursor(c.from+f.length)}})}else a?i=t.changeByRange(d=>{let c=l.line(s++);return{changes:{from:d.from,to:d.to,insert:c.text},range:U.cursor(d.from+c.length)}}):i=t.replaceSelection(l);o.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Te.scroll=o=>{o.inputState.lastScrollTop=o.scrollDOM.scrollTop,o.inputState.lastScrollLeft=o.scrollDOM.scrollLeft},Ie.keydown=(o,e)=>(o.inputState.setSelectionOrigin("select"),e.keyCode==27&&o.inputState.tabFocusMode!=0&&(o.inputState.tabFocusMode=Date.now()+2e3),!1),Te.touchstart=(o,e)=>{o.inputState.lastTouchTime=Date.now(),o.inputState.setSelectionOrigin("select.pointer")},Te.touchmove=o=>{o.inputState.setSelectionOrigin("select.pointer")},Ie.mousedown=(o,e)=>{if(o.observer.flush(),o.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of o.state.facet(Kl))if(t=i(o,e),t)break;if(!t&&e.button==0&&(t=th(o,e)),t){let i=!o.hasFocus;o.inputState.startMouseSelection(new Kc(o,e,t,i)),i&&o.observer.ignore(()=>{yl(o.contentDOM);let l=o.root.activeElement;l&&!l.contains(o.contentDOM)&&l.blur()});let s=o.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}return!1};function xo(o,e,t,i){if(i==1)return U.cursor(e,t);if(i==2)return Bc(o.state,e,t);{let s=de.find(o.docView,e),l=o.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:l.from,r=s?s.posAtEnd:l.to;return r<o.state.doc.length&&r==l.to&&r++,U.range(a,r)}}let vo=(o,e,t)=>e>=t.top&&e<=t.bottom&&o>=t.left&&o<=t.right;function Zc(o,e,t,i){let s=de.find(o.docView,e);if(!s)return 1;let l=e-s.posAtStart;if(l==0)return 1;if(l==s.length)return-1;let a=s.coordsAt(l,-1);if(a&&vo(t,i,a))return-1;let r=s.coordsAt(l,1);return r&&vo(t,i,r)?1:a&&a.bottom>=i?-1:1}function Co(o,e){let t=o.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Zc(o,t,e.clientX,e.clientY)}}const eh=q.ie&&q.ie_version<=11;let So=null,No=0,Bo=0;function Oo(o){if(!eh)return o.detail;let e=So,t=Bo;return So=o,Bo=Date.now(),No=!e||t>Date.now()-400&&Math.abs(e.clientX-o.clientX)<2&&Math.abs(e.clientY-o.clientY)<2?(No+1)%3:1}function th(o,e){let t=Co(o,e),i=Oo(e),s=o.state.selection;return{update(l){l.docChanged&&(t.pos=l.changes.mapPos(t.pos),s=s.map(l.changes))},get(l,a,r){let d=Co(o,l),c,h=xo(o,d.pos,d.bias,i);if(t.pos!=d.pos&&!a){let f=xo(o,t.pos,t.bias,i),u=Math.min(f.from,h.from),p=Math.max(f.to,h.to);h=u<h.from?U.range(u,p):U.range(p,u)}return a?s.replaceRange(s.main.extend(h.from,h.to)):r&&i==1&&s.ranges.length>1&&(c=ih(s,d.pos))?c:r?s.addRange(h):U.create([h])}}}function ih(o,e){for(let t=0;t<o.ranges.length;t++){let{from:i,to:s}=o.ranges[t];if(i<=e&&s>=e)return U.create(o.ranges.slice(0,t).concat(o.ranges.slice(t+1)),o.mainIndex==t?0:o.mainIndex-(o.mainIndex>t?1:0))}return null}Ie.dragstart=(o,e)=>{let{selection:{main:t}}=o.state;if(e.target.draggable){let s=o.docView.nearest(e.target);if(s&&s.isWidget){let l=s.posAtStart,a=l+s.length;(l>=t.to||a<=t.from)&&(t=U.range(l,a))}}let{inputState:i}=o;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",ji(o.state,Gn,o.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Ie.dragend=o=>(o.inputState.draggedContent=null,!1);function Vo(o,e,t,i){if(t=ji(o.state,Qn,t),!t)return;let s=o.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:l}=o.inputState,a=i&&l&&Gc(o,e)?{from:l.from,to:l.to}:null,r={from:s,insert:t},d=o.state.changes(a?[a,r]:r);o.focus(),o.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),o.inputState.draggedContent=null}Ie.drop=(o,e)=>{if(!e.dataTransfer)return!1;if(o.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,l=()=>{++s==t.length&&Vo(o,e,i.filter(a=>a!=null).join(o.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let r=new FileReader;r.onerror=l,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[a]=r.result),l()},r.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Vo(o,e,i,!0),!0}return!1},Ie.paste=(o,e)=>{if(o.state.readOnly)return!0;o.observer.flush();let t=wo?null:e.clipboardData;return t?(yo(o,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Jc(o),!1)};function nh(o,e){let t=o.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(),o.focus()},50)}function sh(o){let e=[],t=[],i=!1;for(let s of o.selection.ranges)s.empty||(e.push(o.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:l}of o.selection.ranges){let a=o.doc.lineAt(l);a.number>s&&(e.push(a.text),t.push({from:a.from,to:Math.min(o.doc.length,a.to+1)})),s=a.number}i=!0}return{text:ji(o,Gn,e.join(o.lineBreak)),ranges:t,linewise:i}}let ns=null;Ie.copy=Ie.cut=(o,e)=>{let{text:t,ranges:i,linewise:s}=sh(o.state);if(!t&&!s)return!1;ns=s?t:null,e.type=="cut"&&!o.state.readOnly&&o.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let l=wo?null:e.clipboardData;return l?(l.clearData(),l.setData("text/plain",t),!0):(nh(o,t),!1)};const _o=Ct.define();function Ao(o,e){let t=[];for(let i of o.facet(Yl)){let s=i(o,e);s&&t.push(s)}return t?o.update({effects:t,annotations:_o.of(!0)}):null}function To(o){setTimeout(()=>{let e=o.hasFocus;if(e!=o.inputState.notifiedFocused){let t=Ao(o.state,e);t?o.dispatch(t):o.update([])}},10)}Te.focus=o=>{o.inputState.lastFocusTime=Date.now(),!o.scrollDOM.scrollTop&&(o.inputState.lastScrollTop||o.inputState.lastScrollLeft)&&(o.scrollDOM.scrollTop=o.inputState.lastScrollTop,o.scrollDOM.scrollLeft=o.inputState.lastScrollLeft),To(o)},Te.blur=o=>{o.observer.clearSelectionRange(),To(o)},Te.compositionstart=Te.compositionupdate=o=>{o.observer.editContext||(o.inputState.compositionFirstChange==null&&(o.inputState.compositionFirstChange=!0),o.inputState.composing<0&&(o.inputState.composing=0))},Te.compositionend=o=>{o.observer.editContext||(o.inputState.composing=-1,o.inputState.compositionEndedAt=Date.now(),o.inputState.compositionPendingKey=!0,o.inputState.compositionPendingChange=o.observer.pendingRecords().length>0,o.inputState.compositionFirstChange=null,q.chrome&&q.android?o.observer.flushSoon():o.inputState.compositionPendingChange?Promise.resolve().then(()=>o.observer.flush()):setTimeout(()=>{o.inputState.composing<0&&o.docView.hasComposition&&o.update([])},50))},Te.contextmenu=o=>{o.inputState.lastContextMenu=Date.now()},Ie.beforeinput=(o,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&o.observer.editContext){let l=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(l&&a.length){let r=a[0],d=o.posAtDOM(r.startContainer,r.startOffset),c=o.posAtDOM(r.endContainer,r.endOffset);return is(o,{from:d,to:c,insert:o.state.toText(l)},null),!0}}let s;if(q.chrome&&q.android&&(s=bo.find(l=>l.inputType==e.inputType))&&(o.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let l=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>l+10&&o.hasFocus&&(o.contentDOM.blur(),o.focus())},100)}return q.ios&&e.inputType=="deleteContentForward"&&o.observer.flushSoon(),q.safari&&e.inputType=="insertText"&&o.inputState.composing>=0&&setTimeout(()=>Te.compositionend(o,e),20),!1};const Mo=new Set;function lh(o){Mo.has(o)||(Mo.add(o),o.addEventListener("copy",()=>{}),o.addEventListener("cut",()=>{}))}const Eo=["pre-wrap","normal","pre-line","break-spaces"];let Et=!1;function Io(){Et=!1}class oh{constructor(e){this.lineWrapping=e,this.doc=J.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 Eo.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let s=e[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(t=!0,this.heightSamples[Math.floor(s*10)]=!0)}return t}refresh(e,t,i,s,l,a){let r=Eo.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=s,this.lineLength=l,d){this.heightSamples={};for(let c=0;c<a.length;c++){let h=a[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return d}}class ah{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,s,l){this.from=e,this.length=t,this.top=i,this.height=s,this._content=l}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 lt?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(o){return o[o.ByPos=0]="ByPos",o[o.ByHeight=1]="ByHeight",o[o.ByPosNoHeight=2]="ByPosNoHeight",o}(oe||(oe={}));const zi=.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)>zi&&(Et=!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,s){let l=this,a=i.doc;for(let r=s.length-1;r>=0;r--){let{fromA:d,toA:c,fromB:h,toB:f}=s[r],u=l.lineAt(d,oe.ByPosNoHeight,i.setDoc(t),0,0),p=u.to>=c?u:l.lineAt(c,oe.ByPosNoHeight,i,0,0);for(f+=p.to-c,c=p.to;r>0&&u.from<=s[r-1].toA;)d=s[r-1].fromA,h=s[r-1].fromB,r--,d<u.from&&(u=l.lineAt(d,oe.ByPosNoHeight,i,0,0));h+=u.from-d,d=u.from;let b=ss.build(i.setDoc(a),e,h,f);l=qi(l,l.replace(d,c,b))}return l.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,s=0,l=0;for(;;)if(t==i)if(s>l*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,s-=r.size}else if(l>s*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,l-=r.size}else break;else if(s<l){let r=e[t++];r&&(s+=r.size)}else{let r=e[--i];r&&(l+=r.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new rh(ve.of(e.slice(0,t)),a,ve.of(e.slice(i)))}}function qi(o,e){return o==e?o:(o.constructor!=e.constructor&&(Et=!0),e)}ve.prototype.size=1;class Do extends ve{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,s){return new qe(s,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,s,l){return this.blockAt(0,i,s,l)}forEachLine(e,t,i,s,l,a){e<=l+this.length&&t>=l&&a(this.blockAt(0,i,s,l))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oe extends Do{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new qe(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Oe||s instanceof ge&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ge?s=new Oe(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ve.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.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,s=e.doc.lineAt(t+this.length).number,l=s-i+1,a,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*l);a=d/l,this.length>l+1&&(r=(this.height-d)/(this.length-l-1))}else a=this.height/l;return{firstLine:i,lastLine:s,perLine:a,perChar:r}}blockAt(e,t,i,s){let{firstLine:l,lastLine:a,perLine:r,perChar:d}=this.heightMetrics(t,s);if(t.lineWrapping){let c=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),h=t.doc.lineAt(c),f=r+h.length*d,u=Math.max(i,e-f/2);return new qe(h.from,h.length,u,f,0)}else{let c=Math.max(0,Math.min(a-l,Math.floor((e-i)/r))),{from:h,length:f}=t.doc.line(l+c);return new qe(h,f,i+r*c,r,0)}}lineAt(e,t,i,s,l){if(t==oe.ByHeight)return this.blockAt(e,i,s,l);if(t==oe.ByPosNoHeight){let{from:p,to:b}=i.doc.lineAt(e);return new qe(p,b-p,0,0,0)}let{firstLine:a,perLine:r,perChar:d}=this.heightMetrics(i,l),c=i.doc.lineAt(e),h=r+c.length*d,f=c.number-a,u=s+r*f+d*(c.from-l-f);return new qe(c.from,c.length,Math.max(s,Math.min(u,s+this.height-h)),h,0)}forEachLine(e,t,i,s,l,a){e=Math.max(e,l),t=Math.min(t,l+this.length);let{firstLine:r,perLine:d,perChar:c}=this.heightMetrics(i,l);for(let h=e,f=s;h<=t;){let u=i.doc.lineAt(h);if(h==e){let b=u.number-r;f+=d*b+c*(e-l-b)}let p=d+c*u.length;a(new qe(u.from,u.length,f,p,0)),f+=p,h=u.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let l=i[i.length-1];l instanceof ge?i[i.length-1]=new ge(l.length+s):i.push(null,new ge(s-1))}if(e>0){let l=i[0];l instanceof ge?i[0]=new ge(e+l.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,s){let l=t+this.length;if(s&&s.from<=t+this.length&&s.more){let a=[],r=Math.max(t,s.from),d=-1;for(s.from>t&&a.push(new ge(s.from-t-1).updateHeight(e,t));r<=l&&s.more;){let h=e.doc.lineAt(r).length;a.length&&a.push(null);let f=s.heights[s.index++];d==-1?d=f:Math.abs(f-d)>=zi&&(d=-2);let u=new Oe(h,f);u.outdated=!1,a.push(u),r+=h+1}r<=l&&a.push(null,new ge(l-r).updateHeight(e,r));let c=ve.of(a);return(d<0||Math.abs(c.height-this.height)>=zi||Math.abs(d-this.heightMetrics(e,t).perLine)>=zi)&&(Et=!0),qi(this,c)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class rh 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,s){let l=i+this.left.height;return e<l?this.left.blockAt(e,t,i,s):this.right.blockAt(e,t,l,s+this.left.length+this.break)}lineAt(e,t,i,s,l){let a=s+this.left.height,r=l+this.left.length+this.break,d=t==oe.ByHeight?e<a:e<r,c=d?this.left.lineAt(e,t,i,s,l):this.right.lineAt(e,t,i,a,r);if(this.break||(d?c.to<r:c.from>r))return c;let h=t==oe.ByPosNoHeight?oe.ByPosNoHeight:oe.ByPos;return d?c.join(this.right.lineAt(r,h,i,a,r)):this.left.lineAt(r,h,i,s,l).join(c)}forEachLine(e,t,i,s,l,a){let r=s+this.left.height,d=l+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,s,l,a),t>=d&&this.right.forEachLine(e,t,i,r,d,a);else{let c=this.lineAt(d,oe.ByPos,i,s,l);e<c.from&&this.left.forEachLine(e,c.from-1,i,s,l,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(c.to+1,t,i,r,d,a)}}replace(e,t,i){let s=this.left.length+this.break;if(t<s)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-s,t-s,i));let l=[];e>0&&this.decomposeLeft(e,l);let a=l.length;for(let r of i)l.push(r);if(e>0&&Po(l,a-1),t<this.length){let r=l.length;this.decomposeRight(t,l),Po(l,r)}return ve.of(l)}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,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<s&&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=qi(this.left,e),this.right=qi(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,s){let{left:l,right:a}=this,r=t+l.length+this.break,d=null;return s&&s.from<=t+l.length&&s.more?d=l=l.updateHeight(e,t,i,s):l.updateHeight(e,t,i),s&&s.from<=r+a.length&&s.more?d=a=a.updateHeight(e,r,i,s):a.updateHeight(e,r,i),d?this.balanced(l,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Po(o,e){let t,i;o[e]==null&&(t=o[e-1])instanceof ge&&(i=o[e+1])instanceof ge&&o.splice(e-1,3,new ge(t.length+1+i.length))}const dh=5;class ss{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),s=this.nodes[this.nodes.length-1];s instanceof Oe?s.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 s=i.widget?i.widget.estimatedHeight:0,l=i.widget?i.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new Do(a,s,i)):(a||l||s>=dh)&&this.addLineDeco(s,l,a)}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 s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.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 s of this.nodes)s instanceof Oe&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(e,t,i,s){let l=new ss(i,e);return le.spans(t,i,s,l,0),l.finish(i)}}function ch(o,e,t){let i=new hh;return le.compare(o,e,t,i,0),i.changes}class hh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,s){(e<t||i&&i.heightRelevant||s&&s.heightRelevant)&&jn(e,t,this.changes,5)}}function fh(o,e){let t=o.getBoundingClientRect(),i=o.ownerDocument,s=i.defaultView||window,l=Math.max(0,t.left),a=Math.min(s.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(s.innerHeight,t.bottom);for(let c=o.parentNode;c&&c!=i.body;)if(c.nodeType==1){let h=c,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let u=h.getBoundingClientRect();l=Math.max(l,u.left),a=Math.min(a,u.right),r=Math.max(r,u.top),d=Math.min(c==o.parentNode?s.innerHeight:d,u.bottom)}c=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:l-t.left,right:Math.max(l,a)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function uh(o,e){let t=o.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ls{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 s=e[i],l=t[i];if(s.from!=l.from||s.to!=l.to||s.size!=l.size)return!1}return!0}draw(e,t){return ye.replace({widget:new ph(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class ph extends Ln{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 $o{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=Fo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Xn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new oh(t),this.stateDeco=e.facet(ii).filter(i=>typeof i!="function"),this.heightMap=ve.empty().applyChanges(this.stateDeco,J.empty,this.heightOracle.setDoc(e.doc),[new Ae(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=ye.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 s=i?t.head:t.anchor;if(!e.some(({from:l,to:a})=>s>=l&&s<=a)){let{from:l,to:a}=this.lineBlockAt(s);e.push(new Ui(l,a))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Fo:new os(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(li(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(ii).filter(h=>typeof h!="function");let s=e.changedRanges,l=Ae.extendWithRanges(s,ch(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),a=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Io(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),l),(this.heightMap.height!=a||Et)&&(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=l.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 c=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(c||!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(kc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,l=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let a=this.heightOracle.mustRefreshForWrapping(l),r=t.getBoundingClientRect(),d=a||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let c=0,h=0;if(r.width&&r.height){let{scaleX:g,scaleY:m}=wl(t,r);(g>.005&&Math.abs(this.scaleX-g)>.005||m>.005&&Math.abs(this.scaleY-m)>.005)&&(this.scaleX=g,this.scaleY=m,c|=8,a=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,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Cl(e.scrollDOM);let b=(this.printing?uh:fh)(t,this.paddingTop),k=b.top-this.pixelViewport.top,v=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let C=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(C!=this.inView&&(this.inView=C,C&&(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,c|=8),d){let g=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(g)&&(a=!0),a||s.lineWrapping&&Math.abs(x-this.contentDOMWidth)>s.charWidth){let{lineHeight:m,charWidth:S,textHeight:_}=e.docView.measureTextSize();a=m>0&&s.refresh(l,m,S,_,x/S,g),a&&(e.docView.minWidth=0,c|=8)}k>0&&v>0?h=Math.max(k,v):k<0&&v<0&&(h=Math.min(k,v)),Io();for(let m of this.viewports){let S=m.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(m);this.heightMap=(a?ve.empty().applyChanges(this.stateDeco,J.empty,this.heightOracle,[new Ae(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new ah(m.from,S))}Et&&(c|=2)}let V=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return V&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||V)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}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)),s=this.heightMap,l=this.heightOracle,{visibleTop:a,visibleBottom:r}=this,d=new Ui(s.lineAt(a-i*1e3,oe.ByHeight,l,0,0).from,s.lineAt(r+(1-i)*1e3,oe.ByHeight,l,0,0).to);if(t){let{head:c}=t.range;if(c<d.from||c>d.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(c,oe.ByPos,l,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<d.from?u=f.top:u=f.bottom-h,d=new Ui(s.lineAt(u-1e3/2,oe.ByHeight,l,0,0).from,s.lineAt(u+h+1e3/2,oe.ByHeight,l,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),s=t.mapPos(e.to,1);return new Ui(this.heightMap.lineAt(i,oe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,oe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),{bottom:l}=this.heightMap.lineAt(t,oe.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:r}=this;return(e==0||s<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||l>=r+Math.max(10,Math.min(i,250)))&&s>a-2*1e3&&l<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let s of e)t.touchesRange(s.from,s.to)||i.push(new ls(t.mapPos(s.from),t.mapPos(s.to),s.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,l=s>>1,a=s<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(h,f,u,p)=>{if(f-h<l)return;let b=this.state.selection.main,k=[b.from];b.empty||k.push(b.to);for(let C of k)if(C>h&&C<f){d(h,C-10,u,p),d(C+10,f,u,p);return}let v=gh(e,C=>C.from>=u.from&&C.to<=u.to&&Math.abs(C.from-h)<l&&Math.abs(C.to-f)<l&&!k.some(x=>C.from<x&&C.to>x));if(!v){if(f<u.to&&t&&i&&t.visibleRanges.some(C=>C.from<=f&&C.to>=f)){let C=t.moveToLineBoundary(U.cursor(f),!1,!0).head;C>h&&(f=C)}v=new ls(h,f,this.gapSize(u,h,f,p))}r.push(v)},c=h=>{if(h.length<a||h.type!=Le.Text)return;let f=mh(h.from,h.to,this.stateDeco);if(f.total<a)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,p,b;if(i){let k=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,C;if(u!=null){let x=Hi(f,u),V=((this.visibleBottom-this.visibleTop)/2+k)/h.height;v=x-V,C=x+V}else v=(this.visibleTop-h.top-k)/h.height,C=(this.visibleBottom-h.top+k)/h.height;p=Wi(f,v),b=Wi(f,C)}else{let k=f.total*this.heightOracle.charWidth,v=s*this.heightOracle.charWidth,C,x;if(u!=null){let V=Hi(f,u),g=((this.pixelViewport.right-this.pixelViewport.left)/2+v)/k;C=V-g,x=V+g}else C=(this.pixelViewport.left-v)/k,x=(this.pixelViewport.right+v)/k;p=Wi(f,C),b=Wi(f,x)}p>h.from&&d(h.from,p,h,f),b<h.to&&d(b,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return r}gapSize(e,t,i,s){let l=Hi(s,i)-Hi(s,t);return this.heightOracle.lineWrapping?e.height*l:s.total*this.heightOracle.charWidth*l}updateLineGaps(e){ls.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ye.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=[];le.spans(e,this.viewport.from,this.viewport.to,{span(s,l){t.push({from:s,to:l})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,l)=>s.from!=t[l].from||s.to!=t[l].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)||li(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)||li(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 li(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 Ui{constructor(e,t){this.from=e,this.to=t}}function mh(o,e,t){let i=[],s=o,l=0;return le.spans(t,o,e,{span(){},point(a,r){a>s&&(i.push({from:s,to:a}),l+=a-s),s=r}},20),s<e&&(i.push({from:s,to:e}),l+=e-s),{total:l,ranges:i}}function Wi({total:o,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(o*t);for(let s=0;;s++){let{from:l,to:a}=e[s],r=a-l;if(i<=r)return l+i;i-=r}}function Hi(o,e){let t=0;for(let{from:i,to:s}of o.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/o.total}function gh(o,e){for(let t of o)if(e(t))return t}const Fo={toDOM(o){return o},fromDOM(o){return o},scale:1,eq(o){return o==this}};class os{constructor(e,t,i){let s=0,l=0,a=0;this.viewports=i.map(({from:r,to:d})=>{let c=t.lineAt(r,oe.ByPos,e,0,0).top,h=t.lineAt(d,oe.ByPos,e,0,0).bottom;return s+=h-c,{from:r,to:d,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let r of this.viewports)r.domTop=a+(r.top-l)*this.scale,a=r.domBottom=r.domTop+(r.bottom-r.top),l=r.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let l=t<this.viewports.length?this.viewports[t]:null;if(!l||e<l.top)return s+(e-i)*this.scale;if(e<=l.bottom)return l.domTop+(e-l.top);i=l.bottom,s=l.domBottom}}fromDOM(e){for(let t=0,i=0,s=0;;t++){let l=t<this.viewports.length?this.viewports[t]:null;if(!l||e<l.domTop)return i+(e-s)/this.scale;if(e<=l.domBottom)return l.top+(e-l.domTop);i=l.bottom,s=l.domBottom}}eq(e){return e instanceof os?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 li(o,e){if(e.scale==1)return o;let t=e.toDOM(o.top),i=e.toDOM(o.bottom);return new qe(o.from,o.length,t,i-t,Array.isArray(o._content)?o._content.map(s=>li(s,e)):o._content)}const Ki=H.define({combine:o=>o.join(" ")}),as=H.define({combine:o=>o.indexOf(!0)>-1}),rs=st.newName(),Ro=st.newName(),Lo=st.newName(),jo={"&light":"."+Ro,"&dark":"."+Lo};function ds(o,e,t){return new st(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return o;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):o+" "+i}})}const kh=ds("."+rs,{"&":{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"}},jo),bh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cs=q.ie&&q.ie_version<=11;class wh{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ec,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);(q.ie&&q.ie_version<=11||q.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&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new xh(e),e.state.facet(at)&&(e.contentDOM.editContext=this.editContext.editContext)),cs&&(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,s=this.selectionRange;if(i.state.facet(at)?i.root.activeElement!=this.dom:!Ai(i.dom,s))return;let l=s.anchorNode&&i.docView.nearest(s.anchorNode);if(l&&l.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Xt(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Gt(e.root);if(!t)return!1;let i=q.safari&&e.root.nodeType==11&&Yd(this.dom.ownerDocument)==this.dom&&yh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=Ai(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&ic(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(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,bh),cs&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),cs&&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 s=()=>{let l=this.delayedAndroidKey;l&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=l.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&l.force&&Vt(this.dom,l.key,l.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!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,s=!1;for(let l of e){let a=this.readMutation(l);a&&(a.typeOver&&(s=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&Ai(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let l=new $c(this.view,e,t,i);return this.view.docView.domChanged={newSel:l.newSel?l.newSel.main:null},l}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,s=go(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}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=zo(t,e.previousSibling||e.target.previousSibling,-1),s=zo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):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 s of this.scrollTargets)s.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 zo(o,e,t){for(;e;){let i=ne.get(e);if(i&&i.parent==o)return i;let s=e.parentNode;e=s!=o.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function qo(o,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,l=e.endOffset,a=o.docView.domAtPos(o.state.selection.main.anchor);return Xt(a.node,a.offset,s,l)&&([t,i,s,l]=[s,l,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:l}}function yh(o,e){if(e.getComposedRanges){let s=e.getComposedRanges(o.root)[0];if(s)return qo(o,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return o.contentDOM.addEventListener("beforeinput",i,!0),o.dom.ownerDocument.execCommand("indent"),o.contentDOM.removeEventListener("beforeinput",i,!0),t?qo(o,t):null}class xh{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:s}=e.state.selection.main,l={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:J.of(i.text.split(`
10
- `))};l.from==this.from&&s<this.from?l.from=s:l.to==this.to&&s>this.to&&(l.to=s),!(l.from==l.to&&!l.insert.length)&&(this.pendingContextChange=l,e.state.readOnly||is(e,l,U.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let s=[],l=null;for(let a=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);a<r;a++){let d=e.coordsForChar(a);l=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||l||new DOMRect,s.push(l)}t.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let l of i.getTextFormats()){let a=l.underlineStyle,r=l.underlineThickness;if(a!="None"&&r!="None"){let d=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;s.push(ye.mark({attributes:{style:d}}).range(this.toEditorPos(l.rangeStart),this.toEditorPos(l.rangeEnd)))}}e.dispatch({effects:Zl.of(ye.set(s))})},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 s=Gt(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((l,a,r,d,c)=>{if(i)return;let h=c.length-(a-l);if(s&&a>=s.to)if(s.from==l&&s.to==a&&s.insert.eq(c)){s=this.pendingContextChange=null,t+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(l+=t,a+=t,a<=this.from)this.from+=h,this.to+=h;else if(l<this.to){if(l<this.from||a>this.to||this.to-this.from+c.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(l),this.toContextPos(a),c.toString()),this.to+=h}t+=h}),s&&!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))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}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 Z{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&&(s=>s.forEach(l=>i(l,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||tc(e.parent)||document,this.viewState=new $o(e.state||ee.create(e)),e.scrollTo&&e.scrollTo.is(Pi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ti).map(s=>new Yn(s));for(let s of this.plugins)s.update(this);this.observer=new wh(this),this.inputState=new zc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new oo(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,s,l=this.state;for(let u of e){if(u.startState!=l)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");l=u.state}if(this.destroyed){this.viewState.state=l;return}let a=this.hasFocus,r=0,d=null;e.some(u=>u.annotation(_o))?(this.inputState.notifiedFocused=a,r=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,d=Ao(l,a),d||(r=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(l.doc)||!this.state.selection.eq(l.selection))&&(h=null)):this.observer.clear(),l.facet(ee.phrases)!=this.state.facet(ee.phrases))return this.setState(l);s=$i.create(this,l,e),s.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 Tt(p.empty?p:U.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of u.effects)p.is(Pi)&&(f=p.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Qi.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(ni)!=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(s.startState.facet(Ki)!=s.state.facet(Ki)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(Kn))try{u(s)}catch(p){ze(this.state,p,"update listener")}(d||h)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),h&&!go(this,h)&&c.force&&Vt(this.contentDOM,c.key,c.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 $o(e),this.plugins=e.facet(ti).map(i=>new Yn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new oo(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(ti),i=e.state.facet(ti);if(t!=i){let s=[];for(let l of i){let a=t.indexOf(l);if(a<0)s.push(new Yn(l));else{let r=this.plugins[a];r.mustUpdate=e,s.push(r)}}for(let l of this.plugins)l.mustUpdate!=e&&l.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].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,s=i.scrollTop*this.scaleY,{scrollAnchorPos:l,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(a<0)if(Cl(i))l=-1,a=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);l=p.from,a=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 c=[];d&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(p=>{try{return p.read(this)}catch(b){return ze(this.state,b),Uo}}),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<c.length;p++)if(h[p]!=Uo)try{let b=c[p];b.write&&b.write(h[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,a=-1;continue}else{let b=(l<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(l).top)-a;if(b>1||b<-1){s=s+b,i.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Kn))r(t)}get themeClasses(){return rs+" "+(this.state.facet(as)?Lo:Ro)+" "+this.state.facet(Ki)}updateAttrs(){let e=Wo(this,eo,{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:`${q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Wo(this,Xn,t);let i=this.observer.ignore(()=>{let s=Rn(this.contentDOM,this.contentAttrs,t),l=Rn(this.dom,this.editorAttrs,e);return s||l});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(Z.announce)){t&&(this.announceDOM.textContent=""),t=!1;let l=this.announceDOM.appendChild(document.createElement("div"));l.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(ni);let e=this.state.facet(Z.cspNonce);st.mount(this.root,this.styleModules.concat(kh).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 ts(this,e,po(this,e,t,i))}moveByGroup(e,t){return ts(this,e,po(this,e,t,i=>Ec(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),l=i[t?i.length-1:0];return U.cursor(l.side(t,s)+e.from,l.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return Mc(this,e,t,i)}moveVertically(e,t,i){return ts(this,e,Ic(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(),fo(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 s=this.state.doc.lineAt(e),l=this.bidiSpans(s),a=l[ot.find(l,e-s.from,-1,t)];return Mi(i,a.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(Xl)||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 ql(e.length);let t=this.textDirectionAt(e.from),i;for(let l of this.bidiCache)if(l.from==e.from&&l.dir==t&&(l.fresh||zl(l.isolates,i=no(this,e))))return l.order;i||(i=no(this,e));let s=pc(e.text,t,i);return this.bidiCache.push(new Qi(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{yl(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 Pi.of(new Tt(typeof e=="number"?U.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 Pi.of(new Tt(U.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 Mt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Mt.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=st.newName(),s=[Ki.of(i),ni.of(ds(`.${i}`,e))];return t&&t.dark&&s.push(as.of(!0)),s}static baseTheme(e){return Pd.lowest(ni.of(ds("."+rs,e,jo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&ne.get(i)||ne.get(e);return((t=s?.rootView)===null||t===void 0?void 0:t.view)||null}}Z.styleModule=ni,Z.inputHandler=Gl,Z.clipboardInputFilter=Qn,Z.clipboardOutputFilter=Gn,Z.scrollHandler=Jl,Z.focusChangeEffect=Yl,Z.perLineTextDirection=Xl,Z.exceptionSink=Ql,Z.updateListener=Kn,Z.editable=at,Z.mouseSelectionStyle=Kl,Z.dragMovesSelection=Hl,Z.clickAddsSelectionRange=Wl,Z.decorations=ii,Z.outerDecorations=to,Z.atomicRanges=Jn,Z.bidiIsolatedRanges=io,Z.scrollMargins=so,Z.darkTheme=as,Z.cspNonce=H.define({combine:o=>o.length?o[0]:""}),Z.contentAttributes=Xn,Z.editorAttributes=eo,Z.lineWrapping=Z.contentAttributes.of({class:"cm-lineWrapping"}),Z.announce=ce.define();const vh=4096,Uo={};class Qi{constructor(e,t,i,s,l,a){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=l,this.order=a}static update(e,t){if(t.empty&&!e.some(l=>l.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:me.LTR;for(let l=Math.max(0,e.length-10);l<e.length;l++){let a=e[l];a.dir==s&&!t.touchesRange(a.from,a.to)&&i.push(new Qi(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function Wo(o,e,t){for(let i=o.state.facet(e),s=i.length-1;s>=0;s--){let l=i[s],a=typeof l=="function"?l(o):l;a&&Fn(a,t)}return t}const Ch=!q.ios,Ho={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Ch&&(Ho[".cm-line"].caretColor=Ho[".cm-content"].caretColor="transparent !important");class It extends Nt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}It.prototype.elementClass="",It.prototype.toDOM=void 0,It.prototype.mapMode=Be.TrackBefore,It.prototype.startSide=It.prototype.endSide=-1,It.prototype.point=!0;var hs;const Dt=new X;function Sh(o){return H.define({combine:o?e=>e.concat(o):void 0})}const Nh=new X;class De{constructor(e,t,i=[],s=""){this.data=e,this.name=s,ee.prototype.hasOwnProperty("tree")||Object.defineProperty(ee.prototype,"tree",{get(){return fs(this)}}),this.parser=t,this.extension=[$t.of(this),ee.languageData.of((l,a,r)=>{let d=Ko(l,a,r),c=d.type.prop(Dt);if(!c)return[];let h=l.facet(c),f=d.type.prop(Nh);if(f){let u=d.resolve(a-d.from,r);for(let p of f)if(p.test(u,l)){let b=l.facet(p.facet);return p.type=="replace"?b:b.concat(h)}}return h})].concat(i)}isActiveAt(e,t,i=-1){return Ko(e,t,i).type.prop(Dt)==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=[],s=(l,a)=>{if(l.prop(Dt)==this.data){i.push({from:a,to:a+l.length});return}let r=l.prop(X.mounted);if(r){if(r.tree.prop(Dt)==this.data){if(r.overlay)for(let d of r.overlay)i.push({from:d.from+a,to:d.to+a});else i.push({from:a,to:a+l.length});return}else if(r.overlay){let d=i.length;if(s(r.tree,r.overlay[0].from+a),i.length>d)return}}for(let d=0;d<l.children.length;d++){let c=l.children[d];c instanceof re&&s(c,l.positions[d]+a)}};return s(fs(e),0),i}get allowsNesting(){return!0}}De.setState=ce.define();function Ko(o,e,t){let i=o.facet($t),s=fs(o).topNode;if(!i||i.allowsNesting)for(let l=s;l;l=l.enter(e,t,fe.ExcludeBuffers))l.type.isTop&&(s=l);return s}class Gi extends De{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Sh(e.languageData);return new Gi(t,e.parser.configure({props:[Dt.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Gi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function fs(o){let e=o.field(De.state,!1);return e?e.tree:re.empty}class Bh{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 oi=null;class Yi{constructor(e,t,i=[],s,l,a,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=l,this.viewport=a,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Yi(e,t,[],re.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Bh(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=re.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}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 s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(ht.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=s,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=oi;oi=this;try{return e()}finally{oi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Qo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:l,viewport:a,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((c,h,f,u)=>d.push({fromA:c,toA:h,fromB:f,toB:u})),i=ht.applyChanges(i,d),s=re.empty,l=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){r=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);h<f&&r.push({from:h,to:f})}}}return new Yi(this.parser,t,i,s,l,a,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:s,to:l}=this.skipped[i];s<e.to&&l>e.from&&(this.fragments=Qo(this.fragments,s,l),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 Ms{createParse(t,i,s){let l=s[0].from,a=s[s.length-1].to;return{parsedPos:l,advance(){let d=oi;if(d){for(let c of s)d.tempSkipped.push(c);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=a,new re(Ce.none,[],[],a-l)},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 oi}}function Qo(o,e,t){return ht.applyChanges(o,[{fromA:e,toA:t,fromB:e,toB:t}])}class Pt{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 Pt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Yi.create(e.facet($t).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Pt(i)}}De.state=pt.define({create:Pt.init,update(o,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet($t)!=e.state.facet($t)?Pt.init(e.state):o.apply(e)}});let Go=o=>{let e=setTimeout(()=>o(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Go=o=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(o,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const us=typeof navigator<"u"&&(!((hs=navigator.scheduling)===null||hs===void 0)&&hs.isInputPending)?()=>navigator.scheduling.isInputPending():null,Oh=Mt.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=Go(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:s}}=this.view,l=i.field(De.state);if(l.tree==l.context.tree&&l.context.isDone(s+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!us?Math.max(25,e.timeRemaining()-5):1e9),r=l.context.treeLen<s&&i.doc.length>s+1e3,d=l.context.work(()=>us&&us()||Date.now()>a,s+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(l.context.takeTree(),this.view.dispatch({effects:De.setState.of(new Pt(l.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(l.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=H.define({combine(o){return o.length?o[0]:null},enables:o=>[De.state,Oh,Z.contentAttributes.compute([o],e=>{let t=e.facet(o);return t&&t.name?{"data-language":t.name}:{}})]});class Vh{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const _h=new X;function Yo({except:o,units:e=1}={}){return t=>{let i=o&&o.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Ah=new X;function Th(o){let e=o.firstChild,t=o.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?o.to:t.from}:null}class ps{constructor(e,t){this.specs=e;let i;function s(r){let d=st.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const l=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,a=t.scope;this.scope=a instanceof De?r=>r.prop(Dt)==a.data:a?r=>r==a:void 0,this.style=Ls(e.map(r=>({tag:r.tag,class:r.class||s(Object.assign({},r,{tag:null}))})),{all:l}).style,this.module=i?new st(i):null,this.themeType=t.themeType}static define(e,t){return new ps(e,t||{})}}P.meta,P.link,P.heading,P.emphasis,P.strong,P.strikethrough,P.keyword,P.atom,P.bool,P.url,P.contentSeparator,P.labelName,P.literal,P.inserted,P.string,P.deleted,P.regexp,P.escape,P.string,P.variableName,P.variableName,P.typeName,P.namespace,P.className,P.variableName,P.macroName,P.propertyName,P.comment,P.invalid;const Mh=Object.create(null),Xo=[Ce.none],Jo=[],Zo=Object.create(null),Eh=Object.create(null);for(let[o,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"]])Eh[o]=Ih(Mh,e);function ms(o,e){Jo.indexOf(o)>-1||(Jo.push(o),console.warn(e))}function Ih(o,e){let t=[];for(let r of e.split(" ")){let d=[];for(let c of r.split(".")){let h=o[c]||P[c];h?typeof h=="function"?d.length?d=d.map(h):ms(c,`Modifier ${c} used at start of tag`):d.length?ms(c,`Tag ${c} used as modifier`):d=Array.isArray(h)?h:[h]:ms(c,`Unknown highlighting tag ${c}`)}for(let c of d)t.push(c)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(r=>r.id),l=Zo[s];if(l)return l.id;let a=Zo[s]=Ce.define({id:Xo.length,name:i,props:[Rs({[i]:t})]});return Xo.push(a),a.id}me.RTL,me.LTR;const Dh=Gi.define({name:"json",parser:Ad.configure({props:[_h.add({Object:Yo({except:/^\s*\}/}),Array:Yo({except:/^\s*\]/})}),Ah.add({"Object Array":Th})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Ph(){return new Vh(Dh)}const gs=[{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 $h(){const o=Me();if(o.formRules?.length){const e={};gs.forEach(i=>{e[i.name]=i});const t=[...gs];return o.formRules.forEach(i=>{const s=e[i.name];s?Object.assign(s,i):t.push(s)}),t}return gs}const Fh={loadAdvances:$h},Rh={class:"unione-props-setting data-field-setting"},Lh={key:0},jh=["onClick"],zh={class:"field-txt"},qh=["onClick"],Uh={key:1,class:"field-txt"},Wh=["onClick"],Hh={key:0,class:"field-txt"},Kh={key:3,class:"edit-field"},Qh=["onClick"],Gh=Y(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([Ph()]),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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(o,"modelValue"),s={mounted:g=>g.focus()},l=n.ref({});function a(){const g=Object.keys(l.value);if(g.length)for(let m in g){const S=i.value.filter(_=>_.name==m);if(S&&S[0]){let _=l.value[m];Object.keys(_).forEach(y=>{y=="convertName"?(S[0].convert||(S[0].convert={}),S[0].convert.type=_[y]):S[0][y]=_[y]})}}l.value={}}function r(g,m){a();const S={};m=="convertName"?(g.convert||(g.convert={}),S[m]=g.convert?.type):S[m]=g[m]||"",l.value[g.name]=S}function d(g,m){{l.value={};return}}function c(g,m){switch(m){case"query":return g.configs?.query?.enable;case"form":return g.configs?.show?.form?.enable;case"view":return g.configs?.show?.view?.enable;case"list":return g.configs?.show?.list?.enable;case"sort":return g.configs?.sort?.enable}}function h(g,m){switch(m){case"query":g.configs=W.utils.obj.ext(g.configs,{query:{enable:!1}}),g.configs.query.enable=!g.configs.query.enable;break;case"form":g.configs=W.utils.obj.ext(g.configs,{show:{form:{enable:!1}}}),g.configs.show.form.enable=!g.configs.show.form.enable;break;case"view":g.configs=W.utils.obj.ext(g.configs,{show:{view:{enable:!1}}}),g.configs.show.view.enable=!g.configs.show.view.enable;break;case"list":g.configs=W.utils.obj.ext(g.configs,{show:{list:{enable:!1}}}),g.configs.show.list.enable=!g.configs.show.list.enable;break;case"sort":g.configs=W.utils.obj.ext(g.configs,{sort:{enable:!1}}),g.configs.sort.enable=!g.configs.sort.enable;break}console.log("record.configs",g.configs)}const f=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(g,m){switch(f.value.prop=m,f.value.field=g,g.configs||(g.configs={}),g.configs.show||(g.configs.show={}),m){case"query":g.configs.query||(g.configs.query={}),g.configs.query.types||(g.configs.query.types="EQ"),f.value.show=g.configs.query,f.value.title=`查询设置/${g.title}(${g.name})`;break;case"form":g.configs.show.form||(g.configs.show.form={}),f.value.show=g.configs.show.form,f.value.title=`表单设置/${g.title}(${g.name})`;break;case"view":g.configs.show.view||(g.configs.show.view={}),f.value.show=g.configs.show.view,f.value.title=`详情设置/${g.title}(${g.name})`;break;case"list":g.configs.show.list||(g.configs.show.list={}),f.value.show=g.configs.show.list,f.value.title=`列头设置/${g.title}(${g.name})`;break;case"sort":g.configs.sort||(g.configs.sort={}),f.value.show=g.configs.sort,f.value.title=`排序设置/${g.title}(${g.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:g=>{const m=p.value.options.filter(S=>S.value==g);return m[0]?m[0].label:g}}),b=n.ref({visible:!1,field:{},props:{},advances:Fh.loadAdvances(),showInfo:g=>{let m=0;if(g.configs?.rule){const S=g.configs.rule;S.advance&&m++,typeof S.rangeMin<"u"&&m++,typeof S.rangeMax<"u"&&m++,typeof S.regExpress<"u"&&m++}if(m>0)return"("+m+")"},toSetting:()=>{const g=b.value.props;b.value.field.configs=W.utils.obj.ext(b.value.field.configs,{rule:{...g}}),b.value.visible=!1,b.value.props={}}});function k(g){b.value.visible=!0,b.value.field=g,b.value.props=g.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:g=>{const m=g.configs?.widget?.name,S=v.value.widgets.filter(_=>_.value==m);return S[0]?S[0].label:m},toSetting:(g,m)=>{g.configs||(g.configs={}),g.configs.widget||(g.configs.widget={}),g.configs.widget.name=m},toclose:()=>{v.value.visible=!1}});function C(g){v.value.field=g,g.configs=W.utils.obj.ext(g.configs,{widget:{props:{}}}),v.value.widget=g.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:(g,m="--")=>x.value.types.filter(S=>S.value==g)[0]?.label||m,toAddOption:()=>{x.value.convert.options||(x.value.convert.options=[]),x.value.convert.options.push({label:"",value:""})},toDelOption:(g,m)=>{x.value.convert.options.splice(g,1)},toSetting:()=>{x.value.visible=!1}});function V(g){x.value.visible=!0,x.value.field=g,g.configs||(g.configs={}),g.configs.convert||(g.configs.convert={}),x.value.convert=g.configs.convert}return(g,m)=>{const S=n.resolveComponent("ToolOutlined"),_=n.resolveComponent("a-button"),y=n.resolveComponent("a-select"),w=n.resolveComponent("a-checkbox"),N=n.resolveComponent("a-table"),A=n.resolveComponent("a-switch"),O=n.resolveComponent("a-form-item"),D=n.resolveComponent("a-select-option"),M=n.resolveComponent("a-input-number"),E=n.resolveComponent("a-form"),z=n.resolveComponent("a-modal"),$=n.resolveComponent("a-input"),I=n.resolveComponent("unione-select-box"),K=n.resolveComponent("a-checkbox-group"),L=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",Rh,[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:B})=>[["widget","queryType","rules","convertName"].includes(B.key)?(n.openBlock(),n.createElementBlock("span",Lh,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:B,text:Q,record:T})=>[["rules"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!b.value.showInfo(T)&&"empty"]),onClick:j=>k(T)},[n.createElementVNode("span",zh,n.toDisplayString(b.value.showInfo(T)),1),b.value.showInfo(T)?(n.openBlock(),n.createBlock(_,{key:0,type:"link"},{default:n.withCtx(()=>m[50]||(m[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,jh)):["widget"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[T.name]||!Object.keys(l.value[T.name]).includes(B.dataIndex))&&!Q&&"empty"]),onClick:j=>r(T,B.dataIndex)},[l.value[T.name]&&Object.keys(l.value[T.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(y,{key:0,value:T.configs?.widget?.name,allowClear:!0,options:v.value.widgets,onChange:j=>v.value.toSetting(T,j),onBlur:m[0]||(m[0]=j=>d())},null,8,["value","options","onChange"])),[[s]]):(n.openBlock(),n.createElementBlock("span",Uh,n.toDisplayString(v.value.widgetName(T)),1)),n.createVNode(_,{type:"link",onClick:n.withModifiers(j=>C(T),["stop"])},{default:n.withCtx(()=>m[51]||(m[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,qh)):["convertName"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[T.name]||!Object.keys(l.value[T.name]).includes(B.dataIndex))&&!T.convert?.type&&"empty"]),onClick:j=>V(T)},[T.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Hh,n.toDisplayString(x.value.getTypes(T.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Wh)):["query","form","view","list","sort"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",Kh,[n.createVNode(w,{checked:c(T,B.dataIndex),onClick:j=>h(T,B.dataIndex)},null,8,["checked","onClick"]),n.createVNode(_,{type:"link",onClick:j=>u(T,B.dataIndex)},{default:n.withCtx(()=>m[52]||(m[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(z,{visible:f.value.visible,"onUpdate:visible":m[14]||(m[14]=B=>f.value.visible=B),width:600,title:f.value.title,onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(E,{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(O,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.enable,"onUpdate:checked":m[1]||(m[1]=B=>f.value.show.enable=B),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(n.openBlock(),n.createBlock(O,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.defoult,"onUpdate:checked":m[2]||(m[2]=B=>f.value.show.defoult=B),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="sort"?(n.openBlock(),n.createBlock(O,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.asc,"onUpdate:checked":m[3]||(m[3]=B=>f.value.show.asc=B),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(O,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(O,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.defoult,"onUpdate:checked":m[4]||(m[4]=B=>f.value.show.defoult=B),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(O,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.visible,"onUpdate:checked":m[5]||(m[5]=B=>f.value.show.visible=B),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(O,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(y,{value:f.value.show.types,"onUpdate:value":m[6]||(m[6]=B=>f.value.show.types=B)},{default:n.withCtx(()=>[n.createVNode(D,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>m[53]||(m[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(D,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>m[54]||(m[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(D,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>m[55]||(m[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(D,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>m[56]||(m[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(D,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>m[57]||(m[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(D,{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(O,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(M,{value:f.value.show.index,"onUpdate:value":m[7]||(m[7]=B=>f.value.show.index=B)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,max:24,value:f.value.show.width,"onUpdate:value":m[8]||(m[8]=B=>f.value.show.width=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,value:f.value.show.width,"onUpdate:value":m[9]||(m[9]=B=>f.value.show.width=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":m[10]||(m[10]=B=>f.value.show.labelWidth=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":m[11]||(m[11]=B=>f.value.show.valueWidth=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(y,{value:f.value.show.fixed,"onUpdate:value":m[12]||(m[12]=B=>f.value.show.fixed=B),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(y,{value:f.value.show.align,"onUpdate:value":m[13]||(m[13]=B=>f.value.show.align=B),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(z,{visible:x.value.visible,"onUpdate:visible":m[33]||(m[33]=B=>x.value.visible=B),width:600,title:x.value.getTypes(x.value.convert.types,"转换")+"设置",onOk:x.value.toSetting},{default:n.withCtx(()=>[n.createVNode(E,{model:x.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(O,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(y,{value:x.value.convert.types,"onUpdate:value":m[15]||(m[15]=B=>x.value.convert.types=B),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(O,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.convert.search,"onUpdate:checked":m[16]||(m[16]=B=>f.value.convert.search=B),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="option"?(n.openBlock(),n.createBlock(O,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(_,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:x.value.toAddOption},{default:n.withCtx(()=>m[59]||(m[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:B,record:Q,index:T})=>[B.dataIndex==="label"?(n.openBlock(),n.createBlock($,{key:0,value:Q.label,"onUpdate:value":j=>Q.label=j,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),B.dataIndex==="value"?(n.openBlock(),n.createBlock($,{key:1,value:Q.value,"onUpdate:value":j=>Q.value=j,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),B.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:j=>x.value.toDelOption(T,Q)},"删除",8,Qh)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(x.value.convert.types)?(n.openBlock(),n.createBlock(O,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(I,{value:x.value.convert.dsId,"onUpdate:value":m[17]||(m[17]=B=>x.value.convert.dsId=B),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(O,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.tableName,"onUpdate:value":m[18]||(m[18]=B=>x.value.convert.tableName=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.tableName,"onUpdate:value":m[19]||(m[19]=B=>x.value.convert.tableName=B)},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(O,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.idField,"onUpdate:value":m[20]||(m[20]=B=>x.value.convert.idField=B)},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(O,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.pidField,"onUpdate:value":m[21]||(m[21]=B=>x.value.convert.pidField=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.valueField,"onUpdate:value":m[22]||(m[22]=B=>x.value.convert.valueField=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.labelField,"onUpdate:value":m[23]||(m[23]=B=>x.value.convert.labelField=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.tableField,"onUpdate:value":m[24]||(m[24]=B=>x.value.convert.tableField=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.tableWhere,"onUpdate:value":m[25]||(m[25]=B=>x.value.convert.tableWhere=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.tableOrder,"onUpdate:value":m[26]||(m[26]=B=>x.value.convert.tableOrder=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.tableOrder,"onUpdate:value":m[27]||(m[27]=B=>x.value.convert.tableOrder=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(A,{checked:x.value.convert.isAsync,"onUpdate:checked":m[28]||(m[28]=B=>x.value.convert.isAsync=B),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(A,{checked:x.value.convert.isPaging,"onUpdate:checked":m[29]||(m[29]=B=>x.value.convert.isPaging=B),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),x.value.convert.types=="dict"?(n.openBlock(),n.createBlock(O,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.dictName,"onUpdate:value":m[30]||(m[30]=B=>x.value.convert.dictName=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(x.value.convert.types)?(n.openBlock(),n.createBlock(O,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode($,{value:x.value.convert.url,"onUpdate:value":m[31]||(m[31]=B=>x.value.convert.url=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(x.value.convert.types)?(n.openBlock(),n.createBlock(O,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:x.value.convert.params,"onUpdate:modelValue":m[32]||(m[32]=B=>x.value.convert.params=B),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(z,{visible:v.value.visible,"onUpdate:visible":m[40]||(m[40]=B=>v.value.visible=B),width:600,title:"控件设置",onOk:v.value.toclose},{default:n.withCtx(()=>[n.createVNode(E,{model:v.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(O,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(y,{value:v.value.widget.name,"onUpdate:value":m[34]||(m[34]=B=>v.value.widget.name=B),allowClear:!0,options:v.value.widgets},null,8,["value","options"]),[[s]])]),_:1}),n.createVNode(O,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode($,{value:v.value.widget.placeholder,"onUpdate:value":m[35]||(m[35]=B=>v.value.widget.placeholder=B)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode($,{value:v.value.widget.help,"onUpdate:value":m[36]||(m[36]=B=>v.value.widget.help=B)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode($,{value:v.value.widget.tooltip,"onUpdate:value":m[37]||(m[37]=B=>v.value.widget.tooltip=B)},null,8,["value"])]),_:1}),["a-date-picker"].includes(v.value.widget.name)?(n.openBlock(),n.createBlock(O,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode($,{value:v.value.field.dataFormat,"onUpdate:value":m[38]||(m[38]=B=>v.value.field.dataFormat=B)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(O,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(y,{value:v.value.widget.props.mode,"onUpdate:value":m[39]||(m[39]=B=>v.value.widget.props.mode=B),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(D,{value:"multiple"},{default:n.withCtx(()=>m[60]||(m[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(D,{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(z,{visible:b.value.visible,"onUpdate:visible":m[49]||(m[49]=B=>b.value.visible=B),width:600,title:"规则设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(E,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(L,{title:"基本设置",type:"line"},{default:n.withCtx(()=>[n.createVNode(O,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(K,{value:b.value.props.trigger,"onUpdate:value":m[41]||(m[41]=B=>b.value.props.trigger=B),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(O,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(w,{checked:b.value.props.whitespace,"onUpdate:checked":m[42]||(m[42]=B=>b.value.props.whitespace=B)},{default:n.withCtx(()=>m[62]||(m[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(O,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(y,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":m[43]||(m[43]=B=>b.value.props.advance=B)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(n.openBlock(),n.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(O,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(M,{value:b.value.props.rangeMin,"onUpdate:value":m[44]||(m[44]=B=>b.value.props.rangeMin=B)},null,8,["value"]),m[63]||(m[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(M,{value:b.value.props.rangeMax,"onUpdate:value":m[45]||(m[45]=B=>b.value.props.rangeMax=B)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode($,{value:b.value.props.rangeMessage,"onUpdate:value":m[46]||(m[46]=B=>b.value.props.rangeMessage=B)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(L,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(O,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode($,{value:b.value.props.regExpress,"onUpdate:value":m[47]||(m[47]=B=>b.value.props.regExpress=B)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode($,{value:b.value.props.regMessage,"onUpdate:value":m[48]||(m[48]=B=>b.value.props.regMessage=B)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),Yh={class:"unione-props-setting data-field-fkey"},Xh={key:0},Jh=["onClick"],Zh=["onClick"],ef=["onClick"],tf=["onClick"],nf=["onClick"],sf=["onClick"],lf=["onClick"],of=["onClick"],af=Y(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=W.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(o,"modelValue"),s=n.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),l=n.ref({});function a(){l.value={}}function r(u,p){a();const b={};b[p]=u.configs.fkey[p]||"",l.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 c(u,p,b,k){u.configs.fkey[p]=b,p=="fieldName"&&(u.configs.fkey.fieldTitle=k.title),p=="labelName"&&(u.configs.fkey.labelTitle=k.title)}function h(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=W.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,p)=>{const b=n.resolveComponent("FormOutlined"),k=n.resolveComponent("unione-select-box"),v=n.resolveComponent("a-button"),C=n.resolveComponent("a-table"),x=n.resolveComponent("a-input-number"),V=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",Yh,[n.createVNode(C,{columns:t.value,"data-source":s.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:n.withCtx(({column:g})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(g.key)?(n.openBlock(),n.createElementBlock("span",Xh,[n.createVNode(b),n.createTextVNode(" "+n.toDisplayString(g.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:g,record:m})=>[["dsnName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.dsnName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:a,onSelect:(S,_)=>d(m,S,_)},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,Jh)):["dsnTitle"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.dsnTitle&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:a,onSelect:(S,_)=>d(m,S,_)},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,Zh)):n.createCommentVNode("",!0),["fieldName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.fieldName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(m,"fieldName",S,_)},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,ef)):["labelName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.labelName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(m,"labelName",S,_)},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(S=>h(m),["stop"])},{default:n.withCtx(()=>p[4]||(p[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,tf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(V,{visible:f.value.visible,"onUpdate:visible":p[3]||(p[3]=g=>f.value.visible=g),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(C,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:n.withCtx(({column:g,record:m,index:S,text:_})=>[g.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",f.value.editField!="title"&&!_&&"empty"]),onClick:y=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="title"?(n.openBlock(),n.createBlock(k,{key:0,value:m[m.dataIndex],"onUpdate:value":y=>m[m.dataIndex]=y,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]=y=>f.value.editField={}),onSelect:(y,w)=>f.value.onShowFieldChange(m,y,w)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,nf)):n.createCommentVNode("",!0),g.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",f.value.editField!="width"&&!_&&"empty"]),onClick:y=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="width"?(n.openBlock(),n.createBlock(x,{key:0,onBlur:p[1]||(p[1]=y=>f.value.editField={}),value:m.width,"onUpdate:value":y=>m.width=y,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,sf)):n.createCommentVNode("",!0),g.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!_&&"empty"]),onClick:y=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="index"?(n.openBlock(),n.createBlock(x,{key:0,onBlur:p[2]||(p[2]=y=>f.value.editField={}),value:m.index,"onUpdate:value":y=>m.index=y,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,lf)):n.createCommentVNode("",!0),g.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:y=>f.value.toDelField(S)},"删除",8,of)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),rf={class:"unione-props-setting data-filter"},df={class:"title"},cf={class:"name"},hf={class:"action"},ff=Y(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=W.useDialog(),t=n.useModel(o,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function s(c){r.value.visible=!0,r.value.filter={...c},r.value.name=c.name}function l(c){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(c,1)}})}const a=n.ref(),r=n.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{a.value.validate().then(c=>{if(r.value.name){const h=t.value.filter(f=>f.name==r.value.name)[0];if(!h){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(c).forEach(f=>{h[f]=c[f]})}else{if(t.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(c)}r.value.visible=!1})}});function d(){const c=[];r.value.filter.filter||(r.value.filter.filter=""),c.push("-- @if(isNotEmpty(params."),c.push(r.value.filter.name||"xxx"),c.push(") && !isBlank(params."),c.push(r.value.filter.name||"xxx"),c.push(`)
7
+ `;this.styleTag.textContent=a;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 Bt={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:"'"},An={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++)Bt[48+pe]=Bt[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Bt[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Bt[pe]=String.fromCharCode(pe+32),An[pe]=String.fromCharCode(pe);for(var Tn in Bt)An.hasOwnProperty(Tn)||(An[Tn]=Bt[Tn]);function Gt(o){let e;return o.nodeType==11?e=o.getSelection?o:o.ownerDocument:e=o,e.getSelection()}function Mn(o,e){return e?o==e||o.contains(e.nodeType!=1?e.parentNode:e):!1}function Yd(o){let e=o.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ai(o,e){if(!e.anchorNode)return!1;try{return Mn(o,e.anchorNode)}catch{return!1}}function Yt(o){return o.nodeType==3?kt(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function Xt(o,e,t,i){return t?bl(o,e,t,i,-1)||bl(o,e,t,i,1):!1}function gt(o){for(var e=0;;e++)if(o=o.previousSibling,!o)return e}function Ti(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function bl(o,e,t,i,s){for(;;){if(o==t&&e==i)return!0;if(e==(s<0?0:Ye(o))){if(o.nodeName=="DIV")return!1;let l=o.parentNode;if(!l||l.nodeType!=1)return!1;e=gt(o)+(s<0?0:1),o=l}else if(o.nodeType==1){if(o=o.childNodes[e+(s<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;e=s<0?Ye(o):0}else return!1}}function Ye(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function Mi(o,e){let t=e?o.left:o.right;return{left:t,right:t,top:o.top,bottom:o.bottom}}function Xd(o){let e=o.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:o.innerWidth,top:0,bottom:o.innerHeight}}function wl(o,e){let t=e.width/o.offsetWidth,i=e.height/o.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-o.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-o.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function Jd(o,e,t,i,s,l,a,r){let d=o.ownerDocument,c=d.defaultView||window;for(let h=o,f=!1;h&&!f;)if(h.nodeType==1){let u,p=h==d.body,b=1,k=1;if(p)u=Xd(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let y=h.getBoundingClientRect();({scaleX:b,scaleY:k}=wl(h,y)),u={left:y.left,right:y.left+h.clientWidth*b,top:y.top,bottom:y.top+h.clientHeight*k}}let v=0,C=0;if(s=="nearest")e.top<u.top?(C=-(u.top-e.top+a),t>0&&e.bottom>u.bottom+C&&(C=e.bottom-u.bottom+C+a)):e.bottom>u.bottom&&(C=e.bottom-u.bottom+a,t<0&&e.top-C<u.top&&(C=-(u.top+C-e.top+a)));else{let y=e.bottom-e.top,V=u.bottom-u.top;C=(s=="center"&&y<=V?e.top+y/2-V/2:s=="start"||s=="center"&&t<0?e.top-a:e.bottom-V+a)-u.top}if(i=="nearest"?e.left<u.left?(v=-(u.left-e.left+l),t>0&&e.right>u.right+v&&(v=e.right-u.right+v+l)):e.right>u.right&&(v=e.right-u.right+l,t<0&&e.left<u.left+v&&(v=-(u.left+v-e.left+l))):v=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-l:e.right-(u.right-u.left)+l)-u.left,v||C)if(p)c.scrollBy(v,C);else{let y=0,V=0;if(C){let g=h.scrollTop;h.scrollTop+=C/k,V=(h.scrollTop-g)*k}if(v){let g=h.scrollLeft;h.scrollLeft+=v/b,y=(h.scrollLeft-g)*b}e={left:e.left-y,top:e.top-V,right:e.right-y,bottom:e.bottom-V},y&&Math.abs(y-v)<1&&(i="nearest"),V&&Math.abs(V-C)<1&&(s="nearest")}if(p)break;h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function Zd(o){let e=o.ownerDocument,t,i;for(let s=o.parentNode;s&&!(s==e.body||t&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:i}}class ec{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,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Ot=null;function yl(o){if(o.setActive)return o.setActive();if(Ot)return o.focus(Ot);let e=[];for(let t=o;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(o.focus(Ot==null?{get preventScroll(){return Ot={preventScroll:!0},!0}}:void 0),!Ot){Ot=!1;for(let t=0;t<e.length;){let i=e[t++],s=e[t++],l=e[t++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=l&&(i.scrollLeft=l)}}}let xl;function kt(o,e,t=e){let i=xl||(xl=document.createRange());return i.setEnd(o,t),i.setStart(o,e),i}function Vt(o,e,t,i){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let l=new KeyboardEvent("keydown",s);l.synthetic=!0,o.dispatchEvent(l);let a=new KeyboardEvent("keyup",s);return a.synthetic=!0,o.dispatchEvent(a),l.defaultPrevented||a.defaultPrevented}function tc(o){for(;o;){if(o&&(o.nodeType==9||o.nodeType==11&&o.host))return o;o=o.assignedSlot||o.parentNode}return null}function vl(o){for(;o.attributes.length;)o.removeAttributeNode(o.attributes[0])}function ic(o,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 s=t.childNodes[i-1];s.contentEditable=="false"?i--:(t=s,i=Ye(t))}else{if(t==o)return!0;i=gt(t),t=t.parentNode}}function Cl(o){return o.scrollTop>Math.max(1,o.scrollHeight-o.clientHeight-4)}function Sl(o,e){for(let t=o,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&&!Ti(t))i=gt(t),t=t.parentNode;else return null}}function Nl(o,e){for(let t=o,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&&!Ti(t))i=gt(t)+1,t=t.parentNode;else return null}}class we{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new we(e.parentNode,gt(e),t)}static after(e,t){return new we(e.parentNode,gt(e)+1,t)}}const En=[];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,s=null,l;for(let a of this.children){if(a.flags&7){if(!a.dom&&(l=s?s.nextSibling:i.firstChild)){let r=ne.get(l);(!r||!r.parent&&r.canReuseDOM(a))&&a.reuseDOM(l)}a.sync(e,t),a.flags&=-8}if(l=s?s.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&l!=a.dom&&(t.written=!0),a.dom.parentNode==i)for(;l&&l!=a.dom;)l=Bl(l);else i.insertBefore(a.dom,l);s=a.dom}for(l=s?s.nextSibling:i.firstChild,l&&t&&t.node==i&&(t.written=!0);l;)l=Bl(l)}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 s=Ye(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==this.dom)break;s==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?s=-1:s=1),e=l}s<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 s=0,l=0;;s++){let a=this.children[s];if(a.dom==i)return l;l+=a.length+a.breakAfter}}domBoundsAround(e,t,i=0){let s=-1,l=-1,a=-1,r=-1;for(let d=0,c=i,h=i;d<this.children.length;d++){let f=this.children[d],u=c+f.length;if(c<e&&u>t)return f.domBoundsAround(e,t,c);if(u>=e&&s==-1&&(s=d,l=c),c>t&&f.dom.parentNode==this.dom){a=d,r=h;break}h=u,c=u+f.breakAfter}return{from:l,to:r<0?i+this.length:r,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a<this.children.length&&a>=0?this.children[a].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=En){this.markDirty();for(let s=e;s<t;s++){let l=this.children[s];l.parent==this&&i.indexOf(l)<0&&l.destroy()}this.children.splice(e,t-e,...i);for(let s=0;s<i.length;s++)i[s].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ol(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,s,l,a){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 Bl(o){let e=o.nextSibling;return o.parentNode.removeChild(o),e}class Ol{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 Vl(o,e,t,i,s,l,a,r,d){let{children:c}=o,h=c.length?c[e]:null,f=l.length?l[l.length-1]:null,u=f?f.breakAfter:a;if(!(e==i&&h&&!a&&!u&&l.length<2&&h.merge(t,s,l.length?f:null,t==0,r,d))){if(i<c.length){let p=c[i];p&&(s<p.length||p.breakAfter&&f?.breakAfter)?(e==i&&(p=p.split(s),s=0),!u&&f&&p.merge(0,s,f,!0,0,d)?l[l.length-1]=p:((s||p.children.length&&!p.children[0].length)&&p.merge(0,s,null,!1,0,d),l.push(p))):p?.breakAfter&&(f?f.breakAfter=1:a=1),i++}for(h&&(h.breakAfter=a,t>0&&(!a&&l.length&&h.merge(t,h.length,l[0],!1,r,0)?h.breakAfter=l.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,r,0),e++));e<i&&l.length;)if(c[i-1].become(l[l.length-1]))i--,l.pop(),d=l.length?0:r;else if(c[e].become(l[0]))e++,l.shift(),r=l.length?0:d;else break;!l.length&&e&&i<c.length&&!c[e-1].breakAfter&&c[i].merge(0,0,c[e-1],!1,r,d)&&e--,(e<i||l.length)&&o.replaceChildren(e,i,l)}}function _l(o,e,t,i,s,l){let a=o.childCursor(),{i:r,off:d}=a.findPos(t,1),{i:c,off:h}=a.findPos(e,-1),f=e-t;for(let u of i)f+=u.length;o.length+=f,Vl(o,c,h,r,d,i,0,s,l)}let Se=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},In=typeof document<"u"?document:{documentElement:{style:{}}};const Dn=/Edge\/(\d+)/.exec(Se.userAgent),Al=/MSIE \d/.test(Se.userAgent),Pn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Se.userAgent),Ei=!!(Al||Pn||Dn),Tl=!Ei&&/gecko\/(\d+)/i.test(Se.userAgent),$n=!Ei&&/Chrome\/(\d+)/.exec(Se.userAgent),Ml="webkitFontSmoothing"in In.documentElement.style,El=!Ei&&/Apple Computer/.test(Se.vendor),Il=El&&(/Mobile\/\w+/.test(Se.userAgent)||Se.maxTouchPoints>2);var q={mac:Il||/Mac/.test(Se.platform),windows:/Win/.test(Se.platform),linux:/Linux|X11/.test(Se.platform),ie:Ei,ie_version:Al?In.documentMode||6:Pn?+Pn[1]:Dn?+Dn[1]:0,gecko:Tl,gecko_version:Tl?+(/Firefox\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,chrome:!!$n,chrome_version:$n?+$n[1]:0,ios:Il,android:/Android\b/.test(Se.userAgent),webkit:Ml,safari:El,webkit_version:Ml?+(/\bAppleWebKit\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,tabSize:In.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const nc=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>nc||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 we(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 sc(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 s of t)s.setParent(this)}setAttrs(e){if(vl(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,s,l,a){return i&&(!(i instanceof Xe&&i.mark.eq(this.mark))||e&&l<=0||t<this.length&&a<=0)?!1:(_l(this,e,t,i?i.children.slice():[],l-1,a-1),this.markDirty(),!0)}split(e){let t=[],i=0,s=-1,l=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),s<0&&i>=e&&(s=l),i=d,l++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Xe(this.mark,t,a)}domAtPos(e){return Dl(this,e)}coordsAt(e,t){return $l(this,e,t)}}function sc(o,e,t){let i=o.nodeValue.length;e>i&&(e=i);let s=e,l=e,a=0;e==0&&t<0||e==i&&t>=0?q.chrome||q.gecko||(e?(s--,a=1):l<i&&(l++,a=-1)):t<0?s--:l<i&&l++;let r=kt(o,s,l).getClientRects();if(!r.length)return null;let d=r[(a?a<0:t>=0)?0:r.length-1];return q.safari&&!a&&d.width==0&&(d=Array.prototype.find.call(r,c=>c.width)||d),a?Mi(d,a<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,s,l,a){return i&&(!(i instanceof bt)||!this.widget.compare(i.widget)||e>0&&l<=0||t<this.length&&a<=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,s=this.posAtStart;return i?i.slice(s,s+this.length):X.empty}domAtPos(e){return(this.length?e==0:this.side>0)?we.before(this.dom):we.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 s=this.dom.getClientRects(),l=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let r=a?s.length-1:0;l=s[r],!(e>0?r==0:r==s.length-1||l.top<l.bottom);r+=a?-1:1);return Mi(l,!a)}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 _t extends ne{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof _t&&e.side==this.side}split(){return new _t(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?we.before(this.dom):we.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=_t.prototype.children=En;function Dl(o,e){let t=o.dom,{children:i}=o,s=0;for(let l=0;s<i.length;s++){let a=i[s],r=l+a.length;if(!(r==l&&a.getSide()<=0)){if(e>l&&e<r&&a.dom.parentNode==t)return a.domAtPos(e-l);if(e<=l)break;l=r}}for(let l=s;l>0;l--){let a=i[l-1];if(a.dom.parentNode==t)return a.domAtPos(a.length)}for(let l=s;l<i.length;l++){let a=i[l];if(a.dom.parentNode==t)return a.domAtPos(0)}return new we(t,0)}function Pl(o,e,t){let i,{children:s}=o;t>0&&e instanceof Xe&&s.length&&(i=s[s.length-1])instanceof Xe&&i.mark.eq(e.mark)?Pl(i,e.children[0],t-1):(s.push(e),e.setParent(o)),o.length+=e.length}function $l(o,e,t){let i=null,s=-1,l=null,a=-1;function r(c,h){for(let f=0,u=0;f<c.children.length&&u<=h;f++){let p=c.children[f],b=u+p.length;b>=h&&(p.children.length?r(p,h-u):(!l||l.isHidden&&t>0)&&(b>h||u==b&&p.getSide()>0)?(l=p,a=h-u):(u<h||u==b&&p.getSide()<0&&!p.isHidden)&&(i=p,s=h-u)),u=b}}r(o,e);let d=(t<0?i:l)||i||l;return d?d.coordsAt(Math.max(0,d==i?s:a),t):lc(o)}function lc(o){let e=o.dom.lastChild;if(!e)return o.dom.getBoundingClientRect();let t=Yt(e);return t[t.length-1]||null}function Fn(o,e){for(let t in o)t=="class"&&e.class?e.class+=" "+o.class:t=="style"&&e.style?e.style+=";"+o.style:e[t]=o[t];return e}const Fl=Object.create(null);function Ii(o,e,t){if(o==e)return!0;o||(o=Fl),e||(e=Fl);let i=Object.keys(o),s=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let l of i)if(l!=t&&(s.indexOf(l)==-1||o[l]!==e[l]))return!1;return!0}function Rn(o,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?o.style.cssText="":o.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?o.style.cssText=t[s]:o.setAttribute(s,t[s]));return i}function oc(o){let e=Object.create(null);for(let t=0;t<o.attributes.length;t++){let i=o.attributes[t];e[i.name]=i.value}return e}class Ln{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(o){return o[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o}(Le||(Le={}));class ye extends Nt{constructor(e,t,i,s){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(e){return new Jt(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 lt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:l,end:a}=Rl(e,t);i=(l?t?-3e8:-1:5e8)-1,s=(a?t?2e8:1:-6e8)+1}return new lt(e,i,s,t,e.widget||null,!0)}static line(e){return new Zt(e)}static set(e,t=!1){return le.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ye.none=le.empty;class Jt extends ye{constructor(e){let{start:t,end:i}=Rl(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 Jt&&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))&&Ii(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)}}Jt.prototype.point=!1;class Zt extends ye{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Zt&&this.spec.class==e.spec.class&&Ii(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)}}Zt.prototype.mapMode=Be.TrackBefore,Zt.prototype.point=!0;class lt extends ye{constructor(e,t,i,s,l,a){super(t,i,l,e),this.block=s,this.isReplace=a,this.mapMode=s?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 lt&&ac(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)}}lt.prototype.point=!0;function Rl(o,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=o;return t==null&&(t=o.inclusive),i==null&&(i=o.inclusive),{start:t??e,end:i??e}}function ac(o,e){return o==e||!!(o&&e&&o.compare(e))}function jn(o,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=o?t[s]=Math.max(t[s],e):t.push(o,e)}class de extends ne{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,l,a){if(i){if(!(i instanceof de))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),_l(this,e,t,i?i.children.slice():[],l,a),!0}split(e){let t=new de;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let l=i;l<this.children.length;l++)t.append(this.children[l],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){Ii(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Pl(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Fn(t,this.attrs||{})),i&&(this.attrs=Fn({class:i},this.attrs||{}))}domAtPos(e){return Dl(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(vl(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&&(Rn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&ne.get(s)instanceof Xe;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=ne.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!q.ios||!this.children.some(l=>l instanceof Ee))){let l=document.createElement("BR");l.cmIgnore=!0,this.dom.appendChild(l)}}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 s=Yt(i.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=$l(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,l=i.bottom-i.top;if(Math.abs(l-s.lineHeight)<2&&s.textHeight<l){let a=(l-s.textHeight)/2;return{top:i.top+a,bottom:i.bottom-a,left:i.left,right:i.left}}}return i}become(e){return e instanceof de&&this.children.length==0&&e.children.length==0&&Ii(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,s=0;i<e.children.length;i++){let l=e.children[i],a=s+l.length;if(a>=t){if(l instanceof de)return l;if(a>t)break}s=a+l.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,s,l,a){return i&&(!(i instanceof Je)||!this.widget.compare(i.widget)||e>0&&l<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?we.before(this.dom):we.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 En}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 zn?null:Mi(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 zn extends Ln{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 ei{constructor(e,t,i,s){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=s,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 de),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Di(new _t(-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:l,lineBreak:a,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(a){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=l,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Di(new Ee(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,l,a){if(this.disallowBlockEffectsFor[a]&&i instanceof lt){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 lt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Je(i.widget||At.block,r,i));else{let d=bt.create(i.widget||At.inline,r,r?0:i.startSide),c=this.atCursorPos&&!d.isEditable&&l<=s.length&&(e<t||i.startSide>0),h=!d.isEditable&&(e<t||l>s.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!c&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),c&&(f.append(Di(new _t(1),s),l),l=s.length+Math.max(0,l-s.length)),f.append(Di(d,s),l),this.atCursorPos=h,this.pendingBuffer=h?e<t||l>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.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=l)}static build(e,t,i,s,l){let a=new ei(e,t,i,l);return a.openEnd=le.spans(s,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Di(o,e){for(let t of e)o=new Xe(t,[o],o.length);return o}class At extends Ln{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}}At.inline=new At("span"),At.block=new At("div");var me=function(o){return o[o.LTR=0]="LTR",o[o.RTL=1]="RTL",o}(me||(me={}));const wt=me.LTR,qn=me.RTL;function Ll(o){let e=[];for(let t=0;t<o.length;t++)e.push(1<<+o[t]);return e}const rc=Ll("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),dc=Ll("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Un=Object.create(null),je=[];for(let o of["()","[]","{}"]){let e=o.charCodeAt(0),t=o.charCodeAt(1);Un[e]=t,Un[t]=-e}function jl(o){return o<=247?rc[o]:1424<=o&&o<=1524?2:1536<=o&&o<=1785?dc[o-1536]:1774<=o&&o<=2220?4:8192<=o&&o<=8204?256:64336<=o&&o<=65023?4:1}const cc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ot{get dir(){return this.level%2?qn:wt}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,s){let l=-1;for(let a=0;a<e.length;a++){let r=e[a];if(r.from<=t&&r.to>=t){if(r.level==i)return a;(l<0||(s!=0?s<0?r.from<t:r.to>t:e[l].level>r.level))&&(l=a)}}if(l<0)throw new RangeError("Index out of range");return l}}function zl(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++){let i=o[t],s=e[t];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!zl(i.inner,s.inner))return!1}return!0}const se=[];function hc(o,e,t,i,s){for(let l=0;l<=i.length;l++){let a=l?i[l-1].to:e,r=l<i.length?i[l].from:t,d=l?256:s;for(let c=a,h=d,f=d;c<r;c++){let u=jl(o.charCodeAt(c));u==512?u=h:u==8&&f==4&&(u=16),se[c]=u==4?2:u,u&7&&(f=u),h=u}for(let c=a,h=d,f=d;c<r;c++){let u=se[c];if(u==128)c<r-1&&h==se[c+1]&&h&24?u=se[c]=h:se[c]=256;else if(u==64){let p=c+1;for(;p<r&&se[p]==64;)p++;let b=c&&h==8||p<t&&se[p]==8?f==1?1:8:256;for(let k=c;k<p;k++)se[k]=b;c=p-1}else u==8&&f==1&&(se[c]=1);h=u,u&7&&(f=u)}}}function fc(o,e,t,i,s){let l=s==1?2:1;for(let a=0,r=0,d=0;a<=i.length;a++){let c=a?i[a-1].to:e,h=a<i.length?i[a].from:t;for(let f=c,u,p,b;f<h;f++)if(p=Un[u=o.charCodeAt(f)])if(p<0){for(let k=r-3;k>=0;k-=3)if(je[k+1]==-p){let v=je[k+2],C=v&2?s:v&4?v&1?l:s:0;C&&(se[f]=se[je[k]]=C),r=k;break}}else{if(je.length==189)break;je[r++]=f,je[r++]=u,je[r++]=d}else if((b=se[f])==2||b==1){let k=b==s;d=k?0:1;for(let v=r-3;v>=0;v-=3){let C=je[v+2];if(C&2)break;if(k)je[v+2]|=2;else{if(C&4)break;je[v+2]|=4}}}}}function uc(o,e,t,i){for(let s=0,l=i;s<=t.length;s++){let a=s?t[s-1].to:o,r=s<t.length?t[s].from:e;for(let d=a;d<r;){let c=se[d];if(c==256){let h=d+1;for(;;)if(h==r){if(s==t.length)break;h=t[s++].to,r=s<t.length?t[s].from:e}else if(se[h]==256)h++;else break;let f=l==1,u=(h<e?se[h]:i)==1,p=f==u?f?1:2:i;for(let b=h,k=s,v=k?t[k-1].to:o;b>d;)b==v&&(b=t[--k].from,v=k?t[k-1].to:o),se[--b]=p;d=h}else l=c,d++}}}function Wn(o,e,t,i,s,l,a){let r=i%2?2:1;if(i%2==s%2)for(let d=e,c=0;d<t;){let h=!0,f=!1;if(c==l.length||d<l[c].from){let k=se[d];k!=r&&(h=!1,f=k==16)}let u=!h&&r==1?[]:null,p=h?i:i+1,b=d;e:for(;;)if(c<l.length&&b==l[c].from){if(f)break e;let k=l[c];if(!h)for(let v=k.to,C=c+1;;){if(v==t)break e;if(C<l.length&&l[C].from==v)v=l[C++].to;else{if(se[v]==r)break e;break}}if(c++,u)u.push(k);else{k.from>d&&a.push(new ot(d,k.from,p));let v=k.direction==wt!=!(p%2);Hn(o,v?i+1:i,s,k.inner,k.from,k.to,a),d=k.to}b=k.to}else{if(b==t||(h?se[b]!=r:se[b]==r))break;b++}u?Wn(o,d,b,i+1,s,u,a):d<b&&a.push(new ot(d,b,p)),d=b}else for(let d=t,c=l.length;d>e;){let h=!0,f=!1;if(!c||d>l[c-1].to){let k=se[d-1];k!=r&&(h=!1,f=k==16)}let u=!h&&r==1?[]:null,p=h?i:i+1,b=d;e:for(;;)if(c&&b==l[c-1].to){if(f)break e;let k=l[--c];if(!h)for(let v=k.from,C=c;;){if(v==e)break e;if(C&&l[C-1].to==v)v=l[--C].from;else{if(se[v-1]==r)break e;break}}if(u)u.push(k);else{k.to<d&&a.push(new ot(k.to,d,p));let v=k.direction==wt!=!(p%2);Hn(o,v?i+1:i,s,k.inner,k.from,k.to,a),d=k.from}b=k.from}else{if(b==e||(h?se[b-1]!=r:se[b-1]==r))break;b--}u?Wn(o,b,d,i+1,s,u,a):b<d&&a.push(new ot(b,d,p)),d=b}}function Hn(o,e,t,i,s,l,a){let r=e%2?2:1;hc(o,s,l,i,r),fc(o,s,l,i,r),uc(s,l,i,r),Wn(o,s,l,e,t,i,a)}function pc(o,e,t){if(!o)return[new ot(0,0,e==qn?1:0)];if(e==wt&&!t.length&&!cc.test(o))return ql(o.length);if(t.length)for(;o.length>se.length;)se[se.length]=256;let i=[],s=e==wt?0:1;return Hn(o,s,s,t,0,o.length,i),i}function ql(o){return[new ot(0,o,0)]}let Ul="";function mc(o,e,t,i,s){var l;let a=i.head-o.from,r=ot.find(e,a,(l=i.bidiLevel)!==null&&l!==void 0?l:-1,i.assoc),d=e[r],c=d.side(s,t);if(a==c){let u=r+=s?1:-1;if(u<0||u>=e.length)return null;d=e[r=u],a=d.side(!s,t),c=d.side(s,t)}let h=Ke(o.text,a,d.forward(s,t));(h<d.from||h>d.to)&&(h=c),Ul=o.text.slice(Math.min(a,h),Math.max(a,h));let f=r==(s?e.length-1:0)?null:e[r+(s?1:-1)];return f&&h==c&&f.level+(s?0:1)<d.level?U.cursor(f.side(!s,t)+o.from,f.forward(s,t)?1:-1,f.level):U.cursor(h+o.from,d.forward(s,t)?-1:1,d.level)}function gc(o,e,t){for(let i=e;i<t;i++){let s=jl(o.charCodeAt(i));if(s==1)return wt;if(s==2||s==4)return qn}return wt}const Wl=K.define(),Hl=K.define(),Kl=K.define(),Ql=K.define(),Kn=K.define(),Gl=K.define(),Yl=K.define(),Qn=K.define(),Gn=K.define(),Xl=K.define({combine:o=>o.some(e=>e)}),kc=K.define({combine:o=>o.some(e=>e)}),Jl=K.define();class Tt{constructor(e,t="nearest",i="nearest",s=5,l=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=l,this.isSnapshot=a}map(e){return e.empty?this:new Tt(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 Tt(U.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Pi=ce.define({map:(o,e)=>o.map(e)}),Zl=ce.define();function ze(o,e,t){let i=o.facet(Ql);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=K.define({combine:o=>o.length?o[0]:!0});let bc=0;const ti=K.define();class Mt{constructor(e,t,i,s,l){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=s,this.extension=l(this)}static define(e,t){const{eventHandlers:i,eventObservers:s,provide:l,decorations:a}=t||{};return new Mt(bc++,e,i,s,r=>{let d=[ti.of(r)];return a&&d.push(ii.of(c=>{let h=c.plugin(r);return h?a(h):ye.none})),l&&d.push(l(r)),d})}static fromClass(e,t){return Mt.define(i=>new e(i),t)}}class Yn{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 eo=K.define(),Xn=K.define(),ii=K.define(),to=K.define(),Jn=K.define(),io=K.define();function no(o,e){let t=o.state.facet(io);if(!t.length)return t;let i=t.map(l=>l instanceof Function?l(o):l),s=[];return le.spans(i,e.from,e.to,{point(){},span(l,a,r,d){let c=l-e.from,h=a-e.from,f=s;for(let u=r.length-1;u>=0;u--,d--){let p=r[u].spec.bidiIsolate,b;if(p==null&&(p=gc(e.text,c,h)),d>0&&f.length&&(b=f[f.length-1]).to==c&&b.direction==p)b.to=h,f=b.inner;else{let k={from:c,to:h,direction:p,inner:[]};f.push(k),f=k.inner}}}}),s}const so=K.define();function lo(o){let e=0,t=0,i=0,s=0;for(let l of o.state.facet(so)){let a=l(o);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(i=Math.max(i,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:t,top:i,bottom:s}}const ni=K.define();class Ae{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Ae(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 s=e[t-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),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 s=0,l=0,a=0,r=0;;s++){let d=s==e.length?null:e[s],c=a-r,h=d?d.fromB:1e9;for(;l<t.length&&t[l]<h;){let f=t[l],u=t[l+1],p=Math.max(r,f),b=Math.min(h,u);if(p<=b&&new Ae(p+c,b+c,p,b).addToSet(i),u>h)break;l+=2}if(!d)return i;new Ae(d.fromA,d.toA,d.fromB,d.toB).addToSet(i),a=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 l of i)this.changes=this.changes.compose(l.changes);let s=[];this.changes.iterChangedRanges((l,a,r,d)=>s.push(new Ae(l,a,r,d))),this.changedRanges=s}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 oo 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=ye.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 de],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ae(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:c,toA:h})=>h<this.minWidthFrom||c>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 s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!Nc(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let l=s>-1?yc(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:h}=this.hasComposition;i=new Ae(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=l?{from:l.range.fromB,to:l.range.toB}:null,(q.ie||q.chrome)&&!l&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,r=this.updateDeco(),d=Cc(a,r,e.changes);return i=Ae.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,l),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=q.chrome||q.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let l=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.children)a instanceof Je&&a.widget instanceof zn&&l.push(a.dom);s.updateGaps(l)}updateChildren(e,t,i){let s=i?i.range.addToSet(e.slice()):e,l=this.childCursor(t);for(let a=s.length-1;;a--){let r=a>=0?s[a]:null;if(!r)break;let{fromA:d,toA:c,fromB:h,toB:f}=r,u,p,b,k;if(i&&i.range.fromB<f&&i.range.toB>h){let g=ei.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),m=ei.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);p=g.breakAtStart,b=g.openStart,k=m.openEnd;let S=this.compositionView(i);m.breakAtStart?S.breakAfter=1:m.content.length&&S.merge(S.length,S.length,m.content[0],!1,m.openStart,0)&&(S.breakAfter=m.content[0].breakAfter,m.content.shift()),g.content.length&&S.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),u=g.content.concat(S).concat(m.content)}else({content:u,breakAtStart:p,openStart:b,openEnd:k}=ei.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:v,off:C}=l.findPos(c,1),{i:y,off:V}=l.findPos(d,-1);Vl(this,y,V,v,C,u,p,b,k)}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(Zl)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ee(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new Xe(s,[t],t.length);let i=new de;return i.append(t,0),i}fixCompositionDOM(e){let t=(l,a)=>{a.flags|=8|(a.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(a);let r=ne.get(l);r&&r!=a&&(r.dom=null),a.setDOM(l)},i=this.childPos(e.range.fromB,1),s=this.children[i.i];t(e.line,s);for(let l=e.marks.length-1;l>=-1;l--)i=s.childPos(i.off,1),s=s.children[i.i],t(l>=0?e.marks[l].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,l=!s&&Ai(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||l))return;let a=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),c=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(q.gecko&&r.empty&&!this.hasComposition&&wc(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=c=new we(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!Xt(d.node,d.offset,h.anchorNode,h.anchorOffset)||!Xt(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&this.dom.contains(h.focusNode)&&Sc(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Gt(this.view.root);if(f)if(r.empty){if(q.gecko){let u=xc(d.node,d.offset);if(u&&u!=3){let p=(u==1?Sl:Nl)(d.node,d.offset);p&&(d=new we(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(c.node,c.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([d,c]=[c,d]),u.setEnd(c.node,c.offset),u.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(u)}l&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,c)),this.impreciseAnchor=d.precise?null:new we(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new we(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Xt(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=Gt(e.root),{anchorNode:s,anchorOffset:l}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=de.find(this,t.head);if(!a)return;let r=a.posAtStart;if(t.head==r||t.head==r+a.length)return;let d=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!d||!c||d.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);i.collapse(h.node,h.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(s,l)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let s=e.offset;!i&&s<t.childNodes.length;s++){let l=ne.get(t.childNodes[s]);l instanceof de&&(i=l.domAtPos(0))}for(let s=e.offset-1;!i&&s>=0;s--){let l=ne.get(t.childNodes[s]);l instanceof de&&(i=l.domAtPos(l.length))}return i?new we(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 s=this.children[t];if(i<s.length||s instanceof de)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,s=0;for(let l=this.length,a=this.children.length-1;a>=0;a--){let r=this.children[a],d=l-r.breakAfter,c=d-r.length;if(d<e)break;if(c<=e&&(c<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof de&&!(i instanceof de&&t>=0)))i=r,s=c;else if(i&&c==e&&d==e&&r instanceof Je&&Math.abs(t)<2){if(r.deco.startSide<0)break;a&&(i=null)}l=c}return i?i.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof de))return null;for(;s.children.length;){let{i:r,off:d}=s.childPos(i,1);for(;;r++){if(r==s.children.length)return null;if((s=s.children[r]).length)break}i=d}if(!(s instanceof Ee))return null;let l=Ke(s.text,i);if(l==i)return null;let a=kt(s.dom,i,l).getClientRects();for(let r=0;r<a.length;r++){let d=a[r];if(r==a.length-1||d.top<d.bottom&&d.left<d.right)return d}return null}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,l=this.view.contentDOM.clientWidth,a=l>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let c=0,h=0;h<this.children.length;h++){let f=this.children[h],u=c+f.length;if(u>s)break;if(c>=i){let p=f.dom.getBoundingClientRect();if(t.push(p.height),a){let b=f.dom.lastChild,k=b?Yt(b):[];if(k.length){let v=k[k.length-1],C=d?v.right-p.left:p.right-v.left;C>r&&(r=C,this.minWidth=l,this.minWidthFrom=c,this.minWidthTo=u)}}}c=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 l of this.children)if(l instanceof de){let a=l.measureTextSize();if(a)return a}let e=document.createElement("div"),t,i,s;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 l=Yt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=l?l.width/27:7,s=l?l.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ol(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let l=s==t.viewports.length?null:t.viewports[s],a=l?l.from-1:this.length;if(a>i){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(ye.replace({widget:new zn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!l)break;i=l.to+1}return ye.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ii).map(l=>(this.dynamicDecorationMap[e++]=typeof l=="function")?l(this.view):l),i=!1,s=this.view.state.facet(to).map((l,a)=>{let r=typeof l=="function";return r&&(i=!0),r?l(this.view):l});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(le.join(s))),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 c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(Jl))try{if(c(this.view,e.range,e))return!0}catch(h){ze(this.view.state,h,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let l=lo(this.view),a={left:i.left-l.left,top:i.top-l.top,right:i.right+l.right,bottom:i.bottom+l.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;Jd(this.view.scrollDOM,a,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 wc(o){return o.node.nodeType==1&&o.node.firstChild&&(o.offset==0||o.node.childNodes[o.offset-1].contentEditable=="false")&&(o.offset==o.node.childNodes.length||o.node.childNodes[o.offset].contentEditable=="false")}function ao(o,e){let t=o.observer.selectionRange;if(!t.focusNode)return null;let i=Sl(t.focusNode,t.focusOffset),s=Nl(t.focusNode,t.focusOffset),l=i||s;if(s&&i&&s.node!=i.node){let r=ne.get(s.node);if(!r||r instanceof Ee&&r.text!=s.node.nodeValue)l=s;else if(o.docView.lastCompositionAfterCursor){let d=ne.get(i.node);!d||d instanceof Ee&&d.text!=i.node.nodeValue||(l=s)}}if(o.docView.lastCompositionAfterCursor=l!=i,!l)return null;let a=e-l.offset;return{from:a,to:a+l.node.nodeValue.length,node:l.node}}function yc(o,e,t){let i=ao(o,t);if(!i)return null;let{node:s,from:l,to:a}=i,r=s.nodeValue;if(/[\n\r]/.test(r)||o.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,c=new Ae(d.mapPos(l),d.mapPos(a),l,a),h=[];for(let f=s.parentNode;;f=f.parentNode){let u=ne.get(f);if(u instanceof Xe)h.push({node:f,deco:u.mark});else{if(u instanceof de||f.nodeName=="DIV"&&f.parentNode==o.contentDOM)return{range:c,text:s,marks:h,line:f};if(f!=o.contentDOM)h.push({node:f,deco:new Jt({inclusive:!0,attributes:oc(f),tagName:f.tagName.toLowerCase()})});else return null}}}function xc(o,e){return o.nodeType!=1?0:(e&&o.childNodes[e-1].contentEditable=="false"?1:0)|(e<o.childNodes.length&&o.childNodes[e].contentEditable=="false"?2:0)}let vc=class{constructor(){this.changes=[]}compareRange(e,t){jn(e,t,this.changes)}comparePoint(e,t){jn(e,t,this.changes)}};function Cc(o,e,t){let i=new vc;return le.compare(o,e,t,i),i.changes}function Sc(o,e){for(let t=o;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Nc(o,e){let t=!1;return e&&o.iterChangedRanges((i,s)=>{i<e.to&&s>e.from&&(t=!0)}),t}function Bc(o,e,t=1){let i=o.charCategorizer(e),s=o.doc.lineAt(e),l=e-s.from;if(s.length==0)return U.cursor(e);l==0?t=1:l==s.length&&(t=-1);let a=l,r=l;t<0?a=Ke(s.text,l,!1):r=Ke(s.text,l);let d=i(s.text.slice(a,r));for(;a>0;){let c=Ke(s.text,a,!1);if(i(s.text.slice(c,a))!=d)break;a=c}for(;r<s.length;){let c=Ke(s.text,r);if(i(s.text.slice(r,c))!=d)break;r=c}return U.range(a+s.from,r+s.from)}function Oc(o,e){return e.left>o?e.left-o:Math.max(0,o-e.right)}function Vc(o,e){return e.top>o?e.top-o:Math.max(0,o-e.bottom)}function Zn(o,e){return o.top<e.bottom-1&&o.bottom>e.top+1}function ro(o,e){return e<o.top?{top:e,left:o.left,right:o.right,bottom:o.bottom}:o}function co(o,e){return e>o.bottom?{top:o.top,left:o.left,right:o.right,bottom:e}:o}function es(o,e,t){let i,s,l,a,r=!1,d,c,h,f;for(let b=o.firstChild;b;b=b.nextSibling){let k=Yt(b);for(let v=0;v<k.length;v++){let C=k[v];s&&Zn(s,C)&&(C=ro(co(C,s.bottom),s.top));let y=Oc(e,C),V=Vc(t,C);if(y==0&&V==0)return b.nodeType==3?ho(b,e,t):es(b,e,t);if(!i||a>V||a==V&&l>y){i=b,s=C,l=y,a=V;let g=V?t<C.top?-1:1:y?e<C.left?-1:1:0;r=!g||(g>0?v<k.length-1:v>0)}y==0?t>C.bottom&&(!h||h.bottom<C.bottom)?(d=b,h=C):t<C.top&&(!f||f.top>C.top)&&(c=b,f=C):h&&Zn(h,C)?h=co(h,C.bottom):f&&Zn(f,C)&&(f=ro(f,C.top))}}if(h&&h.bottom>=t?(i=d,s=h):f&&f.top<=t&&(i=c,s=f),!i)return{node:o,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return ho(i,u,t);if(r&&i.contentEditable!="false")return es(i,u,t);let p=Array.prototype.indexOf.call(o.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:o,offset:p}}function ho(o,e,t){let i=o.nodeValue.length,s=-1,l=1e9,a=0;for(let r=0;r<i;r++){let d=kt(o,r,r+1).getClientRects();for(let c=0;c<d.length;c++){let h=d[c];if(h.top==h.bottom)continue;a||(a=e-h.left);let f=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<l){let u=e>=(h.left+h.right)/2,p=u;if((q.chrome||q.gecko)&&kt(o,r).getBoundingClientRect().left==h.right&&(p=!u),f<=0)return{node:o,offset:r+(p?1:0)};s=r+(p?1:0),l=f}}}return{node:o,offset:s>-1?s:a>0?o.nodeValue.length:0}}function fo(o,e,t,i=-1){var s,l;let a=o.contentDOM.getBoundingClientRect(),r=a.top+o.viewState.paddingTop,d,{docHeight:c}=o.viewState,{x:h,y:f}=e,u=f-r;if(u<0)return 0;if(u>c)return o.state.doc.length;for(let g=o.viewState.heightOracle.textHeight/2,m=!1;d=o.elementAtHeight(u),d.type!=Le.Text;)for(;u=i>0?d.bottom+g:d.top-g,!(u>=0&&u<=c);){if(m)return t?null:0;m=!0,i=-i}f=r+u;let p=d.from;if(p<o.viewport.from)return o.viewport.from==0?0:t?null:uo(o,a,d,h,f);if(p>o.viewport.to)return o.viewport.to==o.state.doc.length?o.state.doc.length:t?null:uo(o,a,d,h,f);let b=o.dom.ownerDocument,k=o.root.elementFromPoint?o.root:b,v=k.elementFromPoint(h,f);v&&!o.contentDOM.contains(v)&&(v=null),v||(h=Math.max(a.left+1,Math.min(a.right-1,h)),v=k.elementFromPoint(h,f),v&&!o.contentDOM.contains(v)&&(v=null));let C,y=-1;if(v&&((s=o.docView.nearest(v))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let g=b.caretPositionFromPoint(h,f);g&&({offsetNode:C,offset:y}=g)}else if(b.caretRangeFromPoint){let g=b.caretRangeFromPoint(h,f);g&&({startContainer:C,startOffset:y}=g,(!o.contentDOM.contains(C)||q.safari&&_c(C,y,h)||q.chrome&&Ac(C,y,h))&&(C=void 0))}}if(!C||!o.docView.dom.contains(C)){let g=de.find(o.docView,p);if(!g)return u>d.top+d.height/2?d.to:d.from;({node:C,offset:y}=es(g.dom,h,f))}let V=o.docView.nearest(C);if(!V)return null;if(V.isWidget&&((l=V.dom)===null||l===void 0?void 0:l.nodeType)==1){let g=V.dom.getBoundingClientRect();return e.y<g.top||e.y<=g.bottom&&e.x<=(g.left+g.right)/2?V.posAtStart:V.posAtEnd}else return V.localPosFromDOM(C,y)+V.posAtStart}function uo(o,e,t,i,s){let l=Math.round((i-e.left)*o.defaultCharacterWidth);if(o.lineWrapping&&t.height>o.defaultLineHeight*1.5){let r=o.viewState.heightOracle.textHeight,d=Math.floor((s-t.top-(o.defaultLineHeight-r)*.5)/r);l+=d*o.viewState.heightOracle.lineLength}let a=o.state.sliceDoc(t.from,t.to);return t.from+Qd(a,l,o.state.tabSize)}function _c(o,e,t){let i;if(o.nodeType!=3||e!=(i=o.nodeValue.length))return!1;for(let s=o.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return kt(o,i-1,i).getBoundingClientRect().left>t}function Ac(o,e,t){if(e!=0)return!1;for(let s=o;;){let l=s.parentNode;if(!l||l.nodeType!=1||l.firstChild!=s)return!1;if(l.classList.contains("cm-line"))break;s=l}let i=o.nodeType==1?o.getBoundingClientRect():kt(o,0,Math.max(o.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Tc(o,e){let t=o.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 Mc(o,e,t,i){let s=Tc(o,e.head),l=!i||s.type!=Le.Text||!(o.lineWrapping||s.widgetLineBreaks)?null:o.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(l){let a=o.dom.getBoundingClientRect(),r=o.textDirectionAt(s.from),d=o.posAtCoords({x:t==(r==me.LTR)?a.right-1:a.left+1,y:(l.top+l.bottom)/2});if(d!=null)return U.cursor(d,t?-1:1)}return U.cursor(t?s.to:s.from,t?-1:1)}function po(o,e,t,i){let s=o.state.doc.lineAt(e.head),l=o.bidiSpans(s),a=o.textDirectionAt(s.from);for(let r=e,d=null;;){let c=mc(s,l,a,r,t),h=Ul;if(!c){if(s.number==(t?o.state.doc.lines:1))return r;h=`
8
+ `,s=o.state.doc.line(s.number+(t?1:-1)),l=o.bidiSpans(s),c=o.visualLineSide(s,!t)}if(d){if(!d(h))return r}else{if(!i)return c;d=i(h)}r=c}}function Ec(o,e,t){let i=o.state.charCategorizer(e),s=i(t);return l=>{let a=i(l);return s==Ge.Space&&(s=a),s==a}}function Ic(o,e,t,i){let s=e.head,l=t?1:-1;if(s==(t?o.state.doc.length:0))return U.cursor(s,e.assoc);let a=e.goalColumn,r,d=o.contentDOM.getBoundingClientRect(),c=o.coordsAtPos(s,e.assoc||-1),h=o.documentTop;if(c)a==null&&(a=c.left-d.left),r=l<0?c.top:c.bottom;else{let p=o.viewState.lineBlockAt(s);a==null&&(a=Math.min(d.right-d.left,o.defaultCharacterWidth*(s-p.from))),r=(l<0?p.top:p.bottom)+h}let f=d.left+a,u=i??o.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let b=r+(u+p)*l,k=fo(o,{x:f,y:b},!1,l);if(b<d.top||b>d.bottom||(l<0?k<s:k>s)){let v=o.docView.coordsForChar(k),C=!v||b<v.top?-1:1;return U.cursor(k,C,void 0,a)}}}function Fi(o,e,t){for(;;){let i=0;for(let s of o)s.between(e-1,e+1,(l,a,r)=>{if(e>l&&e<a){let d=i||t||(e-l<a-e?-1:1);e=d<0?l:a,i=d}});if(!i)return e}}function ts(o,e,t){let i=Fi(o.state.facet(Jn).map(s=>s(o)),t.from,e.head>t.from?-1:1);return i==t.from?t:U.cursor(i,i<t.from?1:-1)}const si="￿";class Dc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(ee.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=si}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let l=this.text.length;this.readNode(s);let a=s.nextSibling;if(a==t)break;let r=ne.get(s),d=ne.get(a);(r&&d?r.breakAfter:(r?r.breakAfter:Ti(s))||Ti(a)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>l)&&this.lineBreak(),s=a}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,s=this.lineSeparator?null:/\r\n?|\n/g;;){let l=-1,a=1,r;if(this.lineSeparator?(l=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(r=s.exec(t))&&(l=r.index,a=r[0].length),this.append(t.slice(i,l<0?t.length:l)),l<0)break;if(this.lineBreak(),a>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=a-1);i=l+a}}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 s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.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+(Pc(e,i.node,i.offset)?t:0))}}function Pc(o,e,t){for(;;){if(!e||t<Ye(e))return!1;if(e==o)return!0;t=gt(e)+1,e=e.parentNode}}class mo{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class $c{constructor(e,t,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:l,impreciseAnchor:a}=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=l||a?[]:Lc(e),d=new Dc(r,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=jc(r,this.bounds.from)}else{let r=e.observer.selectionRange,d=l&&l.node==r.focusNode&&l.offset==r.focusOffset||!Mn(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),c=a&&a.node==r.anchorNode&&a.offset==r.anchorOffset||!Mn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((q.ios||q.chrome)&&e.state.selection.main.empty&&d!=c&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(d,c),u=Math.max(d,c),p=h.from-f,b=h.to-u;(p==0||p==1||f==0)&&(b==0||b==-1||u==e.state.doc.length)&&(d=0,c=e.state.doc.length)}this.newSel=U.single(c,d)}}}function go(o,e){let t,{newSel:i}=e,s=o.state.selection.main,l=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:r}=e.bounds,d=s.from,c=null;(l===8||q.android&&e.text.length<r-a)&&(d=s.to,c="end");let h=Rc(o.state.doc.sliceString(a,r,si),e.text,d-a,c);h&&(q.chrome&&l==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==si+si&&h.toB--,t={from:a+h.from,to:a+h.toA,insert:X.of(e.text.slice(h.from,h.toB).split(si))})}else i&&(!o.hasFocus&&o.state.facet(at)||i.main.eq(s))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!s.empty&&i&&i.main.empty?t={from:s.from,to:s.to,insert:o.state.doc.slice(s.from,s.to)}:t&&t.from>=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:o.state.doc.slice(s.from,t.from).append(t.insert).append(o.state.doc.slice(t.to,s.to))}:(q.mac||q.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&o.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=U.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:X.of([" "])}):q.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
9
+ `&&o.lineWrapping&&(i&&(i=U.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:X.of([" "])}),t)return is(o,t,i,l);if(i&&!i.main.eq(s)){let a=!1,r="select";return o.inputState.lastSelectionTime>Date.now()-50&&(o.inputState.lastSelectionOrigin=="select"&&(a=!0),r=o.inputState.lastSelectionOrigin),o.dispatch({selection:i,scrollIntoView:a,userEvent:r}),!0}else return!1}function is(o,e,t,i=-1){if(q.ios&&o.inputState.flushIOSKey(e))return!0;let s=o.state.selection.main;if(q.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&o.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Vt(o.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Vt(o.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Vt(o.contentDOM,"Delete",46)))return!0;let l=e.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let a,r=()=>a||(a=Fc(o,e,t));return o.state.facet(Gl).some(d=>d(o,e.from,e.to,l,r))||o.dispatch(r()),!0}function Fc(o,e,t){let i,s=o.state,l=s.selection.main;if(e.from>=l.from&&e.to<=l.to&&e.to-e.from>=(l.to-l.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&o.inputState.composing<0){let r=l.from<e.from?s.sliceDoc(l.from,e.from):"",d=l.to>e.to?s.sliceDoc(e.to,l.to):"";i=s.replaceSelection(o.state.toText(r+e.insert.sliceString(0,void 0,o.state.lineBreak)+d))}else{let r=s.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(s.selection.ranges.length>1&&o.inputState.composing>=0&&e.to<=l.to&&e.to>=l.to-10){let c=o.state.sliceDoc(e.from,e.to),h,f=t&&ao(o,t.main.head);if(f){let b=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-b}}else h=o.state.doc.lineAt(l.head);let u=l.to-e.to,p=l.to-l.from;i=s.changeByRange(b=>{if(b.from==l.from&&b.to==l.to)return{changes:r,range:d||b.map(r)};let k=b.to-u,v=k-c.length;if(b.to-b.from!=p||o.state.sliceDoc(v,k)!=c||b.to>=h.from&&b.from<=h.to)return{range:b};let C=s.changes({from:v,to:k,insert:e.insert}),y=b.to-l.to;return{changes:C,range:d?U.range(Math.max(0,d.anchor+y),Math.max(0,d.head+y)):b.map(C)}})}else i={changes:r,selection:d&&s.selection.replaceRange(d)}}let a="input.type";return(o.composing||o.inputState.compositionPendingChange&&o.inputState.compositionEndedAt>Date.now()-50)&&(o.inputState.compositionPendingChange=!1,a+=".compose",o.inputState.compositionFirstChange&&(a+=".start",o.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:a,scrollIntoView:!0})}function Rc(o,e,t,i){let s=Math.min(o.length,e.length),l=0;for(;l<s&&o.charCodeAt(l)==e.charCodeAt(l);)l++;if(l==s&&o.length==e.length)return null;let a=o.length,r=e.length;for(;a>0&&r>0&&o.charCodeAt(a-1)==e.charCodeAt(r-1);)a--,r--;if(i=="end"){let d=Math.max(0,l-Math.min(a,r));t-=a+d-l}if(a<l&&o.length<e.length){let d=t<=l&&t>=a?l-t:0;l-=d,r=l+(r-a),a=l}else if(r<l){let d=t<=l&&t>=r?l-t:0;l-=d,a=l+(a-r),r=l}return{from:l,toA:a,toB:r}}function Lc(o){let e=[];if(o.root.activeElement!=o.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:l}=o.observer.selectionRange;return t&&(e.push(new mo(t,i)),(s!=t||l!=i)&&e.push(new mo(s,l))),e}function jc(o,e){if(o.length==0)return null;let t=o[0].pos,i=o.length==2?o[1].pos:t;return t>-1&&i>-1?U.single(t+e,i+e):null}class zc{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,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&lh(e.contentDOM.ownerDocument)}handleEvent(e){!Xc(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 s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=qc(e),i=this.handlers,s=this.view.contentDOM;for(let l in t)if(l!="scroll"){let a=!t[l].handlers.length,r=i[l];r&&a!=!r.handlers.length&&(s.removeEventListener(l,this.handleEvent),r=null),r||s.addEventListener(l,this.handleEvent,{passive:a})}for(let l in i)l!="scroll"&&!t[l]&&s.removeEventListener(l,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&&Wc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=bo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Uc.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,Vt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:q.safari&&!q.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 ko(o,e){return(t,i)=>{try{return e.call(o,i,t)}catch(s){ze(t.state,s)}}}function qc(o){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of o){let s=i.spec;if(s&&s.domEventHandlers)for(let l in s.domEventHandlers){let a=s.domEventHandlers[l];a&&t(l).handlers.push(ko(i.value,a))}if(s&&s.domEventObservers)for(let l in s.domEventObservers){let a=s.domEventObservers[l];a&&t(l).observers.push(ko(i.value,a))}}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 bo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Uc="dthko",Wc=[16,17,18,20,91,92,224,225],Ri=6;function Li(o){return Math.max(0,o)*.7+8}function Hc(o,e){return Math.max(Math.abs(o.clientX-e.clientX),Math.abs(o.clientY-e.clientY))}class Kc{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Zd(e.contentDOM),this.atoms=e.state.facet(Jn).map(a=>a(e));let l=e.contentDOM.ownerDocument;l.addEventListener("mousemove",this.move=this.move.bind(this)),l.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(ee.allowMultipleSelections)&&Qc(e,t),this.dragging=Yc(e,t)&&Oo(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&&Hc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,l=0,a=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:l,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=lo(this.view);e.clientX-d.left<=s+Ri?t=-Li(s-e.clientX):e.clientX+d.right>=a-Ri&&(t=Li(e.clientX-a)),e.clientY-d.top<=l+Ri?i=-Li(l-e.clientY):e.clientY+d.bottom>=r-Ri&&(i=Li(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 s=e.ranges[i],l=null;if(s.empty){let a=Fi(this.atoms,s.from,0);a!=s.from&&(l=U.cursor(a,-1))}else{let a=Fi(this.atoms,s.from,-1),r=Fi(this.atoms,s.to,1);(a!=s.from||r!=s.to)&&(l=U.range(s.from==s.anchor?a:r,s.from==s.head?a:r))}l&&(t||(t=e.ranges.slice()),t[i]=l)}return t?U.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 Qc(o,e){let t=o.state.facet(Wl);return t.length?t[0](e):q.mac?e.metaKey:e.ctrlKey}function Gc(o,e){let t=o.state.facet(Hl);return t.length?t[0](e):q.mac?!e.altKey:!e.ctrlKey}function Yc(o,e){let{main:t}=o.state.selection;if(t.empty)return!1;let i=Gt(o.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let l=0;l<s.length;l++){let a=s[l];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Xc(o,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=o.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),wo=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function Jc(o){let e=o.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{o.focus(),t.remove(),yo(o,t.value)},50)}function ji(o,e,t){for(let i of o.facet(e))t=i(t,o);return t}function yo(o,e){e=ji(o.state,Qn,e);let{state:t}=o,i,s=1,l=t.toText(e),a=l.lines==t.selection.ranges.length;if(ns!=null&&t.selection.ranges.every(d=>d.empty)&&ns==l.toString()){let d=-1;i=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==d)return{range:c};d=h.from;let f=t.toText((a?l.line(s++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:f},range:U.cursor(c.from+f.length)}})}else a?i=t.changeByRange(d=>{let c=l.line(s++);return{changes:{from:d.from,to:d.to,insert:c.text},range:U.cursor(d.from+c.length)}}):i=t.replaceSelection(l);o.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Te.scroll=o=>{o.inputState.lastScrollTop=o.scrollDOM.scrollTop,o.inputState.lastScrollLeft=o.scrollDOM.scrollLeft},Ie.keydown=(o,e)=>(o.inputState.setSelectionOrigin("select"),e.keyCode==27&&o.inputState.tabFocusMode!=0&&(o.inputState.tabFocusMode=Date.now()+2e3),!1),Te.touchstart=(o,e)=>{o.inputState.lastTouchTime=Date.now(),o.inputState.setSelectionOrigin("select.pointer")},Te.touchmove=o=>{o.inputState.setSelectionOrigin("select.pointer")},Ie.mousedown=(o,e)=>{if(o.observer.flush(),o.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of o.state.facet(Kl))if(t=i(o,e),t)break;if(!t&&e.button==0&&(t=th(o,e)),t){let i=!o.hasFocus;o.inputState.startMouseSelection(new Kc(o,e,t,i)),i&&o.observer.ignore(()=>{yl(o.contentDOM);let l=o.root.activeElement;l&&!l.contains(o.contentDOM)&&l.blur()});let s=o.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}return!1};function xo(o,e,t,i){if(i==1)return U.cursor(e,t);if(i==2)return Bc(o.state,e,t);{let s=de.find(o.docView,e),l=o.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:l.from,r=s?s.posAtEnd:l.to;return r<o.state.doc.length&&r==l.to&&r++,U.range(a,r)}}let vo=(o,e,t)=>e>=t.top&&e<=t.bottom&&o>=t.left&&o<=t.right;function Zc(o,e,t,i){let s=de.find(o.docView,e);if(!s)return 1;let l=e-s.posAtStart;if(l==0)return 1;if(l==s.length)return-1;let a=s.coordsAt(l,-1);if(a&&vo(t,i,a))return-1;let r=s.coordsAt(l,1);return r&&vo(t,i,r)?1:a&&a.bottom>=i?-1:1}function Co(o,e){let t=o.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Zc(o,t,e.clientX,e.clientY)}}const eh=q.ie&&q.ie_version<=11;let So=null,No=0,Bo=0;function Oo(o){if(!eh)return o.detail;let e=So,t=Bo;return So=o,Bo=Date.now(),No=!e||t>Date.now()-400&&Math.abs(e.clientX-o.clientX)<2&&Math.abs(e.clientY-o.clientY)<2?(No+1)%3:1}function th(o,e){let t=Co(o,e),i=Oo(e),s=o.state.selection;return{update(l){l.docChanged&&(t.pos=l.changes.mapPos(t.pos),s=s.map(l.changes))},get(l,a,r){let d=Co(o,l),c,h=xo(o,d.pos,d.bias,i);if(t.pos!=d.pos&&!a){let f=xo(o,t.pos,t.bias,i),u=Math.min(f.from,h.from),p=Math.max(f.to,h.to);h=u<h.from?U.range(u,p):U.range(p,u)}return a?s.replaceRange(s.main.extend(h.from,h.to)):r&&i==1&&s.ranges.length>1&&(c=ih(s,d.pos))?c:r?s.addRange(h):U.create([h])}}}function ih(o,e){for(let t=0;t<o.ranges.length;t++){let{from:i,to:s}=o.ranges[t];if(i<=e&&s>=e)return U.create(o.ranges.slice(0,t).concat(o.ranges.slice(t+1)),o.mainIndex==t?0:o.mainIndex-(o.mainIndex>t?1:0))}return null}Ie.dragstart=(o,e)=>{let{selection:{main:t}}=o.state;if(e.target.draggable){let s=o.docView.nearest(e.target);if(s&&s.isWidget){let l=s.posAtStart,a=l+s.length;(l>=t.to||a<=t.from)&&(t=U.range(l,a))}}let{inputState:i}=o;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",ji(o.state,Gn,o.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Ie.dragend=o=>(o.inputState.draggedContent=null,!1);function Vo(o,e,t,i){if(t=ji(o.state,Qn,t),!t)return;let s=o.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:l}=o.inputState,a=i&&l&&Gc(o,e)?{from:l.from,to:l.to}:null,r={from:s,insert:t},d=o.state.changes(a?[a,r]:r);o.focus(),o.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),o.inputState.draggedContent=null}Ie.drop=(o,e)=>{if(!e.dataTransfer)return!1;if(o.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,l=()=>{++s==t.length&&Vo(o,e,i.filter(a=>a!=null).join(o.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let r=new FileReader;r.onerror=l,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[a]=r.result),l()},r.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Vo(o,e,i,!0),!0}return!1},Ie.paste=(o,e)=>{if(o.state.readOnly)return!0;o.observer.flush();let t=wo?null:e.clipboardData;return t?(yo(o,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Jc(o),!1)};function nh(o,e){let t=o.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(),o.focus()},50)}function sh(o){let e=[],t=[],i=!1;for(let s of o.selection.ranges)s.empty||(e.push(o.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:l}of o.selection.ranges){let a=o.doc.lineAt(l);a.number>s&&(e.push(a.text),t.push({from:a.from,to:Math.min(o.doc.length,a.to+1)})),s=a.number}i=!0}return{text:ji(o,Gn,e.join(o.lineBreak)),ranges:t,linewise:i}}let ns=null;Ie.copy=Ie.cut=(o,e)=>{let{text:t,ranges:i,linewise:s}=sh(o.state);if(!t&&!s)return!1;ns=s?t:null,e.type=="cut"&&!o.state.readOnly&&o.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let l=wo?null:e.clipboardData;return l?(l.clearData(),l.setData("text/plain",t),!0):(nh(o,t),!1)};const _o=Ct.define();function Ao(o,e){let t=[];for(let i of o.facet(Yl)){let s=i(o,e);s&&t.push(s)}return t?o.update({effects:t,annotations:_o.of(!0)}):null}function To(o){setTimeout(()=>{let e=o.hasFocus;if(e!=o.inputState.notifiedFocused){let t=Ao(o.state,e);t?o.dispatch(t):o.update([])}},10)}Te.focus=o=>{o.inputState.lastFocusTime=Date.now(),!o.scrollDOM.scrollTop&&(o.inputState.lastScrollTop||o.inputState.lastScrollLeft)&&(o.scrollDOM.scrollTop=o.inputState.lastScrollTop,o.scrollDOM.scrollLeft=o.inputState.lastScrollLeft),To(o)},Te.blur=o=>{o.observer.clearSelectionRange(),To(o)},Te.compositionstart=Te.compositionupdate=o=>{o.observer.editContext||(o.inputState.compositionFirstChange==null&&(o.inputState.compositionFirstChange=!0),o.inputState.composing<0&&(o.inputState.composing=0))},Te.compositionend=o=>{o.observer.editContext||(o.inputState.composing=-1,o.inputState.compositionEndedAt=Date.now(),o.inputState.compositionPendingKey=!0,o.inputState.compositionPendingChange=o.observer.pendingRecords().length>0,o.inputState.compositionFirstChange=null,q.chrome&&q.android?o.observer.flushSoon():o.inputState.compositionPendingChange?Promise.resolve().then(()=>o.observer.flush()):setTimeout(()=>{o.inputState.composing<0&&o.docView.hasComposition&&o.update([])},50))},Te.contextmenu=o=>{o.inputState.lastContextMenu=Date.now()},Ie.beforeinput=(o,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&o.observer.editContext){let l=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(l&&a.length){let r=a[0],d=o.posAtDOM(r.startContainer,r.startOffset),c=o.posAtDOM(r.endContainer,r.endOffset);return is(o,{from:d,to:c,insert:o.state.toText(l)},null),!0}}let s;if(q.chrome&&q.android&&(s=bo.find(l=>l.inputType==e.inputType))&&(o.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let l=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>l+10&&o.hasFocus&&(o.contentDOM.blur(),o.focus())},100)}return q.ios&&e.inputType=="deleteContentForward"&&o.observer.flushSoon(),q.safari&&e.inputType=="insertText"&&o.inputState.composing>=0&&setTimeout(()=>Te.compositionend(o,e),20),!1};const Mo=new Set;function lh(o){Mo.has(o)||(Mo.add(o),o.addEventListener("copy",()=>{}),o.addEventListener("cut",()=>{}))}const Eo=["pre-wrap","normal","pre-line","break-spaces"];let Et=!1;function Io(){Et=!1}class oh{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 Eo.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let s=e[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(t=!0,this.heightSamples[Math.floor(s*10)]=!0)}return t}refresh(e,t,i,s,l,a){let r=Eo.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=s,this.lineLength=l,d){this.heightSamples={};for(let c=0;c<a.length;c++){let h=a[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return d}}class ah{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,s,l){this.from=e,this.length=t,this.top=i,this.height=s,this._content=l}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 lt?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(o){return o[o.ByPos=0]="ByPos",o[o.ByHeight=1]="ByHeight",o[o.ByPosNoHeight=2]="ByPosNoHeight",o}(oe||(oe={}));const zi=.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)>zi&&(Et=!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,s){let l=this,a=i.doc;for(let r=s.length-1;r>=0;r--){let{fromA:d,toA:c,fromB:h,toB:f}=s[r],u=l.lineAt(d,oe.ByPosNoHeight,i.setDoc(t),0,0),p=u.to>=c?u:l.lineAt(c,oe.ByPosNoHeight,i,0,0);for(f+=p.to-c,c=p.to;r>0&&u.from<=s[r-1].toA;)d=s[r-1].fromA,h=s[r-1].fromB,r--,d<u.from&&(u=l.lineAt(d,oe.ByPosNoHeight,i,0,0));h+=u.from-d,d=u.from;let b=ss.build(i.setDoc(a),e,h,f);l=qi(l,l.replace(d,c,b))}return l.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,s=0,l=0;for(;;)if(t==i)if(s>l*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,s-=r.size}else if(l>s*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,l-=r.size}else break;else if(s<l){let r=e[t++];r&&(s+=r.size)}else{let r=e[--i];r&&(l+=r.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new rh(ve.of(e.slice(0,t)),a,ve.of(e.slice(i)))}}function qi(o,e){return o==e?o:(o.constructor!=e.constructor&&(Et=!0),e)}ve.prototype.size=1;class Do extends ve{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,s){return new qe(s,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,s,l){return this.blockAt(0,i,s,l)}forEachLine(e,t,i,s,l,a){e<=l+this.length&&t>=l&&a(this.blockAt(0,i,s,l))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oe extends Do{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new qe(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Oe||s instanceof ge&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ge?s=new Oe(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ve.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.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,s=e.doc.lineAt(t+this.length).number,l=s-i+1,a,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*l);a=d/l,this.length>l+1&&(r=(this.height-d)/(this.length-l-1))}else a=this.height/l;return{firstLine:i,lastLine:s,perLine:a,perChar:r}}blockAt(e,t,i,s){let{firstLine:l,lastLine:a,perLine:r,perChar:d}=this.heightMetrics(t,s);if(t.lineWrapping){let c=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),h=t.doc.lineAt(c),f=r+h.length*d,u=Math.max(i,e-f/2);return new qe(h.from,h.length,u,f,0)}else{let c=Math.max(0,Math.min(a-l,Math.floor((e-i)/r))),{from:h,length:f}=t.doc.line(l+c);return new qe(h,f,i+r*c,r,0)}}lineAt(e,t,i,s,l){if(t==oe.ByHeight)return this.blockAt(e,i,s,l);if(t==oe.ByPosNoHeight){let{from:p,to:b}=i.doc.lineAt(e);return new qe(p,b-p,0,0,0)}let{firstLine:a,perLine:r,perChar:d}=this.heightMetrics(i,l),c=i.doc.lineAt(e),h=r+c.length*d,f=c.number-a,u=s+r*f+d*(c.from-l-f);return new qe(c.from,c.length,Math.max(s,Math.min(u,s+this.height-h)),h,0)}forEachLine(e,t,i,s,l,a){e=Math.max(e,l),t=Math.min(t,l+this.length);let{firstLine:r,perLine:d,perChar:c}=this.heightMetrics(i,l);for(let h=e,f=s;h<=t;){let u=i.doc.lineAt(h);if(h==e){let b=u.number-r;f+=d*b+c*(e-l-b)}let p=d+c*u.length;a(new qe(u.from,u.length,f,p,0)),f+=p,h=u.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let l=i[i.length-1];l instanceof ge?i[i.length-1]=new ge(l.length+s):i.push(null,new ge(s-1))}if(e>0){let l=i[0];l instanceof ge?i[0]=new ge(e+l.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,s){let l=t+this.length;if(s&&s.from<=t+this.length&&s.more){let a=[],r=Math.max(t,s.from),d=-1;for(s.from>t&&a.push(new ge(s.from-t-1).updateHeight(e,t));r<=l&&s.more;){let h=e.doc.lineAt(r).length;a.length&&a.push(null);let f=s.heights[s.index++];d==-1?d=f:Math.abs(f-d)>=zi&&(d=-2);let u=new Oe(h,f);u.outdated=!1,a.push(u),r+=h+1}r<=l&&a.push(null,new ge(l-r).updateHeight(e,r));let c=ve.of(a);return(d<0||Math.abs(c.height-this.height)>=zi||Math.abs(d-this.heightMetrics(e,t).perLine)>=zi)&&(Et=!0),qi(this,c)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class rh 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,s){let l=i+this.left.height;return e<l?this.left.blockAt(e,t,i,s):this.right.blockAt(e,t,l,s+this.left.length+this.break)}lineAt(e,t,i,s,l){let a=s+this.left.height,r=l+this.left.length+this.break,d=t==oe.ByHeight?e<a:e<r,c=d?this.left.lineAt(e,t,i,s,l):this.right.lineAt(e,t,i,a,r);if(this.break||(d?c.to<r:c.from>r))return c;let h=t==oe.ByPosNoHeight?oe.ByPosNoHeight:oe.ByPos;return d?c.join(this.right.lineAt(r,h,i,a,r)):this.left.lineAt(r,h,i,s,l).join(c)}forEachLine(e,t,i,s,l,a){let r=s+this.left.height,d=l+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,s,l,a),t>=d&&this.right.forEachLine(e,t,i,r,d,a);else{let c=this.lineAt(d,oe.ByPos,i,s,l);e<c.from&&this.left.forEachLine(e,c.from-1,i,s,l,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(c.to+1,t,i,r,d,a)}}replace(e,t,i){let s=this.left.length+this.break;if(t<s)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-s,t-s,i));let l=[];e>0&&this.decomposeLeft(e,l);let a=l.length;for(let r of i)l.push(r);if(e>0&&Po(l,a-1),t<this.length){let r=l.length;this.decomposeRight(t,l),Po(l,r)}return ve.of(l)}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,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<s&&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=qi(this.left,e),this.right=qi(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,s){let{left:l,right:a}=this,r=t+l.length+this.break,d=null;return s&&s.from<=t+l.length&&s.more?d=l=l.updateHeight(e,t,i,s):l.updateHeight(e,t,i),s&&s.from<=r+a.length&&s.more?d=a=a.updateHeight(e,r,i,s):a.updateHeight(e,r,i),d?this.balanced(l,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Po(o,e){let t,i;o[e]==null&&(t=o[e-1])instanceof ge&&(i=o[e+1])instanceof ge&&o.splice(e-1,3,new ge(t.length+1+i.length))}const dh=5;class ss{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),s=this.nodes[this.nodes.length-1];s instanceof Oe?s.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 s=i.widget?i.widget.estimatedHeight:0,l=i.widget?i.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new Do(a,s,i)):(a||l||s>=dh)&&this.addLineDeco(s,l,a)}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 s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.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 s of this.nodes)s instanceof Oe&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(e,t,i,s){let l=new ss(i,e);return le.spans(t,i,s,l,0),l.finish(i)}}function ch(o,e,t){let i=new hh;return le.compare(o,e,t,i,0),i.changes}class hh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,s){(e<t||i&&i.heightRelevant||s&&s.heightRelevant)&&jn(e,t,this.changes,5)}}function fh(o,e){let t=o.getBoundingClientRect(),i=o.ownerDocument,s=i.defaultView||window,l=Math.max(0,t.left),a=Math.min(s.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(s.innerHeight,t.bottom);for(let c=o.parentNode;c&&c!=i.body;)if(c.nodeType==1){let h=c,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let u=h.getBoundingClientRect();l=Math.max(l,u.left),a=Math.min(a,u.right),r=Math.max(r,u.top),d=Math.min(c==o.parentNode?s.innerHeight:d,u.bottom)}c=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:l-t.left,right:Math.max(l,a)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function uh(o,e){let t=o.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ls{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 s=e[i],l=t[i];if(s.from!=l.from||s.to!=l.to||s.size!=l.size)return!1}return!0}draw(e,t){return ye.replace({widget:new ph(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class ph extends Ln{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 $o{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=Fo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Xn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new oh(t),this.stateDeco=e.facet(ii).filter(i=>typeof i!="function"),this.heightMap=ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle.setDoc(e.doc),[new Ae(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=ye.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 s=i?t.head:t.anchor;if(!e.some(({from:l,to:a})=>s>=l&&s<=a)){let{from:l,to:a}=this.lineBlockAt(s);e.push(new Ui(l,a))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Fo:new os(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(li(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(ii).filter(h=>typeof h!="function");let s=e.changedRanges,l=Ae.extendWithRanges(s,ch(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),a=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Io(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),l),(this.heightMap.height!=a||Et)&&(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=l.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 c=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(c||!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(kc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,l=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let a=this.heightOracle.mustRefreshForWrapping(l),r=t.getBoundingClientRect(),d=a||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let c=0,h=0;if(r.width&&r.height){let{scaleX:g,scaleY:m}=wl(t,r);(g>.005&&Math.abs(this.scaleX-g)>.005||m>.005&&Math.abs(this.scaleY-m)>.005)&&(this.scaleX=g,this.scaleY=m,c|=8,a=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,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Cl(e.scrollDOM);let b=(this.printing?uh:fh)(t,this.paddingTop),k=b.top-this.pixelViewport.top,v=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let C=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(C!=this.inView&&(this.inView=C,C&&(d=!0)),!this.inView&&!this.scrollTarget)return 0;let y=r.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),d){let g=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(g)&&(a=!0),a||s.lineWrapping&&Math.abs(y-this.contentDOMWidth)>s.charWidth){let{lineHeight:m,charWidth:S,textHeight:_}=e.docView.measureTextSize();a=m>0&&s.refresh(l,m,S,_,y/S,g),a&&(e.docView.minWidth=0,c|=8)}k>0&&v>0?h=Math.max(k,v):k<0&&v<0&&(h=Math.min(k,v)),Io();for(let m of this.viewports){let S=m.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(m);this.heightMap=(a?ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle,[new Ae(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new ah(m.from,S))}Et&&(c|=2)}let V=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return V&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||V)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}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)),s=this.heightMap,l=this.heightOracle,{visibleTop:a,visibleBottom:r}=this,d=new Ui(s.lineAt(a-i*1e3,oe.ByHeight,l,0,0).from,s.lineAt(r+(1-i)*1e3,oe.ByHeight,l,0,0).to);if(t){let{head:c}=t.range;if(c<d.from||c>d.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(c,oe.ByPos,l,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<d.from?u=f.top:u=f.bottom-h,d=new Ui(s.lineAt(u-1e3/2,oe.ByHeight,l,0,0).from,s.lineAt(u+h+1e3/2,oe.ByHeight,l,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),s=t.mapPos(e.to,1);return new Ui(this.heightMap.lineAt(i,oe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,oe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),{bottom:l}=this.heightMap.lineAt(t,oe.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:r}=this;return(e==0||s<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||l>=r+Math.max(10,Math.min(i,250)))&&s>a-2*1e3&&l<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let s of e)t.touchesRange(s.from,s.to)||i.push(new ls(t.mapPos(s.from),t.mapPos(s.to),s.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,l=s>>1,a=s<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(h,f,u,p)=>{if(f-h<l)return;let b=this.state.selection.main,k=[b.from];b.empty||k.push(b.to);for(let C of k)if(C>h&&C<f){d(h,C-10,u,p),d(C+10,f,u,p);return}let v=gh(e,C=>C.from>=u.from&&C.to<=u.to&&Math.abs(C.from-h)<l&&Math.abs(C.to-f)<l&&!k.some(y=>C.from<y&&C.to>y));if(!v){if(f<u.to&&t&&i&&t.visibleRanges.some(C=>C.from<=f&&C.to>=f)){let C=t.moveToLineBoundary(U.cursor(f),!1,!0).head;C>h&&(f=C)}v=new ls(h,f,this.gapSize(u,h,f,p))}r.push(v)},c=h=>{if(h.length<a||h.type!=Le.Text)return;let f=mh(h.from,h.to,this.stateDeco);if(f.total<a)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,p,b;if(i){let k=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,C;if(u!=null){let y=Hi(f,u),V=((this.visibleBottom-this.visibleTop)/2+k)/h.height;v=y-V,C=y+V}else v=(this.visibleTop-h.top-k)/h.height,C=(this.visibleBottom-h.top+k)/h.height;p=Wi(f,v),b=Wi(f,C)}else{let k=f.total*this.heightOracle.charWidth,v=s*this.heightOracle.charWidth,C,y;if(u!=null){let V=Hi(f,u),g=((this.pixelViewport.right-this.pixelViewport.left)/2+v)/k;C=V-g,y=V+g}else C=(this.pixelViewport.left-v)/k,y=(this.pixelViewport.right+v)/k;p=Wi(f,C),b=Wi(f,y)}p>h.from&&d(h.from,p,h,f),b<h.to&&d(b,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return r}gapSize(e,t,i,s){let l=Hi(s,i)-Hi(s,t);return this.heightOracle.lineWrapping?e.height*l:s.total*this.heightOracle.charWidth*l}updateLineGaps(e){ls.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ye.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=[];le.spans(e,this.viewport.from,this.viewport.to,{span(s,l){t.push({from:s,to:l})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,l)=>s.from!=t[l].from||s.to!=t[l].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)||li(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)||li(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 li(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 Ui{constructor(e,t){this.from=e,this.to=t}}function mh(o,e,t){let i=[],s=o,l=0;return le.spans(t,o,e,{span(){},point(a,r){a>s&&(i.push({from:s,to:a}),l+=a-s),s=r}},20),s<e&&(i.push({from:s,to:e}),l+=e-s),{total:l,ranges:i}}function Wi({total:o,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(o*t);for(let s=0;;s++){let{from:l,to:a}=e[s],r=a-l;if(i<=r)return l+i;i-=r}}function Hi(o,e){let t=0;for(let{from:i,to:s}of o.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/o.total}function gh(o,e){for(let t of o)if(e(t))return t}const Fo={toDOM(o){return o},fromDOM(o){return o},scale:1,eq(o){return o==this}};class os{constructor(e,t,i){let s=0,l=0,a=0;this.viewports=i.map(({from:r,to:d})=>{let c=t.lineAt(r,oe.ByPos,e,0,0).top,h=t.lineAt(d,oe.ByPos,e,0,0).bottom;return s+=h-c,{from:r,to:d,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let r of this.viewports)r.domTop=a+(r.top-l)*this.scale,a=r.domBottom=r.domTop+(r.bottom-r.top),l=r.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let l=t<this.viewports.length?this.viewports[t]:null;if(!l||e<l.top)return s+(e-i)*this.scale;if(e<=l.bottom)return l.domTop+(e-l.top);i=l.bottom,s=l.domBottom}}fromDOM(e){for(let t=0,i=0,s=0;;t++){let l=t<this.viewports.length?this.viewports[t]:null;if(!l||e<l.domTop)return i+(e-s)/this.scale;if(e<=l.domBottom)return l.top+(e-l.domTop);i=l.bottom,s=l.domBottom}}eq(e){return e instanceof os?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 li(o,e){if(e.scale==1)return o;let t=e.toDOM(o.top),i=e.toDOM(o.bottom);return new qe(o.from,o.length,t,i-t,Array.isArray(o._content)?o._content.map(s=>li(s,e)):o._content)}const Ki=K.define({combine:o=>o.join(" ")}),as=K.define({combine:o=>o.indexOf(!0)>-1}),rs=st.newName(),Ro=st.newName(),Lo=st.newName(),jo={"&light":"."+Ro,"&dark":"."+Lo};function ds(o,e,t){return new st(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return o;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):o+" "+i}})}const kh=ds("."+rs,{"&":{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"}},jo),bh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cs=q.ie&&q.ie_version<=11;class wh{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ec,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);(q.ie&&q.ie_version<=11||q.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&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new xh(e),e.state.facet(at)&&(e.contentDOM.editContext=this.editContext.editContext)),cs&&(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,s=this.selectionRange;if(i.state.facet(at)?i.root.activeElement!=this.dom:!Ai(i.dom,s))return;let l=s.anchorNode&&i.docView.nearest(s.anchorNode);if(l&&l.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Xt(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Gt(e.root);if(!t)return!1;let i=q.safari&&e.root.nodeType==11&&Yd(this.dom.ownerDocument)==this.dom&&yh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=Ai(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&ic(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(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,bh),cs&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),cs&&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 s=()=>{let l=this.delayedAndroidKey;l&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=l.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&l.force&&Vt(this.dom,l.key,l.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!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,s=!1;for(let l of e){let a=this.readMutation(l);a&&(a.typeOver&&(s=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&Ai(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let l=new $c(this.view,e,t,i);return this.view.docView.domChanged={newSel:l.newSel?l.newSel.main:null},l}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,s=go(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}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=zo(t,e.previousSibling||e.target.previousSibling,-1),s=zo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):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 s of this.scrollTargets)s.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 zo(o,e,t){for(;e;){let i=ne.get(e);if(i&&i.parent==o)return i;let s=e.parentNode;e=s!=o.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function qo(o,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,l=e.endOffset,a=o.docView.domAtPos(o.state.selection.main.anchor);return Xt(a.node,a.offset,s,l)&&([t,i,s,l]=[s,l,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:l}}function yh(o,e){if(e.getComposedRanges){let s=e.getComposedRanges(o.root)[0];if(s)return qo(o,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return o.contentDOM.addEventListener("beforeinput",i,!0),o.dom.ownerDocument.execCommand("indent"),o.contentDOM.removeEventListener("beforeinput",i,!0),t?qo(o,t):null}class xh{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:s}=e.state.selection.main,l={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:X.of(i.text.split(`
10
+ `))};l.from==this.from&&s<this.from?l.from=s:l.to==this.to&&s>this.to&&(l.to=s),!(l.from==l.to&&!l.insert.length)&&(this.pendingContextChange=l,e.state.readOnly||is(e,l,U.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let s=[],l=null;for(let a=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);a<r;a++){let d=e.coordsForChar(a);l=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||l||new DOMRect,s.push(l)}t.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let l of i.getTextFormats()){let a=l.underlineStyle,r=l.underlineThickness;if(a!="None"&&r!="None"){let d=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;s.push(ye.mark({attributes:{style:d}}).range(this.toEditorPos(l.rangeStart),this.toEditorPos(l.rangeEnd)))}}e.dispatch({effects:Zl.of(ye.set(s))})},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 s=Gt(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((l,a,r,d,c)=>{if(i)return;let h=c.length-(a-l);if(s&&a>=s.to)if(s.from==l&&s.to==a&&s.insert.eq(c)){s=this.pendingContextChange=null,t+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(l+=t,a+=t,a<=this.from)this.from+=h,this.to+=h;else if(l<this.to){if(l<this.from||a>this.to||this.to-this.from+c.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(l),this.toContextPos(a),c.toString()),this.to+=h}t+=h}),s&&!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))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}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 J{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&&(s=>s.forEach(l=>i(l,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||tc(e.parent)||document,this.viewState=new $o(e.state||ee.create(e)),e.scrollTo&&e.scrollTo.is(Pi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ti).map(s=>new Yn(s));for(let s of this.plugins)s.update(this);this.observer=new wh(this),this.inputState=new zc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new oo(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,s,l=this.state;for(let u of e){if(u.startState!=l)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");l=u.state}if(this.destroyed){this.viewState.state=l;return}let a=this.hasFocus,r=0,d=null;e.some(u=>u.annotation(_o))?(this.inputState.notifiedFocused=a,r=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,d=Ao(l,a),d||(r=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(l.doc)||!this.state.selection.eq(l.selection))&&(h=null)):this.observer.clear(),l.facet(ee.phrases)!=this.state.facet(ee.phrases))return this.setState(l);s=$i.create(this,l,e),s.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 Tt(p.empty?p:U.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of u.effects)p.is(Pi)&&(f=p.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Qi.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(ni)!=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(s.startState.facet(Ki)!=s.state.facet(Ki)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(Kn))try{u(s)}catch(p){ze(this.state,p,"update listener")}(d||h)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),h&&!go(this,h)&&c.force&&Vt(this.contentDOM,c.key,c.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 $o(e),this.plugins=e.facet(ti).map(i=>new Yn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new oo(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(ti),i=e.state.facet(ti);if(t!=i){let s=[];for(let l of i){let a=t.indexOf(l);if(a<0)s.push(new Yn(l));else{let r=this.plugins[a];r.mustUpdate=e,s.push(r)}}for(let l of this.plugins)l.mustUpdate!=e&&l.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].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,s=i.scrollTop*this.scaleY,{scrollAnchorPos:l,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(a<0)if(Cl(i))l=-1,a=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);l=p.from,a=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 c=[];d&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(p=>{try{return p.read(this)}catch(b){return ze(this.state,b),Uo}}),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<c.length;p++)if(h[p]!=Uo)try{let b=c[p];b.write&&b.write(h[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,a=-1;continue}else{let b=(l<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(l).top)-a;if(b>1||b<-1){s=s+b,i.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Kn))r(t)}get themeClasses(){return rs+" "+(this.state.facet(as)?Lo:Ro)+" "+this.state.facet(Ki)}updateAttrs(){let e=Wo(this,eo,{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:`${q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Wo(this,Xn,t);let i=this.observer.ignore(()=>{let s=Rn(this.contentDOM,this.contentAttrs,t),l=Rn(this.dom,this.editorAttrs,e);return s||l});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(J.announce)){t&&(this.announceDOM.textContent=""),t=!1;let l=this.announceDOM.appendChild(document.createElement("div"));l.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(ni);let e=this.state.facet(J.cspNonce);st.mount(this.root,this.styleModules.concat(kh).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 ts(this,e,po(this,e,t,i))}moveByGroup(e,t){return ts(this,e,po(this,e,t,i=>Ec(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),l=i[t?i.length-1:0];return U.cursor(l.side(t,s)+e.from,l.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return Mc(this,e,t,i)}moveVertically(e,t,i){return ts(this,e,Ic(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(),fo(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 s=this.state.doc.lineAt(e),l=this.bidiSpans(s),a=l[ot.find(l,e-s.from,-1,t)];return Mi(i,a.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(Xl)||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 ql(e.length);let t=this.textDirectionAt(e.from),i;for(let l of this.bidiCache)if(l.from==e.from&&l.dir==t&&(l.fresh||zl(l.isolates,i=no(this,e))))return l.order;i||(i=no(this,e));let s=pc(e.text,t,i);return this.bidiCache.push(new Qi(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{yl(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 Pi.of(new Tt(typeof e=="number"?U.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 Pi.of(new Tt(U.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 Mt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Mt.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=st.newName(),s=[Ki.of(i),ni.of(ds(`.${i}`,e))];return t&&t.dark&&s.push(as.of(!0)),s}static baseTheme(e){return Pd.lowest(ni.of(ds("."+rs,e,jo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&ne.get(i)||ne.get(e);return((t=s?.rootView)===null||t===void 0?void 0:t.view)||null}}J.styleModule=ni,J.inputHandler=Gl,J.clipboardInputFilter=Qn,J.clipboardOutputFilter=Gn,J.scrollHandler=Jl,J.focusChangeEffect=Yl,J.perLineTextDirection=Xl,J.exceptionSink=Ql,J.updateListener=Kn,J.editable=at,J.mouseSelectionStyle=Kl,J.dragMovesSelection=Hl,J.clickAddsSelectionRange=Wl,J.decorations=ii,J.outerDecorations=to,J.atomicRanges=Jn,J.bidiIsolatedRanges=io,J.scrollMargins=so,J.darkTheme=as,J.cspNonce=K.define({combine:o=>o.length?o[0]:""}),J.contentAttributes=Xn,J.editorAttributes=eo,J.lineWrapping=J.contentAttributes.of({class:"cm-lineWrapping"}),J.announce=ce.define();const vh=4096,Uo={};class Qi{constructor(e,t,i,s,l,a){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=l,this.order=a}static update(e,t){if(t.empty&&!e.some(l=>l.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:me.LTR;for(let l=Math.max(0,e.length-10);l<e.length;l++){let a=e[l];a.dir==s&&!t.touchesRange(a.from,a.to)&&i.push(new Qi(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function Wo(o,e,t){for(let i=o.state.facet(e),s=i.length-1;s>=0;s--){let l=i[s],a=typeof l=="function"?l(o):l;a&&Fn(a,t)}return t}const Ch=!q.ios,Ho={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Ch&&(Ho[".cm-line"].caretColor=Ho[".cm-content"].caretColor="transparent !important");class It extends Nt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}It.prototype.elementClass="",It.prototype.toDOM=void 0,It.prototype.mapMode=Be.TrackBefore,It.prototype.startSide=It.prototype.endSide=-1,It.prototype.point=!0;var hs;const Dt=new Y;function Sh(o){return K.define({combine:o?e=>e.concat(o):void 0})}const Nh=new Y;class De{constructor(e,t,i=[],s=""){this.data=e,this.name=s,ee.prototype.hasOwnProperty("tree")||Object.defineProperty(ee.prototype,"tree",{get(){return fs(this)}}),this.parser=t,this.extension=[$t.of(this),ee.languageData.of((l,a,r)=>{let d=Ko(l,a,r),c=d.type.prop(Dt);if(!c)return[];let h=l.facet(c),f=d.type.prop(Nh);if(f){let u=d.resolve(a-d.from,r);for(let p of f)if(p.test(u,l)){let b=l.facet(p.facet);return p.type=="replace"?b:b.concat(h)}}return h})].concat(i)}isActiveAt(e,t,i=-1){return Ko(e,t,i).type.prop(Dt)==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=[],s=(l,a)=>{if(l.prop(Dt)==this.data){i.push({from:a,to:a+l.length});return}let r=l.prop(Y.mounted);if(r){if(r.tree.prop(Dt)==this.data){if(r.overlay)for(let d of r.overlay)i.push({from:d.from+a,to:d.to+a});else i.push({from:a,to:a+l.length});return}else if(r.overlay){let d=i.length;if(s(r.tree,r.overlay[0].from+a),i.length>d)return}}for(let d=0;d<l.children.length;d++){let c=l.children[d];c instanceof re&&s(c,l.positions[d]+a)}};return s(fs(e),0),i}get allowsNesting(){return!0}}De.setState=ce.define();function Ko(o,e,t){let i=o.facet($t),s=fs(o).topNode;if(!i||i.allowsNesting)for(let l=s;l;l=l.enter(e,t,fe.ExcludeBuffers))l.type.isTop&&(s=l);return s}class Gi extends De{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Sh(e.languageData);return new Gi(t,e.parser.configure({props:[Dt.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Gi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function fs(o){let e=o.field(De.state,!1);return e?e.tree:re.empty}class Bh{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 oi=null;class Yi{constructor(e,t,i=[],s,l,a,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=l,this.viewport=a,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Yi(e,t,[],re.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Bh(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=re.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}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 s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(ht.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=s,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=oi;oi=this;try{return e()}finally{oi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Qo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:l,viewport:a,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((c,h,f,u)=>d.push({fromA:c,toA:h,fromB:f,toB:u})),i=ht.applyChanges(i,d),s=re.empty,l=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){r=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);h<f&&r.push({from:h,to:f})}}}return new Yi(this.parser,t,i,s,l,a,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:s,to:l}=this.skipped[i];s<e.to&&l>e.from&&(this.fragments=Qo(this.fragments,s,l),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 Ms{createParse(t,i,s){let l=s[0].from,a=s[s.length-1].to;return{parsedPos:l,advance(){let d=oi;if(d){for(let c of s)d.tempSkipped.push(c);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=a,new re(Ce.none,[],[],a-l)},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 oi}}function Qo(o,e,t){return ht.applyChanges(o,[{fromA:e,toA:t,fromB:e,toB:t}])}class Pt{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 Pt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Yi.create(e.facet($t).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Pt(i)}}De.state=pt.define({create:Pt.init,update(o,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet($t)!=e.state.facet($t)?Pt.init(e.state):o.apply(e)}});let Go=o=>{let e=setTimeout(()=>o(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Go=o=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(o,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const us=typeof navigator<"u"&&(!((hs=navigator.scheduling)===null||hs===void 0)&&hs.isInputPending)?()=>navigator.scheduling.isInputPending():null,Oh=Mt.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=Go(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:s}}=this.view,l=i.field(De.state);if(l.tree==l.context.tree&&l.context.isDone(s+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!us?Math.max(25,e.timeRemaining()-5):1e9),r=l.context.treeLen<s&&i.doc.length>s+1e3,d=l.context.work(()=>us&&us()||Date.now()>a,s+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(l.context.takeTree(),this.view.dispatch({effects:De.setState.of(new Pt(l.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(l.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=K.define({combine(o){return o.length?o[0]:null},enables:o=>[De.state,Oh,J.contentAttributes.compute([o],e=>{let t=e.facet(o);return t&&t.name?{"data-language":t.name}:{}})]});class Vh{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const _h=new Y;function Yo({except:o,units:e=1}={}){return t=>{let i=o&&o.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Ah=new Y;function Th(o){let e=o.firstChild,t=o.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?o.to:t.from}:null}class ps{constructor(e,t){this.specs=e;let i;function s(r){let d=st.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const l=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,a=t.scope;this.scope=a instanceof De?r=>r.prop(Dt)==a.data:a?r=>r==a:void 0,this.style=Ls(e.map(r=>({tag:r.tag,class:r.class||s(Object.assign({},r,{tag:null}))})),{all:l}).style,this.module=i?new st(i):null,this.themeType=t.themeType}static define(e,t){return new ps(e,t||{})}}$.meta,$.link,$.heading,$.emphasis,$.strong,$.strikethrough,$.keyword,$.atom,$.bool,$.url,$.contentSeparator,$.labelName,$.literal,$.inserted,$.string,$.deleted,$.regexp,$.escape,$.string,$.variableName,$.variableName,$.typeName,$.namespace,$.className,$.variableName,$.macroName,$.propertyName,$.comment,$.invalid;const Mh=Object.create(null),Xo=[Ce.none],Jo=[],Zo=Object.create(null),Eh=Object.create(null);for(let[o,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"]])Eh[o]=Ih(Mh,e);function ms(o,e){Jo.indexOf(o)>-1||(Jo.push(o),console.warn(e))}function Ih(o,e){let t=[];for(let r of e.split(" ")){let d=[];for(let c of r.split(".")){let h=o[c]||$[c];h?typeof h=="function"?d.length?d=d.map(h):ms(c,`Modifier ${c} used at start of tag`):d.length?ms(c,`Tag ${c} used as modifier`):d=Array.isArray(h)?h:[h]:ms(c,`Unknown highlighting tag ${c}`)}for(let c of d)t.push(c)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(r=>r.id),l=Zo[s];if(l)return l.id;let a=Zo[s]=Ce.define({id:Xo.length,name:i,props:[Rs({[i]:t})]});return Xo.push(a),a.id}me.RTL,me.LTR;const Dh=Gi.define({name:"json",parser:Ad.configure({props:[_h.add({Object:Yo({except:/^\s*\}/}),Array:Yo({except:/^\s*\]/})}),Ah.add({"Object Array":Th})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Ph(){return new Vh(Dh)}const gs=[{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 $h(){const o=Me();if(o.formRules?.length){const e={};gs.forEach(i=>{e[i.name]=i});const t=[...gs];return o.formRules.forEach(i=>{const s=e[i.name];s?Object.assign(s,i):t.push(s)}),t}return gs}const Fh={loadAdvances:$h},Rh={class:"unione-props-setting data-field-setting"},Lh={key:0},jh=["onClick"],zh={class:"field-txt"},qh=["onClick"],Uh={key:1,class:"field-txt"},Wh=["onClick"],Hh={key:0,class:"field-txt"},Kh={key:3,class:"edit-field"},Qh=["onClick"],Gh=Z(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([Ph()]),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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(o,"modelValue"),s={mounted:g=>g.focus()},l=n.ref({});function a(){const g=Object.keys(l.value);if(g.length)for(let m in g){const S=i.value.filter(_=>_.name==m);if(S&&S[0]){let _=l.value[m];Object.keys(_).forEach(x=>{x=="convertName"?(S[0].convert||(S[0].convert={}),S[0].convert.type=_[x]):S[0][x]=_[x]})}}l.value={}}function r(g,m){a();const S={};m=="convertName"?(g.convert||(g.convert={}),S[m]=g.convert?.type):S[m]=g[m]||"",l.value[g.name]=S}function d(g,m){{l.value={};return}}function c(g,m){switch(m){case"query":return g.configs?.query?.enable;case"form":return g.configs?.show?.form?.enable;case"view":return g.configs?.show?.view?.enable;case"list":return g.configs?.show?.list?.enable;case"sort":return g.configs?.sort?.enable}}function h(g,m){switch(m){case"query":g.configs=W.utils.obj.ext(g.configs,{query:{enable:!1}}),g.configs.query.enable=!g.configs.query.enable;break;case"form":g.configs=W.utils.obj.ext(g.configs,{show:{form:{enable:!1}}}),g.configs.show.form.enable=!g.configs.show.form.enable;break;case"view":g.configs=W.utils.obj.ext(g.configs,{show:{view:{enable:!1}}}),g.configs.show.view.enable=!g.configs.show.view.enable;break;case"list":g.configs=W.utils.obj.ext(g.configs,{show:{list:{enable:!1}}}),g.configs.show.list.enable=!g.configs.show.list.enable;break;case"sort":g.configs=W.utils.obj.ext(g.configs,{sort:{enable:!1}}),g.configs.sort.enable=!g.configs.sort.enable;break}console.log("record.configs",g.configs)}const f=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(g,m){switch(f.value.prop=m,f.value.field=g,g.configs||(g.configs={}),g.configs.show||(g.configs.show={}),m){case"query":g.configs.query||(g.configs.query={}),g.configs.query.types||(g.configs.query.types="EQ"),f.value.show=g.configs.query,f.value.title=`查询设置/${g.title}(${g.name})`;break;case"form":g.configs.show.form||(g.configs.show.form={}),f.value.show=g.configs.show.form,f.value.title=`表单设置/${g.title}(${g.name})`;break;case"view":g.configs.show.view||(g.configs.show.view={}),f.value.show=g.configs.show.view,f.value.title=`详情设置/${g.title}(${g.name})`;break;case"list":g.configs.show.list||(g.configs.show.list={}),f.value.show=g.configs.show.list,f.value.title=`列头设置/${g.title}(${g.name})`;break;case"sort":g.configs.sort||(g.configs.sort={}),f.value.show=g.configs.sort,f.value.title=`排序设置/${g.title}(${g.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:g=>{const m=p.value.options.filter(S=>S.value==g);return m[0]?m[0].label:g}}),b=n.ref({visible:!1,field:{},props:{},advances:Fh.loadAdvances(),showInfo:g=>{let m=0;if(g.configs?.rule){const S=g.configs.rule;S.advance&&m++,typeof S.rangeMin<"u"&&m++,typeof S.rangeMax<"u"&&m++,typeof S.regExpress<"u"&&m++}if(m>0)return"("+m+")"},toSetting:()=>{const g=b.value.props;b.value.field.configs=W.utils.obj.ext(b.value.field.configs,{rule:{...g}}),b.value.visible=!1,b.value.props={}}});function k(g){b.value.visible=!0,b.value.field=g,b.value.props=g.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:g=>{const m=g.configs?.widget?.name,S=v.value.widgets.filter(_=>_.value==m);return S[0]?S[0].label:m},toSetting:(g,m)=>{g.configs||(g.configs={}),g.configs.widget||(g.configs.widget={}),g.configs.widget.name=m},toclose:()=>{v.value.visible=!1}});function C(g){v.value.field=g,g.configs=W.utils.obj.ext(g.configs,{widget:{props:{}}}),v.value.widget=g.configs.widget,v.value.visible=!0}const y=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:(g,m="--")=>y.value.types.filter(S=>S.value==g)[0]?.label||m,toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(g,m)=>{y.value.convert.options.splice(g,1)},toSetting:()=>{y.value.visible=!1}});function V(g){y.value.visible=!0,y.value.field=g,g.configs||(g.configs={}),g.configs.convert||(g.configs.convert={}),y.value.convert=g.configs.convert}return(g,m)=>{const S=n.resolveComponent("ToolOutlined"),_=n.resolveComponent("a-button"),x=n.resolveComponent("a-select"),w=n.resolveComponent("a-checkbox"),B=n.resolveComponent("a-table"),A=n.resolveComponent("a-switch"),O=n.resolveComponent("a-form-item"),D=n.resolveComponent("a-select-option"),M=n.resolveComponent("a-input-number"),E=n.resolveComponent("a-form"),z=n.resolveComponent("a-modal"),P=n.resolveComponent("a-input"),I=n.resolveComponent("unione-select-box"),H=n.resolveComponent("a-checkbox-group"),L=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",Rh,[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:N})=>[["widget","queryType","rules","convertName"].includes(N.key)?(n.openBlock(),n.createElementBlock("span",Lh,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:N,text:Q,record:T})=>[["rules"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!b.value.showInfo(T)&&"empty"]),onClick:j=>k(T)},[n.createElementVNode("span",zh,n.toDisplayString(b.value.showInfo(T)),1),b.value.showInfo(T)?(n.openBlock(),n.createBlock(_,{key:0,type:"link"},{default:n.withCtx(()=>m[50]||(m[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,jh)):["widget"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[T.name]||!Object.keys(l.value[T.name]).includes(N.dataIndex))&&!Q&&"empty"]),onClick:j=>r(T,N.dataIndex)},[l.value[T.name]&&Object.keys(l.value[T.name]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:T.configs?.widget?.name,allowClear:!0,options:v.value.widgets,onChange:j=>v.value.toSetting(T,j),onBlur:m[0]||(m[0]=j=>d())},null,8,["value","options","onChange"])),[[s]]):(n.openBlock(),n.createElementBlock("span",Uh,n.toDisplayString(v.value.widgetName(T)),1)),n.createVNode(_,{type:"link",onClick:n.withModifiers(j=>C(T),["stop"])},{default:n.withCtx(()=>m[51]||(m[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,qh)):["convertName"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[T.name]||!Object.keys(l.value[T.name]).includes(N.dataIndex))&&!T.convert?.type&&"empty"]),onClick:j=>V(T)},[T.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Hh,n.toDisplayString(y.value.getTypes(T.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Wh)):["query","form","view","list","sort"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",Kh,[n.createVNode(w,{checked:c(T,N.dataIndex),onClick:j=>h(T,N.dataIndex)},null,8,["checked","onClick"]),n.createVNode(_,{type:"link",onClick:j=>u(T,N.dataIndex)},{default:n.withCtx(()=>m[52]||(m[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(z,{visible:f.value.visible,"onUpdate:visible":m[14]||(m[14]=N=>f.value.visible=N),width:600,title:f.value.title,onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(E,{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(O,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.enable,"onUpdate:checked":m[1]||(m[1]=N=>f.value.show.enable=N),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(n.openBlock(),n.createBlock(O,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.defoult,"onUpdate:checked":m[2]||(m[2]=N=>f.value.show.defoult=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="sort"?(n.openBlock(),n.createBlock(O,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.asc,"onUpdate:checked":m[3]||(m[3]=N=>f.value.show.asc=N),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(O,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(O,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.defoult,"onUpdate:checked":m[4]||(m[4]=N=>f.value.show.defoult=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(O,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.visible,"onUpdate:checked":m[5]||(m[5]=N=>f.value.show.visible=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(O,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(x,{value:f.value.show.types,"onUpdate:value":m[6]||(m[6]=N=>f.value.show.types=N)},{default:n.withCtx(()=>[n.createVNode(D,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>m[53]||(m[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(D,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>m[54]||(m[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(D,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>m[55]||(m[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(D,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>m[56]||(m[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(D,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>m[57]||(m[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(D,{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(O,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(M,{value:f.value.show.index,"onUpdate:value":m[7]||(m[7]=N=>f.value.show.index=N)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,max:24,value:f.value.show.width,"onUpdate:value":m[8]||(m[8]=N=>f.value.show.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,value:f.value.show.width,"onUpdate:value":m[9]||(m[9]=N=>f.value.show.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":m[10]||(m[10]=N=>f.value.show.labelWidth=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(M,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":m[11]||(m[11]=N=>f.value.show.valueWidth=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(x,{value:f.value.show.fixed,"onUpdate:value":m[12]||(m[12]=N=>f.value.show.fixed=N),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(O,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(x,{value:f.value.show.align,"onUpdate:value":m[13]||(m[13]=N=>f.value.show.align=N),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(z,{visible:y.value.visible,"onUpdate:visible":m[33]||(m[33]=N=>y.value.visible=N),width:600,title:y.value.getTypes(y.value.convert.types,"转换")+"设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[n.createVNode(E,{model:y.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(O,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(x,{value:y.value.convert.types,"onUpdate:value":m[15]||(m[15]=N=>y.value.convert.types=N),allowClear:!0,options:y.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(y.value.field.widget?.name)?(n.openBlock(),n.createBlock(O,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.convert.search,"onUpdate:checked":m[16]||(m[16]=N=>f.value.convert.search=N),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="option"?(n.openBlock(),n.createBlock(O,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(_,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:n.withCtx(()=>m[59]||(m[59]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(B,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:N,record:Q,index:T})=>[N.dataIndex==="label"?(n.openBlock(),n.createBlock(P,{key:0,value:Q.label,"onUpdate:value":j=>Q.label=j,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),N.dataIndex==="value"?(n.openBlock(),n.createBlock(P,{key:1,value:Q.value,"onUpdate:value":j=>Q.value=j,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),N.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:j=>y.value.toDelOption(T,Q)},"删除",8,Qh)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(y.value.convert.types)?(n.openBlock(),n.createBlock(O,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(I,{value:y.value.convert.dsId,"onUpdate:value":m[17]||(m[17]=N=>y.value.convert.dsId=N),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.tableName,"onUpdate:value":m[18]||(m[18]=N=>y.value.convert.tableName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.tableName,"onUpdate:value":m[19]||(m[19]=N=>y.value.convert.tableName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"&&["unione-tree-box"].includes(y.value.field.widget?.name)?(n.openBlock(),n.createBlock(O,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.idField,"onUpdate:value":m[20]||(m[20]=N=>y.value.convert.idField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"&&["unione-tree-box"].includes(y.value.field.widget?.name)?(n.openBlock(),n.createBlock(O,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.pidField,"onUpdate:value":m[21]||(m[21]=N=>y.value.convert.pidField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.valueField,"onUpdate:value":m[22]||(m[22]=N=>y.value.convert.valueField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.labelField,"onUpdate:value":m[23]||(m[23]=N=>y.value.convert.labelField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.tableField,"onUpdate:value":m[24]||(m[24]=N=>y.value.convert.tableField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.tableWhere,"onUpdate:value":m[25]||(m[25]=N=>y.value.convert.tableWhere=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.tableOrder,"onUpdate:value":m[26]||(m[26]=N=>y.value.convert.tableOrder=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.tableOrder,"onUpdate:value":m[27]||(m[27]=N=>y.value.convert.tableOrder=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(A,{checked:y.value.convert.isAsync,"onUpdate:checked":m[28]||(m[28]=N=>y.value.convert.isAsync=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(O,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(A,{checked:y.value.convert.isPaging,"onUpdate:checked":m[29]||(m[29]=N=>y.value.convert.isPaging=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),y.value.convert.types=="dict"?(n.openBlock(),n.createBlock(O,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.dictName,"onUpdate:value":m[30]||(m[30]=N=>y.value.convert.dictName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(y.value.convert.types)?(n.openBlock(),n.createBlock(O,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode(P,{value:y.value.convert.url,"onUpdate:value":m[31]||(m[31]=N=>y.value.convert.url=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(y.value.convert.types)?(n.openBlock(),n.createBlock(O,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Ft.Codemirror),{modelValue:y.value.convert.params,"onUpdate:modelValue":m[32]||(m[32]=N=>y.value.convert.params=N),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(z,{visible:v.value.visible,"onUpdate:visible":m[40]||(m[40]=N=>v.value.visible=N),width:600,title:"控件设置",onOk:v.value.toclose},{default:n.withCtx(()=>[n.createVNode(E,{model:v.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(O,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(x,{value:v.value.widget.name,"onUpdate:value":m[34]||(m[34]=N=>v.value.widget.name=N),allowClear:!0,options:v.value.widgets},null,8,["value","options"]),[[s]])]),_:1}),n.createVNode(O,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode(P,{value:v.value.widget.placeholder,"onUpdate:value":m[35]||(m[35]=N=>v.value.widget.placeholder=N)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode(P,{value:v.value.widget.help,"onUpdate:value":m[36]||(m[36]=N=>v.value.widget.help=N)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode(P,{value:v.value.widget.tooltip,"onUpdate:value":m[37]||(m[37]=N=>v.value.widget.tooltip=N)},null,8,["value"])]),_:1}),["a-date-picker"].includes(v.value.widget.name)?(n.openBlock(),n.createBlock(O,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode(P,{value:v.value.field.dataFormat,"onUpdate:value":m[38]||(m[38]=N=>v.value.field.dataFormat=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(O,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(x,{value:v.value.widget.props.mode,"onUpdate:value":m[39]||(m[39]=N=>v.value.widget.props.mode=N),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(D,{value:"multiple"},{default:n.withCtx(()=>m[60]||(m[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(D,{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(z,{visible:b.value.visible,"onUpdate:visible":m[49]||(m[49]=N=>b.value.visible=N),width:600,title:"规则设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(E,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(L,{title:"基本设置",type:"line"},{default:n.withCtx(()=>[n.createVNode(O,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(H,{value:b.value.props.trigger,"onUpdate:value":m[41]||(m[41]=N=>b.value.props.trigger=N),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(O,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(w,{checked:b.value.props.whitespace,"onUpdate:checked":m[42]||(m[42]=N=>b.value.props.whitespace=N)},{default:n.withCtx(()=>m[62]||(m[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(O,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(x,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":m[43]||(m[43]=N=>b.value.props.advance=N)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(n.openBlock(),n.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(O,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(M,{value:b.value.props.rangeMin,"onUpdate:value":m[44]||(m[44]=N=>b.value.props.rangeMin=N)},null,8,["value"]),m[63]||(m[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(M,{value:b.value.props.rangeMax,"onUpdate:value":m[45]||(m[45]=N=>b.value.props.rangeMax=N)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(P,{value:b.value.props.rangeMessage,"onUpdate:value":m[46]||(m[46]=N=>b.value.props.rangeMessage=N)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(L,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(O,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(P,{value:b.value.props.regExpress,"onUpdate:value":m[47]||(m[47]=N=>b.value.props.regExpress=N)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(P,{value:b.value.props.regMessage,"onUpdate:value":m[48]||(m[48]=N=>b.value.props.regMessage=N)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),Yh={class:"unione-props-setting data-field-fkey"},Xh={key:0},Jh=["onClick"],Zh=["onClick"],ef=["onClick"],tf=["onClick"],nf=["onClick"],sf=["onClick"],lf=["onClick"],of=["onClick"],af=Z(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=W.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(o,"modelValue"),s=n.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),l=n.ref({});function a(){l.value={}}function r(u,p){a();const b={};b[p]=u.configs.fkey[p]||"",l.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 c(u,p,b,k){u.configs.fkey[p]=b,p=="fieldName"&&(u.configs.fkey.fieldTitle=k.title),p=="labelName"&&(u.configs.fkey.labelTitle=k.title)}function h(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=W.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,p)=>{const b=n.resolveComponent("FormOutlined"),k=n.resolveComponent("unione-select-box"),v=n.resolveComponent("a-button"),C=n.resolveComponent("a-table"),y=n.resolveComponent("a-input-number"),V=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",Yh,[n.createVNode(C,{columns:t.value,"data-source":s.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:n.withCtx(({column:g})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(g.key)?(n.openBlock(),n.createElementBlock("span",Xh,[n.createVNode(b),n.createTextVNode(" "+n.toDisplayString(g.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:g,record:m})=>[["dsnName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.dsnName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:a,onSelect:(S,_)=>d(m,S,_)},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,Jh)):["dsnTitle"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.dsnTitle&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:a,onSelect:(S,_)=>d(m,S,_)},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,Zh)):n.createCommentVNode("",!0),["fieldName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.fieldName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(m,"fieldName",S,_)},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,ef)):["labelName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[m.name]||!Object.keys(l.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.labelName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[l.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(l.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:l.value[m.name][g.dataIndex],"onUpdate:value":S=>l.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(m,"labelName",S,_)},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(S=>h(m),["stop"])},{default:n.withCtx(()=>p[4]||(p[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,tf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(V,{visible:f.value.visible,"onUpdate:visible":p[3]||(p[3]=g=>f.value.visible=g),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(C,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:n.withCtx(({column:g,record:m,index:S,text:_})=>[g.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",f.value.editField!="title"&&!_&&"empty"]),onClick:x=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="title"?(n.openBlock(),n.createBlock(k,{key:0,value:m[m.dataIndex],"onUpdate:value":x=>m[m.dataIndex]=x,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]=x=>f.value.editField={}),onSelect:(x,w)=>f.value.onShowFieldChange(m,x,w)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,nf)):n.createCommentVNode("",!0),g.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",f.value.editField!="width"&&!_&&"empty"]),onClick:x=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="width"?(n.openBlock(),n.createBlock(y,{key:0,onBlur:p[1]||(p[1]=x=>f.value.editField={}),value:m.width,"onUpdate:value":x=>m.width=x,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,sf)):n.createCommentVNode("",!0),g.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!_&&"empty"]),onClick:x=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="index"?(n.openBlock(),n.createBlock(y,{key:0,onBlur:p[2]||(p[2]=x=>f.value.editField={}),value:m.index,"onUpdate:value":x=>m.index=x,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,lf)):n.createCommentVNode("",!0),g.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:x=>f.value.toDelField(S)},"删除",8,of)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),rf={class:"unione-props-setting data-filter"},df={class:"title"},cf={class:"name"},hf={class:"action"},ff=Z(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=W.useDialog(),t=n.useModel(o,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function s(c){r.value.visible=!0,r.value.filter={...c},r.value.name=c.name}function l(c){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(c,1)}})}const a=n.ref(),r=n.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{a.value.validate().then(c=>{if(r.value.name){const h=t.value.filter(f=>f.name==r.value.name)[0];if(!h){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(c).forEach(f=>{h[f]=c[f]})}else{if(t.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(c)}r.value.visible=!1})}});function d(){const c=[];r.value.filter.filter||(r.value.filter.filter=""),c.push("-- @if(isNotEmpty(params."),c.push(r.value.filter.name||"xxx"),c.push(") && !isBlank(params."),c.push(r.value.filter.name||"xxx"),c.push(`)
11
11
  `),c.push(" AND XXX=#{params."),c.push(r.value.filter.name||"xxx"),c.push(`}
12
12
  `),c.push(`-- @}
13
- `),r.value.filter.filter=r.value.filter.filter+c.join("")}return(c,h)=>{const f=n.resolveComponent("a-button"),u=n.resolveComponent("a-card"),p=n.resolveComponent("PlusOutlined"),b=n.resolveComponent("a-empty"),k=n.resolveComponent("a-input"),v=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-textarea"),x=n.resolveComponent("a-tag"),V=n.resolveComponent("a-form"),g=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",rf,[(t.value.length,n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,(m,S)=>(n.openBlock(),n.createBlock(u,{class:"filter-box",size:"small",key:S},{default:n.withCtx(()=>[n.createElementVNode("div",df,"过滤标题:"+n.toDisplayString(m.title),1),n.createElementVNode("div",cf,"过滤名称:"+n.toDisplayString(m.name),1),n.createElementVNode("div",hf,[n.createVNode(f,{size:"small",onClick:_=>s(m)},{default:n.withCtx(()=>h[4]||(h[4]=[n.createTextVNode("编辑")])),_:2},1032,["onClick"]),n.createVNode(f,{danger:"",size:"small",onClick:_=>l(S)},{default:n.withCtx(()=>h[5]||(h[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(p,{class:"btn"})]),_:1})],64)),n.createVNode(g,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=m=>r.value.visible=m),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:n.withCtx(()=>[n.createVNode(V,{ref_key:"filterForm",ref:a,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(k,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=m=>r.value.filter.title=m)},null,8,["value"])]),_:1}),n.createVNode(v,{label:"过滤名称",name:"name"},{default:n.withCtx(()=>[n.createVNode(k,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=m=>r.value.filter.name=m)},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(C,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=m=>r.value.filter.filter=m),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),n.createVNode(x,{class:"btn-tmpl",color:"blue",onClick:d},{default:n.withCtx(()=>h[6]||(h[6]=[n.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),uf={class:"unione-page form-page data-define-edit"},pf={class:"actions"},mf=Y(n.defineComponent({__name:"edit",setup(o){const e=W.useDialog(),t=n.inject("route"),i=n.inject("router"),s=n.ref(),l=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}}),a=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:[]}}),c=n.ref(!1);function h(){i.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([d.value.id]).then(k=>{k.success?(e.success({title:"发布成功",content:k.body}),b(d.value.id)):e.error({title:"发布失败",content:k.body})})}})}async function u(){const k=await s.value.validate(),v={...d.value,...k};v.configs.show=await a.value.getValue(),console.log("formData",v),G.message.loading({content:"提交中..."}),c.value=!0,ct.save(v).then(C=>{G.message.destroy(),C.success?(d.value=C.body,s.value.setValue(C.body),a.value.setValue(C.body.configs?.show||{}),G.message.success("保存成功!")):G.message.error(C.message)}).finally(()=>{c.value=!1})}const p=n.ref(!1);n.onMounted(()=>{t.query.id&&b(t.query.id)});function b(k){G.message.loading({content:"加载中..."}),ct.detail(k).then(v=>{v.success?(d.value=v.body,s.value.setValue(v.body),a.value.setValue(v.body.configs?.show||{}),G.message.destroy()):G.message.error(v.message)})}return(k,v)=>{const C=n.resolveComponent("unione-form"),x=n.resolveComponent("unione-section"),V=n.resolveComponent("OrderedListOutlined"),g=n.resolveComponent("a-tab-pane"),m=n.resolveComponent("ToolOutlined"),S=n.resolveComponent("ApiOutlined"),_=n.resolveComponent("FunnelPlotOutlined"),y=n.resolveComponent("a-tabs"),w=n.resolveComponent("a-button");return n.openBlock(),n.createElementBlock("div",uf,[n.createVNode(x,{title:"基础信息",type:"line"},{default:n.withCtx(()=>[n.createVNode(C,{form:l.value,ref_key:"formBaseObj",ref:s},null,8,["form"])]),_:1}),n.createVNode(x,{class:"page-setting-section",title:"页面配置",type:p.value&&"line",location:p.value?"left":"right",reactive:"",modelValue:p.value,"onUpdate:modelValue":v[0]||(v[0]=N=>p.value=N)},{default:n.withCtx(()=>[n.createVNode(C,{form:r.value,ref_key:"pageSettingObj",ref:a},null,8,["form"])]),_:1},8,["type","location","modelValue"]),n.createVNode(y,null,{default:n.withCtx(()=>[n.createVNode(g,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(V),v[5]||(v[5]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(ad,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[1]||(v[1]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(m),v[6]||(v[6]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Gh,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[2]||(v[2]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-fkeys"},{tab:n.withCtx(()=>[n.createVNode(S),v[7]||(v[7]=n.createTextVNode("外键设置 "))]),default:n.withCtx(()=>[n.createVNode(af,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[3]||(v[3]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"data-filter"},{tab:n.withCtx(()=>[n.createVNode(_),v[8]||(v[8]=n.createTextVNode("数据过滤 "))]),default:n.withCtx(()=>[n.createVNode(ff,{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",pf,[n.createVNode(w,{type:"primary",onClick:u,loading:c.value},{default:n.withCtx(()=>v[9]||(v[9]=[n.createTextVNode("保存")])),_:1},8,["loading"]),d.value.id?(n.openBlock(),n.createBlock(w,{key:0,danger:"",onClick:f,loading:c.value},{default:n.withCtx(()=>v[10]||(v[10]=[n.createTextVNode("发布")])),_:1},8,["loading"])):n.createCommentVNode("",!0),n.createVNode(w,{onClick:h},{default:n.withCtx(()=>v[11]||(v[11]=[n.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),gf={UnioneEditor:Rt,locales:Zi,loadConfig:Me,install(o,e){const t=Me(e);t.axios&&W.axios.create(t.axios),o.component("UnioneBtn",ka),o.component("UnioneTabs",wa),o.component("UnioneSection",Na),o.component("UnioneQuery",ys),o.component("UnioneTable",xs),o.component("UnioneFormItem",za),o.component("UnioneForm",Ra),o.component("UnioneSelectBox",Ua),o.component("UnioneSwitchBox",Wa),o.component("UnioneRadioBox",Ha),o.component("UnioneCheckBox",Ka),o.component("UnionePageEditor",vs),o.component("UnionePageForm",Cs),o.component("UnionePageList",Ss)}};ie.UnioneDataDefineEdit=mf,ie.UnioneDataDefineList=Zr,ie.UnioneEditor=Rt,ie.UnionePage=ri,ie.UnionePageEditor=vs,ie.UnionePageForm=Cs,ie.UnionePageList=Ss,ie.UnionePageSetting=di,ie.UnioneQueryForm=ys,ie.UnioneTableList=xs,ie.default=gf,ie.loadConfig=Me,ie.locales=Zi,ie.utils=ur,Object.defineProperties(ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
13
+ `),r.value.filter.filter=r.value.filter.filter+c.join("")}return(c,h)=>{const f=n.resolveComponent("a-button"),u=n.resolveComponent("a-card"),p=n.resolveComponent("PlusOutlined"),b=n.resolveComponent("a-empty"),k=n.resolveComponent("a-input"),v=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-textarea"),y=n.resolveComponent("a-tag"),V=n.resolveComponent("a-form"),g=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",rf,[(t.value.length,n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,(m,S)=>(n.openBlock(),n.createBlock(u,{class:"filter-box",size:"small",key:S},{default:n.withCtx(()=>[n.createElementVNode("div",df,"过滤标题:"+n.toDisplayString(m.title),1),n.createElementVNode("div",cf,"过滤名称:"+n.toDisplayString(m.name),1),n.createElementVNode("div",hf,[n.createVNode(f,{size:"small",onClick:_=>s(m)},{default:n.withCtx(()=>h[4]||(h[4]=[n.createTextVNode("编辑")])),_:2},1032,["onClick"]),n.createVNode(f,{danger:"",size:"small",onClick:_=>l(S)},{default:n.withCtx(()=>h[5]||(h[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(p,{class:"btn"})]),_:1})],64)),n.createVNode(g,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=m=>r.value.visible=m),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:n.withCtx(()=>[n.createVNode(V,{ref_key:"filterForm",ref:a,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(k,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=m=>r.value.filter.title=m)},null,8,["value"])]),_:1}),n.createVNode(v,{label:"过滤名称",name:"name"},{default:n.withCtx(()=>[n.createVNode(k,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=m=>r.value.filter.name=m)},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(C,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=m=>r.value.filter.filter=m),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),n.createVNode(y,{class:"btn-tmpl",color:"blue",onClick:d},{default:n.withCtx(()=>h[6]||(h[6]=[n.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),uf={class:"unione-page form-page data-define-edit"},pf={class:"actions"},mf=Z(n.defineComponent({__name:"edit",setup(o){const e=W.useDialog(),t=n.inject("route"),i=n.inject("router"),s=n.ref(),l=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}}),a=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:[]}}),c=n.ref(!1);function h(){i.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([d.value.id]).then(k=>{k.success?(e.success({title:"发布成功",content:k.body}),b(d.value.id)):e.error({title:"发布失败",content:k.body})})}})}async function u(){const k=await s.value.validate(),v={...d.value,...k};v.configs.show=await a.value.getValue(),console.log("formData",v),G.message.loading({content:"提交中..."}),c.value=!0,ct.save(v).then(C=>{G.message.destroy(),C.success?(d.value=C.body,s.value.setValue(C.body),a.value.setValue(C.body.configs?.show||{}),G.message.success("保存成功!")):G.message.error(C.message)}).finally(()=>{c.value=!1})}const p=n.ref(!1);n.onMounted(()=>{t.query.id&&b(t.query.id)});function b(k){G.message.loading({content:"加载中..."}),ct.detail(k).then(v=>{v.success?(d.value=v.body,s.value.setValue(v.body),a.value.setValue(v.body.configs?.show||{}),G.message.destroy()):G.message.error(v.message)})}return(k,v)=>{const C=n.resolveComponent("unione-form"),y=n.resolveComponent("unione-section"),V=n.resolveComponent("OrderedListOutlined"),g=n.resolveComponent("a-tab-pane"),m=n.resolveComponent("ToolOutlined"),S=n.resolveComponent("ApiOutlined"),_=n.resolveComponent("FunnelPlotOutlined"),x=n.resolveComponent("a-tabs"),w=n.resolveComponent("a-button");return n.openBlock(),n.createElementBlock("div",uf,[n.createVNode(y,{title:"基础信息",type:"line"},{default:n.withCtx(()=>[n.createVNode(C,{form:l.value,ref_key:"formBaseObj",ref:s},null,8,["form"])]),_:1}),n.createVNode(y,{class:"page-setting-section",title:"页面配置",type:p.value&&"line",location:p.value?"left":"right",reactive:"",modelValue:p.value,"onUpdate:modelValue":v[0]||(v[0]=B=>p.value=B)},{default:n.withCtx(()=>[n.createVNode(C,{form:r.value,ref_key:"pageSettingObj",ref:a},null,8,["form"])]),_:1},8,["type","location","modelValue"]),n.createVNode(x,null,{default:n.withCtx(()=>[n.createVNode(g,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(V),v[5]||(v[5]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(ad,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[1]||(v[1]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(m),v[6]||(v[6]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Gh,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[2]||(v[2]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-fkeys"},{tab:n.withCtx(()=>[n.createVNode(S),v[7]||(v[7]=n.createTextVNode("外键设置 "))]),default:n.withCtx(()=>[n.createVNode(af,{modelValue:d.value.configs.fields,"onUpdate:modelValue":v[3]||(v[3]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"data-filter"},{tab:n.withCtx(()=>[n.createVNode(_),v[8]||(v[8]=n.createTextVNode("数据过滤 "))]),default:n.withCtx(()=>[n.createVNode(ff,{modelValue:d.value.configs.filters,"onUpdate:modelValue":v[4]||(v[4]=B=>d.value.configs.filters=B)},null,8,["modelValue"])]),_:1})]),_:1}),n.createElementVNode("div",pf,[n.createVNode(w,{type:"primary",onClick:u,loading:c.value},{default:n.withCtx(()=>v[9]||(v[9]=[n.createTextVNode("保存")])),_:1},8,["loading"]),d.value.id?(n.openBlock(),n.createBlock(w,{key:0,danger:"",onClick:f,loading:c.value},{default:n.withCtx(()=>v[10]||(v[10]=[n.createTextVNode("发布")])),_:1},8,["loading"])):n.createCommentVNode("",!0),n.createVNode(w,{onClick:h},{default:n.withCtx(()=>v[11]||(v[11]=[n.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),gf={UnioneEditor:Rt,locales:Zi,loadConfig:Me,install(o,e){const t=Me(e);t.axios&&W.axios.create(t.axios),o.component("UnioneBtn",ka),o.component("UnioneTabs",wa),o.component("UnioneSection",Na),o.component("UnioneQuery",ys),o.component("UnioneTable",xs),o.component("UnioneFormItem",za),o.component("UnioneForm",Ra),o.component("UnioneSelectBox",Ua),o.component("UnioneSwitchBox",Wa),o.component("UnioneRadioBox",Ha),o.component("UnioneCheckBox",Ka),o.component("UnionePageEditor",vs),o.component("UnionePageForm",Cs),o.component("UnionePageList",Ss)}};ie.UnioneDataDefineEdit=mf,ie.UnioneDataDefineList=Zr,ie.UnioneEditor=Rt,ie.UnionePage=ri,ie.UnionePageEditor=vs,ie.UnionePageForm=Cs,ie.UnionePageList=Ss,ie.UnionePageSetting=di,ie.UnioneQueryForm=ys,ie.UnioneTableList=xs,ie.default=gf,ie.loadConfig=Me,ie.locales=Zi,ie.utils=ur,Object.defineProperties(ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});