unione-form-vue 0.0.13 → 0.0.14

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(X,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],K):(X=typeof globalThis<"u"?globalThis:X||self,K(X.index={},X.UnioneBaseVue,X.Vue,X.antDesignVue,X.lodashEs,X.vueCodemirror,X.langJavascript,X.iconsVue,X.uuid))})(this,function(X,K,n,Y,na,Lt,la,He,sa){"use strict";const oa={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},Ji=n.ref(oa);function Ee(o){return o&&(Ji.value=K.utils.obj.ext(Ji.value,o)),Ji.value}const aa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ra={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},da=n.ref([aa,ra]);function ca(o,e){return K.locales.loadLanguage(o,()=>new Promise((t,i)=>{const l=da.value.filter(s=>s.localeName==o);if(e)if(typeof e=="function")e().then(s=>{if(l.length==0){const a={...s,localeName:o};t(a)}else{const a={...l[0],...s};t(a)}});else if(l.length==0){const s={...e,localeName:o};t(s)}else{const s={...l[0],...e};t(s)}else l.length>0?t(l[0]):i("local language not defined ,lang:"+o)}))}const Zi={...K.locales};Zi.loadLanguage=ca;class ha{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=n.ref(e),this.$pid=n.ref(""),this.$store=n.ref({}),this.$forms=n.ref({}),this.$params=n.ref({}),this.$refObj=n.ref({}),this.$refData=n.ref({}),this.$model=t}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const t in this.$store.value)this.$store.value[t].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,i){}use(e,t,i){let l=this.$store.value[e];return l||(l=new en(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,t,i){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(s=>{i&&i(s)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class en{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,i){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=t,this.$data=n.ref(t=="form"?{}:{body:[],total:0}),this.$dialog=K.useDialog(),this.$model=i||n.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}$processParams(e,t){if(t)t.forEach(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}request(e){return new Promise((t,i)=>{const l=Y.message.loading("数据请求中..."),s=this.$store.controller+e.url;K.axios.form({method:"post",...e,url:s}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+s,options:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+s,options:e,err:a})}).finally(()=>{l()})})}find(e){const t=this.$store.controller+"/find";return this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e.body=this.$processParams(e.body,this.$store.findParams),new Promise((i,l)=>{const s=Y.message.loading("数据加载中...");K.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$data.value=a,i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:a})}).finally(()=>{s()})})}save(e){const t=this.$store.controller+"/save";return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((i,l)=>{const s=Y.message.loading("数据提交中...");K.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body||{}),a.silence||Y.message.success(a.message),i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:a})}).finally(()=>{s()})})}loadByIds(e){return new Promise((t,i)=>{const l=Y.message.loading("数据加载中..."),s=this.$store.controller+"/loadByIds";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(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(()=>{l()})})}detail(e){return new Promise((t,i)=>{const l=Y.message.loading("数据加载中..."),s=this.$store.controller+"/detail";K.axios.form({url:s,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(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:s,id:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,err:a})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=Y.message.loading("数据处理中..."),s=this.$store.controller+"/delete";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,err:a})}).finally(()=>{l()})}})})}}class fa{$event;$onces;$delayEmit;constructor(){this.$event=n.ref({}),this.$onces=n.ref({}),this.$delayEmit=n.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];t(i)}}$emit(e,t){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(t)}this.$event.value[e]?this.$event.value[e](t):(this.$delayEmit.value[e]=t,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,t){this.$onces.value[e]=t}$off(e){delete this.$event.value[e]}}class xt{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=n.ref("run"),this.type=n.ref(e.types||"setting"),this.define=n.ref(e),this.ebus=new fa,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ha(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=K.useDialog(),this.loadConfig(t)}sn(){return this.define.value.sn}load(e,t){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",t),t&&t.configs&&(this.define.value=t,this.type.value=this.define.value.types||"setting",this.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}K.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):t&&t.configs&&(this.define.value=t,this.loadConfig(t.configs))})}save(){return new Promise((e,t)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),t();return}this.$axiosProccess.value.save=!0;const i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),K.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(s=>{this.$axiosProccess.value.save=!1,s.success?(Y.message.success(s.message),this.define.value=s.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(s.body)):(this.$dialog.error({content:s.message}),t())}).catch(s=>{console.error("页面配置保存失败",s),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,t){if(t){const i={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(t=>{t.wid||(t.wid="w:"+na.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ua={class:"widget-setting-dialog"},pa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=e,i=n.ref(),l=n.ref(!1);function s(){i.value&&(l.value=!0),t("setting")}function a(){t("saving"),l.value=!1}return(r,d)=>{const h=n.resolveComponent("SettingOutlined"),f=n.resolveComponent("a-tooltip"),c=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",o.model])},[n.createVNode(f,{title:o.settingTitle},{default:n.withCtx(()=>[o.model=="edit"&&(r.$slots["widget-setting"]||o.custome)?(n.openBlock(),n.createBlock(h,{key:0,class:"widget-setting",onClick:s})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),o.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(c,{key:0,title:o.settingTitle,ref_key:"settingModal",ref:i,open:l.value,"onUpdate:open":d[0]||(d[0]=u=>l.value=u),centered:"",width:"80%",onOk:a},{default:n.withCtx(()=>[n.createElementVNode("div",ua,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),te=(o,e)=>{const t=o.__vccOpts||o;for(const[i,l]of e)t[i]=l;return t},ct=te(pa,[["__scopeId","data-v-3a88c0c0"]]),ma={key:0},ga=["onClick"],ci=te(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"}]),l=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:g=>{l.value.selectedRowKeys=g}}),s={mounted:g=>g.focus()},a=n.ref({});function r(){const g=Object.keys(a.value);if(g.length)for(let p in g){const B=y.value.form.action.params[p];B&&a.value[p]&&Object.keys(a.value[p]).forEach(O=>{B[O]=a.value[p][O]})}a.value={}}function d(g,p,B){r();const O={};O[B]=p[B]||"",B=="showIndex"&&(O[B]=p.show?.query?.index),a.value[g]=O}function h(g,p,B){if(!p||!B){a.value={};return}const O=a.value[g][B];p[B]=O,a.value={}}function f(){y.value.form.action.params.push({title:"新建",name:"",value:""})}function c(){}const u=n.ref(""),m=n.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(g,p)=>u.value!=p&&t.preset.includes(p)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),k=n.ref([la.javascript()]),y=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),b=n.ref();function x(g,p,B={}){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,y.value.form=g,y.value.helps=B,y.value.visible=!0,b.value=p}const v=n.ref(null);function V(){v.value&&v.value.validate().then(()=>{y.value.visible=!1,b.value(y.value.form)})}return e({open:x,close}),(g,p)=>{const B=n.resolveComponent("a-input"),O=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-select"),w=n.resolveComponent("a-input-number"),N=n.resolveComponent("a-checkbox"),M=n.resolveComponent("a-tab-pane"),T=n.resolveComponent("a-switch"),E=n.resolveComponent("a-button"),D=n.resolveComponent("a-divider"),z=n.resolveComponent("ToolOutlined"),A=n.resolveComponent("a-tooltip"),q=n.resolveComponent("a-table"),P=n.resolveComponent("a-tabs"),Q=n.resolveComponent("a-form"),R=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock(R,{visible:y.value.visible,"onUpdate:visible":p[23]||(p[23]=S=>y.value.visible=S),title:y.value.title,centered:"",width:"50%",onOk:V},{default:n.withCtx(()=>[n.createVNode(Q,{name:"basic",ref_key:"form",ref:v,rules:m.value,model:y.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(P,null,{default:n.withCtx(()=>[n.createVNode(M,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(O,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.title,"onUpdate:value":p[0]||(p[0]=S=>y.value.form.title=S)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.name,"onUpdate:value":p[1]||(p[1]=S=>y.value.form.name=S),disabled:t.preset.includes(y.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(O,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.icon,"onUpdate:value":p[2]||(p[2]=S=>y.value.form.icon=S)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.type,"onUpdate:value":p[3]||(p[3]=S=>y.value.form.type=S),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),n.createVNode(O,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(w,{value:y.value.form.index,"onUpdate:value":p[4]||(p[4]=S=>y.value.form.index=S)},null,8,["value"])]),_:1}),n.createVNode(O,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.size,"onUpdate:value":p[5]||(p[5]=S=>y.value.form.size=S),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(O,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(N,{checked:y.value.form.props.block,"onUpdate:checked":p[6]||(p[6]=S=>y.value.form.props.block=S)},{default:n.withCtx(()=>p[24]||(p[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:y.value.form.props.danger,"onUpdate:checked":p[7]||(p[7]=S=>y.value.form.props.danger=S)},{default:n.withCtx(()=>p[25]||(p[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:y.value.form.props.ghost,"onUpdate:checked":p[8]||(p[8]=S=>y.value.form.props.ghost=S)},{default:n.withCtx(()=>p[26]||(p[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(M,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(O,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.action.type,"onUpdate:value":p[9]||(p[9]=S=>y.value.form.action.type=S),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.psn,"onUpdate:value":p[10]||(p[10]=S=>y.value.form.action.psn=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.component,"onUpdate:value":p[11]||(p[11]=S=>y.value.form.action.component=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(O,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.href,"onUpdate:value":p[12]||(p[12]=S=>y.value.form.action.href=S)},null,8,["value"])]),_:1}),["link","route"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.action.target,"onUpdate:value":p[13]||(p[13]=S=>y.value.form.action.target=S),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.action.position,"onUpdate:value":p[14]||(p[14]=S=>y.value.form.action.position=S),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.title,"onUpdate:value":p[15]||(p[15]=S=>y.value.form.action.title=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(T,{checked:y.value.form.action.maskClosable,"onUpdate:checked":p[16]||(p[16]=S=>y.value.form.action.maskClosable=S),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(w,{value:y.value.form.action.width,"onUpdate:value":p[17]||(p[17]=S=>y.value.form.action.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(O,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(w,{value:y.value.form.action.height,"onUpdate:value":p[18]||(p[18]=S=>y.value.form.action.height=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(D,{orientation:"left"},{default:n.withCtx(()=>[p[29]||(p[29]=n.createTextVNode("参数列表 ")),n.createVNode(E,{size:"small",class:"param-btn",onClick:f},{default:n.withCtx(()=>p[27]||(p[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(E,{size:"small",class:"param-btn",danger:"",onClick:c},{default:n.withCtx(()=>p[28]||(p[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode(q,{columns:i.value,"data-source":y.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["name","title"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",ma,[n.createVNode(z),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),["value"].includes(S.key)?(n.openBlock(),n.createBlock(A,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(z),n.createTextVNode(" "+n.toDisplayString(S.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:F,record:_,index:I})=>[["name","title","value"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!a.value[I]||!Object.keys(a.value[I]).includes(S.dataIndex))&&!F&&"empty"]),onClick:H=>d(I,_,S.dataIndex)},[a.value[I]&&Object.keys(a.value[I]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(B,{key:0,value:a.value[I][S.dataIndex],"onUpdate:value":H=>a.value[I][S.dataIndex]=H,onBlur:H=>h(I,_,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(F),1)],64))],10,ga)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(M,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(O,{label:"点击事件",help:y.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.clickScript,"onUpdate:modelValue":p[19]||(p[19]=S=>y.value.form.event.clickScript=S),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(O,{label:"禁用逻辑",help:y.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.disableScript,"onUpdate:modelValue":p[20]||(p[20]=S=>y.value.form.event.disableScript=S),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(O,{label:"显示逻辑",help:y.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.visibleScript,"onUpdate:modelValue":p[21]||(p[21]=S=>y.value.form.event.visibleScript=S),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(O,{label:"动态标题",help:y.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.titleScript,"onUpdate:modelValue":p[22]||(p[22]=S=>y.value.form.event.titleScript=S),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),ka=["src"],ba=["src"],ya=te(n.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(o,{emit:e}){const t=Ee(),i=o,l=K.useSession();n.watch(()=>i.widget?.event,()=>{a()}),n.onMounted(()=>{a()});const s=n.ref({});function a(){i.widget?.event&&(i.widget.event.clickScript?s.value.click=new Function("ctx","btn","event",i.widget.event.clickScript):i.widget.event.click&&(s.value.click=i.widget.event.click),i.widget.event.disableScript?s.value.disable=new Function("ctx","btn",i.widget.event.disableScript):i.widget.event.disable&&(s.value.disable=i.widget.event.disable),i.widget.event.visibleScript?s.value.visible=new Function("ctx","btn",i.widget.event.visibleScript):i.widget.event.visible&&(s.value.visible=i.widget.event.visible),i.widget.event.titleScript?s.value.title=new Function("ctx","btn",i.widget.event.titleScript):i.widget.event.title&&(s.value.title=i.widget.event.title)),typeof i.widget.click=="function"&&(s.value.click=i.widget.click),typeof i.widget.title=="function"&&(s.value.title=i.widget.title),typeof i.widget.visible=="function"&&(s.value.visible=i.widget.visible),typeof i.widget.disabled=="function"&&(s.value.disable=i.widget.disabled)}const r=n.computed(()=>s.value.title?s.value.title(u.value,i.widget):i.widget.title),d=n.computed(()=>s.value.visible?s.value.visible(u.value,i.widget)!=!1:i.widget.visible!=!1),h=n.computed(()=>i.disabled==!0?!0:s.value.disable?s.value.disable(u.value,i.widget):i.widget.disable==!0),f=n.ref(null);function c(){f.value?.open(i.widget,g=>{console.log("btn props",g),Object.keys(g).forEach(p=>{i.widget[p]=g[p]}),console.log("props btn",i.widget)})}const u=n.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),m=n.ref({open:!1}),k=n.computed(()=>{if(i.widget.action?.href){let g=i.widget.action.href;const p=g.matchAll("{[a-zA-Z.]*}"),B=[];let O=null;for(;O=p.next();){if(O&&O.value&&O.value[0]){let C=O.value[0].substring(1,O.value[0].length-1);B.includes(C)||B.push(C)}if(O.done)break}if(B.length>0)for(let C=0;C<B.length;C++){let w=B[C],N=K.utils.obj.getValue(u.value,w);N?N instanceof Object?g=g.replaceAll("{"+w+"}",JSON.stringify(N)):Array.isArray(N)?g=g.replaceAll("{"+w+"}",N.join(",")):g=g.replaceAll("{"+w+"}",N):g=g.replaceAll("{"+w+"}","")}return g}return""}),y=n.computed(()=>{const g={};let p=i.widget.action?.href||i.widget.action?.link;if(p){const B=p.matchAll("{[a-zA-Z0-9.]*}"),O=[];let C=null;for(;C=B.next();){if(C&&C.value&&C.value[0]){let N=C.value[0].substring(1,C.value[0].length-1);O.includes(N)||O.push(N)}if(C.done)break}if(O.length>0)for(let N=0;N<O.length;N++){let M=O[N],T=K.utils.obj.getValue(u.value,M);T?T instanceof Object?p=p.replaceAll("{"+M+"}",JSON.stringify(T)):Array.isArray(T)?p=p.replaceAll("{"+M+"}",T.join(",")):p=p.replaceAll("{"+M+"}",T):p=p.replaceAll("{"+M+"}","")}const w=p.split("?")[1];w&&w.split("&").forEach(N=>{const M=N.split("=");M[0]&&M[1]&&(g[M[0]]=M[1])})}return i.widget.action?.params&&i.widget.action.params.filter(B=>B.value+"").forEach(B=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(B.value)){let C=K.utils.obj.getValue(u.value,B.value);g[B.name]=C}else g[B.name]=B.value}),g}),b=e,x=n.inject("router");function v(g){if(t.isDebug&&console.log("unione btn click",i.widget,g),!(s.value.click&&s.value.click(u.value,i.widget,g)==!1)){if(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog")m.value.open=!0;else if(i.widget.action?.type=="route"&&(i.widget.action?.href||i.widget.action?.link)){if(i.widget.action.link&&i.editor?.type.value=="code")return;x.push({path:i.widget.action.href||i.widget.action?.link,query:y.value})}b("click",{btn:i.widget,event:g})}}function V(g){b("click",g)}return(g,p)=>{const B=n.resolveComponent("a-button"),O=n.resolveComponent("unione-btn"),C=n.resolveComponent("a-dropdown"),w=n.resolveComponent("a-drawer"),N=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(ct,{key:0,class:n.normalizeClass(["unione-btn",o.widget.props?.block&&"unione-btn-block"]),model:o.editor?.model.value,onSetting:c,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[!o.widget.widget||o.widget.widget=="button"?(n.openBlock(),n.createBlock(B,n.mergeProps({key:0,disabled:h.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,title:o.widget.tooltip,onClick:v},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","title"])):n.createCommentVNode("",!0),o.widget.widget=="dropdown"?(n.openBlock(),n.createBlock(C,{key:1,trigger:[o.widget.trigger||"hover"],class:n.normalizeClass([o.widget.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["dropdown-overlay",o.widget.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.widget.items,M=>(n.openBlock(),n.createBlock(O,{key:M.name,class:"item",widget:M,editor:o.editor,preset:o.preset,ctx:o.ctx,onClick:V},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(B,{size:o.widget.size||"small"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value),1)]),_:1},8,["size"])]),_:1},8,["trigger","class"])):n.createCommentVNode("",!0),o.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(w,{key:2,open:m.value.open,"onUpdate:open":p[0]||(p[0]=M=>m.value.open=M),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:k.value},null,8,ka)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),o.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(N,{key:3,open:m.value.open,"onUpdate:open":p[1]||(p[1]=M=>m.value.open=M),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:k.value,style:n.normalizeStyle({height:o.widget.action?.height?o.widget.action?.height+"px":""})},null,12,ba)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(ci,{ref_key:"btnSetting",ref:f,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-b868da76"]]),wa={key:0,class:"unione-widget-empty-tip"},xa=te(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(l,s)=>{const a=n.resolveComponent("a-tab-pane"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createBlock(ct,{class:n.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:n.withCtx(()=>[i.value?(n.openBlock(),n.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":s[0]||(s[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,h)=>(n.openBlock(),n.createBlock(a,{key:h,class:"unione-layout-tab-pane"},{tab:n.withCtx(()=>[n.createElementVNode("span",null,[d.icon?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.icon),{key:0})):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d.title),1)])]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.chidlren,(f,c)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(f.widget),{key:c,wid:f.wid,editor:e.editor,widget:f},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",wa,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),va={class:"title"},Ca={class:"text"},Sa={key:0,class:"reactive"},Na={key:1,class:"opts"},Ba={class:"warp"},Oa=te(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),l=n.computed(()=>t.value?.icon||e.icon),s=n.computed(()=>t.value?.type||e.type),a=n.useModel(o,"modelValue");function r(){e.reactive&&(a.value=!a.value)}return(d,h)=>(n.openBlock(),n.createBlock(ct,{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",va,[s.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",s.value])},null,2)):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",Ca,n.toDisplayString(i.value),1)]),o.reactive?(n.openBlock(),n.createElementBlock("div",Sa,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),o.location=="left"?(n.openBlock(),n.createElementBlock("div",Na,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Ba,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,a.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Va={class:"unione-props-setting unione-form-setting"},_a={class:"unione-form-btns"},Ma={key:0},Ta=["onClick"],Aa={class:"field-txt"},Ea=["onClick"],Ia={key:1,class:"field-txt"},Da=["onClick"],Pa={key:0,class:"field-txt"},Fa={key:3,class:"edit-field"},$a={key:0},Ra=["onClick"],La=te(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:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.settings||(C.configs.settings={}),C.configs.settings.btns||(C.configs.settings.btns=[]),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(w=>({value:w.sn,label:w.title+"("+w.name+")"}))),s=n.computed(()=>{const C=i.value.configs.settings.btns,w=C.map(N=>N.name);if(!w.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(N.index,0,N)}if(!w.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let M=N.index||1;C.splice(M,0,N)}if(!w.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(N.index,0,N)}if(!w.includes("back")){const N={title:"返回",type:"default",index:3,visible:!0,name:"back"};C.splice(N.index,0,N)}return C}),a=n.ref(null);function r(C){a.value&&a.value.open(C,w=>{w.visible=!0,Object.keys(w).forEach(N=>{C[N]=w[N]}),i.value.configs.settings.btns.sort((N,M)=>{const T=N.index||1,E=M.index||1;return T-E}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const C=i.value.configs.settings.btns.length+1;let w={title:"新增",name:"new_"+C,index:C,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(M=>M.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,M=>{Object.keys(M).forEach(T=>{w[T]=M[T]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(C){const w=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const N=[];i.value.configs.settings.btns.forEach(M=>{M.name!=C.name&&N.push(M)}),i.value.configs.settings.btns=N}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{w()}})}const f=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 w=f.value.widgets.filter(N=>N.value==C);return w[0]?w[0].label:C},toSetting:()=>{}}),c=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let w="";return C.rules&&(w=C.rules.filter(N=>N.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const C=c.value.props,w={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(w.min=C.rangeMin,w.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(w.max=C.rangeMax,w.enable=!0);const N={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(N.pattern=C.regExpress,N.enable=!0),c.value.field.rules=[w,N],c.value.visible=!1,c.value.props={},console.log("rule",c.value.field.rules)}});function u(C){c.value.visible=!0,c.value.field=C;const w=C.rules||[],N={trigger:"change",whitespace:!0};w.forEach(M=>{M.name=="reg"&&(N.trigger=M.trigger,N.whitespace=M.whitespace,N.regExpress=M.pattern,N.regMessage=M.message),M.name=="range"&&(N.rangeMin=M.min,N.rangeMax=M.max,N.rangeMessage=M.message)}),c.value.props=N}const m=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function k(C,w){const N=v.value.filter(T=>T.name==C.name);N.forEach(T=>{w!="isSort"?T[w]=!0:T[w]=!T[w]});const M=N[0];if(!(!M||w=="isSort")){switch(m.value.prop=w,m.value.field=C,M.show||(M.show={}),w){case"isQuery":M.show.query||(M.show.query={}),m.value.show=M.show.query,m.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":M.show.form||(M.show.form={}),m.value.show=M.show.form,m.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":M.show.view||(M.show.view={}),m.value.show=M.show.view,m.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":M.show.list||(M.show.list={}),m.value.show=M.show.list,m.value.title=`列头设置/${C.title}(${C.name})`;break}m.value.visible=!0}}const y=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(C,w)=>{y.value.convert.options.splice(C,1)},toSetting:()=>{y.value.visible=!1}});function b(C){y.value.visible=!0,y.value.field=C,y.value.convert=C.convert||{}}const x=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),v=n.computed(()=>x.value.fields?.length?x.value.fields:[]),V={mounted:C=>C.focus()},g=n.ref({});function p(C,w){const N={};w=="convertName"?N[w]=C.convert?.type:N[w]=C[w]||"",g.value={},g.value[C.name]=N}function B(C,w){{g.value={};return}}function O(C,w){v.value.filter(M=>M.name==C.name).forEach(M=>{M[w]=!M[w]})}return(C,w)=>{const N=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),T=n.resolveComponent("a-button"),E=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-select"),z=n.resolveComponent("ToolOutlined"),A=n.resolveComponent("a-checkbox"),q=n.resolveComponent("a-table"),P=n.resolveComponent("a-select-option"),Q=n.resolveComponent("a-form-item"),R=n.resolveComponent("a-form"),S=n.resolveComponent("a-modal"),F=n.resolveComponent("a-checkbox-group"),_=n.resolveComponent("a-input-number"),I=n.resolveComponent("a-input"),H=n.resolveComponent("a-col"),Fe=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Va,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[23]||(w[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",_a,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,$=>(n.openBlock(),n.createBlock(T,n.mergeProps({key:$.name,class:["btn",$.name,!$.visible&&"deleted"],type:$.visible?$.type:"default",size:$.size,ref_for:!0},$.props||{},{onClick:Ve=>r($)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString($.title)+" ",1),$.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers(Ve=>h($),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[$.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(T,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:w[0]||(w[0]=$=>d())},{default:n.withCtx(()=>[n.createVNode(E)]),_:1})]),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[24]||(w[24]=[n.createTextVNode("表单设置")])),_:1}),w[36]||(w[36]=n.createTextVNode(" 数据模型:")),n.createVNode(D,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":w[1]||(w[1]=$=>i.value.dataModel=$)},null,8,["options","value"]),n.createVNode(q,{columns:t.value,"data-source":v.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:$})=>[["widget","rules","convertName"].includes($.key)?(n.openBlock(),n.createElementBlock("span",Ma,[n.createVNode(z),n.createTextVNode(" "+n.toDisplayString($.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:$,text:Ve,record:ee})=>[["rules"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!c.value.showInfo(ee)&&"empty"]),onClick:xe=>u(ee)},[n.createElementVNode("span",Aa,n.toDisplayString(c.value.showInfo(ee)),1),c.value.showInfo(ee)?(n.openBlock(),n.createBlock(T,{key:0,type:"link"},{default:n.withCtx(()=>w[25]||(w[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ta)):["widget"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!g.value[ee.name]||!Object.keys(g.value[ee.name]).includes($.dataIndex))&&!Ve&&"empty"]),onClick:xe=>p(ee,$.dataIndex)},[g.value[ee.name]&&Object.keys(g.value[ee.name]).includes($.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ee[$.dataIndex],"onUpdate:value":xe=>ee[$.dataIndex]=xe,options:f.value.widgets,onBlur:w[2]||(w[2]=xe=>B())},null,8,["value","onUpdate:value","options"])),[[V]]):(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(f.value.widgetName(Ve)),1))],10,Ea)):["convertName"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!g.value[ee.name]||!Object.keys(g.value[ee.name]).includes($.dataIndex))&&!ee.convert?.type&&"empty"]),onClick:xe=>p(ee,$.dataIndex)},[g.value[ee.name]&&Object.keys(g.value[ee.name]).includes($.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ee[$.dataIndex],"onUpdate:value":xe=>ee[$.dataIndex]=xe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:w[3]||(w[3]=xe=>B())},null,8,["value","onUpdate:value"])),[[V]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[ee.convert?.type?(n.openBlock(),n.createElementBlock("span",Pa,n.toDisplayString(ee.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),ee.convert?.type?(n.openBlock(),n.createBlock(T,{key:1,type:"link",onClick:n.withModifiers(xe=>b(ee),["stop"])},{default:n.withCtx(()=>w[26]||(w[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Da)):["isForm","isView"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",Fa,[n.createVNode(A,{checked:ee[$.dataIndex],onClick:xe=>O(ee,$.dataIndex)},null,8,["checked","onClick"]),n.createVNode(T,{type:"link",onClick:xe=>k(ee,$.dataIndex)},{default:n.withCtx(()=>w[27]||(w[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(S,{visible:f.value.visible,"onUpdate:visible":w[5]||(w[5]=$=>f.value.visible=$),title:"控件设置",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[f.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(Q,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(D,{value:f.value.props.mode,"onUpdate:value":w[4]||(w[4]=$=>f.value.props.mode=$),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(P,{value:"multiple"},{default:n.withCtx(()=>w[28]||(w[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(P,{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(S,{visible:c.value.visible,"onUpdate:visible":w[13]||(w[13]=$=>c.value.visible=$),title:"规则设置",onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:c.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(Q,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(F,{value:c.value.props.trigger,"onUpdate:value":w[6]||(w[6]=$=>c.value.props.trigger=$),options:["change","blur"]},null,8,["value"])]),_:1}),c.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Q,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(A,{value:c.value.props.whitespace,"onUpdate:value":w[7]||(w[7]=$=>c.value.props.whitespace=$),checked:c.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(Q,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(_,{value:c.value.props.rangeMin,"onUpdate:value":w[8]||(w[8]=$=>c.value.props.rangeMin=$)},null,8,["value"]),w[33]||(w[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(_,{value:c.value.props.rangeMax,"onUpdate:value":w[9]||(w[9]=$=>c.value.props.rangeMax=$)},null,8,["value"])]),_:1}),n.createVNode(Q,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(I,{value:c.value.props.rangeMessage,"onUpdate:value":w[10]||(w[10]=$=>c.value.props.rangeMessage=$)},null,8,["value"])]),_:1}),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[34]||(w[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(Q,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(I,{value:c.value.props.regExpress,"onUpdate:value":w[11]||(w[11]=$=>c.value.props.regExpress=$)},null,8,["value"])]),_:1}),n.createVNode(Q,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(I,{value:c.value.props.regMessage,"onUpdate:value":w[12]||(w[12]=$=>c.value.props.regMessage=$)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(S,{visible:m.value.visible,"onUpdate:visible":w[20]||(w[20]=$=>m.value.visible=$),title:m.value.title,onOk:m.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Q,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(_,{value:m.value.show.index,"onUpdate:value":w[14]||(w[14]=$=>m.value.show.index=$)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Q,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.width,"onUpdate:value":w[15]||(w[15]=$=>m.value.show.width=$)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.labelWidth,"onUpdate:value":w[16]||(w[16]=$=>m.value.show.labelWidth=$)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.valueWidth,"onUpdate:value":w[17]||(w[17]=$=>m.value.show.valueWidth=$)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(D,{value:m.value.show.fixed,"onUpdate:value":w[18]||(w[18]=$=>m.value.show.fixed=$),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(D,{value:m.value.show.align,"onUpdate:value":w[19]||(w[19]=$=>m.value.show.align=$),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(S,{visible:y.value.visible,"onUpdate:visible":w[22]||(w[22]=$=>y.value.visible=$),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[y.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",$a,[n.createVNode(T,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:n.withCtx(()=>w[35]||(w[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(q,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:$,record:Ve,index:ee})=>[$.dataIndex==="label"?(n.openBlock(),n.createBlock(I,{key:0,value:Ve.label,"onUpdate:value":xe=>Ve.label=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),$.dataIndex==="value"?(n.openBlock(),n.createBlock(I,{key:1,value:Ve.value,"onUpdate:value":xe=>Ve.value=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),$.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:xe=>y.value.toDelOption(ee,Ve)},"删除",8,Ra)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),y.value.convert.type=="dict"?(n.openBlock(),n.createBlock(R,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Fe,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(H,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(Q,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(I,{value:y.value.convert.dict,"onUpdate:value":w[21]||(w[21]=$=>y.value.convert.dict=$)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(ci,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),ja=te(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(!1),l=n.ref(),s=n.ref({}),a=n.ref(null);n.onMounted(()=>{if(t.editor&&r.value.dsn){const x=t.editor.dataManager();r.value.primary&&x.psn(r.value.dsn),a.value.setDisabled=b,a.value.getValue=c,a.value.setValue=u,a.value.reset=m,l.value=x.useForm(r.value.dsn,a.value,v=>{s.value=v.body||{}})}k()});const r=n.computed(()=>t.widget||t.form||{}),d=n.computed(()=>{let x=r.value.widgets||[];return!x.length&&t.form?.fields&&(x=t.form.fields),x.forEach(v=>{v.widget||(v.widget="unione-form-item"),v.control||(v.control="a-input")}),x}),h=n.inject("pageSetting"),f=n.computed(()=>r.value.setting||h?.form||{});n.provide("formSetting",f.value);function c(){return s.value}function u(x){s.value=x,k()}function m(){s.value={},k()}function k(){const x=v=>{v.widget=="unione-form-item"&&v.name&&(v.value!=null&&v.value!=null&&v.value!=""||v.value==0)&&(s.value[v.name]==null||s.value[v.name]==null||s.value[v.name]=="")&&(s.value[v.name]=v.value),v.widgets?.forEach(V=>{x(V)})};d.value.forEach(v=>{x(v)})}function y(){return a.value.validate()}function b(x=!0){i.value=x}return e({validate:y,getValue:c,setValue:u,reset:m,setDisabled:b}),(x,v)=>{const V=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(ct,{class:"unione-form-widget","setting-title":"表单设置",model:o.editor?.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(V,{ref_key:"formObj",ref:a,model:s.value,class:n.normalizeClass(["unione-form",o.editor?.model.value,"form-layout-col-"+(f.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(g,p)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(g.widget),{key:p,widget:g,editor:o.editor,value:s.value[g.name],"onUpdate:value":B=>s.value[g.name]=B,disabled:i.value,formValue:s.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[o.editor&&r.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(La,{wid:r.value.wid,editor:o.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-c2f74698"]]);function bl(o,e=!1){const t=Ee();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((l,s)=>{K.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)),l(r)):s("字典加载失败,dict:"+o+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+o,a),s("字典加载失败,dict:"+o+",error:"+a.message)})})}async function yl(o,e){const t=Ee();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 bl(o),l=i.filter(s=>s.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+o+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+o+",key:"+e))}async function za(o,e){const t=await yl(o,e);return Promise.resolve(t.dictValue)}const wl={load:bl,getLabel:za,getOption:yl};class Ke{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=Ee()}load(e,t=!1){return this.config.isDebug&&console.log("进入:加载转换选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e+",force:"+t),!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}wl.load(this.convertObj.dictName,t).then(s=>{this.options=s,typeof e=="number"&&this.options.forEach(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,l)=>{const s=this.convertObj.params||{body:{}};this.convertObj.pidField&&(s.pid=-1);const a=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:a,data:s,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(d=>{d.value=parseInt(d.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(h=>h.value==e).length?i(this.options):(s.body||(s.body={}),s.body[this.convertObj.valueField||"id"]=e,K.axios.admin({url:a,data:s,method:"POST"}).then(h=>{if(h.success){const f={};this.options.forEach(c=>{f[e]=!0}),h.body.forEach(c=>{f[c.value]||this.options.push(c)}),i(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(this.config.isDebug&&console.log("进入:数据转换:value->label方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?wl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(i=>i.value==e);return t.length?Promise.resolve(t[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const t=this.options.filter(i=>i.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,i)=>{this.load(e).then(l=>{const s=l.filter(a=>a.value==e);if(s.length)return t(s[0].label);i()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((i,l)=>{const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:s,data:e,method:"POST"}).then(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),l("加载下级数据项失败,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;K.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(l=>{l.success?(this.$processOptions(l.body),t(l.body)):t([])})})}$processOptions(e){return this.convertObj.types=="local"&&e.forEach(t=>{this.convertObj.idField&&(t.id=t[this.convertObj.idField]),this.convertObj.pidField&&(t.pid=t[this.convertObj.pidField]),t.value=t[this.convertObj.valueField||"id"],t.label=t[this.convertObj.labelField||"title"]}),e}}const qa={key:1,class:"text-view"},Ua=te(n.defineComponent({__name:"formItem",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.inject("formSetting");n.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(t.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?t.value=s.value.value.split(","):t.value=[s.value.value])))});const l=n.ref({}),s=n.computed(()=>{const b=e.editor?.widget(e.wid)||e.widget||{};return b.event&&Object.keys(b.event).forEach(x=>{const v=b.event[x];v&&(l.value[x]=null,typeof v=="function"?l.value[x]=v:v.enable&&v.scriptText&&(l.value[x]=new Function("value","ctx",v.scriptText)))}),b}),a=n.computed(()=>!(l.value.visible&&l.value.visible(e.formValue[s.value.name],e.formValue)==!1)),r=n.computed(()=>l.value.title&&l.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=n.computed(()=>l.value.change&&l.value.change(e.formValue[s.value.name],e.formValue)||s.value.change),h=n.ref({}),f=n.computed(()=>{const b=[],x=s.value.rule||{};if((s.value.props?.required||s.value.required)&&b.push({required:!0,whitespace:x?.whitespace||!1,trigger:x?.trigger||i.ruleTrigger||"change",validator:(v,V)=>(x?.whitespace&&V&&typeof V=="string"&&(V=V.trim()),V!=null&&V!=null&&(V+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(s.value.title+"不能为空!"))}),x.advance&&h.value[x.advance]){const v=h.value[x.advance];b.push({pattern:v.pattern,message:v.message||"表单验证不通过!",trigger:x.trigger||i.ruleTrigger||"change"})}return x.regExpress&&b.push({pattern:x.regExpress,message:x.regMessage||"表单验证不通过!",trigger:x.trigger||i.ruleTrigger||"change"}),s.value.dataLen&&b.push({validator:(v,V)=>V&&(V+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(V+"").length+"]"):Promise.resolve(),trigger:x?.trigger||i.ruleTrigger||"change"}),b}),c=n.computed(()=>{const b=s.value.props||{};if(s.value.control=="a-input-number"){const x=s.value.rule||{};x.rangeMin!=null&&x.rangeMin!=null&&(b.min=x.rangeMin),x.rangeMax!=null&&x.rangeMax!=null&&(b.max=x.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(b.format=s.value.view.dataFormat,b.valueFormat=s.value.view.dataFormat),s.value.required&&(b.required=s.value.required),b}),u=n.computed(()=>{const b=s.value.css||{},x=[];return b.cssName&&x.push(b.cssName),i.platform=="app"?b.cssName?typeof b.cssName=="string"&&b.cssName.indexOf("all-line")<0&&x.push("all-line"):x.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!b.cssName||typeof b.cssName=="string"&&b.cssName.indexOf("all-line")<0)&&x.push("all-line"):s.value.view.width==2&&x.push("2in-line")),x}),m=n.computed(()=>{const b=i.showColumn||3;let x=s.value.view?.labelWidth||i.labelWidth||9;return s.value.css?.cssName&&b>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(x/b)}:s.value.view?.width>=3&&b>1?{span:Math.round(x/b)}:{span:x}}),k=n.computed(()=>{const b=i.showColumn||3;let x=s.value.view?.valueWidth||i.valueWidth||19;return s.value.css?.cssName&&b>1&&u.value.includes("all-line")?{}:{span:x}}),y=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new Ke(s.value.convert).convert(t.value.toString()).then(b=>{y.value=b})}),(b,x)=>{const v=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(ct,{class:n.normalizeClass(["unione-form-item",u.value]),style:n.normalizeStyle(s.value.css?.cssText)},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createBlock(v,{key:0,label:r.value,name:s.value.name,labelCol:m.value,wrapperCol:k.value,required:s.value.props?.required,rules:f.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:n.withCtx(()=>[!o.editor||o.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value.control||"a-input"),n.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:o.disabled,onChange:d.value,value:t.value,"onUpdate:value":x[0]||(x[0]=V=>t.value=V)},c.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","style"])):t.value?(n.openBlock(),n.createElementBlock("div",qa,n.toDisplayString(y.value?y.value:t.value),1)):n.createCommentVNode("",!0)]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-1d53d430"]]);function xl(o,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{o(i)},e)}}const Wa=te(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){Ee();const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),s=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),a=xl(f=>{h.value.search(f).then(c=>{i.value=c})},500);n.onMounted(()=>{h.value.load(t.value).then(f=>{i.value=f})});const r=n.ref({}),d=n.computed(()=>{const f=e.editor?.widget(e.wid)||e.widget||{};return f.event&&Object.keys(f.event).forEach(c=>{const u=f.event[c];r.value[c]=null,u.enable&&u.scriptText&&(r.value[c]=new Function("value","ctx",u.scriptText))}),f}),h=n.computed(()=>{const f=d.value.convert||e.convert||{};return new Ke(f)});return n.watch(t,()=>{t.value&&h.value.load(t.value).then(f=>{i.value=f})}),n.watch(()=>d.value.convert||e.convert||{},()=>{h.value.load().then(f=>{i.value=f})}),(f,c)=>{const u=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(u,{class:"unione-form-select",options:l.value,showSearch:s.value,value:t.value,"onUpdate:value":c[0]||(c[0]=m=>t.value=m),onSearch:n.unref(a)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Ha=te(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 l=n.ref({}),s=n.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const h=r.event[d];l.value[d]=null,h.enable&&h.scriptText&&(l.value[d]=new Function("value","ctx",h.scriptText))}),r}),a=n.computed(()=>{const r=s.value.convert||e.convert;return r?new Ke(r):null});return(r,d)=>{const h=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(h,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=f=>t.value=f)}),null,16,["checked"])}}}),[["__scopeId","data-v-a56d945e"]]),Ka=te(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([]),l=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 s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const f=d.event[h];s.value[h]=null,f.enable&&f.scriptText&&(s.value[h]=new Function("value","ctx",f.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new Ke(d)});return(d,h)=>{const f=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(f,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=c=>t.value=c)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Qa=te(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([]),l=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 s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const f=d.event[h];s.value[h]=null,f.enable&&f.scriptText&&(s.value[h]=new Function("value","ctx",f.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new Ke(d)});return(d,h)=>{const f=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(f,{class:"unione-form-checkbox",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=c=>t.value=c)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Ga=te(n.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(o){const e=n.ref(),t=n.useModel(o,"value");return n.watch(()=>e.value,()=>{e.value?t.value=K.utils.sm2Encrypt(e.value):t.value=""}),(i,l)=>{const s=n.resolveComponent("a-input-password");return n.openBlock(),n.createBlock(s,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=a=>e.value=a)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]),Ya={class:"unione-props-setting unione-query-setting"},Xa={class:"unione-query-opts"},Ja={key:0},Za=["onClick"],er={key:1},tr={key:1,class:"edit-field"},ir=["onClick"],nr=te(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}),l=n.computed(()=>(e.editor.dataModels()||[]).map(g=>({value:g.sn,label:g.title+"("+g.name+")"}))),s=n.computed(()=>{const V=[],g=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(p=>{V.push(p),g.push(p.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((p,B)=>{const O=p.index||1,C=B.index||1;return O-C}),V}),a=n.ref(null);function r(V){a.value&&a.value.open(V,g=>{g.visible=!0,Object.keys(g).forEach(p=>{V[p]=g[p]}),i.value.configs.btns.sort((p,B)=>{const O=p.index||1,C=B.index||1;return O-C}),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,p=>{Object.keys(p).forEach(B=>{g[B]=p[B]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(V){const g=()=>{if(["query","reset","advanced"].includes(V.name))V.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const p=[];i.value.configs.btns.forEach(B=>{B.name!=V.name&&p.push(B)}),i.value.configs.btns=p}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{g()}})}const f=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),c=n.computed(()=>f.value.fields?.length?f.value.fields:[]),u={mounted:V=>V.focus()},m=n.ref({});function k(){const V=Object.keys(m.value);if(V.length)for(let g in V){const p=c.value.filter(B=>B.name==g);if(p&&p[0]){let B=m.value[g];Object.keys(B).forEach(O=>{if(O=="showIndex"){const C=p[0].show?.query||{};p[0].show||(p[0].show={}),p[0].show.query={...C,index:B[O]}}else p[0][O]=B[O]})}}m.value={}}function y(V,g){k();const p={};p[g]=V[g]||"",g=="showIndex"&&(p[g]=V.show?.query?.index),m.value[V.name]=p}function b(V,g){if(!V||!g){m.value={};return}const p=m.value[V.name][g];if(g=="showIndex"){const B=V.show?.query||{};V.show||(V.show={}),V.show.query={...B,index:p}}else V[g]=p;m.value={}}function x(V,g){c.value.filter(B=>B.name==V.name).forEach(B=>{B[g]=!B[g]})}const v=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=v.value.options.filter(p=>p.value==V);return g[0]?g[0].label:V}});return(V,g)=>{const p=n.resolveComponent("a-divider"),B=n.resolveComponent("CloseOutlined"),O=n.resolveComponent("a-button"),C=n.resolveComponent("PlusOutlined"),w=n.resolveComponent("a-select"),N=n.resolveComponent("ToolOutlined"),M=n.resolveComponent("a-checkbox"),T=n.resolveComponent("a-input-number"),E=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Ya,[n.createVNode(p,{orientation:"left"},{default:n.withCtx(()=>g[3]||(g[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Xa,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,D=>(n.openBlock(),n.createBlock(O,n.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size||"default",ref_for:!0},D.props||{},{onClick:z=>r(D)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(D.title)+" ",1),D.visible?(n.openBlock(),n.createBlock(B,{key:0,class:"btn-del",onClick:n.withModifiers(z=>h(D),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(O,{class:n.normalizeClass(["btn","btn-add"]),onClick:g[0]||(g[0]=D=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(C)]),_:1})]),n.createVNode(p,{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:l.value,value:i.value.dataModel,"onUpdate:value":g[1]||(g[1]=D=>i.value.dataModel=D)},null,8,["options","value"]),n.createVNode(E,{columns:t.value,"data-source":c.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:D})=>[["showIndex","queryType"].includes(D.key)?(n.openBlock(),n.createElementBlock("span",Ja,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(D.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:D,text:z,record:A})=>[["queryType"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!m.value[A.name]||!Object.keys(m.value[A.name]).includes(D.dataIndex))&&!z&&"empty"]),onClick:q=>y(A,D.dataIndex)},[m.value[A.name]&&Object.keys(m.value[A.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:A[D.dataIndex],"onUpdate:value":q=>A[D.dataIndex]=q,allowClear:!0,options:v.value.options,onBlur:g[2]||(g[2]=q=>b())},null,8,["value","onUpdate:value","options"])),[[u]]):(n.openBlock(),n.createElementBlock("span",er,n.toDisplayString(v.value.showLabel(z)),1))],10,Za)):["isQuery"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",tr,[n.createVNode(M,{checked:A[D.dataIndex],onClick:q=>x(A,D.dataIndex)},null,8,["checked","onClick"])])):D.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!m.value[A.name]||!Object.keys(m.value[A.name]).includes(D.dataIndex))&&!z&&"empty"]),onClick:q=>y(A,D.dataIndex)},[m.value[A.name]&&Object.keys(m.value[A.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(T,{key:0,value:m.value[A.name][D.dataIndex],"onUpdate:value":q=>m.value[A.name][D.dataIndex]=q,onBlur:q=>b(A,D.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(A.show?.query?.index||" "),1)],64))],10,ir)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),lr={class:"query-btn"},sr={class:"btn-advanced-overlay"},vl=te(n.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},fields:{type:Array},params:{type:Object,default(){return{}}}},emits:["query","reset","btnClick"],setup(o,{emit:e}){const t=o,i=n.computed(()=>{const b=t.editor?.widget(t.wid)||t.widget||{};return b.btns||(b.btns=[]),b}),l=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),s=n.computed(()=>{let b=[];return i.value.fields?.length&&(b=i.value.fields),b.length==0&&t.fields?.length&&(b=t.fields),b.sort((x,v)=>{const V=x.show?.query?.index||1,g=v.show?.query?.index||1;return V-g}),b.forEach(x=>{x.widget=x.widget||x.control||"a-input",x.defaultValue!=null&&x.defaultValue!="undefined"&&typeof x.defaultValue<"u"&&(f.value[x.name]=x.defaultValue,x.value=x.defaultValue)}),b}),a=n.computed(()=>i.value.labelWidth||7),r=n.computed(()=>{const b=i.value.btns.filter(x=>x.name=="advanced")[0]||{};return b.event?.clickScript&&(b.event.click=new Function("ctx","btn","event",b.event.clickScript)),b.event?.disableScript&&(b.event.disable=new Function("ctx","btn",b.event.disableScript)),b.event?.visibleScript&&(b.event.visible=new Function("ctx","btn",b.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...b}}),d=["query","reset","advanced"],h=n.computed(()=>{const b=i.value.btns.filter(v=>v.name!="advanced"),x=[];return b.forEach(v=>{v.size||(v.size="default"),x.push(v.name)}),x.includes("query")||b.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),x.includes("reset")||b.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),b.sort((v,V)=>{const g=v.index||1,p=V.index||1;return g-p}),b}),f=n.ref({}),c=n.computed(()=>{const b={};return i.value.params?Object.keys(i.value.params).forEach(x=>{b[x]=i.value.params[x]}):t.params&&Object.keys(t.params).forEach(x=>{b[x]=t.params[x]}),b});n.onMounted(()=>{t.editor?.ebus.$on("query-form-params",b=>{i.value.params=b}),k()});const u=e;function m({btn:b,event:x}){console.log("unione query form btn click",b,x),b.name=="query"&&k(),b.name=="reset"&&y(),u("btnClick",{btn:b,event:x})}function k(){const b=[];s.value.forEach(v=>{v.visible&&b.push(v.name)});const x={params:{...c.value},keywords:""};Object.keys(f.value).forEach(v=>{b.includes(v)&&(x.params[v]=f.value[v])}),l.value.visible&&f.value[l.value.name]&&(x.keywords=f.value[l.value.name]),u("query",x),t.editor?.ebus.$emit("table-list-search",x)}function y(){f.value={},s.value.forEach(x=>{x.visible=!1});const b={params:{...c.value},keywords:""};u("reset",b),t.editor?.ebus.$emit("table-list-reset",b)}return(b,x)=>{const v=n.resolveComponent("a-input"),V=n.resolveComponent("a-form-item"),g=n.resolveComponent("unione-btn"),p=n.resolveComponent("a-checkbox"),B=n.resolveComponent("DownOutlined"),O=n.resolveComponent("a-button"),C=n.resolveComponent("a-dropdown"),w=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(ct,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},n.createSlots({default:n.withCtx(()=>[n.createVNode(w,{model:f.value,layout:"horizontal","label-col":{span:a.value}},{default:n.withCtx(()=>[l.value.visible?(n.openBlock(),n.createBlock(V,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:n.normalizeStyle({width:a.value})},{default:n.withCtx(()=>[n.createVNode(v,{placeholder:l.value.placeholder,value:f.value[l.value.name],"onUpdate:value":x[0]||(x[0]=N=>f.value[l.value.name]=N),allowClear:"",onKeyup:n.withKeys(k,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,N=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N.name},[N.visible?(n.openBlock(),n.createBlock(V,{key:0,label:N.title,class:n.normalizeClass(["query-field",N.name]),style:n.normalizeStyle({width:a.value}),name:N.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(N.widget),n.mergeProps({placeholder:N.placeholder,value:f.value[N.name],"onUpdate:value":M=>f.value[N.name]=M,ref_for:!0},N.props||{},{allowClear:"",widget:N}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",lr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,N=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N.name},[N.visible!=!1?(n.openBlock(),n.createBlock(g,{key:0,widget:N,editor:o.editor,onClick:m,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&s.value.length?(n.openBlock(),n.createBlock(C,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",sr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,N=>(n.openBlock(),n.createBlock(p,{key:N.name,class:"item",checked:N.visible,onClick:M=>N.visible=!N.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(N.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(O,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value.title)+" ",1),n.createVNode(B)]),_:1})]),_:1},8,["trigger"])):n.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(nr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-f95e2d5b"]]),or={class:"unione-props-setting unione-table-setting"},ar={class:"unione-table-tools"},rr={key:1,class:"unione-table-opts"},dr={key:0},cr=["onClick"],hr={key:1,class:"edit-field"},fr=["onClick"],ur={key:1},pr=te(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:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(C,w){let N=C.filter(M=>M.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(C,w){let N=C.filter(M=>M.value==w);return N&&N[0]&&N[0].label||w}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.leftBtns||(C.configs.leftBtns=[]),C.configs.rightBtns||(C.configs.rightBtns=[]),C.configs.operation||(C.configs.operation={}),C.configs.operation.btns||(C.configs.operation.btns=[]),C.configs.operation.more||(C.configs.operation.more={}),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(w=>({value:w.sn,label:w.title+"("+w.name+")"}))),s=n.computed(()=>{if(!i.value)return[];const C=[],w=i.value.configs.leftBtns;if(w.forEach(N=>{C.push(N.name)}),!C.includes("add")){const N={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};w.splice(0,0,N)}if(!C.includes("delBatch")){const N={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};w.splice(1,0,N)}return w}),a=n.computed(()=>{if(!i.value)return[];const C=[],w=i.value.configs.rightBtns;if(w.forEach(N=>{C.push(N.name)}),!C.includes("downData")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};w.splice(0,0,N)}if(!C.includes("impData")){const N={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};w.splice(1,0,N)}if(!C.includes("expData")){const N={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};w.splice(2,0,N)}if(!C.includes("downTmpl")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};w.splice(3,0,N)}return w});function r(C,w){C=="left"?f.value.open(w,N=>{N.visible=!0,Object.keys(N).forEach(M=>{w[M]=N[M]}),i.value.configs.leftBtns.sort((M,T)=>{const E=M.index||1,D=T.index||1;return E-D}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):f.value.open(w,N=>{N.visible=!0,Object.keys(N).forEach(M=>{w[M]=N[M]}),i.value.configs.rightBtns.sort((M,T)=>{const E=M.index||1,D=T.index||1;return E-D}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(C){const w=C=="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:{}};C=="left"?i.value.configs.leftBtns.push(N):i.value.configs.rightBtns.push(N),e.editor.widget(e.wid,i.value),r(C,N)}function h(C,w){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(w.name))w.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const M=[];i.value.configs.leftBtns.forEach(T=>{T.name!=w.name&&M.push(T)}),i.value.configs.leftBtns=M}else{const M=[];i.value.configs.rightBtns.forEach(T=>{T.name!=w.name&&M.push(T)}),i.value.configs.rightBtns=M}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const f=n.ref(null);function c(C){f.value.open(C,w=>{w.visible=!0,Object.keys(w).forEach(N=>{C[N]=w[N]}),i.value.configs.operation.btns.sort((N,M)=>{const T=N.index||1,E=M.index||1;return T-E}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const C=i.value.configs.operation.btns.length+1;let w={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(w),e.editor.widget(e.wid,i.value),f.value.open(w,N=>{Object.keys(N).forEach(M=>{w[M]=N[M]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function m(C){const w=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const N=[];i.value.configs.operation.btns.forEach(M=>{M.name!=C.name&&N.push(M)}),i.value.configs.operation.btns=N}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{w()}})}const k=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),y=n.computed(()=>k.value.fields?.length?(k.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),k.value.fields):[]),b={mounted:C=>C.focus()},x=n.ref({});function v(){const C=Object.keys(x.value);if(C.length)for(let w in C){const N=y.value.filter(M=>M.name==w);if(N&&N[0]){let M=x.value[w];Object.keys(M).forEach(T=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),T=="showIndex"?N[0].show.list.index=M[T]:T=="showWidth"?N[0].show.list.width=M[T]:T=="fixed"?N[0].show.list.fixed=M[T]:T=="align"?N[0].show.list.align=M[T]:N[0][T]=M[T]})}}x.value={}}function V(C,w){v();const N={};w=="showIndex"?N[w]=C.show?.list?.index:w=="showWidth"?N[w]=C.show?.list?.width:w=="fixed"?N[w]=C.show?.list?.fixed:w=="align"?N[w]=C.show?.list?.align:N[w]=C[w]||"",x.value[C.name]=N}function g(C,w){if(!C||!w){x.value={};return}const N=x.value[C.name][w];C.show||(C.show={}),C.show.list||(C.show.list={}),w=="showIndex"?C.show.list.index=N:w=="showWidth"?C.show.list.width=N:w=="fixed"?C.show.list.fixed=N:w=="align"?C.show.list.align=N:C[w]=N,x.value={}}function p(C,w){return w=="showIndex"?C.show?.list?.index:w=="showWidth"?C.show?.list?.width:w=="fixed"?C.show?.list?.fixed:w=="align"?C.show?.list?.align:C[w]}function B(C,w){y.value.filter(M=>M.name==C.name).forEach(M=>{M[w]=!M[w]})}const O=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const w=O.value.options.filter(N=>N.value==C);return w[0]?w[0].label:C}});return(C,w)=>{const N=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),T=n.resolveComponent("a-button"),E=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-input"),z=n.resolveComponent("a-form-item"),A=n.resolveComponent("a-col"),q=n.resolveComponent("a-input-number"),P=n.resolveComponent("a-checkbox"),Q=n.resolveComponent("a-row"),R=n.resolveComponent("a-select"),S=n.resolveComponent("ToolOutlined"),F=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",or,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>w[8]||(w[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",ar,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,_=>(n.openBlock(),n.createBlock(T,n.mergeProps({key:_.name,class:["btn",_.name,!_.visible&&"deleted"],type:_.visible?_.type:"default",size:_.size,ref_for:!0},_.props||{},{onClick:I=>r("left",_)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(_.title)+" ",1),_.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers(I=>h("left",_),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[_.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(_.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(T,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:w[0]||(w[0]=_=>d("left"))},{default:n.withCtx(()=>[n.createVNode(E)]),_:1}),n.createVNode(T,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:w[1]||(w[1]=_=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(E)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,_=>(n.openBlock(),n.createBlock(T,n.mergeProps({key:_.name,class:["btn","right",_.name,!_.visible&&"deleted"],type:_.visible?_.type:"default",size:_.size,ref_for:!0},_.props||{},{onClick:I=>r("right",_)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(_.title)+" ",1),_.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers(I=>h("right",_),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[_.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(_.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(Q,{key:0},{default:n.withCtx(()=>[n.createVNode(A,{span:7},{default:n.withCtx(()=>[n.createVNode(z,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(D,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(A,{span:5},{default:n.withCtx(()=>[n.createVNode(z,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(q,{value:i.value.configs.operation.width,"onUpdate:value":w[2]||(w[2]=_=>i.value.configs.operation.width=_)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(A,{span:6},{default:n.withCtx(()=>[n.createVNode(z,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(q,{value:i.value.configs.operation.count,"onUpdate:value":w[3]||(w[3]=_=>i.value.configs.operation.count=_)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(A,{span:5},{default:n.withCtx(()=>[n.createVNode(z,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(P,{checked:i.value.configs.operation.visible,"onUpdate:checked":w[4]||(w[4]=_=>i.value.configs.operation.visible=_)},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",rr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,_=>(n.openBlock(),n.createBlock(T,n.mergeProps({key:_.name,class:["btn",_.name,!_.visible&&"deleted"],type:_.visible?_.type:"default",size:_.size||"small",ref_for:!0},_.props||{},{onClick:I=>c(_)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(_.title)+" ",1),_.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers(I=>m(_),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[_.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(_.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(T,{class:n.normalizeClass(["btn","btn-add"]),onClick:w[5]||(w[5]=_=>u()),size:"small"},{default:n.withCtx(()=>[n.createVNode(E)]),_: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(R,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":w[6]||(w[6]=_=>i.value.dataModel=_)},null,8,["options","value"]),n.createVNode(F,{columns:t.value,"data-source":y.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:_})=>[["showIndex","showWidth","align","fixed"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",dr,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:_,record:I})=>[["showIndex","showWidth"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!x.value[I.name]||!Object.keys(x.value[I.name]).includes(_.dataIndex))&&!p(I,_.dataIndex)&&"empty"]),onClick:H=>V(I,_.dataIndex)},[x.value[I.name]&&Object.keys(x.value[I.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(q,{key:0,value:x.value[I.name][_.dataIndex],"onUpdate:value":H=>x.value[I.name][_.dataIndex]=H,onBlur:H=>g(I,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[b]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p(I,_.dataIndex)),1)],64))],10,cr)):["isList","isQuery","isSort"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",hr,[n.createVNode(P,{checked:I[_.dataIndex],onClick:H=>B(I,_.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!x.value[I.name]||!Object.keys(x.value[I.name]).includes(_.dataIndex))&&!p(I,_.dataIndex)&&"empty"]),onClick:H=>V(I,_.dataIndex)},[x.value[I.name]&&Object.keys(x.value[I.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(R,{key:0,value:I.show.list[_.dataIndex],"onUpdate:value":H=>I.show.list[_.dataIndex]=H,allowClear:!0,options:_.options,onBlur:w[7]||(w[7]=H=>g())},null,8,["value","onUpdate:value","options"])),[[b]]):(n.openBlock(),n.createElementBlock("span",ur,n.toDisplayString(_.showLabel(_.options,p(I,_.dataIndex))),1))],10,fr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:f,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function tn(o){const e=o.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const mr={toHump:tn},gr={class:"unione-table-tools"},kr={class:"unione-table-data"},br={key:0,class:"unione-table-opts"},Cl=te(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=Ee(),l=o,s=n.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),a=n.computed(()=>s.value.props||{}),r=n.computed(()=>s.value.rowKey||l.rowKey||"id"),d=n.computed(()=>s.value.dsn?l.editor?.dataManager().use(s.value.dsn,"list"):null),h=n.computed(()=>{const E=l.dataList||[];return!E.length&&d.value?d.value.data().body||[]:E}),f=n.computed(()=>{if(s.value.operation==!1)return{visible:!1};const E=K.utils.obj.ext(s.value.operation||{},{title:"操作",visible:!0,width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),D=[];let z=(s.value.operation?.btns||[]).map(A=>(typeof A=="string"&&(A={name:A,visible:!1}),A));if(z.forEach(A=>{D.push(A.name)}),D.includes("edit")||z.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),D.includes("view")||z.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),D.includes("delete")||z.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const A=z.filter(P=>P.name=="edit")[0];if(A.visible&&(A.action||(A.action={}),A.action.type||(A.action.type="route"),!A.action.href)){const P=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",Q=l.editor.model.value;A.action.link=i.editPageUrl+"?psn="+P+"&model="+Q+"&id={row."+l.rowKey+"}"}const q=z.filter(P=>P.name=="view")[0];if(q.visible&&(q.action||(q.action={}),q.action.type||(q.action.type="route"),!q.action.href)){const P=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";q.action.link=i.viewPageUrl+"?psn="+P+"&model=view&id={row."+l.rowKey+"}"}}return z=z.filter(A=>A.visible!=!1).sort((A,q)=>{const P=A.index||1,Q=q.index||1;return P-Q}),E.count&&(z.length>E.count+1?(E.btns=z.slice(0,E.count),E.more.items=z.slice(E.count,z.length),E.more.visible=!0):(E.btns=z,E.more.visible=!1)),E}),c=n.computed(()=>{let E=[];s.value.columns?.length&&(E=[...s.value.columns]);const D=[];E.forEach((A,q)=>{A.dataIndex=A.name,A.convert&&(A.dataIndex=A.name+"Label",A.convertObj=new Ke(A.convert),A.customCell=(P,Q,R)=>{const S=P[R.name];A.convertObj&&(P[R.dataIndex]==null||P[R.dataIndex]==null)&&S!=null&&S!=null&&(S+"").length>0&&(P[R.dataIndex]=S,A.convertObj.convert(S).then(F=>{F&&(P[R.dataIndex]=F)}))}),A.sort?.enable&&(A.sorter=!0,A.sort.defoult&&(A.defaultSortOrder=A.sort.asc?"ascend":"descend")),A.customRender=({text:P})=>P||"--",A.fkey?.enable&&(A.fkey.labelName&&(A.dataIndex=tn(A.fkey.labelName)),A.fkey.labelTitle&&(A.title=A.fkey.labelTitle),A.customRender=({record:P,column:Q})=>P&&P[Q.name+"FEntry"]&&P[Q.name+"FEntry"][Q.dataIndex]||"--",A.fkey.fields?.forEach((P,Q)=>{if(!P.name)return;const R=tn(P.name),S={fkName:A.name,title:P.title,name:R,dataIndex:P.name,width:P.width,index:P.index||q+Q+1,customRender:({record:F,column:_})=>{if(F&&F[_.fkName+"FEntry"]){const I=F[_.fkName+"FEntry"][_.name];if(I)return P.convertObj&&P.convertObj.convert(I)||I}return"--"}};P.convert&&(P.convertObj=new Ke(P.convert)),D.push(S)}))}),D.forEach(A=>{E.splice(A.index,0,A)});const z=K.utils.obj.ext(s.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return z&&z.visible!=!1&&(z.customRender=A=>V.value?(V.value.current-1)*V.value.pageSize+A.index+1:A.index,E=[z,...E]),f.value&&f.value.visible!=!1&&E.push({fixed:"right",align:"center",...f.value,name:"operation"}),E}),u=n.computed(()=>{if(s.value.leftBtns===!1)return[];const E=[],D=[];if((s.value.leftBtns||[]).map(A=>(typeof A=="string"&&(A={name:A,visible:!1}),A)).forEach(A=>{A.visible!=!1&&E.push(A),D.push(A.name),A.name=="delBatch"&&!g.value&&(A.visible=!1)}),!D.includes("add")){const A={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};E.splice(0,0,A)}if(!D.includes("delBatch")&&g.value){const A={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};E.splice(1,0,A)}if(l.editor&&l.editor.type.value!="code"){const A=E.filter(q=>q.name=="add")[0];if(A.visible&&(A.action||(A.action={}),A.action.type||(A.action.type="route"),!A.action.href)){const q=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",P=l.editor.model.value;A.action.link=i.addPageUrl+"?psn="+q+"&model="+P}}return E});function m({btn:E,event:D}){if(i.isDebug&&console.log("unione table left btn click",E,D),E.name=="delBatch"){if(!p.value.selectedRowKeys.length){Y.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.deleteByIds(p.value.selectedRowKeys).then(()=>{M(),N(!0)});return}Y.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+p.value.selectedRowKeys.length+")数据",onOk:()=>{O("delBatch",{btn:E,event:D,keys:p.value.selectedRowKeys}),O("leftBtnClick",{btn:E,event:D,keys:p.value.selectedRowKeys}),O("btnClick",{btn:E,event:D,keys:p.value.selectedRowKeys})}});return}O(E.name,{btn:E,event:D}),O("leftBtnClick",{btn:E,event:D}),O("btnClick",{btn:E,event:D})}const k=n.computed(()=>{if(s.value.rightBtns===!1)return[];const E=[],D=[];if((s.value.rightBtns||[]).map(A=>(typeof A=="string"&&(A={name:A,visible:!1}),A)).forEach(A=>{A.visible!=!1&&E.push(A),D.push(A.name)}),!D.includes("impData")){const A={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};E.splice(1,0,A)}if(!D.includes("expData")){const A={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};E.splice(2,0,A)}if(!D.includes("downTmpl")){const A={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};E.splice(3,0,A)}return E});function y({btn:E,event:D}){i.isDebug&&console.log("unione table right btn click",E,D),O(E.name,{btn:E,event:D}),O("rightBtnClick",{btn:E,event:D}),O("btnClick",{btn:E,event:D})}const b=n.computed(()=>({bordered:!0,size:"small",...s.value.attrs||{}})),x=n.ref({}),v=n.ref(null),V=n.computed(()=>K.utils.obj.ext(l.pagination||s.value.pagination,{showTotal:E=>"共"+E+"记录",pageSize:l.pagination?.pageSize||d.value?.data()?.pageSize||10,current:l.pagination?.current||d.value?.data()?.page||1,total:l.pagination?.total||d.value?.data()?.total||0,position:["bottomCenter"]})),g=n.computed(()=>typeof s.value.selection<"u"?s.value.selection:!0),p=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(E,D)=>{p.value.selectedRowKeys=E,p.value.selectedRowList=D},getCheckboxProps:E=>({disabled:E.checkable})}),B=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],O=t;function C({btn:E,event:D},z){if(i.isDebug&&console.log("unione table opt btn click",E,D),E.name=="delete"){if(d.value){d.value.deleteByIds([z[r.value]]).then(()=>{M(),p.value.selectedRowKeys=p.value.selectedRowKeys.filter(A=>A!=z[r.value]),p.value.selectedRowList=p.value.selectedRowList.filter(A=>A[r.value]!=z[r.value])});return}Y.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{O(E.name,{btn:E,event:D,row:z}),O("optBtnClick",{btn:E,event:D,row:z}),O("btnClick",{btn:E,event:D,row:z})}});return}O(E.name,{btn:E,event:D,row:z}),O("optBtnClick",{btn:E,event:D,row:z}),O("btnClick",{btn:E,event:D,row:z})}function w(E,D,z,A){v.value={current:E.current,pageSize:E.pageSize},M(),O("change",{pagination:E,filters:D,sorter:z,event:A})}function N(E=!1){E?(p.value.selectedRowKeys=[],p.value.selectedRowList=[]):Y.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${p.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{p.value.selectedRowKeys=[],p.value.selectedRowList=[]}})}function M(){if(d.value){const E={page:V.value.current,pageSize:V.value.pageSize,keywords:x.value.keywords,body:x.value.params||{}};v.value&&(E.page=v.value.current,E.pageSize=v.value.pageSize),console.log("dataStorage find params",E),d.value.find(E)}}n.onMounted(()=>{l.editor?.ebus.$on("table-list-search",E=>{console.log("table-list-search",E),x.value=E||{},M()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),x.value={},M(),N(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),M()})});function T(){return{keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}}return e({getSelected:T,clearSelected:N}),(E,D)=>{const z=n.resolveComponent("unione-btn"),A=n.resolveComponent("DownOutlined"),q=n.resolveComponent("a-button"),P=n.resolveComponent("a-dropdown"),Q=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(ct,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,R=>(n.openBlock(),n.createBlock(z,{key:R.name,class:"btn",widget:R,editor:o.editor,onClick:m,preset:B,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),p.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:D[0]||(D[0]=R=>N())},"当前选中记录("+n.toDisplayString(p.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(k.value,R=>(n.openBlock(),n.createBlock(z,{key:R.name,class:"btn right",widget:R,editor:o.editor,onClick:y,preset:B,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",kr,[c.value&&c.value.length?(n.openBlock(),n.createBlock(Q,n.mergeProps({key:0,columns:c.value,rowKey:r.value,"data-source":h.value,"row-selection":g.value?p.value:null,scroll:{x:a.value.scrollX||"max-content",y:a.value.scrollY},pagination:V.value,onChange:w},b.value),{bodyCell:n.withCtx(({column:R,record:S})=>[R.name==="operation"?(n.openBlock(),n.createElementBlock("div",br,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(f.value.btns,F=>(n.openBlock(),n.createBlock(z,{key:F.name,class:"opt",widget:F,editor:o.editor,onClick:_=>C(_,S),preset:B,ctx:{row:S}},null,8,["widget","editor","onClick","ctx"]))),128)),f.value.more?.visible!=!1&&f.value.more.items?.length?(n.openBlock(),n.createBlock(P,{key:0,trigger:[f.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",f.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",f.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(f.value.more.items,F=>(n.openBlock(),n.createBlock(z,{key:F.name,class:"item",widget:F,editor:o.editor,onClick:_=>C(_,S),type:"text",preset:B,ctx:{row:S}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(q,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(f.value.more.title)+" ",1),n.createVNode(A)]),_:1})]),_:2},1032,["trigger","class"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):n.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(pr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-8fd95ebe"]]),yr={class:"page-setting-dialog"},jt=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),l=K.useSession(),s=n.computed(()=>l.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 h(){t.editor?.save().then(u=>{console.log("res",u)})}const f=n.ref("");function c(u){f.value||(f.value=i.value),u?t.editor?.setModel("edit"):t.editor?.setModel(f.value)}return(u,m)=>{const k=n.resolveComponent("SettingOutlined"),y=n.resolveComponent("a-tooltip"),b=n.resolveComponent("SaveOutlined"),x=n.resolveComponent("FormOutlined"),v=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"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{key:0,title:o.settingTitle},{default:n.withCtx(()=>[n.createVNode(k,{class:"page-setting",onClick:r})]),_:1},8,["title"])):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(b,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(x,{class:"btn-edit",onClick:m[0]||(m[0]=g=>c(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-edit",onClick:m[1]||(m[1]=g=>c(!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":m[2]||(m[2]=g=>a.value=g),centered:"",width:"85%",onOk:h},{default:n.withCtx(()=>[n.createElementVNode("div",yr,[n.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),wr={class:"unione-props-setting data-field-manage"},xr={key:0},vr={key:1},Cr={key:2},Sr={key:3},Nr={key:4},Br={key:5},Or={key:6},Vr=["onClick"],_r=["onClick"],Mr=["onClick"],Tr={key:1},Ar=te(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(m=>{i.value.selectedRowKeys.includes(m)||i.value.selectedRowKeys.push(m);const k=[];t.value.forEach(y=>{!u.includes(y.name)&&i.value.selectedRowKeys.includes(y.name)&&k.push(y.name)}),k.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(y=>!k.includes(y)))})}}),l={mounted:u=>u.focus()},s=n.ref({});function a(){const u=Object.keys(s.value);if(u.length)for(let m in u){const k=t.value.filter(y=>y.name==m);if(k&&k[0]){let y=s.value[m];Object.keys(y).forEach(b=>{k[0][b]=y[b]})}}s.value={}}function r(u,m){a();const k={};k[m]=u[m]||"",s.value[u.name]=k}function d(u,m){if(!u||!m){s.value={};return}const k=s.value[u.name][m];if(m=="name"&&t.value.filter(b=>b[m]==k&&b.name!=u.name).length>0){Y.Modal.warn({title:"提示信息",content:"字段名称["+k+"]已存在"});return}u[m]=k,s.value={}}function h(u,m){t.value.filter(y=>y.name==u.name).forEach(y=>{y[m]=!y[m]})}function f(){if(a(),t.value.filter(k=>k.name=="new_").length>0){s.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};t.value.push(m),s.value[m.name]={name:"new_"}}function c(){if(!i.value.selectedRowKeys.length){Y.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}Y.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,m)=>{const k=n.resolveComponent("a-button"),y=n.resolveComponent("a-tooltip"),b=n.resolveComponent("a-input"),x=n.resolveComponent("a-input-number"),v=n.resolveComponent("a-select-option"),V=n.resolveComponent("a-select"),g=n.resolveComponent("a-checkbox"),p=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",wr,[n.createVNode(k,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>m[1]||(m[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(k,{class:"btn btn-delete",type:"primary",danger:"",onClick:c,size:"small"},{default:n.withCtx(()=>m[2]||(m[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(p,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:n.withCtx(({column:B})=>[B.key==="name"?(n.openBlock(),n.createElementBlock("span",xr,[m[3]||(m[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="title"?(n.openBlock(),n.createElementBlock("span",vr,[m[4]||(m[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="descs"?(n.openBlock(),n.createElementBlock("span",Cr,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Br,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Or,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="isPk"?(n.openBlock(),n.createBlock(y,{key:7,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[m[5]||(m[5]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="isFk"?(n.openBlock(),n.createBlock(y,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="isNull"?(n.openBlock(),n.createBlock(y,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="syncDbEnable"?(n.openBlock(),n.createBlock(y,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:B,text:O,record:C})=>[["name","title","descs","defaultValue"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!O&&"empty"]),onClick:w=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(b,{key:0,value:s.value[C.name][B.dataIndex],"onUpdate:value":w=>s.value[C.name][B.dataIndex]=w,onBlur:w=>d(C,B.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(O||" "),1)],64))],10,Vr)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!O&&"empty"]),onClick:w=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:s.value[C.name][B.dataIndex],"onUpdate:value":w=>s.value[C.name][B.dataIndex]=w,onBlur:w=>d(C,B.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(O||" "),1)],64))],10,_r)):["dataType"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!O&&"empty"]),onClick:w=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(V,{key:0,value:C[B.dataIndex],"onUpdate:value":w=>C[B.dataIndex]=w,onBlur:m[0]||(m[0]=w=>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"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Tr,n.toDisplayString(O),1))],10,Mr)):["syncDbEnable","isFk","isPk"].includes(B.dataIndex)?(n.openBlock(),n.createBlock(g,{key:3,checked:C[B.dataIndex],onClick:w=>h(C,B.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(B.dataIndex)?(n.openBlock(),n.createBlock(g,{key:4,checked:!C[B.dataIndex],onClick:w=>h(C,B.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Er={class:"unione-props-setting data-field-setting"},Ir={key:0},Dr=["onClick"],Pr={class:"field-txt"},Fr=["onClick"],$r={key:1,class:"field-txt"},Rr=["onClick"],Lr={key:1},jr=["onClick"],zr={key:0,class:"field-txt"},qr={key:4,class:"edit-field"},Ur={key:0},Wr=["onClick"],Hr=te(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:x})=>x+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),t=n.useModel(o,"modelValue"),i={mounted:x=>x.focus()},l=n.ref({});function s(){const x=Object.keys(l.value);if(x.length)for(let v in x){const V=t.value.filter(g=>g.name==v);if(V&&V[0]){let g=l.value[v];Object.keys(g).forEach(p=>{p=="convertName"?(V[0].convert||(V[0].convert={}),V[0].convert.type=g[p]):V[0][p]=g[p]})}}l.value={}}function a(x,v){s();const V={};v=="convertName"?(x.convert||(x.convert={}),V[v]=x.convert?.type):V[v]=x[v]||"",l.value[x.name]=V}function r(x,v){{l.value={};return}}function d(x,v){t.value.filter(g=>g.name==x.name).forEach(g=>{g[v]=!g[v]})}const h=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function f(x,v){const V=t.value.filter(p=>p.name==x.name);V.forEach(p=>{v!="isSort"?p[v]=!0:p[v]=!p[v]});const g=V[0];if(!(!g||v=="isSort")){switch(h.value.prop=v,h.value.field=x,g.show||(g.show={}),v){case"isQuery":g.show.query||(g.show.query={}),h.value.show=g.show.query,h.value.title=`查询设置/${x.title}(${x.name})`;break;case"isForm":g.show.form||(g.show.form={}),h.value.show=g.show.form,h.value.title=`表单设置/${x.title}(${x.name})`;break;case"isView":g.show.view||(g.show.view={}),h.value.show=g.show.view,h.value.title=`详情设置/${x.title}(${x.name})`;break;case"isList":g.show.list||(g.show.list={}),h.value.show=g.show.list,h.value.title=`列头设置/${x.title}(${x.name})`;break}h.value.visible=!0}}const c=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:x=>{const v=c.value.options.filter(V=>V.value==x);return v[0]?v[0].label:x}}),u=n.ref({visible:!1,field:{},props:{},showInfo:x=>{let v="";return x.rules&&(v=x.rules.filter(V=>V.enable).length||""),v&&(v="("+v+")"),v},toSetting:()=>{const x=u.value.props,v={name:"range",trigger:x.trigger,whitespace:x.whitespace,message:x.rangeMessage};x.rangeMin!=null&&x.rangeMin!=null&&(v.min=x.rangeMin,v.enable=!0),x.rangeMax!=null&&x.rangeMax!=null&&(v.max=x.rangeMax,v.enable=!0);const V={name:"reg",trigger:x.trigger,whitespace:x.whitespace,message:x.regMessage};x.regExpress&&(V.pattern=x.regExpress,V.enable=!0),u.value.field.rules=[v,V],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function m(x){u.value.visible=!0,u.value.field=x;const v=x.rules||[],V={trigger:"change",whitespace:!0};v.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 k=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 v=k.value.widgets.filter(V=>V.value==x);return v[0]?v[0].label:x},toSetting:()=>{}}),y=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(x,v)=>{y.value.convert.options.splice(x,1)},toSetting:()=>{y.value.visible=!1}});function b(x){y.value.visible=!0,y.value.field=x,y.value.convert=x.convert||{}}return(x,v)=>{const V=n.resolveComponent("ToolOutlined"),g=n.resolveComponent("a-button"),p=n.resolveComponent("a-select"),B=n.resolveComponent("a-checkbox"),O=n.resolveComponent("a-table"),C=n.resolveComponent("a-input-number"),w=n.resolveComponent("a-form-item"),N=n.resolveComponent("a-input"),M=n.resolveComponent("a-form"),T=n.resolveComponent("a-modal"),E=n.resolveComponent("a-col"),D=n.resolveComponent("a-row"),z=n.resolveComponent("a-select-option"),A=n.resolveComponent("a-divider"),q=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Er,[n.createVNode(O,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:P})=>[["widget","queryType","rules","convertName"].includes(P.key)?(n.openBlock(),n.createElementBlock("span",Ir,[n.createVNode(V),n.createTextVNode(" "+n.toDisplayString(P.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:P,text:Q,record:R})=>[["rules"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!u.value.showInfo(R)&&"empty"]),onClick:S=>m(R)},[n.createElementVNode("span",Pr,n.toDisplayString(u.value.showInfo(R)),1),u.value.showInfo(R)?(n.openBlock(),n.createBlock(g,{key:0,type:"link"},{default:n.withCtx(()=>v[22]||(v[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Dr)):["widget"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[R.name]||!Object.keys(l.value[R.name]).includes(P.dataIndex))&&!Q&&"empty"]),onClick:S=>a(R,P.dataIndex)},[l.value[R.name]&&Object.keys(l.value[R.name]).includes(P.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:R[P.dataIndex],"onUpdate:value":S=>R[P.dataIndex]=S,allowClear:!0,options:k.value.widgets,onBlur:v[0]||(v[0]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",$r,n.toDisplayString(k.value.widgetName(Q)),1))],10,Fr)):["queryType"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[R.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[R.name]||!Object.keys(l.value[R.name]).includes(P.dataIndex))&&!Q&&"empty"]),onClick:S=>a(R,P.dataIndex)},[l.value[R.name]&&Object.keys(l.value[R.name]).includes(P.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:R[P.dataIndex],"onUpdate:value":S=>R[P.dataIndex]=S,allowClear:!0,options:c.value.options,onBlur:v[1]||(v[1]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Lr,n.toDisplayString(c.value.showLabel(Q)),1))],10,Rr)):n.createCommentVNode("",!0)],64)):["convertName"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[R.name]||!Object.keys(l.value[R.name]).includes(P.dataIndex))&&!R.convert?.type&&"empty"]),onClick:S=>a(R,P.dataIndex)},[l.value[R.name]&&Object.keys(l.value[R.name]).includes(P.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:R.convert.type,"onUpdate:value":S=>R.convert.type=S,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:v[2]||(v[2]=S=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[R.convert?.type?(n.openBlock(),n.createElementBlock("span",zr,n.toDisplayString(R.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),R.convert?.type?(n.openBlock(),n.createBlock(g,{key:1,type:"link",onClick:n.withModifiers(S=>b(R),["stop"])},{default:n.withCtx(()=>v[23]||(v[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,jr)):["isQuery","isForm","isView","isList","isSort"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",qr,[n.createVNode(B,{checked:R[P.dataIndex],onClick:S=>d(R,P.dataIndex)},null,8,["checked","onClick"]),n.createVNode(g,{type:"link",onClick:S=>f(R,P.dataIndex)},{default:n.withCtx(()=>v[24]||(v[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(T,{visible:h.value.visible,"onUpdate:visible":v[9]||(v[9]=P=>h.value.visible=P),title:h.value.title,onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(w,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(C,{value:h.value.show.index,"onUpdate:value":v[3]||(v[3]=P=>h.value.show.index=P)},null,8,["value"])]),_:1}),["isQuery"].includes(h.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(w,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.width,"onUpdate:value":v[4]||(v[4]=P=>h.value.show.width=P)},null,8,["value"])]),_:1})),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(w,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.labelWidth,"onUpdate:value":v[5]||(v[5]=P=>h.value.show.labelWidth=P)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(w,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.valueWidth,"onUpdate:value":v[6]||(v[6]=P=>h.value.show.valueWidth=P)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(w,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(p,{value:h.value.show.fixed,"onUpdate:value":v[7]||(v[7]=P=>h.value.show.fixed=P),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(w,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(p,{value:h.value.show.align,"onUpdate:value":v[8]||(v[8]=P=>h.value.show.align=P),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(T,{visible:y.value.visible,"onUpdate:visible":v[11]||(v[11]=P=>y.value.visible=P),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[y.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",Ur,[n.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:n.withCtx(()=>v[25]||(v[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(O,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:P,text:Q,record:R,index:S})=>[P.dataIndex==="label"?(n.openBlock(),n.createBlock(N,{key:0,value:R.label,"onUpdate:value":F=>R.label=F,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),P.dataIndex==="value"?(n.openBlock(),n.createBlock(N,{key:1,value:R.value,"onUpdate:value":F=>R.value=F,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),P.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:F=>y.value.toDelOption(S,R)},"删除",8,Wr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),y.value.convert.type=="dict"?(n.openBlock(),n.createBlock(M,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(D,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(E,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(w,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(N,{value:y.value.convert.dict,"onUpdate:value":v[10]||(v[10]=P=>y.value.convert.dict=P)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(T,{visible:k.value.visible,"onUpdate:visible":v[13]||(v[13]=P=>k.value.visible=P),title:"控件设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:k.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[k.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(w,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(p,{value:k.value.props.mode,"onUpdate:value":v[12]||(v[12]=P=>k.value.props.mode=P),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(z,{value:"multiple"},{default:n.withCtx(()=>v[26]||(v[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(z,{value:"tags"},{default:n.withCtx(()=>v[27]||(v[27]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(T,{visible:u.value.visible,"onUpdate:visible":v[21]||(v[21]=P=>u.value.visible=P),title:"规则设置",onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(A,{orientation:"left"},{default:n.withCtx(()=>v[28]||(v[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(w,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(q,{value:u.value.props.trigger,"onUpdate:value":v[14]||(v[14]=P=>u.value.props.trigger=P),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(B,{value:u.value.props.whitespace,"onUpdate:value":v[15]||(v[15]=P=>u.value.props.whitespace=P),checked:u.value.props.whitespace},{default:n.withCtx(()=>v[29]||(v[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(A,{orientation:"left"},{default:n.withCtx(()=>v[30]||(v[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(w,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(C,{value:u.value.props.rangeMin,"onUpdate:value":v[16]||(v[16]=P=>u.value.props.rangeMin=P)},null,8,["value"]),v[31]||(v[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(C,{value:u.value.props.rangeMax,"onUpdate:value":v[17]||(v[17]=P=>u.value.props.rangeMax=P)},null,8,["value"])]),_:1}),n.createVNode(w,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.rangeMessage,"onUpdate:value":v[18]||(v[18]=P=>u.value.props.rangeMessage=P)},null,8,["value"])]),_:1}),n.createVNode(A,{orientation:"left"},{default:n.withCtx(()=>v[32]||(v[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(w,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regExpress,"onUpdate:value":v[19]||(v[19]=P=>u.value.props.regExpress=P)},null,8,["value"])]),_:1}),n.createVNode(w,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regMessage,"onUpdate:value":v[20]||(v[20]=P=>u.value.props.regMessage=P)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Kr={class:"unione-props-setting data-field"},Qr=te(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 l=n.resolveComponent("OrderedListOutlined"),s=n.resolveComponent("a-tab-pane"),a=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Kr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(s,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(l),i[2]||(i[2]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(Ar,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=d=>e.value=d)},null,8,["modelValue"])]),_:1}),n.createVNode(s,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(a),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Hr,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Gr={key:0,class:"data-model-list"},Yr=["onClick"],Xr=te(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(o,{expose:e}){const t=n.computed(()=>l.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const l=o;function s(c){i.value=c}function a(){if(t.value.length>=l.limit){Y.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const c=sa.v4(),u={sn:c,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),l.editor.dataModel(c,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},d=n.ref(),h=n.inject("closeSetting");function f(){d.value.validate().then(c=>{h&&h()})}return e({toSaving:f}),(c,u)=>{const m=n.resolveComponent("a-input"),k=n.resolveComponent("a-form-item"),y=n.resolveComponent("a-textarea"),b=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(n.openBlock(),n.createElementBlock("div",Gr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,x=>(n.openBlock(),n.createElementBlock("div",{key:x.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==x.sn&&"slt"]),onClick:v=>s(x)},n.toDisplayString(x.title),11,Yr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:a},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[n.createVNode(b,{ref_key:"formObj",ref:d,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:n.withCtx(()=>[n.createVNode(k,{label:"数据标题",name:"title",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.title,"onUpdate:value":u[0]||(u[0]=x=>i.value.title=x)},null,8,["value"])]),_:1}),n.createVNode(k,{label:"数据名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.name,"onUpdate:value":u[1]||(u[1]=x=>i.value.name=x)},null,8,["value"])]),_:1}),n.createVNode(k,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.url,"onUpdate:value":u[2]||(u[2]=x=>i.value.url=x)},null,8,["value"])]),_:1}),n.createVNode(k,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(y,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=x=>i.value.descs=x)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Qr,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=x=>i.value.fields=x)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Jr={class:"unione-props-setting unione-page-setting"},zt=te(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,l)=>{const s=n.resolveComponent("a-form-item"),a=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),h=n.resolveComponent("a-form"),f=n.resolveComponent("a-tab-pane"),c=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Jr,[n.createVNode(c,{type:"card"},{default:n.withCtx(()=>[n.createVNode(f,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(h,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(n.openBlock(),n.createBlock(s,{key:0,label:"页面编码"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.value.sn)+"/V"+n.toDisplayString(t.value.vers),1)]),_:1})):n.createCommentVNode("",!0),n.createVNode(s,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=u=>t.value.title=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=u=>t.value.component=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=u=>t.value.icon=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"是否全局"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>t.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"是否模版"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>t.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=u=>t.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),n.createVNode(f,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Xr,{editor:o.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Sl=te(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 xt,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(s.value,a)});const s=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),s.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel("run"),i.load(s.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Zr={class:"form-btns"},Nl=n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new xt,s=n.computed(()=>l.$widgetList.value||[]),a=n.computed(()=>{const c=l.define.value?.configs?.btns||[],u=c.map(m=>m.name);if(!u.includes("save")){const m={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};c.splice(m.index,0,m)}if(!u.includes("submit")){const m={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let k=m.index||1;c.splice(k,0,m)}if(!u.includes("reset")){const m={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};c.splice(m.index,0,m)}if(!u.includes("back")){const m={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};c.splice(m.index,0,m)}return l.model.value=="view"&&c.filter(m=>["save","submit","reset"].includes(m.name)).forEach(m=>{m.visible=!1}),c});function r({btn:c,event:u}){c.name=="save"&&d(),c.name=="reset",c.name=="back"&&h()}async function d(){const c=l.dataManager().form();let u={};for(let m in c){const k=await c[m].validate();if(l.dataManager().psn()==m){for(let y in u)k[y]=u[y];u=k}else u[m]=k}console.log("=======form data=====",u),l.dataManager().primary().save({data:u,params:l.dataManager().params}).then(m=>{console.log("save result:",m)})}function h(){e.back()}n.watch(()=>t.pageDefine,c=>{c&&l.load(f.value,c)});const f=n.ref("new_");return n.onMounted(()=>{const c=n.inject("route");console.log("unione page view route",c),f.value=t.psn||c?.query?.psn||c?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),l.setModel(c?.query?.model||c?.meta?.model||"run"),c?.query&&l.dataManager().params(c.query),l.load(f.value,t.pageDefine||i)}),(c,u)=>{const m=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(jt,{class:"unione-page-form","setting-title":"页面设置",editor:n.unref(l)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,k=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(k.widget),{key:k.wid,wid:k.wid,widget:k,editor:n.unref(l)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",Zr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,k=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:k.name},[k.visible!=!1?(n.openBlock(),n.createBlock(m,{key:0,widget:k,editor:n.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(l)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),ed=["onMouseover"],td={key:0,class:"node-opts"},id={class:"form-warp"},nd={class:"form-btns"},Bl=n.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick"],setup(o,{emit:e}){const t=K.useDialog(),i=n.inject("router"),l=o,s={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function a(){if(l.fields?.length){const S={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};s.configs.widgets=[S],s.configs.dsnList=["primary"],r.dataManager().use("primary","form").store(l.storage)}s.configs.btns=l.btns||[],l.btns==!1&&(s.configs.btns=!1),s.configs.opts=l.opts||[],l.opts==!1&&(s.configs.opts=!1),s.configs.event=l.event||{},s.configs.setting=l.setting||{}}const r=new xt,d=n.ref(!1),h=n.ref([]),f=n.ref({}),c=n.ref(null),u=n.ref(null),m=n.ref([]),k=n.ref([]),y=n.ref(0),b=n.computed(()=>{const S={disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"parentId",labelField:"title",leafField:"isLeaf",...l.setting?.tree||{}};return r.define.value?.configs?.tree||S}),x=n.computed(()=>{const S=r.define.value?.configs?.opts;if(typeof S=="boolean"&&S==!1)return!1;const F=(S||[]).map(I=>typeof I=="string"?{name:I,visible:!1}:I),_=[];return F.forEach(I=>{_.push(I.name)}),console.log("opts addBtn",F),F.filter(I=>I.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),v=n.computed(()=>{const S=r.define.value?.configs?.opts;if(typeof S=="boolean"&&S==!1)return[];const F=(S||[]).map(H=>typeof H=="string"?{name:H,visible:!1}:H),_=[],I=[];return F.forEach(H=>{I.push(H.name),H.name!="add"&&_.push(H)}),I.includes("delete")||_.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),I.includes("child")||_.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",_),_});function V({btn:S,event:F},_){F.stopPropagation();const I=f.value[_[b.value.idField]];if(console.log("onTreeMenuClick,btn:",S),console.log("onTreeMenuClick,node:",_),console.log("onTreeMenuClick,curentNode:",I),S.name=="child"){const H=f.value[I[b.value.idField]];H.isLeaf=!1,c.value={},c.value[b.value.pidField]=H[b.value.idField],c.value[b.value.labelField]="新建...",c.value[b.value.idField]="new_"+y.value,c.value.parentNode=H,y.value=y.value+1,H.children||(H.children=[],k.value.push(H[b.value.idField])),E.value.createNode&&E.value.createNode(c.value,H,r.dataManager().params()),f.value[c.value[b.value.idField]]=c.value,H.children.push(c.value),m.value=[c.value[b.value.idField]],r.dataManager().primary().setValue(c.value)}S.name=="delete"&&(I[b.value.idField]&&(I[b.value.idField]+"").startsWith("new_")?(I.parentNode?I.parentNode.children=I.parentNode.children.filter(H=>H[b.value.idField]!=I[b.value.idField]):h.value=h.value.filter(H=>H[b.value.idField]!=I[b.value.idField]),delete f.value[I[b.value.idField]]):r.dataManager().primary().deleteByIds([I[b.value.idField]]).then(()=>{if(I.parentNode){const H=f.value[I[b.value.pidField]];H.children=H.children.filter(Fe=>Fe[b.value.idField]!=I[b.value.idField])}else h.value=h.value.filter(H=>H[b.value.idField]!=I[b.value.idField]);delete f.value[I[b.value.idField]]}))}function g(S,{expanded:F,node:_}){F&&(c.value=_.dataRef,r.dataManager().primary().setValue(c.value),M())}function p(S,F){F.selected?(c.value=F.node.dataRef,r.dataManager().primary().setValue(c.value)):c.value&&(m.value=[c.value[b.value.idField]]),A("treeClick",{keys:S,event:F})}n.watch(()=>l.params,()=>{d.value&&(h.value=[],f.value={},c.value=null,m.value=[],k.value=[],y.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),M())}),n.watch(()=>c.value,()=>{console.log("active node changed",c.value),O(!c.value)});const B=n.ref(null);n.watch(B,()=>{B.value&&c.value&&r.dataManager().primary().setValue(c.value)});function O(S=!0){const F=r.dataManager().form();for(let _ in F)F[_].setDisabled(S)}function C(){if(c.value={},c.value[b.value.pidField]=-1,c.value[b.value.labelField]="新建...",c.value[b.value.idField]="new_"+y.value,y.value=y.value+1,E.value.createNode&&E.value.createNode(c.value,null,r.dataManager().params()),c.value[b.value.pidField]==-1)h.value.push(c.value);else{const S=f.value[c.value[b.value.pidField]];S.children||(S.children=[]),S.children.push(c.value)}m.value=[c.value[b.value.idField]],f.value[c.value[b.value.idField]]=c.value,r.dataManager().primary().setValue(c.value)}const w=n.ref(""),N=xl(()=>{r.dataManager().primary().find({page:1,pageSize:9999,keywords:w.value,needCount:!1,body:{}}).then(S=>{if(f.value={},h.value=[],S.body?.length){const F={};S.body.forEach(_=>{F[_[b.value.idField]]=_}),S.body.forEach(_=>{const I=F[_[b.value.pidField]];I?(I.children||(I.children=[],I.isLeaf=!1),I.children.push(_)):h.value.push(_)})}})},400);function M(){const S={};if(S[b.value.pidField]=-1,c.value){if(c.value.children?.length)return;S[b.value.pidField]=c.value[b.value.idField],r.dataManager().primary().find({page:1,pageSize:999,body:S}).then(F=>{c.value.children=F.body||[],c.value.children.forEach(_=>{_.isLeaf=!!_[b.value.leafField],f.value[_[b.value.idField]]=_,_.parentNode=f.value[_[b.value.pidField]]})})}else r.dataManager().primary().find({page:1,pageSize:999,body:S}).then(F=>{h.value=F.body||[],h.value.forEach(_=>{_.isLeaf=!!_[b.value.leafField],f.value[_[b.value.idField]]=_})})}const T=n.computed(()=>r.$widgetList.value||[]),E=n.computed(()=>{const S={...r.define.value?.configs?.event||{}};for(const F in S)S[F]&&typeof S[F]!="function"&&S[F].enable&&S[F].scriptText&&(F=="createNode"?S[F]=new Function("node","parent","params",S[F].scriptText):S[F]=new Function("data","event",S[F].scriptText));return S}),D=n.computed(()=>r.define.value?.configs?.setting||l.setting||{});n.provide("pageSetting",D.value);const z=n.computed(()=>{const S=r.define.value?.configs?.btns;if(typeof S=="boolean"&&S==!1)return[];const F=(r.define.value?.configs?.btns||[]).map(I=>typeof I=="string"?{name:I,visible:!1}:{size:"default",...I}),_=F.map(I=>I.name);if(!_.includes("save")){const I={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};F.splice(I.index,0,I)}if(!_.includes("reset")){const I={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};F.splice(I.index,0,I)}if(!_.includes("back")){const I={title:"返回",type:"default",index:F.length,visible:!0,size:"default",name:"back"};F.splice(I.index,0,I)}return r.model.value=="view"&&F.filter(I=>["save","submit","reset"].includes(I.name)).forEach(I=>{I.visible=!1}),F}),A=e;function q({btn:S,event:F}){S.name=="save"&&P({btn:S,event:F}),S.name=="reset",S.name=="back"&&Q(),A("btnClick",{btn:S,event:F})}async function P(S){const F=r.dataManager().form();let _={...c.value};for(let I in F){const H=await F[I].validate();if(r.dataManager().psn()==I)for(let Fe in H)_[Fe]=H[Fe];else _[I]=H}if(_[b.value.pidField]&&(_[b.value.pidField]+"").startsWith("new_")){t.error({content:"请先保存父节点!"});return}_[b.value.idField]&&(_[b.value.idField]+"").startsWith("new_")&&delete _[b.value.idField],delete _.parentNode,delete _.children,_[b.value.leafField]=_[b.value.leafField]?1:0,E.value.preSave&&E.value.preSave(_,S),console.log("=======form data=====",_),r.dataManager().primary().save({data:_}).then(I=>{console.log("save result:",I),c.value[b.value.idField]=I.body,m.value=[I.body],f.value[I.body]=c.value,c.value.children?.forEach(H=>{H[b.value.pidField]=I.body}),E.value.postSaved&&E.value.postSaved(_,S)})}function Q(){i.back()}const R=n.ref("new_");return n.onMounted(()=>{const S=n.inject("route");console.log("unione page tree route",S),R.value=l.psn||S?.query?.psn||S?.meta?.psn||"new_",console.log("unione page tree,psn:"+R.value),r.setModel(S?.query?.model||S?.meta?.model||"run");const F={...l.params||{},...S?.query||{},...S?.params||{}};r.dataManager().params(F),a(),r.load(R.value,s),n.nextTick(()=>{O(!0)}),M(),d.value=!0}),(S,F)=>{const _=n.resolveComponent("SearchOutlined"),I=n.resolveComponent("a-input"),H=n.resolveComponent("unione-btn"),Fe=n.resolveComponent("a-tree");return n.openBlock(),n.createBlock(jt,{class:"unione-page-tree","setting-title":"页面设置",editor:n.unref(r)},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",{class:"tree-warp",onContextmenu:F[4]||(F[4]=n.withModifiers(()=>{},["prevent"]))},[n.createVNode(I,{size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:w.value,"onUpdate:value":F[0]||(F[0]=$=>w.value=$),onChange:n.unref(N),onPressEnter:n.unref(N)},{suffix:n.withCtx(()=>[n.createVNode(_)]),_:1},8,["value","onChange","onPressEnter"]),x.value?(n.openBlock(),n.createBlock(H,{key:0,widget:x.value,onClick:C},null,8,["widget"])):n.createCommentVNode("",!0),n.createVNode(Fe,{"show-line":b.value.showLine,"show-icon":b.value.showIcon,disabled:b.value.disabled,blockNode:!0,draggable:b.value.draggable,multiple:b.value.multiple,selectable:b.value.selectable,checkable:b.value.checkable,fieldNames:{title:b.value.labelField,key:b.value.idField},selectedKeys:m.value,"onUpdate:selectedKeys":F[2]||(F[2]=$=>m.value=$),expandedKeys:k.value,"onUpdate:expandedKeys":F[3]||(F[3]=$=>k.value=$),"tree-data":h.value,onExpand:g,onSelect:p},n.createSlots({icon:n.withCtx(({dataRef:$})=>[$.iconName?(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.iconName),{key:0})):n.createCommentVNode("",!0)]),_:2},[v.value?.length?{name:"title",fn:n.withCtx(({dataRef:$})=>[n.createElementVNode("div",{class:"node-label",onMouseover:()=>u.value=$,onMouseleave:F[1]||(F[1]=()=>u.value=null)},[n.createElementVNode("span",null,n.toDisplayString($[b.value.labelField]),1),c.value&&c.value[b.value.idField]==$[b.value.idField]||u.value&&u.value[b.value.idField]==$[b.value.idField]?(n.openBlock(),n.createElementBlock("div",td,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v.value,Ve=>(n.openBlock(),n.createBlock(H,{key:Ve.name,widget:Ve,ctx:{node:$},onClick:ee=>V(ee,$)},null,8,["widget","ctx","onClick"]))),128))])):n.createCommentVNode("",!0)],40,ed)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),n.createElementVNode("div",id,[n.renderSlot(S.$slots,"form-warp",{class:"form-warp"},()=>[n.createElementVNode("div",{ref_key:"formWarp",ref:B},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,$=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.widget),{key:$.wid,wid:$.wid,widget:$,editor:n.unref(r)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",nd,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.value,$=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:$.name},[$.visible!=!1?(n.openBlock(),n.createBlock(H,{key:0,widget:$,editor:n.unref(r),disabled:!c.value,ctx:{},onClick:q},null,8,["widget","editor","disabled"])):n.createCommentVNode("",!0)],64))),128))])],512)])])]),_:2},[n.unref(r)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Ol=n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(o,{expose:e,emit:t}){const i=o,l={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function s(){if(i.fields?.length){l.configs.widgets[0].dsn="primary",l.configs.widgets[0].fields=i.fields.filter(y=>y.isQuery),l.configs.widgets[0].btns=i.queryBtns||[],l.configs.widgets[0].params=i.params||{},l.configs.dsnList=["primary"],l.configs.widgets[1].dsn="primary";const k=i.fields.filter(y=>y.isPk)[0];k&&k.name&&(l.configs.widgets[1].dataKey=k.name),l.configs.widgets[1].columns=i.fields.filter(y=>y.hidden!=!0),l.configs.widgets[1].operation=K.utils.obj.ext(l.configs.widgets[1].operation,i.operation||{}),l.configs.widgets[1].leftBtns=i.leftBtns==!1?!1:i.leftBtns||[],l.configs.widgets[1].rightBtns=i.rightBtns==!1?!1:i.rightBtns||[],a.dataManager().use("primary","list").store(i.storage)}}const a=new xt,r=n.computed(()=>a.$widgetList.value||[]),d=t;function h(k){d("btnClick",k)}const f=n.ref("new_");n.onMounted(()=>{const k=n.inject("route");console.log("unione page view route",k),f.value=i.psn||k?.query?.psn||k?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),a.setModel(k?.query?.model||k?.meta?.model||"run");const y={...i.params||{},...k?.query||{},...k?.params||{}};a.dataManager().params(y),s(),a.load(f.value,l)});function c(){return a.dataManager().use("primary","list")}function u(k){k?a.ebus.$emit("table-list-search",k):a.ebus.$emit("table-list-reload")}function m(k){a.dataManager().params(k),a.ebus.$emit("query-form-params",k),a.ebus.$emit("table-list-search",{params:k})}return e({storage:c,editor:a,reload:u,setParams:m}),(k,y)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(a)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,b=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:n.unref(a),onBtnClick:h},null,40,["wid","widget","editor"]))),128))]),_:2},[n.unref(a)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(a)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),ht={release(o){return K.axios.admin({url:"/api/data/define/release",method:"post",data:o})},find(o){return K.axios.admin({url:"/api/data/define/find",method:"post",data:o})},save(o){return K.axios.admin({url:"/api/data/define/save",method:"post",data:o})},delete(o){return K.axios.admin({url:"/api/data/define/delete",method:"post",data:o})},detail(o){return K.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:o})},loadFromDb(o){return K.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})},impFromDb(o){return K.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})}},ld={class:"unione-page list-page"},sd=te(n.defineComponent({__name:"list",setup(o){const e=Ee(),t=K.useDialog(),i=n.inject("router"),l=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),s=n.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});n.onMounted(()=>{r()});const a=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){a.value.loading=!0,ht.find({page:a.value.pagination.current,pageSize:a.value.pagination.pageSize,body:a.value.params,keywords:a.value.keywords}).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 h({params:g,keywords:p}){a.value.pagination.current=1,a.value.params=g,a.value.keywords=p,r()}function f({btn:g,event:p,row:B}){console.log("table btn click",g,p,B),(g.name=="add"||g.name=="edit")&&i.push({path:"/system/data/define/edit",query:B?{id:B.id}:{}}),g.name=="impFromDb"&&(u.value=!0),g.name=="release"&&c(B),g.name=="view"&&i.push({path:e.listPageUrl,query:{psn:B.sn+":list",model:"preview"}})}function c(g){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ht.release([g.id]).then(p=>{p.success?(t.success({title:"发布成功",content:p.body}),r()):t.error({title:"发布失败",content:p.body})})}})}const u=n.ref(!1),m=n.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),k=n.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),y=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function b(g){!g||!Object.keys(g).length||!g.dsId||(Y.message.loading("数据加载中..."),y.value.params=g,y.value.loading=!0,ht.loadFromDb(g).then(p=>{y.value.loading=!1,Y.message.destroy(),p.success?(p.body.forEach(B=>{B.checkable=!!B.id}),y.value.data=p.body,y.value.pagination.total=p.body.length):Y.message.error(p.message)}))}function x(g){y.value.pagination.current=g.pagination.current,y.value.pagination.pageSize=g.pagination.pageSize}const v=n.ref();function V({btn:g}){if(g.name!="imp")return;const p=v.value.getSelected();p?.keys?.length?t.confirm({content:"确定导入选中的"+p.keys.length+"条记录么?",onOk:()=>{Y.message.loading("数据导入中..."),ht.impFromDb({dsId:y.value.params.dsId,tables:p.keys.join()}).then(B=>{Y.message.destroy(),B.success?(t.success({content:B.message}),a.value.pagination.current=1,r()):t.error({context:B.message})})}}):t.error({content:"请选择目标记录!"})}return(g,p)=>{const B=n.resolveComponent("UnioneQuery"),O=n.resolveComponent("UnioneTable"),C=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",ld,[n.createVNode(B,{widget:l.value,onQuery:h,onReset:h},null,8,["widget"]),n.createVNode(O,{widget:s.value,dataList:a.value.data,loading:a.value.loading,pagination:a.value.pagination,onChange:d,onBtnClick:f},null,8,["widget","dataList","loading","pagination"]),n.createVNode(C,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":p[0]||(p[0]=w=>u.value=w),placement:"left"},{default:n.withCtx(()=>[n.createVNode(B,{widget:m.value,onQuery:b,onReset:b,onBtnClick:V,class:"load-table-form"},null,8,["widget"]),n.createVNode(O,{widget:k.value,dataList:y.value.data,loading:y.value.loading,pagination:y.value.pagination,onChange:x,rowKey:"name",ref_key:"loadTableObj",ref:v},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-483acb94"]]),od={class:"unione-props-setting data-field-manage"},ad={key:0},rd={key:1},dd=["onClick"],cd=["onClick"],hd=["onClick"],fd={key:1},ud=te(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:m})=>m+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=n.useModel(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(k=>{i.value.selectedRowKeys.includes(k)||i.value.selectedRowKeys.push(k);const y=[];t.value.forEach(b=>{!m.includes(b.name)&&i.value.selectedRowKeys.includes(b.name)&&y.push(b.name)}),y.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(b=>!y.includes(b)))})}}),l={mounted:m=>m.focus()},s=n.ref({});function a(){const m=Object.keys(s.value);if(m.length)for(let k in m){const y=t.value.filter(b=>b.name==k);if(y&&y[0]){let b=s.value[k];Object.keys(b).forEach(x=>{y[0][x]=b[x]})}}s.value={}}function r(m,k){a();const y={};y[k]=m[k]||"",s.value[m.name]=y}function d(m,k){if(!m||!k){s.value={};return}const y=s.value[m.name][k];if(k=="name"&&t.value.filter(x=>x[k]==y&&x.name!=m.name).length>0){Y.Modal.warn({title:"提示信息",content:"字段名称["+y+"]已存在"});return}m[k]=y,s.value={}}function h(m,k){const y=t.value.filter(b=>b.name==m.name)[0];return k=="isFk"?y.configs?.fkey?.enable:y[k]==1}function f(m,k){const y=t.value.filter(b=>b.name==m.name)[0];k=="isFk"?(y.configs||(y.configs={}),y.configs.fkey||(y.configs.fkey={}),y.configs.fkey.enable=!y.configs.fkey.enable):y[k]!=1?y[k]=1:y[k]=0}function c(){if(a(),t.value.filter(y=>y.name=="new_").length>0){s.value.new_={name:"new_"};return}const k={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(k),s.value[k.name]={name:"new_"}}function u(){if(!i.value.selectedRowKeys.length){Y.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}Y.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(m=>!i.value.selectedRowKeys.includes(m.name)),i.value.selectedRowKeys=[]}})}return(m,k)=>{const y=n.resolveComponent("a-button"),b=n.resolveComponent("a-tooltip"),x=n.resolveComponent("a-input"),v=n.resolveComponent("a-input-number"),V=n.resolveComponent("a-select-option"),g=n.resolveComponent("a-select"),p=n.resolveComponent("a-checkbox"),B=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",od,[n.createVNode(y,{class:"btn btn-add",type:"primary",onClick:c,size:"small"},{default:n.withCtx(()=>k[1]||(k[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(y,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:n.withCtx(()=>k[2]||(k[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(B,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:O})=>[["name","title"].includes(O.key)?(n.openBlock(),n.createElementBlock("span",ad,[k[3]||(k[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(O.title),1)])):n.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(O.key)?(n.openBlock(),n.createElementBlock("span",rd,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(O.title),1)])):n.createCommentVNode("",!0),O.key==="isPk"?(n.openBlock(),n.createBlock(b,{key:2,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[k[4]||(k[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(O.title),1)]),_:2},1024)):n.createCommentVNode("",!0),O.key==="isFk"?(n.openBlock(),n.createBlock(b,{key:3,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(O.title),1)]),_:2},1024)):n.createCommentVNode("",!0),O.key==="isNull"?(n.openBlock(),n.createBlock(b,{key:4,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(O.title),1)]),_:2},1024)):n.createCommentVNode("",!0),O.key==="syncEnable"?(n.openBlock(),n.createBlock(b,{key:5,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(O.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:O,text:C,record:w})=>[["name","title","descs","dataValue"].includes(O.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[w.name]||!Object.keys(s.value[w.name]).includes(O.dataIndex))&&!C&&"empty"]),onClick:N=>r(w,O.dataIndex)},[s.value[w.name]&&Object.keys(s.value[w.name]).includes(O.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:s.value[w.name][O.dataIndex],"onUpdate:value":N=>s.value[w.name][O.dataIndex]=N,onBlur:N=>d(w,O.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,dd)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(O.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[w.name]||!Object.keys(s.value[w.name]).includes(O.dataIndex))&&!C&&"empty"]),onClick:N=>r(w,O.dataIndex)},[s.value[w.name]&&Object.keys(s.value[w.name]).includes(O.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:s.value[w.name][O.dataIndex],"onUpdate:value":N=>s.value[w.name][O.dataIndex]=N,onBlur:N=>d(w,O.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,cd)):["dataType"].includes(O.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[w.name]||!Object.keys(s.value[w.name]).includes(O.dataIndex))&&!C&&"empty"]),onClick:N=>r(w,O.dataIndex)},[s.value[w.name]&&Object.keys(s.value[w.name]).includes(O.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(g,{key:0,value:w[O.dataIndex],"onUpdate:value":N=>w[O.dataIndex]=N,onBlur:k[0]||(k[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"])),[[l]]):(n.openBlock(),n.createElementBlock("span",fd,n.toDisplayString(C),1))],10,hd)):["syncEnable","isFk","isPk"].includes(O.dataIndex)?(n.openBlock(),n.createBlock(p,{key:3,checked:h(w,O.dataIndex),onClick:N=>f(w,O.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(O.dataIndex)?(n.openBlock(),n.createBlock(p,{key:4,checked:!h(w,O.dataIndex),onClick:N=>f(w,O.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Vl=1024;let pd=0,nn=class{constructor(e,t){this.from=e,this.to=t}};class J{constructor(e={}){this.id=pd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ce.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}J.closedBy=new J({deserialize:o=>o.split(" ")}),J.openedBy=new J({deserialize:o=>o.split(" ")}),J.group=new J({deserialize:o=>o.split(" ")}),J.isolate=new J({deserialize:o=>{if(o&&o!="rtl"&&o!="ltr"&&o!="auto")throw new RangeError("Invalid value for isolate: "+o);return o||"auto"}}),J.contextHash=new J({perNode:!0}),J.lookAhead=new J({perNode:!0}),J.mounted=new J({perNode:!0});class hi{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[J.mounted.id]}}const md=Object.create(null);class Ce{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):md,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Ce(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(l)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(J.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(J.group),s=-1;s<(l?l.length:0);s++){let a=t[s<0?i.name:l[s]];if(a)return a}}}}Ce.none=new Ce("",Object.create(null),0,8);class ln{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let l=null;for(let s of e){let a=s(i);a&&(l||(l=Object.assign({},i.props)),l[a[0].id]=a[1])}t.push(l?new Ce(i.name,l,i.id,i.flags):i)}return new ln(t)}}const fi=new WeakMap,_l=new WeakMap;var fe;(function(o){o[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays"})(fe||(fe={}));class de{constructor(e,t,i,l,s){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,s&&s.length){this.props=Object.create(null);for(let[a,r]of s)this.props[typeof a=="number"?a:a.id]=r}}toString(){let e=hi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.toString();l&&(t&&(t+=","),t+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new an(this.topNode,e)}cursorAt(e,t=0,i=0){let l=fi.get(this)||this.topNode,s=new an(l);return s.moveTo(e,t),fi.set(this,s._tree),s}get topNode(){return new _e(this,0,0,null)}resolve(e,t=0){let i=qt(fi.get(this)||this.topNode,e,t,!1);return fi.set(this,i),i}resolveInner(e,t=0){let i=qt(_l.get(this)||this.topNode,e,t,!0);return _l.set(this,i),i}resolveStack(e,t=0){return bd(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:s=this.length}=e,a=e.mode||0,r=(a&fe.IncludeAnonymous)>0;for(let d=this.cursor(a|fe.IncludeAnonymous);;){let h=!1;if(d.from<=s&&d.to>=l&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:dn(Ce.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new de(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new de(Ce.none,t,i,l)))}static build(e){return yd(e)}}de.empty=new de(Ce.none,[],[],0);class sn{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new sn(this.buffer,this.index)}}class tt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ce.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],l=this.set.types[t],s=l.name;if(/\W/.test(s)&&!l.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return s+"("+a.join(",")+")"}findChild(e,t,i,l,s){let{buffer:a}=this,r=-1;for(let d=e;d!=t&&!(Ml(s,l,a[d+1],a[d+2])&&(r=d,i>0));d=a[d+3]);return r}slice(e,t,i){let l=this.buffer,s=new Uint16Array(t-e),a=0;for(let r=e,d=0;r<t;){s[d++]=l[r++],s[d++]=l[r++]-i;let h=s[d++]=l[r++]-i;s[d++]=l[r++]-e,a=Math.max(a,h)}return new tt(s,a,this.set)}}function Ml(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 qt(o,e,t,i){for(var l;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 _e&&o.index<0?null:o.parent;if(!a)return o;o=a}let s=i?0:fe.IgnoreOverlays;if(i)for(let a=o,r=a.parent;r;a=r,r=a.parent)a instanceof _e&&a.index<0&&((l=r.enter(e,t,s))===null||l===void 0?void 0:l.from)!=a.from&&(o=r);for(;;){let a=o.enter(e,t,s);if(!a)return o;o=a}}class Tl{cursor(e=0){return new an(this,e)}getChild(e,t=null,i=null){let l=Al(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return Al(this,e,t,i)}resolve(e,t=0){return qt(this,e,t,!1)}resolveInner(e,t=0){return qt(this,e,t,!0)}matchContext(e){return on(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class _e extends Tl{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,l,s=0){for(let a=this;;){for(let{children:r,positions:d}=a._tree,h=t>0?r.length:-1;e!=h;e+=t){let f=r[e],c=d[e]+a.from;if(Ml(l,i,c,c+f.length)){if(f instanceof tt){if(s&fe.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,t,i-c,l);if(u>-1)return new it(new gd(a,f,e,c),null,u)}else if(s&fe.IncludeAnonymous||!f.type.isAnonymous||rn(f)){let u;if(!(s&fe.IgnoreMounts)&&(u=hi.get(f))&&!u.overlay)return new _e(u.tree,c,e,a);let m=new _e(f,c,e,a);return s&fe.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?f.children.length-1:0,t,i,l)}}}if(s&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 l;if(!(i&fe.IgnoreOverlays)&&(l=hi.get(this._tree))&&l.overlay){let s=e-this.from;for(let{from:a,to:r}of l.overlay)if((t>0?a<=s:a<s)&&(t<0?r>=s:r>s))return new _e(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Al(o,e,t,i){let l=o.cursor(),s=[];if(!l.firstChild())return s;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return s}for(;;){if(i!=null&&l.type.is(i))return s;if(l.type.is(e)&&s.push(l.node),!l.nextSibling())return i==null?s:[]}}function on(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 gd{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class it extends Tl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new it(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&fe.ExcludeBuffers)return null;let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new it(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new it(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 it(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,s=i.buffer[this.index+3];if(s>l){let a=i.buffer[this.index+1];e.push(i.slice(l,s,a)),t.push(0)}return new de(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function El(o){if(!o.length)return null;let e=0,t=o[0];for(let s=1;s<o.length;s++){let a=o[s];(a.from>t.from||a.to<t.to)&&(t=a,e=s)}let i=t instanceof _e&&t.index<0?null:t.parent,l=o.slice();return i?l[e]=i:l.splice(e,1),new kd(l,t)}class kd{constructor(e,t){this.heads=e,this.node=t}get next(){return El(this.heads)}}function bd(o,e,t){let i=o.resolveInner(e,t),l=null;for(let s=i instanceof _e?i:i.context.parent;s;s=s.parent)if(s.index<0){let a=s.parent;(l||(l=[i])).push(a.resolve(e,t)),s=a}else{let a=hi.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let r=new _e(a.tree,a.overlay[0].from+s.from,-1,s);(l||(l=[i])).push(qt(r,e,t,!1))}}return l?El(l):i}class an{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof _e)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof _e?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&fe.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(l.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,a=e<0?-1:i._tree.children.length;s!=a;s+=e){let r=i._tree.children[s];if(this.mode&fe.IncludeAnonymous||r instanceof tt||!r.type.isAnonymous||rn(r))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,s=this.stack.length;s>=0;){for(let a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=s+1;break e}l=this.stack[--s]}for(let l=i;l<this.stack.length;l++)t=new it(this.buffer,t,this.stack[l]);return this.bufferNode=new it(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return on(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,s=this.stack.length-1;l>=0;s--){if(s<0)return on(this.node,e,l);let a=i[t.buffer[this.stack[s]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function rn(o){return o.children.some(e=>e instanceof tt||!e.type.isAnonymous||rn(e))}function yd(o){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=Vl,reused:s=[],minRepeatType:a=i.types.length}=o,r=Array.isArray(t)?new sn(t,t.length):t,d=i.types,h=0,f=0;function c(p,B,O,C,w,N){let{id:M,start:T,end:E,size:D}=r,z=f;for(;D<0;)if(r.next(),D==-1){let R=s[M];O.push(R),C.push(T-p);return}else if(D==-3){h=M;return}else if(D==-4){f=M;return}else throw new RangeError(`Unrecognized record size: ${D}`);let A=d[M],q,P,Q=T-p;if(E-T<=l&&(P=b(r.pos-B,w))){let R=new Uint16Array(P.size-P.skip),S=r.pos-P.size,F=R.length;for(;r.pos>S;)F=x(P.start,R,F);q=new tt(R,E-P.start,i),Q=P.start-p}else{let R=r.pos-D;r.next();let S=[],F=[],_=M>=a?M:-1,I=0,H=E;for(;r.pos>R;)_>=0&&r.id==_&&r.size>=0?(r.end<=H-l&&(k(S,F,T,I,r.end,H,_,z),I=S.length,H=r.end),r.next()):N>2500?u(T,R,S,F):c(T,R,S,F,_,N+1);if(_>=0&&I>0&&I<S.length&&k(S,F,T,I,T,H,_,z),S.reverse(),F.reverse(),_>-1&&I>0){let Fe=m(A);q=dn(A,S,F,0,S.length,0,E-T,Fe,Fe)}else q=y(A,S,F,E-T,z-E)}O.push(q),C.push(Q)}function u(p,B,O,C){let w=[],N=0,M=-1;for(;r.pos>B;){let{id:T,start:E,end:D,size:z}=r;if(z>4)r.next();else{if(M>-1&&E<M)break;M<0&&(M=D-l),w.push(T,E,D),N++,r.next()}}if(N){let T=new Uint16Array(N*4),E=w[w.length-2];for(let D=w.length-3,z=0;D>=0;D-=3)T[z++]=w[D],T[z++]=w[D+1]-E,T[z++]=w[D+2]-E,T[z++]=z;O.push(new tt(T,w[2]-E,i)),C.push(E-p)}}function m(p){return(B,O,C)=>{let w=0,N=B.length-1,M,T;if(N>=0&&(M=B[N])instanceof de){if(!N&&M.type==p&&M.length==C)return M;(T=M.prop(J.lookAhead))&&(w=O[N]+M.length+T)}return y(p,B,O,C,w)}}function k(p,B,O,C,w,N,M,T){let E=[],D=[];for(;p.length>C;)E.push(p.pop()),D.push(B.pop()+O-w);p.push(y(i.types[M],E,D,N-w,T-N)),B.push(w-O)}function y(p,B,O,C,w=0,N){if(h){let M=[J.contextHash,h];N=N?[M].concat(N):[M]}if(w>25){let M=[J.lookAhead,w];N=N?[M].concat(N):[M]}return new de(p,B,O,C,N)}function b(p,B){let O=r.fork(),C=0,w=0,N=0,M=O.end-l,T={size:0,start:0,skip:0};e:for(let E=O.pos-p;O.pos>E;){let D=O.size;if(O.id==B&&D>=0){T.size=C,T.start=w,T.skip=N,N+=4,C+=4,O.next();continue}let z=O.pos-D;if(D<0||z<E||O.start<M)break;let A=O.id>=a?4:0,q=O.start;for(O.next();O.pos>z;){if(O.size<0)if(O.size==-3)A+=4;else break e;else O.id>=a&&(A+=4);O.next()}w=q,C+=D,N+=A}return(B<0||C==p)&&(T.size=C,T.start=w,T.skip=N),T.size>4?T:void 0}function x(p,B,O){let{id:C,start:w,end:N,size:M}=r;if(r.next(),M>=0&&C<a){let T=O;if(M>4){let E=r.pos-(M-4);for(;r.pos>E;)O=x(p,B,O)}B[--O]=T,B[--O]=N-p,B[--O]=w-p,B[--O]=C}else M==-3?h=C:M==-4&&(f=C);return O}let v=[],V=[];for(;r.pos>0;)c(o.start||0,o.bufferStart||0,v,V,-1,0);let g=(e=o.length)!==null&&e!==void 0?e:v.length?V[0]+v[0].length:0;return new de(d[o.topID],v.reverse(),V.reverse(),g)}const Il=new WeakMap;function ui(o,e){if(!o.isAnonymous||e instanceof tt||e.type!=o)return 1;let t=Il.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=o||!(i instanceof de)){t=1;break}t+=ui(o,i)}Il.set(e,t)}return t}function dn(o,e,t,i,l,s,a,r,d){let h=0;for(let k=i;k<l;k++)h+=ui(o,e[k]);let f=Math.ceil(h*1.5/8),c=[],u=[];function m(k,y,b,x,v){for(let V=b;V<x;){let g=V,p=y[V],B=ui(o,k[V]);for(V++;V<x;V++){let O=ui(o,k[V]);if(B+O>=f)break;B+=O}if(V==g+1){if(B>f){let O=k[g];m(O.children,O.positions,0,O.children.length,y[g]+v);continue}c.push(k[g])}else{let O=y[V-1]+k[V-1].length-p;c.push(dn(o,k,y,g,V,p,O,null,d))}u.push(p+v-s)}}return m(e,t,i,l,0),(r||d)(c,u,a)}class ft{constructor(e,t,i,l,s=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(s?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 l=[new ft(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&l.push(s);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],s=1,a=e.length?e[0]:null;for(let r=0,d=0,h=0;;r++){let f=r<t.length?t[r]:null,c=f?f.fromA:1e9;if(c-d>=i)for(;a&&a.from<c;){let u=a;if(d>=u.from||c<=u.to||h){let m=Math.max(u.from,d)-h,k=Math.min(u.to,c)-h;u=m>=k?null:new ft(m,k,u.tree,u.offset+h,r>0,!!f)}if(u&&l.push(u),a.to>c)break;a=s<e.length?e[s++]:null}if(!f)break;d=f.toA,h=f.toA-f.toB}return l}}class Dl{startParse(e,t,i){return typeof e=="string"&&(e=new wd(e)),i=i?i.length?i.map(l=>new nn(l.from,l.to)):[new nn(0,0)]:[new nn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let s=l.advance();if(s)return s}}}class wd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new J({perNode:!0});class pi{constructor(e,t,i,l,s,a,r,d,h,f=0,c){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=s,this.score=a,this.buffer=r,this.bufferBase=d,this.curContext=h,this.lookAhead=f,this.parent=c}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new pi(e,[],t,i,i,0,[],0,l?new Pl(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,l=e&65535,{parser:s}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let r=s.dynamicPrecedence(l);if(r&&(this.score+=r),i==0){this.pushState(s.getGoto(this.state,l,!0),this.reducePos),l<s.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(l,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),h=d?this.stack[d-2]:this.p.ranges[0].from,f=this.reducePos-h;f>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=f));let c=d?this.stack[d-1]:0,u=this.bufferBase+this.buffer.length-c;if(l<s.minRepeatTerm||e&131072){let m=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,h,m,u+4,!0)}if(e&262144)this.state=this.stack[d];else{let m=this.stack[d-3];this.state=s.getGoto(m,l,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(l,h)}storeNode(e,t,i,l=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let 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(!s||this.pos==i)this.buffer.push(e,t,i,l);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,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4);else{let s=e,{parser:a}=this.p;(l>this.pos||t<=a.maxNode)&&(this.pos=l,a.stateFlag(s,1)||(this.reducePos=l)),this.pushState(s,i),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(i,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new pi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new xd(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let s=0,a;s<t.length;s+=2)(a=t[s+1])!=this.state&&this.p.parser.hasAction(a,e)&&l.push(t[s],a);if(this.stack.length<120)for(let s=0;l.length<8&&s<t.length;s+=2){let a=t[s+1];l.some((r,d)=>d&1&&r==a)||l.push(t[s],a)}t=l}let i=[];for(let l=0;l<t.length&&i.length<4;l+=2){let s=t[l+1];if(s==this.state)continue;let a=this.split();a.pushState(s,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[l],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,l=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],l,!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=(l,s)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let r=(a>>19)-s;if(r>1){let d=a&65535,h=this.stack.length-r*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return r<<19|65536|d}}else{let r=i(a,s+1);if(r!=null)return r}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Pl(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Pl{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class xd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class mi{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new mi(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new mi(this.stack,this.pos,this.index)}}function gi(o,e=Uint16Array){if(typeof o!="string")return o;let t=null;for(let i=0,l=0;i<o.length;){let s=0;for(;;){let a=o.charCodeAt(i++),r=!1;if(a==126){s=65535;break}a>=92&&a--,a>=34&&a--;let d=a-32;if(d>=46&&(d-=46,r=!0),s+=d,r)break;s*=46}t?t[l++]=s:t=new e(s)}return t}class ki{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Fl=new ki;class vd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Fl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,l=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!l)return null;let a=this.ranges[--l];s-=i.from-a.to,i=a}for(;t<0?s>i.to:s>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];s+=a.from-i.to,i=a}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let 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)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Fl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class vt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Cd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}vt.prototype.contextual=vt.prototype.fallback=vt.prototype.extend=!1,vt.prototype.fallback=vt.prototype.extend=!1;function Cd(o,e,t,i,l,s){let a=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&o[a];){let h=o[a+1];for(let m=a+3;m<h;m+=2)if((o[m+1]&r)>0){let k=o[m];if(d.allows(k)&&(e.token.value==-1||e.token.value==k||Sd(k,e.token.value,l,s))){e.acceptToken(k);break}}let f=e.next,c=0,u=o[a+2];if(e.next<0&&u>c&&o[h+u*3-3]==65535){a=o[h+u*3-1];continue e}for(;c<u;){let m=c+u>>1,k=h+m+(m<<1),y=o[k],b=o[k+1]||65536;if(f<y)u=m;else if(f>=b)c=m+1;else{a=o[k+2],e.advance();continue e}}break}}function $l(o,e,t){for(let i=e,l;(l=o[i])!=65535;i++)if(l==t)return i-e;return-1}function Sd(o,e,t,i){let l=$l(t,i,e);return l<0||$l(t,i,o)<l}const Ne=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let cn=null;function Rl(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 Nd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Rl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Rl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],l=this.index[t];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[l],a=this.start[t]+i.positions[l];if(a>e)return this.nextStart=a,null;if(s instanceof de){if(a==e){if(a<this.safeFrom)return null;let r=a+s.length;if(r<=this.safeTo){let d=s.prop(J.lookAhead);if(!d||r+d<this.fragment.to)return s}}this.index[t]++,a+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+s.length}}}class Bd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ki)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:s}=l,a=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let h=0;h<s.length;h++){if(!(1<<h&a))continue;let f=s[h],c=this.tokens[h];if(!(i&&!f.fallback)&&((f.contextual||c.start!=e.pos||c.mask!=a||c.context!=r)&&(this.updateCachedToken(c,f,e),c.mask=a,c.context=r),c.lookAhead>c.end+25&&(d=Math.max(c.lookAhead,d)),c.value!=0)){let u=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!f.extend&&(i=c,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return d&&e.setLookAhead(d),!i&&e.pos==this.stream.end&&(i=new ki,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ki,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:s}=i.p;for(let a=0;a<s.specialized.length;a++)if(s.specialized[a]==e.value){let r=s.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(l+1)}putAction(e,t,i,l){for(let s=0;s<l;s+=3)if(this.actions[s]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=i,l}addActions(e,t,i,l){let{state:s}=e,{parser:a}=e.p,{data:r}=a;for(let d=0;d<2;d++)for(let h=a.stateSlot(s,d?2:1);;h+=3){if(r[h]==65535)if(r[h+1]==1)h=Qe(r,h+2);else{l==0&&r[h+1]==2&&(l=this.putAction(Qe(r,h+2),t,i,l));break}r[h]==t&&(l=this.putAction(Qe(r,h+1),t,i,l))}return l}}class Od{constructor(e,t,i,l){this.parser=e,this.input=t,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new vd(t,l),this.tokens=new Bd(e,this.stream),this.topTerm=e.top[1];let{from:s}=l[0];this.stacks=[pi.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Nd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,s;if(this.bigReductionCount>300&&e.length==1){let[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;{l||(l=[],s=[]),l.push(r);let d=this.tokens.getMainToken(r);s.push(d.value,d.end)}}break}}if(!i.length){let a=l&&_d(l);if(a)return Ne&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Ne&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,s,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 h=i[d];if(r.sameState(h)||r.buffer.length>500&&h.buffer.length>500)if((r.score-h.score||r.buffer.length-h.buffer.length)>0)i.splice(d--,1);else{i.splice(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 l=e.pos,{parser:s}=this,a=Ne?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let c=this.fragments.nodeAt(l);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(J.contextHash)||0)==f))return e.useNode(c,u),Ne&&console.log(a+this.stackID(e)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof de)||c.children.length==0||c.positions[0]>0)break;let m=c.children[0];if(m instanceof de&&c.positions[0]==0)c=m;else break}}let r=s.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ne&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;h<d.length;){let f=d[h++],c=d[h++],u=d[h++],m=h==d.length||!i,k=m?e:e.split(),y=this.tokens.mainToken;if(k.apply(f,c,y?y.start:k.pos,u),Ne&&console.log(a+this.stackID(k)+` (via ${f&65536?`reduce of ${s.getName(f&65535)}`:"shift"} for ${s.getName(c)} @ ${l}${k==e?"":", split"})`),m)return!0;k.pos>l?t.push(k):i.push(k)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Ll(e,t),!0}}runRecovery(e,t,i){let l=null,s=!1;for(let a=0;a<e.length;a++){let r=e[a],d=t[a<<1],h=t[(a<<1)+1],f=Ne?this.stackID(r)+" -> ":"";if(r.deadEnd&&(s||(s=!0,r.restart(),Ne&&console.log(f+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let c=r.split(),u=f;for(let m=0;c.forceReduce()&&m<10&&(Ne&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,i));m++)Ne&&(u=this.stackID(c)+" -> ");for(let m of r.recoverByInsert(d))Ne&&console.log(f+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>r.pos?(h==r.pos&&(h++,d=0),r.recoverByDelete(d,h),Ne&&console.log(f+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),Ll(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),de.build({buffer:mi.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(cn||(cn=new WeakMap)).get(e);return t||cn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Ll(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 bi extends Dl{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function s(r,d,h){l[r].push([d,d.deserialize(String(h))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=J[d]);for(let h=1;h<r.length;){let f=r[h++];if(f>=0)s(f,d,r[h++]);else{let c=r[h+-f];for(let u=-f;u>0;u--)s(r[h++],d,c);h++}}}this.nodeSet=new ln(t.map((r,d)=>Ce.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:l[d],top:i.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Vl;let a=gi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(jl),this.states=gi(e.states,Uint32Array),this.data=gi(e.stateData),this.goto=gi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new vt(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 l=new Od(this,e,t,i);for(let s of this.wrappers)l=s(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let s=l[t+1];;){let a=l[s++],r=a&1,d=l[s++];if(r&&i)return d;for(let h=s+(a>>1);s<h;s++)if(l[s]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let l=0;l<2;l++)for(let s=this.stateSlot(e,l?2:1),a;;s+=3){if((a=i[s])==65535)if(i[s+1]==1)a=i[s=Qe(i,s+2)];else{if(i[s+1]==2)return Qe(i,s+2);break}if(a==t||a==0)return Qe(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let s=this.stateSlot(e,1);l==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Qe(this.data,s+2);else break;l=t(Qe(this.data,s+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Qe(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];t.some((s,a)=>a&1&&s==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(bi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(s=>s.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let s=e.specializers.find(r=>r.from==i.external);if(!s)return i;let a=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[l]=jl(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 s of e.split(" ")){let a=t.indexOf(s);a>=0&&(i[a]=!0)}let l=null;for(let s=0;s<t.length;s++)if(!i[s])for(let a=this.dialects[t[s]],r;(r=this.data[a++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Vd(e,i,l)}static deserialize(e){return new bi(e)}}function Qe(o,e){return o[e]|o[e+1]<<16}function _d(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 jl(o){if(o.external){let e=o.extend?1:0;return(t,i)=>o.external(t,i)<<1|e}return o.get}let Md=0;class Me{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=Md++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Me&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new Me(i,[],null,[]);if(l.set.push(l),t)for(let s of t.set)l.set.push(s);return l}static defineModifier(e){let t=new yi(e);return i=>i.modified.indexOf(t)>-1?i:yi.get(i.base||i,i.modified.concat(t).sort((l,s)=>l.id-s.id))}}let Td=0;class yi{constructor(e){this.name=e,this.instances=[],this.id=Td++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Ad(t,r.modified));if(i)return i;let l=[],s=new Me(e.name,l,e,t);for(let r of t)r.instances.push(s);let a=Ed(t);for(let r of e.set)if(!r.modified.length)for(let d of a)l.push(yi.get(r,d));return s}}function Ad(o,e){return o.length==e.length&&o.every((t,i)=>t==e[i])}function Ed(o){let e=[[]];for(let t=0;t<o.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(o[t]));return e.sort((t,i)=>i.length-t.length)}function zl(o){let e=Object.create(null);for(let t in o){let i=o[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let s=[],a=2,r=l;for(let c=0;;){if(r=="..."&&c>0&&c+3==l.length){a=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==l.length)break;let m=l[c++];if(c==l.length&&m=="!"){a=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(c)}let d=s.length-1,h=s[d];if(!h)throw new RangeError("Invalid path: "+l);let f=new hn(i,a,d>0?s.slice(0,d):null);e[h]=f.sort(e[h])}}return Id.add(e)}const Id=new J;class hn{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}hn.empty=new hn([],2,null);function ql(o,e){let t=Object.create(null);for(let s of o)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let a of s.tag)t[a.id]=s.class;let{scope:i,all:l=null}=e||{};return{style:s=>{let a=l;for(let r of s)for(let d of r.set){let h=t[d.id];if(h){a=a?a+" "+h:h;break}}return a},scope:i}}const j=Me.define,wi=j(),nt=j(),Ul=j(nt),Wl=j(nt),lt=j(),xi=j(lt),fn=j(lt),$e=j(),ut=j($e),Re=j(),Le=j(),un=j(),Ut=j(un),vi=j(),L={comment:wi,lineComment:j(wi),blockComment:j(wi),docComment:j(wi),name:nt,variableName:j(nt),typeName:Ul,tagName:j(Ul),propertyName:Wl,attributeName:j(Wl),className:j(nt),labelName:j(nt),namespace:j(nt),macroName:j(nt),literal:lt,string:xi,docString:j(xi),character:j(xi),attributeValue:j(xi),number:fn,integer:j(fn),float:j(fn),bool:j(lt),regexp:j(lt),escape:j(lt),color:j(lt),url:j(lt),keyword:Re,self:j(Re),null:j(Re),atom:j(Re),unit:j(Re),modifier:j(Re),operatorKeyword:j(Re),controlKeyword:j(Re),definitionKeyword:j(Re),moduleKeyword:j(Re),operator:Le,derefOperator:j(Le),arithmeticOperator:j(Le),logicOperator:j(Le),bitwiseOperator:j(Le),compareOperator:j(Le),updateOperator:j(Le),definitionOperator:j(Le),typeOperator:j(Le),controlOperator:j(Le),punctuation:un,separator:j(un),bracket:Ut,angleBracket:j(Ut),squareBracket:j(Ut),paren:j(Ut),brace:j(Ut),content:$e,heading:ut,heading1:j(ut),heading2:j(ut),heading3:j(ut),heading4:j(ut),heading5:j(ut),heading6:j(ut),contentSeparator:j($e),list:j($e),quote:j($e),emphasis:j($e),strong:j($e),link:j($e),monospace:j($e),strikethrough:j($e),inserted:j(),deleted:j(),changed:j(),invalid:j(),meta:vi,documentMeta:j(vi),annotation:j(vi),processingInstruction:j(vi),definition:Me.defineModifier("definition"),constant:Me.defineModifier("constant"),function:Me.defineModifier("function"),standard:Me.defineModifier("standard"),local:Me.defineModifier("local"),special:Me.defineModifier("special")};for(let o in L){let e=L[o];e instanceof Me&&(e.name=o)}ql([{tag:L.link,class:"tok-link"},{tag:L.heading,class:"tok-heading"},{tag:L.emphasis,class:"tok-emphasis"},{tag:L.strong,class:"tok-strong"},{tag:L.keyword,class:"tok-keyword"},{tag:L.atom,class:"tok-atom"},{tag:L.bool,class:"tok-bool"},{tag:L.url,class:"tok-url"},{tag:L.labelName,class:"tok-labelName"},{tag:L.inserted,class:"tok-inserted"},{tag:L.deleted,class:"tok-deleted"},{tag:L.literal,class:"tok-literal"},{tag:L.string,class:"tok-string"},{tag:L.number,class:"tok-number"},{tag:[L.regexp,L.escape,L.special(L.string)],class:"tok-string2"},{tag:L.variableName,class:"tok-variableName"},{tag:L.local(L.variableName),class:"tok-variableName tok-local"},{tag:L.definition(L.variableName),class:"tok-variableName tok-definition"},{tag:L.special(L.variableName),class:"tok-variableName2"},{tag:L.definition(L.propertyName),class:"tok-propertyName tok-definition"},{tag:L.typeName,class:"tok-typeName"},{tag:L.namespace,class:"tok-namespace"},{tag:L.className,class:"tok-className"},{tag:L.macroName,class:"tok-macroName"},{tag:L.propertyName,class:"tok-propertyName"},{tag:L.operator,class:"tok-operator"},{tag:L.comment,class:"tok-comment"},{tag:L.meta,class:"tok-meta"},{tag:L.invalid,class:"tok-invalid"},{tag:L.punctuation,class:"tok-punctuation"}]);const Dd=zl({String:L.string,Number:L.number,"True False":L.bool,PropertyName:L.propertyName,Null:L.null,",":L.separator,"[ ]":L.squareBracket,"{ }":L.brace}),Pd=bi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Dd],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});class Z{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]=Ct(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),je.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ct(this,e,t);let i=[];return this.decompose(e,t,i,0),je.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Wt(this),s=new Wt(e);for(let a=t,r=t;;){if(l.next(a),s.next(a),a=0,l.lineBreak!=s.lineBreak||l.done!=s.done||l.value!=s.value)return!1;if(r+=l.value.length,l.done||r>=i)return!0}}iter(e=1){return new Wt(this,e)}iterRange(e,t=this.length){return new Kl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ql(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Z.empty:e.length<=32?new re(e):je.from(re.split(e,[]))}}class re extends Z{constructor(e,t=Fd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let s=0;;s++){let a=this.text[s],r=l+a.length;if((t?i:r)>=e)return new $d(l,r,i,a);l=r+1,i++}}decompose(e,t,i,l){let s=e<=0&&t>=this.length?this:new re(Hl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),r=Ci(s.text,a.text.slice(),0,s.length);if(r.length<=32)i.push(new re(r,a.length+s.length));else{let d=r.length>>1;i.push(new re(r.slice(0,d)),new re(r.slice(d)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);[e,t]=Ct(this,e,t);let l=Ci(this.text,Ci(i.text,Hl(this.text,0,e)),t),s=this.length+i.length-(t-e);return l.length<=32?new re(l,s):je.from(re.split(l,[]),s)}sliceString(e,t=this.length,i=`
1
+ (function(X,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],K):(X=typeof globalThis<"u"?globalThis:X||self,K(X.index={},X.UnioneBaseVue,X.Vue,X.antDesignVue,X.lodashEs,X.vueCodemirror,X.langJavascript,X.iconsVue,X.uuid))})(this,function(X,K,n,Y,na,Lt,la,He,sa){"use strict";const oa={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},Ji=n.ref(oa);function Ie(o){return o&&(Ji.value=K.utils.obj.ext(Ji.value,o)),Ji.value}const aa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ra={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},da=n.ref([aa,ra]);function ca(o,e){return K.locales.loadLanguage(o,()=>new Promise((t,i)=>{const l=da.value.filter(s=>s.localeName==o);if(e)if(typeof e=="function")e().then(s=>{if(l.length==0){const a={...s,localeName:o};t(a)}else{const a={...l[0],...s};t(a)}});else if(l.length==0){const s={...e,localeName:o};t(s)}else{const s={...l[0],...e};t(s)}else l.length>0?t(l[0]):i("local language not defined ,lang:"+o)}))}const Zi={...K.locales};Zi.loadLanguage=ca;class ha{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=n.ref(e),this.$pid=n.ref(""),this.$store=n.ref({}),this.$forms=n.ref({}),this.$params=n.ref({}),this.$refObj=n.ref({}),this.$refData=n.ref({}),this.$model=t}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const t in this.$store.value)this.$store.value[t].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,i){}use(e,t,i){let l=this.$store.value[e];return l||(l=new en(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,t,i){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(s=>{i&&i(s)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class en{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,i){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=t,this.$data=n.ref(t=="form"?{}:{body:[],total:0}),this.$dialog=K.useDialog(),this.$model=i||n.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}$processParams(e,t){if(t)t.forEach(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}request(e){return new Promise((t,i)=>{const l=Y.message.loading("数据请求中..."),s=this.$store.controller+e.url;K.axios.form({method:"post",...e,url:s}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+s,options:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+s,options:e,err:a})}).finally(()=>{l()})})}find(e){const t=this.$store.controller+(this.$store.findUrl||"/find");return!e&&this.$store.findParams&&(e={dsn:this.$dsn}),this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e&&(e.body=this.$processParams(e.body,this.$store.findParams)),new Promise((i,l)=>{const s=Y.message.loading("数据加载中...");K.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$data.value=a,i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:a})}).finally(()=>{s()})})}save(e){const t=this.$store.controller+(this.$store.saveUrl||"/save");return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((i,l)=>{const s=Y.message.loading("数据提交中...");K.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body||{}),a.silence||Y.message.success(a.message),i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:a})}).finally(()=>{s()})})}loadByIds(e){return new Promise((t,i)=>{const l=Y.message.loading("数据加载中..."),s=this.$store.controller+"/loadByIds";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(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(()=>{l()})})}detail(e){return new Promise((t,i)=>{const l=Y.message.loading("数据加载中..."),s=this.$store.controller+"/detail";K.axios.form({url:s,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(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:s,id:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,err:a})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=Y.message.loading("数据处理中..."),s=this.$store.controller+"/delete";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,err:a})}).finally(()=>{l()})}})})}}class fa{$event;$onces;$delayEmit;constructor(){this.$event=n.ref({}),this.$onces=n.ref({}),this.$delayEmit=n.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];t(i)}}$emit(e,t){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(t)}this.$event.value[e]?this.$event.value[e](t):(this.$delayEmit.value[e]=t,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,t){this.$onces.value[e]=t}$off(e){delete this.$event.value[e]}}class ct{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=n.ref("run"),this.type=n.ref(e.types||"setting"),this.define=n.ref(e),this.ebus=new fa,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ha(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=K.useDialog(),this.loadConfig(t)}sn(){return this.define.value.sn}load(e,t){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",t),t&&t.configs&&(this.define.value=t,this.type.value=this.define.value.types||"setting",this.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}K.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):t&&t.configs&&(this.define.value=t,this.loadConfig(t.configs))})}save(){return new Promise((e,t)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),t();return}this.$axiosProccess.value.save=!0;const i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),K.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(s=>{this.$axiosProccess.value.save=!1,s.success?(Y.message.success(s.message),this.define.value=s.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(s.body)):(this.$dialog.error({content:s.message}),t())}).catch(s=>{console.error("页面配置保存失败",s),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,t){if(t){const i={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(t=>{t.wid||(t.wid="w:"+na.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ua={class:"widget-setting-dialog"},pa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=e,i=n.ref(),l=n.ref(!1);function s(){i.value&&(l.value=!0),t("setting")}function a(){t("saving"),l.value=!1}return(r,d)=>{const h=n.resolveComponent("SettingOutlined"),f=n.resolveComponent("a-tooltip"),c=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",o.model])},[n.createVNode(f,{title:o.settingTitle},{default:n.withCtx(()=>[o.model=="edit"&&(r.$slots["widget-setting"]||o.custome)?(n.openBlock(),n.createBlock(h,{key:0,class:"widget-setting",onClick:s})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),o.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(c,{key:0,title:o.settingTitle,ref_key:"settingModal",ref:i,open:l.value,"onUpdate:open":d[0]||(d[0]=u=>l.value=u),centered:"",width:"80%",onOk:a},{default:n.withCtx(()=>[n.createElementVNode("div",ua,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),te=(o,e)=>{const t=o.__vccOpts||o;for(const[i,l]of e)t[i]=l;return t},ht=te(pa,[["__scopeId","data-v-3a88c0c0"]]),ma={key:0},ga=["onClick"],ci=te(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"}]),l=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:g=>{l.value.selectedRowKeys=g}}),s={mounted:g=>g.focus()},a=n.ref({});function r(){const g=Object.keys(a.value);if(g.length)for(let p in g){const B=y.value.form.action.params[p];B&&a.value[p]&&Object.keys(a.value[p]).forEach(V=>{B[V]=a.value[p][V]})}a.value={}}function d(g,p,B){r();const V={};V[B]=p[B]||"",B=="showIndex"&&(V[B]=p.show?.query?.index),a.value[g]=V}function h(g,p,B){if(!p||!B){a.value={};return}const V=a.value[g][B];p[B]=V,a.value={}}function f(){y.value.form.action.params.push({title:"新建",name:"",value:""})}function c(){}const u=n.ref(""),m=n.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(g,p)=>u.value!=p&&t.preset.includes(p)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=n.ref([la.javascript()]),y=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),k=n.ref();function v(g,p,B={}){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,y.value.form=g,y.value.helps=B,y.value.visible=!0,k.value=p}const w=n.ref(null);function O(){w.value&&w.value.validate().then(()=>{y.value.visible=!1,k.value(y.value.form)})}return e({open:v,close}),(g,p)=>{const B=n.resolveComponent("a-input"),V=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-select"),x=n.resolveComponent("a-input-number"),N=n.resolveComponent("a-checkbox"),M=n.resolveComponent("a-tab-pane"),E=n.resolveComponent("a-switch"),T=n.resolveComponent("a-button"),D=n.resolveComponent("a-divider"),R=n.resolveComponent("ToolOutlined"),A=n.resolveComponent("a-tooltip"),q=n.resolveComponent("a-table"),P=n.resolveComponent("a-tabs"),Q=n.resolveComponent("a-form"),L=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock(L,{visible:y.value.visible,"onUpdate:visible":p[23]||(p[23]=S=>y.value.visible=S),title:y.value.title,centered:"",width:"50%",onOk:O},{default:n.withCtx(()=>[n.createVNode(Q,{name:"basic",ref_key:"form",ref:w,rules:m.value,model:y.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(P,null,{default:n.withCtx(()=>[n.createVNode(M,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(V,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.title,"onUpdate:value":p[0]||(p[0]=S=>y.value.form.title=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.name,"onUpdate:value":p[1]||(p[1]=S=>y.value.form.name=S),disabled:t.preset.includes(y.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(V,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.icon,"onUpdate:value":p[2]||(p[2]=S=>y.value.form.icon=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.type,"onUpdate:value":p[3]||(p[3]=S=>y.value.form.type=S),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),n.createVNode(V,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(x,{value:y.value.form.index,"onUpdate:value":p[4]||(p[4]=S=>y.value.form.index=S)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.size,"onUpdate:value":p[5]||(p[5]=S=>y.value.form.size=S),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(V,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(N,{checked:y.value.form.props.block,"onUpdate:checked":p[6]||(p[6]=S=>y.value.form.props.block=S)},{default:n.withCtx(()=>p[24]||(p[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:y.value.form.props.danger,"onUpdate:checked":p[7]||(p[7]=S=>y.value.form.props.danger=S)},{default:n.withCtx(()=>p[25]||(p[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(N,{checked:y.value.form.props.ghost,"onUpdate:checked":p[8]||(p[8]=S=>y.value.form.props.ghost=S)},{default:n.withCtx(()=>p[26]||(p[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(M,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(V,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.action.type,"onUpdate:value":p[9]||(p[9]=S=>y.value.form.action.type=S),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.psn,"onUpdate:value":p[10]||(p[10]=S=>y.value.form.action.psn=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.component,"onUpdate:value":p[11]||(p[11]=S=>y.value.form.action.component=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(V,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.href,"onUpdate:value":p[12]||(p[12]=S=>y.value.form.action.href=S)},null,8,["value"])]),_:1}),["link","route"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.action.target,"onUpdate:value":p[13]||(p[13]=S=>y.value.form.action.target=S),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:y.value.form.action.position,"onUpdate:value":p[14]||(p[14]=S=>y.value.form.action.position=S),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(B,{value:y.value.form.action.title,"onUpdate:value":p[15]||(p[15]=S=>y.value.form.action.title=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(E,{checked:y.value.form.action.maskClosable,"onUpdate:checked":p[16]||(p[16]=S=>y.value.form.action.maskClosable=S),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(x,{value:y.value.form.action.width,"onUpdate:value":p[17]||(p[17]=S=>y.value.form.action.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(y.value.form.action.type)?(n.openBlock(),n.createBlock(V,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(x,{value:y.value.form.action.height,"onUpdate:value":p[18]||(p[18]=S=>y.value.form.action.height=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(D,{orientation:"left"},{default:n.withCtx(()=>[p[29]||(p[29]=n.createTextVNode("参数列表 ")),n.createVNode(T,{size:"small",class:"param-btn",onClick:f},{default:n.withCtx(()=>p[27]||(p[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(T,{size:"small",class:"param-btn",danger:"",onClick:c},{default:n.withCtx(()=>p[28]||(p[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode(q,{columns:i.value,"data-source":y.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["name","title"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",ma,[n.createVNode(R),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),["value"].includes(S.key)?(n.openBlock(),n.createBlock(A,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(R),n.createTextVNode(" "+n.toDisplayString(S.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:F,record:_,index:I})=>[["name","title","value"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!a.value[I]||!Object.keys(a.value[I]).includes(S.dataIndex))&&!F&&"empty"]),onClick:U=>d(I,_,S.dataIndex)},[a.value[I]&&Object.keys(a.value[I]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(B,{key:0,value:a.value[I][S.dataIndex],"onUpdate:value":U=>a.value[I][S.dataIndex]=U,onBlur:U=>h(I,_,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(F),1)],64))],10,ga)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(M,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(V,{label:"点击事件",help:y.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.clickScript,"onUpdate:modelValue":p[19]||(p[19]=S=>y.value.form.event.clickScript=S),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(V,{label:"禁用逻辑",help:y.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.disableScript,"onUpdate:modelValue":p[20]||(p[20]=S=>y.value.form.event.disableScript=S),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(V,{label:"显示逻辑",help:y.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.visibleScript,"onUpdate:modelValue":p[21]||(p[21]=S=>y.value.form.event.visibleScript=S),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(V,{label:"动态标题",help:y.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:y.value.form.event.titleScript,"onUpdate:modelValue":p[22]||(p[22]=S=>y.value.form.event.titleScript=S),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),ka=["src"],ba=["src"],ya=te(n.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(o,{emit:e}){const t=Ie(),i=o,l=K.useSession();n.watch(()=>i.widget?.event,()=>{a()}),n.onMounted(()=>{a()});const s=n.ref({});function a(){i.widget?.event&&(i.widget.event.clickScript?s.value.click=new Function("ctx","btn","event",i.widget.event.clickScript):i.widget.event.click&&(s.value.click=i.widget.event.click),i.widget.event.disableScript?s.value.disable=new Function("ctx","btn",i.widget.event.disableScript):i.widget.event.disable&&(s.value.disable=i.widget.event.disable),i.widget.event.visibleScript?s.value.visible=new Function("ctx","btn",i.widget.event.visibleScript):i.widget.event.visible&&(s.value.visible=i.widget.event.visible),i.widget.event.titleScript?s.value.title=new Function("ctx","btn",i.widget.event.titleScript):i.widget.event.title&&(s.value.title=i.widget.event.title)),typeof i.widget.click=="function"&&(s.value.click=i.widget.click),typeof i.widget.title=="function"&&(s.value.title=i.widget.title),typeof i.widget.visible=="function"&&(s.value.visible=i.widget.visible),typeof i.widget.disabled=="function"&&(s.value.disable=i.widget.disabled)}const r=n.computed(()=>s.value.title?s.value.title(u.value,i.widget):i.widget.title),d=n.computed(()=>s.value.visible?s.value.visible(u.value,i.widget)!=!1:i.widget.visible!=!1),h=n.computed(()=>i.disabled==!0?!0:s.value.disable?s.value.disable(u.value,i.widget):i.widget.disable==!0),f=n.ref(null);function c(){f.value?.open(i.widget,g=>{console.log("btn props",g),Object.keys(g).forEach(p=>{i.widget[p]=g[p]}),console.log("props btn",i.widget)})}const u=n.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),m=n.ref({open:!1}),b=n.computed(()=>{if(i.widget.action?.href){let g=i.widget.action.href;const p=g.matchAll("{[a-zA-Z.]*}"),B=[];let V=null;for(;V=p.next();){if(V&&V.value&&V.value[0]){let C=V.value[0].substring(1,V.value[0].length-1);B.includes(C)||B.push(C)}if(V.done)break}if(B.length>0)for(let C=0;C<B.length;C++){let x=B[C],N=K.utils.obj.getValue(u.value,x);N?N instanceof Object?g=g.replaceAll("{"+x+"}",JSON.stringify(N)):Array.isArray(N)?g=g.replaceAll("{"+x+"}",N.join(",")):g=g.replaceAll("{"+x+"}",N):g=g.replaceAll("{"+x+"}","")}return g}return""}),y=n.computed(()=>{const g={};let p=i.widget.action?.href||i.widget.action?.link;if(p){const B=p.matchAll("{[a-zA-Z0-9.]*}"),V=[];let C=null;for(;C=B.next();){if(C&&C.value&&C.value[0]){let N=C.value[0].substring(1,C.value[0].length-1);V.includes(N)||V.push(N)}if(C.done)break}if(V.length>0)for(let N=0;N<V.length;N++){let M=V[N],E=K.utils.obj.getValue(u.value,M);E?E instanceof Object?p=p.replaceAll("{"+M+"}",JSON.stringify(E)):Array.isArray(E)?p=p.replaceAll("{"+M+"}",E.join(",")):p=p.replaceAll("{"+M+"}",E):p=p.replaceAll("{"+M+"}","")}const x=p.split("?")[1];x&&x.split("&").forEach(N=>{const M=N.split("=");M[0]&&M[1]&&(g[M[0]]=M[1])})}return i.widget.action?.params&&i.widget.action.params.filter(B=>B.value+"").forEach(B=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(B.value)){let C=K.utils.obj.getValue(u.value,B.value);g[B.name]=C}else g[B.name]=B.value}),g}),k=e,v=n.inject("router");function w(g){if(t.isDebug&&console.log("unione btn click",i.widget,g),!(s.value.click&&s.value.click(u.value,i.widget,g)==!1)){if(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog")m.value.open=!0;else if(i.widget.action?.type=="route"&&(i.widget.action?.href||i.widget.action?.link)){if(i.widget.action.link&&i.editor?.type.value=="code")return;v.push({path:i.widget.action.href||i.widget.action?.link,query:y.value})}k("click",{btn:i.widget,event:g})}}function O(g){k("click",g)}return(g,p)=>{const B=n.resolveComponent("a-button"),V=n.resolveComponent("unione-btn"),C=n.resolveComponent("a-dropdown"),x=n.resolveComponent("a-drawer"),N=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(ht,{key:0,class:n.normalizeClass(["unione-btn",o.widget.props?.block&&"unione-btn-block"]),model:o.editor?.model.value,onSetting:c,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[!o.widget.widget||o.widget.widget=="button"?(n.openBlock(),n.createBlock(B,n.mergeProps({key:0,disabled:h.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,title:o.widget.tooltip,onClick:w},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","title"])):n.createCommentVNode("",!0),o.widget.widget=="dropdown"?(n.openBlock(),n.createBlock(C,{key:1,trigger:[o.widget.trigger||"hover"],class:n.normalizeClass([o.widget.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["dropdown-overlay",o.widget.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.widget.items,M=>(n.openBlock(),n.createBlock(V,{key:M.name,class:"item",widget:M,editor:o.editor,preset:o.preset,ctx:o.ctx,onClick:O},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(B,{size:o.widget.size||"small"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value),1)]),_:1},8,["size"])]),_:1},8,["trigger","class"])):n.createCommentVNode("",!0),o.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(x,{key:2,open:m.value.open,"onUpdate:open":p[0]||(p[0]=M=>m.value.open=M),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,ka)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),o.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(N,{key:3,open:m.value.open,"onUpdate:open":p[1]||(p[1]=M=>m.value.open=M),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,ba)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(ci,{ref_key:"btnSetting",ref:f,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-b868da76"]]),wa={key:0,class:"unione-widget-empty-tip"},xa=te(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(l,s)=>{const a=n.resolveComponent("a-tab-pane"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createBlock(ht,{class:n.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:n.withCtx(()=>[i.value?(n.openBlock(),n.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":s[0]||(s[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,h)=>(n.openBlock(),n.createBlock(a,{key:h,class:"unione-layout-tab-pane"},{tab:n.withCtx(()=>[n.createElementVNode("span",null,[d.icon?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.icon),{key:0})):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d.title),1)])]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.chidlren,(f,c)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(f.widget),{key:c,wid:f.wid,editor:e.editor,widget:f},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",wa,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),va={class:"title"},Ca={class:"text"},Sa={key:0,class:"reactive"},Na={key:1,class:"opts"},Ba={class:"warp"},Oa=te(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),l=n.computed(()=>t.value?.icon||e.icon),s=n.computed(()=>t.value?.type||e.type),a=n.useModel(o,"modelValue");function r(){e.reactive&&(a.value=!a.value)}return(d,h)=>(n.openBlock(),n.createBlock(ht,{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",va,[s.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",s.value])},null,2)):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",Ca,n.toDisplayString(i.value),1)]),o.reactive?(n.openBlock(),n.createElementBlock("div",Sa,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),o.location=="left"?(n.openBlock(),n.createElementBlock("div",Na,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Ba,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,a.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Va={class:"unione-props-setting unione-form-setting"},_a={class:"unione-form-btns"},Ma={key:0},Ta=["onClick"],Aa={class:"field-txt"},Ea=["onClick"],Ia={key:1,class:"field-txt"},Da=["onClick"],Pa={key:0,class:"field-txt"},Fa={key:3,class:"edit-field"},$a={key:0},Ra=["onClick"],La=te(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:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.settings||(C.configs.settings={}),C.configs.settings.btns||(C.configs.settings.btns=[]),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),s=n.computed(()=>{const C=i.value.configs.settings.btns,x=C.map(N=>N.name);if(!x.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(N.index,0,N)}if(!x.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let M=N.index||1;C.splice(M,0,N)}if(!x.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(N.index,0,N)}if(!x.includes("back")){const N={title:"返回",type:"default",index:3,visible:!0,name:"back"};C.splice(N.index,0,N)}return C}),a=n.ref(null);function r(C){a.value&&a.value.open(C,x=>{x.visible=!0,Object.keys(x).forEach(N=>{C[N]=x[N]}),i.value.configs.settings.btns.sort((N,M)=>{const E=N.index||1,T=M.index||1;return E-T}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const C=i.value.configs.settings.btns.length+1;let x={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};x.name="new_"+i.value.configs.settings.btns.length;const N=i.value.configs.settings.btns.filter(M=>M.name==x.name).length;N>0&&(x.name=x.name+N),i.value.configs.settings.btns.push(x),e.editor.widget(e.wid,i.value),a.value.open(x,M=>{Object.keys(M).forEach(E=>{x[E]=M[E]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(C){const x=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const N=[];i.value.configs.settings.btns.forEach(M=>{M.name!=C.name&&N.push(M)}),i.value.configs.settings.btns=N}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{x()}})}const f=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=f.value.widgets.filter(N=>N.value==C);return x[0]?x[0].label:C},toSetting:()=>{}}),c=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let x="";return C.rules&&(x=C.rules.filter(N=>N.enable).length||""),x&&(x="("+x+")"),x},toSetting:()=>{const C=c.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 N={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(N.pattern=C.regExpress,N.enable=!0),c.value.field.rules=[x,N],c.value.visible=!1,c.value.props={},console.log("rule",c.value.field.rules)}});function u(C){c.value.visible=!0,c.value.field=C;const x=C.rules||[],N={trigger:"change",whitespace:!0};x.forEach(M=>{M.name=="reg"&&(N.trigger=M.trigger,N.whitespace=M.whitespace,N.regExpress=M.pattern,N.regMessage=M.message),M.name=="range"&&(N.rangeMin=M.min,N.rangeMax=M.max,N.rangeMessage=M.message)}),c.value.props=N}const m=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function b(C,x){const N=w.value.filter(E=>E.name==C.name);N.forEach(E=>{x!="isSort"?E[x]=!0:E[x]=!E[x]});const M=N[0];if(!(!M||x=="isSort")){switch(m.value.prop=x,m.value.field=C,M.show||(M.show={}),x){case"isQuery":M.show.query||(M.show.query={}),m.value.show=M.show.query,m.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":M.show.form||(M.show.form={}),m.value.show=M.show.form,m.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":M.show.view||(M.show.view={}),m.value.show=M.show.view,m.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":M.show.list||(M.show.list={}),m.value.show=M.show.list,m.value.title=`列头设置/${C.title}(${C.name})`;break}m.value.visible=!0}}const y=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(C,x)=>{y.value.convert.options.splice(C,1)},toSetting:()=>{y.value.visible=!1}});function k(C){y.value.visible=!0,y.value.field=C,y.value.convert=C.convert||{}}const v=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),w=n.computed(()=>v.value.fields?.length?v.value.fields:[]),O={mounted:C=>C.focus()},g=n.ref({});function p(C,x){const N={};x=="convertName"?N[x]=C.convert?.type:N[x]=C[x]||"",g.value={},g.value[C.name]=N}function B(C,x){{g.value={};return}}function V(C,x){w.value.filter(M=>M.name==C.name).forEach(M=>{M[x]=!M[x]})}return(C,x)=>{const N=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),E=n.resolveComponent("a-button"),T=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-select"),R=n.resolveComponent("ToolOutlined"),A=n.resolveComponent("a-checkbox"),q=n.resolveComponent("a-table"),P=n.resolveComponent("a-select-option"),Q=n.resolveComponent("a-form-item"),L=n.resolveComponent("a-form"),S=n.resolveComponent("a-modal"),F=n.resolveComponent("a-checkbox-group"),_=n.resolveComponent("a-input-number"),I=n.resolveComponent("a-input"),U=n.resolveComponent("a-col"),ke=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Va,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[23]||(x[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",_a,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,$=>(n.openBlock(),n.createBlock(E,n.mergeProps({key:$.name,class:["btn",$.name,!$.visible&&"deleted"],type:$.visible?$.type:"default",size:$.size,ref_for:!0},$.props||{},{onClick:_e=>r($)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString($.title)+" ",1),$.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers(_e=>h($),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[$.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(E,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:x[0]||(x[0]=$=>d())},{default:n.withCtx(()=>[n.createVNode(T)]),_:1})]),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[24]||(x[24]=[n.createTextVNode("表单设置")])),_:1}),x[36]||(x[36]=n.createTextVNode(" 数据模型:")),n.createVNode(D,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":x[1]||(x[1]=$=>i.value.dataModel=$)},null,8,["options","value"]),n.createVNode(q,{columns:t.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:$})=>[["widget","rules","convertName"].includes($.key)?(n.openBlock(),n.createElementBlock("span",Ma,[n.createVNode(R),n.createTextVNode(" "+n.toDisplayString($.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:$,text:_e,record:ee})=>[["rules"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!c.value.showInfo(ee)&&"empty"]),onClick:ve=>u(ee)},[n.createElementVNode("span",Aa,n.toDisplayString(c.value.showInfo(ee)),1),c.value.showInfo(ee)?(n.openBlock(),n.createBlock(E,{key:0,type:"link"},{default:n.withCtx(()=>x[25]||(x[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ta)):["widget"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!g.value[ee.name]||!Object.keys(g.value[ee.name]).includes($.dataIndex))&&!_e&&"empty"]),onClick:ve=>p(ee,$.dataIndex)},[g.value[ee.name]&&Object.keys(g.value[ee.name]).includes($.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ee[$.dataIndex],"onUpdate:value":ve=>ee[$.dataIndex]=ve,options:f.value.widgets,onBlur:x[2]||(x[2]=ve=>B())},null,8,["value","onUpdate:value","options"])),[[O]]):(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(f.value.widgetName(_e)),1))],10,Ea)):["convertName"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!g.value[ee.name]||!Object.keys(g.value[ee.name]).includes($.dataIndex))&&!ee.convert?.type&&"empty"]),onClick:ve=>p(ee,$.dataIndex)},[g.value[ee.name]&&Object.keys(g.value[ee.name]).includes($.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ee[$.dataIndex],"onUpdate:value":ve=>ee[$.dataIndex]=ve,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:x[3]||(x[3]=ve=>B())},null,8,["value","onUpdate:value"])),[[O]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[ee.convert?.type?(n.openBlock(),n.createElementBlock("span",Pa,n.toDisplayString(ee.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),ee.convert?.type?(n.openBlock(),n.createBlock(E,{key:1,type:"link",onClick:n.withModifiers(ve=>k(ee),["stop"])},{default:n.withCtx(()=>x[26]||(x[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Da)):["isForm","isView"].includes($.dataIndex)?(n.openBlock(),n.createElementBlock("div",Fa,[n.createVNode(A,{checked:ee[$.dataIndex],onClick:ve=>V(ee,$.dataIndex)},null,8,["checked","onClick"]),n.createVNode(E,{type:"link",onClick:ve=>b(ee,$.dataIndex)},{default:n.withCtx(()=>x[27]||(x[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(S,{visible:f.value.visible,"onUpdate:visible":x[5]||(x[5]=$=>f.value.visible=$),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"},{default:n.withCtx(()=>[f.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(Q,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(D,{value:f.value.props.mode,"onUpdate:value":x[4]||(x[4]=$=>f.value.props.mode=$),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(P,{value:"multiple"},{default:n.withCtx(()=>x[28]||(x[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(P,{value:"tags"},{default:n.withCtx(()=>x[29]||(x[29]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(S,{visible:c.value.visible,"onUpdate:visible":x[13]||(x[13]=$=>c.value.visible=$),title:"规则设置",onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{model:c.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(()=>x[30]||(x[30]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(Q,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(F,{value:c.value.props.trigger,"onUpdate:value":x[6]||(x[6]=$=>c.value.props.trigger=$),options:["change","blur"]},null,8,["value"])]),_:1}),c.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Q,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(A,{value:c.value.props.whitespace,"onUpdate:value":x[7]||(x[7]=$=>c.value.props.whitespace=$),checked:c.value.props.whitespace},{default:n.withCtx(()=>x[31]||(x[31]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[32]||(x[32]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(Q,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(_,{value:c.value.props.rangeMin,"onUpdate:value":x[8]||(x[8]=$=>c.value.props.rangeMin=$)},null,8,["value"]),x[33]||(x[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(_,{value:c.value.props.rangeMax,"onUpdate:value":x[9]||(x[9]=$=>c.value.props.rangeMax=$)},null,8,["value"])]),_:1}),n.createVNode(Q,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(I,{value:c.value.props.rangeMessage,"onUpdate:value":x[10]||(x[10]=$=>c.value.props.rangeMessage=$)},null,8,["value"])]),_:1}),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[34]||(x[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(Q,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(I,{value:c.value.props.regExpress,"onUpdate:value":x[11]||(x[11]=$=>c.value.props.regExpress=$)},null,8,["value"])]),_:1}),n.createVNode(Q,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(I,{value:c.value.props.regMessage,"onUpdate:value":x[12]||(x[12]=$=>c.value.props.regMessage=$)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(S,{visible:m.value.visible,"onUpdate:visible":x[20]||(x[20]=$=>m.value.visible=$),title:m.value.title,onOk:m.value.toSetting},{default:n.withCtx(()=>[n.createVNode(L,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Q,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(_,{value:m.value.show.index,"onUpdate:value":x[14]||(x[14]=$=>m.value.show.index=$)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Q,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.width,"onUpdate:value":x[15]||(x[15]=$=>m.value.show.width=$)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.labelWidth,"onUpdate:value":x[16]||(x[16]=$=>m.value.show.labelWidth=$)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.valueWidth,"onUpdate:value":x[17]||(x[17]=$=>m.value.show.valueWidth=$)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(D,{value:m.value.show.fixed,"onUpdate:value":x[18]||(x[18]=$=>m.value.show.fixed=$),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(Q,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(D,{value:m.value.show.align,"onUpdate:value":x[19]||(x[19]=$=>m.value.show.align=$),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(S,{visible:y.value.visible,"onUpdate:visible":x[22]||(x[22]=$=>y.value.visible=$),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[y.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",$a,[n.createVNode(E,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:n.withCtx(()=>x[35]||(x[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(q,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:$,record:_e,index:ee})=>[$.dataIndex==="label"?(n.openBlock(),n.createBlock(I,{key:0,value:_e.label,"onUpdate:value":ve=>_e.label=ve,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),$.dataIndex==="value"?(n.openBlock(),n.createBlock(I,{key:1,value:_e.value,"onUpdate:value":ve=>_e.value=ve,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),$.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:ve=>y.value.toDelOption(ee,_e)},"删除",8,Ra)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),y.value.convert.type=="dict"?(n.openBlock(),n.createBlock(L,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(ke,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(U,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(Q,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(I,{value:y.value.convert.dict,"onUpdate:value":x[21]||(x[21]=$=>y.value.convert.dict=$)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(ci,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),ja=te(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(!1),l=n.ref(),s=n.ref({}),a=n.ref(null);n.onMounted(()=>{if(d.value.dsn){const w=r.value.dataManager();d.value.primary&&w.psn(d.value.dsn),a.value.setDisabled=v,a.value.getValue=u,a.value.setValue=m,a.value.reset=b,l.value=w.useForm(d.value.dsn,a.value,O=>{s.value=O.body||{}})}t.editor||r.value.loadConfig({widgets:h.value}),t.form?.model&&r.value.setModel(t.form.model),y()});const r=n.computed(()=>t.editor||new ct),d=n.computed(()=>t.widget||t.form||{}),h=n.computed(()=>{let w=d.value.widgets||[];return!w.length&&t.form?.fields&&(w=t.form.fields),w.forEach(O=>{O.widget||(O.widget="unione-form-item"),O.control||(O.control="a-input")}),w}),f=n.inject("pageSetting"),c=n.computed(()=>d.value.setting||f?.form||{});n.provide("formSetting",c.value);function u(){return s.value}function m(w){s.value=w,y()}function b(){s.value={},y()}function y(){const w=O=>{O.widget=="unione-form-item"&&O.name&&(O.value!=null&&O.value!=null&&O.value!=""||O.value==0)&&(s.value[O.name]==null||s.value[O.name]==null||s.value[O.name]=="")&&(s.value[O.name]=O.value),O.widgets?.forEach(g=>{w(g)})};h.value.forEach(O=>{w(O)})}function k(){return a.value.validate()}function v(w=!0){i.value=w}return e({validate:k,getValue:u,setValue:m,reset:b,setDisabled:v}),(w,O)=>{const g=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(ht,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(g,{ref_key:"formObj",ref:a,model:s.value,class:n.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(c.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,(p,B)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(p.widget),{key:B,widget:p,editor:r.value,value:s.value[p.name],"onUpdate:value":V=>s.value[p.name]=V,disabled:i.value,formValue:s.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[o.editor&&d.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(La,{wid:d.value.wid,editor:o.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-9a034019"]]);function bl(o,e=!1){const t=Ie();if(!o)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+o);return i&&e==!1?Promise.resolve(JSON.parse(i)):(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+o+",force:"+e),new Promise((l,s)=>{K.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)),l(r)):s("字典加载失败,dict:"+o+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+o,a),s("字典加载失败,dict:"+o+",error:"+a.message)})}))}async function yl(o,e){const t=Ie();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await bl(o),l=i.filter(s=>s.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+o+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+o+",key:"+e))}async function za(o,e){const t=await yl(o,e);return Promise.resolve(t.dictValue)}const wl={load:bl,getLabel:za,getOption:yl};class Ke{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=Ie()}load(e,t=!1){return!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}wl.load(this.convertObj.dictName,t).then(s=>{this.options=s,typeof e=="number"&&this.options.forEach(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,l)=>{const s=this.convertObj.params||{body:{}};this.convertObj.pidField&&(s.pid=-1);const a=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:a,data:s,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(d=>{d.value=parseInt(d.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(h=>h.value==e).length?i(this.options):(s.body||(s.body={}),s.body[this.convertObj.valueField||"id"]=e,K.axios.admin({url:a,data:s,method:"POST"}).then(h=>{if(h.success){const f={};this.options.forEach(c=>{f[e]=!0}),h.body.forEach(c=>{f[c.value]||this.options.push(c)}),i(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?wl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(i=>i.value==e);return t.length?Promise.resolve(t[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const t=this.options.filter(i=>i.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,i)=>{this.load(e).then(l=>{const s=l.filter(a=>a.value==e);if(s.length)return t(s[0].label);i()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((i,l)=>{const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:s,data:e,method:"POST"}).then(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),l("加载下级数据项失败,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;K.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(l=>{l.success?(this.$processOptions(l.body),t(l.body)):t([])})})}$processOptions(e){return this.convertObj.types=="local"&&e.forEach(t=>{this.convertObj.idField&&(t.id=t[this.convertObj.idField]),this.convertObj.pidField&&(t.pid=t[this.convertObj.pidField]),t.value=t[this.convertObj.valueField||"id"],t.label=t[this.convertObj.labelField||"title"]}),e}}const qa=["innerHTML"],Ua={key:2,class:"text-view"},Wa=te(n.defineComponent({__name:"formItem",props:n.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.inject("formSetting");n.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(t.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?t.value=s.value.value.split(","):t.value=[s.value.value])))});const l=n.ref({}),s=n.computed(()=>{const k=e.editor?.widget(e.wid)||e.widget||{};return k.event&&Object.keys(k.event).forEach(v=>{const w=k.event[v];w&&(l.value[v]=null,typeof w=="function"?l.value[v]=w:w.enable&&w.scriptText&&(l.value[v]=new Function("value","ctx",w.scriptText)))}),k}),a=n.computed(()=>!(l.value.visible&&l.value.visible(e.formValue[s.value.name],e.formValue)==!1)),r=n.computed(()=>l.value.title&&l.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=n.computed(()=>l.value.change&&l.value.change(e.formValue[s.value.name],e.formValue)||s.value.change),h=n.ref({}),f=n.computed(()=>{const k=[],v=s.value.rule||{};if((s.value.props?.required||s.value.required)&&k.push({required:!0,whitespace:v?.whitespace||!1,trigger:v?.trigger||i.ruleTrigger||"change",validator:(w,O)=>(v?.whitespace&&O&&typeof O=="string"&&(O=O.trim()),O!=null&&O!=null&&(O+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(s.value.title+"不能为空!"))}),v.advance&&h.value[v.advance]){const w=h.value[v.advance];k.push({pattern:w.pattern,message:w.message||"表单验证不通过!",trigger:v.trigger||i.ruleTrigger||"change"})}return v.regExpress&&k.push({pattern:v.regExpress,message:v.regMessage||"表单验证不通过!",trigger:v.trigger||i.ruleTrigger||"change"}),s.value.dataLen&&k.push({validator:(w,O)=>O&&(O+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(O+"").length+"]"):Promise.resolve(),trigger:v?.trigger||i.ruleTrigger||"change"}),k}),c=n.computed(()=>{const k=s.value.props||{};if(s.value.control=="a-input-number"){const v=s.value.rule||{};v.rangeMin!=null&&v.rangeMin!=null&&(k.min=v.rangeMin),v.rangeMax!=null&&v.rangeMax!=null&&(k.max=v.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(k.format=s.value.view.dataFormat,k.valueFormat=s.value.view.dataFormat),s.value.required&&(k.required=s.value.required),k}),u=n.computed(()=>{const k=s.value.css||{},v=["form-item-"+s.value.name];return k.cssName&&v.push(k.cssName),i.platform=="app"?k.cssName?typeof k.cssName=="string"&&k.cssName.indexOf("all-line")<0&&v.push("all-line"):v.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!k.cssName||typeof k.cssName=="string"&&k.cssName.indexOf("all-line")<0)&&v.push("all-line"):s.value.view.width==2&&v.push("2in-line")),v}),m=n.computed(()=>{const k=i.showColumn||3;let v=s.value.view?.labelWidth||i.labelWidth||9;return s.value.css?.cssName&&k>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(v/k)}:s.value.view?.width>=3&&k>1?{span:Math.round(v/k)}:{span:v}}),b=n.computed(()=>{const k=i.showColumn||3;let v=s.value.view?.valueWidth||i.valueWidth||19;return s.value.css?.cssName&&k>1&&u.value.includes("all-line")?{}:{span:v}}),y=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new Ke(s.value.convert).convert(t.value.toString()).then(k=>{y.value=k})}),(k,v)=>{const w=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(ht,{class:n.normalizeClass(["unione-form-item",u.value]),style:n.normalizeStyle(s.value.css?.cssText)},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createBlock(w,{key:0,label:r.value,name:s.value.name,labelCol:m.value,wrapperCol:b.value,required:s.value.props?.required,rules:f.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:n.withCtx(()=>[!o.editor||o.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value.control||"a-input"),n.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:o.disabled,onChange:d.value,value:t.value,"onUpdate:value":v[0]||(v[0]=O=>t.value=O)},c.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","style"])):s.value.view=="html"?(n.openBlock(),n.createElementBlock("div",{key:1,class:"text-view",innerHTML:y.value?y.value:t.value},null,8,qa)):(n.openBlock(),n.createElementBlock("div",Ua,n.toDisplayString(y.value?y.value:t.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-70d75c15"]]);function xl(o,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{o(i)},e)}}const Ha=te(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){Ie();const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),s=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),a=xl(f=>{h.value.search(f).then(c=>{i.value=c})},500);n.onMounted(()=>{h.value.load(t.value).then(f=>{i.value=f})});const r=n.ref({}),d=n.computed(()=>{const f=e.editor?.widget(e.wid)||e.widget||{};return f.event&&Object.keys(f.event).forEach(c=>{const u=f.event[c];r.value[c]=null,u.enable&&u.scriptText&&(r.value[c]=new Function("value","ctx",u.scriptText))}),f}),h=n.computed(()=>{const f=d.value.convert||e.convert||{};return new Ke(f)});return n.watch(t,()=>{t.value&&h.value.load(t.value).then(f=>{i.value=f})}),n.watch(()=>d.value.convert||e.convert||{},()=>{h.value.load().then(f=>{i.value=f})}),(f,c)=>{const u=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(u,{class:"unione-form-select",options:l.value,showSearch:s.value,value:t.value,"onUpdate:value":c[0]||(c[0]=m=>t.value=m),onSearch:n.unref(a)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Ka=te(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 l=n.ref({}),s=n.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const h=r.event[d];l.value[d]=null,h.enable&&h.scriptText&&(l.value[d]=new Function("value","ctx",h.scriptText))}),r}),a=n.computed(()=>{const r=s.value.convert||e.convert;return r?new Ke(r):null});return(r,d)=>{const h=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(h,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=f=>t.value=f)}),null,16,["checked"])}}}),[["__scopeId","data-v-a56d945e"]]),Qa=te(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([]),l=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 s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const f=d.event[h];s.value[h]=null,f.enable&&f.scriptText&&(s.value[h]=new Function("value","ctx",f.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new Ke(d)});return(d,h)=>{const f=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(f,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=c=>t.value=c)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Ga=te(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([]),l=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 s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(h=>{const f=d.event[h];s.value[h]=null,f.enable&&f.scriptText&&(s.value[h]=new Function("value","ctx",f.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new Ke(d)});return(d,h)=>{const f=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(f,{class:"unione-form-checkbox",options:l.value,value:t.value,"onUpdate:value":h[0]||(h[0]=c=>t.value=c)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Ya=te(n.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(o){const e=n.ref(),t=n.useModel(o,"value");return n.watch(()=>e.value,()=>{e.value?t.value=K.utils.sm2Encrypt(e.value):t.value=""}),(i,l)=>{const s=n.resolveComponent("a-input-password");return n.openBlock(),n.createBlock(s,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=a=>e.value=a)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]),Xa={class:"unione-props-setting unione-query-setting"},Ja={class:"unione-query-opts"},Za={key:0},er=["onClick"],tr={key:1},ir={key:1,class:"edit-field"},nr=["onClick"],lr=te(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:O})=>O+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),i=n.computed(()=>{const O=e.editor.widget(e.wid)||{};return O.configs||(O.configs={}),O.configs.btns||(O.configs.btns=[]),O}),l=n.computed(()=>(e.editor.dataModels()||[]).map(g=>({value:g.sn,label:g.title+"("+g.name+")"}))),s=n.computed(()=>{const O=[],g=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(p=>{O.push(p),g.push(p.name)}),g.includes("query")||O.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),g.includes("reset")||O.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),g.includes("reset")||O.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),O.sort((p,B)=>{const V=p.index||1,C=B.index||1;return V-C}),O}),a=n.ref(null);function r(O){a.value&&a.value.open(O,g=>{g.visible=!0,Object.keys(g).forEach(p=>{O[p]=g[p]}),i.value.configs.btns.sort((p,B)=>{const V=p.index||1,C=B.index||1;return V-C}),i.value.configs.btns=[...i.value.configs.btns]})}function d(){const O=i.value.configs.btns.length+1;let g={title:"新增",name:"new_"+O,size:"default",index:O,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(g),e.editor.widget(e.wid,i.value),a.value.open(g,p=>{Object.keys(p).forEach(B=>{g[B]=p[B]}),i.value.configs.btns=[...i.value.configs.btns]})}function h(O){const g=()=>{if(["query","reset","advanced"].includes(O.name))O.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const p=[];i.value.configs.btns.forEach(B=>{B.name!=O.name&&p.push(B)}),i.value.configs.btns=p}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{g()}})}const f=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),c=n.computed(()=>f.value.fields?.length?f.value.fields:[]),u={mounted:O=>O.focus()},m=n.ref({});function b(){const O=Object.keys(m.value);if(O.length)for(let g in O){const p=c.value.filter(B=>B.name==g);if(p&&p[0]){let B=m.value[g];Object.keys(B).forEach(V=>{if(V=="showIndex"){const C=p[0].show?.query||{};p[0].show||(p[0].show={}),p[0].show.query={...C,index:B[V]}}else p[0][V]=B[V]})}}m.value={}}function y(O,g){b();const p={};p[g]=O[g]||"",g=="showIndex"&&(p[g]=O.show?.query?.index),m.value[O.name]=p}function k(O,g){if(!O||!g){m.value={};return}const p=m.value[O.name][g];if(g=="showIndex"){const B=O.show?.query||{};O.show||(O.show={}),O.show.query={...B,index:p}}else O[g]=p;m.value={}}function v(O,g){c.value.filter(B=>B.name==O.name).forEach(B=>{B[g]=!B[g]})}const w=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:O=>{const g=w.value.options.filter(p=>p.value==O);return g[0]?g[0].label:O}});return(O,g)=>{const p=n.resolveComponent("a-divider"),B=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),C=n.resolveComponent("PlusOutlined"),x=n.resolveComponent("a-select"),N=n.resolveComponent("ToolOutlined"),M=n.resolveComponent("a-checkbox"),E=n.resolveComponent("a-input-number"),T=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Xa,[n.createVNode(p,{orientation:"left"},{default:n.withCtx(()=>g[3]||(g[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Ja,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,D=>(n.openBlock(),n.createBlock(V,n.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size||"default",ref_for:!0},D.props||{},{onClick:R=>r(D)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(D.title)+" ",1),D.visible?(n.openBlock(),n.createBlock(B,{key:0,class:"btn-del",onClick:n.withModifiers(R=>h(D),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),onClick:g[0]||(g[0]=D=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(C)]),_:1})]),n.createVNode(p,{orientation:"left"},{default:n.withCtx(()=>g[4]||(g[4]=[n.createTextVNode("查询字段")])),_:1}),g[5]||(g[5]=n.createTextVNode(" 数据模型:")),n.createVNode(x,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":g[1]||(g[1]=D=>i.value.dataModel=D)},null,8,["options","value"]),n.createVNode(T,{columns:t.value,"data-source":c.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:D})=>[["showIndex","queryType"].includes(D.key)?(n.openBlock(),n.createElementBlock("span",Za,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(D.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:D,text:R,record:A})=>[["queryType"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!m.value[A.name]||!Object.keys(m.value[A.name]).includes(D.dataIndex))&&!R&&"empty"]),onClick:q=>y(A,D.dataIndex)},[m.value[A.name]&&Object.keys(m.value[A.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:A[D.dataIndex],"onUpdate:value":q=>A[D.dataIndex]=q,allowClear:!0,options:w.value.options,onBlur:g[2]||(g[2]=q=>k())},null,8,["value","onUpdate:value","options"])),[[u]]):(n.openBlock(),n.createElementBlock("span",tr,n.toDisplayString(w.value.showLabel(R)),1))],10,er)):["isQuery"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",ir,[n.createVNode(M,{checked:A[D.dataIndex],onClick:q=>v(A,D.dataIndex)},null,8,["checked","onClick"])])):D.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!m.value[A.name]||!Object.keys(m.value[A.name]).includes(D.dataIndex))&&!R&&"empty"]),onClick:q=>y(A,D.dataIndex)},[m.value[A.name]&&Object.keys(m.value[A.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(E,{key:0,value:m.value[A.name][D.dataIndex],"onUpdate:value":q=>m.value[A.name][D.dataIndex]=q,onBlur:q=>k(A,D.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(A.show?.query?.index||" "),1)],64))],10,nr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),sr={class:"query-btn"},or={class:"btn-advanced-overlay"},vl=te(n.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},fields:{type:Array},params:{type:Object,default(){return{}}}},emits:["query","reset","btnClick"],setup(o,{emit:e}){const t=o,i=n.computed(()=>{const k=t.editor?.widget(t.wid)||t.widget||{};return k.btns||(k.btns=[]),k}),l=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),s=n.computed(()=>{let k=[];return i.value.fields?.length&&(k=i.value.fields),k.length==0&&t.fields?.length&&(k=t.fields),k.sort((v,w)=>{const O=v.show?.query?.index||1,g=w.show?.query?.index||1;return O-g}),k.forEach(v=>{!v.widget&&!v.control&&v.convert&&(v.widget="unione-select-box"),v.widget=v.widget||v.control||"a-input",v.defaultValue!=null&&v.defaultValue!="undefined"&&typeof v.defaultValue<"u"&&(f.value[v.name]=v.defaultValue,v.value=v.defaultValue)}),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"],h=n.computed(()=>{const k=i.value.btns.filter(w=>w.name!="advanced"),v=[];return k.forEach(w=>{w.size||(w.size="default"),v.push(w.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((w,O)=>{const g=w.index||1,p=O.index||1;return g-p}),k}),f=n.ref({}),c=n.computed(()=>{const k={};return i.value.params?Object.keys(i.value.params).forEach(v=>{k[v]=i.value.params[v]}):t.params&&Object.keys(t.params).forEach(v=>{k[v]=t.params[v]}),k});n.onMounted(()=>{t.editor?.ebus.$on("query-form-params",k=>{i.value.params=k}),b()});const u=e;function m({btn:k,event:v}){console.log("unione query form btn click",k,v),k.name=="query"&&b(),k.name=="reset"&&y(),u("btnClick",{btn:k,event:v})}function b(){const k=[];s.value.forEach(w=>{w.visible&&k.push(w.name)});const v={params:{...c.value},keywords:""};Object.keys(f.value).forEach(w=>{k.includes(w)&&(v.params[w]=f.value[w])}),l.value.visible&&f.value[l.value.name]&&(v.keywords=f.value[l.value.name]),u("query",v),t.editor?.ebus.$emit("table-list-search",v)}function y(){f.value={},s.value.forEach(v=>{v.visible=!1});const k={params:{...c.value},keywords:""};u("reset",k),t.editor?.ebus.$emit("table-list-reset",k)}return(k,v)=>{const w=n.resolveComponent("a-input"),O=n.resolveComponent("a-form-item"),g=n.resolveComponent("unione-btn"),p=n.resolveComponent("a-checkbox"),B=n.resolveComponent("DownOutlined"),V=n.resolveComponent("a-button"),C=n.resolveComponent("a-dropdown"),x=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(ht,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},n.createSlots({default:n.withCtx(()=>[n.createVNode(x,{model:f.value,layout:"horizontal","label-col":{span:a.value}},{default:n.withCtx(()=>[l.value.visible?(n.openBlock(),n.createBlock(O,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:n.normalizeStyle({width:a.value})},{default:n.withCtx(()=>[n.createVNode(w,{placeholder:l.value.placeholder,value:f.value[l.value.name],"onUpdate:value":v[0]||(v[0]=N=>f.value[l.value.name]=N),allowClear:"",onKeyup:n.withKeys(b,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,N=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N.name},[N.visible?(n.openBlock(),n.createBlock(O,{key:0,label:N.title,class:n.normalizeClass(["query-field",N.name]),style:n.normalizeStyle({width:a.value}),name:N.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(N.widget),n.mergeProps({placeholder:N.placeholder,value:f.value[N.name],"onUpdate:value":M=>f.value[N.name]=M,ref_for:!0},N.props||{},{allowClear:"",widget:N}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",sr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,N=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N.name},[N.visible!=!1?(n.openBlock(),n.createBlock(g,{key:0,widget:N,editor:o.editor,onClick:m,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&s.value.length?(n.openBlock(),n.createBlock(C,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",or,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,N=>(n.openBlock(),n.createBlock(p,{key:N.name,class:"item",checked:N.visible,onClick:M=>N.visible=!N.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(N.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(V,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value.title)+" ",1),n.createVNode(B)]),_:1})]),_:1},8,["trigger"])):n.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(lr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),ar={class:"unione-props-setting unione-table-setting"},rr={class:"unione-table-tools"},dr={key:1,class:"unione-table-opts"},cr={key:0},hr=["onClick"],fr={key:1,class:"edit-field"},ur=["onClick"],pr={key:1},mr=te(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:C})=>C+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(C,x){let N=C.filter(M=>M.value==x);return N&&N[0]&&N[0].label||x}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,x){let N=C.filter(M=>M.value==x);return N&&N[0]&&N[0].label||x}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.leftBtns||(C.configs.leftBtns=[]),C.configs.rightBtns||(C.configs.rightBtns=[]),C.configs.operation||(C.configs.operation={}),C.configs.operation.btns||(C.configs.operation.btns=[]),C.configs.operation.more||(C.configs.operation.more={}),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),s=n.computed(()=>{if(!i.value)return[];const C=[],x=i.value.configs.leftBtns;if(x.forEach(N=>{C.push(N.name)}),!C.includes("add")){const N={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};x.splice(0,0,N)}if(!C.includes("delBatch")){const N={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};x.splice(1,0,N)}return x}),a=n.computed(()=>{if(!i.value)return[];const C=[],x=i.value.configs.rightBtns;if(x.forEach(N=>{C.push(N.name)}),!C.includes("downData")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};x.splice(0,0,N)}if(!C.includes("impData")){const N={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};x.splice(1,0,N)}if(!C.includes("expData")){const N={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};x.splice(2,0,N)}if(!C.includes("downTmpl")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};x.splice(3,0,N)}return x});function r(C,x){C=="left"?f.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(M=>{x[M]=N[M]}),i.value.configs.leftBtns.sort((M,E)=>{const T=M.index||1,D=E.index||1;return T-D}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):f.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(M=>{x[M]=N[M]}),i.value.configs.rightBtns.sort((M,E)=>{const T=M.index||1,D=E.index||1;return T-D}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(C){const x=C=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let N={title:"新增"+x,name:"new_"+x,index:x,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?i.value.configs.leftBtns.push(N):i.value.configs.rightBtns.push(N),e.editor.widget(e.wid,i.value),r(C,N)}function h(C,x){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(x.name))x.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const M=[];i.value.configs.leftBtns.forEach(E=>{E.name!=x.name&&M.push(E)}),i.value.configs.leftBtns=M}else{const M=[];i.value.configs.rightBtns.forEach(E=>{E.name!=x.name&&M.push(E)}),i.value.configs.rightBtns=M}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const f=n.ref(null);function c(C){f.value.open(C,x=>{x.visible=!0,Object.keys(x).forEach(N=>{C[N]=x[N]}),i.value.configs.operation.btns.sort((N,M)=>{const E=N.index||1,T=M.index||1;return E-T}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const C=i.value.configs.operation.btns.length+1;let x={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(x),e.editor.widget(e.wid,i.value),f.value.open(x,N=>{Object.keys(N).forEach(M=>{x[M]=N[M]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function m(C){const x=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const N=[];i.value.configs.operation.btns.forEach(M=>{M.name!=C.name&&N.push(M)}),i.value.configs.operation.btns=N}};Y.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{x()}})}const b=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),y=n.computed(()=>b.value.fields?.length?(b.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),b.value.fields):[]),k={mounted:C=>C.focus()},v=n.ref({});function w(){const C=Object.keys(v.value);if(C.length)for(let x in C){const N=y.value.filter(M=>M.name==x);if(N&&N[0]){let M=v.value[x];Object.keys(M).forEach(E=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),E=="showIndex"?N[0].show.list.index=M[E]:E=="showWidth"?N[0].show.list.width=M[E]:E=="fixed"?N[0].show.list.fixed=M[E]:E=="align"?N[0].show.list.align=M[E]:N[0][E]=M[E]})}}v.value={}}function O(C,x){w();const N={};x=="showIndex"?N[x]=C.show?.list?.index:x=="showWidth"?N[x]=C.show?.list?.width:x=="fixed"?N[x]=C.show?.list?.fixed:x=="align"?N[x]=C.show?.list?.align:N[x]=C[x]||"",v.value[C.name]=N}function g(C,x){if(!C||!x){v.value={};return}const N=v.value[C.name][x];C.show||(C.show={}),C.show.list||(C.show.list={}),x=="showIndex"?C.show.list.index=N:x=="showWidth"?C.show.list.width=N:x=="fixed"?C.show.list.fixed=N:x=="align"?C.show.list.align=N:C[x]=N,v.value={}}function p(C,x){return x=="showIndex"?C.show?.list?.index:x=="showWidth"?C.show?.list?.width:x=="fixed"?C.show?.list?.fixed:x=="align"?C.show?.list?.align:C[x]}function B(C,x){y.value.filter(M=>M.name==C.name).forEach(M=>{M[x]=!M[x]})}const V=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const x=V.value.options.filter(N=>N.value==C);return x[0]?x[0].label:C}});return(C,x)=>{const N=n.resolveComponent("a-divider"),M=n.resolveComponent("CloseOutlined"),E=n.resolveComponent("a-button"),T=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-input"),R=n.resolveComponent("a-form-item"),A=n.resolveComponent("a-col"),q=n.resolveComponent("a-input-number"),P=n.resolveComponent("a-checkbox"),Q=n.resolveComponent("a-row"),L=n.resolveComponent("a-select"),S=n.resolveComponent("ToolOutlined"),F=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",ar,[n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[8]||(x[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",rr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,_=>(n.openBlock(),n.createBlock(E,n.mergeProps({key:_.name,class:["btn",_.name,!_.visible&&"deleted"],type:_.visible?_.type:"default",size:_.size,ref_for:!0},_.props||{},{onClick:I=>r("left",_)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(_.title)+" ",1),_.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers(I=>h("left",_),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[_.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(_.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(E,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:x[0]||(x[0]=_=>d("left"))},{default:n.withCtx(()=>[n.createVNode(T)]),_:1}),n.createVNode(E,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:x[1]||(x[1]=_=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(T)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,_=>(n.openBlock(),n.createBlock(E,n.mergeProps({key:_.name,class:["btn","right",_.name,!_.visible&&"deleted"],type:_.visible?_.type:"default",size:_.size,ref_for:!0},_.props||{},{onClick:I=>r("right",_)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(_.title)+" ",1),_.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"bool-del",onClick:n.withModifiers(I=>h("right",_),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[_.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(_.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[9]||(x[9]=[n.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createBlock(Q,{key:0},{default:n.withCtx(()=>[n.createVNode(A,{span:7},{default:n.withCtx(()=>[n.createVNode(R,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(D,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(A,{span:5},{default:n.withCtx(()=>[n.createVNode(R,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(q,{value:i.value.configs.operation.width,"onUpdate:value":x[2]||(x[2]=_=>i.value.configs.operation.width=_)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(A,{span:6},{default:n.withCtx(()=>[n.createVNode(R,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(q,{value:i.value.configs.operation.count,"onUpdate:value":x[3]||(x[3]=_=>i.value.configs.operation.count=_)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(A,{span:5},{default:n.withCtx(()=>[n.createVNode(R,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(P,{checked:i.value.configs.operation.visible,"onUpdate:checked":x[4]||(x[4]=_=>i.value.configs.operation.visible=_)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[10]||(x[10]=[n.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createElementBlock("div",dr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,_=>(n.openBlock(),n.createBlock(E,n.mergeProps({key:_.name,class:["btn",_.name,!_.visible&&"deleted"],type:_.visible?_.type:"default",size:_.size||"small",ref_for:!0},_.props||{},{onClick:I=>c(_)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(_.title)+" ",1),_.visible?(n.openBlock(),n.createBlock(M,{key:0,class:"btn-del",onClick:n.withModifiers(I=>m(_),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[_.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(_.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(E,{class:n.normalizeClass(["btn","btn-add"]),onClick:x[5]||(x[5]=_=>u()),size:"small"},{default:n.withCtx(()=>[n.createVNode(T)]),_:1})])):n.createCommentVNode("",!0),n.createVNode(N,{orientation:"left"},{default:n.withCtx(()=>x[11]||(x[11]=[n.createTextVNode("表头设置")])),_:1}),x[12]||(x[12]=n.createTextVNode(" 数据模型:")),n.createVNode(L,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":x[6]||(x[6]=_=>i.value.dataModel=_)},null,8,["options","value"]),n.createVNode(F,{columns:t.value,"data-source":y.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:_})=>[["showIndex","showWidth","align","fixed"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",cr,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:_,record:I})=>[["showIndex","showWidth"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!v.value[I.name]||!Object.keys(v.value[I.name]).includes(_.dataIndex))&&!p(I,_.dataIndex)&&"empty"]),onClick:U=>O(I,_.dataIndex)},[v.value[I.name]&&Object.keys(v.value[I.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(q,{key:0,value:v.value[I.name][_.dataIndex],"onUpdate:value":U=>v.value[I.name][_.dataIndex]=U,onBlur:U=>g(I,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[k]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p(I,_.dataIndex)),1)],64))],10,hr)):["isList","isQuery","isSort"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",fr,[n.createVNode(P,{checked:I[_.dataIndex],onClick:U=>B(I,_.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!v.value[I.name]||!Object.keys(v.value[I.name]).includes(_.dataIndex))&&!p(I,_.dataIndex)&&"empty"]),onClick:U=>O(I,_.dataIndex)},[v.value[I.name]&&Object.keys(v.value[I.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(L,{key:0,value:I.show.list[_.dataIndex],"onUpdate:value":U=>I.show.list[_.dataIndex]=U,allowClear:!0,options:_.options,onBlur:x[7]||(x[7]=U=>g())},null,8,["value","onUpdate:value","options"])),[[k]]):(n.openBlock(),n.createElementBlock("span",pr,n.toDisplayString(_.showLabel(_.options,p(I,_.dataIndex))),1))],10,ur)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(ci,{ref_key:"btnSetting",ref:f,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function tn(o){const e=o.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const gr={toHump:tn},kr={class:"unione-table-tools"},br={class:"unione-table-data"},yr={key:0,class:"unione-table-opts"},Cl=te(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=Ie(),l=o,s=n.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),a=n.computed(()=>s.value.props||{}),r=n.computed(()=>s.value.rowKey||l.rowKey||"id"),d=n.computed(()=>s.value.dsn?l.editor?.dataManager().use(s.value.dsn,"list"):null),h=n.computed(()=>{const T=l.dataList||[];return!T.length&&d.value?d.value.data().body||[]:T}),f=n.computed(()=>{if(s.value.operation==!1)return{visible:!1};const T=K.utils.obj.ext(s.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),D=[];let R=(s.value.operation?.btns||[]).map(A=>(typeof A=="string"&&(A={name:A,visible:!1}),A));if(R.forEach(A=>{D.push(A.name)}),D.includes("edit")||R.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),D.includes("view")||R.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),D.includes("delete")||R.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const A=R.filter(P=>P.name=="edit")[0];if(A.visible&&(A.action||(A.action={}),A.action.type||(A.action.type="route"),!A.action.href)){const P=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",Q=l.editor.model.value;A.action.link=i.editPageUrl+"?psn="+P+"&model="+Q+"&id={row."+l.rowKey+"}"}const q=R.filter(P=>P.name=="view")[0];if(q.visible&&(q.action||(q.action={}),q.action.type||(q.action.type="route"),!q.action.href)){const P=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";q.action.link=i.viewPageUrl+"?psn="+P+"&model=view&id={row."+l.rowKey+"}"}}return R=R.filter(A=>A.visible!=!1).sort((A,q)=>{const P=A.index||1,Q=q.index||1;return P-Q}),T.count&&(R.length>T.count+1?(T.btns=R.slice(0,T.count),T.more.items=R.slice(T.count,R.length),T.more.visible=!0):(T.btns=R,T.more.visible=!1)),T}),c=n.computed(()=>{let T=[];s.value.columns?.length&&(T=[...s.value.columns]);const D=[];T.forEach((A,q)=>{A.dataIndex=A.name,A.convert&&(A.dataIndex=A.name+"Label",A.convertObj=new Ke(A.convert),A.customCell=(P,Q,L)=>{const S=P[L.name];A.convertObj&&(P[L.dataIndex]==null||P[L.dataIndex]==null)&&S!=null&&S!=null&&(S+"").length>0&&(P[L.dataIndex]=S,A.convertObj.convert(S).then(F=>{F&&(P[L.dataIndex]=F)}))}),A.sort?.enable&&(A.sorter=!0,A.sort.multiple&&(A.sorter={},A.sorter.multiple=A.sort.multiple),A.sort.defoult&&(A.defaultSortOrder=A.sort.asc?"ascend":"descend")),A.customRender=({text:P})=>P||"--",A.fkey?.enable&&(A.fkey.labelName&&(A.dataIndex=tn(A.fkey.labelName)),A.fkey.labelTitle&&(A.title=A.fkey.labelTitle),A.customRender=({record:P,column:Q})=>P&&P[Q.name+"FEntry"]&&P[Q.name+"FEntry"][Q.dataIndex]||"--",A.fkey.fields?.forEach((P,Q)=>{if(!P.name)return;const L=tn(P.name),S={fkName:A.name,title:P.title,name:L,dataIndex:P.name,width:P.width,index:P.index||q+Q+1,customRender:({record:F,column:_})=>{if(F&&F[_.fkName+"FEntry"]){const I=F[_.fkName+"FEntry"][_.name];if(I)return P.convertObj&&P.convertObj.convert(I)||I}return"--"}};P.convert&&(P.convertObj=new Ke(P.convert)),D.push(S)}))}),D.forEach(A=>{T.splice(A.index,0,A)});const R=K.utils.obj.ext(s.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return R&&R.visible!=!1&&(R.customRender=A=>O.value?(O.value.current-1)*O.value.pageSize+A.index+1:A.index,T=[R,...T]),f.value&&f.value.visible!=!1&&T.push({fixed:"right",align:"center",...f.value,name:"operation"}),T}),u=n.computed(()=>{if(s.value.leftBtns===!1)return[];const T=[],D=[];if((s.value.leftBtns||[]).map(A=>(typeof A=="string"&&(A={name:A,visible:!1}),A)).forEach(A=>{A.visible!=!1&&T.push(A),D.push(A.name),A.name=="delBatch"&&!g.value&&(A.visible=!1)}),!D.includes("add")){const A={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};T.splice(0,0,A)}if(!D.includes("delBatch")&&g.value){const A={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};T.splice(1,0,A)}if(l.editor&&l.editor.type.value!="code"){const A=T.filter(q=>q.name=="add")[0];if(A.visible&&(A.action||(A.action={}),A.action.type||(A.action.type="route"),!A.action.href)){const q=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",P=l.editor.model.value;A.action.link=i.addPageUrl+"?psn="+q+"&model="+P}}return T});function m({btn:T,event:D}){if(i.isDebug&&console.log("unione table left btn click",T,D),T.name=="delBatch"){if(!p.value.selectedRowKeys.length){Y.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.deleteByIds(p.value.selectedRowKeys).then(()=>{M(),N(!0)});return}Y.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+p.value.selectedRowKeys.length+")数据",onOk:()=>{V("delBatch",{btn:T,event:D,keys:p.value.selectedRowKeys}),V("leftBtnClick",{btn:T,event:D,keys:p.value.selectedRowKeys}),V("btnClick",{btn:T,event:D,keys:p.value.selectedRowKeys})}});return}V(T.name,{btn:T,event:D}),V("leftBtnClick",{btn:T,event:D}),V("btnClick",{btn:T,event:D})}const b=n.computed(()=>{if(s.value.rightBtns===!1)return[];const T=[],D=[];if((s.value.rightBtns||[]).map(A=>(typeof A=="string"&&(A={name:A,visible:!1}),A)).forEach(A=>{A.visible!=!1&&T.push(A),D.push(A.name)}),!D.includes("impData")){const A={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};T.splice(1,0,A)}if(!D.includes("expData")){const A={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};T.splice(2,0,A)}if(!D.includes("downTmpl")){const A={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};T.splice(3,0,A)}return T});function y({btn:T,event:D}){i.isDebug&&console.log("unione table right btn click",T,D),V(T.name,{btn:T,event:D}),V("rightBtnClick",{btn:T,event:D}),V("btnClick",{btn:T,event:D})}const k=n.computed(()=>({bordered:!0,size:"small",...s.value.attrs||{}})),v=n.ref({}),w=n.ref(null),O=n.computed(()=>K.utils.obj.ext(l.pagination||s.value.pagination,{showTotal:T=>"共"+T+"记录",pageSize:l.pagination?.pageSize||d.value?.data()?.pageSize||10,current:l.pagination?.current||d.value?.data()?.page||1,total:l.pagination?.total||d.value?.data()?.total||0,position:["bottomCenter"]})),g=n.computed(()=>typeof s.value.selection<"u"?s.value.selection:!0),p=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(T,D)=>{p.value.selectedRowKeys=T,p.value.selectedRowList=D},getCheckboxProps:T=>({disabled:T.checkable})}),B=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],V=t;function C({btn:T,event:D},R){if(i.isDebug&&console.log("unione table opt btn click",T,D),T.name=="delete"){if(d.value){d.value.deleteByIds([R[r.value]]).then(()=>{M(),p.value.selectedRowKeys=p.value.selectedRowKeys.filter(A=>A!=R[r.value]),p.value.selectedRowList=p.value.selectedRowList.filter(A=>A[r.value]!=R[r.value])});return}Y.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{V(T.name,{btn:T,event:D,row:R}),V("optBtnClick",{btn:T,event:D,row:R}),V("btnClick",{btn:T,event:D,row:R})}});return}V(T.name,{btn:T,event:D,row:R}),V("optBtnClick",{btn:T,event:D,row:R}),V("btnClick",{btn:T,event:D,row:R})}function x(T,D,R,A){console.log("tableChanged",T,D,R,A),w.value={page:T.current,pageSize:T.pageSize},R&&(Array.isArray(R)?(w.value.sorts=[],R.forEach(q=>{w.value.sorts.push({name:q.column.name,asc:q.order=="ascend"})})):R.column&&(w.value.sorts=[{name:R.column.name,asc:R.order=="ascend"}])),M(),V("change",{pagination:T,filters:D,sorter:R,event:A})}function N(T=!1){T?(p.value.selectedRowKeys=[],p.value.selectedRowList=[]):Y.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${p.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{p.value.selectedRowKeys=[],p.value.selectedRowList=[]}})}function M(){if(d.value){const T={page:O.value.current,pageSize:O.value.pageSize,keywords:v.value.keywords,body:v.value.params||{}};w.value?.page&&(T.page=w.value.page),w.value?.pageSize&&(T.pageSize=w.value.pageSize),w.value?.sorts&&(T.sorts=w.value.sorts),console.log("dataStorage find params",T),d.value.find(T)}}n.onMounted(()=>{c.value?.forEach(T=>{T.sort?.enable&&T.sort.defoult&&(w.value||(w.value={},w.value.sorts||(w.value.sorts=[]),w.value.sorts.push({name:T.name,asc:T.sort.asc==!0})))}),l.editor?.ebus.$on("table-list-search",T=>{console.log("table-list-search",T),v.value=T||{},M()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),v.value={},M(),N(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),M()})});function E(){return{keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}}return e({getSelected:E,clearSelected:N}),(T,D)=>{const R=n.resolveComponent("unione-btn"),A=n.resolveComponent("DownOutlined"),q=n.resolveComponent("a-button"),P=n.resolveComponent("a-dropdown"),Q=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(ht,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",kr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,L=>(n.openBlock(),n.createBlock(R,{key:L.name,class:"btn",widget:L,editor:o.editor,onClick:m,preset:B,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),p.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:D[0]||(D[0]=L=>N())},"当前选中记录("+n.toDisplayString(p.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,L=>(n.openBlock(),n.createBlock(R,{key:L.name,class:"btn right",widget:L,editor:o.editor,onClick:y,preset:B,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",br,[c.value&&c.value.length?(n.openBlock(),n.createBlock(Q,n.mergeProps({key:0,columns:c.value,rowKey:r.value,"data-source":h.value,"row-selection":g.value?p.value:null,scroll:{x:a.value.scrollX||"max-content",y:a.value.scrollY},pagination:O.value,onChange:x},k.value),{bodyCell:n.withCtx(({column:L,record:S})=>[L.name==="operation"?(n.openBlock(),n.createElementBlock("div",yr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(f.value.btns,F=>(n.openBlock(),n.createBlock(R,{key:F.name,class:"opt",widget:F,editor:o.editor,onClick:_=>C(_,S),preset:B,ctx:{row:S}},null,8,["widget","editor","onClick","ctx"]))),128)),f.value.more?.visible!=!1&&f.value.more.items?.length?(n.openBlock(),n.createBlock(P,{key:0,trigger:[f.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",f.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",f.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(f.value.more.items,F=>(n.openBlock(),n.createBlock(R,{key:F.name,class:"item",widget:F,editor:o.editor,onClick:_=>C(_,S),type:"text",preset:B,ctx:{row:S}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(q,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(f.value.more.title)+" ",1),n.createVNode(A)]),_:1})]),_:2},1032,["trigger","class"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):n.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(mr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-d11fa152"]]),wr={class:"page-setting-dialog"},jt=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),l=K.useSession(),s=n.computed(()=>l.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 h(){t.editor?.save().then(u=>{console.log("res",u)})}const f=n.ref("");function c(u){f.value||(f.value=i.value),u?t.editor?.setModel("edit"):t.editor?.setModel(f.value)}return(u,m)=>{const b=n.resolveComponent("SettingOutlined"),y=n.resolveComponent("a-tooltip"),k=n.resolveComponent("SaveOutlined"),v=n.resolveComponent("FormOutlined"),w=n.resolveComponent("StopOutlined"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{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"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(k,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-edit",onClick:m[0]||(m[0]=g=>c(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(y,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(w,{class:"btn-edit",onClick:m[1]||(m[1]=g=>c(!1))})]),_:1})):n.createCommentVNode("",!0),n.renderSlot(u.$slots,"default"),i.value=="edit"?(n.openBlock(),n.createBlock(O,{key:4,title:t.settingTitle,open:a.value,"onUpdate:open":m[2]||(m[2]=g=>a.value=g),centered:"",width:"85%",onOk:h},{default:n.withCtx(()=>[n.createElementVNode("div",wr,[n.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),xr={class:"unione-props-setting data-field-manage"},vr={key:0},Cr={key:1},Sr={key:2},Nr={key:3},Br={key:4},Or={key:5},Vr={key:6},_r=["onClick"],Mr=["onClick"],Tr=["onClick"],Ar={key:1},Er=te(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(m=>{i.value.selectedRowKeys.includes(m)||i.value.selectedRowKeys.push(m);const b=[];t.value.forEach(y=>{!u.includes(y.name)&&i.value.selectedRowKeys.includes(y.name)&&b.push(y.name)}),b.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(y=>!b.includes(y)))})}}),l={mounted:u=>u.focus()},s=n.ref({});function a(){const u=Object.keys(s.value);if(u.length)for(let m in u){const b=t.value.filter(y=>y.name==m);if(b&&b[0]){let y=s.value[m];Object.keys(y).forEach(k=>{b[0][k]=y[k]})}}s.value={}}function r(u,m){a();const b={};b[m]=u[m]||"",s.value[u.name]=b}function d(u,m){if(!u||!m){s.value={};return}const b=s.value[u.name][m];if(m=="name"&&t.value.filter(k=>k[m]==b&&k.name!=u.name).length>0){Y.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}u[m]=b,s.value={}}function h(u,m){t.value.filter(y=>y.name==u.name).forEach(y=>{y[m]=!y[m]})}function f(){if(a(),t.value.filter(b=>b.name=="new_").length>0){s.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};t.value.push(m),s.value[m.name]={name:"new_"}}function c(){if(!i.value.selectedRowKeys.length){Y.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}Y.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,m)=>{const b=n.resolveComponent("a-button"),y=n.resolveComponent("a-tooltip"),k=n.resolveComponent("a-input"),v=n.resolveComponent("a-input-number"),w=n.resolveComponent("a-select-option"),O=n.resolveComponent("a-select"),g=n.resolveComponent("a-checkbox"),p=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",xr,[n.createVNode(b,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>m[1]||(m[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:c,size:"small"},{default:n.withCtx(()=>m[2]||(m[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(p,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:n.withCtx(({column:B})=>[B.key==="name"?(n.openBlock(),n.createElementBlock("span",vr,[m[3]||(m[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="title"?(n.openBlock(),n.createElementBlock("span",Cr,[m[4]||(m[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="descs"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Br,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Or,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Vr,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(B.title),1)])):n.createCommentVNode("",!0),B.key==="isPk"?(n.openBlock(),n.createBlock(y,{key:7,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[m[5]||(m[5]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="isFk"?(n.openBlock(),n.createBlock(y,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="isNull"?(n.openBlock(),n.createBlock(y,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0),B.key==="syncDbEnable"?(n.openBlock(),n.createBlock(y,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(B.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:B,text:V,record:C})=>[["name","title","descs","defaultValue"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!V&&"empty"]),onClick:x=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(k,{key:0,value:s.value[C.name][B.dataIndex],"onUpdate:value":x=>s.value[C.name][B.dataIndex]=x,onBlur:x=>d(C,B.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V||" "),1)],64))],10,_r)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!V&&"empty"]),onClick:x=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:s.value[C.name][B.dataIndex],"onUpdate:value":x=>s.value[C.name][B.dataIndex]=x,onBlur:x=>d(C,B.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V||" "),1)],64))],10,Mr)):["dataType"].includes(B.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(B.dataIndex))&&!V&&"empty"]),onClick:x=>r(C,B.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(B.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(O,{key:0,value:C[B.dataIndex],"onUpdate:value":x=>C[B.dataIndex]=x,onBlur:m[0]||(m[0]=x=>d())},{default:n.withCtx(()=>[n.createVNode(w,{key:"String",value:"String"}),n.createVNode(w,{key:"Long",value:"Long"}),n.createVNode(w,{key:"Short",value:"Short"}),n.createVNode(w,{key:"Integer",value:"Integer"}),n.createVNode(w,{key:"Float",value:"Float"}),n.createVNode(w,{key:"Double",value:"Double"}),n.createVNode(w,{key:"Date",value:"Date"}),n.createVNode(w,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Ar,n.toDisplayString(V),1))],10,Tr)):["syncDbEnable","isFk","isPk"].includes(B.dataIndex)?(n.openBlock(),n.createBlock(g,{key:3,checked:C[B.dataIndex],onClick:x=>h(C,B.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(B.dataIndex)?(n.openBlock(),n.createBlock(g,{key:4,checked:!C[B.dataIndex],onClick:x=>h(C,B.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Ir={class:"unione-props-setting data-field-setting"},Dr={key:0},Pr=["onClick"],Fr={class:"field-txt"},$r=["onClick"],Rr={key:1,class:"field-txt"},Lr=["onClick"],jr={key:1},zr=["onClick"],qr={key:0,class:"field-txt"},Ur={key:4,class:"edit-field"},Wr={key:0},Hr=["onClick"],Kr=te(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: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:"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:v=>v.focus()},l=n.ref({});function s(){const v=Object.keys(l.value);if(v.length)for(let w in v){const O=t.value.filter(g=>g.name==w);if(O&&O[0]){let g=l.value[w];Object.keys(g).forEach(p=>{p=="convertName"?(O[0].convert||(O[0].convert={}),O[0].convert.type=g[p]):O[0][p]=g[p]})}}l.value={}}function a(v,w){s();const O={};w=="convertName"?(v.convert||(v.convert={}),O[w]=v.convert?.type):O[w]=v[w]||"",l.value[v.name]=O}function r(v,w){{l.value={};return}}function d(v,w){t.value.filter(g=>g.name==v.name).forEach(g=>{g[w]=!g[w]})}const h=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function f(v,w){const O=t.value.filter(p=>p.name==v.name);O.forEach(p=>{w!="isSort"?p[w]=!0:p[w]=!p[w]});const g=O[0];if(!(!g||w=="isSort")){switch(h.value.prop=w,h.value.field=v,g.show||(g.show={}),w){case"isQuery":g.show.query||(g.show.query={}),h.value.show=g.show.query,h.value.title=`查询设置/${v.title}(${v.name})`;break;case"isForm":g.show.form||(g.show.form={}),h.value.show=g.show.form,h.value.title=`表单设置/${v.title}(${v.name})`;break;case"isView":g.show.view||(g.show.view={}),h.value.show=g.show.view,h.value.title=`详情设置/${v.title}(${v.name})`;break;case"isList":g.show.list||(g.show.list={}),h.value.show=g.show.list,h.value.title=`列头设置/${v.title}(${v.name})`;break}h.value.visible=!0}}const c=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 w=c.value.options.filter(O=>O.value==v);return w[0]?w[0].label:v}}),u=n.ref({visible:!1,field:{},props:{},showInfo:v=>{let w="";return v.rules&&(w=v.rules.filter(O=>O.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const v=u.value.props,w={name:"range",trigger:v.trigger,whitespace:v.whitespace,message:v.rangeMessage};v.rangeMin!=null&&v.rangeMin!=null&&(w.min=v.rangeMin,w.enable=!0),v.rangeMax!=null&&v.rangeMax!=null&&(w.max=v.rangeMax,w.enable=!0);const O={name:"reg",trigger:v.trigger,whitespace:v.whitespace,message:v.regMessage};v.regExpress&&(O.pattern=v.regExpress,O.enable=!0),u.value.field.rules=[w,O],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function m(v){u.value.visible=!0,u.value.field=v;const w=v.rules||[],O={trigger:"change",whitespace:!0};w.forEach(g=>{g.name=="reg"&&(O.trigger=g.trigger,O.whitespace=g.whitespace,O.regExpress=g.pattern,O.regMessage=g.message),g.name=="range"&&(O.rangeMin=g.min,O.rangeMax=g.max,O.rangeMessage=g.message)}),u.value.props=O}const b=n.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:v=>{const w=b.value.widgets.filter(O=>O.value==v);return w[0]?w[0].label:v},toSetting:()=>{}}),y=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(v,w)=>{y.value.convert.options.splice(v,1)},toSetting:()=>{y.value.visible=!1}});function k(v){y.value.visible=!0,y.value.field=v,y.value.convert=v.convert||{}}return(v,w)=>{const O=n.resolveComponent("ToolOutlined"),g=n.resolveComponent("a-button"),p=n.resolveComponent("a-select"),B=n.resolveComponent("a-checkbox"),V=n.resolveComponent("a-table"),C=n.resolveComponent("a-input-number"),x=n.resolveComponent("a-form-item"),N=n.resolveComponent("a-input"),M=n.resolveComponent("a-form"),E=n.resolveComponent("a-modal"),T=n.resolveComponent("a-col"),D=n.resolveComponent("a-row"),R=n.resolveComponent("a-select-option"),A=n.resolveComponent("a-divider"),q=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Ir,[n.createVNode(V,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:P})=>[["widget","queryType","rules","convertName"].includes(P.key)?(n.openBlock(),n.createElementBlock("span",Dr,[n.createVNode(O),n.createTextVNode(" "+n.toDisplayString(P.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:P,text:Q,record:L})=>[["rules"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!u.value.showInfo(L)&&"empty"]),onClick:S=>m(L)},[n.createElementVNode("span",Fr,n.toDisplayString(u.value.showInfo(L)),1),u.value.showInfo(L)?(n.openBlock(),n.createBlock(g,{key:0,type:"link"},{default:n.withCtx(()=>w[22]||(w[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Pr)):["widget"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(P.dataIndex))&&!Q&&"empty"]),onClick:S=>a(L,P.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(P.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:L[P.dataIndex],"onUpdate:value":S=>L[P.dataIndex]=S,allowClear:!0,options:b.value.widgets,onBlur:w[0]||(w[0]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Rr,n.toDisplayString(b.value.widgetName(Q)),1))],10,$r)):["queryType"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[L.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(P.dataIndex))&&!Q&&"empty"]),onClick:S=>a(L,P.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(P.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:L[P.dataIndex],"onUpdate:value":S=>L[P.dataIndex]=S,allowClear:!0,options:c.value.options,onBlur:w[1]||(w[1]=S=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",jr,n.toDisplayString(c.value.showLabel(Q)),1))],10,Lr)):n.createCommentVNode("",!0)],64)):["convertName"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(P.dataIndex))&&!L.convert?.type&&"empty"]),onClick:S=>a(L,P.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(P.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:L.convert.type,"onUpdate:value":S=>L.convert.type=S,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:w[2]||(w[2]=S=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[L.convert?.type?(n.openBlock(),n.createElementBlock("span",qr,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(S=>k(L),["stop"])},{default:n.withCtx(()=>w[23]||(w[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,zr)):["isQuery","isForm","isView","isList","isSort"].includes(P.dataIndex)?(n.openBlock(),n.createElementBlock("div",Ur,[n.createVNode(B,{checked:L[P.dataIndex],onClick:S=>d(L,P.dataIndex)},null,8,["checked","onClick"]),n.createVNode(g,{type:"link",onClick:S=>f(L,P.dataIndex)},{default:n.withCtx(()=>w[24]||(w[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(E,{visible:h.value.visible,"onUpdate:visible":w[9]||(w[9]=P=>h.value.visible=P),title:h.value.title,onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(x,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(C,{value:h.value.show.index,"onUpdate:value":w[3]||(w[3]=P=>h.value.show.index=P)},null,8,["value"])]),_:1}),["isQuery"].includes(h.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(x,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.width,"onUpdate:value":w[4]||(w[4]=P=>h.value.show.width=P)},null,8,["value"])]),_:1})),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(x,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.labelWidth,"onUpdate:value":w[5]||(w[5]=P=>h.value.show.labelWidth=P)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(h.value.prop)?(n.openBlock(),n.createBlock(x,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(N,{value:h.value.show.valueWidth,"onUpdate:value":w[6]||(w[6]=P=>h.value.show.valueWidth=P)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(x,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(p,{value:h.value.show.fixed,"onUpdate:value":w[7]||(w[7]=P=>h.value.show.fixed=P),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(n.openBlock(),n.createBlock(x,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(p,{value:h.value.show.align,"onUpdate:value":w[8]||(w[8]=P=>h.value.show.align=P),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(E,{visible:y.value.visible,"onUpdate:visible":w[11]||(w[11]=P=>y.value.visible=P),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[y.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",Wr,[n.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:n.withCtx(()=>w[25]||(w[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(V,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:P,text:Q,record:L,index:S})=>[P.dataIndex==="label"?(n.openBlock(),n.createBlock(N,{key:0,value:L.label,"onUpdate:value":F=>L.label=F,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),P.dataIndex==="value"?(n.openBlock(),n.createBlock(N,{key:1,value:L.value,"onUpdate:value":F=>L.value=F,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),P.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:F=>y.value.toDelOption(S,L)},"删除",8,Hr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),y.value.convert.type=="dict"?(n.openBlock(),n.createBlock(M,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(D,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(T,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(x,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(N,{value:y.value.convert.dict,"onUpdate:value":w[10]||(w[10]=P=>y.value.convert.dict=P)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(E,{visible:b.value.visible,"onUpdate:visible":w[13]||(w[13]=P=>b.value.visible=P),title:"控件设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[b.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(x,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(p,{value:b.value.props.mode,"onUpdate:value":w[12]||(w[12]=P=>b.value.props.mode=P),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(R,{value:"multiple"},{default:n.withCtx(()=>w[26]||(w[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(R,{value:"tags"},{default:n.withCtx(()=>w[27]||(w[27]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(E,{visible:u.value.visible,"onUpdate:visible":w[21]||(w[21]=P=>u.value.visible=P),title:"规则设置",onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(A,{orientation:"left"},{default:n.withCtx(()=>w[28]||(w[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(x,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(q,{value:u.value.props.trigger,"onUpdate:value":w[14]||(w[14]=P=>u.value.props.trigger=P),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(x,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.whitespace,"onUpdate:value":w[15]||(w[15]=P=>u.value.props.whitespace=P),checked:u.value.props.whitespace},{default:n.withCtx(()=>w[29]||(w[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(A,{orientation:"left"},{default:n.withCtx(()=>w[30]||(w[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(x,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(C,{value:u.value.props.rangeMin,"onUpdate:value":w[16]||(w[16]=P=>u.value.props.rangeMin=P)},null,8,["value"]),w[31]||(w[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(C,{value:u.value.props.rangeMax,"onUpdate:value":w[17]||(w[17]=P=>u.value.props.rangeMax=P)},null,8,["value"])]),_:1}),n.createVNode(x,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.rangeMessage,"onUpdate:value":w[18]||(w[18]=P=>u.value.props.rangeMessage=P)},null,8,["value"])]),_:1}),n.createVNode(A,{orientation:"left"},{default:n.withCtx(()=>w[32]||(w[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(x,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regExpress,"onUpdate:value":w[19]||(w[19]=P=>u.value.props.regExpress=P)},null,8,["value"])]),_:1}),n.createVNode(x,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(N,{value:u.value.props.regMessage,"onUpdate:value":w[20]||(w[20]=P=>u.value.props.regMessage=P)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Qr={class:"unione-props-setting data-field"},Gr=te(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 l=n.resolveComponent("OrderedListOutlined"),s=n.resolveComponent("a-tab-pane"),a=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Qr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(s,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(l),i[2]||(i[2]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(Er,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=d=>e.value=d)},null,8,["modelValue"])]),_:1}),n.createVNode(s,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(a),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Kr,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Yr={key:0,class:"data-model-list"},Xr=["onClick"],Jr=te(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(o,{expose:e}){const t=n.computed(()=>l.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const l=o;function s(c){i.value=c}function a(){if(t.value.length>=l.limit){Y.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const c=sa.v4(),u={sn:c,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),l.editor.dataModel(c,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},d=n.ref(),h=n.inject("closeSetting");function f(){d.value.validate().then(c=>{h&&h()})}return e({toSaving:f}),(c,u)=>{const m=n.resolveComponent("a-input"),b=n.resolveComponent("a-form-item"),y=n.resolveComponent("a-textarea"),k=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(n.openBlock(),n.createElementBlock("div",Yr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,v=>(n.openBlock(),n.createElementBlock("div",{key:v.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==v.sn&&"slt"]),onClick:w=>s(v)},n.toDisplayString(v.title),11,Xr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:a},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[n.createVNode(k,{ref_key:"formObj",ref:d,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:n.withCtx(()=>[n.createVNode(b,{label:"数据标题",name:"title",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.title,"onUpdate:value":u[0]||(u[0]=v=>i.value.title=v)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.name,"onUpdate:value":u[1]||(u[1]=v=>i.value.name=v)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.url,"onUpdate:value":u[2]||(u[2]=v=>i.value.url=v)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(y,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=v=>i.value.descs=v)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Gr,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=v=>i.value.fields=v)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Zr={class:"unione-props-setting unione-page-setting"},zt=te(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,l)=>{const s=n.resolveComponent("a-form-item"),a=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),h=n.resolveComponent("a-form"),f=n.resolveComponent("a-tab-pane"),c=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Zr,[n.createVNode(c,{type:"card"},{default:n.withCtx(()=>[n.createVNode(f,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(h,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(n.openBlock(),n.createBlock(s,{key:0,label:"页面编码"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.value.sn)+"/V"+n.toDisplayString(t.value.vers),1)]),_:1})):n.createCommentVNode("",!0),n.createVNode(s,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=u=>t.value.title=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=u=>t.value.component=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=u=>t.value.icon=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"是否全局"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>t.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"是否模版"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>t.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=u=>t.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),n.createVNode(f,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Jr,{editor:o.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Sl=te(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 ct,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(s.value,a)});const s=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),s.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel("run"),i.load(s.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),ed={class:"form-btns"},Nl=n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new ct,s=n.computed(()=>l.$widgetList.value||[]),a=n.computed(()=>{const c=l.define.value?.configs?.btns||[],u=c.map(m=>m.name);if(!u.includes("save")){const m={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};c.splice(m.index,0,m)}if(!u.includes("submit")){const m={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let b=m.index||1;c.splice(b,0,m)}if(!u.includes("reset")){const m={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};c.splice(m.index,0,m)}if(!u.includes("back")){const m={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};c.splice(m.index,0,m)}return l.model.value=="view"&&c.filter(m=>["save","submit","reset"].includes(m.name)).forEach(m=>{m.visible=!1}),c});function r({btn:c,event:u}){c.name=="save"&&d(),c.name=="reset",c.name=="back"&&h()}async function d(){const c=l.dataManager().form();let u={};for(let m in c){const b=await c[m].validate();if(l.dataManager().psn()==m){for(let y in u)b[y]=u[y];u=b}else u[m]=b}console.log("=======form data=====",u),l.dataManager().primary().save({data:u,params:l.dataManager().params}).then(m=>{console.log("save result:",m)})}function h(){e.back()}n.watch(()=>t.pageDefine,c=>{c&&l.load(f.value,c)});const f=n.ref("new_");return n.onMounted(()=>{const c=n.inject("route");console.log("unione page view route",c),f.value=t.psn||c?.query?.psn||c?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),l.setModel(c?.query?.model||c?.meta?.model||"run"),c?.query&&l.dataManager().params(c.query),l.load(f.value,t.pageDefine||i)}),(c,u)=>{const m=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(jt,{class:"unione-page-form","setting-title":"页面设置",editor:n.unref(l)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,b=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:n.unref(l)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",ed,[(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(m,{key:0,widget:b,editor:n.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(l)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),td=["onMouseover"],id={key:0,class:"node-opts"},nd={class:"form-warp"},ld={class:"form-btns"},Bl=n.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick"],setup(o,{emit:e}){const t=K.useDialog(),i=n.inject("router"),l=o,s={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function a(){if(l.fields?.length){const S={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};s.configs.widgets=[S]}s.configs.dsnList=["primary"],r.dataManager().use("primary","form").store(l.storage),s.configs.btns=l.btns||[],l.btns==!1&&(s.configs.btns=!1),s.configs.opts=l.opts||[],l.opts==!1&&(s.configs.opts=!1),s.configs.event=l.event||{},s.configs.setting=l.setting||{}}const r=new ct,d=n.ref(!1),h=n.ref([]),f=n.ref({}),c=n.ref(null),u=n.ref(null),m=n.ref([]),b=n.ref([]),y=n.ref(0),k=n.computed(()=>{const S={disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",...l.setting?.tree||{}};return r.define.value?.configs?.tree||S}),v=n.computed(()=>{const S=r.define.value?.configs?.opts;if(typeof S=="boolean"&&S==!1)return!1;const F=(S||[]).map(I=>typeof I=="string"?{name:I,visible:!1}:I),_=[];return F.forEach(I=>{_.push(I.name)}),console.log("opts addBtn",F),F.filter(I=>I.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),w=n.computed(()=>{const S=r.define.value?.configs?.opts;if(typeof S=="boolean"&&S==!1)return[];const F=(S||[]).map(U=>typeof U=="string"?{name:U,visible:!1}:U),_=[],I=[];return F.forEach(U=>{I.push(U.name),U.name!="add"&&_.push(U)}),I.includes("delete")||_.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),I.includes("child")||_.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",_),_});function O({btn:S,event:F},_){F.stopPropagation();const I=f.value[_[k.value.idField]];if(console.log("onTreeMenuClick,btn:",S),console.log("onTreeMenuClick,node:",_),console.log("onTreeMenuClick,curentNode:",I),S.name=="child"){const U=f.value[I[k.value.idField]];U.isLeaf=!1,c.value={},c.value[k.value.pidField]=U[k.value.idField],c.value[k.value.labelField]="新建...",c.value[k.value.idField]="new_"+y.value,c.value.parentNode=U,y.value=y.value+1,U.children||(U.children=[],b.value.push(U[k.value.idField])),T.value.createNode&&T.value.createNode(c.value,U,r.dataManager().params()),f.value[c.value[k.value.idField]]=c.value,U.children.push(c.value),m.value=[c.value[k.value.idField]],r.dataManager().primary().setValue(c.value)}S.name=="delete"&&(I[k.value.idField]&&(I[k.value.idField]+"").startsWith("new_")?(I.parentNode?I.parentNode.children=I.parentNode.children.filter(U=>U[k.value.idField]!=I[k.value.idField]):h.value=h.value.filter(U=>U[k.value.idField]!=I[k.value.idField]),delete f.value[I[k.value.idField]]):r.dataManager().primary().deleteByIds([I[k.value.idField]]).then(()=>{if(I.parentNode){const U=f.value[I[k.value.pidField]];U.children=U.children.filter(ke=>ke[k.value.idField]!=I[k.value.idField])}else h.value=h.value.filter(U=>U[k.value.idField]!=I[k.value.idField]);delete f.value[I[k.value.idField]]}))}function g(S,{expanded:F,node:_}){F&&(c.value=_.dataRef,r.dataManager().primary().setValue(c.value),M())}function p(S,F){F.selected?(c.value=F.node.dataRef,r.dataManager().primary().setValue(c.value)):c.value&&(m.value=[c.value[k.value.idField]]),A("treeClick",{keys:S,event:F})}n.watch(()=>l.params,()=>{d.value&&(h.value=[],f.value={},c.value=null,m.value=[],b.value=[],y.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),M())}),n.watch(()=>c.value,()=>{console.log("active node changed",c.value),V(!c.value)});const B=n.ref(null);n.watch(B,()=>{B.value&&c.value&&r.dataManager().primary().setValue(c.value)});function V(S=!0){const F=r.dataManager().form();for(let _ in F)F[_].setDisabled(S)}function C(){if(c.value={},c.value[k.value.pidField]=-1,c.value[k.value.labelField]="新建...",c.value[k.value.idField]="new_"+y.value,y.value=y.value+1,T.value.createNode&&T.value.createNode(c.value,null,r.dataManager().params()),c.value[k.value.pidField]==-1)h.value.push(c.value);else{const S=f.value[c.value[k.value.pidField]];S.children||(S.children=[]),S.children.push(c.value)}m.value=[c.value[k.value.idField]],f.value[c.value[k.value.idField]]=c.value,r.dataManager().primary().setValue(c.value)}const x=n.ref(""),N=xl(()=>{r.dataManager().primary().find({page:1,pageSize:9999,keywords:x.value,needCount:!1,body:k.value.async==!1?null:{}}).then(S=>{if(f.value={},h.value=[],S.body?.length){const F={};S.body.forEach(_=>{F[_[k.value.idField]]=_}),S.body.forEach(_=>{const I=F[_[k.value.pidField]];I?(I.children||(I.children=[],I.isLeaf=!1),I.children.push(_)):h.value.push(_)})}})},400);function M(){const S={};if(S[k.value.pidField]=-1,c.value){if(c.value.children?.length||k.value.async==!1)return;S[k.value.pidField]=c.value[k.value.idField],r.dataManager().primary().find({page:1,pageSize:999,body:S}).then(F=>{c.value.children=F.body||[],c.value.children.forEach(_=>{_.isLeaf=!!_[k.value.leafField],f.value[_[k.value.idField]]=_,_.parentNode=f.value[_[k.value.pidField]]})})}else{const F=k.value.async==!1?null:{page:1,pageSize:999,body:S};r.dataManager().primary().find(F).then(_=>{if(k.value.async==!1){if(h.value=[],_.body?.length){const I={};_.body.forEach(U=>{I[U[k.value.idField]]=U}),_.body.forEach(U=>{const ke=I[U[k.value.pidField]];ke?(ke.children||(ke.children=[],ke.isLeaf=!1),ke.children.push(U)):h.value.push(U)})}}else h.value=_.body||[],h.value.forEach(I=>{I.isLeaf=!!I[k.value.leafField],f.value[I[k.value.idField]]=I})})}}const E=n.computed(()=>r.$widgetList.value||[]),T=n.computed(()=>{const S={...r.define.value?.configs?.event||{}};for(const F in S)S[F]&&typeof S[F]!="function"&&S[F].enable&&S[F].scriptText&&(F=="createNode"?S[F]=new Function("node","parent","params",S[F].scriptText):S[F]=new Function("data","event",S[F].scriptText));return S}),D=n.computed(()=>r.define.value?.configs?.setting||l.setting||{});n.provide("pageSetting",D.value);const R=n.computed(()=>{const S=r.define.value?.configs?.btns;if(typeof S=="boolean"&&S==!1)return[];const F=(r.define.value?.configs?.btns||[]).map(I=>typeof I=="string"?{name:I,visible:!1}:{size:"default",...I}),_=F.map(I=>I.name);if(!_.includes("save")){const I={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};F.splice(I.index,0,I)}if(!_.includes("reset")){const I={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};F.splice(I.index,0,I)}if(!_.includes("back")){const I={title:"返回",type:"default",index:F.length,visible:!0,size:"default",name:"back"};F.splice(I.index,0,I)}return r.model.value=="view"&&F.filter(I=>["save","submit","reset"].includes(I.name)).forEach(I=>{I.visible=!1}),F}),A=e;function q({btn:S,event:F}){S.name=="save"&&P({btn:S,event:F}),S.name=="reset",S.name=="back"&&Q(),A("btnClick",{btn:S,event:F})}async function P(S){const F=r.dataManager().form();let _={...c.value};for(let I in F){const U=await F[I].validate();if(r.dataManager().psn()==I)for(let ke in U)_[ke]=U[ke];else _[I]=U}if(_[k.value.pidField]&&(_[k.value.pidField]+"").startsWith("new_")){t.error({content:"请先保存父节点!"});return}_[k.value.idField]&&(_[k.value.idField]+"").startsWith("new_")&&delete _[k.value.idField],delete _.parentNode,delete _.children,_[k.value.leafField]=_[k.value.leafField]?1:0,T.value.preSave&&T.value.preSave(_,S),console.log("=======form data=====",_),r.dataManager().primary().save({data:_}).then(I=>{console.log("save result:",I),c.value[k.value.idField]=I.body,m.value=[I.body],f.value[I.body]=c.value,c.value.children?.forEach(U=>{U[k.value.pidField]=I.body}),T.value.postSaved&&T.value.postSaved(_,S)})}function Q(){i.back()}const L=n.ref("new_");return n.onMounted(()=>{const S=n.inject("route");console.log("unione page tree route",S),L.value=l.psn||S?.query?.psn||S?.meta?.psn||"new_",console.log("unione page tree,psn:"+L.value),r.setModel(S?.query?.model||S?.meta?.model||"run");const F={...l.params||{},...S?.query||{},...S?.params||{}};r.dataManager().params(F),a(),r.load(L.value,s),n.nextTick(()=>{V(!0)}),M(),d.value=!0}),(S,F)=>{const _=n.resolveComponent("SearchOutlined"),I=n.resolveComponent("a-input"),U=n.resolveComponent("unione-btn"),ke=n.resolveComponent("a-tree");return n.openBlock(),n.createBlock(jt,{class:"unione-page-tree","setting-title":"页面设置",editor:n.unref(r)},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",{class:"tree-warp",onContextmenu:F[4]||(F[4]=n.withModifiers(()=>{},["prevent"]))},[n.createVNode(I,{size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:x.value,"onUpdate:value":F[0]||(F[0]=$=>x.value=$),onChange:n.unref(N),onPressEnter:n.unref(N)},{suffix:n.withCtx(()=>[n.createVNode(_)]),_:1},8,["value","onChange","onPressEnter"]),v.value?(n.openBlock(),n.createBlock(U,{key:0,widget:v.value,onClick:C},null,8,["widget"])):n.createCommentVNode("",!0),n.createVNode(ke,{"show-line":k.value.showLine,"show-icon":k.value.showIcon,disabled:k.value.disabled,blockNode:!0,draggable:k.value.draggable,multiple:k.value.multiple,selectable:k.value.selectable,checkable:k.value.checkable,fieldNames:{title:k.value.labelField,key:k.value.idField},selectedKeys:m.value,"onUpdate:selectedKeys":F[2]||(F[2]=$=>m.value=$),expandedKeys:b.value,"onUpdate:expandedKeys":F[3]||(F[3]=$=>b.value=$),"tree-data":h.value,onExpand:g,onSelect:p},n.createSlots({icon:n.withCtx(({dataRef:$})=>[$.iconName?(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.iconName),{key:0})):n.createCommentVNode("",!0)]),_:2},[w.value?.length?{name:"title",fn:n.withCtx(({dataRef:$})=>[n.createElementVNode("div",{class:"node-label",onMouseover:()=>u.value=$,onMouseleave:F[1]||(F[1]=()=>u.value=null)},[n.createElementVNode("span",null,n.toDisplayString($[k.value.labelField]),1),c.value&&c.value[k.value.idField]==$[k.value.idField]||u.value&&u.value[k.value.idField]==$[k.value.idField]?(n.openBlock(),n.createElementBlock("div",id,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(w.value,_e=>(n.openBlock(),n.createBlock(U,{key:_e.name,widget:_e,ctx:{node:$},onClick:ee=>O(ee,$)},null,8,["widget","ctx","onClick"]))),128))])):n.createCommentVNode("",!0)],40,td)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),n.createElementVNode("div",nd,[n.renderSlot(S.$slots,"form-warp",{class:"form-warp"},()=>[n.createElementVNode("div",{ref_key:"formWarp",ref:B},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(E.value,$=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent($.widget),{key:$.wid,wid:$.wid,widget:$,editor:n.unref(r)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",ld,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(R.value,$=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:$.name},[$.visible!=!1?(n.openBlock(),n.createBlock(U,{key:0,widget:$,editor:n.unref(r),disabled:!c.value,ctx:{},onClick:q},null,8,["widget","editor","disabled"])):n.createCommentVNode("",!0)],64))),128))])],512)])])]),_:2},[n.unref(r)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Ol=n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},selection:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(o,{expose:e,emit:t}){const i=o,l=n.ref(null),s={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function a(){if(i.fields?.length){s.configs.widgets[0].dsn="primary",s.configs.widgets[0].fields=i.fields.filter(O=>O.isQuery),s.configs.widgets[0].btns=i.queryBtns||[],s.configs.widgets[0].params=i.params||{},s.configs.dsnList=["primary"],s.configs.widgets[1].dsn="primary";const w=i.fields.filter(O=>O.isPk)[0];w&&w.name&&(s.configs.widgets[1].dataKey=w.name),s.configs.widgets[1].columns=i.fields.filter(O=>O.hidden!=!0),s.configs.widgets[1].operation=K.utils.obj.ext(s.configs.widgets[1].operation,i.operation||{}),i.operation==!1&&(s.configs.widgets[1].operation=!1),i.selection==!1&&(s.configs.widgets[1].selection=!1),s.configs.widgets[1].leftBtns=i.leftBtns==!1?!1:i.leftBtns||[],s.configs.widgets[1].rightBtns=i.rightBtns==!1?!1:i.rightBtns||[],r.dataManager().use("primary","list").store(i.storage)}}const r=new ct,d=n.computed(()=>r.$widgetList.value||[]),h=t;function f(w){h("btnClick",w)}const c=n.ref("new_");n.onMounted(()=>{const w=n.inject("route");console.log("unione page view route",w),c.value=i.psn||w?.query?.psn||w?.meta?.psn||"new_",console.log("unione page view,psn:"+c.value),r.setModel(w?.query?.model||w?.meta?.model||"run");const O={...i.params||{},...w?.query||{},...w?.params||{}};r.dataManager().params(O),a(),r.load(c.value,s)});function u(){return r.dataManager().use("primary","list")}function m(w){w?r.ebus.$emit("table-list-search",w):r.ebus.$emit("table-list-reload")}function b(w){r.dataManager().params(w),r.ebus.$emit("query-form-params",w),r.ebus.$emit("table-list-search",{params:w})}function y(){return l.value?l.value[0]:null}function k(){return l.value?l.value[0].getSelected():null}function v(){l.value&&l.value[0].clearSelected()}return e({storage:u,editor:r,reload:m,setParams:b,getTable:y,getSelected:k,clearSelected:v}),(w,O)=>(n.openBlock(),n.createBlock(jt,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(r)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,g=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:g.wid},[g.widget=="unione-table"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(g.widget),{key:0,wid:g.wid,widget:g,editor:n.unref(r),onBtnClick:f,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(n.openBlock(),n.createBlock(n.resolveDynamicComponent(g.widget),{key:1,wid:g.wid,widget:g,editor:n.unref(r),onBtnClick:f},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[n.unref(r)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(zt,{editor:n.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),ft={release(o){return K.axios.admin({url:"/api/data/define/release",method:"post",data:o})},find(o){return K.axios.admin({url:"/api/data/define/find",method:"post",data:o})},save(o){return K.axios.admin({url:"/api/data/define/save",method:"post",data:o})},delete(o){return K.axios.admin({url:"/api/data/define/delete",method:"post",data:o})},detail(o){return K.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:o})},loadFromDb(o){return K.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})},impFromDb(o){return K.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})}},sd={class:"unione-page list-page"},od=te(n.defineComponent({__name:"list",setup(o){const e=Ie(),t=K.useDialog(),i=n.inject("router"),l=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),s=n.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});n.onMounted(()=>{r()});const a=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){a.value.loading=!0,ft.find({page:a.value.pagination.current,pageSize:a.value.pagination.pageSize,body:a.value.params,keywords:a.value.keywords}).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 h({params:g,keywords:p}){a.value.pagination.current=1,a.value.params=g,a.value.keywords=p,r()}function f({btn:g,event:p,row:B}){console.log("table btn click",g,p,B),(g.name=="add"||g.name=="edit")&&i.push({path:"/system/data/define/edit",query:B?{id:B.id}:{}}),g.name=="impFromDb"&&(u.value=!0),g.name=="release"&&c(B),g.name=="view"&&i.push({path:e.listPageUrl,query:{psn:B.sn+":list",model:"preview"}})}function c(g){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ft.release([g.id]).then(p=>{p.success?(t.success({title:"发布成功",content:p.body}),r()):t.error({title:"发布失败",content:p.body})})}})}const u=n.ref(!1),m=n.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),b=n.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),y=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function k(g){!g||!Object.keys(g).length||!g.dsId||(Y.message.loading("数据加载中..."),y.value.params=g,y.value.loading=!0,ft.loadFromDb(g).then(p=>{y.value.loading=!1,Y.message.destroy(),p.success?(p.body.forEach(B=>{B.checkable=!!B.id}),y.value.data=p.body,y.value.pagination.total=p.body.length):Y.message.error(p.message)}))}function v(g){y.value.pagination.current=g.pagination.current,y.value.pagination.pageSize=g.pagination.pageSize}const w=n.ref();function O({btn:g}){if(g.name!="imp")return;const p=w.value.getSelected();p?.keys?.length?t.confirm({content:"确定导入选中的"+p.keys.length+"条记录么?",onOk:()=>{Y.message.loading("数据导入中..."),ft.impFromDb({dsId:y.value.params.dsId,tables:p.keys.join()}).then(B=>{Y.message.destroy(),B.success?(t.success({content:B.message}),a.value.pagination.current=1,r()):t.error({context:B.message})})}}):t.error({content:"请选择目标记录!"})}return(g,p)=>{const B=n.resolveComponent("UnioneQuery"),V=n.resolveComponent("UnioneTable"),C=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",sd,[n.createVNode(B,{widget:l.value,onQuery:h,onReset:h},null,8,["widget"]),n.createVNode(V,{widget:s.value,dataList:a.value.data,loading:a.value.loading,pagination:a.value.pagination,onChange:d,onBtnClick:f},null,8,["widget","dataList","loading","pagination"]),n.createVNode(C,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":p[0]||(p[0]=x=>u.value=x),placement:"left"},{default:n.withCtx(()=>[n.createVNode(B,{widget:m.value,onQuery:k,onReset:k,onBtnClick:O,class:"load-table-form"},null,8,["widget"]),n.createVNode(V,{widget:b.value,dataList:y.value.data,loading:y.value.loading,pagination:y.value.pagination,onChange:v,rowKey:"name",ref_key:"loadTableObj",ref:w},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-483acb94"]]),ad={class:"unione-props-setting data-field-manage"},rd={key:0},dd={key:1},cd=["onClick"],hd=["onClick"],fd=["onClick"],ud={key:1},pd=te(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:m})=>m+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=n.useModel(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(b=>{i.value.selectedRowKeys.includes(b)||i.value.selectedRowKeys.push(b);const y=[];t.value.forEach(k=>{!m.includes(k.name)&&i.value.selectedRowKeys.includes(k.name)&&y.push(k.name)}),y.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(k=>!y.includes(k)))})}}),l={mounted:m=>m.focus()},s=n.ref({});function a(){const m=Object.keys(s.value);if(m.length)for(let b in m){const y=t.value.filter(k=>k.name==b);if(y&&y[0]){let k=s.value[b];Object.keys(k).forEach(v=>{y[0][v]=k[v]})}}s.value={}}function r(m,b){a();const y={};y[b]=m[b]||"",s.value[m.name]=y}function d(m,b){if(!m||!b){s.value={};return}const y=s.value[m.name][b];if(b=="name"&&t.value.filter(v=>v[b]==y&&v.name!=m.name).length>0){Y.Modal.warn({title:"提示信息",content:"字段名称["+y+"]已存在"});return}m[b]=y,s.value={}}function h(m,b){const y=t.value.filter(k=>k.name==m.name)[0];return b=="isFk"?y.configs?.fkey?.enable:y[b]==1}function f(m,b){const y=t.value.filter(k=>k.name==m.name)[0];b=="isFk"?(y.configs||(y.configs={}),y.configs.fkey||(y.configs.fkey={}),y.configs.fkey.enable=!y.configs.fkey.enable):y[b]!=1?y[b]=1:y[b]=0}function c(){if(a(),t.value.filter(y=>y.name=="new_").length>0){s.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),s.value[b.name]={name:"new_"}}function u(){if(!i.value.selectedRowKeys.length){Y.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}Y.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(m=>!i.value.selectedRowKeys.includes(m.name)),i.value.selectedRowKeys=[]}})}return(m,b)=>{const y=n.resolveComponent("a-button"),k=n.resolveComponent("a-tooltip"),v=n.resolveComponent("a-input"),w=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-select-option"),g=n.resolveComponent("a-select"),p=n.resolveComponent("a-checkbox"),B=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",ad,[n.createVNode(y,{class:"btn btn-add",type:"primary",onClick:c,size:"small"},{default:n.withCtx(()=>b[1]||(b[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(y,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:n.withCtx(()=>b[2]||(b[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(B,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:V})=>[["name","title"].includes(V.key)?(n.openBlock(),n.createElementBlock("span",rd,[b[3]||(b[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(V.title),1)])):n.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(V.key)?(n.openBlock(),n.createElementBlock("span",dd,[n.createVNode(n.unref(He.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(V.title),1)])):n.createCommentVNode("",!0),V.key==="isPk"?(n.openBlock(),n.createBlock(k,{key:2,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[b[4]||(b[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0),V.key==="isFk"?(n.openBlock(),n.createBlock(k,{key:3,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0),V.key==="isNull"?(n.openBlock(),n.createBlock(k,{key:4,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0),V.key==="syncEnable"?(n.openBlock(),n.createBlock(k,{key:5,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(V.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:V,text:C,record:x})=>[["name","title","descs","dataValue"].includes(V.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[x.name]||!Object.keys(s.value[x.name]).includes(V.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,V.dataIndex)},[s.value[x.name]&&Object.keys(s.value[x.name]).includes(V.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:s.value[x.name][V.dataIndex],"onUpdate:value":N=>s.value[x.name][V.dataIndex]=N,onBlur:N=>d(x,V.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,cd)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(V.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[x.name]||!Object.keys(s.value[x.name]).includes(V.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,V.dataIndex)},[s.value[x.name]&&Object.keys(s.value[x.name]).includes(V.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[x.name][V.dataIndex],"onUpdate:value":N=>s.value[x.name][V.dataIndex]=N,onBlur:N=>d(x,V.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,hd)):["dataType"].includes(V.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[x.name]||!Object.keys(s.value[x.name]).includes(V.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,V.dataIndex)},[s.value[x.name]&&Object.keys(s.value[x.name]).includes(V.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(g,{key:0,value:x[V.dataIndex],"onUpdate:value":N=>x[V.dataIndex]=N,onBlur:b[0]||(b[0]=N=>d())},{default:n.withCtx(()=>[n.createVNode(O,{key:"String",value:"String"}),n.createVNode(O,{key:"Long",value:"Long"}),n.createVNode(O,{key:"Short",value:"Short"}),n.createVNode(O,{key:"Integer",value:"Integer"}),n.createVNode(O,{key:"Float",value:"Float"}),n.createVNode(O,{key:"Double",value:"Double"}),n.createVNode(O,{key:"Date",value:"Date"}),n.createVNode(O,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",ud,n.toDisplayString(C),1))],10,fd)):["syncEnable","isFk","isPk"].includes(V.dataIndex)?(n.openBlock(),n.createBlock(p,{key:3,checked:h(x,V.dataIndex),onClick:N=>f(x,V.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(V.dataIndex)?(n.openBlock(),n.createBlock(p,{key:4,checked:!h(x,V.dataIndex),onClick:N=>f(x,V.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Vl=1024;let md=0,nn=class{constructor(e,t){this.from=e,this.to=t}};class J{constructor(e={}){this.id=md++,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=Se.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}J.closedBy=new J({deserialize:o=>o.split(" ")}),J.openedBy=new J({deserialize:o=>o.split(" ")}),J.group=new J({deserialize:o=>o.split(" ")}),J.isolate=new J({deserialize:o=>{if(o&&o!="rtl"&&o!="ltr"&&o!="auto")throw new RangeError("Invalid value for isolate: "+o);return o||"auto"}}),J.contextHash=new J({perNode:!0}),J.lookAhead=new J({perNode:!0}),J.mounted=new J({perNode:!0});class hi{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[J.mounted.id]}}const gd=Object.create(null);class Se{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):gd,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Se(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(l)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(J.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(J.group),s=-1;s<(l?l.length:0);s++){let a=t[s<0?i.name:l[s]];if(a)return a}}}}Se.none=new Se("",Object.create(null),0,8);class ln{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let l=null;for(let s of e){let a=s(i);a&&(l||(l=Object.assign({},i.props)),l[a[0].id]=a[1])}t.push(l?new Se(i.name,l,i.id,i.flags):i)}return new ln(t)}}const fi=new WeakMap,_l=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 de{constructor(e,t,i,l,s){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,s&&s.length){this.props=Object.create(null);for(let[a,r]of s)this.props[typeof a=="number"?a:a.id]=r}}toString(){let e=hi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.toString();l&&(t&&(t+=","),t+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new an(this.topNode,e)}cursorAt(e,t=0,i=0){let l=fi.get(this)||this.topNode,s=new an(l);return s.moveTo(e,t),fi.set(this,s._tree),s}get topNode(){return new Me(this,0,0,null)}resolve(e,t=0){let i=qt(fi.get(this)||this.topNode,e,t,!1);return fi.set(this,i),i}resolveInner(e,t=0){let i=qt(_l.get(this)||this.topNode,e,t,!0);return _l.set(this,i),i}resolveStack(e,t=0){return yd(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:s=this.length}=e,a=e.mode||0,r=(a&fe.IncludeAnonymous)>0;for(let d=this.cursor(a|fe.IncludeAnonymous);;){let h=!1;if(d.from<=s&&d.to>=l&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:dn(Se.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new de(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new de(Se.none,t,i,l)))}static build(e){return wd(e)}}de.empty=new de(Se.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 tt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Se.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],l=this.set.types[t],s=l.name;if(/\W/.test(s)&&!l.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return s+"("+a.join(",")+")"}findChild(e,t,i,l,s){let{buffer:a}=this,r=-1;for(let d=e;d!=t&&!(Ml(s,l,a[d+1],a[d+2])&&(r=d,i>0));d=a[d+3]);return r}slice(e,t,i){let l=this.buffer,s=new Uint16Array(t-e),a=0;for(let r=e,d=0;r<t;){s[d++]=l[r++],s[d++]=l[r++]-i;let h=s[d++]=l[r++]-i;s[d++]=l[r++]-e,a=Math.max(a,h)}return new tt(s,a,this.set)}}function Ml(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 qt(o,e,t,i){for(var l;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 Me&&o.index<0?null:o.parent;if(!a)return o;o=a}let s=i?0:fe.IgnoreOverlays;if(i)for(let a=o,r=a.parent;r;a=r,r=a.parent)a instanceof Me&&a.index<0&&((l=r.enter(e,t,s))===null||l===void 0?void 0:l.from)!=a.from&&(o=r);for(;;){let a=o.enter(e,t,s);if(!a)return o;o=a}}class Tl{cursor(e=0){return new an(this,e)}getChild(e,t=null,i=null){let l=Al(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return Al(this,e,t,i)}resolve(e,t=0){return qt(this,e,t,!1)}resolveInner(e,t=0){return qt(this,e,t,!0)}matchContext(e){return on(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class Me extends Tl{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,l,s=0){for(let a=this;;){for(let{children:r,positions:d}=a._tree,h=t>0?r.length:-1;e!=h;e+=t){let f=r[e],c=d[e]+a.from;if(Ml(l,i,c,c+f.length)){if(f instanceof tt){if(s&fe.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,t,i-c,l);if(u>-1)return new it(new kd(a,f,e,c),null,u)}else if(s&fe.IncludeAnonymous||!f.type.isAnonymous||rn(f)){let u;if(!(s&fe.IgnoreMounts)&&(u=hi.get(f))&&!u.overlay)return new Me(u.tree,c,e,a);let m=new Me(f,c,e,a);return s&fe.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?f.children.length-1:0,t,i,l)}}}if(s&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 l;if(!(i&fe.IgnoreOverlays)&&(l=hi.get(this._tree))&&l.overlay){let s=e-this.from;for(let{from:a,to:r}of l.overlay)if((t>0?a<=s:a<s)&&(t<0?r>=s:r>s))return new Me(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Al(o,e,t,i){let l=o.cursor(),s=[];if(!l.firstChild())return s;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return s}for(;;){if(i!=null&&l.type.is(i))return s;if(l.type.is(e)&&s.push(l.node),!l.nextSibling())return i==null?s:[]}}function on(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 kd{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class it extends Tl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new it(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&fe.ExcludeBuffers)return null;let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new it(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new it(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 it(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,s=i.buffer[this.index+3];if(s>l){let a=i.buffer[this.index+1];e.push(i.slice(l,s,a)),t.push(0)}return new de(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function El(o){if(!o.length)return null;let e=0,t=o[0];for(let s=1;s<o.length;s++){let a=o[s];(a.from>t.from||a.to<t.to)&&(t=a,e=s)}let i=t instanceof Me&&t.index<0?null:t.parent,l=o.slice();return i?l[e]=i:l.splice(e,1),new bd(l,t)}class bd{constructor(e,t){this.heads=e,this.node=t}get next(){return El(this.heads)}}function yd(o,e,t){let i=o.resolveInner(e,t),l=null;for(let s=i instanceof Me?i:i.context.parent;s;s=s.parent)if(s.index<0){let a=s.parent;(l||(l=[i])).push(a.resolve(e,t)),s=a}else{let a=hi.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let r=new Me(a.tree,a.overlay[0].from+s.from,-1,s);(l||(l=[i])).push(qt(r,e,t,!1))}}return l?El(l):i}class an{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Me)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Me?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&fe.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(l.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,a=e<0?-1:i._tree.children.length;s!=a;s+=e){let r=i._tree.children[s];if(this.mode&fe.IncludeAnonymous||r instanceof tt||!r.type.isAnonymous||rn(r))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,s=this.stack.length;s>=0;){for(let a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=s+1;break e}l=this.stack[--s]}for(let l=i;l<this.stack.length;l++)t=new it(this.buffer,t,this.stack[l]);return this.bufferNode=new it(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return on(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,s=this.stack.length-1;l>=0;s--){if(s<0)return on(this.node,e,l);let a=i[t.buffer[this.stack[s]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function rn(o){return o.children.some(e=>e instanceof tt||!e.type.isAnonymous||rn(e))}function wd(o){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=Vl,reused:s=[],minRepeatType:a=i.types.length}=o,r=Array.isArray(t)?new sn(t,t.length):t,d=i.types,h=0,f=0;function c(p,B,V,C,x,N){let{id:M,start:E,end:T,size:D}=r,R=f;for(;D<0;)if(r.next(),D==-1){let L=s[M];V.push(L),C.push(E-p);return}else if(D==-3){h=M;return}else if(D==-4){f=M;return}else throw new RangeError(`Unrecognized record size: ${D}`);let A=d[M],q,P,Q=E-p;if(T-E<=l&&(P=k(r.pos-B,x))){let L=new Uint16Array(P.size-P.skip),S=r.pos-P.size,F=L.length;for(;r.pos>S;)F=v(P.start,L,F);q=new tt(L,T-P.start,i),Q=P.start-p}else{let L=r.pos-D;r.next();let S=[],F=[],_=M>=a?M:-1,I=0,U=T;for(;r.pos>L;)_>=0&&r.id==_&&r.size>=0?(r.end<=U-l&&(b(S,F,E,I,r.end,U,_,R),I=S.length,U=r.end),r.next()):N>2500?u(E,L,S,F):c(E,L,S,F,_,N+1);if(_>=0&&I>0&&I<S.length&&b(S,F,E,I,E,U,_,R),S.reverse(),F.reverse(),_>-1&&I>0){let ke=m(A);q=dn(A,S,F,0,S.length,0,T-E,ke,ke)}else q=y(A,S,F,T-E,R-T)}V.push(q),C.push(Q)}function u(p,B,V,C){let x=[],N=0,M=-1;for(;r.pos>B;){let{id:E,start:T,end:D,size:R}=r;if(R>4)r.next();else{if(M>-1&&T<M)break;M<0&&(M=D-l),x.push(E,T,D),N++,r.next()}}if(N){let E=new Uint16Array(N*4),T=x[x.length-2];for(let D=x.length-3,R=0;D>=0;D-=3)E[R++]=x[D],E[R++]=x[D+1]-T,E[R++]=x[D+2]-T,E[R++]=R;V.push(new tt(E,x[2]-T,i)),C.push(T-p)}}function m(p){return(B,V,C)=>{let x=0,N=B.length-1,M,E;if(N>=0&&(M=B[N])instanceof de){if(!N&&M.type==p&&M.length==C)return M;(E=M.prop(J.lookAhead))&&(x=V[N]+M.length+E)}return y(p,B,V,C,x)}}function b(p,B,V,C,x,N,M,E){let T=[],D=[];for(;p.length>C;)T.push(p.pop()),D.push(B.pop()+V-x);p.push(y(i.types[M],T,D,N-x,E-N)),B.push(x-V)}function y(p,B,V,C,x=0,N){if(h){let M=[J.contextHash,h];N=N?[M].concat(N):[M]}if(x>25){let M=[J.lookAhead,x];N=N?[M].concat(N):[M]}return new de(p,B,V,C,N)}function k(p,B){let V=r.fork(),C=0,x=0,N=0,M=V.end-l,E={size:0,start:0,skip:0};e:for(let T=V.pos-p;V.pos>T;){let D=V.size;if(V.id==B&&D>=0){E.size=C,E.start=x,E.skip=N,N+=4,C+=4,V.next();continue}let R=V.pos-D;if(D<0||R<T||V.start<M)break;let A=V.id>=a?4:0,q=V.start;for(V.next();V.pos>R;){if(V.size<0)if(V.size==-3)A+=4;else break e;else V.id>=a&&(A+=4);V.next()}x=q,C+=D,N+=A}return(B<0||C==p)&&(E.size=C,E.start=x,E.skip=N),E.size>4?E:void 0}function v(p,B,V){let{id:C,start:x,end:N,size:M}=r;if(r.next(),M>=0&&C<a){let E=V;if(M>4){let T=r.pos-(M-4);for(;r.pos>T;)V=v(p,B,V)}B[--V]=E,B[--V]=N-p,B[--V]=x-p,B[--V]=C}else M==-3?h=C:M==-4&&(f=C);return V}let w=[],O=[];for(;r.pos>0;)c(o.start||0,o.bufferStart||0,w,O,-1,0);let g=(e=o.length)!==null&&e!==void 0?e:w.length?O[0]+w[0].length:0;return new de(d[o.topID],w.reverse(),O.reverse(),g)}const Il=new WeakMap;function ui(o,e){if(!o.isAnonymous||e instanceof tt||e.type!=o)return 1;let t=Il.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=o||!(i instanceof de)){t=1;break}t+=ui(o,i)}Il.set(e,t)}return t}function dn(o,e,t,i,l,s,a,r,d){let h=0;for(let b=i;b<l;b++)h+=ui(o,e[b]);let f=Math.ceil(h*1.5/8),c=[],u=[];function m(b,y,k,v,w){for(let O=k;O<v;){let g=O,p=y[O],B=ui(o,b[O]);for(O++;O<v;O++){let V=ui(o,b[O]);if(B+V>=f)break;B+=V}if(O==g+1){if(B>f){let V=b[g];m(V.children,V.positions,0,V.children.length,y[g]+w);continue}c.push(b[g])}else{let V=y[O-1]+b[O-1].length-p;c.push(dn(o,b,y,g,O,p,V,null,d))}u.push(p+w-s)}}return m(e,t,i,l,0),(r||d)(c,u,a)}class ut{constructor(e,t,i,l,s=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(s?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 l=[new ut(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&l.push(s);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],s=1,a=e.length?e[0]:null;for(let r=0,d=0,h=0;;r++){let f=r<t.length?t[r]:null,c=f?f.fromA:1e9;if(c-d>=i)for(;a&&a.from<c;){let u=a;if(d>=u.from||c<=u.to||h){let m=Math.max(u.from,d)-h,b=Math.min(u.to,c)-h;u=m>=b?null:new ut(m,b,u.tree,u.offset+h,r>0,!!f)}if(u&&l.push(u),a.to>c)break;a=s<e.length?e[s++]:null}if(!f)break;d=f.toA,h=f.toA-f.toB}return l}}class Dl{startParse(e,t,i){return typeof e=="string"&&(e=new xd(e)),i=i?i.length?i.map(l=>new nn(l.from,l.to)):[new nn(0,0)]:[new nn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let s=l.advance();if(s)return s}}}class xd{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 J({perNode:!0});class pi{constructor(e,t,i,l,s,a,r,d,h,f=0,c){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=s,this.score=a,this.buffer=r,this.bufferBase=d,this.curContext=h,this.lookAhead=f,this.parent=c}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new pi(e,[],t,i,i,0,[],0,l?new Pl(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,l=e&65535,{parser:s}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let r=s.dynamicPrecedence(l);if(r&&(this.score+=r),i==0){this.pushState(s.getGoto(this.state,l,!0),this.reducePos),l<s.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(l,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),h=d?this.stack[d-2]:this.p.ranges[0].from,f=this.reducePos-h;f>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=f));let c=d?this.stack[d-1]:0,u=this.bufferBase+this.buffer.length-c;if(l<s.minRepeatTerm||e&131072){let m=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,h,m,u+4,!0)}if(e&262144)this.state=this.stack[d];else{let m=this.stack[d-3];this.state=s.getGoto(m,l,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(l,h)}storeNode(e,t,i,l=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let 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(!s||this.pos==i)this.buffer.push(e,t,i,l);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,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4);else{let s=e,{parser:a}=this.p;(l>this.pos||t<=a.maxNode)&&(this.pos=l,a.stateFlag(s,1)||(this.reducePos=l)),this.pushState(s,i),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(i,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new pi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new vd(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let s=0,a;s<t.length;s+=2)(a=t[s+1])!=this.state&&this.p.parser.hasAction(a,e)&&l.push(t[s],a);if(this.stack.length<120)for(let s=0;l.length<8&&s<t.length;s+=2){let a=t[s+1];l.some((r,d)=>d&1&&r==a)||l.push(t[s],a)}t=l}let i=[];for(let l=0;l<t.length&&i.length<4;l+=2){let s=t[l+1];if(s==this.state)continue;let a=this.split();a.pushState(s,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[l],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,l=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],l,!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=(l,s)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let r=(a>>19)-s;if(r>1){let d=a&65535,h=this.stack.length-r*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return r<<19|65536|d}}else{let r=i(a,s+1);if(r!=null)return r}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Pl(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Pl{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class vd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class mi{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new mi(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new mi(this.stack,this.pos,this.index)}}function gi(o,e=Uint16Array){if(typeof o!="string")return o;let t=null;for(let i=0,l=0;i<o.length;){let s=0;for(;;){let a=o.charCodeAt(i++),r=!1;if(a==126){s=65535;break}a>=92&&a--,a>=34&&a--;let d=a-32;if(d>=46&&(d-=46,r=!0),s+=d,r)break;s*=46}t?t[l++]=s:t=new e(s)}return t}class ki{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Fl=new ki;class Cd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Fl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,l=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!l)return null;let a=this.ranges[--l];s-=i.from-a.to,i=a}for(;t<0?s>i.to:s>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];s+=a.from-i.to,i=a}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let 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)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Fl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class vt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Sd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}vt.prototype.contextual=vt.prototype.fallback=vt.prototype.extend=!1,vt.prototype.fallback=vt.prototype.extend=!1;function Sd(o,e,t,i,l,s){let a=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&o[a];){let h=o[a+1];for(let m=a+3;m<h;m+=2)if((o[m+1]&r)>0){let b=o[m];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||Nd(b,e.token.value,l,s))){e.acceptToken(b);break}}let f=e.next,c=0,u=o[a+2];if(e.next<0&&u>c&&o[h+u*3-3]==65535){a=o[h+u*3-1];continue e}for(;c<u;){let m=c+u>>1,b=h+m+(m<<1),y=o[b],k=o[b+1]||65536;if(f<y)u=m;else if(f>=k)c=m+1;else{a=o[b+2],e.advance();continue e}}break}}function $l(o,e,t){for(let i=e,l;(l=o[i])!=65535;i++)if(l==t)return i-e;return-1}function Nd(o,e,t,i){let l=$l(t,i,e);return l<0||$l(t,i,o)<l}const Be=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let cn=null;function Rl(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 Bd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Rl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Rl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],l=this.index[t];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[l],a=this.start[t]+i.positions[l];if(a>e)return this.nextStart=a,null;if(s instanceof de){if(a==e){if(a<this.safeFrom)return null;let r=a+s.length;if(r<=this.safeTo){let d=s.prop(J.lookAhead);if(!d||r+d<this.fragment.to)return s}}this.index[t]++,a+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+s.length}}}class Od{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ki)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:s}=l,a=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let h=0;h<s.length;h++){if(!(1<<h&a))continue;let f=s[h],c=this.tokens[h];if(!(i&&!f.fallback)&&((f.contextual||c.start!=e.pos||c.mask!=a||c.context!=r)&&(this.updateCachedToken(c,f,e),c.mask=a,c.context=r),c.lookAhead>c.end+25&&(d=Math.max(c.lookAhead,d)),c.value!=0)){let u=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!f.extend&&(i=c,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return d&&e.setLookAhead(d),!i&&e.pos==this.stream.end&&(i=new ki,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ki,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:s}=i.p;for(let a=0;a<s.specialized.length;a++)if(s.specialized[a]==e.value){let r=s.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(l+1)}putAction(e,t,i,l){for(let s=0;s<l;s+=3)if(this.actions[s]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=i,l}addActions(e,t,i,l){let{state:s}=e,{parser:a}=e.p,{data:r}=a;for(let d=0;d<2;d++)for(let h=a.stateSlot(s,d?2:1);;h+=3){if(r[h]==65535)if(r[h+1]==1)h=Qe(r,h+2);else{l==0&&r[h+1]==2&&(l=this.putAction(Qe(r,h+2),t,i,l));break}r[h]==t&&(l=this.putAction(Qe(r,h+1),t,i,l))}return l}}class Vd{constructor(e,t,i,l){this.parser=e,this.input=t,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Cd(t,l),this.tokens=new Od(e,this.stream),this.topTerm=e.top[1];let{from:s}=l[0];this.stacks=[pi.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Bd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,s;if(this.bigReductionCount>300&&e.length==1){let[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;{l||(l=[],s=[]),l.push(r);let d=this.tokens.getMainToken(r);s.push(d.value,d.end)}}break}}if(!i.length){let a=l&&Md(l);if(a)return Be&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Be&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,s,i);if(a)return Be&&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 h=i[d];if(r.sameState(h)||r.buffer.length>500&&h.buffer.length>500)if((r.score-h.score||r.buffer.length-h.buffer.length)>0)i.splice(d--,1);else{i.splice(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 l=e.pos,{parser:s}=this,a=Be?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let c=this.fragments.nodeAt(l);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(J.contextHash)||0)==f))return e.useNode(c,u),Be&&console.log(a+this.stackID(e)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof de)||c.children.length==0||c.positions[0]>0)break;let m=c.children[0];if(m instanceof de&&c.positions[0]==0)c=m;else break}}let r=s.stateSlot(e.state,4);if(r>0)return e.reduce(r),Be&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;h<d.length;){let f=d[h++],c=d[h++],u=d[h++],m=h==d.length||!i,b=m?e:e.split(),y=this.tokens.mainToken;if(b.apply(f,c,y?y.start:b.pos,u),Be&&console.log(a+this.stackID(b)+` (via ${f&65536?`reduce of ${s.getName(f&65535)}`:"shift"} for ${s.getName(c)} @ ${l}${b==e?"":", split"})`),m)return!0;b.pos>l?t.push(b):i.push(b)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Ll(e,t),!0}}runRecovery(e,t,i){let l=null,s=!1;for(let a=0;a<e.length;a++){let r=e[a],d=t[a<<1],h=t[(a<<1)+1],f=Be?this.stackID(r)+" -> ":"";if(r.deadEnd&&(s||(s=!0,r.restart(),Be&&console.log(f+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let c=r.split(),u=f;for(let m=0;c.forceReduce()&&m<10&&(Be&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,i));m++)Be&&(u=this.stackID(c)+" -> ");for(let m of r.recoverByInsert(d))Be&&console.log(f+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>r.pos?(h==r.pos&&(h++,d=0),r.recoverByDelete(d,h),Be&&console.log(f+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),Ll(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),de.build({buffer:mi.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(cn||(cn=new WeakMap)).get(e);return t||cn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Ll(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 _d{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class bi extends Dl{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function s(r,d,h){l[r].push([d,d.deserialize(String(h))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=J[d]);for(let h=1;h<r.length;){let f=r[h++];if(f>=0)s(f,d,r[h++]);else{let c=r[h+-f];for(let u=-f;u>0;u--)s(r[h++],d,c);h++}}}this.nodeSet=new ln(t.map((r,d)=>Se.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:l[d],top:i.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Vl;let a=gi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(jl),this.states=gi(e.states,Uint32Array),this.data=gi(e.stateData),this.goto=gi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new vt(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 l=new Vd(this,e,t,i);for(let s of this.wrappers)l=s(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let s=l[t+1];;){let a=l[s++],r=a&1,d=l[s++];if(r&&i)return d;for(let h=s+(a>>1);s<h;s++)if(l[s]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let l=0;l<2;l++)for(let s=this.stateSlot(e,l?2:1),a;;s+=3){if((a=i[s])==65535)if(i[s+1]==1)a=i[s=Qe(i,s+2)];else{if(i[s+1]==2)return Qe(i,s+2);break}if(a==t||a==0)return Qe(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let s=this.stateSlot(e,1);l==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Qe(this.data,s+2);else break;l=t(Qe(this.data,s+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Qe(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];t.some((s,a)=>a&1&&s==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(bi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(s=>s.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let s=e.specializers.find(r=>r.from==i.external);if(!s)return i;let a=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[l]=jl(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 s of e.split(" ")){let a=t.indexOf(s);a>=0&&(i[a]=!0)}let l=null;for(let s=0;s<t.length;s++)if(!i[s])for(let a=this.dialects[t[s]],r;(r=this.data[a++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new _d(e,i,l)}static deserialize(e){return new bi(e)}}function Qe(o,e){return o[e]|o[e+1]<<16}function Md(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 jl(o){if(o.external){let e=o.extend?1:0;return(t,i)=>o.external(t,i)<<1|e}return o.get}let Td=0;class Te{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=Td++}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 Te&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new Te(i,[],null,[]);if(l.set.push(l),t)for(let s of t.set)l.set.push(s);return l}static defineModifier(e){let t=new yi(e);return i=>i.modified.indexOf(t)>-1?i:yi.get(i.base||i,i.modified.concat(t).sort((l,s)=>l.id-s.id))}}let Ad=0;class yi{constructor(e){this.name=e,this.instances=[],this.id=Ad++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Ed(t,r.modified));if(i)return i;let l=[],s=new Te(e.name,l,e,t);for(let r of t)r.instances.push(s);let a=Id(t);for(let r of e.set)if(!r.modified.length)for(let d of a)l.push(yi.get(r,d));return s}}function Ed(o,e){return o.length==e.length&&o.every((t,i)=>t==e[i])}function Id(o){let e=[[]];for(let t=0;t<o.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(o[t]));return e.sort((t,i)=>i.length-t.length)}function zl(o){let e=Object.create(null);for(let t in o){let i=o[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let s=[],a=2,r=l;for(let c=0;;){if(r=="..."&&c>0&&c+3==l.length){a=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==l.length)break;let m=l[c++];if(c==l.length&&m=="!"){a=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(c)}let d=s.length-1,h=s[d];if(!h)throw new RangeError("Invalid path: "+l);let f=new hn(i,a,d>0?s.slice(0,d):null);e[h]=f.sort(e[h])}}return Dd.add(e)}const Dd=new J;class hn{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}hn.empty=new hn([],2,null);function ql(o,e){let t=Object.create(null);for(let s of o)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let a of s.tag)t[a.id]=s.class;let{scope:i,all:l=null}=e||{};return{style:s=>{let a=l;for(let r of s)for(let d of r.set){let h=t[d.id];if(h){a=a?a+" "+h:h;break}}return a},scope:i}}const z=Te.define,wi=z(),nt=z(),Ul=z(nt),Wl=z(nt),lt=z(),xi=z(lt),fn=z(lt),$e=z(),pt=z($e),Re=z(),Le=z(),un=z(),Ut=z(un),vi=z(),j={comment:wi,lineComment:z(wi),blockComment:z(wi),docComment:z(wi),name:nt,variableName:z(nt),typeName:Ul,tagName:z(Ul),propertyName:Wl,attributeName:z(Wl),className:z(nt),labelName:z(nt),namespace:z(nt),macroName:z(nt),literal:lt,string:xi,docString:z(xi),character:z(xi),attributeValue:z(xi),number:fn,integer:z(fn),float:z(fn),bool:z(lt),regexp:z(lt),escape:z(lt),color:z(lt),url:z(lt),keyword:Re,self:z(Re),null:z(Re),atom:z(Re),unit:z(Re),modifier:z(Re),operatorKeyword:z(Re),controlKeyword:z(Re),definitionKeyword:z(Re),moduleKeyword:z(Re),operator:Le,derefOperator:z(Le),arithmeticOperator:z(Le),logicOperator:z(Le),bitwiseOperator:z(Le),compareOperator:z(Le),updateOperator:z(Le),definitionOperator:z(Le),typeOperator:z(Le),controlOperator:z(Le),punctuation:un,separator:z(un),bracket:Ut,angleBracket:z(Ut),squareBracket:z(Ut),paren:z(Ut),brace:z(Ut),content:$e,heading:pt,heading1:z(pt),heading2:z(pt),heading3:z(pt),heading4:z(pt),heading5:z(pt),heading6:z(pt),contentSeparator:z($e),list:z($e),quote:z($e),emphasis:z($e),strong:z($e),link:z($e),monospace:z($e),strikethrough:z($e),inserted:z(),deleted:z(),changed:z(),invalid:z(),meta:vi,documentMeta:z(vi),annotation:z(vi),processingInstruction:z(vi),definition:Te.defineModifier("definition"),constant:Te.defineModifier("constant"),function:Te.defineModifier("function"),standard:Te.defineModifier("standard"),local:Te.defineModifier("local"),special:Te.defineModifier("special")};for(let o in j){let e=j[o];e instanceof Te&&(e.name=o)}ql([{tag:j.link,class:"tok-link"},{tag:j.heading,class:"tok-heading"},{tag:j.emphasis,class:"tok-emphasis"},{tag:j.strong,class:"tok-strong"},{tag:j.keyword,class:"tok-keyword"},{tag:j.atom,class:"tok-atom"},{tag:j.bool,class:"tok-bool"},{tag:j.url,class:"tok-url"},{tag:j.labelName,class:"tok-labelName"},{tag:j.inserted,class:"tok-inserted"},{tag:j.deleted,class:"tok-deleted"},{tag:j.literal,class:"tok-literal"},{tag:j.string,class:"tok-string"},{tag:j.number,class:"tok-number"},{tag:[j.regexp,j.escape,j.special(j.string)],class:"tok-string2"},{tag:j.variableName,class:"tok-variableName"},{tag:j.local(j.variableName),class:"tok-variableName tok-local"},{tag:j.definition(j.variableName),class:"tok-variableName tok-definition"},{tag:j.special(j.variableName),class:"tok-variableName2"},{tag:j.definition(j.propertyName),class:"tok-propertyName tok-definition"},{tag:j.typeName,class:"tok-typeName"},{tag:j.namespace,class:"tok-namespace"},{tag:j.className,class:"tok-className"},{tag:j.macroName,class:"tok-macroName"},{tag:j.propertyName,class:"tok-propertyName"},{tag:j.operator,class:"tok-operator"},{tag:j.comment,class:"tok-comment"},{tag:j.meta,class:"tok-meta"},{tag:j.invalid,class:"tok-invalid"},{tag:j.punctuation,class:"tok-punctuation"}]);const Pd=zl({String:j.string,Number:j.number,"True False":j.bool,PropertyName:j.propertyName,Null:j.null,",":j.separator,"[ ]":j.squareBracket,"{ }":j.brace}),Fd=bi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Pd],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 Z{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]=Ct(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),je.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ct(this,e,t);let i=[];return this.decompose(e,t,i,0),je.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Wt(this),s=new Wt(e);for(let a=t,r=t;;){if(l.next(a),s.next(a),a=0,l.lineBreak!=s.lineBreak||l.done!=s.done||l.value!=s.value)return!1;if(r+=l.value.length,l.done||r>=i)return!0}}iter(e=1){return new Wt(this,e)}iterRange(e,t=this.length){return new Kl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ql(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Z.empty:e.length<=32?new re(e):je.from(re.split(e,[]))}}class re extends Z{constructor(e,t=$d(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let s=0;;s++){let a=this.text[s],r=l+a.length;if((t?i:r)>=e)return new Rd(l,r,i,a);l=r+1,i++}}decompose(e,t,i,l){let s=e<=0&&t>=this.length?this:new re(Hl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),r=Ci(s.text,a.text.slice(),0,s.length);if(r.length<=32)i.push(new re(r,a.length+s.length));else{let d=r.length>>1;i.push(new re(r.slice(0,d)),new re(r.slice(d)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);[e,t]=Ct(this,e,t);let l=Ci(this.text,Ci(i.text,Hl(this.text,0,e)),t),s=this.length+i.length-(t-e);return l.length<=32?new re(l,s):je.from(re.split(l,[]),s)}sliceString(e,t=this.length,i=`
2
2
  `){[e,t]=Ct(this,e,t);let l="";for(let s=0,a=0;s<=t&&a<this.text.length;a++){let r=this.text[a],d=s+r.length;s>e&&a&&(l+=i),e<d&&t>s&&(l+=r.slice(Math.max(0,e-s),t-s)),s=d+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let s of e)i.push(s),l+=s.length+1,i.length==32&&(t.push(new re(i,l)),i=[],l=-1);return l>-1&&t.push(new re(i,l)),t}}class je extends Z{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let s=0;;s++){let a=this.children[s],r=l+a.length,d=i+a.lines-1;if((t?d:r)>=e)return a.lineInner(e,t,i,l);l=r+1,i=d+1}}decompose(e,t,i,l){for(let s=0,a=0;a<=t&&s<this.children.length;s++){let r=this.children[s],d=a+r.length;if(e<=d&&t>=a){let h=l&((a<=e?1:0)|(d>=t?2:0));a>=e&&d<=t&&!h?i.push(r):r.decompose(e-a,t-a,i,h)}a=d+1}}replace(e,t,i){if([e,t]=Ct(this,e,t),i.lines<this.lines)for(let l=0,s=0;l<this.children.length;l++){let a=this.children[l],r=s+a.length;if(e>=s&&t<=r){let d=a.replace(e-s,t-s,i),h=this.lines-a.lines+d.lines;if(d.lines<h>>4&&d.lines>h>>6){let f=this.children.slice();return f[l]=d,new je(f,this.length-(t-e)+i.length)}return super.replace(s,r,d)}s=r+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
- `){[e,t]=Ct(this,e,t);let l="";for(let s=0,a=0;s<this.children.length&&a<=t;s++){let r=this.children[s],d=a+r.length;a>e&&s&&(l+=i),e<d&&t>a&&(l+=r.sliceString(e-a,t-a,i)),a=d+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof je))return 0;let i=0,[l,s,a,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,s+=t){if(l==a||s==r)return i;let d=this.children[l],h=e.children[s];if(d!=h)return i+d.scanIdentical(h,t);i+=d.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let m of e)i+=m.lines;if(i<32){let m=[];for(let k of e)k.flatten(m);return new re(m,t)}let l=Math.max(32,i>>5),s=l<<1,a=l>>1,r=[],d=0,h=-1,f=[];function c(m){let k;if(m.lines>s&&m instanceof je)for(let y of m.children)c(y);else m.lines>a&&(d>a||!d)?(u(),r.push(m)):m instanceof re&&d&&(k=f[f.length-1])instanceof re&&m.lines+k.lines<=32?(d+=m.lines,h+=m.length+1,f[f.length-1]=new re(k.text.concat(m.text),k.length+1+m.length)):(d+m.lines>l&&u(),d+=m.lines,h+=m.length+1,f.push(m))}function u(){d!=0&&(r.push(f.length==1?f[0]:je.from(f,h)),h=-1,d=f.length=0)}for(let m of e)c(m);return u(),r.length==1?r[0]:new je(r,t)}}Z.empty=new re([""],0);function Fd(o){let e=-1;for(let t of o)e+=t.length+1;return e}function Ci(o,e,t=0,i=1e9){for(let l=0,s=0,a=!0;s<o.length&&l<=i;s++){let r=o[s],d=l+r.length;d>=t&&(d>i&&(r=r.slice(0,i-l)),l<t&&(r=r.slice(t-l)),a?(e[e.length-1]+=r,a=!1):e.push(r)),l=d+1}return e}function Hl(o,e,t){return Ci(o,[""],e,t)}class Wt{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof re?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],s=this.offsets[i],a=s>>1,r=l instanceof re?l.text.length:l.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((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
- `,this;e--}else if(l instanceof re){let d=l.text[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=l.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 re?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Kl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Wt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ql{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Z.prototype[Symbol.iterator]=function(){return this.iter()},Wt.prototype[Symbol.iterator]=Kl.prototype[Symbol.iterator]=Ql.prototype[Symbol.iterator]=function(){return this});class $d{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function Ct(o,e,t){return e=Math.max(0,Math.min(o.length,e)),[e,Math.max(e,Math.min(o.length,t))]}let St="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<St.length;o++)St[o]+=St[o-1];function Rd(o){for(let e=1;e<St.length;e+=2)if(St[e]>o)return St[e-1]<=o;return!1}function Gl(o){return o>=127462&&o<=127487}const Yl=8205;function Ge(o,e,t=!0,i=!0){return(t?Xl:Ld)(o,e,i)}function Xl(o,e,t){if(e==o.length)return e;e&&Jl(o.charCodeAt(e))&&Zl(o.charCodeAt(e-1))&&e--;let i=pn(o,e);for(e+=es(i);e<o.length;){let l=pn(o,e);if(i==Yl||l==Yl||t&&Rd(l))e+=es(l),i=l;else if(Gl(l)){let s=0,a=e-2;for(;a>=0&&Gl(pn(o,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function Ld(o,e,t){for(;e>0;){let i=Xl(o,e-2,t);if(i<e)return i;e--}return 0}function Jl(o){return o>=56320&&o<57344}function Zl(o){return o>=55296&&o<56320}function pn(o,e){let t=o.charCodeAt(e);if(!Zl(t)||e+1==o.length)return t;let i=o.charCodeAt(e+1);return Jl(i)?(t-55296<<10)+(i-56320)+65536:t}function es(o){return o<65536?1:2}const mn=/\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 Ye{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let s=this.sections[t++],a=this.sections[t++];a<0?(e(i,l,s),l+=s):l+=a,i+=s}}iterChangedRanges(e,t=!1){gn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new Ye(e)}composeDesc(e){return this.empty?e:e.empty?this:ts(this,e)}mapDesc(e,t=!1){return e.empty?this:kn(this,e,t)}mapPos(e,t=-1,i=Be.Simple){let l=0,s=0;for(let a=0;a<this.sections.length;){let r=this.sections[a++],d=this.sections[a++],h=l+r;if(d<0){if(h>e)return s+(e-l);s+=r}else{if(i!=Be.Simple&&h>=e&&(i==Be.TrackDel&&l<e&&h>e||i==Be.TrackBefore&&l<e||i==Be.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!r)return e==l||t<0?s:s+d;s+=d}l=h}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return s}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let s=this.sections[i++],a=this.sections[i++],r=l+s;if(a>=0&&l<=t&&r>=e)return l<e&&r>t?"cover":!0;l=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ye(e)}static create(e){return new Ye(e)}}class ue extends Ye{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return gn(this,(t,i,l,s,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return kn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,s=0;l<t.length;l+=2){let a=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=a;let d=l>>1;for(;i.length<d;)i.push(Z.empty);i.push(a?e.slice(s,s+a):Z.empty)}s+=a}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:ts(this,e,!0)}map(e,t=!1){return e.empty?this:kn(this,e,t,!0)}iterChanges(e,t=!1){gn(this,e,t)}get desc(){return Ye.create(this.sections)}filter(e){let t=[],i=[],l=[],s=new Ht(this);e:for(let a=0,r=0;;){let d=a==e.length?1e9:e[a++];for(;r<d||r==d&&s.len==0;){if(s.done)break e;let f=Math.min(s.len,d-r);ke(l,f,-1);let c=s.ins==-1?-1:s.off==0?s.ins:0;ke(t,f,c),c>0&&st(i,t,s.text),s.forward(f),r+=f}let h=e[a++];for(;r<h;){if(s.done)break e;let f=Math.min(s.len,h-r);ke(t,f,-1),ke(l,f,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(f),r+=f}}return{changes:new ue(t,i),filtered:Ye.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],s=[],a=0,r=null;function d(f=!1){if(!f&&!l.length)return;a<t&&ke(l,t-a,-1);let c=new ue(l,s);r=r?r.compose(c.map(r)):c,l=[],s=[],a=0}function h(f){if(Array.isArray(f))for(let c of f)h(c);else if(f instanceof ue){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);d(),r=r?r.compose(f.map(r)):f}else{let{from:c,to:u=c,insert:m}=f;if(c>u||c<0||u>t)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${t})`);let k=m?typeof m=="string"?Z.of(m.split(i||mn)):m:Z.empty,y=k.length;if(c==u&&y==0)return;c<a&&d(),c>a&&ke(l,c-a,-1),ke(l,u-c,y),st(s,l,k),a=u}}return h(e),d(!r),r}static empty(e){return new ue(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let s=e[l];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((a,r)=>r&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<l;)i.push(Z.empty);i[l]=Z.of(s.slice(1)),t.push(s[0],i[l].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function ke(o,e,t,i=!1){if(e==0&&t<=0)return;let l=o.length-2;l>=0&&t<=0&&t==o[l+1]?o[l]+=e:e==0&&o[l]==0?o[l+1]+=t:i?(o[l]+=e,o[l+1]+=t):o.push(e,t)}function st(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(Z.empty);o.push(t)}}function gn(o,e,t){let i=o.inserted;for(let l=0,s=0,a=0;a<o.sections.length;){let r=o.sections[a++],d=o.sections[a++];if(d<0)l+=r,s+=r;else{let h=l,f=s,c=Z.empty;for(;h+=r,f+=d,d&&i&&(c=c.append(i[a-2>>1])),!(t||a==o.sections.length||o.sections[a+1]<0);)r=o.sections[a++],d=o.sections[a++];e(l,h,s,f,c),l=h,s=f}}}function kn(o,e,t,i=!1){let l=[],s=i?[]:null,a=new Ht(o),r=new Ht(e);for(let d=-1;;)if(a.ins==-1&&r.ins==-1){let h=Math.min(a.len,r.len);ke(l,h,-1),a.forward(h),r.forward(h)}else if(r.ins>=0&&(a.ins<0||d==a.i||a.off==0&&(r.len<a.len||r.len==a.len&&!t))){let h=r.len;for(ke(l,r.ins,-1);h;){let f=Math.min(a.len,h);a.ins>=0&&d<a.i&&a.len<=f&&(ke(l,0,a.ins),s&&st(s,l,a.text),d=a.i),a.forward(f),h-=f}r.next()}else if(a.ins>=0){let h=0,f=a.len;for(;f;)if(r.ins==-1){let c=Math.min(f,r.len);h+=c,f-=c,r.forward(c)}else if(r.ins==0&&r.len<f)f-=r.len,r.next();else break;ke(l,h,d<a.i?a.ins:0),s&&d<a.i&&st(s,l,a.text),d=a.i,a.forward(a.len-f)}else{if(a.done&&r.done)return s?ue.createSet(l,s):Ye.create(l);throw new Error("Mismatched change set lengths")}}function ts(o,e,t=!1){let i=[],l=t?[]:null,s=new Ht(o),a=new Ht(e);for(let r=!1;;){if(s.done&&a.done)return l?ue.createSet(i,l):Ye.create(i);if(s.ins==0)ke(i,s.len,0,r),s.next();else if(a.len==0&&!a.done)ke(i,0,a.ins,r),l&&st(l,i,a.text),a.next();else{if(s.done||a.done)throw new Error("Mismatched change set lengths");{let d=Math.min(s.len2,a.len),h=i.length;if(s.ins==-1){let f=a.ins==-1?-1:a.off?0:a.ins;ke(i,d,f,r),l&&f&&st(l,i,a.text)}else a.ins==-1?(ke(i,s.off?0:s.len,d,r),l&&st(l,i,s.textBit(d))):(ke(i,s.off?0:s.len,a.off?0:a.ins,r),l&&!a.off&&st(l,i,a.text));r=(s.ins>d||a.ins>=0&&a.len>d)&&(r||i.length>h),s.forward2(d),a.forward(d)}}}}class Ht{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Z.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?Z.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 pt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new pt(i,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return W.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return W.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 W.range(e.anchor,e.head)}static create(e,t,i){return new pt(e,t,i)}}class W{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:W.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 W([this.main],0)}addRange(e,t=!0){return W.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,W.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 W(e.ranges.map(t=>pt.fromJSON(t)),e.main)}static single(e,t=e){return new W([W.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;l<e.length;l++){let s=e[l];if(s.empty?s.from<=i:s.from<i)return W.normalized(e.slice(),t);i=s.to}return new W(e,t)}static cursor(e,t=0,i,l){return pt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,t,i,l){let s=(i??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?pt.create(t,e,48|s):pt.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((l,s)=>l.from-s.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let s=e[l],a=e[l-1];if(s.empty?s.from<=a.to:s.from<a.to){let r=a.from,d=Math.max(s.to,a.to);l<=t&&t--,e.splice(--l,2,s.anchor>s.head?W.range(d,r):W.range(r,d))}}return new W(e,t)}}function is(o,e){for(let t of o.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let bn=0;class G{constructor(e,t,i,l,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=bn++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new G(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:yn),!!e.static,e.enables)}of(e){return new Si([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function yn(o,e){return o==e||o.length==e.length&&o.every((t,i)=>t===e[i])}class Si{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=bn++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,s=this.id,a=e[s]>>1,r=this.type==2,d=!1,h=!1,f=[];for(let c of this.dependencies)c=="doc"?d=!0:c=="selection"?h=!0:((t=e[c.id])!==null&&t!==void 0?t:1)&1||f.push(e[c.id]);return{create(c){return c.values[a]=i(c),1},update(c,u){if(d&&u.docChanged||h&&(u.docChanged||u.selection)||wn(c,f)){let m=i(c);if(r?!ns(m,c.values[a],l):!l(m,c.values[a]))return c.values[a]=m,1}return 0},reconfigure:(c,u)=>{let m,k=u.config.address[s];if(k!=null){let y=Oi(u,k);if(this.dependencies.every(b=>b instanceof G?u.facet(b)===c.facet(b):b instanceof mt?u.field(b,!1)==c.field(b,!1):!0)||(r?ns(m=i(c),y,l):l(m=i(c),y)))return c.values[a]=y,0}else m=i(c);return c.values[a]=m,1}}}}function ns(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)Qt(o,i)&1&&(t=!0);return t}function jd(o,e,t){let i=t.map(d=>o[d.id]),l=t.map(d=>d.type),s=i.filter(d=>!(d&1)),a=o[e.id]>>1;function r(d){let h=[];for(let f=0;f<i.length;f++){let c=Oi(d,i[f]);if(l[f]==2)for(let u of c)h.push(u);else h.push(c)}return e.combine(h)}return{create(d){for(let h of i)Qt(d,h);return d.values[a]=r(d),1},update(d,h){if(!wn(d,s))return 0;let f=r(d);return e.compare(f,d.values[a])?0:(d.values[a]=f,1)},reconfigure(d,h){let f=wn(d,i),c=h.config.facets[e.id],u=h.facet(e);if(c&&!f&&yn(t,c))return d.values[a]=u,0;let m=r(d);return e.compare(m,u)?(d.values[a]=u,0):(d.values[a]=m,1)}}}const ls=G.define({static:!0});class mt{constructor(e,t,i,l,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=s,this.provides=void 0}static define(e){let t=new mt(bn++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ls).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let s=i.values[t],a=this.updateF(s,l);return this.compareF(s,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ls.of({field:this,create:e})]}get extension(){return this}}const gt={lowest:4,low:3,default:2,high:1,highest:0};function Kt(o){return e=>new ss(e,o)}const zd={highest:Kt(gt.highest),high:Kt(gt.high),default:Kt(gt.default),low:Kt(gt.low),lowest:Kt(gt.lowest)};class ss{constructor(e,t){this.inner=e,this.prec=t}}class Ni{of(e){return new xn(this,e)}reconfigure(e){return Ni.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class xn{constructor(e,t){this.compartment=e,this.inner=t}}class Bi{constructor(e,t,i,l,s,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=s,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 l=[],s=Object.create(null),a=new Map;for(let u of qd(e,t,a))u instanceof mt?l.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let r=Object.create(null),d=[],h=[];for(let u of l)r[u.id]=h.length<<1,h.push(m=>u.slot(m));let f=i?.config.facets;for(let u in s){let m=s[u],k=m[0].facet,y=f&&f[u]||[];if(m.every(b=>b.type==0))if(r[k.id]=d.length<<1|1,yn(y,m))d.push(i.facet(k));else{let b=k.combine(m.map(x=>x.value));d.push(i&&k.compare(b,i.facet(k))?i.facet(k):b)}else{for(let b of m)b.type==0?(r[b.id]=d.length<<1|1,d.push(b.value)):(r[b.id]=h.length<<1,h.push(x=>b.dynamicSlot(x)));r[k.id]=h.length<<1,h.push(b=>jd(b,k,m))}}let c=h.map(u=>u(r));return new Bi(e,a,c,r,d,s)}}function qd(o,e,t){let i=[[],[],[],[],[]],l=new Map;function s(a,r){let d=l.get(a);if(d!=null){if(d<=r)return;let h=i[d].indexOf(a);h>-1&&i[d].splice(h,1),a instanceof xn&&t.delete(a.compartment)}if(l.set(a,r),Array.isArray(a))for(let h of a)s(h,r);else if(a instanceof xn){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(a.compartment)||a.inner;t.set(a.compartment,h),s(h,r)}else if(a instanceof ss)s(a.inner,a.prec);else if(a instanceof mt)i[r].push(a),a.provides&&s(a.provides,r);else if(a instanceof Si)i[r].push(a),a.facet.extensions&&s(a.facet.extensions,gt.default);else{let h=a.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,r)}}return s(o,gt.default),i.reduce((a,r)=>a.concat(r))}function Qt(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 l=o.computeSlot(o,o.config.dynamicSlots[t]);return o.status[t]=2|l}function Oi(o,e){return e&1?o.config.staticValues[e>>1]:o.values[e>>1]}const os=G.define(),vn=G.define({combine:o=>o.some(e=>e),static:!0}),as=G.define({combine:o=>o.length?o[0]:void 0,static:!0}),rs=G.define(),ds=G.define(),cs=G.define(),hs=G.define({combine:o=>o.length?o[0]:!1});class Nt{constructor(e,t){this.type=e,this.value=t}static define(){return new Ud}}class Ud{of(e){return new Nt(this,e)}}class Wd{constructor(e){this.map=e}of(e){return new he(this,e)}}class he{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new he(this.type,t)}is(e){return this.type==e}static define(e={}){return new Wd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let s=l.map(t);s&&i.push(s)}return i}}he.reconfigure=he.define(),he.appendConfig=he.define();class be{constructor(e,t,i,l,s,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,i&&is(i,t.newLength),s.some(r=>r.type==be.time)||(this.annotations=s.concat(be.time.of(Date.now())))}static create(e,t,i,l,s,a){return new be(e,t,i,l,s,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=Nt.define(),be.userEvent=Nt.define(),be.addToHistory=Nt.define(),be.remote=Nt.define();function Hd(o,e){let t=[];for(let i=0,l=0;;){let s,a;if(i<o.length&&(l==e.length||e[l]>=o[i]))s=o[i++],a=o[i++];else if(l<e.length)s=e[l++],a=e[l++];else return t;!t.length||t[t.length-1]<s?t.push(s,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function fs(o,e,t){var i;let l,s,a;return t?(l=e.changes,s=ue.empty(e.changes.length),a=o.changes.compose(e.changes)):(l=e.changes.map(o.changes),s=o.changes.mapDesc(e.changes,!0),a=o.changes.compose(l)),{changes:a,selection:e.selection?e.selection.map(s):(i=o.selection)===null||i===void 0?void 0:i.map(l),effects:he.mapEffects(o.effects,l).concat(he.mapEffects(e.effects,s)),annotations:o.annotations.length?o.annotations.concat(e.annotations):e.annotations,scrollIntoView:o.scrollIntoView||e.scrollIntoView}}function Cn(o,e,t){let i=e.selection,l=Bt(e.annotations);return e.userEvent&&(l=l.concat(be.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,o.facet(as)),selection:i&&(i instanceof W?i:W.single(i.anchor,i.head)),effects:Bt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function us(o,e,t){let i=Cn(o,e.length?e[0]:{},o.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let a=!!e[s].sequential;i=fs(i,Cn(o,e[s],a?i.changes.newLength:o.doc.length),a)}let l=be.create(o,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Qd(t?Kd(l):l)}function Kd(o){let e=o.startState,t=!0;for(let l of e.facet(rs)){let s=l(o);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Hd(t,s))}if(t!==!0){let l,s;if(t===!1)s=o.changes.invertedDesc,l=ue.empty(e.doc.length);else{let a=o.changes.filter(t);l=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}o=be.create(e,l,o.selection&&o.selection.map(s),he.mapEffects(o.effects,s),o.annotations,o.scrollIntoView)}let i=e.facet(ds);for(let l=i.length-1;l>=0;l--){let s=i[l](o);s instanceof be?o=s:Array.isArray(s)&&s.length==1&&s[0]instanceof be?o=s[0]:o=us(e,Bt(s),!1)}return o}function Qd(o){let e=o.startState,t=e.facet(cs),i=o;for(let l=t.length-1;l>=0;l--){let s=t[l](o);s&&Object.keys(s).length&&(i=fs(i,Cn(e,s,o.changes.newLength),!0))}return i==o?o:be.create(e,o.changes,o.selection,i.effects,i.annotations,i.scrollIntoView)}const Gd=[];function Bt(o){return o==null?Gd:Array.isArray(o)?o:[o]}var Xe=function(o){return o[o.Word=0]="Word",o[o.Space=1]="Space",o[o.Other=2]="Other",o}(Xe||(Xe={}));const Yd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Sn;try{Sn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Xd(o){if(Sn)return Sn.test(o);for(let e=0;e<o.length;e++){let t=o[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Yd.test(t)))return!0}return!1}function Jd(o){return e=>{if(!/\S/.test(e))return Xe.Space;if(Xd(e))return Xe.Word;for(let t=0;t<o.length;t++)if(e.indexOf(o[t])>-1)return Xe.Word;return Xe.Other}}class ne{constructor(e,t,i,l,s,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Qt(this,r<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Qt(this,i),Oi(this,i)}update(...e){return us(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let r of e.effects)r.is(Ni.reconfigure)?(t&&(l=new Map,t.compartments.forEach((d,h)=>l.set(h,d)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(he.reconfigure)?(t=null,i=r.value):r.is(he.appendConfig)&&(t=null,i=Bt(i).concat(r.value));let s;t?s=e.startState.values.slice():(t=Bi.resolve(i,l,this),s=new ne(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let a=e.startState.facet(vn)?e.newSelection:e.newSelection.asSingle();new ne(t,e.newDoc,a,s,(r,d)=>d.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:W.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),s=[i.range],a=Bt(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),h=this.changes(d.changes),f=h.map(l);for(let u=0;u<r;u++)s[u]=s[u].map(f);let c=l.mapDesc(h,!0);s.push(d.range.map(c)),l=l.compose(f),a=he.mapEffects(a,f).concat(he.mapEffects(Bt(d.effects),c))}return{changes:l,selection:W.create(s,t.mainIndex),effects:a}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(ne.lineSeparator))}toText(e){return Z.of(e.split(this.facet(ne.lineSeparator)||mn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Qt(this,t),Oi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof mt&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let a=i[s],r=e[s];l.push(a.init(d=>a.spec.fromJSON(r,d)))}}return ne.create({doc:e.doc,selection:W.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Bi.resolve(e.extensions||[],new Map),i=e.doc instanceof Z?e.doc:Z.of((e.doc||"").split(t.staticFacet(ne.lineSeparator)||mn)),l=e.selection?e.selection instanceof W?e.selection:W.single(e.selection.anchor,e.selection.head):W.single(0);return is(l,i.length),t.staticFacet(vn)||(l=l.asSingle()),new ne(t,i,l,t.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(ne.tabSize)}get lineBreak(){return this.facet(ne.lineSeparator)||`
5
- `}get readOnly(){return this.facet(hs)}phrase(e,...t){for(let i of this.facet(ne.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let s=+(l||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let s of this.facet(os))for(let a of s(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){return Jd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),s=this.charCategorizer(e),a=e-i,r=e-i;for(;a>0;){let d=Ge(t,a,!1);if(s(t.slice(d,a))!=Xe.Word)break;a=d}for(;r<l;){let d=Ge(t,r);if(s(t.slice(r,d))!=Xe.Word)break;r=d}return a==r?null:W.range(a+i,r+i)}}ne.allowMultipleSelections=vn,ne.tabSize=G.define({combine:o=>o.length?o[0]:4}),ne.lineSeparator=as,ne.readOnly=hs,ne.phrases=G.define({compare(o,e){let t=Object.keys(o),i=Object.keys(e);return t.length==i.length&&t.every(l=>o[l]==e[l])}}),ne.languageData=os,ne.changeFilter=rs,ne.transactionFilter=ds,ne.transactionExtender=cs,Ni.reconfigure=he.define();class Ot{eq(e){return this==e}range(e,t=e){return Gt.create(e,t,this)}}Ot.prototype.startSide=Ot.prototype.endSide=0,Ot.prototype.point=!1,Ot.prototype.mapMode=Be.TrackDel;class Gt{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Gt(e,t,i)}}function Nn(o,e){return o.from-e.from||o.value.startSide-e.value.startSide}class Bn{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let s=i?this.to:this.from;for(let a=l,r=s.length;;){if(a==r)return a;let d=a+r>>1,h=s[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==a)return h>=0?a:r;h>=0?r=d:a=d+1}}between(e,t,i,l){for(let s=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,s);s<a;s++)if(l(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],l=[],s=[],a=-1,r=-1;for(let d=0;d<this.value.length;d++){let h=this.value[d],f=this.from[d]+e,c=this.to[d]+e,u,m;if(f==c){let k=t.mapPos(f,h.startSide,h.mapMode);if(k==null||(u=m=k,h.startSide!=h.endSide&&(m=t.mapPos(f,h.endSide),m<u)))continue}else if(u=t.mapPos(f,h.startSide),m=t.mapPos(c,h.endSide),u>m||u==m&&h.startSide>0&&h.endSide<=0)continue;(m-u||h.endSide-h.startSide)<0||(a<0&&(a=u),h.point&&(r=Math.max(r,m-u)),i.push(h),l.push(u-a),s.push(m-a))}return{mapped:i.length?new Bn(l,s,i,r):null,pos:a}}}class oe{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new oe(e,t,i,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:l=0,filterTo:s=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Nn)),this.isEmpty)return t.length?oe.of(t):this;let r=new ms(this,null,-1).goto(0),d=0,h=[],f=new Vi;for(;r.value||d<t.length;)if(d<t.length&&(r.from-t[d].from||r.startSide-t[d].value.startSide)>=0){let c=t[d++];f.addInner(c.from,c.to,c.value)||h.push(c)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!a||l>this.chunkEnd(r.chunkIndex)||s<this.chunkPos[r.chunkIndex])&&f.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!a||l>r.to||s<r.from||a(r.from,r.to,r.value))&&(f.addInner(r.from,r.to,r.value)||h.push(Gt.create(r.from,r.to,r.value))),r.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?oe.empty:this.nextLayer.update({add:h,filter:a,filterFrom:l,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let a=0;a<this.chunk.length;a++){let r=this.chunkPos[a],d=this.chunk[a],h=e.touchesRange(r,r+d.length);if(h===!1)l=Math.max(l,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(h===!0){let{mapped:f,pos:c}=d.map(r,e);f&&(l=Math.max(l,f.maxPoint),t.push(f),i.push(c))}}let s=this.nextLayer.map(e);return t.length==0?s:new oe(i,t,s||oe.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let s=this.chunkPos[l],a=this.chunk[l];if(t>=s&&e<=s+a.length&&a.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Yt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Yt.from(e).goto(t)}static compare(e,t,i,l,s=-1){let a=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),r=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),d=ps(a,r,i),h=new Xt(a,d,s),f=new Xt(r,d,s);i.iterGaps((c,u,m)=>gs(h,c,f,u,m,l)),i.empty&&i.length==0&&gs(h,0,f,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let s=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0),a=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(s.length!=a.length)return!1;if(!s.length)return!0;let r=ps(s,a),d=new Xt(s,r,0).goto(i),h=new Xt(a,r,0).goto(i);for(;;){if(d.to!=h.to||!Vn(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>l)return!0;d.next(),h.next()}}static spans(e,t,i,l,s=-1){let a=new Xt(e,null,s).goto(t),r=t,d=a.openStart;for(;;){let h=Math.min(a.to,i);if(a.point){let f=a.activeForPoint(a.to),c=a.pointFrom<t?f.length+1:a.point.startSide<0?f.length:Math.min(f.length,d);l.point(r,h,a.point,f,c,a.pointRank),d=Math.min(a.openEnd(h),f.length)}else h>r&&(l.span(r,h,a.active,d),d=a.openEnd(h));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 Vi;for(let l of e instanceof Gt?[e]:t?Zd(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return oe.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=oe.empty;l=l.nextLayer)t=new oe(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}oe.empty=new oe([],[],null,-1);function Zd(o){if(o.length>1)for(let e=o[0],t=1;t<o.length;t++){let i=o[t];if(Nn(e,i)>0)return o.slice().sort(Nn);e=i}return o}oe.empty.nextLayer=oe.empty;class Vi{finishChunk(e){this.chunks.push(new Bn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Vi)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(oe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=oe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function ps(o,e,t){let i=new Map;for(let s of o)for(let a=0;a<s.chunk.length;a++)s.chunk[a].maxPoint<=0&&i.set(s.chunk[a],s.chunkPos[a]);let l=new Set;for(let s of e)for(let a=0;a<s.chunk.length;a++){let r=i.get(s.chunk[a]);r!=null&&(t?t.mapPos(r):r)==s.chunkPos[a]&&!t?.touchesRange(r,r+s.chunk[a].length)&&l.add(s.chunk[a])}return l}class ms{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Yt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let s=0;s<e.length;s++)for(let a=e[s];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&l.push(new ms(a,t,i,s));return l.length==1?l[0]:new Yt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),On(this.heap,0)}}}function On(o,e){for(let t=o[e];;){let i=(e<<1)+1;if(i>=o.length)break;let l=o[i];if(i+1<o.length&&l.compare(o[i+1])>=0&&(l=o[i+1],i++),t.compare(l)<0)break;o[i]=t,o[e]=l,e=i}}class Xt{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Yt.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){_i(this.active,e),_i(this.activeTo,e),_i(this.activeRank,e),this.minActive=ks(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Mi(this.active,t,i),Mi(this.activeTo,t,l),Mi(this.activeRank,t,s),e&&Mi(e,t,this.cursor.from),this.minActive=ks(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&_i(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function gs(o,e,t,i,l,s){o.goto(e),t.goto(i);let a=i+l,r=i,d=i-e;for(;;){let h=o.to+d-t.to||o.endSide-t.endSide,f=h<0?o.to+d:t.to,c=Math.min(f,a);if(o.point||t.point?o.point&&t.point&&(o.point==t.point||o.point.eq(t.point))&&Vn(o.activeForPoint(o.to),t.activeForPoint(t.to))||s.comparePoint(r,c,o.point,t.point):c>r&&!Vn(o.active,t.active)&&s.compareRange(r,c,o.active,t.active),f>a)break;r=f,h<=0&&o.next(),h>=0&&t.next()}}function Vn(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 _i(o,e){for(let t=e,i=o.length-1;t<i;t++)o[t]=o[t+1];o.pop()}function Mi(o,e,t){for(let i=o.length-1;i>=e;i--)o[i+1]=o[i];o[e]=t}function ks(o,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||o[l].endSide-o[t].endSide)<0&&(t=l,i=e[l]);return t}function ec(o,e,t,i){for(let l=0,s=0;;){if(s>=e)return l;if(l==o.length)break;s+=o.charCodeAt(l)==9?t-s%t:1,l=Ge(o,l)}return i===!0?-1:o.length}const _n="ͼ",bs=typeof Symbol>"u"?"__"+_n:Symbol.for(_n),Mn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ys=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ot{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function s(a,r,d,h){let f=[],c=/^@(\w+)\b/.exec(a[0]),u=c&&c[1]=="keyframes";if(c&&r==null)return d.push(a[0]+";");for(let m in r){let k=r[m];if(/&/.test(m))s(m.split(/,\s*/).map(y=>a.map(b=>y.replace(/&/,b))).reduce((y,b)=>y.concat(b)),k,d);else if(k&&typeof k=="object"){if(!c)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(l(m),k,f,u)}else k!=null&&f.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+k+";")}(f.length||u)&&d.push((i&&!c&&!h?a.map(i):a).join(", ")+" {"+f.join(" ")+"}")}for(let a in e)s(l(a),e[a],this.rules)}getRules(){return this.rules.join(`
6
- `)}static newName(){let e=ys[bs]||1;return ys[bs]=e+1,_n+e.toString(36)}static mount(e,t,i){let l=e[Mn],s=i&&i.nonce;l?s&&l.setNonce(s):l=new tc(e,s),l.mount(Array.isArray(t)?t:[t],e)}}let ws=new Map;class tc{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let s=ws.get(i);if(s)return e[Mn]=s;this.sheet=new l.CSSStyleSheet,ws.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Mn]=this}mount(e,t){let i=this.sheet,l=0,s=0;for(let a=0;a<e.length;a++){let r=e[a],d=this.modules.indexOf(r);if(d<s&&d>-1&&(this.modules.splice(d,1),s--,d=-1),d==-1){if(this.modules.splice(s++,0,r),i)for(let h=0;h<r.rules.length;h++)i.insertRule(r.rules[h],l++)}else{for(;s<d;)l+=this.modules[s++].rules.length;l+=r.rules.length,s++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let 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 Vt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Tn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pe=0;pe<10;pe++)Vt[48+pe]=Vt[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Vt[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Vt[pe]=String.fromCharCode(pe+32),Tn[pe]=String.fromCharCode(pe);for(var An in Vt)Tn.hasOwnProperty(An)||(Tn[An]=Vt[An]);function Jt(o){let e;return o.nodeType==11?e=o.getSelection?o:o.ownerDocument:e=o,e.getSelection()}function En(o,e){return e?o==e||o.contains(e.nodeType!=1?e.parentNode:e):!1}function ic(o){let e=o.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ti(o,e){if(!e.anchorNode)return!1;try{return En(o,e.anchorNode)}catch{return!1}}function Zt(o){return o.nodeType==3?bt(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function ei(o,e,t,i){return t?xs(o,e,t,i,-1)||xs(o,e,t,i,1):!1}function kt(o){for(var e=0;;e++)if(o=o.previousSibling,!o)return e}function Ai(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function xs(o,e,t,i,l){for(;;){if(o==t&&e==i)return!0;if(e==(l<0?0:Je(o))){if(o.nodeName=="DIV")return!1;let s=o.parentNode;if(!s||s.nodeType!=1)return!1;e=kt(o)+(l<0?0:1),o=s}else if(o.nodeType==1){if(o=o.childNodes[e+(l<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;e=l<0?Je(o):0}else return!1}}function Je(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function Ei(o,e){let t=e?o.left:o.right;return{left:t,right:t,top:o.top,bottom:o.bottom}}function nc(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 vs(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 lc(o,e,t,i,l,s,a,r){let d=o.ownerDocument,h=d.defaultView||window;for(let f=o,c=!1;f&&!c;)if(f.nodeType==1){let u,m=f==d.body,k=1,y=1;if(m)u=nc(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let v=f.getBoundingClientRect();({scaleX:k,scaleY:y}=vs(f,v)),u={left:v.left,right:v.left+f.clientWidth*k,top:v.top,bottom:v.top+f.clientHeight*y}}let b=0,x=0;if(l=="nearest")e.top<u.top?(x=-(u.top-e.top+a),t>0&&e.bottom>u.bottom+x&&(x=e.bottom-u.bottom+x+a)):e.bottom>u.bottom&&(x=e.bottom-u.bottom+a,t<0&&e.top-x<u.top&&(x=-(u.top+x-e.top+a)));else{let v=e.bottom-e.top,V=u.bottom-u.top;x=(l=="center"&&v<=V?e.top+v/2-V/2:l=="start"||l=="center"&&t<0?e.top-a:e.bottom-V+a)-u.top}if(i=="nearest"?e.left<u.left?(b=-(u.left-e.left+s),t>0&&e.right>u.right+b&&(b=e.right-u.right+b+s)):e.right>u.right&&(b=e.right-u.right+s,t<0&&e.left<u.left+b&&(b=-(u.left+b-e.left+s))):b=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-s:e.right-(u.right-u.left)+s)-u.left,b||x)if(m)h.scrollBy(b,x);else{let v=0,V=0;if(x){let g=f.scrollTop;f.scrollTop+=x/y,V=(f.scrollTop-g)*y}if(b){let g=f.scrollLeft;f.scrollLeft+=b/k,v=(f.scrollLeft-g)*k}e={left:e.left-v,top:e.top-V,right:e.right-v,bottom:e.bottom-V},v&&Math.abs(v-b)<1&&(i="nearest"),V&&Math.abs(V-x)<1&&(l="nearest")}if(m)break;f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function sc(o){let e=o.ownerDocument,t,i;for(let l=o.parentNode;l&&!(l==e.body||t&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=l),!t&&l.scrollWidth>l.clientWidth&&(t=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:t,y:i}}class oc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Je(t):0),i,Math.min(e.focusOffset,i?Je(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let _t=null;function Cs(o){if(o.setActive)return o.setActive();if(_t)return o.focus(_t);let e=[];for(let t=o;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(o.focus(_t==null?{get preventScroll(){return _t={preventScroll:!0},!0}}:void 0),!_t){_t=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],s=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=s&&(i.scrollLeft=s)}}}let Ss;function bt(o,e,t=e){let i=Ss||(Ss=document.createRange());return i.setEnd(o,t),i.setStart(o,e),i}function Mt(o,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let s=new KeyboardEvent("keydown",l);s.synthetic=!0,o.dispatchEvent(s);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,o.dispatchEvent(a),s.defaultPrevented||a.defaultPrevented}function ac(o){for(;o;){if(o&&(o.nodeType==9||o.nodeType==11&&o.host))return o;o=o.assignedSlot||o.parentNode}return null}function Ns(o){for(;o.attributes.length;)o.removeAttributeNode(o.attributes[0])}function rc(o,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Je(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Je(t))}else{if(t==o)return!0;i=kt(t),t=t.parentNode}}function Bs(o){return o.scrollTop>Math.max(1,o.scrollHeight-o.clientHeight-4)}function Os(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=Je(t)}else if(t.parentNode&&!Ai(t))i=kt(t),t=t.parentNode;else return null}}function Vs(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&&!Ai(t))i=kt(t)+1,t=t.parentNode;else return null}}class ye{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ye(e.parentNode,kt(e),t)}static after(e,t){return new ye(e.parentNode,kt(e)+1,t)}}const In=[];class le{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,l=null,s;for(let a of this.children){if(a.flags&7){if(!a.dom&&(s=l?l.nextSibling:i.firstChild)){let r=le.get(s);(!r||!r.parent&&r.canReuseDOM(a))&&a.reuseDOM(s)}a.sync(e,t),a.flags&=-8}if(s=l?l.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&s!=a.dom&&(t.written=!0),a.dom.parentNode==i)for(;s&&s!=a.dom;)s=_s(s);else i.insertBefore(a.dom,s);l=a.dom}for(s=l?l.nextSibling:i.firstChild,s&&t&&t.node==i&&(t.written=!0);s;)s=_s(s)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let l=Je(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;l==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?l=-1:l=1),e=s}l<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!le.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,s=0;;l++){let a=this.children[l];if(a.dom==i)return s;s+=a.length+a.breakAfter}}domBoundsAround(e,t,i=0){let l=-1,s=-1,a=-1,r=-1;for(let d=0,h=i,f=i;d<this.children.length;d++){let c=this.children[d],u=h+c.length;if(h<e&&u>t)return c.domBoundsAround(e,t,h);if(u>=e&&l==-1&&(l=d,s=h),h>t&&c.dom.parentNode==this.dom){a=d,r=f;break}f=u,h=u+c.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(l?this.children[l-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=In){this.markDirty();for(let l=e;l<t;l++){let s=this.children[l];s.parent==this&&i.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...i);for(let l=0;l<i.length;l++)i[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ms(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,i,l,s,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}}le.prototype.breakAfter=0;function _s(o){let e=o.nextSibling;return o.parentNode.removeChild(o),e}class Ms{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Ts(o,e,t,i,l,s,a,r,d){let{children:h}=o,f=h.length?h[e]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:a;if(!(e==i&&f&&!a&&!u&&s.length<2&&f.merge(t,l,s.length?c:null,t==0,r,d))){if(i<h.length){let m=h[i];m&&(l<m.length||m.breakAfter&&c?.breakAfter)?(e==i&&(m=m.split(l),l=0),!u&&c&&m.merge(0,l,c,!0,0,d)?s[s.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,d),s.push(m))):m?.breakAfter&&(c?c.breakAfter=1:a=1),i++}for(f&&(f.breakAfter=a,t>0&&(!a&&s.length&&f.merge(t,f.length,s[0],!1,r,0)?f.breakAfter=s.shift().breakAfter:(t<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(t,f.length,null,!1,r,0),e++));e<i&&s.length;)if(h[i-1].become(s[s.length-1]))i--,s.pop(),d=s.length?0:r;else if(h[e].become(s[0]))e++,s.shift(),r=s.length?0:d;else break;!s.length&&e&&i<h.length&&!h[e-1].breakAfter&&h[i].merge(0,0,h[e-1],!1,r,d)&&e--,(e<i||s.length)&&o.replaceChildren(e,i,s)}}function As(o,e,t,i,l,s){let a=o.childCursor(),{i:r,off:d}=a.findPos(t,1),{i:h,off:f}=a.findPos(e,-1),c=e-t;for(let u of i)c+=u.length;o.length+=c,Ts(o,h,f,r,d,i,0,l,s)}let Se=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Dn=typeof document<"u"?document:{documentElement:{style:{}}};const Pn=/Edge\/(\d+)/.exec(Se.userAgent),Es=/MSIE \d/.test(Se.userAgent),Fn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Se.userAgent),Ii=!!(Es||Fn||Pn),Is=!Ii&&/gecko\/(\d+)/i.test(Se.userAgent),$n=!Ii&&/Chrome\/(\d+)/.exec(Se.userAgent),Ds="webkitFontSmoothing"in Dn.documentElement.style,Ps=!Ii&&/Apple Computer/.test(Se.vendor),Fs=Ps&&(/Mobile\/\w+/.test(Se.userAgent)||Se.maxTouchPoints>2);var U={mac:Fs||/Mac/.test(Se.platform),windows:/Win/.test(Se.platform),linux:/Linux|X11/.test(Se.platform),ie:Ii,ie_version:Es?Dn.documentMode||6:Fn?+Fn[1]:Pn?+Pn[1]:0,gecko:Is,gecko_version:Is?+(/Firefox\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,chrome:!!$n,chrome_version:$n?+$n[1]:0,ios:Fs,android:/Android\b/.test(Se.userAgent),webkit:Ds,safari:Ps,webkit_version:Ds?+(/\bAppleWebKit\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,tabSize:Dn.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const dc=256;class Ie extends le{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 Ie)||this.length-(t-e)+i.length>dc||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ie(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return cc(this.dom,e,t)}}class Ze extends le{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let l of t)l.setParent(this)}setAttrs(e){if(Ns(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,l,s,a){return i&&(!(i instanceof Ze&&i.mark.eq(this.mark))||e&&s<=0||t<this.length&&a<=0)?!1:(As(this,e,t,i?i.children.slice():[],s-1,a-1),this.markDirty(),!0)}split(e){let t=[],i=0,l=-1,s=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=s),i=d,s++}let a=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new Ze(this.mark,t,a)}domAtPos(e){return $s(this,e)}coordsAt(e,t){return Ls(this,e,t)}}function cc(o,e,t){let i=o.nodeValue.length;e>i&&(e=i);let l=e,s=e,a=0;e==0&&t<0||e==i&&t>=0?U.chrome||U.gecko||(e?(l--,a=1):s<i&&(s++,a=-1)):t<0?l--:s<i&&s++;let r=bt(o,l,s).getClientRects();if(!r.length)return null;let d=r[(a?a<0:t>=0)?0:r.length-1];return U.safari&&!a&&d.width==0&&(d=Array.prototype.find.call(r,h=>h.width)||d),a?Ei(d,a<0):d||null}class yt extends le{static create(e,t,i){return new yt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=yt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,l,s,a){return i&&(!(i instanceof yt)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e instanceof yt&&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 Z.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):Z.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let l=this.dom.getClientRects(),s=null;if(!l.length)return null;let a=this.side?this.side<0:e>0;for(let r=a?l.length-1:0;s=l[r],!(e>0?r==0:r==l.length-1||s.top<s.bottom);r+=a?-1:1);return Ei(s,!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 Tt extends le{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Tt&&e.side==this.side}split(){return new Tt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Z.empty}get isHidden(){return!0}}Ie.prototype.children=yt.prototype.children=Tt.prototype.children=In;function $s(o,e){let t=o.dom,{children:i}=o,l=0;for(let s=0;l<i.length;l++){let a=i[l],r=s+a.length;if(!(r==s&&a.getSide()<=0)){if(e>s&&e<r&&a.dom.parentNode==t)return a.domAtPos(e-s);if(e<=s)break;s=r}}for(let s=l;s>0;s--){let a=i[s-1];if(a.dom.parentNode==t)return a.domAtPos(a.length)}for(let s=l;s<i.length;s++){let a=i[s];if(a.dom.parentNode==t)return a.domAtPos(0)}return new ye(t,0)}function Rs(o,e,t){let i,{children:l}=o;t>0&&e instanceof Ze&&l.length&&(i=l[l.length-1])instanceof Ze&&i.mark.eq(e.mark)?Rs(i,e.children[0],t-1):(l.push(e),e.setParent(o)),o.length+=e.length}function Ls(o,e,t){let i=null,l=-1,s=null,a=-1;function r(h,f){for(let c=0,u=0;c<h.children.length&&u<=f;c++){let m=h.children[c],k=u+m.length;k>=f&&(m.children.length?r(m,f-u):(!s||s.isHidden&&t>0)&&(k>f||u==k&&m.getSide()>0)?(s=m,a=f-u):(u<f||u==k&&m.getSide()<0&&!m.isHidden)&&(i=m,l=f-u)),u=k}}r(o,e);let d=(t<0?i:s)||i||s;return d?d.coordsAt(Math.max(0,d==i?l:a),t):hc(o)}function hc(o){let e=o.dom.lastChild;if(!e)return o.dom.getBoundingClientRect();let t=Zt(e);return t[t.length-1]||null}function Rn(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 js=Object.create(null);function Di(o,e,t){if(o==e)return!0;o||(o=js),e||(e=js);let i=Object.keys(o),l=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(l.indexOf(s)==-1||o[s]!==e[s]))return!1;return!0}function Ln(o,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?o.style.cssText="":o.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?o.style.cssText=t[l]:o.setAttribute(l,t[l]));return i}function fc(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 jn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var ze=function(o){return o[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o}(ze||(ze={}));class we extends Ot{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new ti(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new at(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:s,end:a}=zs(e,t);i=(s?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new at(e,i,l,t,e.widget||null,!0)}static line(e){return new ii(e)}static set(e,t=!1){return oe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=oe.empty;class ti extends we{constructor(e){let{start:t,end:i}=zs(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof ti&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Di(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ti.prototype.point=!1;class ii extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ii&&this.spec.class==e.spec.class&&Di(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}ii.prototype.mapMode=Be.TrackBefore,ii.prototype.point=!0;class at extends we{constructor(e,t,i,l,s,a){super(t,i,s,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?Be.TrackBefore:Be.TrackAfter:Be.TrackDel}get type(){return this.startSide!=this.endSide?ze.WidgetRange:this.startSide<=0?ze.WidgetBefore:ze.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof at&&uc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}at.prototype.point=!0;function zs(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 uc(o,e){return o==e||!!(o&&e&&o.compare(e))}function zn(o,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=o?t[l]=Math.max(t[l],e):t.push(o,e)}class ce extends le{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,l,s,a){if(i){if(!(i instanceof ce))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),As(this,e,t,i?i.children.slice():[],s,a),!0}split(e){let t=new ce;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:l}=this.childPos(e);l&&(t.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let s=i;s<this.children.length;s++)t.append(this.children[s],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Di(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Rs(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Rn(t,this.attrs||{})),i&&(this.attrs=Rn({class:i},this.attrs||{}))}domAtPos(e){return $s(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Ns(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Ln(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let l=this.dom.lastChild;for(;l&&le.get(l)instanceof Ze;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=le.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!U.ios||!this.children.some(s=>s instanceof Ie))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ie)||/[^ -~]/.test(i.text))return null;let l=Zt(i.dom);if(l.length!=1)return null;e+=l[0].width,t=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Ls(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-l.lineHeight)<2&&l.textHeight<s){let a=(s-l.textHeight)/2;return{top:i.top+a,bottom:i.bottom-a,left:i.left,right:i.left}}}return i}become(e){return e instanceof ce&&this.children.length==0&&e.children.length==0&&Di(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,l=0;i<e.children.length;i++){let s=e.children[i],a=l+s.length;if(a>=t){if(s instanceof ce)return s;if(a>t)break}l=a+s.breakAfter}return null}}class et extends le{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,l,s,a){return i&&(!(i instanceof et)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?ye.before(this.dom):ye.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let i=new et(this.widget,t,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return In}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Z.empty}domBoundsAround(){return null}become(e){return e instanceof et&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);return i||(this.widget instanceof qn?null:Ei(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:i}=this.deco;return t==i?!1:e<0?t<0:i>0}}class qn extends jn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class ni{constructor(e,t,i,l){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof et&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ce),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Pi(new Tt(-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 et)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:s,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=s,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Pi(new Ie(this.text.slice(this.textOff,this.textOff+l)),t),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,t,i,l){this.buildText(t-e,i,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,i,l,s,a){if(this.disallowBlockEffectsFor[a]&&i instanceof at){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 at)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new et(i.widget||At.block,r,i));else{let d=yt.create(i.widget||At.inline,r,r?0:i.startSide),h=this.atCursorPos&&!d.isEditable&&s<=l.length&&(e<t||i.startSide>0),f=!d.isEditable&&(e<t||s>l.length||i.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),h&&(c.append(Pi(new Tt(1),l),s),s=l.length+Math.max(0,s-l.length)),c.append(Pi(d,l),s),this.atCursorPos=f,this.pendingBuffer=f?e<t||s>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,i,l,s){let a=new ni(e,t,i,s);return a.openEnd=oe.spans(l,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Pi(o,e){for(let t of e)o=new Ze(t,[o],o.length);return o}class At extends jn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}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,Un=me.RTL;function qs(o){let e=[];for(let t=0;t<o.length;t++)e.push(1<<+o[t]);return e}const pc=qs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),mc=qs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Wn=Object.create(null),qe=[];for(let o of["()","[]","{}"]){let e=o.charCodeAt(0),t=o.charCodeAt(1);Wn[e]=t,Wn[t]=-e}function Us(o){return o<=247?pc[o]:1424<=o&&o<=1524?2:1536<=o&&o<=1785?mc[o-1536]:1774<=o&&o<=2220?4:8192<=o&&o<=8204?256:64336<=o&&o<=65023?4:1}const gc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class rt{get dir(){return this.level%2?Un: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,l){let s=-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;(s<0||(l!=0?l<0?r.from<t:r.to>t:e[s].level>r.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function Ws(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++){let i=o[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!Ws(i.inner,l.inner))return!1}return!0}const se=[];function kc(o,e,t,i,l){for(let s=0;s<=i.length;s++){let a=s?i[s-1].to:e,r=s<i.length?i[s].from:t,d=s?256:l;for(let h=a,f=d,c=d;h<r;h++){let u=Us(o.charCodeAt(h));u==512?u=f:u==8&&c==4&&(u=16),se[h]=u==4?2:u,u&7&&(c=u),f=u}for(let h=a,f=d,c=d;h<r;h++){let u=se[h];if(u==128)h<r-1&&f==se[h+1]&&f&24?u=se[h]=f:se[h]=256;else if(u==64){let m=h+1;for(;m<r&&se[m]==64;)m++;let k=h&&f==8||m<t&&se[m]==8?c==1?1:8:256;for(let y=h;y<m;y++)se[y]=k;h=m-1}else u==8&&c==1&&(se[h]=1);f=u,u&7&&(c=u)}}}function bc(o,e,t,i,l){let s=l==1?2:1;for(let a=0,r=0,d=0;a<=i.length;a++){let h=a?i[a-1].to:e,f=a<i.length?i[a].from:t;for(let c=h,u,m,k;c<f;c++)if(m=Wn[u=o.charCodeAt(c)])if(m<0){for(let y=r-3;y>=0;y-=3)if(qe[y+1]==-m){let b=qe[y+2],x=b&2?l:b&4?b&1?s:l:0;x&&(se[c]=se[qe[y]]=x),r=y;break}}else{if(qe.length==189)break;qe[r++]=c,qe[r++]=u,qe[r++]=d}else if((k=se[c])==2||k==1){let y=k==l;d=y?0:1;for(let b=r-3;b>=0;b-=3){let x=qe[b+2];if(x&2)break;if(y)qe[b+2]|=2;else{if(x&4)break;qe[b+2]|=4}}}}}function yc(o,e,t,i){for(let l=0,s=i;l<=t.length;l++){let a=l?t[l-1].to:o,r=l<t.length?t[l].from:e;for(let d=a;d<r;){let h=se[d];if(h==256){let f=d+1;for(;;)if(f==r){if(l==t.length)break;f=t[l++].to,r=l<t.length?t[l].from:e}else if(se[f]==256)f++;else break;let c=s==1,u=(f<e?se[f]:i)==1,m=c==u?c?1:2:i;for(let k=f,y=l,b=y?t[y-1].to:o;k>d;)k==b&&(k=t[--y].from,b=y?t[y-1].to:o),se[--k]=m;d=f}else s=h,d++}}}function Hn(o,e,t,i,l,s,a){let r=i%2?2:1;if(i%2==l%2)for(let d=e,h=0;d<t;){let f=!0,c=!1;if(h==s.length||d<s[h].from){let y=se[d];y!=r&&(f=!1,c=y==16)}let u=!f&&r==1?[]:null,m=f?i:i+1,k=d;e:for(;;)if(h<s.length&&k==s[h].from){if(c)break e;let y=s[h];if(!f)for(let b=y.to,x=h+1;;){if(b==t)break e;if(x<s.length&&s[x].from==b)b=s[x++].to;else{if(se[b]==r)break e;break}}if(h++,u)u.push(y);else{y.from>d&&a.push(new rt(d,y.from,m));let b=y.direction==wt!=!(m%2);Kn(o,b?i+1:i,l,y.inner,y.from,y.to,a),d=y.to}k=y.to}else{if(k==t||(f?se[k]!=r:se[k]==r))break;k++}u?Hn(o,d,k,i+1,l,u,a):d<k&&a.push(new rt(d,k,m)),d=k}else for(let d=t,h=s.length;d>e;){let f=!0,c=!1;if(!h||d>s[h-1].to){let y=se[d-1];y!=r&&(f=!1,c=y==16)}let u=!f&&r==1?[]:null,m=f?i:i+1,k=d;e:for(;;)if(h&&k==s[h-1].to){if(c)break e;let y=s[--h];if(!f)for(let b=y.from,x=h;;){if(b==e)break e;if(x&&s[x-1].to==b)b=s[--x].from;else{if(se[b-1]==r)break e;break}}if(u)u.push(y);else{y.to<d&&a.push(new rt(y.to,d,m));let b=y.direction==wt!=!(m%2);Kn(o,b?i+1:i,l,y.inner,y.from,y.to,a),d=y.from}k=y.from}else{if(k==e||(f?se[k-1]!=r:se[k-1]==r))break;k--}u?Hn(o,k,d,i+1,l,u,a):k<d&&a.push(new rt(k,d,m)),d=k}}function Kn(o,e,t,i,l,s,a){let r=e%2?2:1;kc(o,l,s,i,r),bc(o,l,s,i,r),yc(l,s,i,r),Hn(o,l,s,e,t,i,a)}function wc(o,e,t){if(!o)return[new rt(0,0,e==Un?1:0)];if(e==wt&&!t.length&&!gc.test(o))return Hs(o.length);if(t.length)for(;o.length>se.length;)se[se.length]=256;let i=[],l=e==wt?0:1;return Kn(o,l,l,t,0,o.length,i),i}function Hs(o){return[new rt(0,o,0)]}let Ks="";function xc(o,e,t,i,l){var s;let a=i.head-o.from,r=rt.find(e,a,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),d=e[r],h=d.side(l,t);if(a==h){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;d=e[r=u],a=d.side(!l,t),h=d.side(l,t)}let f=Ge(o.text,a,d.forward(l,t));(f<d.from||f>d.to)&&(f=h),Ks=o.text.slice(Math.min(a,f),Math.max(a,f));let c=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return c&&f==h&&c.level+(l?0:1)<d.level?W.cursor(c.side(!l,t)+o.from,c.forward(l,t)?1:-1,c.level):W.cursor(f+o.from,d.forward(l,t)?-1:1,d.level)}function vc(o,e,t){for(let i=e;i<t;i++){let l=Us(o.charCodeAt(i));if(l==1)return wt;if(l==2||l==4)return Un}return wt}const Qs=G.define(),Gs=G.define(),Ys=G.define(),Xs=G.define(),Qn=G.define(),Js=G.define(),Zs=G.define(),Gn=G.define(),Yn=G.define(),eo=G.define({combine:o=>o.some(e=>e)}),Cc=G.define({combine:o=>o.some(e=>e)}),to=G.define();class Et{constructor(e,t="nearest",i="nearest",l=5,s=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=s,this.isSnapshot=a}map(e){return e.empty?this:new Et(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 Et(W.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Fi=he.define({map:(o,e)=>o.map(e)}),io=he.define();function Ue(o,e,t){let i=o.facet(Xs);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const dt=G.define({combine:o=>o.length?o[0]:!0});let Sc=0;const li=G.define();class It{constructor(e,t,i,l,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:s,decorations:a}=t||{};return new It(Sc++,e,i,l,r=>{let d=[li.of(r)];return a&&d.push(si.of(h=>{let f=h.plugin(r);return f?a(f):we.none})),s&&d.push(s(r)),d})}static fromClass(e,t){return It.define(i=>new e(i),t)}}class Xn{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Ue(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){Ue(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){Ue(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const no=G.define(),Jn=G.define(),si=G.define(),lo=G.define(),Zn=G.define(),so=G.define();function oo(o,e){let t=o.state.facet(so);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(o):s),l=[];return oe.spans(i,e.from,e.to,{point(){},span(s,a,r,d){let h=s-e.from,f=a-e.from,c=l;for(let u=r.length-1;u>=0;u--,d--){let m=r[u].spec.bidiIsolate,k;if(m==null&&(m=vc(e.text,h,f)),d>0&&c.length&&(k=c[c.length-1]).to==h&&k.direction==m)k.to=f,c=k.inner;else{let y={from:h,to:f,direction:m,inner:[]};c.push(y),c=y.inner}}}}),l}const ao=G.define();function ro(o){let e=0,t=0,i=0,l=0;for(let s of o.state.facet(ao)){let a=s(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&&(l=Math.max(l,a.bottom)))}return{left:e,right:t,top:i,bottom:l}}const oi=G.define();class Te{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}join(e){return new Te(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,s=0,a=0,r=0;;l++){let d=l==e.length?null:e[l],h=a-r,f=d?d.fromB:1e9;for(;s<t.length&&t[s]<f;){let c=t[s],u=t[s+1],m=Math.max(r,c),k=Math.min(f,u);if(m<=k&&new Te(m+h,k+h,m,k).addToSet(i),u>f)break;s+=2}if(!d)return i;new Te(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 s of i)this.changes=this.changes.compose(s.changes);let l=[];this.changes.iterChangedRanges((s,a,r,d)=>l.push(new Te(s,a,r,d))),this.changedRanges=l}static create(e,t,i){return new $i(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class co extends le{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=we.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ce],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Te(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:f})=>f<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!Tc(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let s=l>-1?Bc(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;i=new Te(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(U.ie||U.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,r=this.updateDeco(),d=_c(a,r,e.changes);return i=Te.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=U.chrome||U.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||l.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.children)a instanceof et&&a.widget instanceof qn&&s.push(a.dom);l.updateGaps(s)}updateChildren(e,t,i){let l=i?i.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let a=l.length-1;;a--){let r=a>=0?l[a]:null;if(!r)break;let{fromA:d,toA:h,fromB:f,toB:c}=r,u,m,k,y;if(i&&i.range.fromB<c&&i.range.toB>f){let g=ni.build(this.view.state.doc,f,i.range.fromB,this.decorations,this.dynamicDecorationMap),p=ni.build(this.view.state.doc,i.range.toB,c,this.decorations,this.dynamicDecorationMap);m=g.breakAtStart,k=g.openStart,y=p.openEnd;let B=this.compositionView(i);p.breakAtStart?B.breakAfter=1:p.content.length&&B.merge(B.length,B.length,p.content[0],!1,p.openStart,0)&&(B.breakAfter=p.content[0].breakAfter,p.content.shift()),g.content.length&&B.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),u=g.content.concat(B).concat(p.content)}else({content:u,breakAtStart:m,openStart:k,openEnd:y}=ni.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:b,off:x}=s.findPos(h,1),{i:v,off:V}=s.findPos(d,-1);Ts(this,v,V,b,x,u,m,k,y)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(io)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ie(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new Ze(l,[t],t.length);let i=new ce;return i.append(t,0),i}fixCompositionDOM(e){let t=(s,a)=>{a.flags|=8|(a.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(a);let r=le.get(s);r&&r!=a&&(r.dom=null),a.setDOM(s)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];t(e.line,l);for(let s=e.marks.length-1;s>=-1;s--)i=l.childPos(i.off,1),l=l.children[i.i],t(s>=0?e.marks[s].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,s=!l&&Ti(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||t||s))return;let a=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(U.gecko&&r.empty&&!this.hasComposition&&Nc(d)){let c=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(c,d.node.childNodes[d.offset]||null)),d=h=new ye(c,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!ei(d.node,d.offset,f.anchorNode,f.anchorOffset)||!ei(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,r))&&(this.view.observer.ignore(()=>{U.android&&U.chrome&&this.dom.contains(f.focusNode)&&Mc(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Jt(this.view.root);if(c)if(r.empty){if(U.gecko){let u=Oc(d.node,d.offset);if(u&&u!=3){let m=(u==1?Os:Vs)(d.node,d.offset);m&&(d=new ye(m.node,m.offset))}}c.collapse(d.node,d.offset),r.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=r.bidiLevel)}else if(c.extend){c.collapse(d.node,d.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([d,h]=[h,d]),u.setEnd(h.node,h.offset),u.setStart(d.node,d.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ye(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new ye(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ei(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Jt(e.root),{anchorNode:l,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=ce.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),h=this.coordsAt(t.head,1);if(!d||!h||d.bottom>h.top)return;let f=this.domAtPos(t.head+t.assoc);i.collapse(f.node,f.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&i.collapse(l,s)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let l=e.offset;!i&&l<t.childNodes.length;l++){let s=le.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let s=le.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(s.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=le.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(i<l.length||l instanceof ce)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,l=0;for(let s=this.length,a=this.children.length-1;a>=0;a--){let r=this.children[a],d=s-r.breakAfter,h=d-r.length;if(d<e)break;if(h<=e&&(h<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof ce&&!(i instanceof ce&&t>=0)))i=r,l=h;else if(i&&h==e&&d==e&&r instanceof et&&Math.abs(t)<2){if(r.deco.startSide<0)break;a&&(i=null)}s=h}return i?i.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),l=this.children[t];if(!(l instanceof ce))return null;for(;l.children.length;){let{i:r,off:d}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=d}if(!(l instanceof Ie))return null;let s=Ge(l.text,i);if(s==i)return null;let a=bt(l.dom,i,s).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:l}=e,s=this.view.contentDOM.clientWidth,a=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let h=0,f=0;f<this.children.length;f++){let c=this.children[f],u=h+c.length;if(u>l)break;if(h>=i){let m=c.dom.getBoundingClientRect();if(t.push(m.height),a){let k=c.dom.lastChild,y=k?Zt(k):[];if(y.length){let b=y[y.length-1],x=d?b.right-m.left:m.right-b.left;x>r&&(r=x,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?me.RTL:me.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ce){let a=s.measureTextSize();if(a)return a}let e=document.createElement("div"),t,i,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Zt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,l=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ms(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let s=l==t.viewports.length?null:t.viewports[l],a=s?s.from-1:this.length;if(a>i){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(we.replace({widget:new qn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!s)break;i=s.to+1}return we.set(e)}updateDeco(){let e=1,t=this.view.state.facet(si).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,l=this.view.state.facet(lo).map((s,a)=>{let r=typeof s=="function";return r&&(i=!0),r?s(this.view):s});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(oe.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(to))try{if(h(this.view,e.range,e))return!0}catch(f){Ue(this.view.state,f,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let s=ro(this.view),a={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;lc(this.view.scrollDOM,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 Nc(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 ho(o,e){let t=o.observer.selectionRange;if(!t.focusNode)return null;let i=Os(t.focusNode,t.focusOffset),l=Vs(t.focusNode,t.focusOffset),s=i||l;if(l&&i&&l.node!=i.node){let r=le.get(l.node);if(!r||r instanceof Ie&&r.text!=l.node.nodeValue)s=l;else if(o.docView.lastCompositionAfterCursor){let d=le.get(i.node);!d||d instanceof Ie&&d.text!=i.node.nodeValue||(s=l)}}if(o.docView.lastCompositionAfterCursor=s!=i,!s)return null;let a=e-s.offset;return{from:a,to:a+s.node.nodeValue.length,node:s.node}}function Bc(o,e,t){let i=ho(o,t);if(!i)return null;let{node:l,from:s,to:a}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||o.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,h=new Te(d.mapPos(s),d.mapPos(a),s,a),f=[];for(let c=l.parentNode;;c=c.parentNode){let u=le.get(c);if(u instanceof Ze)f.push({node:c,deco:u.mark});else{if(u instanceof ce||c.nodeName=="DIV"&&c.parentNode==o.contentDOM)return{range:h,text:l,marks:f,line:c};if(c!=o.contentDOM)f.push({node:c,deco:new ti({inclusive:!0,attributes:fc(c),tagName:c.tagName.toLowerCase()})});else return null}}}function Oc(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){zn(e,t,this.changes)}comparePoint(e,t){zn(e,t,this.changes)}};function _c(o,e,t){let i=new Vc;return oe.compare(o,e,t,i),i.changes}function Mc(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 Tc(o,e){let t=!1;return e&&o.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}function Ac(o,e,t=1){let i=o.charCategorizer(e),l=o.doc.lineAt(e),s=e-l.from;if(l.length==0)return W.cursor(e);s==0?t=1:s==l.length&&(t=-1);let a=s,r=s;t<0?a=Ge(l.text,s,!1):r=Ge(l.text,s);let d=i(l.text.slice(a,r));for(;a>0;){let h=Ge(l.text,a,!1);if(i(l.text.slice(h,a))!=d)break;a=h}for(;r<l.length;){let h=Ge(l.text,r);if(i(l.text.slice(r,h))!=d)break;r=h}return W.range(a+l.from,r+l.from)}function Ec(o,e){return e.left>o?e.left-o:Math.max(0,o-e.right)}function Ic(o,e){return e.top>o?e.top-o:Math.max(0,o-e.bottom)}function el(o,e){return o.top<e.bottom-1&&o.bottom>e.top+1}function fo(o,e){return e<o.top?{top:e,left:o.left,right:o.right,bottom:o.bottom}:o}function uo(o,e){return e>o.bottom?{top:o.top,left:o.left,right:o.right,bottom:e}:o}function tl(o,e,t){let i,l,s,a,r=!1,d,h,f,c;for(let k=o.firstChild;k;k=k.nextSibling){let y=Zt(k);for(let b=0;b<y.length;b++){let x=y[b];l&&el(l,x)&&(x=fo(uo(x,l.bottom),l.top));let v=Ec(e,x),V=Ic(t,x);if(v==0&&V==0)return k.nodeType==3?po(k,e,t):tl(k,e,t);if(!i||a>V||a==V&&s>v){i=k,l=x,s=v,a=V;let g=V?t<x.top?-1:1:v?e<x.left?-1:1:0;r=!g||(g>0?b<y.length-1:b>0)}v==0?t>x.bottom&&(!f||f.bottom<x.bottom)?(d=k,f=x):t<x.top&&(!c||c.top>x.top)&&(h=k,c=x):f&&el(f,x)?f=uo(f,x.bottom):c&&el(c,x)&&(c=fo(c,x.top))}}if(f&&f.bottom>=t?(i=d,l=f):c&&c.top<=t&&(i=h,l=c),!i)return{node:o,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return po(i,u,t);if(r&&i.contentEditable!="false")return tl(i,u,t);let m=Array.prototype.indexOf.call(o.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:o,offset:m}}function po(o,e,t){let i=o.nodeValue.length,l=-1,s=1e9,a=0;for(let r=0;r<i;r++){let d=bt(o,r,r+1).getClientRects();for(let h=0;h<d.length;h++){let f=d[h];if(f.top==f.bottom)continue;a||(a=e-f.left);let c=(f.top>t?f.top-t:t-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&c<s){let u=e>=(f.left+f.right)/2,m=u;if((U.chrome||U.gecko)&&bt(o,r).getBoundingClientRect().left==f.right&&(m=!u),c<=0)return{node:o,offset:r+(m?1:0)};l=r+(m?1:0),s=c}}}return{node:o,offset:l>-1?l:a>0?o.nodeValue.length:0}}function mo(o,e,t,i=-1){var l,s;let a=o.contentDOM.getBoundingClientRect(),r=a.top+o.viewState.paddingTop,d,{docHeight:h}=o.viewState,{x:f,y:c}=e,u=c-r;if(u<0)return 0;if(u>h)return o.state.doc.length;for(let g=o.viewState.heightOracle.textHeight/2,p=!1;d=o.elementAtHeight(u),d.type!=ze.Text;)for(;u=i>0?d.bottom+g:d.top-g,!(u>=0&&u<=h);){if(p)return t?null:0;p=!0,i=-i}c=r+u;let m=d.from;if(m<o.viewport.from)return o.viewport.from==0?0:t?null:go(o,a,d,f,c);if(m>o.viewport.to)return o.viewport.to==o.state.doc.length?o.state.doc.length:t?null:go(o,a,d,f,c);let k=o.dom.ownerDocument,y=o.root.elementFromPoint?o.root:k,b=y.elementFromPoint(f,c);b&&!o.contentDOM.contains(b)&&(b=null),b||(f=Math.max(a.left+1,Math.min(a.right-1,f)),b=y.elementFromPoint(f,c),b&&!o.contentDOM.contains(b)&&(b=null));let x,v=-1;if(b&&((l=o.docView.nearest(b))===null||l===void 0?void 0:l.isEditable)!=!1){if(k.caretPositionFromPoint){let g=k.caretPositionFromPoint(f,c);g&&({offsetNode:x,offset:v}=g)}else if(k.caretRangeFromPoint){let g=k.caretRangeFromPoint(f,c);g&&({startContainer:x,startOffset:v}=g,(!o.contentDOM.contains(x)||U.safari&&Dc(x,v,f)||U.chrome&&Pc(x,v,f))&&(x=void 0))}}if(!x||!o.docView.dom.contains(x)){let g=ce.find(o.docView,m);if(!g)return u>d.top+d.height/2?d.to:d.from;({node:x,offset:v}=tl(g.dom,f,c))}let V=o.docView.nearest(x);if(!V)return null;if(V.isWidget&&((s=V.dom)===null||s===void 0?void 0:s.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(x,v)+V.posAtStart}function go(o,e,t,i,l){let s=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((l-t.top-(o.defaultLineHeight-r)*.5)/r);s+=d*o.viewState.heightOracle.lineLength}let a=o.state.sliceDoc(t.from,t.to);return t.from+ec(a,s,o.state.tabSize)}function Dc(o,e,t){let i;if(o.nodeType!=3||e!=(i=o.nodeValue.length))return!1;for(let l=o.nextSibling;l;l=l.nextSibling)if(l.nodeType!=1||l.nodeName!="BR")return!1;return bt(o,i-1,i).getBoundingClientRect().left>t}function Pc(o,e,t){if(e!=0)return!1;for(let l=o;;){let s=l.parentNode;if(!s||s.nodeType!=1||s.firstChild!=l)return!1;if(s.classList.contains("cm-line"))break;l=s}let i=o.nodeType==1?o.getBoundingClientRect():bt(o,0,Math.max(o.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Fc(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==ze.Text))return i}return t}function $c(o,e,t,i){let l=Fc(o,e.head),s=!i||l.type!=ze.Text||!(o.lineWrapping||l.widgetLineBreaks)?null:o.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(s){let a=o.dom.getBoundingClientRect(),r=o.textDirectionAt(l.from),d=o.posAtCoords({x:t==(r==me.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(d!=null)return W.cursor(d,t?-1:1)}return W.cursor(t?l.to:l.from,t?-1:1)}function ko(o,e,t,i){let l=o.state.doc.lineAt(e.head),s=o.bidiSpans(l),a=o.textDirectionAt(l.from);for(let r=e,d=null;;){let h=xc(l,s,a,r,t),f=Ks;if(!h){if(l.number==(t?o.state.doc.lines:1))return r;f=`
8
- `,l=o.state.doc.line(l.number+(t?1:-1)),s=o.bidiSpans(l),h=o.visualLineSide(l,!t)}if(d){if(!d(f))return r}else{if(!i)return h;d=i(f)}r=h}}function Rc(o,e,t){let i=o.state.charCategorizer(e),l=i(t);return s=>{let a=i(s);return l==Xe.Space&&(l=a),l==a}}function Lc(o,e,t,i){let l=e.head,s=t?1:-1;if(l==(t?o.state.doc.length:0))return W.cursor(l,e.assoc);let a=e.goalColumn,r,d=o.contentDOM.getBoundingClientRect(),h=o.coordsAtPos(l,e.assoc||-1),f=o.documentTop;if(h)a==null&&(a=h.left-d.left),r=s<0?h.top:h.bottom;else{let m=o.viewState.lineBlockAt(l);a==null&&(a=Math.min(d.right-d.left,o.defaultCharacterWidth*(l-m.from))),r=(s<0?m.top:m.bottom)+f}let c=d.left+a,u=i??o.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let k=r+(u+m)*s,y=mo(o,{x:c,y:k},!1,s);if(k<d.top||k>d.bottom||(s<0?y<l:y>l)){let b=o.docView.coordsForChar(y),x=!b||k<b.top?-1:1;return W.cursor(y,x,void 0,a)}}}function Ri(o,e,t){for(;;){let i=0;for(let l of o)l.between(e-1,e+1,(s,a,r)=>{if(e>s&&e<a){let d=i||t||(e-s<a-e?-1:1);e=d<0?s:a,i=d}});if(!i)return e}}function il(o,e,t){let i=Ri(o.state.facet(Zn).map(l=>l(o)),t.from,e.head>t.from?-1:1);return i==t.from?t:W.cursor(i,i<t.from?1:-1)}const ai="￿";class jc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(ne.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ai}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let s=this.text.length;this.readNode(l);let a=l.nextSibling;if(a==t)break;let r=le.get(l),d=le.get(a);(r&&d?r.breakAfter:(r?r.breakAfter:Ai(l))||Ai(a)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>s)&&this.lineBreak(),l=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,l=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,a=1,r;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(r=l.exec(t))&&(s=r.index,a=r[0].length),this.append(t.slice(i,s<0?t.length:s)),s<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=s+a}}readNode(e){if(e.cmIgnore)return;let t=le.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(zc(e,i.node,i.offset)?t:0))}}function zc(o,e,t){for(;;){if(!e||t<Je(e))return!1;if(e==o)return!0;t=kt(e)+1,e=e.parentNode}}class bo{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class qc{constructor(e,t,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor: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=s||a?[]:Hc(e),d=new jc(r,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Kc(r,this.bounds.from)}else{let r=e.observer.selectionRange,d=s&&s.node==r.focusNode&&s.offset==r.focusOffset||!En(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),h=a&&a.node==r.anchorNode&&a.offset==r.anchorOffset||!En(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),f=e.viewport;if((U.ios||U.chrome)&&e.state.selection.main.empty&&d!=h&&(f.from>0||f.to<e.state.doc.length)){let c=Math.min(d,h),u=Math.max(d,h),m=f.from-c,k=f.to-u;(m==0||m==1||c==0)&&(k==0||k==-1||u==e.state.doc.length)&&(d=0,h=e.state.doc.length)}this.newSel=W.single(h,d)}}}function yo(o,e){let t,{newSel:i}=e,l=o.state.selection.main,s=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:r}=e.bounds,d=l.from,h=null;(s===8||U.android&&e.text.length<r-a)&&(d=l.to,h="end");let f=Wc(o.state.doc.sliceString(a,r,ai),e.text,d-a,h);f&&(U.chrome&&s==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==ai+ai&&f.toB--,t={from:a+f.from,to:a+f.toA,insert:Z.of(e.text.slice(f.from,f.toB).split(ai))})}else i&&(!o.hasFocus&&o.state.facet(dt)||i.main.eq(l))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!l.empty&&i&&i.main.empty?t={from:l.from,to:l.to,insert:o.state.doc.slice(l.from,l.to)}:t&&t.from>=l.from&&t.to<=l.to&&(t.from!=l.from||t.to!=l.to)&&l.to-l.from-(t.to-t.from)<=4?t={from:l.from,to:l.to,insert:o.state.doc.slice(l.from,t.from).append(t.insert).append(o.state.doc.slice(t.to,l.to))}:(U.mac||U.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&o.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=W.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:Z.of([" "])}):U.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
9
- `&&o.lineWrapping&&(i&&(i=W.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:Z.of([" "])}),t)return nl(o,t,i,s);if(i&&!i.main.eq(l)){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 nl(o,e,t,i=-1){if(U.ios&&o.inputState.flushIOSKey(e))return!0;let l=o.state.selection.main;if(U.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&o.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Mt(o.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&Mt(o.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&Mt(o.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let a,r=()=>a||(a=Uc(o,e,t));return o.state.facet(Js).some(d=>d(o,e.from,e.to,s,r))||o.dispatch(r()),!0}function Uc(o,e,t){let i,l=o.state,s=l.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&o.inputState.composing<0){let r=s.from<e.from?l.sliceDoc(s.from,e.from):"",d=s.to>e.to?l.sliceDoc(e.to,s.to):"";i=l.replaceSelection(o.state.toText(r+e.insert.sliceString(0,void 0,o.state.lineBreak)+d))}else{let r=l.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&o.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let h=o.state.sliceDoc(e.from,e.to),f,c=t&&ho(o,t.main.head);if(c){let k=e.insert.length-(e.to-e.from);f={from:c.from,to:c.to-k}}else f=o.state.doc.lineAt(s.head);let u=s.to-e.to,m=s.to-s.from;i=l.changeByRange(k=>{if(k.from==s.from&&k.to==s.to)return{changes:r,range:d||k.map(r)};let y=k.to-u,b=y-h.length;if(k.to-k.from!=m||o.state.sliceDoc(b,y)!=h||k.to>=f.from&&k.from<=f.to)return{range:k};let x=l.changes({from:b,to:y,insert:e.insert}),v=k.to-s.to;return{changes:x,range:d?W.range(Math.max(0,d.anchor+v),Math.max(0,d.head+v)):k.map(x)}})}else i={changes:r,selection:d&&l.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)),l.update(i,{userEvent:a,scrollIntoView:!0})}function Wc(o,e,t,i){let l=Math.min(o.length,e.length),s=0;for(;s<l&&o.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==l&&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,s-Math.min(a,r));t-=a+d-s}if(a<s&&o.length<e.length){let d=t<=s&&t>=a?s-t:0;s-=d,r=s+(r-a),a=s}else if(r<s){let d=t<=s&&t>=r?s-t:0;s-=d,a=s+(a-r),r=s}return{from:s,toA:a,toB:r}}function Hc(o){let e=[];if(o.root.activeElement!=o.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}=o.observer.selectionRange;return t&&(e.push(new bo(t,i)),(l!=t||s!=i)&&e.push(new bo(l,s))),e}function Kc(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?W.single(t+e,i+e):null}class Qc{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,U.safari&&e.contentDOM.addEventListener("input",()=>null),U.gecko&&hh(e.contentDOM.ownerDocument)}handleEvent(e){!nh(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Gc(e),i=this.handlers,l=this.view.contentDOM;for(let s in t)if(s!="scroll"){let a=!t[s].handlers.length,r=i[s];r&&a!=!r.handlers.length&&(l.removeEventListener(s,this.handleEvent),r=null),r||l.addEventListener(s,this.handleEvent,{passive:a})}for(let s in i)s!="scroll"&&!t[s]&&l.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Xc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),U.android&&U.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return U.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=xo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Yc.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Mt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:U.safari&&!U.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wo(o,e){return(t,i)=>{try{return e.call(o,i,t)}catch(l){Ue(t.state,l)}}}function Gc(o){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of o){let l=i.spec;if(l&&l.domEventHandlers)for(let s in l.domEventHandlers){let a=l.domEventHandlers[s];a&&t(s).handlers.push(wo(i.value,a))}if(l&&l.domEventObservers)for(let s in l.domEventObservers){let a=l.domEventObservers[s];a&&t(s).observers.push(wo(i.value,a))}}for(let i in De)t(i).handlers.push(De[i]);for(let i in Ae)t(i).observers.push(Ae[i]);return e}const xo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Yc="dthko",Xc=[16,17,18,20,91,92,224,225],Li=6;function ji(o){return Math.max(0,o)*.7+8}function Jc(o,e){return Math.max(Math.abs(o.clientX-e.clientX),Math.abs(o.clientY-e.clientY))}class Zc{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=sc(e.contentDOM),this.atoms=e.state.facet(Zn).map(a=>a(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(ne.allowMultipleSelections)&&eh(e,t),this.dragging=ih(e,t)&&Mo(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Jc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,s=0,a=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=ro(this.view);e.clientX-d.left<=l+Li?t=-ji(l-e.clientX):e.clientX+d.right>=a-Li&&(t=ji(e.clientX-a)),e.clientY-d.top<=s+Li?i=-ji(s-e.clientY):e.clientY+d.bottom>=r-Li&&(i=ji(e.clientY-r)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],s=null;if(l.empty){let a=Ri(this.atoms,l.from,0);a!=l.from&&(s=W.cursor(a,-1))}else{let a=Ri(this.atoms,l.from,-1),r=Ri(this.atoms,l.to,1);(a!=l.from||r!=l.to)&&(s=W.range(l.from==l.anchor?a:r,l.from==l.head?a:r))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?W.create(t,e.mainIndex):e}select(e){let{view:t}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function eh(o,e){let t=o.state.facet(Qs);return t.length?t[0](e):U.mac?e.metaKey:e.ctrlKey}function th(o,e){let t=o.state.facet(Gs);return t.length?t[0](e):U.mac?!e.altKey:!e.ctrlKey}function ih(o,e){let{main:t}=o.state.selection;if(t.empty)return!1;let i=Jt(o.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let s=0;s<l.length;s++){let a=l[s];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function nh(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=le.get(t))&&i.ignoreEvent(e))return!1;return!0}const De=Object.create(null),Ae=Object.create(null),vo=U.ie&&U.ie_version<15||U.ios&&U.webkit_version<604;function lh(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(),Co(o,t.value)},50)}function zi(o,e,t){for(let i of o.facet(e))t=i(t,o);return t}function Co(o,e){e=zi(o.state,Gn,e);let{state:t}=o,i,l=1,s=t.toText(e),a=s.lines==t.selection.ranges.length;if(ll!=null&&t.selection.ranges.every(d=>d.empty)&&ll==s.toString()){let d=-1;i=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==d)return{range:h};d=f.from;let c=t.toText((a?s.line(l++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:c},range:W.cursor(h.from+c.length)}})}else a?i=t.changeByRange(d=>{let h=s.line(l++);return{changes:{from:d.from,to:d.to,insert:h.text},range:W.cursor(d.from+h.length)}}):i=t.replaceSelection(s);o.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Ae.scroll=o=>{o.inputState.lastScrollTop=o.scrollDOM.scrollTop,o.inputState.lastScrollLeft=o.scrollDOM.scrollLeft},De.keydown=(o,e)=>(o.inputState.setSelectionOrigin("select"),e.keyCode==27&&o.inputState.tabFocusMode!=0&&(o.inputState.tabFocusMode=Date.now()+2e3),!1),Ae.touchstart=(o,e)=>{o.inputState.lastTouchTime=Date.now(),o.inputState.setSelectionOrigin("select.pointer")},Ae.touchmove=o=>{o.inputState.setSelectionOrigin("select.pointer")},De.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(Ys))if(t=i(o,e),t)break;if(!t&&e.button==0&&(t=ah(o,e)),t){let i=!o.hasFocus;o.inputState.startMouseSelection(new Zc(o,e,t,i)),i&&o.observer.ignore(()=>{Cs(o.contentDOM);let s=o.root.activeElement;s&&!s.contains(o.contentDOM)&&s.blur()});let l=o.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function So(o,e,t,i){if(i==1)return W.cursor(e,t);if(i==2)return Ac(o.state,e,t);{let l=ce.find(o.docView,e),s=o.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:s.from,r=l?l.posAtEnd:s.to;return r<o.state.doc.length&&r==s.to&&r++,W.range(a,r)}}let No=(o,e,t)=>e>=t.top&&e<=t.bottom&&o>=t.left&&o<=t.right;function sh(o,e,t,i){let l=ce.find(o.docView,e);if(!l)return 1;let s=e-l.posAtStart;if(s==0)return 1;if(s==l.length)return-1;let a=l.coordsAt(s,-1);if(a&&No(t,i,a))return-1;let r=l.coordsAt(s,1);return r&&No(t,i,r)?1:a&&a.bottom>=i?-1:1}function Bo(o,e){let t=o.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:sh(o,t,e.clientX,e.clientY)}}const oh=U.ie&&U.ie_version<=11;let Oo=null,Vo=0,_o=0;function Mo(o){if(!oh)return o.detail;let e=Oo,t=_o;return Oo=o,_o=Date.now(),Vo=!e||t>Date.now()-400&&Math.abs(e.clientX-o.clientX)<2&&Math.abs(e.clientY-o.clientY)<2?(Vo+1)%3:1}function ah(o,e){let t=Bo(o,e),i=Mo(e),l=o.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),l=l.map(s.changes))},get(s,a,r){let d=Bo(o,s),h,f=So(o,d.pos,d.bias,i);if(t.pos!=d.pos&&!a){let c=So(o,t.pos,t.bias,i),u=Math.min(c.from,f.from),m=Math.max(c.to,f.to);f=u<f.from?W.range(u,m):W.range(m,u)}return a?l.replaceRange(l.main.extend(f.from,f.to)):r&&i==1&&l.ranges.length>1&&(h=rh(l,d.pos))?h:r?l.addRange(f):W.create([f])}}}function rh(o,e){for(let t=0;t<o.ranges.length;t++){let{from:i,to:l}=o.ranges[t];if(i<=e&&l>=e)return W.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}De.dragstart=(o,e)=>{let{selection:{main:t}}=o.state;if(e.target.draggable){let l=o.docView.nearest(e.target);if(l&&l.isWidget){let s=l.posAtStart,a=s+l.length;(s>=t.to||a<=t.from)&&(t=W.range(s,a))}}let{inputState:i}=o;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",zi(o.state,Yn,o.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},De.dragend=o=>(o.inputState.draggedContent=null,!1);function To(o,e,t,i){if(t=zi(o.state,Gn,t),!t)return;let l=o.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=o.inputState,a=i&&s&&th(o,e)?{from:s.from,to:s.to}:null,r={from:l,insert:t},d=o.state.changes(a?[a,r]:r);o.focus(),o.dispatch({changes:d,selection:{anchor:d.mapPos(l,-1),head:d.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),o.inputState.draggedContent=null}De.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),l=0,s=()=>{++l==t.length&&To(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=s,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[a]=r.result),s()},r.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return To(o,e,i,!0),!0}return!1},De.paste=(o,e)=>{if(o.state.readOnly)return!0;o.observer.flush();let t=vo?null:e.clipboardData;return t?(Co(o,t.getData("text/plain")||t.getData("text/uri-list")),!0):(lh(o),!1)};function dh(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 ch(o){let e=[],t=[],i=!1;for(let l of o.selection.ranges)l.empty||(e.push(o.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:s}of o.selection.ranges){let a=o.doc.lineAt(s);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(o.doc.length,a.to+1)})),l=a.number}i=!0}return{text:zi(o,Yn,e.join(o.lineBreak)),ranges:t,linewise:i}}let ll=null;De.copy=De.cut=(o,e)=>{let{text:t,ranges:i,linewise:l}=ch(o.state);if(!t&&!l)return!1;ll=l?t:null,e.type=="cut"&&!o.state.readOnly&&o.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=vo?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(dh(o,t),!1)};const Ao=Nt.define();function Eo(o,e){let t=[];for(let i of o.facet(Zs)){let l=i(o,e);l&&t.push(l)}return t?o.update({effects:t,annotations:Ao.of(!0)}):null}function Io(o){setTimeout(()=>{let e=o.hasFocus;if(e!=o.inputState.notifiedFocused){let t=Eo(o.state,e);t?o.dispatch(t):o.update([])}},10)}Ae.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),Io(o)},Ae.blur=o=>{o.observer.clearSelectionRange(),Io(o)},Ae.compositionstart=Ae.compositionupdate=o=>{o.observer.editContext||(o.inputState.compositionFirstChange==null&&(o.inputState.compositionFirstChange=!0),o.inputState.composing<0&&(o.inputState.composing=0))},Ae.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,U.chrome&&U.android?o.observer.flushSoon():o.inputState.compositionPendingChange?Promise.resolve().then(()=>o.observer.flush()):setTimeout(()=>{o.inputState.composing<0&&o.docView.hasComposition&&o.update([])},50))},Ae.contextmenu=o=>{o.inputState.lastContextMenu=Date.now()},De.beforeinput=(o,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&o.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(s&&a.length){let r=a[0],d=o.posAtDOM(r.startContainer,r.startOffset),h=o.posAtDOM(r.endContainer,r.endOffset);return nl(o,{from:d,to:h,insert:o.state.toText(s)},null),!0}}let l;if(U.chrome&&U.android&&(l=xo.find(s=>s.inputType==e.inputType))&&(o.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>s+10&&o.hasFocus&&(o.contentDOM.blur(),o.focus())},100)}return U.ios&&e.inputType=="deleteContentForward"&&o.observer.flushSoon(),U.safari&&e.inputType=="insertText"&&o.inputState.composing>=0&&setTimeout(()=>Ae.compositionend(o,e),20),!1};const Do=new Set;function hh(o){Do.has(o)||(Do.add(o),o.addEventListener("copy",()=>{}),o.addEventListener("cut",()=>{}))}const Po=["pre-wrap","normal","pre-line","break-spaces"];let Dt=!1;function Fo(){Dt=!1}class fh{constructor(e){this.lineWrapping=e,this.doc=Z.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Po.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,s,a){let r=Po.indexOf(e)>-1,d=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=s,d){this.heightSamples={};for(let h=0;h<a.length;h++){let f=a[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return d}}class uh{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class We{constructor(e,t,i,l,s){this.from=e,this.length=t,this.top=i,this.height=l,this._content=s}get type(){return typeof this._content=="number"?ze.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 at?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 We(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ae=function(o){return o[o.ByPos=0]="ByPos",o[o.ByHeight=1]="ByHeight",o[o.ByPosNoHeight=2]="ByPosNoHeight",o}(ae||(ae={}));const qi=.001;class ve{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>qi&&(Dt=!0),this.height=e)}replace(e,t,i){return ve.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let s=this,a=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:d,toA:h,fromB:f,toB:c}=l[r],u=s.lineAt(d,ae.ByPosNoHeight,i.setDoc(t),0,0),m=u.to>=h?u:s.lineAt(h,ae.ByPosNoHeight,i,0,0);for(c+=m.to-h,h=m.to;r>0&&u.from<=l[r-1].toA;)d=l[r-1].fromA,f=l[r-1].fromB,r--,d<u.from&&(u=s.lineAt(d,ae.ByPosNoHeight,i,0,0));f+=u.from-d,d=u.from;let k=sl.build(i.setDoc(a),e,f,c);s=Ui(s,s.replace(d,h,k))}return s.updateHeight(i,0)}static empty(){return new Oe(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,s=0;for(;;)if(t==i)if(l>s*2){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),i+=1+r.break,l-=r.size}else if(s>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,s-=r.size}else break;else if(l<s){let r=e[t++];r&&(l+=r.size)}else{let r=e[--i];r&&(s+=r.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new ph(ve.of(e.slice(0,t)),a,ve.of(e.slice(i)))}}function Ui(o,e){return o==e?o:(o.constructor!=e.constructor&&(Dt=!0),e)}ve.prototype.size=1;class $o extends ve{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,l){return new We(l,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,l,s){return this.blockAt(0,i,l,s)}forEachLine(e,t,i,l,s,a){e<=s+this.length&&t>=s&&a(this.blockAt(0,i,l,s))}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oe extends $o{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,l){return new We(l,this.length,i,this.height,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Oe||l instanceof ge&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof ge?l=new Oe(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):ve.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ge extends ve{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,s=l-i+1,a,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*s);a=d/s,this.length>s+1&&(r=(this.height-d)/(this.length-s-1))}else a=this.height/s;return{firstLine:i,lastLine:l,perLine:a,perChar:r}}blockAt(e,t,i,l){let{firstLine:s,lastLine:a,perLine:r,perChar:d}=this.heightMetrics(t,l);if(t.lineWrapping){let h=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),f=t.doc.lineAt(h),c=r+f.length*d,u=Math.max(i,e-c/2);return new We(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(a-s,Math.floor((e-i)/r))),{from:f,length:c}=t.doc.line(s+h);return new We(f,c,i+r*h,r,0)}}lineAt(e,t,i,l,s){if(t==ae.ByHeight)return this.blockAt(e,i,l,s);if(t==ae.ByPosNoHeight){let{from:m,to:k}=i.doc.lineAt(e);return new We(m,k-m,0,0,0)}let{firstLine:a,perLine:r,perChar:d}=this.heightMetrics(i,s),h=i.doc.lineAt(e),f=r+h.length*d,c=h.number-a,u=l+r*c+d*(h.from-s-c);return new We(h.from,h.length,Math.max(l,Math.min(u,l+this.height-f)),f,0)}forEachLine(e,t,i,l,s,a){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:r,perLine:d,perChar:h}=this.heightMetrics(i,s);for(let f=e,c=l;f<=t;){let u=i.doc.lineAt(f);if(f==e){let k=u.number-r;c+=d*k+h*(e-s-k)}let m=d+h*u.length;a(new We(u.from,u.length,c,m,0)),c+=m,f=u.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let s=i[i.length-1];s instanceof ge?i[i.length-1]=new ge(s.length+l):i.push(null,new ge(l-1))}if(e>0){let s=i[0];s instanceof ge?i[0]=new ge(e+s.length):i.unshift(new ge(e-1),null)}return ve.of(i)}decomposeLeft(e,t){t.push(new ge(e-1),null)}decomposeRight(e,t){t.push(null,new ge(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let s=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],r=Math.max(t,l.from),d=-1;for(l.from>t&&a.push(new ge(l.from-t-1).updateHeight(e,t));r<=s&&l.more;){let f=e.doc.lineAt(r).length;a.length&&a.push(null);let c=l.heights[l.index++];d==-1?d=c:Math.abs(c-d)>=qi&&(d=-2);let u=new Oe(f,c);u.outdated=!1,a.push(u),r+=f+1}r<=s&&a.push(null,new ge(s-r).updateHeight(e,r));let h=ve.of(a);return(d<0||Math.abs(h.height-this.height)>=qi||Math.abs(d-this.heightMetrics(e,t).perLine)>=qi)&&(Dt=!0),Ui(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ph extends ve{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,s,l+this.left.length+this.break)}lineAt(e,t,i,l,s){let a=l+this.left.height,r=s+this.left.length+this.break,d=t==ae.ByHeight?e<a:e<r,h=d?this.left.lineAt(e,t,i,l,s):this.right.lineAt(e,t,i,a,r);if(this.break||(d?h.to<r:h.from>r))return h;let f=t==ae.ByPosNoHeight?ae.ByPosNoHeight:ae.ByPos;return d?h.join(this.right.lineAt(r,f,i,a,r)):this.left.lineAt(r,f,i,l,s).join(h)}forEachLine(e,t,i,l,s,a){let r=l+this.left.height,d=s+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,l,s,a),t>=d&&this.right.forEachLine(e,t,i,r,d,a);else{let h=this.lineAt(d,ae.ByPos,i,l,s);e<h.from&&this.left.forEachLine(e,h.from-1,i,l,s,a),h.to>=e&&h.from<=t&&a(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,r,d,a)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let s=[];e>0&&this.decomposeLeft(e,s);let a=s.length;for(let r of i)s.push(r);if(e>0&&Ro(s,a-1),t<this.length){let r=s.length;this.decomposeRight(t,s),Ro(s,r)}return ve.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ve.of(this.break?[e,null,t]:[e,t]):(this.left=Ui(this.left,e),this.right=Ui(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,l){let{left:s,right:a}=this,r=t+s.length+this.break,d=null;return l&&l.from<=t+s.length&&l.more?d=s=s.updateHeight(e,t,i,l):s.updateHeight(e,t,i),l&&l.from<=r+a.length&&l.more?d=a=a.updateHeight(e,r,i,l):a.updateHeight(e,r,i),d?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ro(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 mh=5;class sl{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Oe?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Oe(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new $o(a,l,i)):(a||s||l>=mh)&&this.addLineDeco(l,s,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 l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Oe)&&!this.isCovered?this.nodes.push(new Oe(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Oe&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let s=new sl(i,e);return oe.spans(t,i,l,s,0),s.finish(i)}}function gh(o,e,t){let i=new kh;return oe.compare(o,e,t,i,0),i.changes}class kh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&zn(e,t,this.changes,5)}}function bh(o,e){let t=o.getBoundingClientRect(),i=o.ownerDocument,l=i.defaultView||window,s=Math.max(0,t.left),a=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(l.innerHeight,t.bottom);for(let h=o.parentNode;h&&h!=i.body;)if(h.nodeType==1){let f=h,c=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!="visible"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),a=Math.min(a,u.right),r=Math.max(r,u.top),d=Math.min(h==o.parentNode?l.innerHeight:d,u.bottom)}h=c.position=="absolute"||c.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,a)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function yh(o,e){let t=o.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ol{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],s=t[i];if(l.from!=s.from||l.to!=s.to||l.size!=s.size)return!1}return!0}draw(e,t){return we.replace({widget:new wh(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class wh extends jn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Lo{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=jo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Jn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new fh(t),this.stateDeco=e.facet(si).filter(i=>typeof i!="function"),this.heightMap=ve.empty().applyChanges(this.stateDeco,Z.empty,this.heightOracle.setDoc(e.doc),[new Te(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:s,to:a})=>l>=s&&l<=a)){let{from:s,to:a}=this.lineBlockAt(l);e.push(new Wi(s,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?jo:new al(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ri(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(si).filter(f=>typeof f!="function");let l=e.changedRanges,s=Te.extendWithRanges(l,gh(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),a=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Fo(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||Dt)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let d=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<d.from||t.range.head>d.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,t));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Cc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let a=this.heightOracle.mustRefreshForWrapping(s),r=t.getBoundingClientRect(),d=a||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,f=0;if(r.width&&r.height){let{scaleX:g,scaleY:p}=vs(t,r);(g>.005&&Math.abs(this.scaleX-g)>.005||p>.005&&Math.abs(this.scaleY-p)>.005)&&(this.scaleX=g,this.scaleY=p,h|=8,a=d=!0)}let c=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Bs(e.scrollDOM);let k=(this.printing?yh:bh)(t,this.paddingTop),y=k.top-this.pixelViewport.top,b=k.bottom-this.pixelViewport.bottom;this.pixelViewport=k;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(d=!0)),!this.inView&&!this.scrollTarget)return 0;let v=r.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),d){let g=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(g)&&(a=!0),a||l.lineWrapping&&Math.abs(v-this.contentDOMWidth)>l.charWidth){let{lineHeight:p,charWidth:B,textHeight:O}=e.docView.measureTextSize();a=p>0&&l.refresh(s,p,B,O,v/B,g),a&&(e.docView.minWidth=0,h|=8)}y>0&&b>0?f=Math.max(y,b):y<0&&b<0&&(f=Math.min(y,b)),Fo();for(let p of this.viewports){let B=p.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(p);this.heightMap=(a?ve.empty().applyChanges(this.stateDeco,Z.empty,this.heightOracle,[new Te(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new uh(p.from,B))}Dt&&(h|=2)}let V=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return V&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||V)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:r}=this,d=new Wi(l.lineAt(a-i*1e3,ae.ByHeight,s,0,0).from,l.lineAt(r+(1-i)*1e3,ae.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(h<d.from||h>d.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=l.lineAt(h,ae.ByPos,s,0,0),u;t.y=="center"?u=(c.top+c.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h<d.from?u=c.top:u=c.bottom-f,d=new Wi(l.lineAt(u-1e3/2,ae.ByHeight,s,0,0).from,l.lineAt(u+f+1e3/2,ae.ByHeight,s,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Wi(this.heightMap.lineAt(i,ae.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,ae.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,ae.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,ae.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:r}=this;return(e==0||l<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=r+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&s<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new ol(t.mapPos(l.from),t.mapPos(l.to),l.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,s=l>>1,a=l<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(f,c,u,m)=>{if(c-f<s)return;let k=this.state.selection.main,y=[k.from];k.empty||y.push(k.to);for(let x of y)if(x>f&&x<c){d(f,x-10,u,m),d(x+10,c,u,m);return}let b=vh(e,x=>x.from>=u.from&&x.to<=u.to&&Math.abs(x.from-f)<s&&Math.abs(x.to-c)<s&&!y.some(v=>x.from<v&&x.to>v));if(!b){if(c<u.to&&t&&i&&t.visibleRanges.some(x=>x.from<=c&&x.to>=c)){let x=t.moveToLineBoundary(W.cursor(c),!1,!0).head;x>f&&(c=x)}b=new ol(f,c,this.gapSize(u,f,c,m))}r.push(b)},h=f=>{if(f.length<a||f.type!=ze.Text)return;let c=xh(f.from,f.to,this.stateDeco);if(c.total<a)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,m,k;if(i){let y=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,x;if(u!=null){let v=Ki(c,u),V=((this.visibleBottom-this.visibleTop)/2+y)/f.height;b=v-V,x=v+V}else b=(this.visibleTop-f.top-y)/f.height,x=(this.visibleBottom-f.top+y)/f.height;m=Hi(c,b),k=Hi(c,x)}else{let y=c.total*this.heightOracle.charWidth,b=l*this.heightOracle.charWidth,x,v;if(u!=null){let V=Ki(c,u),g=((this.pixelViewport.right-this.pixelViewport.left)/2+b)/y;x=V-g,v=V+g}else x=(this.pixelViewport.left-b)/y,v=(this.pixelViewport.right+b)/y;m=Hi(c,x),k=Hi(c,v)}m>f.from&&d(f.from,m,f,c),k<f.to&&d(k,f.to,f,c)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return r}gapSize(e,t,i,l){let s=Ki(l,i)-Ki(l,t);return this.heightOracle.lineWrapping?e.height*s:l.total*this.heightOracle.charWidth*s}updateLineGaps(e){ol.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];oe.spans(e,this.viewport.from,this.viewport.to,{span(l,s){t.push({from:l,to:s})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((l,s)=>l.from!=t[s].from||l.to!=t[s].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ri(this.heightMap.lineAt(e,ae.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||ri(this.heightMap.lineAt(this.scaler.fromDOM(e),ae.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return ri(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Wi{constructor(e,t){this.from=e,this.to=t}}function xh(o,e,t){let i=[],l=o,s=0;return oe.spans(t,o,e,{span(){},point(a,r){a>l&&(i.push({from:l,to:a}),s+=a-l),l=r}},20),l<e&&(i.push({from:l,to:e}),s+=e-l),{total:s,ranges:i}}function Hi({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 l=0;;l++){let{from:s,to:a}=e[l],r=a-s;if(i<=r)return s+i;i-=r}}function Ki(o,e){let t=0;for(let{from:i,to:l}of o.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/o.total}function vh(o,e){for(let t of o)if(e(t))return t}const jo={toDOM(o){return o},fromDOM(o){return o},scale:1,eq(o){return o==this}};class al{constructor(e,t,i){let l=0,s=0,a=0;this.viewports=i.map(({from:r,to:d})=>{let h=t.lineAt(r,ae.ByPos,e,0,0).top,f=t.lineAt(d,ae.ByPos,e,0,0).bottom;return l+=f-h,{from:r,to:d,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=a+(r.top-s)*this.scale,a=r.domBottom=r.domTop+(r.bottom-r.top),s=r.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return l+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,l=s.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-l)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,l=s.domBottom}}eq(e){return e instanceof al?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function ri(o,e){if(e.scale==1)return o;let t=e.toDOM(o.top),i=e.toDOM(o.bottom);return new We(o.from,o.length,t,i-t,Array.isArray(o._content)?o._content.map(l=>ri(l,e)):o._content)}const Qi=G.define({combine:o=>o.join(" ")}),rl=G.define({combine:o=>o.indexOf(!0)>-1}),dl=ot.newName(),zo=ot.newName(),qo=ot.newName(),Uo={"&light":"."+zo,"&dark":"."+qo};function cl(o,e,t){return new ot(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return o;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):o+" "+i}})}const Ch=cl("."+dl,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Uo),Sh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hl=U.ie&&U.ie_version<=11;class Nh{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new oc,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(U.ie&&U.ie_version<=11||U.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&&!(U.chrome&&U.chrome_version<126)&&(this.editContext=new Oh(e),e.state.facet(dt)&&(e.contentDOM.editContext=this.editContext.editContext)),hl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(dt)?i.root.activeElement!=this.dom:!Ti(i.dom,l))return;let s=l.anchorNode&&i.docView.nearest(l.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(U.ie&&U.ie_version<=11||U.android&&U.chrome)&&!i.state.selection.main.empty&&l.focusNode&&ei(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Jt(e.root);if(!t)return!1;let i=U.safari&&e.root.nodeType==11&&ic(this.dom.ownerDocument)==this.dom&&Bh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Ti(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&rc(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Sh),hl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),hl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Mt(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,l=!1;for(let s of e){let a=this.readMutation(s);a&&(a.typeOver&&(l=!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:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Ti(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new qc(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,l=yo(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Wo(t,e.previousSibling||e.target.previousSibling,-1),l=Wo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(dt)!=e.state.facet(dt)&&(e.view.contentDOM.editContext=e.state.facet(dt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Wo(o,e,t){for(;e;){let i=le.get(e);if(i&&i.parent==o)return i;let l=e.parentNode;e=l!=o.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function Ho(o,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,s=e.endOffset,a=o.docView.domAtPos(o.state.selection.main.anchor);return ei(a.node,a.offset,l,s)&&([t,i,l,s]=[l,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}}function Bh(o,e){if(e.getComposedRanges){let l=e.getComposedRanges(o.root)[0];if(l)return Ho(o,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return o.contentDOM.addEventListener("beforeinput",i,!0),o.dom.ownerDocument.execCommand("indent"),o.contentDOM.removeEventListener("beforeinput",i,!0),t?Ho(o,t):null}class Oh{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let{anchor:l}=e.state.selection.main,s={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:Z.of(i.text.split(`
10
- `))};s.from==this.from&&l<this.from?s.from=l:s.to==this.to&&l>this.to&&(s.to=l),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||nl(e,s,W.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let l=[],s=null;for(let a=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);a<r;a++){let d=e.coordsForChar(a);s=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||s||new DOMRect,l.push(s)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let s of i.getTextFormats()){let a=s.underlineStyle,r=s.underlineThickness;if(a!="None"&&r!="None"){let d=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(we.mark({attributes:{style:d}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:io.of(we.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=Jt(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((s,a,r,d,h)=>{if(i)return;let f=h.length-(a-s);if(l&&a>=l.to)if(l.from==s&&l.to==a&&l.insert.eq(h)){l=this.pendingContextChange=null,t+=f,this.to+=f;return}else l=null,this.revertPending(e.state);if(s+=t,a+=t,a<=this.from)this.from+=f,this.to+=f;else if(s<this.to){if(s<this.from||a>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),h.toString()),this.to+=f}t+=f}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ie{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(s=>i(s,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ac(e.parent)||document,this.viewState=new Lo(e.state||ne.create(e)),e.scrollTo&&e.scrollTo.is(Fi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(li).map(l=>new Xn(l));for(let l of this.plugins)l.update(this);this.observer=new Nh(this),this.inputState=new Qc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new co(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof be?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,s=this.state;for(let u of e){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,r=0,d=null;e.some(u=>u.annotation(Ao))?(this.inputState.notifiedFocused=a,r=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,d=Eo(s,a),d||(r=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(ne.phrases)!=this.state.facet(ne.phrases))return this.setState(s);l=$i.create(this,s,e),l.flags|=r;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:m}=u.state.selection;c=new Et(m.empty?m:W.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of u.effects)m.is(Fi)&&(c=m.value.clip(this.state))}this.viewState.update(l,c),this.bidiCache=Gi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(oi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Qi)!=l.state.facet(Qi)&&(this.viewState.mustMeasureContent=!0),(t||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(Qn))try{u(l)}catch(m){Ue(this.state,m,"update listener")}(d||f)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),f&&!yo(this,f)&&h.force&&Mt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Lo(e),this.plugins=e.facet(li).map(i=>new Xn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new co(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(li),i=e.state.facet(li);if(t!=i){let l=[];for(let s of i){let a=t.indexOf(s);if(a<0)l.push(new Xn(s));else{let r=this.plugins[a];r.mustUpdate=e,l.push(r)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){Ue(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,l=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(a<0)if(Bs(i))s=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);s=m.from,a=m.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(m=>{try{return m.read(this)}catch(k){return Ue(this.state,k),Ko}}),c=$i.create(this,this.state,[]),u=!1;c.flags|=d,t?t.flags|=d:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c),u&&this.docViewUpdate());for(let m=0;m<h.length;m++)if(f[m]!=Ko)try{let k=h[m];k.write&&k.write(f[m],this)}catch(k){Ue(this.state,k)}if(u&&this.docView.updateSelection(!0),!c.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 k=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a;if(k>1||k<-1){l=l+k,i.scrollTop=l/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Qn))r(t)}get themeClasses(){return dl+" "+(this.state.facet(rl)?qo:zo)+" "+this.state.facet(Qi)}updateAttrs(){let e=Qo(this,no,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(dt)?"true":"false",class:"cm-content",style:`${U.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Qo(this,Jn,t);let i=this.observer.ignore(()=>{let l=Ln(this.contentDOM,this.contentAttrs,t),s=Ln(this.dom,this.editorAttrs,e);return l||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(ie.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(oi);let e=this.state.facet(ie.cspNonce);ot.mount(this.root,this.styleModules.concat(Ch).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return il(this,e,ko(this,e,t,i))}moveByGroup(e,t){return il(this,e,ko(this,e,t,i=>Rc(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return W.cursor(s.side(t,l)+e.from,s.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return $c(this,e,t,i)}moveVertically(e,t,i){return il(this,e,Lc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),mo(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),s=this.bidiSpans(l),a=s[rt.find(s,e-l.from,-1,t)];return Ei(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(eo)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Vh)return Hs(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Ws(s.isolates,i=oo(this,e))))return s.order;i||(i=oo(this,e));let l=wc(e.text,t,i);return this.bidiCache.push(new Gi(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||U.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Cs(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Fi.of(new Et(typeof e=="number"?W.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Fi.of(new Et(W.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 It.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return It.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=ot.newName(),l=[Qi.of(i),oi.of(cl(`.${i}`,e))];return t&&t.dark&&l.push(rl.of(!0)),l}static baseTheme(e){return zd.lowest(oi.of(cl("."+dl,e,Uo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&le.get(i)||le.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}ie.styleModule=oi,ie.inputHandler=Js,ie.clipboardInputFilter=Gn,ie.clipboardOutputFilter=Yn,ie.scrollHandler=to,ie.focusChangeEffect=Zs,ie.perLineTextDirection=eo,ie.exceptionSink=Xs,ie.updateListener=Qn,ie.editable=dt,ie.mouseSelectionStyle=Ys,ie.dragMovesSelection=Gs,ie.clickAddsSelectionRange=Qs,ie.decorations=si,ie.outerDecorations=lo,ie.atomicRanges=Zn,ie.bidiIsolatedRanges=so,ie.scrollMargins=ao,ie.darkTheme=rl,ie.cspNonce=G.define({combine:o=>o.length?o[0]:""}),ie.contentAttributes=Jn,ie.editorAttributes=no,ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"}),ie.announce=he.define();const Vh=4096,Ko={};class Gi{constructor(e,t,i,l,s,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=s,this.order=a}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:me.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let a=e[s];a.dir==l&&!t.touchesRange(a.from,a.to)&&i.push(new Gi(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function Qo(o,e,t){for(let i=o.state.facet(e),l=i.length-1;l>=0;l--){let s=i[l],a=typeof s=="function"?s(o):s;a&&Rn(a,t)}return t}const _h=!U.ios,Go={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};_h&&(Go[".cm-line"].caretColor=Go[".cm-content"].caretColor="transparent !important");class Pt extends Ot{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Pt.prototype.elementClass="",Pt.prototype.toDOM=void 0,Pt.prototype.mapMode=Be.TrackBefore,Pt.prototype.startSide=Pt.prototype.endSide=-1,Pt.prototype.point=!0;var fl;const Ft=new J;function Mh(o){return G.define({combine:o?e=>e.concat(o):void 0})}const Th=new J;class Pe{constructor(e,t,i=[],l=""){this.data=e,this.name=l,ne.prototype.hasOwnProperty("tree")||Object.defineProperty(ne.prototype,"tree",{get(){return ul(this)}}),this.parser=t,this.extension=[Rt.of(this),ne.languageData.of((s,a,r)=>{let d=Yo(s,a,r),h=d.type.prop(Ft);if(!h)return[];let f=s.facet(h),c=d.type.prop(Th);if(c){let u=d.resolve(a-d.from,r);for(let m of c)if(m.test(u,s)){let k=s.facet(m.facet);return m.type=="replace"?k:k.concat(f)}}return f})].concat(i)}isActiveAt(e,t,i=-1){return Yo(e,t,i).type.prop(Ft)==this.data}findRegions(e){let t=e.facet(Rt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(s,a)=>{if(s.prop(Ft)==this.data){i.push({from:a,to:a+s.length});return}let r=s.prop(J.mounted);if(r){if(r.tree.prop(Ft)==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+s.length});return}else if(r.overlay){let d=i.length;if(l(r.tree,r.overlay[0].from+a),i.length>d)return}}for(let d=0;d<s.children.length;d++){let h=s.children[d];h instanceof de&&l(h,s.positions[d]+a)}};return l(ul(e),0),i}get allowsNesting(){return!0}}Pe.setState=he.define();function Yo(o,e,t){let i=o.facet(Rt),l=ul(o).topNode;if(!i||i.allowsNesting)for(let s=l;s;s=s.enter(e,t,fe.ExcludeBuffers))s.type.isTop&&(l=s);return l}class Yi extends Pe{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Mh(e.languageData);return new Yi(t,e.parser.configure({props:[Ft.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Yi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ul(o){let e=o.field(Pe.state,!1);return e?e.tree:de.empty}class Ah{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let di=null;class Xi{constructor(e,t,i=[],l,s,a,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=s,this.viewport=a,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Xi(e,t,[],de.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Ah(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=de.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(ft.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ft.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=di;di=this;try{return e()}finally{di=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Xo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:s,viewport:a,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,f,c,u)=>d.push({fromA:h,toA:f,fromB:c,toB:u})),i=ft.applyChanges(i,d),l=de.empty,s=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){r=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),c=e.mapPos(h.to,-1);f<c&&r.push({from:f,to:c})}}}return new Xi(this.parser,t,i,l,s,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:l,to:s}=this.skipped[i];l<e.to&&s>e.from&&(this.fragments=Xo(this.fragments,l,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Dl{createParse(t,i,l){let s=l[0].from,a=l[l.length-1].to;return{parsedPos:s,advance(){let d=di;if(d){for(let h of l)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=a,new de(Ce.none,[],[],a-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return di}}function Xo(o,e,t){return ft.applyChanges(o,[{fromA:e,toA:t,fromB:e,toB:t}])}class $t{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 $t(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Xi.create(e.facet(Rt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new $t(i)}}Pe.state=mt.define({create:$t.init,update(o,e){for(let t of e.effects)if(t.is(Pe.setState))return t.value;return e.startState.facet(Rt)!=e.state.facet(Rt)?$t.init(e.state):o.apply(e)}});let Jo=o=>{let e=setTimeout(()=>o(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Jo=o=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(o,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const pl=typeof navigator<"u"&&(!((fl=navigator.scheduling)===null||fl===void 0)&&fl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Eh=It.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(Pe.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(Pe.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Jo(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:l}}=this.view,s=i.field(Pe.state);if(s.tree==s.context.tree&&s.context.isDone(l+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!pl?Math.max(25,e.timeRemaining()-5):1e9),r=s.context.treeLen<l&&i.doc.length>l+1e3,d=s.context.work(()=>pl&&pl()||Date.now()>a,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pe.setState.of(new $t(s.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ue(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()}}}),Rt=G.define({combine(o){return o.length?o[0]:null},enables:o=>[Pe.state,Eh,ie.contentAttributes.compute([o],e=>{let t=e.facet(o);return t&&t.name?{"data-language":t.name}:{}})]});class Ih{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Dh=new J;function Zo({except:o,units:e=1}={}){return t=>{let i=o&&o.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Ph=new J;function Fh(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 ml{constructor(e,t){this.specs=e;let i;function l(r){let d=ot.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const s=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof Pe?r=>r.prop(Ft)==a.data:a?r=>r==a:void 0,this.style=ql(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:s}).style,this.module=i?new ot(i):null,this.themeType=t.themeType}static define(e,t){return new ml(e,t||{})}}L.meta,L.link,L.heading,L.emphasis,L.strong,L.strikethrough,L.keyword,L.atom,L.bool,L.url,L.contentSeparator,L.labelName,L.literal,L.inserted,L.string,L.deleted,L.regexp,L.escape,L.string,L.variableName,L.variableName,L.typeName,L.namespace,L.className,L.variableName,L.macroName,L.propertyName,L.comment,L.invalid;const $h=Object.create(null),ea=[Ce.none],ta=[],ia=Object.create(null),Rh=Object.create(null);for(let[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"]])Rh[o]=Lh($h,e);function gl(o,e){ta.indexOf(o)>-1||(ta.push(o),console.warn(e))}function Lh(o,e){let t=[];for(let r of e.split(" ")){let d=[];for(let h of r.split(".")){let f=o[h]||L[h];f?typeof f=="function"?d.length?d=d.map(f):gl(h,`Modifier ${h} used at start of tag`):d.length?gl(h,`Tag ${h} used as modifier`):d=Array.isArray(f)?f:[f]:gl(h,`Unknown highlighting tag ${h}`)}for(let h of d)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(r=>r.id),s=ia[l];if(s)return s.id;let a=ia[l]=Ce.define({id:ea.length,name:i,props:[zl({[i]:t})]});return ea.push(a),a.id}me.RTL,me.LTR;const jh=Yi.define({name:"json",parser:Pd.configure({props:[Dh.add({Object:Zo({except:/^\s*\}/}),Array:Zo({except:/^\s*\]/})}),Ph.add({"Object Array":Fh})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function zh(){return new Ih(jh)}const kl=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function qh(){const o=Ee();if(o.formRules?.length){const e={};kl.forEach(i=>{e[i.name]=i});const t=[...kl];return o.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):t.push(l)}),t}return kl}const Uh={loadAdvances:qh},Wh={class:"unione-props-setting data-field-setting"},Hh={key:0},Kh=["onClick"],Qh={class:"field-txt"},Gh=["onClick"],Yh={key:1,class:"field-txt"},Xh=["onClick"],Jh={key:0,class:"field-txt"},Zh={key:3,class:"edit-field"},ef=["onClick"],tf=te(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([zh()]),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"),l={mounted:g=>g.focus()},s=n.ref({});function a(){const g=Object.keys(s.value);if(g.length)for(let p in g){const B=i.value.filter(O=>O.name==p);if(B&&B[0]){let O=s.value[p];Object.keys(O).forEach(C=>{C=="convertName"?(B[0].convert||(B[0].convert={}),B[0].convert.type=O[C]):B[0][C]=O[C]})}}s.value={}}function r(g,p){a();const B={};p=="convertName"?(g.convert||(g.convert={}),B[p]=g.convert?.type):B[p]=g[p]||"",s.value[g.name]=B}function d(g,p){{s.value={};return}}function h(g,p){switch(p){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 f(g,p){switch(p){case"query":g.configs=K.utils.obj.ext(g.configs,{query:{enable:!1}}),g.configs.query.enable=!g.configs.query.enable;break;case"form":g.configs=K.utils.obj.ext(g.configs,{show:{form:{enable:!1}}}),g.configs.show.form.enable=!g.configs.show.form.enable;break;case"view":g.configs=K.utils.obj.ext(g.configs,{show:{view:{enable:!1}}}),g.configs.show.view.enable=!g.configs.show.view.enable;break;case"list":g.configs=K.utils.obj.ext(g.configs,{show:{list:{enable:!1}}}),g.configs.show.list.enable=!g.configs.show.list.enable;break;case"sort":g.configs=K.utils.obj.ext(g.configs,{sort:{enable:!1}}),g.configs.sort.enable=!g.configs.sort.enable;break}console.log("record.configs",g.configs)}const c=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{c.value.visible=!1}});function u(g,p){switch(c.value.prop=p,c.value.field=g,g.configs||(g.configs={}),g.configs.show||(g.configs.show={}),p){case"query":g.configs.query||(g.configs.query={}),g.configs.query.types||(g.configs.query.types="EQ"),c.value.show=g.configs.query,c.value.title=`查询设置/${g.title}(${g.name})`;break;case"form":g.configs.show.form||(g.configs.show.form={}),c.value.show=g.configs.show.form,c.value.title=`表单设置/${g.title}(${g.name})`;break;case"view":g.configs.show.view||(g.configs.show.view={}),c.value.show=g.configs.show.view,c.value.title=`详情设置/${g.title}(${g.name})`;break;case"list":g.configs.show.list||(g.configs.show.list={}),c.value.show=g.configs.show.list,c.value.title=`列头设置/${g.title}(${g.name})`;break;case"sort":g.configs.sort||(g.configs.sort={}),c.value.show=g.configs.sort,c.value.title=`排序设置/${g.title}(${g.name})`;break}c.value.visible=!0}const m=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:g=>{const p=m.value.options.filter(B=>B.value==g);return p[0]?p[0].label:g}}),k=n.ref({visible:!1,field:{},props:{},advances:Uh.loadAdvances(),showInfo:g=>{let p=0;if(g.configs?.rule){const B=g.configs.rule;B.advance&&p++,typeof B.rangeMin<"u"&&p++,typeof B.rangeMax<"u"&&p++,typeof B.regExpress<"u"&&p++}if(p>0)return"("+p+")"},toSetting:()=>{const g=k.value.props;k.value.field.configs=K.utils.obj.ext(k.value.field.configs,{rule:{...g}}),k.value.visible=!1,k.value.props={}}});function y(g){k.value.visible=!0,k.value.field=g,k.value.props=g.configs?.rule||{}}const b=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 p=g.configs?.widget?.name,B=b.value.widgets.filter(O=>O.value==p);return B[0]?B[0].label:p},toSetting:(g,p)=>{g.configs||(g.configs={}),g.configs.widget||(g.configs.widget={}),g.configs.widget.name=p},toclose:()=>{b.value.visible=!1}});function x(g){b.value.field=g,g.configs=K.utils.obj.ext(g.configs,{widget:{props:{}}}),b.value.widget=g.configs.widget,b.value.visible=!0}const v=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,p="--")=>v.value.types.filter(B=>B.value==g)[0]?.label||p,toAddOption:()=>{v.value.convert.options||(v.value.convert.options=[]),v.value.convert.options.push({label:"",value:""})},toDelOption:(g,p)=>{v.value.convert.options.splice(g,1)},toSetting:()=>{v.value.visible=!1}});function V(g){v.value.visible=!0,v.value.field=g,g.configs||(g.configs={}),g.configs.convert||(g.configs.convert={}),v.value.convert=g.configs.convert}return(g,p)=>{const B=n.resolveComponent("ToolOutlined"),O=n.resolveComponent("a-button"),C=n.resolveComponent("a-select"),w=n.resolveComponent("a-checkbox"),N=n.resolveComponent("a-table"),M=n.resolveComponent("a-switch"),T=n.resolveComponent("a-form-item"),E=n.resolveComponent("a-select-option"),D=n.resolveComponent("a-input-number"),z=n.resolveComponent("a-form"),A=n.resolveComponent("a-modal"),q=n.resolveComponent("a-input"),P=n.resolveComponent("unione-select-box"),Q=n.resolveComponent("a-checkbox-group"),R=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",Wh,[n.createVNode(N,{columns:t.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["widget","queryType","rules","convertName"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",Hh,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:F,record:_})=>[["rules"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!k.value.showInfo(_)&&"empty"]),onClick:I=>y(_)},[n.createElementVNode("span",Qh,n.toDisplayString(k.value.showInfo(_)),1),k.value.showInfo(_)?(n.openBlock(),n.createBlock(O,{key:0,type:"link"},{default:n.withCtx(()=>p[50]||(p[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Kh)):["widget"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[_.name]||!Object.keys(s.value[_.name]).includes(S.dataIndex))&&!F&&"empty"]),onClick:I=>r(_,S.dataIndex)},[s.value[_.name]&&Object.keys(s.value[_.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:_.configs?.widget?.name,allowClear:!0,options:b.value.widgets,onChange:I=>b.value.toSetting(_,I),onBlur:p[0]||(p[0]=I=>d())},null,8,["value","options","onChange"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Yh,n.toDisplayString(b.value.widgetName(_)),1)),n.createVNode(O,{type:"link",onClick:n.withModifiers(I=>x(_),["stop"])},{default:n.withCtx(()=>p[51]||(p[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Gh)):["convertName"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[_.name]||!Object.keys(s.value[_.name]).includes(S.dataIndex))&&!_.convert?.type&&"empty"]),onClick:I=>V(_)},[_.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Jh,n.toDisplayString(v.value.getTypes(_.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Xh)):["query","form","view","list","sort"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",Zh,[n.createVNode(w,{checked:h(_,S.dataIndex),onClick:I=>f(_,S.dataIndex)},null,8,["checked","onClick"]),n.createVNode(O,{type:"link",onClick:I=>u(_,S.dataIndex)},{default:n.withCtx(()=>p[52]||(p[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(A,{visible:c.value.visible,"onUpdate:visible":p[14]||(p[14]=S=>c.value.visible=S),width:600,title:c.value.title,onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(z,{model:c.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:n.normalizeClass(["field-setting-form","form-mix",c.value.prop])},{default:n.withCtx(()=>[n.createVNode(T,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.enable,"onUpdate:checked":p[1]||(p[1]=S=>c.value.show.enable=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),c.value.prop=="sort"?(n.openBlock(),n.createBlock(T,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.defoult,"onUpdate:checked":p[2]||(p[2]=S=>c.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="sort"?(n.openBlock(),n.createBlock(T,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.asc,"onUpdate:checked":p[3]||(p[3]=S=>c.value.show.asc=S),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="query"&&c.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(T,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),c.value.prop=="query"?(n.openBlock(),n.createBlock(T,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.defoult,"onUpdate:checked":p[4]||(p[4]=S=>c.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="query"?(n.openBlock(),n.createBlock(T,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.visible,"onUpdate:checked":p[5]||(p[5]=S=>c.value.show.visible=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="query"?(n.openBlock(),n.createBlock(T,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.types,"onUpdate:value":p[6]||(p[6]=S=>c.value.show.types=S)},{default:n.withCtx(()=>[n.createVNode(E,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>p[53]||(p[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(E,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>p[54]||(p[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(E,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>p[55]||(p[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(E,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>p[56]||(p[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(E,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>p[57]||(p[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(E,{key:"ADVANCE",value:"ADVANCE"},{default:n.withCtx(()=>p[58]||(p[58]=[n.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0),["query","sort"].includes(c.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(T,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(D,{value:c.value.show.index,"onUpdate:value":p[7]||(p[7]=S=>c.value.show.index=S)},null,8,["value"])]),_:1})),["form","view"].includes(c.value.prop)?(n.openBlock(),n.createBlock(T,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:c.value.show.width,"onUpdate:value":p[8]||(p[8]=S=>c.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(c.value.prop)?(n.openBlock(),n.createBlock(T,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,value:c.value.show.width,"onUpdate:value":p[9]||(p[9]=S=>c.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(c.value.prop)?(n.openBlock(),n.createBlock(T,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:c.value.show.labelWidth,"onUpdate:value":p[10]||(p[10]=S=>c.value.show.labelWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(c.value.prop)?(n.openBlock(),n.createBlock(T,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:c.value.show.valueWidth,"onUpdate:value":p[11]||(p[11]=S=>c.value.show.valueWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(c.value.prop)?(n.openBlock(),n.createBlock(T,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.fixed,"onUpdate:value":p[12]||(p[12]=S=>c.value.show.fixed=S),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(c.value.prop)?(n.openBlock(),n.createBlock(T,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.align,"onUpdate:value":p[13]||(p[13]=S=>c.value.show.align=S),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),n.createVNode(A,{visible:v.value.visible,"onUpdate:visible":p[33]||(p[33]=S=>v.value.visible=S),width:600,title:v.value.getTypes(v.value.convert.types,"转换")+"设置",onOk:v.value.toSetting},{default:n.withCtx(()=>[n.createVNode(z,{model:v.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(T,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:v.value.convert.types,"onUpdate:value":p[15]||(p[15]=S=>v.value.convert.types=S),allowClear:!0,options:v.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(T,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.convert.search,"onUpdate:checked":p[16]||(p[16]=S=>c.value.convert.search=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="option"?(n.openBlock(),n.createBlock(T,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(O,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:v.value.toAddOption},{default:n.withCtx(()=>p[59]||(p[59]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(N,{columns:v.value.optionColumn,"data-source":v.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:S,record:F,index:_})=>[S.dataIndex==="label"?(n.openBlock(),n.createBlock(q,{key:0,value:F.label,"onUpdate:value":I=>F.label=I,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="value"?(n.openBlock(),n.createBlock(q,{key:1,value:F.value,"onUpdate:value":I=>F.value=I,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:I=>v.value.toDelOption(_,F)},"删除",8,ef)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(T,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(P,{value:v.value.convert.dsId,"onUpdate:value":p[17]||(p[17]=S=>v.value.convert.dsId=S),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.tableName,"onUpdate:value":p[18]||(p[18]=S=>v.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.tableName,"onUpdate:value":p[19]||(p[19]=S=>v.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"&&["unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(T,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.idField,"onUpdate:value":p[20]||(p[20]=S=>v.value.convert.idField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"&&["unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(T,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.pidField,"onUpdate:value":p[21]||(p[21]=S=>v.value.convert.pidField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.valueField,"onUpdate:value":p[22]||(p[22]=S=>v.value.convert.valueField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.labelField,"onUpdate:value":p[23]||(p[23]=S=>v.value.convert.labelField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.tableField,"onUpdate:value":p[24]||(p[24]=S=>v.value.convert.tableField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.tableWhere,"onUpdate:value":p[25]||(p[25]=S=>v.value.convert.tableWhere=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.tableOrder,"onUpdate:value":p[26]||(p[26]=S=>v.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.tableOrder,"onUpdate:value":p[27]||(p[27]=S=>v.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:v.value.convert.isAsync,"onUpdate:checked":p[28]||(p[28]=S=>v.value.convert.isAsync=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(T,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:v.value.convert.isPaging,"onUpdate:checked":p[29]||(p[29]=S=>v.value.convert.isPaging=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dict"?(n.openBlock(),n.createBlock(T,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.dictName,"onUpdate:value":p[30]||(p[30]=S=>v.value.convert.dictName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(T,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode(q,{value:v.value.convert.url,"onUpdate:value":p[31]||(p[31]=S=>v.value.convert.url=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(T,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:v.value.convert.params,"onUpdate:modelValue":p[32]||(p[32]=S=>v.value.convert.params=S),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(A,{visible:b.value.visible,"onUpdate:visible":p[40]||(p[40]=S=>b.value.visible=S),width:600,title:"控件设置",onOk:b.value.toclose},{default:n.withCtx(()=>[n.createVNode(z,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(T,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(C,{value:b.value.widget.name,"onUpdate:value":p[34]||(p[34]=S=>b.value.widget.name=S),allowClear:!0,options:b.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),n.createVNode(T,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:b.value.widget.placeholder,"onUpdate:value":p[35]||(p[35]=S=>b.value.widget.placeholder=S)},null,8,["value"])]),_:1}),n.createVNode(T,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode(q,{value:b.value.widget.help,"onUpdate:value":p[36]||(p[36]=S=>b.value.widget.help=S)},null,8,["value"])]),_:1}),n.createVNode(T,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode(q,{value:b.value.widget.tooltip,"onUpdate:value":p[37]||(p[37]=S=>b.value.widget.tooltip=S)},null,8,["value"])]),_:1}),["a-date-picker"].includes(b.value.widget.name)?(n.openBlock(),n.createBlock(T,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode(q,{value:b.value.field.dataFormat,"onUpdate:value":p[38]||(p[38]=S=>b.value.field.dataFormat=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),b.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(T,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:b.value.widget.props.mode,"onUpdate:value":p[39]||(p[39]=S=>b.value.widget.props.mode=S),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(E,{value:"multiple"},{default:n.withCtx(()=>p[60]||(p[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(E,{value:"tags"},{default:n.withCtx(()=>p[61]||(p[61]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(A,{visible:k.value.visible,"onUpdate:visible":p[49]||(p[49]=S=>k.value.visible=S),width:600,title:"规则设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[n.createVNode(z,{model:k.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(R,{title:"基本设置",type:"line"},{default:n.withCtx(()=>[n.createVNode(T,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(Q,{value:k.value.props.trigger,"onUpdate:value":p[41]||(p[41]=S=>k.value.props.trigger=S),options:["change","blur"]},null,8,["value"])]),_:1}),k.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(T,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(w,{checked:k.value.props.whitespace,"onUpdate:checked":p[42]||(p[42]=S=>k.value.props.whitespace=S)},{default:n.withCtx(()=>p[62]||(p[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(T,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(C,{options:k.value.advances,fieldNames:{label:"title",value:"name"},value:k.value.props.advance,"onUpdate:value":p[43]||(p[43]=S=>k.value.props.advance=S)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(k.value.field.dataType)?(n.openBlock(),n.createBlock(R,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(T,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(D,{value:k.value.props.rangeMin,"onUpdate:value":p[44]||(p[44]=S=>k.value.props.rangeMin=S)},null,8,["value"]),p[63]||(p[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(D,{value:k.value.props.rangeMax,"onUpdate:value":p[45]||(p[45]=S=>k.value.props.rangeMax=S)},null,8,["value"])]),_:1}),n.createVNode(T,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.props.rangeMessage,"onUpdate:value":p[46]||(p[46]=S=>k.value.props.rangeMessage=S)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(R,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(T,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.props.regExpress,"onUpdate:value":p[47]||(p[47]=S=>k.value.props.regExpress=S)},null,8,["value"])]),_:1}),n.createVNode(T,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.props.regMessage,"onUpdate:value":p[48]||(p[48]=S=>k.value.props.regMessage=S)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),nf={class:"unione-props-setting data-field-fkey"},lf={key:0},sf=["onClick"],of=["onClick"],af=["onClick"],rf=["onClick"],df=["onClick"],cf=["onClick"],hf=["onClick"],ff=["onClick"],uf=te(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=K.useDialog(),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),i=n.useModel(o,"modelValue"),l=n.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),s=n.ref({});function a(){s.value={}}function r(u,m){a();const k={};k[m]=u.configs.fkey[m]||"",s.value[u.name]=k}function d(u,m,k){u.configs.fkey.dsn=m,u.configs.fkey.dsnName=k.name,u.configs.fkey.dsnTitle=k.title,u.configs.fkey.dsnId=k.id}function h(u,m,k,y){u.configs.fkey[m]=k,m=="fieldName"&&(u.configs.fkey.fieldTitle=y.title),m=="labelName"&&(u.configs.fkey.labelTitle=y.title)}function f(u){c.value.record=u,c.value.visible=!0,c.value.fields=u.configs?.fkey?.fields||[]}const c=n.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(u,m)=>{c.value.editField[u]=m},onShowFieldChange:(u,m,k)=>{u.name=k.name,u.title=k.title},toAddField:()=>{c.value.fields.push({name:"",title:""}),c.value.editField[c.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{c.value.fields.splice(u,1)}})},toSetting:()=>{c.value.visible=!1,c.value.record.configs=K.utils.obj.ext(c.value.record.configs,{fkey:{fields:c.value.fields}})}});return(u,m)=>{const k=n.resolveComponent("FormOutlined"),y=n.resolveComponent("unione-select-box"),b=n.resolveComponent("a-button"),x=n.resolveComponent("a-table"),v=n.resolveComponent("a-input-number"),V=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",nf,[n.createVNode(x,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:n.withCtx(({column:g})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(g.key)?(n.openBlock(),n.createElementBlock("span",lf,[n.createVNode(k),n.createTextVNode(" "+n.toDisplayString(g.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:g,record:p})=>[["dsnName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnName&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:a,onSelect:(B,O)=>d(p,B,O)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnName),1)],64))],10,sf)):["dsnTitle"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnTitle&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:a,onSelect:(B,O)=>d(p,B,O)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnTitle),1)],64))],10,of)):n.createCommentVNode("",!0),["fieldName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.fieldName&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(B,O)=>h(p,"fieldName",B,O)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.fieldTitle),1)],64))],10,af)):["labelName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.labelName&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(B,O)=>h(p,"labelName",B,O)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.labelTitle)+" ",1),p.configs?.fkey?.labelName?(n.openBlock(),n.createBlock(b,{key:0,type:"link",onClick:n.withModifiers(B=>f(p),["stop"])},{default:n.withCtx(()=>m[4]||(m[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,rf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(V,{visible:c.value.visible,"onUpdate:visible":m[3]||(m[3]=g=>c.value.visible=g),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(b,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:c.value.toAddField},{default:n.withCtx(()=>m[5]||(m[5]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(x,{columns:c.value.columns,"data-source":c.value.fields,size:"small"},{bodyCell:n.withCtx(({column:g,record:p,index:B,text:O})=>[g.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",c.value.editField!="title"&&!O&&"empty"]),onClick:C=>c.value.toEditField(B,g.dataIndex)},[c.value.editField[B]=="title"?(n.openBlock(),n.createBlock(y,{key:0,value:p[p.dataIndex],"onUpdate:value":C=>p[p.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:c.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=C=>c.value.editField={}),onSelect:(C,w)=>c.value.onShowFieldChange(p,C,w)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(O),1)],64))],10,df)):n.createCommentVNode("",!0),g.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",c.value.editField!="width"&&!O&&"empty"]),onClick:C=>c.value.toEditField(B,g.dataIndex)},[c.value.editField[B]=="width"?(n.openBlock(),n.createBlock(v,{key:0,onBlur:m[1]||(m[1]=C=>c.value.editField={}),value:p.width,"onUpdate:value":C=>p.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(O),1)],64))],10,cf)):n.createCommentVNode("",!0),g.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",c.value.editField!="wiindexdth"&&!O&&"empty"]),onClick:C=>c.value.toEditField(B,g.dataIndex)},[c.value.editField[B]=="index"?(n.openBlock(),n.createBlock(v,{key:0,onBlur:m[2]||(m[2]=C=>c.value.editField={}),value:p.index,"onUpdate:value":C=>p.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(O),1)],64))],10,hf)):n.createCommentVNode("",!0),g.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:C=>c.value.toDelField(B)},"删除",8,ff)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),pf={class:"unione-props-setting data-filter"},mf={class:"title"},gf={class:"name"},kf={class:"action"},bf=te(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=K.useDialog(),t=n.useModel(o,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(h){r.value.visible=!0,r.value.filter={...h},r.value.name=h.name}function s(h){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(h,1)}})}const 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(h=>{if(r.value.name){const f=t.value.filter(c=>c.name==r.value.name)[0];if(!f){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(h).forEach(c=>{f[c]=h[c]})}else{if(t.value.filter(c=>c.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(h)}r.value.visible=!1})}});function d(){const h=[];r.value.filter.filter||(r.value.filter.filter=""),h.push("-- @if(isNotEmpty(params."),h.push(r.value.filter.name||"xxx"),h.push(") && !isBlank(params."),h.push(r.value.filter.name||"xxx"),h.push(`)
3
+ `){[e,t]=Ct(this,e,t);let l="";for(let s=0,a=0;s<this.children.length&&a<=t;s++){let r=this.children[s],d=a+r.length;a>e&&s&&(l+=i),e<d&&t>a&&(l+=r.sliceString(e-a,t-a,i)),a=d+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof je))return 0;let i=0,[l,s,a,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,s+=t){if(l==a||s==r)return i;let d=this.children[l],h=e.children[s];if(d!=h)return i+d.scanIdentical(h,t);i+=d.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let m of e)i+=m.lines;if(i<32){let m=[];for(let b of e)b.flatten(m);return new re(m,t)}let l=Math.max(32,i>>5),s=l<<1,a=l>>1,r=[],d=0,h=-1,f=[];function c(m){let b;if(m.lines>s&&m instanceof je)for(let y of m.children)c(y);else m.lines>a&&(d>a||!d)?(u(),r.push(m)):m instanceof re&&d&&(b=f[f.length-1])instanceof re&&m.lines+b.lines<=32?(d+=m.lines,h+=m.length+1,f[f.length-1]=new re(b.text.concat(m.text),b.length+1+m.length)):(d+m.lines>l&&u(),d+=m.lines,h+=m.length+1,f.push(m))}function u(){d!=0&&(r.push(f.length==1?f[0]:je.from(f,h)),h=-1,d=f.length=0)}for(let m of e)c(m);return u(),r.length==1?r[0]:new je(r,t)}}Z.empty=new re([""],0);function $d(o){let e=-1;for(let t of o)e+=t.length+1;return e}function Ci(o,e,t=0,i=1e9){for(let l=0,s=0,a=!0;s<o.length&&l<=i;s++){let r=o[s],d=l+r.length;d>=t&&(d>i&&(r=r.slice(0,i-l)),l<t&&(r=r.slice(t-l)),a?(e[e.length-1]+=r,a=!1):e.push(r)),l=d+1}return e}function Hl(o,e,t){return Ci(o,[""],e,t)}class Wt{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof re?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],s=this.offsets[i],a=s>>1,r=l instanceof re?l.text.length:l.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((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
+ `,this;e--}else if(l instanceof re){let d=l.text[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=l.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 re?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Kl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Wt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ql{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Z.prototype[Symbol.iterator]=function(){return this.iter()},Wt.prototype[Symbol.iterator]=Kl.prototype[Symbol.iterator]=Ql.prototype[Symbol.iterator]=function(){return this});class Rd{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function Ct(o,e,t){return e=Math.max(0,Math.min(o.length,e)),[e,Math.max(e,Math.min(o.length,t))]}let St="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<St.length;o++)St[o]+=St[o-1];function Ld(o){for(let e=1;e<St.length;e+=2)if(St[e]>o)return St[e-1]<=o;return!1}function Gl(o){return o>=127462&&o<=127487}const Yl=8205;function Ge(o,e,t=!0,i=!0){return(t?Xl:jd)(o,e,i)}function Xl(o,e,t){if(e==o.length)return e;e&&Jl(o.charCodeAt(e))&&Zl(o.charCodeAt(e-1))&&e--;let i=pn(o,e);for(e+=es(i);e<o.length;){let l=pn(o,e);if(i==Yl||l==Yl||t&&Ld(l))e+=es(l),i=l;else if(Gl(l)){let s=0,a=e-2;for(;a>=0&&Gl(pn(o,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function jd(o,e,t){for(;e>0;){let i=Xl(o,e-2,t);if(i<e)return i;e--}return 0}function Jl(o){return o>=56320&&o<57344}function Zl(o){return o>=55296&&o<56320}function pn(o,e){let t=o.charCodeAt(e);if(!Zl(t)||e+1==o.length)return t;let i=o.charCodeAt(e+1);return Jl(i)?(t-55296<<10)+(i-56320)+65536:t}function es(o){return o<65536?1:2}const mn=/\r\n?|\n/;var Oe=function(o){return o[o.Simple=0]="Simple",o[o.TrackDel=1]="TrackDel",o[o.TrackBefore=2]="TrackBefore",o[o.TrackAfter=3]="TrackAfter",o}(Oe||(Oe={}));class Ye{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let s=this.sections[t++],a=this.sections[t++];a<0?(e(i,l,s),l+=s):l+=a,i+=s}}iterChangedRanges(e,t=!1){gn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new Ye(e)}composeDesc(e){return this.empty?e:e.empty?this:ts(this,e)}mapDesc(e,t=!1){return e.empty?this:kn(this,e,t)}mapPos(e,t=-1,i=Oe.Simple){let l=0,s=0;for(let a=0;a<this.sections.length;){let r=this.sections[a++],d=this.sections[a++],h=l+r;if(d<0){if(h>e)return s+(e-l);s+=r}else{if(i!=Oe.Simple&&h>=e&&(i==Oe.TrackDel&&l<e&&h>e||i==Oe.TrackBefore&&l<e||i==Oe.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!r)return e==l||t<0?s:s+d;s+=d}l=h}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return s}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let s=this.sections[i++],a=this.sections[i++],r=l+s;if(a>=0&&l<=t&&r>=e)return l<e&&r>t?"cover":!0;l=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ye(e)}static create(e){return new Ye(e)}}class ue extends Ye{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return gn(this,(t,i,l,s,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return kn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,s=0;l<t.length;l+=2){let a=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=a;let d=l>>1;for(;i.length<d;)i.push(Z.empty);i.push(a?e.slice(s,s+a):Z.empty)}s+=a}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:ts(this,e,!0)}map(e,t=!1){return e.empty?this:kn(this,e,t,!0)}iterChanges(e,t=!1){gn(this,e,t)}get desc(){return Ye.create(this.sections)}filter(e){let t=[],i=[],l=[],s=new Ht(this);e:for(let a=0,r=0;;){let d=a==e.length?1e9:e[a++];for(;r<d||r==d&&s.len==0;){if(s.done)break e;let f=Math.min(s.len,d-r);be(l,f,-1);let c=s.ins==-1?-1:s.off==0?s.ins:0;be(t,f,c),c>0&&st(i,t,s.text),s.forward(f),r+=f}let h=e[a++];for(;r<h;){if(s.done)break e;let f=Math.min(s.len,h-r);be(t,f,-1),be(l,f,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(f),r+=f}}return{changes:new ue(t,i),filtered:Ye.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],s=[],a=0,r=null;function d(f=!1){if(!f&&!l.length)return;a<t&&be(l,t-a,-1);let c=new ue(l,s);r=r?r.compose(c.map(r)):c,l=[],s=[],a=0}function h(f){if(Array.isArray(f))for(let c of f)h(c);else if(f instanceof ue){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);d(),r=r?r.compose(f.map(r)):f}else{let{from:c,to:u=c,insert:m}=f;if(c>u||c<0||u>t)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${t})`);let b=m?typeof m=="string"?Z.of(m.split(i||mn)):m:Z.empty,y=b.length;if(c==u&&y==0)return;c<a&&d(),c>a&&be(l,c-a,-1),be(l,u-c,y),st(s,l,b),a=u}}return h(e),d(!r),r}static empty(e){return new ue(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let s=e[l];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((a,r)=>r&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<l;)i.push(Z.empty);i[l]=Z.of(s.slice(1)),t.push(s[0],i[l].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function be(o,e,t,i=!1){if(e==0&&t<=0)return;let l=o.length-2;l>=0&&t<=0&&t==o[l+1]?o[l]+=e:e==0&&o[l]==0?o[l+1]+=t:i?(o[l]+=e,o[l+1]+=t):o.push(e,t)}function st(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(Z.empty);o.push(t)}}function gn(o,e,t){let i=o.inserted;for(let l=0,s=0,a=0;a<o.sections.length;){let r=o.sections[a++],d=o.sections[a++];if(d<0)l+=r,s+=r;else{let h=l,f=s,c=Z.empty;for(;h+=r,f+=d,d&&i&&(c=c.append(i[a-2>>1])),!(t||a==o.sections.length||o.sections[a+1]<0);)r=o.sections[a++],d=o.sections[a++];e(l,h,s,f,c),l=h,s=f}}}function kn(o,e,t,i=!1){let l=[],s=i?[]:null,a=new Ht(o),r=new Ht(e);for(let d=-1;;)if(a.ins==-1&&r.ins==-1){let h=Math.min(a.len,r.len);be(l,h,-1),a.forward(h),r.forward(h)}else if(r.ins>=0&&(a.ins<0||d==a.i||a.off==0&&(r.len<a.len||r.len==a.len&&!t))){let h=r.len;for(be(l,r.ins,-1);h;){let f=Math.min(a.len,h);a.ins>=0&&d<a.i&&a.len<=f&&(be(l,0,a.ins),s&&st(s,l,a.text),d=a.i),a.forward(f),h-=f}r.next()}else if(a.ins>=0){let h=0,f=a.len;for(;f;)if(r.ins==-1){let c=Math.min(f,r.len);h+=c,f-=c,r.forward(c)}else if(r.ins==0&&r.len<f)f-=r.len,r.next();else break;be(l,h,d<a.i?a.ins:0),s&&d<a.i&&st(s,l,a.text),d=a.i,a.forward(a.len-f)}else{if(a.done&&r.done)return s?ue.createSet(l,s):Ye.create(l);throw new Error("Mismatched change set lengths")}}function ts(o,e,t=!1){let i=[],l=t?[]:null,s=new Ht(o),a=new Ht(e);for(let r=!1;;){if(s.done&&a.done)return l?ue.createSet(i,l):Ye.create(i);if(s.ins==0)be(i,s.len,0,r),s.next();else if(a.len==0&&!a.done)be(i,0,a.ins,r),l&&st(l,i,a.text),a.next();else{if(s.done||a.done)throw new Error("Mismatched change set lengths");{let d=Math.min(s.len2,a.len),h=i.length;if(s.ins==-1){let f=a.ins==-1?-1:a.off?0:a.ins;be(i,d,f,r),l&&f&&st(l,i,a.text)}else a.ins==-1?(be(i,s.off?0:s.len,d,r),l&&st(l,i,s.textBit(d))):(be(i,s.off?0:s.len,a.off?0:a.ins,r),l&&!a.off&&st(l,i,a.text));r=(s.ins>d||a.ins>=0&&a.len>d)&&(r||i.length>h),s.forward2(d),a.forward(d)}}}}class Ht{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Z.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?Z.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 mt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new mt(i,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return H.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return H.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return H.range(e.anchor,e.head)}static create(e,t,i){return new mt(e,t,i)}}class H{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:H.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new H([this.main],0)}addRange(e,t=!0){return H.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,H.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new H(e.ranges.map(t=>mt.fromJSON(t)),e.main)}static single(e,t=e){return new H([H.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;l<e.length;l++){let s=e[l];if(s.empty?s.from<=i:s.from<i)return H.normalized(e.slice(),t);i=s.to}return new H(e,t)}static cursor(e,t=0,i,l){return mt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,t,i,l){let s=(i??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?mt.create(t,e,48|s):mt.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((l,s)=>l.from-s.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let s=e[l],a=e[l-1];if(s.empty?s.from<=a.to:s.from<a.to){let r=a.from,d=Math.max(s.to,a.to);l<=t&&t--,e.splice(--l,2,s.anchor>s.head?H.range(d,r):H.range(r,d))}}return new H(e,t)}}function is(o,e){for(let t of o.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let bn=0;class G{constructor(e,t,i,l,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=bn++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new G(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:yn),!!e.static,e.enables)}of(e){return new Si([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Si(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function yn(o,e){return o==e||o.length==e.length&&o.every((t,i)=>t===e[i])}class Si{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=bn++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,s=this.id,a=e[s]>>1,r=this.type==2,d=!1,h=!1,f=[];for(let c of this.dependencies)c=="doc"?d=!0:c=="selection"?h=!0:((t=e[c.id])!==null&&t!==void 0?t:1)&1||f.push(e[c.id]);return{create(c){return c.values[a]=i(c),1},update(c,u){if(d&&u.docChanged||h&&(u.docChanged||u.selection)||wn(c,f)){let m=i(c);if(r?!ns(m,c.values[a],l):!l(m,c.values[a]))return c.values[a]=m,1}return 0},reconfigure:(c,u)=>{let m,b=u.config.address[s];if(b!=null){let y=Oi(u,b);if(this.dependencies.every(k=>k instanceof G?u.facet(k)===c.facet(k):k instanceof gt?u.field(k,!1)==c.field(k,!1):!0)||(r?ns(m=i(c),y,l):l(m=i(c),y)))return c.values[a]=y,0}else m=i(c);return c.values[a]=m,1}}}}function ns(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)Qt(o,i)&1&&(t=!0);return t}function zd(o,e,t){let i=t.map(d=>o[d.id]),l=t.map(d=>d.type),s=i.filter(d=>!(d&1)),a=o[e.id]>>1;function r(d){let h=[];for(let f=0;f<i.length;f++){let c=Oi(d,i[f]);if(l[f]==2)for(let u of c)h.push(u);else h.push(c)}return e.combine(h)}return{create(d){for(let h of i)Qt(d,h);return d.values[a]=r(d),1},update(d,h){if(!wn(d,s))return 0;let f=r(d);return e.compare(f,d.values[a])?0:(d.values[a]=f,1)},reconfigure(d,h){let f=wn(d,i),c=h.config.facets[e.id],u=h.facet(e);if(c&&!f&&yn(t,c))return d.values[a]=u,0;let m=r(d);return e.compare(m,u)?(d.values[a]=u,0):(d.values[a]=m,1)}}}const ls=G.define({static:!0});class gt{constructor(e,t,i,l,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=s,this.provides=void 0}static define(e){let t=new gt(bn++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ls).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let s=i.values[t],a=this.updateF(s,l);return this.compareF(s,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ls.of({field:this,create:e})]}get extension(){return this}}const kt={lowest:4,low:3,default:2,high:1,highest:0};function Kt(o){return e=>new ss(e,o)}const qd={highest:Kt(kt.highest),high:Kt(kt.high),default:Kt(kt.default),low:Kt(kt.low),lowest:Kt(kt.lowest)};class ss{constructor(e,t){this.inner=e,this.prec=t}}class Ni{of(e){return new xn(this,e)}reconfigure(e){return Ni.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class xn{constructor(e,t){this.compartment=e,this.inner=t}}class Bi{constructor(e,t,i,l,s,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=s,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 l=[],s=Object.create(null),a=new Map;for(let u of Ud(e,t,a))u instanceof gt?l.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let r=Object.create(null),d=[],h=[];for(let u of l)r[u.id]=h.length<<1,h.push(m=>u.slot(m));let f=i?.config.facets;for(let u in s){let m=s[u],b=m[0].facet,y=f&&f[u]||[];if(m.every(k=>k.type==0))if(r[b.id]=d.length<<1|1,yn(y,m))d.push(i.facet(b));else{let k=b.combine(m.map(v=>v.value));d.push(i&&b.compare(k,i.facet(b))?i.facet(b):k)}else{for(let k of m)k.type==0?(r[k.id]=d.length<<1|1,d.push(k.value)):(r[k.id]=h.length<<1,h.push(v=>k.dynamicSlot(v)));r[b.id]=h.length<<1,h.push(k=>zd(k,b,m))}}let c=h.map(u=>u(r));return new Bi(e,a,c,r,d,s)}}function Ud(o,e,t){let i=[[],[],[],[],[]],l=new Map;function s(a,r){let d=l.get(a);if(d!=null){if(d<=r)return;let h=i[d].indexOf(a);h>-1&&i[d].splice(h,1),a instanceof xn&&t.delete(a.compartment)}if(l.set(a,r),Array.isArray(a))for(let h of a)s(h,r);else if(a instanceof xn){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(a.compartment)||a.inner;t.set(a.compartment,h),s(h,r)}else if(a instanceof ss)s(a.inner,a.prec);else if(a instanceof gt)i[r].push(a),a.provides&&s(a.provides,r);else if(a instanceof Si)i[r].push(a),a.facet.extensions&&s(a.facet.extensions,kt.default);else{let h=a.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,r)}}return s(o,kt.default),i.reduce((a,r)=>a.concat(r))}function Qt(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 l=o.computeSlot(o,o.config.dynamicSlots[t]);return o.status[t]=2|l}function Oi(o,e){return e&1?o.config.staticValues[e>>1]:o.values[e>>1]}const os=G.define(),vn=G.define({combine:o=>o.some(e=>e),static:!0}),as=G.define({combine:o=>o.length?o[0]:void 0,static:!0}),rs=G.define(),ds=G.define(),cs=G.define(),hs=G.define({combine:o=>o.length?o[0]:!1});class Nt{constructor(e,t){this.type=e,this.value=t}static define(){return new Wd}}class Wd{of(e){return new Nt(this,e)}}class Hd{constructor(e){this.map=e}of(e){return new he(this,e)}}class he{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new he(this.type,t)}is(e){return this.type==e}static define(e={}){return new Hd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let s=l.map(t);s&&i.push(s)}return i}}he.reconfigure=he.define(),he.appendConfig=he.define();class ye{constructor(e,t,i,l,s,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,i&&is(i,t.newLength),s.some(r=>r.type==ye.time)||(this.annotations=s.concat(ye.time.of(Date.now())))}static create(e,t,i,l,s,a){return new ye(e,t,i,l,s,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(ye.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ye.time=Nt.define(),ye.userEvent=Nt.define(),ye.addToHistory=Nt.define(),ye.remote=Nt.define();function Kd(o,e){let t=[];for(let i=0,l=0;;){let s,a;if(i<o.length&&(l==e.length||e[l]>=o[i]))s=o[i++],a=o[i++];else if(l<e.length)s=e[l++],a=e[l++];else return t;!t.length||t[t.length-1]<s?t.push(s,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function fs(o,e,t){var i;let l,s,a;return t?(l=e.changes,s=ue.empty(e.changes.length),a=o.changes.compose(e.changes)):(l=e.changes.map(o.changes),s=o.changes.mapDesc(e.changes,!0),a=o.changes.compose(l)),{changes:a,selection:e.selection?e.selection.map(s):(i=o.selection)===null||i===void 0?void 0:i.map(l),effects:he.mapEffects(o.effects,l).concat(he.mapEffects(e.effects,s)),annotations:o.annotations.length?o.annotations.concat(e.annotations):e.annotations,scrollIntoView:o.scrollIntoView||e.scrollIntoView}}function Cn(o,e,t){let i=e.selection,l=Bt(e.annotations);return e.userEvent&&(l=l.concat(ye.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,o.facet(as)),selection:i&&(i instanceof H?i:H.single(i.anchor,i.head)),effects:Bt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function us(o,e,t){let i=Cn(o,e.length?e[0]:{},o.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let a=!!e[s].sequential;i=fs(i,Cn(o,e[s],a?i.changes.newLength:o.doc.length),a)}let l=ye.create(o,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Gd(t?Qd(l):l)}function Qd(o){let e=o.startState,t=!0;for(let l of e.facet(rs)){let s=l(o);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Kd(t,s))}if(t!==!0){let l,s;if(t===!1)s=o.changes.invertedDesc,l=ue.empty(e.doc.length);else{let a=o.changes.filter(t);l=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}o=ye.create(e,l,o.selection&&o.selection.map(s),he.mapEffects(o.effects,s),o.annotations,o.scrollIntoView)}let i=e.facet(ds);for(let l=i.length-1;l>=0;l--){let s=i[l](o);s instanceof ye?o=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ye?o=s[0]:o=us(e,Bt(s),!1)}return o}function Gd(o){let e=o.startState,t=e.facet(cs),i=o;for(let l=t.length-1;l>=0;l--){let s=t[l](o);s&&Object.keys(s).length&&(i=fs(i,Cn(e,s,o.changes.newLength),!0))}return i==o?o:ye.create(e,o.changes,o.selection,i.effects,i.annotations,i.scrollIntoView)}const Yd=[];function Bt(o){return o==null?Yd:Array.isArray(o)?o:[o]}var Xe=function(o){return o[o.Word=0]="Word",o[o.Space=1]="Space",o[o.Other=2]="Other",o}(Xe||(Xe={}));const Xd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Sn;try{Sn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Jd(o){if(Sn)return Sn.test(o);for(let e=0;e<o.length;e++){let t=o[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Xd.test(t)))return!0}return!1}function Zd(o){return e=>{if(!/\S/.test(e))return Xe.Space;if(Jd(e))return Xe.Word;for(let t=0;t<o.length;t++)if(e.indexOf(o[t])>-1)return Xe.Word;return Xe.Other}}class ne{constructor(e,t,i,l,s,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Qt(this,r<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Qt(this,i),Oi(this,i)}update(...e){return us(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let r of e.effects)r.is(Ni.reconfigure)?(t&&(l=new Map,t.compartments.forEach((d,h)=>l.set(h,d)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(he.reconfigure)?(t=null,i=r.value):r.is(he.appendConfig)&&(t=null,i=Bt(i).concat(r.value));let s;t?s=e.startState.values.slice():(t=Bi.resolve(i,l,this),s=new ne(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let a=e.startState.facet(vn)?e.newSelection:e.newSelection.asSingle();new ne(t,e.newDoc,a,s,(r,d)=>d.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:H.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),s=[i.range],a=Bt(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),h=this.changes(d.changes),f=h.map(l);for(let u=0;u<r;u++)s[u]=s[u].map(f);let c=l.mapDesc(h,!0);s.push(d.range.map(c)),l=l.compose(f),a=he.mapEffects(a,f).concat(he.mapEffects(Bt(d.effects),c))}return{changes:l,selection:H.create(s,t.mainIndex),effects:a}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(ne.lineSeparator))}toText(e){return Z.of(e.split(this.facet(ne.lineSeparator)||mn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Qt(this,t),Oi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof gt&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let a=i[s],r=e[s];l.push(a.init(d=>a.spec.fromJSON(r,d)))}}return ne.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Bi.resolve(e.extensions||[],new Map),i=e.doc instanceof Z?e.doc:Z.of((e.doc||"").split(t.staticFacet(ne.lineSeparator)||mn)),l=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return is(l,i.length),t.staticFacet(vn)||(l=l.asSingle()),new ne(t,i,l,t.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(ne.tabSize)}get lineBreak(){return this.facet(ne.lineSeparator)||`
5
+ `}get readOnly(){return this.facet(hs)}phrase(e,...t){for(let i of this.facet(ne.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let s=+(l||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let s of this.facet(os))for(let a of s(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){return Zd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),s=this.charCategorizer(e),a=e-i,r=e-i;for(;a>0;){let d=Ge(t,a,!1);if(s(t.slice(d,a))!=Xe.Word)break;a=d}for(;r<l;){let d=Ge(t,r);if(s(t.slice(r,d))!=Xe.Word)break;r=d}return a==r?null:H.range(a+i,r+i)}}ne.allowMultipleSelections=vn,ne.tabSize=G.define({combine:o=>o.length?o[0]:4}),ne.lineSeparator=as,ne.readOnly=hs,ne.phrases=G.define({compare(o,e){let t=Object.keys(o),i=Object.keys(e);return t.length==i.length&&t.every(l=>o[l]==e[l])}}),ne.languageData=os,ne.changeFilter=rs,ne.transactionFilter=ds,ne.transactionExtender=cs,Ni.reconfigure=he.define();class Ot{eq(e){return this==e}range(e,t=e){return Gt.create(e,t,this)}}Ot.prototype.startSide=Ot.prototype.endSide=0,Ot.prototype.point=!1,Ot.prototype.mapMode=Oe.TrackDel;class Gt{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Gt(e,t,i)}}function Nn(o,e){return o.from-e.from||o.value.startSide-e.value.startSide}class Bn{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let s=i?this.to:this.from;for(let a=l,r=s.length;;){if(a==r)return a;let d=a+r>>1,h=s[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==a)return h>=0?a:r;h>=0?r=d:a=d+1}}between(e,t,i,l){for(let s=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,s);s<a;s++)if(l(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],l=[],s=[],a=-1,r=-1;for(let d=0;d<this.value.length;d++){let h=this.value[d],f=this.from[d]+e,c=this.to[d]+e,u,m;if(f==c){let b=t.mapPos(f,h.startSide,h.mapMode);if(b==null||(u=m=b,h.startSide!=h.endSide&&(m=t.mapPos(f,h.endSide),m<u)))continue}else if(u=t.mapPos(f,h.startSide),m=t.mapPos(c,h.endSide),u>m||u==m&&h.startSide>0&&h.endSide<=0)continue;(m-u||h.endSide-h.startSide)<0||(a<0&&(a=u),h.point&&(r=Math.max(r,m-u)),i.push(h),l.push(u-a),s.push(m-a))}return{mapped:i.length?new Bn(l,s,i,r):null,pos:a}}}class oe{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new oe(e,t,i,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:l=0,filterTo:s=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Nn)),this.isEmpty)return t.length?oe.of(t):this;let r=new ms(this,null,-1).goto(0),d=0,h=[],f=new Vi;for(;r.value||d<t.length;)if(d<t.length&&(r.from-t[d].from||r.startSide-t[d].value.startSide)>=0){let c=t[d++];f.addInner(c.from,c.to,c.value)||h.push(c)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!a||l>this.chunkEnd(r.chunkIndex)||s<this.chunkPos[r.chunkIndex])&&f.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!a||l>r.to||s<r.from||a(r.from,r.to,r.value))&&(f.addInner(r.from,r.to,r.value)||h.push(Gt.create(r.from,r.to,r.value))),r.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?oe.empty:this.nextLayer.update({add:h,filter:a,filterFrom:l,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let a=0;a<this.chunk.length;a++){let r=this.chunkPos[a],d=this.chunk[a],h=e.touchesRange(r,r+d.length);if(h===!1)l=Math.max(l,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(h===!0){let{mapped:f,pos:c}=d.map(r,e);f&&(l=Math.max(l,f.maxPoint),t.push(f),i.push(c))}}let s=this.nextLayer.map(e);return t.length==0?s:new oe(i,t,s||oe.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let s=this.chunkPos[l],a=this.chunk[l];if(t>=s&&e<=s+a.length&&a.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Yt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Yt.from(e).goto(t)}static compare(e,t,i,l,s=-1){let a=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),r=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),d=ps(a,r,i),h=new Xt(a,d,s),f=new Xt(r,d,s);i.iterGaps((c,u,m)=>gs(h,c,f,u,m,l)),i.empty&&i.length==0&&gs(h,0,f,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let s=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0),a=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(s.length!=a.length)return!1;if(!s.length)return!0;let r=ps(s,a),d=new Xt(s,r,0).goto(i),h=new Xt(a,r,0).goto(i);for(;;){if(d.to!=h.to||!Vn(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>l)return!0;d.next(),h.next()}}static spans(e,t,i,l,s=-1){let a=new Xt(e,null,s).goto(t),r=t,d=a.openStart;for(;;){let h=Math.min(a.to,i);if(a.point){let f=a.activeForPoint(a.to),c=a.pointFrom<t?f.length+1:a.point.startSide<0?f.length:Math.min(f.length,d);l.point(r,h,a.point,f,c,a.pointRank),d=Math.min(a.openEnd(h),f.length)}else h>r&&(l.span(r,h,a.active,d),d=a.openEnd(h));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 Vi;for(let l of e instanceof Gt?[e]:t?ec(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return oe.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=oe.empty;l=l.nextLayer)t=new oe(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}oe.empty=new oe([],[],null,-1);function ec(o){if(o.length>1)for(let e=o[0],t=1;t<o.length;t++){let i=o[t];if(Nn(e,i)>0)return o.slice().sort(Nn);e=i}return o}oe.empty.nextLayer=oe.empty;class Vi{finishChunk(e){this.chunks.push(new Bn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Vi)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(oe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=oe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function ps(o,e,t){let i=new Map;for(let s of o)for(let a=0;a<s.chunk.length;a++)s.chunk[a].maxPoint<=0&&i.set(s.chunk[a],s.chunkPos[a]);let l=new Set;for(let s of e)for(let a=0;a<s.chunk.length;a++){let r=i.get(s.chunk[a]);r!=null&&(t?t.mapPos(r):r)==s.chunkPos[a]&&!t?.touchesRange(r,r+s.chunk[a].length)&&l.add(s.chunk[a])}return l}class ms{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Yt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let s=0;s<e.length;s++)for(let a=e[s];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&l.push(new ms(a,t,i,s));return l.length==1?l[0]:new Yt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)On(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),On(this.heap,0)}}}function On(o,e){for(let t=o[e];;){let i=(e<<1)+1;if(i>=o.length)break;let l=o[i];if(i+1<o.length&&l.compare(o[i+1])>=0&&(l=o[i+1],i++),t.compare(l)<0)break;o[i]=t,o[e]=l,e=i}}class Xt{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Yt.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){_i(this.active,e),_i(this.activeTo,e),_i(this.activeRank,e),this.minActive=ks(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Mi(this.active,t,i),Mi(this.activeTo,t,l),Mi(this.activeRank,t,s),e&&Mi(e,t,this.cursor.from),this.minActive=ks(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&_i(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function gs(o,e,t,i,l,s){o.goto(e),t.goto(i);let a=i+l,r=i,d=i-e;for(;;){let h=o.to+d-t.to||o.endSide-t.endSide,f=h<0?o.to+d:t.to,c=Math.min(f,a);if(o.point||t.point?o.point&&t.point&&(o.point==t.point||o.point.eq(t.point))&&Vn(o.activeForPoint(o.to),t.activeForPoint(t.to))||s.comparePoint(r,c,o.point,t.point):c>r&&!Vn(o.active,t.active)&&s.compareRange(r,c,o.active,t.active),f>a)break;r=f,h<=0&&o.next(),h>=0&&t.next()}}function Vn(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 _i(o,e){for(let t=e,i=o.length-1;t<i;t++)o[t]=o[t+1];o.pop()}function Mi(o,e,t){for(let i=o.length-1;i>=e;i--)o[i+1]=o[i];o[e]=t}function ks(o,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||o[l].endSide-o[t].endSide)<0&&(t=l,i=e[l]);return t}function tc(o,e,t,i){for(let l=0,s=0;;){if(s>=e)return l;if(l==o.length)break;s+=o.charCodeAt(l)==9?t-s%t:1,l=Ge(o,l)}return i===!0?-1:o.length}const _n="ͼ",bs=typeof Symbol>"u"?"__"+_n:Symbol.for(_n),Mn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ys=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ot{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function s(a,r,d,h){let f=[],c=/^@(\w+)\b/.exec(a[0]),u=c&&c[1]=="keyframes";if(c&&r==null)return d.push(a[0]+";");for(let m in r){let b=r[m];if(/&/.test(m))s(m.split(/,\s*/).map(y=>a.map(k=>y.replace(/&/,k))).reduce((y,k)=>y.concat(k)),b,d);else if(b&&typeof b=="object"){if(!c)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(l(m),b,f,u)}else b!=null&&f.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+b+";")}(f.length||u)&&d.push((i&&!c&&!h?a.map(i):a).join(", ")+" {"+f.join(" ")+"}")}for(let a in e)s(l(a),e[a],this.rules)}getRules(){return this.rules.join(`
6
+ `)}static newName(){let e=ys[bs]||1;return ys[bs]=e+1,_n+e.toString(36)}static mount(e,t,i){let l=e[Mn],s=i&&i.nonce;l?s&&l.setNonce(s):l=new ic(e,s),l.mount(Array.isArray(t)?t:[t],e)}}let ws=new Map;class ic{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let s=ws.get(i);if(s)return e[Mn]=s;this.sheet=new l.CSSStyleSheet,ws.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Mn]=this}mount(e,t){let i=this.sheet,l=0,s=0;for(let a=0;a<e.length;a++){let r=e[a],d=this.modules.indexOf(r);if(d<s&&d>-1&&(this.modules.splice(d,1),s--,d=-1),d==-1){if(this.modules.splice(s++,0,r),i)for(let h=0;h<r.rules.length;h++)i.insertRule(r.rules[h],l++)}else{for(;s<d;)l+=this.modules[s++].rules.length;l+=r.rules.length,s++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let 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 Vt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Tn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pe=0;pe<10;pe++)Vt[48+pe]=Vt[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Vt[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Vt[pe]=String.fromCharCode(pe+32),Tn[pe]=String.fromCharCode(pe);for(var An in Vt)Tn.hasOwnProperty(An)||(Tn[An]=Vt[An]);function Jt(o){let e;return o.nodeType==11?e=o.getSelection?o:o.ownerDocument:e=o,e.getSelection()}function En(o,e){return e?o==e||o.contains(e.nodeType!=1?e.parentNode:e):!1}function nc(o){let e=o.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ti(o,e){if(!e.anchorNode)return!1;try{return En(o,e.anchorNode)}catch{return!1}}function Zt(o){return o.nodeType==3?yt(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function ei(o,e,t,i){return t?xs(o,e,t,i,-1)||xs(o,e,t,i,1):!1}function bt(o){for(var e=0;;e++)if(o=o.previousSibling,!o)return e}function Ai(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function xs(o,e,t,i,l){for(;;){if(o==t&&e==i)return!0;if(e==(l<0?0:Je(o))){if(o.nodeName=="DIV")return!1;let s=o.parentNode;if(!s||s.nodeType!=1)return!1;e=bt(o)+(l<0?0:1),o=s}else if(o.nodeType==1){if(o=o.childNodes[e+(l<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;e=l<0?Je(o):0}else return!1}}function Je(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function Ei(o,e){let t=e?o.left:o.right;return{left:t,right:t,top:o.top,bottom:o.bottom}}function lc(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 vs(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 sc(o,e,t,i,l,s,a,r){let d=o.ownerDocument,h=d.defaultView||window;for(let f=o,c=!1;f&&!c;)if(f.nodeType==1){let u,m=f==d.body,b=1,y=1;if(m)u=lc(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let w=f.getBoundingClientRect();({scaleX:b,scaleY:y}=vs(f,w)),u={left:w.left,right:w.left+f.clientWidth*b,top:w.top,bottom:w.top+f.clientHeight*y}}let k=0,v=0;if(l=="nearest")e.top<u.top?(v=-(u.top-e.top+a),t>0&&e.bottom>u.bottom+v&&(v=e.bottom-u.bottom+v+a)):e.bottom>u.bottom&&(v=e.bottom-u.bottom+a,t<0&&e.top-v<u.top&&(v=-(u.top+v-e.top+a)));else{let w=e.bottom-e.top,O=u.bottom-u.top;v=(l=="center"&&w<=O?e.top+w/2-O/2:l=="start"||l=="center"&&t<0?e.top-a:e.bottom-O+a)-u.top}if(i=="nearest"?e.left<u.left?(k=-(u.left-e.left+s),t>0&&e.right>u.right+k&&(k=e.right-u.right+k+s)):e.right>u.right&&(k=e.right-u.right+s,t<0&&e.left<u.left+k&&(k=-(u.left+k-e.left+s))):k=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-s:e.right-(u.right-u.left)+s)-u.left,k||v)if(m)h.scrollBy(k,v);else{let w=0,O=0;if(v){let g=f.scrollTop;f.scrollTop+=v/y,O=(f.scrollTop-g)*y}if(k){let g=f.scrollLeft;f.scrollLeft+=k/b,w=(f.scrollLeft-g)*b}e={left:e.left-w,top:e.top-O,right:e.right-w,bottom:e.bottom-O},w&&Math.abs(w-k)<1&&(i="nearest"),O&&Math.abs(O-v)<1&&(l="nearest")}if(m)break;f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function oc(o){let e=o.ownerDocument,t,i;for(let l=o.parentNode;l&&!(l==e.body||t&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=l),!t&&l.scrollWidth>l.clientWidth&&(t=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:t,y:i}}class ac{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?Je(t):0),i,Math.min(e.focusOffset,i?Je(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let _t=null;function Cs(o){if(o.setActive)return o.setActive();if(_t)return o.focus(_t);let e=[];for(let t=o;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(o.focus(_t==null?{get preventScroll(){return _t={preventScroll:!0},!0}}:void 0),!_t){_t=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],s=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=s&&(i.scrollLeft=s)}}}let Ss;function yt(o,e,t=e){let i=Ss||(Ss=document.createRange());return i.setEnd(o,t),i.setStart(o,e),i}function Mt(o,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let s=new KeyboardEvent("keydown",l);s.synthetic=!0,o.dispatchEvent(s);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,o.dispatchEvent(a),s.defaultPrevented||a.defaultPrevented}function rc(o){for(;o;){if(o&&(o.nodeType==9||o.nodeType==11&&o.host))return o;o=o.assignedSlot||o.parentNode}return null}function Ns(o){for(;o.attributes.length;)o.removeAttributeNode(o.attributes[0])}function dc(o,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Je(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Je(t))}else{if(t==o)return!0;i=bt(t),t=t.parentNode}}function Bs(o){return o.scrollTop>Math.max(1,o.scrollHeight-o.clientHeight-4)}function Os(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=Je(t)}else if(t.parentNode&&!Ai(t))i=bt(t),t=t.parentNode;else return null}}function Vs(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&&!Ai(t))i=bt(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,bt(e),t)}static after(e,t){return new we(e.parentNode,bt(e)+1,t)}}const In=[];class le{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,l=null,s;for(let a of this.children){if(a.flags&7){if(!a.dom&&(s=l?l.nextSibling:i.firstChild)){let r=le.get(s);(!r||!r.parent&&r.canReuseDOM(a))&&a.reuseDOM(s)}a.sync(e,t),a.flags&=-8}if(s=l?l.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&s!=a.dom&&(t.written=!0),a.dom.parentNode==i)for(;s&&s!=a.dom;)s=_s(s);else i.insertBefore(a.dom,s);l=a.dom}for(s=l?l.nextSibling:i.firstChild,s&&t&&t.node==i&&(t.written=!0);s;)s=_s(s)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let l=Je(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;l==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?l=-1:l=1),e=s}l<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!le.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,s=0;;l++){let a=this.children[l];if(a.dom==i)return s;s+=a.length+a.breakAfter}}domBoundsAround(e,t,i=0){let l=-1,s=-1,a=-1,r=-1;for(let d=0,h=i,f=i;d<this.children.length;d++){let c=this.children[d],u=h+c.length;if(h<e&&u>t)return c.domBoundsAround(e,t,h);if(u>=e&&l==-1&&(l=d,s=h),h>t&&c.dom.parentNode==this.dom){a=d,r=f;break}f=u,h=u+c.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(l?this.children[l-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=In){this.markDirty();for(let l=e;l<t;l++){let s=this.children[l];s.parent==this&&i.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...i);for(let l=0;l<i.length;l++)i[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ms(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,i,l,s,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}}le.prototype.breakAfter=0;function _s(o){let e=o.nextSibling;return o.parentNode.removeChild(o),e}class Ms{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Ts(o,e,t,i,l,s,a,r,d){let{children:h}=o,f=h.length?h[e]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:a;if(!(e==i&&f&&!a&&!u&&s.length<2&&f.merge(t,l,s.length?c:null,t==0,r,d))){if(i<h.length){let m=h[i];m&&(l<m.length||m.breakAfter&&c?.breakAfter)?(e==i&&(m=m.split(l),l=0),!u&&c&&m.merge(0,l,c,!0,0,d)?s[s.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,d),s.push(m))):m?.breakAfter&&(c?c.breakAfter=1:a=1),i++}for(f&&(f.breakAfter=a,t>0&&(!a&&s.length&&f.merge(t,f.length,s[0],!1,r,0)?f.breakAfter=s.shift().breakAfter:(t<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(t,f.length,null,!1,r,0),e++));e<i&&s.length;)if(h[i-1].become(s[s.length-1]))i--,s.pop(),d=s.length?0:r;else if(h[e].become(s[0]))e++,s.shift(),r=s.length?0:d;else break;!s.length&&e&&i<h.length&&!h[e-1].breakAfter&&h[i].merge(0,0,h[e-1],!1,r,d)&&e--,(e<i||s.length)&&o.replaceChildren(e,i,s)}}function As(o,e,t,i,l,s){let a=o.childCursor(),{i:r,off:d}=a.findPos(t,1),{i:h,off:f}=a.findPos(e,-1),c=e-t;for(let u of i)c+=u.length;o.length+=c,Ts(o,h,f,r,d,i,0,l,s)}let Ne=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Dn=typeof document<"u"?document:{documentElement:{style:{}}};const Pn=/Edge\/(\d+)/.exec(Ne.userAgent),Es=/MSIE \d/.test(Ne.userAgent),Fn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ne.userAgent),Ii=!!(Es||Fn||Pn),Is=!Ii&&/gecko\/(\d+)/i.test(Ne.userAgent),$n=!Ii&&/Chrome\/(\d+)/.exec(Ne.userAgent),Ds="webkitFontSmoothing"in Dn.documentElement.style,Ps=!Ii&&/Apple Computer/.test(Ne.vendor),Fs=Ps&&(/Mobile\/\w+/.test(Ne.userAgent)||Ne.maxTouchPoints>2);var W={mac:Fs||/Mac/.test(Ne.platform),windows:/Win/.test(Ne.platform),linux:/Linux|X11/.test(Ne.platform),ie:Ii,ie_version:Es?Dn.documentMode||6:Fn?+Fn[1]:Pn?+Pn[1]:0,gecko:Is,gecko_version:Is?+(/Firefox\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,chrome:!!$n,chrome_version:$n?+$n[1]:0,ios:Fs,android:/Android\b/.test(Ne.userAgent),webkit:Ds,safari:Ps,webkit_version:Ds?+(/\bAppleWebKit\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,tabSize:Dn.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const cc=256;class De extends le{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 De)||this.length-(t-e)+i.length>cc||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 De(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 hc(this.dom,e,t)}}class Ze extends le{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let l of t)l.setParent(this)}setAttrs(e){if(Ns(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,l,s,a){return i&&(!(i instanceof Ze&&i.mark.eq(this.mark))||e&&s<=0||t<this.length&&a<=0)?!1:(As(this,e,t,i?i.children.slice():[],s-1,a-1),this.markDirty(),!0)}split(e){let t=[],i=0,l=-1,s=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=s),i=d,s++}let a=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new Ze(this.mark,t,a)}domAtPos(e){return $s(this,e)}coordsAt(e,t){return Ls(this,e,t)}}function hc(o,e,t){let i=o.nodeValue.length;e>i&&(e=i);let l=e,s=e,a=0;e==0&&t<0||e==i&&t>=0?W.chrome||W.gecko||(e?(l--,a=1):s<i&&(s++,a=-1)):t<0?l--:s<i&&s++;let r=yt(o,l,s).getClientRects();if(!r.length)return null;let d=r[(a?a<0:t>=0)?0:r.length-1];return W.safari&&!a&&d.width==0&&(d=Array.prototype.find.call(r,h=>h.width)||d),a?Ei(d,a<0):d||null}class wt extends le{static create(e,t,i){return new wt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=wt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,l,s,a){return i&&(!(i instanceof wt)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e instanceof wt&&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 Z.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):Z.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 l=this.dom.getClientRects(),s=null;if(!l.length)return null;let a=this.side?this.side<0:e>0;for(let r=a?l.length-1:0;s=l[r],!(e>0?r==0:r==l.length-1||s.top<s.bottom);r+=a?-1:1);return Ei(s,!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 Tt extends le{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Tt&&e.side==this.side}split(){return new Tt(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 Z.empty}get isHidden(){return!0}}De.prototype.children=wt.prototype.children=Tt.prototype.children=In;function $s(o,e){let t=o.dom,{children:i}=o,l=0;for(let s=0;l<i.length;l++){let a=i[l],r=s+a.length;if(!(r==s&&a.getSide()<=0)){if(e>s&&e<r&&a.dom.parentNode==t)return a.domAtPos(e-s);if(e<=s)break;s=r}}for(let s=l;s>0;s--){let a=i[s-1];if(a.dom.parentNode==t)return a.domAtPos(a.length)}for(let s=l;s<i.length;s++){let a=i[s];if(a.dom.parentNode==t)return a.domAtPos(0)}return new we(t,0)}function Rs(o,e,t){let i,{children:l}=o;t>0&&e instanceof Ze&&l.length&&(i=l[l.length-1])instanceof Ze&&i.mark.eq(e.mark)?Rs(i,e.children[0],t-1):(l.push(e),e.setParent(o)),o.length+=e.length}function Ls(o,e,t){let i=null,l=-1,s=null,a=-1;function r(h,f){for(let c=0,u=0;c<h.children.length&&u<=f;c++){let m=h.children[c],b=u+m.length;b>=f&&(m.children.length?r(m,f-u):(!s||s.isHidden&&t>0)&&(b>f||u==b&&m.getSide()>0)?(s=m,a=f-u):(u<f||u==b&&m.getSide()<0&&!m.isHidden)&&(i=m,l=f-u)),u=b}}r(o,e);let d=(t<0?i:s)||i||s;return d?d.coordsAt(Math.max(0,d==i?l:a),t):fc(o)}function fc(o){let e=o.dom.lastChild;if(!e)return o.dom.getBoundingClientRect();let t=Zt(e);return t[t.length-1]||null}function Rn(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 js=Object.create(null);function Di(o,e,t){if(o==e)return!0;o||(o=js),e||(e=js);let i=Object.keys(o),l=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(l.indexOf(s)==-1||o[s]!==e[s]))return!1;return!0}function Ln(o,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?o.style.cssText="":o.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?o.style.cssText=t[l]:o.setAttribute(l,t[l]));return i}function uc(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 jn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var ze=function(o){return o[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o}(ze||(ze={}));class xe extends Ot{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new ti(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new at(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:s,end:a}=zs(e,t);i=(s?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new at(e,i,l,t,e.widget||null,!0)}static line(e){return new ii(e)}static set(e,t=!1){return oe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}xe.none=oe.empty;class ti extends xe{constructor(e){let{start:t,end:i}=zs(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof ti&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Di(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ti.prototype.point=!1;class ii extends xe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ii&&this.spec.class==e.spec.class&&Di(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}ii.prototype.mapMode=Oe.TrackBefore,ii.prototype.point=!0;class at extends xe{constructor(e,t,i,l,s,a){super(t,i,s,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?Oe.TrackBefore:Oe.TrackAfter:Oe.TrackDel}get type(){return this.startSide!=this.endSide?ze.WidgetRange:this.startSide<=0?ze.WidgetBefore:ze.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof at&&pc(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)}}at.prototype.point=!0;function zs(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 pc(o,e){return o==e||!!(o&&e&&o.compare(e))}function zn(o,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=o?t[l]=Math.max(t[l],e):t.push(o,e)}class ce extends le{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,l,s,a){if(i){if(!(i instanceof ce))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),As(this,e,t,i?i.children.slice():[],s,a),!0}split(e){let t=new ce;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:l}=this.childPos(e);l&&(t.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let s=i;s<this.children.length;s++)t.append(this.children[s],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Di(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Rs(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Rn(t,this.attrs||{})),i&&(this.attrs=Rn({class:i},this.attrs||{}))}domAtPos(e){return $s(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Ns(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Ln(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let l=this.dom.lastChild;for(;l&&le.get(l)instanceof Ze;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=le.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!W.ios||!this.children.some(s=>s instanceof De))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof De)||/[^ -~]/.test(i.text))return null;let l=Zt(i.dom);if(l.length!=1)return null;e+=l[0].width,t=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Ls(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-l.lineHeight)<2&&l.textHeight<s){let a=(s-l.textHeight)/2;return{top:i.top+a,bottom:i.bottom-a,left:i.left,right:i.left}}}return i}become(e){return e instanceof ce&&this.children.length==0&&e.children.length==0&&Di(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,l=0;i<e.children.length;i++){let s=e.children[i],a=l+s.length;if(a>=t){if(s instanceof ce)return s;if(a>t)break}l=a+s.breakAfter}return null}}class et extends le{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,l,s,a){return i&&(!(i instanceof et)||!this.widget.compare(i.widget)||e>0&&s<=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 et(this.widget,t,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return In}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Z.empty}domBoundsAround(){return null}become(e){return e instanceof et&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);return i||(this.widget instanceof qn?null:Ei(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:i}=this.deco;return t==i?!1:e<0?t<0:i>0}}class qn extends jn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class ni{constructor(e,t,i,l){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof et&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ce),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Pi(new Tt(-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 et)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:s,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=s,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Pi(new De(this.text.slice(this.textOff,this.textOff+l)),t),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,t,i,l){this.buildText(t-e,i,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,i,l,s,a){if(this.disallowBlockEffectsFor[a]&&i instanceof at){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 at)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new et(i.widget||At.block,r,i));else{let d=wt.create(i.widget||At.inline,r,r?0:i.startSide),h=this.atCursorPos&&!d.isEditable&&s<=l.length&&(e<t||i.startSide>0),f=!d.isEditable&&(e<t||s>l.length||i.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),h&&(c.append(Pi(new Tt(1),l),s),s=l.length+Math.max(0,s-l.length)),c.append(Pi(d,l),s),this.atCursorPos=f,this.pendingBuffer=f?e<t||s>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,i,l,s){let a=new ni(e,t,i,s);return a.openEnd=oe.spans(l,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Pi(o,e){for(let t of e)o=new Ze(t,[o],o.length);return o}class At extends jn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}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 xt=me.LTR,Un=me.RTL;function qs(o){let e=[];for(let t=0;t<o.length;t++)e.push(1<<+o[t]);return e}const mc=qs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),gc=qs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Wn=Object.create(null),qe=[];for(let o of["()","[]","{}"]){let e=o.charCodeAt(0),t=o.charCodeAt(1);Wn[e]=t,Wn[t]=-e}function Us(o){return o<=247?mc[o]:1424<=o&&o<=1524?2:1536<=o&&o<=1785?gc[o-1536]:1774<=o&&o<=2220?4:8192<=o&&o<=8204?256:64336<=o&&o<=65023?4:1}const kc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class rt{get dir(){return this.level%2?Un:xt}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,l){let s=-1;for(let a=0;a<e.length;a++){let r=e[a];if(r.from<=t&&r.to>=t){if(r.level==i)return a;(s<0||(l!=0?l<0?r.from<t:r.to>t:e[s].level>r.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function Ws(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++){let i=o[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!Ws(i.inner,l.inner))return!1}return!0}const se=[];function bc(o,e,t,i,l){for(let s=0;s<=i.length;s++){let a=s?i[s-1].to:e,r=s<i.length?i[s].from:t,d=s?256:l;for(let h=a,f=d,c=d;h<r;h++){let u=Us(o.charCodeAt(h));u==512?u=f:u==8&&c==4&&(u=16),se[h]=u==4?2:u,u&7&&(c=u),f=u}for(let h=a,f=d,c=d;h<r;h++){let u=se[h];if(u==128)h<r-1&&f==se[h+1]&&f&24?u=se[h]=f:se[h]=256;else if(u==64){let m=h+1;for(;m<r&&se[m]==64;)m++;let b=h&&f==8||m<t&&se[m]==8?c==1?1:8:256;for(let y=h;y<m;y++)se[y]=b;h=m-1}else u==8&&c==1&&(se[h]=1);f=u,u&7&&(c=u)}}}function yc(o,e,t,i,l){let s=l==1?2:1;for(let a=0,r=0,d=0;a<=i.length;a++){let h=a?i[a-1].to:e,f=a<i.length?i[a].from:t;for(let c=h,u,m,b;c<f;c++)if(m=Wn[u=o.charCodeAt(c)])if(m<0){for(let y=r-3;y>=0;y-=3)if(qe[y+1]==-m){let k=qe[y+2],v=k&2?l:k&4?k&1?s:l:0;v&&(se[c]=se[qe[y]]=v),r=y;break}}else{if(qe.length==189)break;qe[r++]=c,qe[r++]=u,qe[r++]=d}else if((b=se[c])==2||b==1){let y=b==l;d=y?0:1;for(let k=r-3;k>=0;k-=3){let v=qe[k+2];if(v&2)break;if(y)qe[k+2]|=2;else{if(v&4)break;qe[k+2]|=4}}}}}function wc(o,e,t,i){for(let l=0,s=i;l<=t.length;l++){let a=l?t[l-1].to:o,r=l<t.length?t[l].from:e;for(let d=a;d<r;){let h=se[d];if(h==256){let f=d+1;for(;;)if(f==r){if(l==t.length)break;f=t[l++].to,r=l<t.length?t[l].from:e}else if(se[f]==256)f++;else break;let c=s==1,u=(f<e?se[f]:i)==1,m=c==u?c?1:2:i;for(let b=f,y=l,k=y?t[y-1].to:o;b>d;)b==k&&(b=t[--y].from,k=y?t[y-1].to:o),se[--b]=m;d=f}else s=h,d++}}}function Hn(o,e,t,i,l,s,a){let r=i%2?2:1;if(i%2==l%2)for(let d=e,h=0;d<t;){let f=!0,c=!1;if(h==s.length||d<s[h].from){let y=se[d];y!=r&&(f=!1,c=y==16)}let u=!f&&r==1?[]:null,m=f?i:i+1,b=d;e:for(;;)if(h<s.length&&b==s[h].from){if(c)break e;let y=s[h];if(!f)for(let k=y.to,v=h+1;;){if(k==t)break e;if(v<s.length&&s[v].from==k)k=s[v++].to;else{if(se[k]==r)break e;break}}if(h++,u)u.push(y);else{y.from>d&&a.push(new rt(d,y.from,m));let k=y.direction==xt!=!(m%2);Kn(o,k?i+1:i,l,y.inner,y.from,y.to,a),d=y.to}b=y.to}else{if(b==t||(f?se[b]!=r:se[b]==r))break;b++}u?Hn(o,d,b,i+1,l,u,a):d<b&&a.push(new rt(d,b,m)),d=b}else for(let d=t,h=s.length;d>e;){let f=!0,c=!1;if(!h||d>s[h-1].to){let y=se[d-1];y!=r&&(f=!1,c=y==16)}let u=!f&&r==1?[]:null,m=f?i:i+1,b=d;e:for(;;)if(h&&b==s[h-1].to){if(c)break e;let y=s[--h];if(!f)for(let k=y.from,v=h;;){if(k==e)break e;if(v&&s[v-1].to==k)k=s[--v].from;else{if(se[k-1]==r)break e;break}}if(u)u.push(y);else{y.to<d&&a.push(new rt(y.to,d,m));let k=y.direction==xt!=!(m%2);Kn(o,k?i+1:i,l,y.inner,y.from,y.to,a),d=y.from}b=y.from}else{if(b==e||(f?se[b-1]!=r:se[b-1]==r))break;b--}u?Hn(o,b,d,i+1,l,u,a):b<d&&a.push(new rt(b,d,m)),d=b}}function Kn(o,e,t,i,l,s,a){let r=e%2?2:1;bc(o,l,s,i,r),yc(o,l,s,i,r),wc(l,s,i,r),Hn(o,l,s,e,t,i,a)}function xc(o,e,t){if(!o)return[new rt(0,0,e==Un?1:0)];if(e==xt&&!t.length&&!kc.test(o))return Hs(o.length);if(t.length)for(;o.length>se.length;)se[se.length]=256;let i=[],l=e==xt?0:1;return Kn(o,l,l,t,0,o.length,i),i}function Hs(o){return[new rt(0,o,0)]}let Ks="";function vc(o,e,t,i,l){var s;let a=i.head-o.from,r=rt.find(e,a,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),d=e[r],h=d.side(l,t);if(a==h){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;d=e[r=u],a=d.side(!l,t),h=d.side(l,t)}let f=Ge(o.text,a,d.forward(l,t));(f<d.from||f>d.to)&&(f=h),Ks=o.text.slice(Math.min(a,f),Math.max(a,f));let c=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return c&&f==h&&c.level+(l?0:1)<d.level?H.cursor(c.side(!l,t)+o.from,c.forward(l,t)?1:-1,c.level):H.cursor(f+o.from,d.forward(l,t)?-1:1,d.level)}function Cc(o,e,t){for(let i=e;i<t;i++){let l=Us(o.charCodeAt(i));if(l==1)return xt;if(l==2||l==4)return Un}return xt}const Qs=G.define(),Gs=G.define(),Ys=G.define(),Xs=G.define(),Qn=G.define(),Js=G.define(),Zs=G.define(),Gn=G.define(),Yn=G.define(),eo=G.define({combine:o=>o.some(e=>e)}),Sc=G.define({combine:o=>o.some(e=>e)}),to=G.define();class Et{constructor(e,t="nearest",i="nearest",l=5,s=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=s,this.isSnapshot=a}map(e){return e.empty?this:new Et(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 Et(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Fi=he.define({map:(o,e)=>o.map(e)}),io=he.define();function Ue(o,e,t){let i=o.facet(Xs);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const dt=G.define({combine:o=>o.length?o[0]:!0});let Nc=0;const li=G.define();class It{constructor(e,t,i,l,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:s,decorations:a}=t||{};return new It(Nc++,e,i,l,r=>{let d=[li.of(r)];return a&&d.push(si.of(h=>{let f=h.plugin(r);return f?a(f):xe.none})),s&&d.push(s(r)),d})}static fromClass(e,t){return It.define(i=>new e(i),t)}}class Xn{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Ue(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){Ue(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){Ue(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const no=G.define(),Jn=G.define(),si=G.define(),lo=G.define(),Zn=G.define(),so=G.define();function oo(o,e){let t=o.state.facet(so);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(o):s),l=[];return oe.spans(i,e.from,e.to,{point(){},span(s,a,r,d){let h=s-e.from,f=a-e.from,c=l;for(let u=r.length-1;u>=0;u--,d--){let m=r[u].spec.bidiIsolate,b;if(m==null&&(m=Cc(e.text,h,f)),d>0&&c.length&&(b=c[c.length-1]).to==h&&b.direction==m)b.to=f,c=b.inner;else{let y={from:h,to:f,direction:m,inner:[]};c.push(y),c=y.inner}}}}),l}const ao=G.define();function ro(o){let e=0,t=0,i=0,l=0;for(let s of o.state.facet(ao)){let a=s(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&&(l=Math.max(l,a.bottom)))}return{left:e,right:t,top:i,bottom:l}}const oi=G.define();class Ae{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}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 l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,s=0,a=0,r=0;;l++){let d=l==e.length?null:e[l],h=a-r,f=d?d.fromB:1e9;for(;s<t.length&&t[s]<f;){let c=t[s],u=t[s+1],m=Math.max(r,c),b=Math.min(f,u);if(m<=b&&new Ae(m+h,b+h,m,b).addToSet(i),u>f)break;s+=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 s of i)this.changes=this.changes.compose(s.changes);let l=[];this.changes.iterChangedRanges((s,a,r,d)=>l.push(new Ae(s,a,r,d))),this.changedRanges=l}static create(e,t,i){return new $i(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class co extends le{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=xe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ce],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new 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:h,toA:f})=>f<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!Ac(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let s=l>-1?Oc(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;i=new Ae(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(W.ie||W.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,r=this.updateDeco(),d=Mc(a,r,e.changes);return i=Ae.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=W.chrome||W.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||l.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.children)a instanceof et&&a.widget instanceof qn&&s.push(a.dom);l.updateGaps(s)}updateChildren(e,t,i){let l=i?i.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let a=l.length-1;;a--){let r=a>=0?l[a]:null;if(!r)break;let{fromA:d,toA:h,fromB:f,toB:c}=r,u,m,b,y;if(i&&i.range.fromB<c&&i.range.toB>f){let g=ni.build(this.view.state.doc,f,i.range.fromB,this.decorations,this.dynamicDecorationMap),p=ni.build(this.view.state.doc,i.range.toB,c,this.decorations,this.dynamicDecorationMap);m=g.breakAtStart,b=g.openStart,y=p.openEnd;let B=this.compositionView(i);p.breakAtStart?B.breakAfter=1:p.content.length&&B.merge(B.length,B.length,p.content[0],!1,p.openStart,0)&&(B.breakAfter=p.content[0].breakAfter,p.content.shift()),g.content.length&&B.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),u=g.content.concat(B).concat(p.content)}else({content:u,breakAtStart:m,openStart:b,openEnd:y}=ni.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:k,off:v}=s.findPos(h,1),{i:w,off:O}=s.findPos(d,-1);Ts(this,w,O,k,v,u,m,b,y)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(io)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new De(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new Ze(l,[t],t.length);let i=new ce;return i.append(t,0),i}fixCompositionDOM(e){let t=(s,a)=>{a.flags|=8|(a.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(a);let r=le.get(s);r&&r!=a&&(r.dom=null),a.setDOM(s)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];t(e.line,l);for(let s=e.marks.length-1;s>=-1;s--)i=l.childPos(i.off,1),l=l.children[i.i],t(s>=0?e.marks[s].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,s=!l&&Ti(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||t||s))return;let a=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&Bc(d)){let c=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(c,d.node.childNodes[d.offset]||null)),d=h=new we(c,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!ei(d.node,d.offset,f.anchorNode,f.anchorOffset)||!ei(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(f.focusNode)&&Tc(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Jt(this.view.root);if(c)if(r.empty){if(W.gecko){let u=Vc(d.node,d.offset);if(u&&u!=3){let m=(u==1?Os:Vs)(d.node,d.offset);m&&(d=new we(m.node,m.offset))}}c.collapse(d.node,d.offset),r.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=r.bidiLevel)}else if(c.extend){c.collapse(d.node,d.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([d,h]=[h,d]),u.setEnd(h.node,h.offset),u.setStart(d.node,d.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new we(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new we(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ei(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Jt(e.root),{anchorNode:l,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=ce.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),h=this.coordsAt(t.head,1);if(!d||!h||d.bottom>h.top)return;let f=this.domAtPos(t.head+t.assoc);i.collapse(f.node,f.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&i.collapse(l,s)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let l=e.offset;!i&&l<t.childNodes.length;l++){let s=le.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let s=le.get(t.childNodes[l]);s instanceof ce&&(i=s.domAtPos(s.length))}return i?new we(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=le.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(i<l.length||l instanceof ce)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,l=0;for(let s=this.length,a=this.children.length-1;a>=0;a--){let r=this.children[a],d=s-r.breakAfter,h=d-r.length;if(d<e)break;if(h<=e&&(h<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof ce&&!(i instanceof ce&&t>=0)))i=r,l=h;else if(i&&h==e&&d==e&&r instanceof et&&Math.abs(t)<2){if(r.deco.startSide<0)break;a&&(i=null)}s=h}return i?i.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),l=this.children[t];if(!(l instanceof ce))return null;for(;l.children.length;){let{i:r,off:d}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=d}if(!(l instanceof De))return null;let s=Ge(l.text,i);if(s==i)return null;let a=yt(l.dom,i,s).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:l}=e,s=this.view.contentDOM.clientWidth,a=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let h=0,f=0;f<this.children.length;f++){let c=this.children[f],u=h+c.length;if(u>l)break;if(h>=i){let m=c.dom.getBoundingClientRect();if(t.push(m.height),a){let b=c.dom.lastChild,y=b?Zt(b):[];if(y.length){let k=y[y.length-1],v=d?k.right-m.left:m.right-k.left;v>r&&(r=v,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?me.RTL:me.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ce){let a=s.measureTextSize();if(a)return a}let e=document.createElement("div"),t,i,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Zt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,l=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ms(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let s=l==t.viewports.length?null:t.viewports[l],a=s?s.from-1:this.length;if(a>i){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(xe.replace({widget:new qn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!s)break;i=s.to+1}return xe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(si).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,l=this.view.state.facet(lo).map((s,a)=>{let r=typeof s=="function";return r&&(i=!0),r?s(this.view):s});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(oe.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(to))try{if(h(this.view,e.range,e))return!0}catch(f){Ue(this.view.state,f,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let s=ro(this.view),a={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;sc(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 Bc(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 ho(o,e){let t=o.observer.selectionRange;if(!t.focusNode)return null;let i=Os(t.focusNode,t.focusOffset),l=Vs(t.focusNode,t.focusOffset),s=i||l;if(l&&i&&l.node!=i.node){let r=le.get(l.node);if(!r||r instanceof De&&r.text!=l.node.nodeValue)s=l;else if(o.docView.lastCompositionAfterCursor){let d=le.get(i.node);!d||d instanceof De&&d.text!=i.node.nodeValue||(s=l)}}if(o.docView.lastCompositionAfterCursor=s!=i,!s)return null;let a=e-s.offset;return{from:a,to:a+s.node.nodeValue.length,node:s.node}}function Oc(o,e,t){let i=ho(o,t);if(!i)return null;let{node:l,from:s,to:a}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||o.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,h=new Ae(d.mapPos(s),d.mapPos(a),s,a),f=[];for(let c=l.parentNode;;c=c.parentNode){let u=le.get(c);if(u instanceof Ze)f.push({node:c,deco:u.mark});else{if(u instanceof ce||c.nodeName=="DIV"&&c.parentNode==o.contentDOM)return{range:h,text:l,marks:f,line:c};if(c!=o.contentDOM)f.push({node:c,deco:new ti({inclusive:!0,attributes:uc(c),tagName:c.tagName.toLowerCase()})});else return null}}}function Vc(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 _c=class{constructor(){this.changes=[]}compareRange(e,t){zn(e,t,this.changes)}comparePoint(e,t){zn(e,t,this.changes)}};function Mc(o,e,t){let i=new _c;return oe.compare(o,e,t,i),i.changes}function Tc(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 Ac(o,e){let t=!1;return e&&o.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}function Ec(o,e,t=1){let i=o.charCategorizer(e),l=o.doc.lineAt(e),s=e-l.from;if(l.length==0)return H.cursor(e);s==0?t=1:s==l.length&&(t=-1);let a=s,r=s;t<0?a=Ge(l.text,s,!1):r=Ge(l.text,s);let d=i(l.text.slice(a,r));for(;a>0;){let h=Ge(l.text,a,!1);if(i(l.text.slice(h,a))!=d)break;a=h}for(;r<l.length;){let h=Ge(l.text,r);if(i(l.text.slice(r,h))!=d)break;r=h}return H.range(a+l.from,r+l.from)}function Ic(o,e){return e.left>o?e.left-o:Math.max(0,o-e.right)}function Dc(o,e){return e.top>o?e.top-o:Math.max(0,o-e.bottom)}function el(o,e){return o.top<e.bottom-1&&o.bottom>e.top+1}function fo(o,e){return e<o.top?{top:e,left:o.left,right:o.right,bottom:o.bottom}:o}function uo(o,e){return e>o.bottom?{top:o.top,left:o.left,right:o.right,bottom:e}:o}function tl(o,e,t){let i,l,s,a,r=!1,d,h,f,c;for(let b=o.firstChild;b;b=b.nextSibling){let y=Zt(b);for(let k=0;k<y.length;k++){let v=y[k];l&&el(l,v)&&(v=fo(uo(v,l.bottom),l.top));let w=Ic(e,v),O=Dc(t,v);if(w==0&&O==0)return b.nodeType==3?po(b,e,t):tl(b,e,t);if(!i||a>O||a==O&&s>w){i=b,l=v,s=w,a=O;let g=O?t<v.top?-1:1:w?e<v.left?-1:1:0;r=!g||(g>0?k<y.length-1:k>0)}w==0?t>v.bottom&&(!f||f.bottom<v.bottom)?(d=b,f=v):t<v.top&&(!c||c.top>v.top)&&(h=b,c=v):f&&el(f,v)?f=uo(f,v.bottom):c&&el(c,v)&&(c=fo(c,v.top))}}if(f&&f.bottom>=t?(i=d,l=f):c&&c.top<=t&&(i=h,l=c),!i)return{node:o,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return po(i,u,t);if(r&&i.contentEditable!="false")return tl(i,u,t);let m=Array.prototype.indexOf.call(o.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:o,offset:m}}function po(o,e,t){let i=o.nodeValue.length,l=-1,s=1e9,a=0;for(let r=0;r<i;r++){let d=yt(o,r,r+1).getClientRects();for(let h=0;h<d.length;h++){let f=d[h];if(f.top==f.bottom)continue;a||(a=e-f.left);let c=(f.top>t?f.top-t:t-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&c<s){let u=e>=(f.left+f.right)/2,m=u;if((W.chrome||W.gecko)&&yt(o,r).getBoundingClientRect().left==f.right&&(m=!u),c<=0)return{node:o,offset:r+(m?1:0)};l=r+(m?1:0),s=c}}}return{node:o,offset:l>-1?l:a>0?o.nodeValue.length:0}}function mo(o,e,t,i=-1){var l,s;let a=o.contentDOM.getBoundingClientRect(),r=a.top+o.viewState.paddingTop,d,{docHeight:h}=o.viewState,{x:f,y:c}=e,u=c-r;if(u<0)return 0;if(u>h)return o.state.doc.length;for(let g=o.viewState.heightOracle.textHeight/2,p=!1;d=o.elementAtHeight(u),d.type!=ze.Text;)for(;u=i>0?d.bottom+g:d.top-g,!(u>=0&&u<=h);){if(p)return t?null:0;p=!0,i=-i}c=r+u;let m=d.from;if(m<o.viewport.from)return o.viewport.from==0?0:t?null:go(o,a,d,f,c);if(m>o.viewport.to)return o.viewport.to==o.state.doc.length?o.state.doc.length:t?null:go(o,a,d,f,c);let b=o.dom.ownerDocument,y=o.root.elementFromPoint?o.root:b,k=y.elementFromPoint(f,c);k&&!o.contentDOM.contains(k)&&(k=null),k||(f=Math.max(a.left+1,Math.min(a.right-1,f)),k=y.elementFromPoint(f,c),k&&!o.contentDOM.contains(k)&&(k=null));let v,w=-1;if(k&&((l=o.docView.nearest(k))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let g=b.caretPositionFromPoint(f,c);g&&({offsetNode:v,offset:w}=g)}else if(b.caretRangeFromPoint){let g=b.caretRangeFromPoint(f,c);g&&({startContainer:v,startOffset:w}=g,(!o.contentDOM.contains(v)||W.safari&&Pc(v,w,f)||W.chrome&&Fc(v,w,f))&&(v=void 0))}}if(!v||!o.docView.dom.contains(v)){let g=ce.find(o.docView,m);if(!g)return u>d.top+d.height/2?d.to:d.from;({node:v,offset:w}=tl(g.dom,f,c))}let O=o.docView.nearest(v);if(!O)return null;if(O.isWidget&&((s=O.dom)===null||s===void 0?void 0:s.nodeType)==1){let g=O.dom.getBoundingClientRect();return e.y<g.top||e.y<=g.bottom&&e.x<=(g.left+g.right)/2?O.posAtStart:O.posAtEnd}else return O.localPosFromDOM(v,w)+O.posAtStart}function go(o,e,t,i,l){let s=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((l-t.top-(o.defaultLineHeight-r)*.5)/r);s+=d*o.viewState.heightOracle.lineLength}let a=o.state.sliceDoc(t.from,t.to);return t.from+tc(a,s,o.state.tabSize)}function Pc(o,e,t){let i;if(o.nodeType!=3||e!=(i=o.nodeValue.length))return!1;for(let l=o.nextSibling;l;l=l.nextSibling)if(l.nodeType!=1||l.nodeName!="BR")return!1;return yt(o,i-1,i).getBoundingClientRect().left>t}function Fc(o,e,t){if(e!=0)return!1;for(let l=o;;){let s=l.parentNode;if(!s||s.nodeType!=1||s.firstChild!=l)return!1;if(s.classList.contains("cm-line"))break;l=s}let i=o.nodeType==1?o.getBoundingClientRect():yt(o,0,Math.max(o.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function $c(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==ze.Text))return i}return t}function Rc(o,e,t,i){let l=$c(o,e.head),s=!i||l.type!=ze.Text||!(o.lineWrapping||l.widgetLineBreaks)?null:o.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(s){let a=o.dom.getBoundingClientRect(),r=o.textDirectionAt(l.from),d=o.posAtCoords({x:t==(r==me.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(d!=null)return H.cursor(d,t?-1:1)}return H.cursor(t?l.to:l.from,t?-1:1)}function ko(o,e,t,i){let l=o.state.doc.lineAt(e.head),s=o.bidiSpans(l),a=o.textDirectionAt(l.from);for(let r=e,d=null;;){let h=vc(l,s,a,r,t),f=Ks;if(!h){if(l.number==(t?o.state.doc.lines:1))return r;f=`
8
+ `,l=o.state.doc.line(l.number+(t?1:-1)),s=o.bidiSpans(l),h=o.visualLineSide(l,!t)}if(d){if(!d(f))return r}else{if(!i)return h;d=i(f)}r=h}}function Lc(o,e,t){let i=o.state.charCategorizer(e),l=i(t);return s=>{let a=i(s);return l==Xe.Space&&(l=a),l==a}}function jc(o,e,t,i){let l=e.head,s=t?1:-1;if(l==(t?o.state.doc.length:0))return H.cursor(l,e.assoc);let a=e.goalColumn,r,d=o.contentDOM.getBoundingClientRect(),h=o.coordsAtPos(l,e.assoc||-1),f=o.documentTop;if(h)a==null&&(a=h.left-d.left),r=s<0?h.top:h.bottom;else{let m=o.viewState.lineBlockAt(l);a==null&&(a=Math.min(d.right-d.left,o.defaultCharacterWidth*(l-m.from))),r=(s<0?m.top:m.bottom)+f}let c=d.left+a,u=i??o.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=r+(u+m)*s,y=mo(o,{x:c,y:b},!1,s);if(b<d.top||b>d.bottom||(s<0?y<l:y>l)){let k=o.docView.coordsForChar(y),v=!k||b<k.top?-1:1;return H.cursor(y,v,void 0,a)}}}function Ri(o,e,t){for(;;){let i=0;for(let l of o)l.between(e-1,e+1,(s,a,r)=>{if(e>s&&e<a){let d=i||t||(e-s<a-e?-1:1);e=d<0?s:a,i=d}});if(!i)return e}}function il(o,e,t){let i=Ri(o.state.facet(Zn).map(l=>l(o)),t.from,e.head>t.from?-1:1);return i==t.from?t:H.cursor(i,i<t.from?1:-1)}const ai="￿";class zc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(ne.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ai}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let s=this.text.length;this.readNode(l);let a=l.nextSibling;if(a==t)break;let r=le.get(l),d=le.get(a);(r&&d?r.breakAfter:(r?r.breakAfter:Ai(l))||Ai(a)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>s)&&this.lineBreak(),l=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,l=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,a=1,r;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(r=l.exec(t))&&(s=r.index,a=r[0].length),this.append(t.slice(i,s<0?t.length:s)),s<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=s+a}}readNode(e){if(e.cmIgnore)return;let t=le.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(qc(e,i.node,i.offset)?t:0))}}function qc(o,e,t){for(;;){if(!e||t<Je(e))return!1;if(e==o)return!0;t=bt(e)+1,e=e.parentNode}}class bo{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Uc{constructor(e,t,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,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=s||a?[]:Kc(e),d=new zc(r,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Qc(r,this.bounds.from)}else{let r=e.observer.selectionRange,d=s&&s.node==r.focusNode&&s.offset==r.focusOffset||!En(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),h=a&&a.node==r.anchorNode&&a.offset==r.anchorOffset||!En(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),f=e.viewport;if((W.ios||W.chrome)&&e.state.selection.main.empty&&d!=h&&(f.from>0||f.to<e.state.doc.length)){let c=Math.min(d,h),u=Math.max(d,h),m=f.from-c,b=f.to-u;(m==0||m==1||c==0)&&(b==0||b==-1||u==e.state.doc.length)&&(d=0,h=e.state.doc.length)}this.newSel=H.single(h,d)}}}function yo(o,e){let t,{newSel:i}=e,l=o.state.selection.main,s=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:r}=e.bounds,d=l.from,h=null;(s===8||W.android&&e.text.length<r-a)&&(d=l.to,h="end");let f=Hc(o.state.doc.sliceString(a,r,ai),e.text,d-a,h);f&&(W.chrome&&s==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==ai+ai&&f.toB--,t={from:a+f.from,to:a+f.toA,insert:Z.of(e.text.slice(f.from,f.toB).split(ai))})}else i&&(!o.hasFocus&&o.state.facet(dt)||i.main.eq(l))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!l.empty&&i&&i.main.empty?t={from:l.from,to:l.to,insert:o.state.doc.slice(l.from,l.to)}:t&&t.from>=l.from&&t.to<=l.to&&(t.from!=l.from||t.to!=l.to)&&l.to-l.from-(t.to-t.from)<=4?t={from:l.from,to:l.to,insert:o.state.doc.slice(l.from,t.from).append(t.insert).append(o.state.doc.slice(t.to,l.to))}:(W.mac||W.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&o.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:Z.of([" "])}):W.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
9
+ `&&o.lineWrapping&&(i&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:Z.of([" "])}),t)return nl(o,t,i,s);if(i&&!i.main.eq(l)){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 nl(o,e,t,i=-1){if(W.ios&&o.inputState.flushIOSKey(e))return!0;let l=o.state.selection.main;if(W.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&o.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Mt(o.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&Mt(o.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&Mt(o.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let a,r=()=>a||(a=Wc(o,e,t));return o.state.facet(Js).some(d=>d(o,e.from,e.to,s,r))||o.dispatch(r()),!0}function Wc(o,e,t){let i,l=o.state,s=l.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&o.inputState.composing<0){let r=s.from<e.from?l.sliceDoc(s.from,e.from):"",d=s.to>e.to?l.sliceDoc(e.to,s.to):"";i=l.replaceSelection(o.state.toText(r+e.insert.sliceString(0,void 0,o.state.lineBreak)+d))}else{let r=l.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&o.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let h=o.state.sliceDoc(e.from,e.to),f,c=t&&ho(o,t.main.head);if(c){let b=e.insert.length-(e.to-e.from);f={from:c.from,to:c.to-b}}else f=o.state.doc.lineAt(s.head);let u=s.to-e.to,m=s.to-s.from;i=l.changeByRange(b=>{if(b.from==s.from&&b.to==s.to)return{changes:r,range:d||b.map(r)};let y=b.to-u,k=y-h.length;if(b.to-b.from!=m||o.state.sliceDoc(k,y)!=h||b.to>=f.from&&b.from<=f.to)return{range:b};let v=l.changes({from:k,to:y,insert:e.insert}),w=b.to-s.to;return{changes:v,range:d?H.range(Math.max(0,d.anchor+w),Math.max(0,d.head+w)):b.map(v)}})}else i={changes:r,selection:d&&l.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)),l.update(i,{userEvent:a,scrollIntoView:!0})}function Hc(o,e,t,i){let l=Math.min(o.length,e.length),s=0;for(;s<l&&o.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==l&&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,s-Math.min(a,r));t-=a+d-s}if(a<s&&o.length<e.length){let d=t<=s&&t>=a?s-t:0;s-=d,r=s+(r-a),a=s}else if(r<s){let d=t<=s&&t>=r?s-t:0;s-=d,a=s+(a-r),r=s}return{from:s,toA:a,toB:r}}function Kc(o){let e=[];if(o.root.activeElement!=o.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}=o.observer.selectionRange;return t&&(e.push(new bo(t,i)),(l!=t||s!=i)&&e.push(new bo(l,s))),e}function Qc(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?H.single(t+e,i+e):null}class Gc{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&fh(e.contentDOM.ownerDocument)}handleEvent(e){!lh(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Yc(e),i=this.handlers,l=this.view.contentDOM;for(let s in t)if(s!="scroll"){let a=!t[s].handlers.length,r=i[s];r&&a!=!r.handlers.length&&(l.removeEventListener(s,this.handleEvent),r=null),r||l.addEventListener(s,this.handleEvent,{passive:a})}for(let s in i)s!="scroll"&&!t[s]&&l.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Jc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=xo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Xc.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,Mt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:W.safari&&!W.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wo(o,e){return(t,i)=>{try{return e.call(o,i,t)}catch(l){Ue(t.state,l)}}}function Yc(o){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of o){let l=i.spec;if(l&&l.domEventHandlers)for(let s in l.domEventHandlers){let a=l.domEventHandlers[s];a&&t(s).handlers.push(wo(i.value,a))}if(l&&l.domEventObservers)for(let s in l.domEventObservers){let a=l.domEventObservers[s];a&&t(s).observers.push(wo(i.value,a))}}for(let i in Pe)t(i).handlers.push(Pe[i]);for(let i in Ee)t(i).observers.push(Ee[i]);return e}const xo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Xc="dthko",Jc=[16,17,18,20,91,92,224,225],Li=6;function ji(o){return Math.max(0,o)*.7+8}function Zc(o,e){return Math.max(Math.abs(o.clientX-e.clientX),Math.abs(o.clientY-e.clientY))}class eh{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=oc(e.contentDOM),this.atoms=e.state.facet(Zn).map(a=>a(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(ne.allowMultipleSelections)&&th(e,t),this.dragging=nh(e,t)&&Mo(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Zc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,s=0,a=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=ro(this.view);e.clientX-d.left<=l+Li?t=-ji(l-e.clientX):e.clientX+d.right>=a-Li&&(t=ji(e.clientX-a)),e.clientY-d.top<=s+Li?i=-ji(s-e.clientY):e.clientY+d.bottom>=r-Li&&(i=ji(e.clientY-r)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],s=null;if(l.empty){let a=Ri(this.atoms,l.from,0);a!=l.from&&(s=H.cursor(a,-1))}else{let a=Ri(this.atoms,l.from,-1),r=Ri(this.atoms,l.to,1);(a!=l.from||r!=l.to)&&(s=H.range(l.from==l.anchor?a:r,l.from==l.head?a:r))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?H.create(t,e.mainIndex):e}select(e){let{view:t}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function th(o,e){let t=o.state.facet(Qs);return t.length?t[0](e):W.mac?e.metaKey:e.ctrlKey}function ih(o,e){let t=o.state.facet(Gs);return t.length?t[0](e):W.mac?!e.altKey:!e.ctrlKey}function nh(o,e){let{main:t}=o.state.selection;if(t.empty)return!1;let i=Jt(o.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let s=0;s<l.length;s++){let a=l[s];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function lh(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=le.get(t))&&i.ignoreEvent(e))return!1;return!0}const Pe=Object.create(null),Ee=Object.create(null),vo=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function sh(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(),Co(o,t.value)},50)}function zi(o,e,t){for(let i of o.facet(e))t=i(t,o);return t}function Co(o,e){e=zi(o.state,Gn,e);let{state:t}=o,i,l=1,s=t.toText(e),a=s.lines==t.selection.ranges.length;if(ll!=null&&t.selection.ranges.every(d=>d.empty)&&ll==s.toString()){let d=-1;i=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==d)return{range:h};d=f.from;let c=t.toText((a?s.line(l++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:c},range:H.cursor(h.from+c.length)}})}else a?i=t.changeByRange(d=>{let h=s.line(l++);return{changes:{from:d.from,to:d.to,insert:h.text},range:H.cursor(d.from+h.length)}}):i=t.replaceSelection(s);o.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Ee.scroll=o=>{o.inputState.lastScrollTop=o.scrollDOM.scrollTop,o.inputState.lastScrollLeft=o.scrollDOM.scrollLeft},Pe.keydown=(o,e)=>(o.inputState.setSelectionOrigin("select"),e.keyCode==27&&o.inputState.tabFocusMode!=0&&(o.inputState.tabFocusMode=Date.now()+2e3),!1),Ee.touchstart=(o,e)=>{o.inputState.lastTouchTime=Date.now(),o.inputState.setSelectionOrigin("select.pointer")},Ee.touchmove=o=>{o.inputState.setSelectionOrigin("select.pointer")},Pe.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(Ys))if(t=i(o,e),t)break;if(!t&&e.button==0&&(t=rh(o,e)),t){let i=!o.hasFocus;o.inputState.startMouseSelection(new eh(o,e,t,i)),i&&o.observer.ignore(()=>{Cs(o.contentDOM);let s=o.root.activeElement;s&&!s.contains(o.contentDOM)&&s.blur()});let l=o.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function So(o,e,t,i){if(i==1)return H.cursor(e,t);if(i==2)return Ec(o.state,e,t);{let l=ce.find(o.docView,e),s=o.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:s.from,r=l?l.posAtEnd:s.to;return r<o.state.doc.length&&r==s.to&&r++,H.range(a,r)}}let No=(o,e,t)=>e>=t.top&&e<=t.bottom&&o>=t.left&&o<=t.right;function oh(o,e,t,i){let l=ce.find(o.docView,e);if(!l)return 1;let s=e-l.posAtStart;if(s==0)return 1;if(s==l.length)return-1;let a=l.coordsAt(s,-1);if(a&&No(t,i,a))return-1;let r=l.coordsAt(s,1);return r&&No(t,i,r)?1:a&&a.bottom>=i?-1:1}function Bo(o,e){let t=o.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:oh(o,t,e.clientX,e.clientY)}}const ah=W.ie&&W.ie_version<=11;let Oo=null,Vo=0,_o=0;function Mo(o){if(!ah)return o.detail;let e=Oo,t=_o;return Oo=o,_o=Date.now(),Vo=!e||t>Date.now()-400&&Math.abs(e.clientX-o.clientX)<2&&Math.abs(e.clientY-o.clientY)<2?(Vo+1)%3:1}function rh(o,e){let t=Bo(o,e),i=Mo(e),l=o.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),l=l.map(s.changes))},get(s,a,r){let d=Bo(o,s),h,f=So(o,d.pos,d.bias,i);if(t.pos!=d.pos&&!a){let c=So(o,t.pos,t.bias,i),u=Math.min(c.from,f.from),m=Math.max(c.to,f.to);f=u<f.from?H.range(u,m):H.range(m,u)}return a?l.replaceRange(l.main.extend(f.from,f.to)):r&&i==1&&l.ranges.length>1&&(h=dh(l,d.pos))?h:r?l.addRange(f):H.create([f])}}}function dh(o,e){for(let t=0;t<o.ranges.length;t++){let{from:i,to:l}=o.ranges[t];if(i<=e&&l>=e)return H.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}Pe.dragstart=(o,e)=>{let{selection:{main:t}}=o.state;if(e.target.draggable){let l=o.docView.nearest(e.target);if(l&&l.isWidget){let s=l.posAtStart,a=s+l.length;(s>=t.to||a<=t.from)&&(t=H.range(s,a))}}let{inputState:i}=o;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",zi(o.state,Yn,o.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Pe.dragend=o=>(o.inputState.draggedContent=null,!1);function To(o,e,t,i){if(t=zi(o.state,Gn,t),!t)return;let l=o.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=o.inputState,a=i&&s&&ih(o,e)?{from:s.from,to:s.to}:null,r={from:l,insert:t},d=o.state.changes(a?[a,r]:r);o.focus(),o.dispatch({changes:d,selection:{anchor:d.mapPos(l,-1),head:d.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),o.inputState.draggedContent=null}Pe.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),l=0,s=()=>{++l==t.length&&To(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=s,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[a]=r.result),s()},r.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return To(o,e,i,!0),!0}return!1},Pe.paste=(o,e)=>{if(o.state.readOnly)return!0;o.observer.flush();let t=vo?null:e.clipboardData;return t?(Co(o,t.getData("text/plain")||t.getData("text/uri-list")),!0):(sh(o),!1)};function ch(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 hh(o){let e=[],t=[],i=!1;for(let l of o.selection.ranges)l.empty||(e.push(o.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:s}of o.selection.ranges){let a=o.doc.lineAt(s);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(o.doc.length,a.to+1)})),l=a.number}i=!0}return{text:zi(o,Yn,e.join(o.lineBreak)),ranges:t,linewise:i}}let ll=null;Pe.copy=Pe.cut=(o,e)=>{let{text:t,ranges:i,linewise:l}=hh(o.state);if(!t&&!l)return!1;ll=l?t:null,e.type=="cut"&&!o.state.readOnly&&o.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=vo?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(ch(o,t),!1)};const Ao=Nt.define();function Eo(o,e){let t=[];for(let i of o.facet(Zs)){let l=i(o,e);l&&t.push(l)}return t?o.update({effects:t,annotations:Ao.of(!0)}):null}function Io(o){setTimeout(()=>{let e=o.hasFocus;if(e!=o.inputState.notifiedFocused){let t=Eo(o.state,e);t?o.dispatch(t):o.update([])}},10)}Ee.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),Io(o)},Ee.blur=o=>{o.observer.clearSelectionRange(),Io(o)},Ee.compositionstart=Ee.compositionupdate=o=>{o.observer.editContext||(o.inputState.compositionFirstChange==null&&(o.inputState.compositionFirstChange=!0),o.inputState.composing<0&&(o.inputState.composing=0))},Ee.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,W.chrome&&W.android?o.observer.flushSoon():o.inputState.compositionPendingChange?Promise.resolve().then(()=>o.observer.flush()):setTimeout(()=>{o.inputState.composing<0&&o.docView.hasComposition&&o.update([])},50))},Ee.contextmenu=o=>{o.inputState.lastContextMenu=Date.now()},Pe.beforeinput=(o,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&o.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(s&&a.length){let r=a[0],d=o.posAtDOM(r.startContainer,r.startOffset),h=o.posAtDOM(r.endContainer,r.endOffset);return nl(o,{from:d,to:h,insert:o.state.toText(s)},null),!0}}let l;if(W.chrome&&W.android&&(l=xo.find(s=>s.inputType==e.inputType))&&(o.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>s+10&&o.hasFocus&&(o.contentDOM.blur(),o.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&o.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&o.inputState.composing>=0&&setTimeout(()=>Ee.compositionend(o,e),20),!1};const Do=new Set;function fh(o){Do.has(o)||(Do.add(o),o.addEventListener("copy",()=>{}),o.addEventListener("cut",()=>{}))}const Po=["pre-wrap","normal","pre-line","break-spaces"];let Dt=!1;function Fo(){Dt=!1}class uh{constructor(e){this.lineWrapping=e,this.doc=Z.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Po.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,s,a){let r=Po.indexOf(e)>-1,d=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=s,d){this.heightSamples={};for(let h=0;h<a.length;h++){let f=a[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return d}}class ph{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class We{constructor(e,t,i,l,s){this.from=e,this.length=t,this.top=i,this.height=l,this._content=s}get type(){return typeof this._content=="number"?ze.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 at?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 We(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ae=function(o){return o[o.ByPos=0]="ByPos",o[o.ByHeight=1]="ByHeight",o[o.ByPosNoHeight=2]="ByPosNoHeight",o}(ae||(ae={}));const qi=.001;class Ce{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>qi&&(Dt=!0),this.height=e)}replace(e,t,i){return Ce.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let s=this,a=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:d,toA:h,fromB:f,toB:c}=l[r],u=s.lineAt(d,ae.ByPosNoHeight,i.setDoc(t),0,0),m=u.to>=h?u:s.lineAt(h,ae.ByPosNoHeight,i,0,0);for(c+=m.to-h,h=m.to;r>0&&u.from<=l[r-1].toA;)d=l[r-1].fromA,f=l[r-1].fromB,r--,d<u.from&&(u=s.lineAt(d,ae.ByPosNoHeight,i,0,0));f+=u.from-d,d=u.from;let b=sl.build(i.setDoc(a),e,f,c);s=Ui(s,s.replace(d,h,b))}return s.updateHeight(i,0)}static empty(){return new Ve(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,s=0;for(;;)if(t==i)if(l>s*2){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),i+=1+r.break,l-=r.size}else if(s>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,s-=r.size}else break;else if(l<s){let r=e[t++];r&&(l+=r.size)}else{let r=e[--i];r&&(s+=r.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new mh(Ce.of(e.slice(0,t)),a,Ce.of(e.slice(i)))}}function Ui(o,e){return o==e?o:(o.constructor!=e.constructor&&(Dt=!0),e)}Ce.prototype.size=1;class $o extends Ce{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,l){return new We(l,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,l,s){return this.blockAt(0,i,l,s)}forEachLine(e,t,i,l,s,a){e<=s+this.length&&t>=s&&a(this.blockAt(0,i,l,s))}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ve extends $o{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,l){return new We(l,this.length,i,this.height,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Ve||l instanceof ge&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof ge?l=new Ve(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Ce.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ge extends Ce{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,s=l-i+1,a,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*s);a=d/s,this.length>s+1&&(r=(this.height-d)/(this.length-s-1))}else a=this.height/s;return{firstLine:i,lastLine:l,perLine:a,perChar:r}}blockAt(e,t,i,l){let{firstLine:s,lastLine:a,perLine:r,perChar:d}=this.heightMetrics(t,l);if(t.lineWrapping){let h=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),f=t.doc.lineAt(h),c=r+f.length*d,u=Math.max(i,e-c/2);return new We(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(a-s,Math.floor((e-i)/r))),{from:f,length:c}=t.doc.line(s+h);return new We(f,c,i+r*h,r,0)}}lineAt(e,t,i,l,s){if(t==ae.ByHeight)return this.blockAt(e,i,l,s);if(t==ae.ByPosNoHeight){let{from:m,to:b}=i.doc.lineAt(e);return new We(m,b-m,0,0,0)}let{firstLine:a,perLine:r,perChar:d}=this.heightMetrics(i,s),h=i.doc.lineAt(e),f=r+h.length*d,c=h.number-a,u=l+r*c+d*(h.from-s-c);return new We(h.from,h.length,Math.max(l,Math.min(u,l+this.height-f)),f,0)}forEachLine(e,t,i,l,s,a){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:r,perLine:d,perChar:h}=this.heightMetrics(i,s);for(let f=e,c=l;f<=t;){let u=i.doc.lineAt(f);if(f==e){let b=u.number-r;c+=d*b+h*(e-s-b)}let m=d+h*u.length;a(new We(u.from,u.length,c,m,0)),c+=m,f=u.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let s=i[i.length-1];s instanceof ge?i[i.length-1]=new ge(s.length+l):i.push(null,new ge(l-1))}if(e>0){let s=i[0];s instanceof ge?i[0]=new ge(e+s.length):i.unshift(new ge(e-1),null)}return Ce.of(i)}decomposeLeft(e,t){t.push(new ge(e-1),null)}decomposeRight(e,t){t.push(null,new ge(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let s=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],r=Math.max(t,l.from),d=-1;for(l.from>t&&a.push(new ge(l.from-t-1).updateHeight(e,t));r<=s&&l.more;){let f=e.doc.lineAt(r).length;a.length&&a.push(null);let c=l.heights[l.index++];d==-1?d=c:Math.abs(c-d)>=qi&&(d=-2);let u=new Ve(f,c);u.outdated=!1,a.push(u),r+=f+1}r<=s&&a.push(null,new ge(s-r).updateHeight(e,r));let h=Ce.of(a);return(d<0||Math.abs(h.height-this.height)>=qi||Math.abs(d-this.heightMetrics(e,t).perLine)>=qi)&&(Dt=!0),Ui(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class mh extends Ce{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,s,l+this.left.length+this.break)}lineAt(e,t,i,l,s){let a=l+this.left.height,r=s+this.left.length+this.break,d=t==ae.ByHeight?e<a:e<r,h=d?this.left.lineAt(e,t,i,l,s):this.right.lineAt(e,t,i,a,r);if(this.break||(d?h.to<r:h.from>r))return h;let f=t==ae.ByPosNoHeight?ae.ByPosNoHeight:ae.ByPos;return d?h.join(this.right.lineAt(r,f,i,a,r)):this.left.lineAt(r,f,i,l,s).join(h)}forEachLine(e,t,i,l,s,a){let r=l+this.left.height,d=s+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,l,s,a),t>=d&&this.right.forEachLine(e,t,i,r,d,a);else{let h=this.lineAt(d,ae.ByPos,i,l,s);e<h.from&&this.left.forEachLine(e,h.from-1,i,l,s,a),h.to>=e&&h.from<=t&&a(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,r,d,a)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let s=[];e>0&&this.decomposeLeft(e,s);let a=s.length;for(let r of i)s.push(r);if(e>0&&Ro(s,a-1),t<this.length){let r=s.length;this.decomposeRight(t,s),Ro(s,r)}return Ce.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Ce.of(this.break?[e,null,t]:[e,t]):(this.left=Ui(this.left,e),this.right=Ui(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,l){let{left:s,right:a}=this,r=t+s.length+this.break,d=null;return l&&l.from<=t+s.length&&l.more?d=s=s.updateHeight(e,t,i,l):s.updateHeight(e,t,i),l&&l.from<=r+a.length&&l.more?d=a=a.updateHeight(e,r,i,l):a.updateHeight(e,r,i),d?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ro(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 gh=5;class sl{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Ve?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ve(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new $o(a,l,i)):(a||s||l>=gh)&&this.addLineDeco(l,s,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 Ve(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 Ve)return e;let t=new Ve(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ve)&&!this.isCovered?this.nodes.push(new Ve(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Ve&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let s=new sl(i,e);return oe.spans(t,i,l,s,0),s.finish(i)}}function kh(o,e,t){let i=new bh;return oe.compare(o,e,t,i,0),i.changes}class bh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&zn(e,t,this.changes,5)}}function yh(o,e){let t=o.getBoundingClientRect(),i=o.ownerDocument,l=i.defaultView||window,s=Math.max(0,t.left),a=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(l.innerHeight,t.bottom);for(let h=o.parentNode;h&&h!=i.body;)if(h.nodeType==1){let f=h,c=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!="visible"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),a=Math.min(a,u.right),r=Math.max(r,u.top),d=Math.min(h==o.parentNode?l.innerHeight:d,u.bottom)}h=c.position=="absolute"||c.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,a)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function wh(o,e){let t=o.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ol{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],s=t[i];if(l.from!=s.from||l.to!=s.to||l.size!=s.size)return!1}return!0}draw(e,t){return xe.replace({widget:new xh(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class xh extends jn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Lo{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=jo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Jn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new uh(t),this.stateDeco=e.facet(si).filter(i=>typeof i!="function"),this.heightMap=Ce.empty().applyChanges(this.stateDeco,Z.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=xe.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:s,to:a})=>l>=s&&l<=a)){let{from:s,to:a}=this.lineBlockAt(l);e.push(new Wi(s,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?jo:new al(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ri(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(si).filter(f=>typeof f!="function");let l=e.changedRanges,s=Ae.extendWithRanges(l,kh(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),a=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Fo(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||Dt)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let d=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<d.from||t.range.head>d.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,t));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Sc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let a=this.heightOracle.mustRefreshForWrapping(s),r=t.getBoundingClientRect(),d=a||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,f=0;if(r.width&&r.height){let{scaleX:g,scaleY:p}=vs(t,r);(g>.005&&Math.abs(this.scaleX-g)>.005||p>.005&&Math.abs(this.scaleY-p)>.005)&&(this.scaleX=g,this.scaleY=p,h|=8,a=d=!0)}let c=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Bs(e.scrollDOM);let b=(this.printing?wh:yh)(t,this.paddingTop),y=b.top-this.pixelViewport.top,k=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(d=!0)),!this.inView&&!this.scrollTarget)return 0;let w=r.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),d){let g=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(g)&&(a=!0),a||l.lineWrapping&&Math.abs(w-this.contentDOMWidth)>l.charWidth){let{lineHeight:p,charWidth:B,textHeight:V}=e.docView.measureTextSize();a=p>0&&l.refresh(s,p,B,V,w/B,g),a&&(e.docView.minWidth=0,h|=8)}y>0&&k>0?f=Math.max(y,k):y<0&&k<0&&(f=Math.min(y,k)),Fo();for(let p of this.viewports){let B=p.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(p);this.heightMap=(a?Ce.empty().applyChanges(this.stateDeco,Z.empty,this.heightOracle,[new Ae(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new ph(p.from,B))}Dt&&(h|=2)}let O=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:r}=this,d=new Wi(l.lineAt(a-i*1e3,ae.ByHeight,s,0,0).from,l.lineAt(r+(1-i)*1e3,ae.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(h<d.from||h>d.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=l.lineAt(h,ae.ByPos,s,0,0),u;t.y=="center"?u=(c.top+c.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h<d.from?u=c.top:u=c.bottom-f,d=new Wi(l.lineAt(u-1e3/2,ae.ByHeight,s,0,0).from,l.lineAt(u+f+1e3/2,ae.ByHeight,s,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Wi(this.heightMap.lineAt(i,ae.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,ae.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,ae.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,ae.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:r}=this;return(e==0||l<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=r+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&s<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new ol(t.mapPos(l.from),t.mapPos(l.to),l.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,s=l>>1,a=l<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(f,c,u,m)=>{if(c-f<s)return;let b=this.state.selection.main,y=[b.from];b.empty||y.push(b.to);for(let v of y)if(v>f&&v<c){d(f,v-10,u,m),d(v+10,c,u,m);return}let k=Ch(e,v=>v.from>=u.from&&v.to<=u.to&&Math.abs(v.from-f)<s&&Math.abs(v.to-c)<s&&!y.some(w=>v.from<w&&v.to>w));if(!k){if(c<u.to&&t&&i&&t.visibleRanges.some(v=>v.from<=c&&v.to>=c)){let v=t.moveToLineBoundary(H.cursor(c),!1,!0).head;v>f&&(c=v)}k=new ol(f,c,this.gapSize(u,f,c,m))}r.push(k)},h=f=>{if(f.length<a||f.type!=ze.Text)return;let c=vh(f.from,f.to,this.stateDeco);if(c.total<a)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(i){let y=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,k,v;if(u!=null){let w=Ki(c,u),O=((this.visibleBottom-this.visibleTop)/2+y)/f.height;k=w-O,v=w+O}else k=(this.visibleTop-f.top-y)/f.height,v=(this.visibleBottom-f.top+y)/f.height;m=Hi(c,k),b=Hi(c,v)}else{let y=c.total*this.heightOracle.charWidth,k=l*this.heightOracle.charWidth,v,w;if(u!=null){let O=Ki(c,u),g=((this.pixelViewport.right-this.pixelViewport.left)/2+k)/y;v=O-g,w=O+g}else v=(this.pixelViewport.left-k)/y,w=(this.pixelViewport.right+k)/y;m=Hi(c,v),b=Hi(c,w)}m>f.from&&d(f.from,m,f,c),b<f.to&&d(b,f.to,f,c)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return r}gapSize(e,t,i,l){let s=Ki(l,i)-Ki(l,t);return this.heightOracle.lineWrapping?e.height*s:l.total*this.heightOracle.charWidth*s}updateLineGaps(e){ol.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=xe.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=[];oe.spans(e,this.viewport.from,this.viewport.to,{span(l,s){t.push({from:l,to:s})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((l,s)=>l.from!=t[s].from||l.to!=t[s].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ri(this.heightMap.lineAt(e,ae.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||ri(this.heightMap.lineAt(this.scaler.fromDOM(e),ae.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return ri(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Wi{constructor(e,t){this.from=e,this.to=t}}function vh(o,e,t){let i=[],l=o,s=0;return oe.spans(t,o,e,{span(){},point(a,r){a>l&&(i.push({from:l,to:a}),s+=a-l),l=r}},20),l<e&&(i.push({from:l,to:e}),s+=e-l),{total:s,ranges:i}}function Hi({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 l=0;;l++){let{from:s,to:a}=e[l],r=a-s;if(i<=r)return s+i;i-=r}}function Ki(o,e){let t=0;for(let{from:i,to:l}of o.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/o.total}function Ch(o,e){for(let t of o)if(e(t))return t}const jo={toDOM(o){return o},fromDOM(o){return o},scale:1,eq(o){return o==this}};class al{constructor(e,t,i){let l=0,s=0,a=0;this.viewports=i.map(({from:r,to:d})=>{let h=t.lineAt(r,ae.ByPos,e,0,0).top,f=t.lineAt(d,ae.ByPos,e,0,0).bottom;return l+=f-h,{from:r,to:d,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=a+(r.top-s)*this.scale,a=r.domBottom=r.domTop+(r.bottom-r.top),s=r.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return l+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,l=s.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-l)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,l=s.domBottom}}eq(e){return e instanceof al?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function ri(o,e){if(e.scale==1)return o;let t=e.toDOM(o.top),i=e.toDOM(o.bottom);return new We(o.from,o.length,t,i-t,Array.isArray(o._content)?o._content.map(l=>ri(l,e)):o._content)}const Qi=G.define({combine:o=>o.join(" ")}),rl=G.define({combine:o=>o.indexOf(!0)>-1}),dl=ot.newName(),zo=ot.newName(),qo=ot.newName(),Uo={"&light":"."+zo,"&dark":"."+qo};function cl(o,e,t){return new ot(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return o;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):o+" "+i}})}const Sh=cl("."+dl,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Uo),Nh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hl=W.ie&&W.ie_version<=11;class Bh{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ac,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new Vh(e),e.state.facet(dt)&&(e.contentDOM.editContext=this.editContext.editContext)),hl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(dt)?i.root.activeElement!=this.dom:!Ti(i.dom,l))return;let s=l.anchorNode&&i.docView.nearest(l.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!i.state.selection.main.empty&&l.focusNode&&ei(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Jt(e.root);if(!t)return!1;let i=W.safari&&e.root.nodeType==11&&nc(this.dom.ownerDocument)==this.dom&&Oh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Ti(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&dc(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Nh),hl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),hl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Mt(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,l=!1;for(let s of e){let a=this.readMutation(s);a&&(a.typeOver&&(l=!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:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Ti(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Uc(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,l=yo(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Wo(t,e.previousSibling||e.target.previousSibling,-1),l=Wo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(dt)!=e.state.facet(dt)&&(e.view.contentDOM.editContext=e.state.facet(dt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Wo(o,e,t){for(;e;){let i=le.get(e);if(i&&i.parent==o)return i;let l=e.parentNode;e=l!=o.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function Ho(o,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,s=e.endOffset,a=o.docView.domAtPos(o.state.selection.main.anchor);return ei(a.node,a.offset,l,s)&&([t,i,l,s]=[l,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}}function Oh(o,e){if(e.getComposedRanges){let l=e.getComposedRanges(o.root)[0];if(l)return Ho(o,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return o.contentDOM.addEventListener("beforeinput",i,!0),o.dom.ownerDocument.execCommand("indent"),o.contentDOM.removeEventListener("beforeinput",i,!0),t?Ho(o,t):null}class Vh{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let{anchor:l}=e.state.selection.main,s={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:Z.of(i.text.split(`
10
+ `))};s.from==this.from&&l<this.from?s.from=l:s.to==this.to&&l>this.to&&(s.to=l),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||nl(e,s,H.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let l=[],s=null;for(let a=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);a<r;a++){let d=e.coordsForChar(a);s=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||s||new DOMRect,l.push(s)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let s of i.getTextFormats()){let a=s.underlineStyle,r=s.underlineThickness;if(a!="None"&&r!="None"){let d=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(xe.mark({attributes:{style:d}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:io.of(xe.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=Jt(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((s,a,r,d,h)=>{if(i)return;let f=h.length-(a-s);if(l&&a>=l.to)if(l.from==s&&l.to==a&&l.insert.eq(h)){l=this.pendingContextChange=null,t+=f,this.to+=f;return}else l=null,this.revertPending(e.state);if(s+=t,a+=t,a<=this.from)this.from+=f,this.to+=f;else if(s<this.to){if(s<this.from||a>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),h.toString()),this.to+=f}t+=f}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ie{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(s=>i(s,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||rc(e.parent)||document,this.viewState=new Lo(e.state||ne.create(e)),e.scrollTo&&e.scrollTo.is(Fi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(li).map(l=>new Xn(l));for(let l of this.plugins)l.update(this);this.observer=new Bh(this),this.inputState=new Gc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new co(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof ye?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,s=this.state;for(let u of e){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,r=0,d=null;e.some(u=>u.annotation(Ao))?(this.inputState.notifiedFocused=a,r=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,d=Eo(s,a),d||(r=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(ne.phrases)!=this.state.facet(ne.phrases))return this.setState(s);l=$i.create(this,s,e),l.flags|=r;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:m}=u.state.selection;c=new Et(m.empty?m:H.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of u.effects)m.is(Fi)&&(c=m.value.clip(this.state))}this.viewState.update(l,c),this.bidiCache=Gi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(oi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Qi)!=l.state.facet(Qi)&&(this.viewState.mustMeasureContent=!0),(t||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(Qn))try{u(l)}catch(m){Ue(this.state,m,"update listener")}(d||f)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),f&&!yo(this,f)&&h.force&&Mt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Lo(e),this.plugins=e.facet(li).map(i=>new Xn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new co(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(li),i=e.state.facet(li);if(t!=i){let l=[];for(let s of i){let a=t.indexOf(s);if(a<0)l.push(new Xn(s));else{let r=this.plugins[a];r.mustUpdate=e,l.push(r)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){Ue(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,l=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(a<0)if(Bs(i))s=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);s=m.from,a=m.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(m=>{try{return m.read(this)}catch(b){return Ue(this.state,b),Ko}}),c=$i.create(this,this.state,[]),u=!1;c.flags|=d,t?t.flags|=d:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c),u&&this.docViewUpdate());for(let m=0;m<h.length;m++)if(f[m]!=Ko)try{let b=h[m];b.write&&b.write(f[m],this)}catch(b){Ue(this.state,b)}if(u&&this.docView.updateSelection(!0),!c.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=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a;if(b>1||b<-1){l=l+b,i.scrollTop=l/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Qn))r(t)}get themeClasses(){return dl+" "+(this.state.facet(rl)?qo:zo)+" "+this.state.facet(Qi)}updateAttrs(){let e=Qo(this,no,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(dt)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Qo(this,Jn,t);let i=this.observer.ignore(()=>{let l=Ln(this.contentDOM,this.contentAttrs,t),s=Ln(this.dom,this.editorAttrs,e);return l||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(ie.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(oi);let e=this.state.facet(ie.cspNonce);ot.mount(this.root,this.styleModules.concat(Sh).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return il(this,e,ko(this,e,t,i))}moveByGroup(e,t){return il(this,e,ko(this,e,t,i=>Lc(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return H.cursor(s.side(t,l)+e.from,s.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return Rc(this,e,t,i)}moveVertically(e,t,i){return il(this,e,jc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),mo(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),s=this.bidiSpans(l),a=s[rt.find(s,e-l.from,-1,t)];return Ei(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(eo)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>_h)return Hs(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Ws(s.isolates,i=oo(this,e))))return s.order;i||(i=oo(this,e));let l=xc(e.text,t,i);return this.bidiCache.push(new Gi(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Cs(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Fi.of(new Et(typeof e=="number"?H.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Fi.of(new Et(H.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return It.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return It.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=ot.newName(),l=[Qi.of(i),oi.of(cl(`.${i}`,e))];return t&&t.dark&&l.push(rl.of(!0)),l}static baseTheme(e){return qd.lowest(oi.of(cl("."+dl,e,Uo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&le.get(i)||le.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}ie.styleModule=oi,ie.inputHandler=Js,ie.clipboardInputFilter=Gn,ie.clipboardOutputFilter=Yn,ie.scrollHandler=to,ie.focusChangeEffect=Zs,ie.perLineTextDirection=eo,ie.exceptionSink=Xs,ie.updateListener=Qn,ie.editable=dt,ie.mouseSelectionStyle=Ys,ie.dragMovesSelection=Gs,ie.clickAddsSelectionRange=Qs,ie.decorations=si,ie.outerDecorations=lo,ie.atomicRanges=Zn,ie.bidiIsolatedRanges=so,ie.scrollMargins=ao,ie.darkTheme=rl,ie.cspNonce=G.define({combine:o=>o.length?o[0]:""}),ie.contentAttributes=Jn,ie.editorAttributes=no,ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"}),ie.announce=he.define();const _h=4096,Ko={};class Gi{constructor(e,t,i,l,s,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=s,this.order=a}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:me.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let a=e[s];a.dir==l&&!t.touchesRange(a.from,a.to)&&i.push(new Gi(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function Qo(o,e,t){for(let i=o.state.facet(e),l=i.length-1;l>=0;l--){let s=i[l],a=typeof s=="function"?s(o):s;a&&Rn(a,t)}return t}const Mh=!W.ios,Go={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Mh&&(Go[".cm-line"].caretColor=Go[".cm-content"].caretColor="transparent !important");class Pt extends Ot{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Pt.prototype.elementClass="",Pt.prototype.toDOM=void 0,Pt.prototype.mapMode=Oe.TrackBefore,Pt.prototype.startSide=Pt.prototype.endSide=-1,Pt.prototype.point=!0;var fl;const Ft=new J;function Th(o){return G.define({combine:o?e=>e.concat(o):void 0})}const Ah=new J;class Fe{constructor(e,t,i=[],l=""){this.data=e,this.name=l,ne.prototype.hasOwnProperty("tree")||Object.defineProperty(ne.prototype,"tree",{get(){return ul(this)}}),this.parser=t,this.extension=[Rt.of(this),ne.languageData.of((s,a,r)=>{let d=Yo(s,a,r),h=d.type.prop(Ft);if(!h)return[];let f=s.facet(h),c=d.type.prop(Ah);if(c){let u=d.resolve(a-d.from,r);for(let m of c)if(m.test(u,s)){let b=s.facet(m.facet);return m.type=="replace"?b:b.concat(f)}}return f})].concat(i)}isActiveAt(e,t,i=-1){return Yo(e,t,i).type.prop(Ft)==this.data}findRegions(e){let t=e.facet(Rt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(s,a)=>{if(s.prop(Ft)==this.data){i.push({from:a,to:a+s.length});return}let r=s.prop(J.mounted);if(r){if(r.tree.prop(Ft)==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+s.length});return}else if(r.overlay){let d=i.length;if(l(r.tree,r.overlay[0].from+a),i.length>d)return}}for(let d=0;d<s.children.length;d++){let h=s.children[d];h instanceof de&&l(h,s.positions[d]+a)}};return l(ul(e),0),i}get allowsNesting(){return!0}}Fe.setState=he.define();function Yo(o,e,t){let i=o.facet(Rt),l=ul(o).topNode;if(!i||i.allowsNesting)for(let s=l;s;s=s.enter(e,t,fe.ExcludeBuffers))s.type.isTop&&(l=s);return l}class Yi extends Fe{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Th(e.languageData);return new Yi(t,e.parser.configure({props:[Ft.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Yi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ul(o){let e=o.field(Fe.state,!1);return e?e.tree:de.empty}class Eh{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let di=null;class Xi{constructor(e,t,i=[],l,s,a,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=s,this.viewport=a,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Xi(e,t,[],de.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Eh(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=de.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(ut.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ut.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=di;di=this;try{return e()}finally{di=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Xo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:s,viewport:a,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,f,c,u)=>d.push({fromA:h,toA:f,fromB:c,toB:u})),i=ut.applyChanges(i,d),l=de.empty,s=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){r=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),c=e.mapPos(h.to,-1);f<c&&r.push({from:f,to:c})}}}return new Xi(this.parser,t,i,l,s,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:l,to:s}=this.skipped[i];l<e.to&&s>e.from&&(this.fragments=Xo(this.fragments,l,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Dl{createParse(t,i,l){let s=l[0].from,a=l[l.length-1].to;return{parsedPos:s,advance(){let d=di;if(d){for(let h of l)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=a,new de(Se.none,[],[],a-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return di}}function Xo(o,e,t){return ut.applyChanges(o,[{fromA:e,toA:t,fromB:e,toB:t}])}class $t{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 $t(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Xi.create(e.facet(Rt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new $t(i)}}Fe.state=gt.define({create:$t.init,update(o,e){for(let t of e.effects)if(t.is(Fe.setState))return t.value;return e.startState.facet(Rt)!=e.state.facet(Rt)?$t.init(e.state):o.apply(e)}});let Jo=o=>{let e=setTimeout(()=>o(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Jo=o=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(o,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const pl=typeof navigator<"u"&&(!((fl=navigator.scheduling)===null||fl===void 0)&&fl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ih=It.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(Fe.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(Fe.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Jo(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:l}}=this.view,s=i.field(Fe.state);if(s.tree==s.context.tree&&s.context.isDone(l+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!pl?Math.max(25,e.timeRemaining()-5):1e9),r=s.context.treeLen<l&&i.doc.length>l+1e3,d=s.context.work(()=>pl&&pl()||Date.now()>a,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Fe.setState.of(new $t(s.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ue(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()}}}),Rt=G.define({combine(o){return o.length?o[0]:null},enables:o=>[Fe.state,Ih,ie.contentAttributes.compute([o],e=>{let t=e.facet(o);return t&&t.name?{"data-language":t.name}:{}})]});class Dh{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Ph=new J;function Zo({except:o,units:e=1}={}){return t=>{let i=o&&o.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Fh=new J;function $h(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 ml{constructor(e,t){this.specs=e;let i;function l(r){let d=ot.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const s=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof Fe?r=>r.prop(Ft)==a.data:a?r=>r==a:void 0,this.style=ql(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:s}).style,this.module=i?new ot(i):null,this.themeType=t.themeType}static define(e,t){return new ml(e,t||{})}}j.meta,j.link,j.heading,j.emphasis,j.strong,j.strikethrough,j.keyword,j.atom,j.bool,j.url,j.contentSeparator,j.labelName,j.literal,j.inserted,j.string,j.deleted,j.regexp,j.escape,j.string,j.variableName,j.variableName,j.typeName,j.namespace,j.className,j.variableName,j.macroName,j.propertyName,j.comment,j.invalid;const Rh=Object.create(null),ea=[Se.none],ta=[],ia=Object.create(null),Lh=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"]])Lh[o]=jh(Rh,e);function gl(o,e){ta.indexOf(o)>-1||(ta.push(o),console.warn(e))}function jh(o,e){let t=[];for(let r of e.split(" ")){let d=[];for(let h of r.split(".")){let f=o[h]||j[h];f?typeof f=="function"?d.length?d=d.map(f):gl(h,`Modifier ${h} used at start of tag`):d.length?gl(h,`Tag ${h} used as modifier`):d=Array.isArray(f)?f:[f]:gl(h,`Unknown highlighting tag ${h}`)}for(let h of d)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(r=>r.id),s=ia[l];if(s)return s.id;let a=ia[l]=Se.define({id:ea.length,name:i,props:[zl({[i]:t})]});return ea.push(a),a.id}me.RTL,me.LTR;const zh=Yi.define({name:"json",parser:Fd.configure({props:[Ph.add({Object:Zo({except:/^\s*\}/}),Array:Zo({except:/^\s*\]/})}),Fh.add({"Object Array":$h})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function qh(){return new Dh(zh)}const kl=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function Uh(){const o=Ie();if(o.formRules?.length){const e={};kl.forEach(i=>{e[i.name]=i});const t=[...kl];return o.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):t.push(l)}),t}return kl}const Wh={loadAdvances:Uh},Hh={class:"unione-props-setting data-field-setting"},Kh={key:0},Qh=["onClick"],Gh={class:"field-txt"},Yh=["onClick"],Xh={key:1,class:"field-txt"},Jh=["onClick"],Zh={key:0,class:"field-txt"},ef={key:3,class:"edit-field"},tf=["onClick"],nf=te(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([qh()]),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"),l={mounted:g=>g.focus()},s=n.ref({});function a(){const g=Object.keys(s.value);if(g.length)for(let p in g){const B=i.value.filter(V=>V.name==p);if(B&&B[0]){let V=s.value[p];Object.keys(V).forEach(C=>{C=="convertName"?(B[0].convert||(B[0].convert={}),B[0].convert.type=V[C]):B[0][C]=V[C]})}}s.value={}}function r(g,p){a();const B={};p=="convertName"?(g.convert||(g.convert={}),B[p]=g.convert?.type):B[p]=g[p]||"",s.value[g.name]=B}function d(g,p){{s.value={};return}}function h(g,p){switch(p){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 f(g,p){switch(p){case"query":g.configs=K.utils.obj.ext(g.configs,{query:{enable:!1}}),g.configs.query.enable=!g.configs.query.enable;break;case"form":g.configs=K.utils.obj.ext(g.configs,{show:{form:{enable:!1}}}),g.configs.show.form.enable=!g.configs.show.form.enable;break;case"view":g.configs=K.utils.obj.ext(g.configs,{show:{view:{enable:!1}}}),g.configs.show.view.enable=!g.configs.show.view.enable;break;case"list":g.configs=K.utils.obj.ext(g.configs,{show:{list:{enable:!1}}}),g.configs.show.list.enable=!g.configs.show.list.enable;break;case"sort":g.configs=K.utils.obj.ext(g.configs,{sort:{enable:!1}}),g.configs.sort.enable=!g.configs.sort.enable;break}console.log("record.configs",g.configs)}const c=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{c.value.visible=!1}});function u(g,p){switch(c.value.prop=p,c.value.field=g,g.configs||(g.configs={}),g.configs.show||(g.configs.show={}),p){case"query":g.configs.query||(g.configs.query={}),g.configs.query.types||(g.configs.query.types="EQ"),c.value.show=g.configs.query,c.value.title=`查询设置/${g.title}(${g.name})`;break;case"form":g.configs.show.form||(g.configs.show.form={}),c.value.show=g.configs.show.form,c.value.title=`表单设置/${g.title}(${g.name})`;break;case"view":g.configs.show.view||(g.configs.show.view={}),c.value.show=g.configs.show.view,c.value.title=`详情设置/${g.title}(${g.name})`;break;case"list":g.configs.show.list||(g.configs.show.list={}),c.value.show=g.configs.show.list,c.value.title=`列头设置/${g.title}(${g.name})`;break;case"sort":g.configs.sort||(g.configs.sort={}),c.value.show=g.configs.sort,c.value.title=`排序设置/${g.title}(${g.name})`;break}c.value.visible=!0}const m=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:g=>{const p=m.value.options.filter(B=>B.value==g);return p[0]?p[0].label:g}}),b=n.ref({visible:!1,field:{},props:{},advances:Wh.loadAdvances(),showInfo:g=>{let p=0;if(g.configs?.rule){const B=g.configs.rule;B.advance&&p++,typeof B.rangeMin<"u"&&p++,typeof B.rangeMax<"u"&&p++,typeof B.regExpress<"u"&&p++}if(p>0)return"("+p+")"},toSetting:()=>{const g=b.value.props;b.value.field.configs=K.utils.obj.ext(b.value.field.configs,{rule:{...g}}),b.value.visible=!1,b.value.props={}}});function y(g){b.value.visible=!0,b.value.field=g,b.value.props=g.configs?.rule||{}}const k=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 p=g.configs?.widget?.name,B=k.value.widgets.filter(V=>V.value==p);return B[0]?B[0].label:p},toSetting:(g,p)=>{g.configs||(g.configs={}),g.configs.widget||(g.configs.widget={}),g.configs.widget.name=p},toclose:()=>{k.value.visible=!1}});function v(g){k.value.field=g,g.configs=K.utils.obj.ext(g.configs,{widget:{props:{}}}),k.value.widget=g.configs.widget,k.value.visible=!0}const w=n.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(g,p="--")=>w.value.types.filter(B=>B.value==g)[0]?.label||p,toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(g,p)=>{w.value.convert.options.splice(g,1)},toSetting:()=>{w.value.visible=!1}});function O(g){w.value.visible=!0,w.value.field=g,g.configs||(g.configs={}),g.configs.convert||(g.configs.convert={}),w.value.convert=g.configs.convert}return(g,p)=>{const B=n.resolveComponent("ToolOutlined"),V=n.resolveComponent("a-button"),C=n.resolveComponent("a-select"),x=n.resolveComponent("a-checkbox"),N=n.resolveComponent("a-table"),M=n.resolveComponent("a-switch"),E=n.resolveComponent("a-form-item"),T=n.resolveComponent("a-select-option"),D=n.resolveComponent("a-input-number"),R=n.resolveComponent("a-form"),A=n.resolveComponent("a-modal"),q=n.resolveComponent("a-input"),P=n.resolveComponent("unione-select-box"),Q=n.resolveComponent("a-checkbox-group"),L=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",Hh,[n.createVNode(N,{columns:t.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:S})=>[["widget","queryType","rules","convertName"].includes(S.key)?(n.openBlock(),n.createElementBlock("span",Kh,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:F,record:_})=>[["rules"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!b.value.showInfo(_)&&"empty"]),onClick:I=>y(_)},[n.createElementVNode("span",Gh,n.toDisplayString(b.value.showInfo(_)),1),b.value.showInfo(_)?(n.openBlock(),n.createBlock(V,{key:0,type:"link"},{default:n.withCtx(()=>p[50]||(p[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Qh)):["widget"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[_.name]||!Object.keys(s.value[_.name]).includes(S.dataIndex))&&!F&&"empty"]),onClick:I=>r(_,S.dataIndex)},[s.value[_.name]&&Object.keys(s.value[_.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:_.configs?.widget?.name,allowClear:!0,options:k.value.widgets,onChange:I=>k.value.toSetting(_,I),onBlur:p[0]||(p[0]=I=>d())},null,8,["value","options","onChange"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Xh,n.toDisplayString(k.value.widgetName(_)),1)),n.createVNode(V,{type:"link",onClick:n.withModifiers(I=>v(_),["stop"])},{default:n.withCtx(()=>p[51]||(p[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Yh)):["convertName"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[_.name]||!Object.keys(s.value[_.name]).includes(S.dataIndex))&&!_.convert?.type&&"empty"]),onClick:I=>O(_)},[_.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Zh,n.toDisplayString(w.value.getTypes(_.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Jh)):["query","form","view","list","sort"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",ef,[n.createVNode(x,{checked:h(_,S.dataIndex),onClick:I=>f(_,S.dataIndex)},null,8,["checked","onClick"]),n.createVNode(V,{type:"link",onClick:I=>u(_,S.dataIndex)},{default:n.withCtx(()=>p[52]||(p[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(A,{visible:c.value.visible,"onUpdate:visible":p[14]||(p[14]=S=>c.value.visible=S),width:600,title:c.value.title,onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:c.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:n.normalizeClass(["field-setting-form","form-mix",c.value.prop])},{default:n.withCtx(()=>[n.createVNode(E,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.enable,"onUpdate:checked":p[1]||(p[1]=S=>c.value.show.enable=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),c.value.prop=="sort"?(n.openBlock(),n.createBlock(E,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.defoult,"onUpdate:checked":p[2]||(p[2]=S=>c.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="sort"?(n.openBlock(),n.createBlock(E,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.asc,"onUpdate:checked":p[3]||(p[3]=S=>c.value.show.asc=S),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="query"&&c.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(E,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),c.value.prop=="query"?(n.openBlock(),n.createBlock(E,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.defoult,"onUpdate:checked":p[4]||(p[4]=S=>c.value.show.defoult=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="query"?(n.openBlock(),n.createBlock(E,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.show.visible,"onUpdate:checked":p[5]||(p[5]=S=>c.value.show.visible=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),c.value.prop=="query"?(n.openBlock(),n.createBlock(E,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.types,"onUpdate:value":p[6]||(p[6]=S=>c.value.show.types=S)},{default:n.withCtx(()=>[n.createVNode(T,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>p[53]||(p[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(T,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>p[54]||(p[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(T,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>p[55]||(p[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(T,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>p[56]||(p[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(T,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>p[57]||(p[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(T,{key:"ADVANCE",value:"ADVANCE"},{default:n.withCtx(()=>p[58]||(p[58]=[n.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0),["query","sort"].includes(c.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(E,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(D,{value:c.value.show.index,"onUpdate:value":p[7]||(p[7]=S=>c.value.show.index=S)},null,8,["value"])]),_:1})),["form","view"].includes(c.value.prop)?(n.openBlock(),n.createBlock(E,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:c.value.show.width,"onUpdate:value":p[8]||(p[8]=S=>c.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(c.value.prop)?(n.openBlock(),n.createBlock(E,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,value:c.value.show.width,"onUpdate:value":p[9]||(p[9]=S=>c.value.show.width=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(c.value.prop)?(n.openBlock(),n.createBlock(E,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:c.value.show.labelWidth,"onUpdate:value":p[10]||(p[10]=S=>c.value.show.labelWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(c.value.prop)?(n.openBlock(),n.createBlock(E,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:c.value.show.valueWidth,"onUpdate:value":p[11]||(p[11]=S=>c.value.show.valueWidth=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(c.value.prop)?(n.openBlock(),n.createBlock(E,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.fixed,"onUpdate:value":p[12]||(p[12]=S=>c.value.show.fixed=S),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(c.value.prop)?(n.openBlock(),n.createBlock(E,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.align,"onUpdate:value":p[13]||(p[13]=S=>c.value.show.align=S),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),n.createVNode(A,{visible:w.value.visible,"onUpdate:visible":p[33]||(p[33]=S=>w.value.visible=S),width:600,title:w.value.getTypes(w.value.convert.types,"转换")+"设置",onOk:w.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:w.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(E,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:w.value.convert.types,"onUpdate:value":p[15]||(p[15]=S=>w.value.convert.types=S),allowClear:!0,options:w.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(w.value.field.widget?.name)?(n.openBlock(),n.createBlock(E,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(M,{checked:c.value.convert.search,"onUpdate:checked":p[16]||(p[16]=S=>c.value.convert.search=S),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="option"?(n.openBlock(),n.createBlock(E,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(V,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:n.withCtx(()=>p[59]||(p[59]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(N,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:S,record:F,index:_})=>[S.dataIndex==="label"?(n.openBlock(),n.createBlock(q,{key:0,value:F.label,"onUpdate:value":I=>F.label=I,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="value"?(n.openBlock(),n.createBlock(q,{key:1,value:F.value,"onUpdate:value":I=>F.value=I,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),S.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:I=>w.value.toDelOption(_,F)},"删除",8,tf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(w.value.convert.types)?(n.openBlock(),n.createBlock(E,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(P,{value:w.value.convert.dsId,"onUpdate:value":p[17]||(p[17]=S=>w.value.convert.dsId=S),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.tableName,"onUpdate:value":p[18]||(p[18]=S=>w.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.tableName,"onUpdate:value":p[19]||(p[19]=S=>w.value.convert.tableName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(n.openBlock(),n.createBlock(E,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.idField,"onUpdate:value":p[20]||(p[20]=S=>w.value.convert.idField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(n.openBlock(),n.createBlock(E,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.pidField,"onUpdate:value":p[21]||(p[21]=S=>w.value.convert.pidField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.valueField,"onUpdate:value":p[22]||(p[22]=S=>w.value.convert.valueField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.labelField,"onUpdate:value":p[23]||(p[23]=S=>w.value.convert.labelField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.tableField,"onUpdate:value":p[24]||(p[24]=S=>w.value.convert.tableField=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.tableWhere,"onUpdate:value":p[25]||(p[25]=S=>w.value.convert.tableWhere=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.tableOrder,"onUpdate:value":p[26]||(p[26]=S=>w.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.tableOrder,"onUpdate:value":p[27]||(p[27]=S=>w.value.convert.tableOrder=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:w.value.convert.isAsync,"onUpdate:checked":p[28]||(p[28]=S=>w.value.convert.isAsync=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(E,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(M,{checked:w.value.convert.isPaging,"onUpdate:checked":p[29]||(p[29]=S=>w.value.convert.isPaging=S),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),w.value.convert.types=="dict"?(n.openBlock(),n.createBlock(E,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.dictName,"onUpdate:value":p[30]||(p[30]=S=>w.value.convert.dictName=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(n.openBlock(),n.createBlock(E,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode(q,{value:w.value.convert.url,"onUpdate:value":p[31]||(p[31]=S=>w.value.convert.url=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(n.openBlock(),n.createBlock(E,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Lt.Codemirror),{modelValue:w.value.convert.params,"onUpdate:modelValue":p[32]||(p[32]=S=>w.value.convert.params=S),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(A,{visible:k.value.visible,"onUpdate:visible":p[40]||(p[40]=S=>k.value.visible=S),width:600,title:"控件设置",onOk:k.value.toclose},{default:n.withCtx(()=>[n.createVNode(R,{model:k.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(E,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(C,{value:k.value.widget.name,"onUpdate:value":p[34]||(p[34]=S=>k.value.widget.name=S),allowClear:!0,options:k.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),n.createVNode(E,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.widget.placeholder,"onUpdate:value":p[35]||(p[35]=S=>k.value.widget.placeholder=S)},null,8,["value"])]),_:1}),n.createVNode(E,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.widget.help,"onUpdate:value":p[36]||(p[36]=S=>k.value.widget.help=S)},null,8,["value"])]),_:1}),n.createVNode(E,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.widget.tooltip,"onUpdate:value":p[37]||(p[37]=S=>k.value.widget.tooltip=S)},null,8,["value"])]),_:1}),["a-date-picker"].includes(k.value.widget.name)?(n.openBlock(),n.createBlock(E,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.field.dataFormat,"onUpdate:value":p[38]||(p[38]=S=>k.value.field.dataFormat=S)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),k.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(E,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.widget.props.mode,"onUpdate:value":p[39]||(p[39]=S=>k.value.widget.props.mode=S),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(T,{value:"multiple"},{default:n.withCtx(()=>p[60]||(p[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(T,{value:"tags"},{default:n.withCtx(()=>p[61]||(p[61]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(A,{visible:b.value.visible,"onUpdate:visible":p[49]||(p[49]=S=>b.value.visible=S),width:600,title:"规则设置",onOk:b.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{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(E,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(Q,{value:b.value.props.trigger,"onUpdate:value":p[41]||(p[41]=S=>b.value.props.trigger=S),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(E,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(x,{checked:b.value.props.whitespace,"onUpdate:checked":p[42]||(p[42]=S=>b.value.props.whitespace=S)},{default:n.withCtx(()=>p[62]||(p[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(E,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(C,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":p[43]||(p[43]=S=>b.value.props.advance=S)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(n.openBlock(),n.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(E,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(D,{value:b.value.props.rangeMin,"onUpdate:value":p[44]||(p[44]=S=>b.value.props.rangeMin=S)},null,8,["value"]),p[63]||(p[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(D,{value:b.value.props.rangeMax,"onUpdate:value":p[45]||(p[45]=S=>b.value.props.rangeMax=S)},null,8,["value"])]),_:1}),n.createVNode(E,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:b.value.props.rangeMessage,"onUpdate:value":p[46]||(p[46]=S=>b.value.props.rangeMessage=S)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(L,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(E,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(q,{value:b.value.props.regExpress,"onUpdate:value":p[47]||(p[47]=S=>b.value.props.regExpress=S)},null,8,["value"])]),_:1}),n.createVNode(E,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:b.value.props.regMessage,"onUpdate:value":p[48]||(p[48]=S=>b.value.props.regMessage=S)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),lf={class:"unione-props-setting data-field-fkey"},sf={key:0},of=["onClick"],af=["onClick"],rf=["onClick"],df=["onClick"],cf=["onClick"],hf=["onClick"],ff=["onClick"],uf=["onClick"],pf=te(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=K.useDialog(),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),i=n.useModel(o,"modelValue"),l=n.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),s=n.ref({});function a(){s.value={}}function r(u,m){a();const b={};b[m]=u.configs.fkey[m]||"",s.value[u.name]=b}function d(u,m,b){u.configs.fkey.dsn=m,u.configs.fkey.dsnName=b.name,u.configs.fkey.dsnTitle=b.title,u.configs.fkey.dsnId=b.id}function h(u,m,b,y){u.configs.fkey[m]=b,m=="fieldName"&&(u.configs.fkey.fieldTitle=y.title),m=="labelName"&&(u.configs.fkey.labelTitle=y.title)}function f(u){c.value.record=u,c.value.visible=!0,c.value.fields=u.configs?.fkey?.fields||[]}const c=n.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(u,m)=>{c.value.editField[u]=m},onShowFieldChange:(u,m,b)=>{u.name=b.name,u.title=b.title},toAddField:()=>{c.value.fields.push({name:"",title:""}),c.value.editField[c.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{c.value.fields.splice(u,1)}})},toSetting:()=>{c.value.visible=!1,c.value.record.configs=K.utils.obj.ext(c.value.record.configs,{fkey:{fields:c.value.fields}})}});return(u,m)=>{const b=n.resolveComponent("FormOutlined"),y=n.resolveComponent("unione-select-box"),k=n.resolveComponent("a-button"),v=n.resolveComponent("a-table"),w=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",lf,[n.createVNode(v,{columns:t.value,"data-source":l.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",sf,[n.createVNode(b),n.createTextVNode(" "+n.toDisplayString(g.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:g,record:p})=>[["dsnName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnName&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:a,onSelect:(B,V)=>d(p,B,V)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnName),1)],64))],10,of)):["dsnTitle"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnTitle&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:a,onSelect:(B,V)=>d(p,B,V)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnTitle),1)],64))],10,af)):n.createCommentVNode("",!0),["fieldName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.fieldName&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(B,V)=>h(p,"fieldName",B,V)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.fieldTitle),1)],64))],10,rf)):["labelName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.labelName&&"empty"]),onClick:B=>r(p,g.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(y,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":B=>s.value[p.name][g.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(B,V)=>h(p,"labelName",B,V)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.labelTitle)+" ",1),p.configs?.fkey?.labelName?(n.openBlock(),n.createBlock(k,{key:0,type:"link",onClick:n.withModifiers(B=>f(p),["stop"])},{default:n.withCtx(()=>m[4]||(m[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,df)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(O,{visible:c.value.visible,"onUpdate:visible":m[3]||(m[3]=g=>c.value.visible=g),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:c.value.toAddField},{default:n.withCtx(()=>m[5]||(m[5]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(v,{columns:c.value.columns,"data-source":c.value.fields,size:"small"},{bodyCell:n.withCtx(({column:g,record:p,index:B,text:V})=>[g.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",c.value.editField!="title"&&!V&&"empty"]),onClick:C=>c.value.toEditField(B,g.dataIndex)},[c.value.editField[B]=="title"?(n.openBlock(),n.createBlock(y,{key:0,value:p[p.dataIndex],"onUpdate:value":C=>p[p.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:c.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=C=>c.value.editField={}),onSelect:(C,x)=>c.value.onShowFieldChange(p,C,x)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V),1)],64))],10,cf)):n.createCommentVNode("",!0),g.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",c.value.editField!="width"&&!V&&"empty"]),onClick:C=>c.value.toEditField(B,g.dataIndex)},[c.value.editField[B]=="width"?(n.openBlock(),n.createBlock(w,{key:0,onBlur:m[1]||(m[1]=C=>c.value.editField={}),value:p.width,"onUpdate:value":C=>p.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V),1)],64))],10,hf)):n.createCommentVNode("",!0),g.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",c.value.editField!="wiindexdth"&&!V&&"empty"]),onClick:C=>c.value.toEditField(B,g.dataIndex)},[c.value.editField[B]=="index"?(n.openBlock(),n.createBlock(w,{key:0,onBlur:m[2]||(m[2]=C=>c.value.editField={}),value:p.index,"onUpdate:value":C=>p.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(V),1)],64))],10,ff)):n.createCommentVNode("",!0),g.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:C=>c.value.toDelField(B)},"删除",8,uf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),mf={class:"unione-props-setting data-filter"},gf={class:"title"},kf={class:"name"},bf={class:"action"},yf=te(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=K.useDialog(),t=n.useModel(o,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(h){r.value.visible=!0,r.value.filter={...h},r.value.name=h.name}function s(h){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(h,1)}})}const 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(h=>{if(r.value.name){const f=t.value.filter(c=>c.name==r.value.name)[0];if(!f){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(h).forEach(c=>{f[c]=h[c]})}else{if(t.value.filter(c=>c.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(h)}r.value.visible=!1})}});function d(){const h=[];r.value.filter.filter||(r.value.filter.filter=""),h.push("-- @if(isNotEmpty(params."),h.push(r.value.filter.name||"xxx"),h.push(") && !isBlank(params."),h.push(r.value.filter.name||"xxx"),h.push(`)
11
11
  `),h.push(" AND XXX=#{params."),h.push(r.value.filter.name||"xxx"),h.push(`}
12
12
  `),h.push(`-- @}
13
- `),r.value.filter.filter=r.value.filter.filter+h.join("")}return(h,f)=>{const c=n.resolveComponent("a-button"),u=n.resolveComponent("a-card"),m=n.resolveComponent("PlusOutlined"),k=n.resolveComponent("a-empty"),y=n.resolveComponent("a-input"),b=n.resolveComponent("a-form-item"),x=n.resolveComponent("a-textarea"),v=n.resolveComponent("a-tag"),V=n.resolveComponent("a-form"),g=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",pf,[(t.value.length,n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,(p,B)=>(n.openBlock(),n.createBlock(u,{class:"filter-box",size:"small",key:B},{default:n.withCtx(()=>[n.createElementVNode("div",mf,"过滤标题:"+n.toDisplayString(p.title),1),n.createElementVNode("div",gf,"过滤名称:"+n.toDisplayString(p.name),1),n.createElementVNode("div",kf,[n.createVNode(c,{size:"small",onClick:O=>l(p)},{default:n.withCtx(()=>f[4]||(f[4]=[n.createTextVNode("编辑")])),_:2},1032,["onClick"]),n.createVNode(c,{danger:"",size:"small",onClick:O=>s(B)},{default:n.withCtx(()=>f[5]||(f[5]=[n.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),n.createVNode(u,{class:"filter-box btn-add",size:"small",onClick:i},{default:n.withCtx(()=>[n.createVNode(m,{class:"btn"})]),_:1})],64)),n.createVNode(g,{visible:r.value.visible,"onUpdate:visible":f[3]||(f[3]=p=>r.value.visible=p),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(b,{label:"过滤标题",name:"title"},{default:n.withCtx(()=>[n.createVNode(y,{value:r.value.filter.title,"onUpdate:value":f[0]||(f[0]=p=>r.value.filter.title=p)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"过滤名称",name:"name"},{default:n.withCtx(()=>[n.createVNode(y,{value:r.value.filter.name,"onUpdate:value":f[1]||(f[1]=p=>r.value.filter.name=p)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:n.withCtx(()=>[n.createVNode(x,{value:r.value.filter.filter,"onUpdate:value":f[2]||(f[2]=p=>r.value.filter.filter=p),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),n.createVNode(v,{class:"btn-tmpl",color:"blue",onClick:d},{default:n.withCtx(()=>f[6]||(f[6]=[n.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),yf={class:"unione-page form-page data-define-edit"},wf={class:"actions"},xf=te(n.defineComponent({__name:"edit",setup(o){const e=K.useDialog(),t=n.inject("route"),i=n.inject("router"),l=n.ref(),s=n.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),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:[]}}),h=n.ref(!1);function f(){i.back()}function c(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{ht.release([d.value.id]).then(y=>{y.success?(e.success({title:"发布成功",content:y.body}),k(d.value.id)):e.error({title:"发布失败",content:y.body})})}})}async function u(){const y=await l.value.validate(),b={...d.value,...y};b.configs.show=await a.value.getValue(),console.log("formData",b),Y.message.loading({content:"提交中..."}),h.value=!0,ht.save(b).then(x=>{Y.message.destroy(),x.success?(d.value=x.body,l.value.setValue(x.body),a.value.setValue(x.body.configs?.show||{}),Y.message.success("保存成功!")):Y.message.error(x.message)}).finally(()=>{h.value=!1})}const m=n.ref(!1);n.onMounted(()=>{t.query.id&&k(t.query.id)});function k(y){Y.message.loading({content:"加载中..."}),ht.detail(y).then(b=>{b.success?(d.value=b.body,l.value.setValue(b.body),a.value.setValue(b.body.configs?.show||{}),Y.message.destroy()):Y.message.error(b.message)})}return(y,b)=>{const x=n.resolveComponent("unione-form"),v=n.resolveComponent("unione-section"),V=n.resolveComponent("OrderedListOutlined"),g=n.resolveComponent("a-tab-pane"),p=n.resolveComponent("ToolOutlined"),B=n.resolveComponent("ApiOutlined"),O=n.resolveComponent("FunnelPlotOutlined"),C=n.resolveComponent("a-tabs"),w=n.resolveComponent("a-button");return n.openBlock(),n.createElementBlock("div",yf,[n.createVNode(v,{title:"基础信息",type:"line"},{default:n.withCtx(()=>[n.createVNode(x,{form:s.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),n.createVNode(v,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":b[0]||(b[0]=N=>m.value=N)},{default:n.withCtx(()=>[n.createVNode(x,{form:r.value,ref_key:"pageSettingObj",ref:a},null,8,["form"])]),_:1},8,["type","location","modelValue"]),n.createVNode(C,null,{default:n.withCtx(()=>[n.createVNode(g,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(V),b[5]||(b[5]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(ud,{modelValue:d.value.configs.fields,"onUpdate:modelValue":b[1]||(b[1]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(p),b[6]||(b[6]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(tf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":b[2]||(b[2]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-fkeys"},{tab:n.withCtx(()=>[n.createVNode(B),b[7]||(b[7]=n.createTextVNode("外键设置 "))]),default:n.withCtx(()=>[n.createVNode(uf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":b[3]||(b[3]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"data-filter"},{tab:n.withCtx(()=>[n.createVNode(O),b[8]||(b[8]=n.createTextVNode("数据过滤 "))]),default:n.withCtx(()=>[n.createVNode(bf,{modelValue:d.value.configs.filters,"onUpdate:modelValue":b[4]||(b[4]=N=>d.value.configs.filters=N)},null,8,["modelValue"])]),_:1})]),_:1}),n.createElementVNode("div",wf,[n.createVNode(w,{type:"primary",onClick:u,loading:h.value},{default:n.withCtx(()=>b[9]||(b[9]=[n.createTextVNode("保存")])),_:1},8,["loading"]),d.value.id?(n.openBlock(),n.createBlock(w,{key:0,danger:"",onClick:c,loading:h.value},{default:n.withCtx(()=>b[10]||(b[10]=[n.createTextVNode("发布")])),_:1},8,["loading"])):n.createCommentVNode("",!0),n.createVNode(w,{onClick:f},{default:n.withCtx(()=>b[11]||(b[11]=[n.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),vf={UnioneEditor:xt,locales:Zi,loadConfig:Ee,DataStorage:en,Convertor:Ke,install(o,e){K.loadConfig(e);const t=Ee(e);t.axios&&K.axios.create(t.axios),o.component("UnioneBtn",ya),o.component("UnioneTabs",xa),o.component("UnioneSection",Oa),o.component("UnioneQuery",vl),o.component("UnioneTable",Cl),o.component("UnioneFormItem",Ua),o.component("UnioneForm",ja),o.component("UnioneSelectBox",Wa),o.component("UnioneSwitchBox",Ha),o.component("UnioneRadioBox",Ka),o.component("UnioneCheckBox",Qa),o.component("UnionePwdBox",Ga),o.component("UnionePageEditor",Sl),o.component("UnionePageForm",Nl),o.component("UnionePageTree",Bl),o.component("UnionePageList",Ol)}};X.Convertor=Ke,X.DataStorage=en,X.UnioneDataDefineEdit=xf,X.UnioneDataDefineList=sd,X.UnioneEditor=xt,X.UnionePage=jt,X.UnionePageEditor=Sl,X.UnionePageForm=Nl,X.UnionePageList=Ol,X.UnionePageSetting=zt,X.UnionePageTree=Bl,X.UnioneQueryForm=vl,X.UnioneTableList=Cl,X.default=vf,X.loadConfig=Ee,X.locales=Zi,X.utils=mr,Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
13
+ `),r.value.filter.filter=r.value.filter.filter+h.join("")}return(h,f)=>{const c=n.resolveComponent("a-button"),u=n.resolveComponent("a-card"),m=n.resolveComponent("PlusOutlined"),b=n.resolveComponent("a-empty"),y=n.resolveComponent("a-input"),k=n.resolveComponent("a-form-item"),v=n.resolveComponent("a-textarea"),w=n.resolveComponent("a-tag"),O=n.resolveComponent("a-form"),g=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",mf,[(t.value.length,n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,(p,B)=>(n.openBlock(),n.createBlock(u,{class:"filter-box",size:"small",key:B},{default:n.withCtx(()=>[n.createElementVNode("div",gf,"过滤标题:"+n.toDisplayString(p.title),1),n.createElementVNode("div",kf,"过滤名称:"+n.toDisplayString(p.name),1),n.createElementVNode("div",bf,[n.createVNode(c,{size:"small",onClick:V=>l(p)},{default:n.withCtx(()=>f[4]||(f[4]=[n.createTextVNode("编辑")])),_:2},1032,["onClick"]),n.createVNode(c,{danger:"",size:"small",onClick:V=>s(B)},{default:n.withCtx(()=>f[5]||(f[5]=[n.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),n.createVNode(u,{class:"filter-box btn-add",size:"small",onClick:i},{default:n.withCtx(()=>[n.createVNode(m,{class:"btn"})]),_:1})],64)),n.createVNode(g,{visible:r.value.visible,"onUpdate:visible":f[3]||(f[3]=p=>r.value.visible=p),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:n.withCtx(()=>[n.createVNode(O,{ref_key:"filterForm",ref: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(k,{label:"过滤标题",name:"title"},{default:n.withCtx(()=>[n.createVNode(y,{value:r.value.filter.title,"onUpdate:value":f[0]||(f[0]=p=>r.value.filter.title=p)},null,8,["value"])]),_:1}),n.createVNode(k,{label:"过滤名称",name:"name"},{default:n.withCtx(()=>[n.createVNode(y,{value:r.value.filter.name,"onUpdate:value":f[1]||(f[1]=p=>r.value.filter.name=p)},null,8,["value"])]),_:1}),n.createVNode(k,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:n.withCtx(()=>[n.createVNode(v,{value:r.value.filter.filter,"onUpdate:value":f[2]||(f[2]=p=>r.value.filter.filter=p),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),n.createVNode(w,{class:"btn-tmpl",color:"blue",onClick:d},{default:n.withCtx(()=>f[6]||(f[6]=[n.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),wf={class:"unione-page form-page data-define-edit"},xf={class:"actions"},vf=te(n.defineComponent({__name:"edit",setup(o){const e=K.useDialog(),t=n.inject("route"),i=n.inject("router"),l=n.ref(),s=n.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),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:[]}}),h=n.ref(!1);function f(){i.back()}function c(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{ft.release([d.value.id]).then(y=>{y.success?(e.success({title:"发布成功",content:y.body}),b(d.value.id)):e.error({title:"发布失败",content:y.body})})}})}async function u(){const y=await l.value.validate(),k={...d.value,...y};k.configs.show=await a.value.getValue(),console.log("formData",k),Y.message.loading({content:"提交中..."}),h.value=!0,ft.save(k).then(v=>{Y.message.destroy(),v.success?(d.value=v.body,l.value.setValue(v.body),a.value.setValue(v.body.configs?.show||{}),Y.message.success("保存成功!")):Y.message.error(v.message)}).finally(()=>{h.value=!1})}const m=n.ref(!1);n.onMounted(()=>{t.query.id&&b(t.query.id)});function b(y){Y.message.loading({content:"加载中..."}),ft.detail(y).then(k=>{k.success?(d.value=k.body,l.value.setValue(k.body),a.value.setValue(k.body.configs?.show||{}),Y.message.destroy()):Y.message.error(k.message)})}return(y,k)=>{const v=n.resolveComponent("unione-form"),w=n.resolveComponent("unione-section"),O=n.resolveComponent("OrderedListOutlined"),g=n.resolveComponent("a-tab-pane"),p=n.resolveComponent("ToolOutlined"),B=n.resolveComponent("ApiOutlined"),V=n.resolveComponent("FunnelPlotOutlined"),C=n.resolveComponent("a-tabs"),x=n.resolveComponent("a-button");return n.openBlock(),n.createElementBlock("div",wf,[n.createVNode(w,{title:"基础信息",type:"line"},{default:n.withCtx(()=>[n.createVNode(v,{form:s.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),n.createVNode(w,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":k[0]||(k[0]=N=>m.value=N)},{default:n.withCtx(()=>[n.createVNode(v,{form:r.value,ref_key:"pageSettingObj",ref:a},null,8,["form"])]),_:1},8,["type","location","modelValue"]),n.createVNode(C,null,{default:n.withCtx(()=>[n.createVNode(g,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(O),k[5]||(k[5]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(pd,{modelValue:d.value.configs.fields,"onUpdate:modelValue":k[1]||(k[1]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(p),k[6]||(k[6]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(nf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":k[2]||(k[2]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-fkeys"},{tab:n.withCtx(()=>[n.createVNode(B),k[7]||(k[7]=n.createTextVNode("外键设置 "))]),default:n.withCtx(()=>[n.createVNode(pf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":k[3]||(k[3]=N=>d.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"data-filter"},{tab:n.withCtx(()=>[n.createVNode(V),k[8]||(k[8]=n.createTextVNode("数据过滤 "))]),default:n.withCtx(()=>[n.createVNode(yf,{modelValue:d.value.configs.filters,"onUpdate:modelValue":k[4]||(k[4]=N=>d.value.configs.filters=N)},null,8,["modelValue"])]),_:1})]),_:1}),n.createElementVNode("div",xf,[n.createVNode(x,{type:"primary",onClick:u,loading:h.value},{default:n.withCtx(()=>k[9]||(k[9]=[n.createTextVNode("保存")])),_:1},8,["loading"]),d.value.id?(n.openBlock(),n.createBlock(x,{key:0,danger:"",onClick:c,loading:h.value},{default:n.withCtx(()=>k[10]||(k[10]=[n.createTextVNode("发布")])),_:1},8,["loading"])):n.createCommentVNode("",!0),n.createVNode(x,{onClick:f},{default:n.withCtx(()=>k[11]||(k[11]=[n.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),Cf={UnioneEditor:ct,locales:Zi,loadConfig:Ie,DataStorage:en,Convertor:Ke,install(o,e){K.loadConfig(e);const t=Ie(e);t.axios&&K.axios.create(t.axios),o.component("UnioneBtn",ya),o.component("UnioneTabs",xa),o.component("UnioneSection",Oa),o.component("UnioneQuery",vl),o.component("UnioneTable",Cl),o.component("UnioneFormItem",Wa),o.component("UnioneForm",ja),o.component("UnioneSelectBox",Ha),o.component("UnioneSwitchBox",Ka),o.component("UnioneRadioBox",Qa),o.component("UnioneCheckBox",Ga),o.component("UnionePwdBox",Ya),o.component("UnionePageEditor",Sl),o.component("UnionePageForm",Nl),o.component("UnionePageTree",Bl),o.component("UnionePageList",Ol)}};X.Convertor=Ke,X.DataStorage=en,X.UnioneDataDefineEdit=vf,X.UnioneDataDefineList=od,X.UnioneEditor=ct,X.UnionePage=jt,X.UnionePageEditor=Sl,X.UnionePageForm=Nl,X.UnionePageList=Ol,X.UnionePageSetting=zt,X.UnionePageTree=Bl,X.UnioneQueryForm=vl,X.UnioneTableList=Cl,X.default=Cf,X.loadConfig=Ie,X.locales=Zi,X.utils=gr,Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});