@a2simcode/ui 0.0.167 → 0.0.169
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/simcode-ui.es.js +37 -41
- package/dist/simcode-ui.umd.js +1 -1
- package/dist/stats.html +1 -1
- package/docs/examples/form/basic.vue +1 -1
- package/package.json +1 -1
package/dist/simcode-ui.umd.js
CHANGED
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
roundFun,
|
|
14
14
|
sumFun,
|
|
15
15
|
sumproductFun,
|
|
16
|
-
getCompValue)=>{ return ${k} }`;let S;const _=fr(k);if(_.res)try{S=_.fn(a,r,i,l,s,d,c,f,p,u,h,g,m,v,y)}catch(T){console.log(T,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(S)?"":(o.decimal!==void 0&&(S=S.toFixed(o.decimal)),S)}),E=(0,n.computed)(()=>{let b=C.value;return o.thousandSeparator&&(b=Pi(b)),o.isChinese&&(b=ji(b)),b});return(0,n.watch)(C,b=>{x("update:modelValue",b),x("change",{value:b,data:E.value})}),(b,k)=>{const S=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(S,{modelValue:E.value,"onUpdate:modelValue":k[0]||(k[0]=_=>E.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),Wh=$h,Gl=de(Wh),Uh={class:"j-block j-input-count"},Jh={class:"j-input-count-top"},Yh={class:"j-input-count-tool"},Gh={style:{"font-weight":"600"}},Kh={class:"j-input-count-codebox"},qh={key:0,class:"j-input-count-cursor"},Xh={key:0,class:"fun_color"},Zh={key:1,class:"comp_color"},Qh={key:2,class:"num_color"},eg={key:3,class:"j-input-count-cursor"},tg={class:"j-input-count-bottom"},ng={class:"j-input-count-left"},og={class:"mb-8px fw-600"},ag={class:"j-input-count-right"},rg={class:"j-input-count-funs"},ig={style:{"font-weight":"600",padding:"8px"}},lg={class:"j-input-count-funs-content"},sg={class:"j-input-count-fundes"},cg={style:{"font-size":"14px","font-weight":"300"}},dg=(0,n.defineComponent)({name:"JInputCount",__name:"input-count",props:{modelValue:String,list:{type:Array,default:()=>[]},type:{type:String,default:"primary"},size:{type:String},label:{type:String,default:"公式设置"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Ge(),a=e,r=t,i=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4},{label:5,value:5},{label:6,value:6},{label:7,value:7},{label:8,value:8},{label:9,value:9},{label:0,value:0},{label:"i",value:"i"},{label:"+",value:"+"},{label:"-",value:"-"},{label:"*",value:"*"},{label:"/",value:"/"},{label:">",value:">"},{label:"<",value:"<"},{label:"=",value:"="},{label:"(",value:"("},{label:")",value:")"},{label:"[",value:"["},{label:"]",value:"]"},{label:"'",value:"'"},{label:'"',value:'"'},{label:",",value:","},{label:".",value:"."}],l=[{label:"ABS",value:"abs",des:["ABS函数可以获取一个数的绝对值","用法:ABS(数字)","示例:ABS(-8)可以返回8,也就是-8的绝对值"]},{label:"AVERAGE",value:"average",des:["AVERAGE函数可以获取一组数值的算术平均值","用法:AVERAGE(数字1,数字2,...)","示例:AVERAGE({语文成绩},{数学成绩}, {英语成绩})返回三门课程的平均分"]},{label:"CEILING",value:"ceiling",des:["CEILING函数可以将数字增大到最接近原值的指定因数的倍数","用法:CEILING(数字,因数)","示例:CEILING(7,6)返回12,因为12比7大的同时,也是6的倍数中最接近7的数字"]},{label:"COUNT",value:"count",des:["COUNT函数可以获取参数的数量","用法:COUNT(值,值,...)","示例:COUNT(小明,小王,小张,小李)返回4,也就是人员的数量"]},{label:"COUNTIF",value:"countif",des:["COUNTIF函数可以获取数组中满足条件的参数个数","用法:COUNTIF(数组,'条件')","示例:COUNTIF(子表单.性别, '女'),可得到子表单中性别填的是'女'的数据条数;COUNTIF([1,2,3,4],'>2'),可得到1,2,3,4中大于2的数字数量,结果为2。"]},{label:"FIXED",value:"fixed",des:["FIXED函数可将数字舍入到指定的小数位数并输出为文本","用法:FIXED(数字,小数位数)","示例:FIXED(3.1415,2)返回'3.14'"]},{label:"FLOOR",value:"floor",des:["FLOOR函数可将数字减小到最接近原值的指定因数的倍数","用法:FLOOR(数字,因数)","示例:FLOOR(7,6)返回6,因为6比7小的同时,也是6的倍数中最接近7的数字"]},{label:"INT",value:"int",des:["INT函数可以获取一个数的整数部分","用法:INT(数字)","示例:INT(3.1415)返回3,也就是3.1415的整数部分"]},{label:"LARGE",value:"large",des:["LARGE函数可以获取数据集中第k个最大值","用法:LARGE(数组,k)","示例:LARGE({学生成绩.数学成绩},1)返回子表单'学生成绩'中排名第1的'数学成绩'"]},{label:"LOG",value:"log",des:["LOG函数可以根据指定底数返回数字的对数","用法:LOG(数字,底数)","示例:LOG(100,10)返回2,也就是以10为底数100的对数"]},{label:"MAX",value:"max",des:["MAX函数可以获取一组数值的最大值","用法:MAX(数字1,数字2,...)","示例:MAX({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最高分"]},{label:"MIN",value:"min",des:["MIN函数可以获取一组数值的最小值","用法:MIN(数字1,数字2,...)","示例:MIN({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最低分"]},{label:"MOD",value:"mod",des:["MOD函数可以获取两数相除的余数","用法:MOD(被除数,除数)","示例:MOD(4,3)返回1,也就是4/3的余数"]},{label:"POWER",value:"power",des:["POWER函数可以获取数字乘幂的结果","用法:POWER(数字,指数)","示例:POWER(3,2)返回9,也就是3的2次方"]},{label:"PRODUCT",value:"product",des:["PRODUCT函数可以获取一组数值的乘积","用法:PRODUCT(数字1,数字2,...)","示例:PRODUCT({单价}, {数量})获取总价,也就是单价和数量的乘积"]},{label:"RAND",value:"rand",des:["RAND函数可返回大于等于0且小于1的均匀分布随机实数","用法:RAND()","示例:RAND()返回0.424656"]},{label:"ROUND",value:"round",des:["ROUND函数可以将数字四舍五入到指定的位数","用法:ROUND(数字,数字位数)","示例:ROUND(3.1485,2)返回3.15"]},{label:"SMALL",value:"small",des:["SMALL函数可以返回数据集中第k个最小值","用法:SMALL(数组,k)","示例:SMALL({学生成绩.数学成绩}, 1)返回子表单'学生成绩'中排名倒数第一的'数学成绩'"]},{label:"SQRT",value:"sqrt",des:["SQRT函数可以获取一个数字的正平方根","用法:SQRT(数字)","示例:SQRT(9)返回3,也就是9的正平方根"]},{label:"SUM",value:"sum",des:["SUM函数可以获取一组数值的总和","用法:SUM(数字1,数字2,...)","示例:SUM({语文成绩},{数学成绩}, {英语成绩})返回三门课程的总分"]},{label:"SUMPRODUCT",value:"sumproduct",des:["SUMPRODUCT函数可以将数组间对应的元素相乘,并返回乘积之和,适用于加权求和","用法:SUMPRODUCT(数组,数组...)","示例:SUMPRODUCT([1,2,3],[0.1,0.2,0.3])返回1.4,也就是 1×0.1 + 2×0.2 + 3×0.3的值"]}],s=(0,n.ref)(!1),d=(0,n.ref)([]),c=(0,n.reactive)({cells:[],cursor:0}),f=(0,n.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(b){r("update:modelValue",b.length>0?JSON.stringify(b):""),r("change",{value:b.length>0?JSON.stringify(b):"",data:b})}}),p=b=>{d.value=b},u=(b,k)=>{const S={value:b,type:k};if(c.cells.splice(c.cursor,0,S),c.cursor+=1,k==="fun"){const _={value:"(",type:k},T={value:")",type:k};c.cells.splice(c.cursor,0,_,T),c.cursor+=1}},h=()=>{c.cursor>0&&(c.cursor-=1)},g=()=>{c.cursor<c.cells.length&&(c.cursor+=1)},m=()=>{c.cursor>0&&(c.cells.splice(c.cursor-1,1),c.cursor-=1)},v=()=>{c.cells=[],c.cursor=0},x=()=>{c.cells=Vt(f.value),c.cursor=c.cells.length,s.value=!0},w=()=>{f.value=c.cells,s.value=!1},y=()=>{c.cells=[],c.cursor=0,s.value=!1},C=(0,n.computed)(()=>{const b={};return a.list.forEach(k=>{k.children.forEach(S=>{b[S.value]=`${k.label}.${S.label}`})}),b}),E=b=>C.value[b]||b;return(b,k)=>{const S=(0,n.resolveComponent)("j-button"),_=(0,n.resolveComponent)("j-icon"),T=(0,n.resolveComponent)("el-space"),V=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(S,(0,n.mergeProps)(b.$attrs,{type:e.type,size:e.size,label:e.label,onClick:x}),null,16,["type","size","label"]),(0,n.createVNode)(V,{visible:s.value,title:(0,n.unref)(o)("公式设置"),height:800,width:1200,onOk:w,onClosed:y},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Uh,[(0,n.createElementVNode)("div",Jh,[(0,n.createElementVNode)("div",Yh,[(0,n.createElementVNode)("span",Gh,(0,n.toDisplayString)((0,n.unref)(o)("计算公式"))+"=",1),(0,n.createVNode)(T,null,{default:(0,n.withCtx)(()=>[(0,n.createVNode)(S,{type:"text",onClick:h},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowLeft"})]),_:1}),(0,n.createVNode)(S,{type:"text",onClick:g},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowRight"})]),_:1}),(0,n.createVNode)(S,{type:"link",label:"退格",onClick:m}),(0,n.createVNode)(S,{type:"link",danger:"",label:"清空",onClick:v})]),_:1})]),(0,n.createElementVNode)("div",Kh,[c.cells.length==0?((0,n.openBlock)(),(0,n.createElementBlock)("span",qh)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.cells,(j,z)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:z},[j.type=="fun"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Xh,(0,n.toDisplayString)(j.value.toUpperCase()),1)):j.type=="comp"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Zh," #"+(0,n.toDisplayString)(E(j.value))+"# ",1)):j.type=="num"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Qh,(0,n.toDisplayString)(j.value),1)):(0,n.createCommentVNode)("",!0),z+1==c.cursor?((0,n.openBlock)(),(0,n.createElementBlock)("span",eg)):(0,n.createCommentVNode)("",!0)],64))),128))])]),(0,n.createVNode)(T,{class:"j-input-count-mid"},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,(j,z)=>(0,n.createVNode)(S,{key:z,label:j.label+"",onClick:L=>u(j.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,n.createElementVNode)("div",tg,[(0,n.createElementVNode)("div",ng,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.list,(j,z)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:z},[(0,n.createElementVNode)("div",og,(0,n.toDisplayString)((0,n.unref)(o)(j.label)),1),(0,n.createVNode)(T,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(j.children,L=>((0,n.openBlock)(),(0,n.createBlock)(S,{key:L.value,onClick:M=>u(L.value,"comp"),label:(0,n.unref)(o)(L.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,n.createElementVNode)("div",ag,[(0,n.createElementVNode)("div",rg,[(0,n.createElementVNode)("span",ig,(0,n.toDisplayString)((0,n.unref)(o)("函数列表")),1),(0,n.createElementVNode)("div",lg,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l,(j,z)=>(0,n.createVNode)(S,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:z,onMouseover:L=>p(j.des),onClick:L=>u(j.value,"fun"),label:j.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,n.createElementVNode)("div",sg,[(0,n.createElementVNode)("div",null,[(0,n.createElementVNode)("ul",null,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.value,(j,z)=>((0,n.openBlock)(),(0,n.createElementBlock)("li",{key:z,style:{"margin-bottom":"8px"}},[(0,n.createElementVNode)("span",cg,(0,n.toDisplayString)((0,n.unref)(o)(j)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),ug=dg,Kl=de(ug),fg={key:0},pg=(0,n.defineComponent)({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=(0,n.computed)(()=>({...o})),r=(0,n.ref)(),i=(0,n.ref)(null),l=(0,n.computed)(()=>o.options);(0,n.onMounted)(()=>{o.animation&&s()}),(0,n.watch)(()=>o.decimals,()=>{i.value&&i.value.update&&(i.value.options.decimalPlaces=o.decimals,i.value.reset(),i.value.update(o.endValue))},{deep:!0}),(0,n.watch)(()=>o.endValue,u=>{i.value&&i.value.update&&i.value.update(u)});const s=()=>{i.value||(l.value.startVal=o.startValue,l.value.decimalPlaces=o.decimals,l.value.duration=o.duration,i.value=new Mu.CountUp(r.value,Number(o.endValue),l.value),i.value.start(()=>{o.callback?.(i.value)}))};return(0,n.onUnmounted)(()=>{i.value=null}),(0,n.onBeforeUnmount)(()=>{i.value=null}),t({myProps:a,el:r,init:s,start:u=>{i.value&&i.value.start&&i.value.start(()=>{u?.(i.value)})},pauseResume:()=>{i.value&&i.value.pauseResume&&i.value.pauseResume()},reset:()=>{i.value&&i.value.reset&&i.value.reset()},update:u=>{i.value&&i.value.update&&i.value.update(u)}}),(u,h)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"el",ref:r},[e.animation?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",fg,(0,n.toDisplayString)(e.endValue),1))],512))}}),hg=pg,ql=de(hg),gg={class:"j-block j-data-panel"},mg={key:0,class:"j-data-panel-header"},yg={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},vg={class:"j-data-panel-header-right"},bg={class:"j-data-panel-body"},wg=(0,n.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",gg,[e.title?((0,n.openBlock)(),(0,n.createElementBlock)("div",mg,[(0,n.createElementVNode)("div",yg,(0,n.toDisplayString)(e.title),1),(0,n.createElementVNode)("div",vg,[(0,n.renderSlot)(t.$slots,"titleRight")])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",bg,[(0,n.renderSlot)(t.$slots,"default")])]))}}),Cg=wg,Xl=de(Cg),xg={class:"j-divider-content"},kg=(0,n.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=(0,n.computed)(()=>{const r={color:t.color};return t.size&&Number(t.size)&&(r.fontSize=`${t.size}px`),r}),a=(0,n.computed)(()=>({borderTopStyle:t.borderStyle}));return(r,i)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,n.normalizeStyle)(o.value)},[(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,n.normalizeStyle)(a.value)},null,4),(0,n.createElementVNode)("div",xg,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.content||""),1)]),(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,n.normalizeStyle)(a.value)},null,4)],6))}}),Sg=kg,Zl=de(Sg),Eg={class:"j-hpanel"},_g={class:"j-hpanel-main"},Bg=(0,n.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Eg,[(0,n.renderSlot)(t.$slots,"left"),(0,n.createElementVNode)("div",_g,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"right")]))}}),Rg=Bg,Ql=de(Rg),Tg={class:"j-vpanel"},Vg={class:"j-vpanel-main"},Mg=(0,n.defineComponent)({name:"JVpanel",__name:"vpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Tg,[(0,n.renderSlot)(t.$slots,"top"),(0,n.createElementVNode)("div",Vg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"bottom")]))}}),Ag=Mg,es=de(Ag),Ng=(0,n.defineComponent)({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),i=(0,n.ref)(),l=async(f,p)=>{o.ok&&(f("保存数据中..."),i.value=await o.ok(),a("update:modelValue",i.value),a("change",{value:i.value}),p(),r.value.close())},s=()=>o.beforeClose?o.beforeClose(i.value):!0,d=()=>{o.closed?.()},c=()=>{r.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(i.value)},200)};return(0,n.watch)(()=>o.modelValue,f=>{i.value=f},{immediate:!0}),(f,p)=>{const u=(0,n.resolveComponent)("j-button"),h=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(u,(0,n.mergeProps)({style:{width:"auto"}},f.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:c}),null,16,["type","label","size"]),(0,n.createVNode)(h,{ref_key:"layerRef",ref:r,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:d},{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(f.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),jg=Ng,ts=de(jg),Pg=(0,n.defineComponent)({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.computed)({get:()=>o.modelValue,set:p=>{a("update:modelValue",p)}}),i=(0,n.ref)(""),l=p=>{i.value=p},s=()=>i.value,d=p=>o.beforeClose?o.beforeClose(p):!0,c=p=>{a("change",p)},f=(0,n.computed)(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(p,u)=>{const h=(0,n.resolveComponent)("j-code-mirror"),g=(0,n.resolveComponent)("j-layout"),m=(0,n.resolveComponent)("j-input-button");return(0,n.openBlock)(),(0,n.createBlock)(m,{modelValue:r.value,"onUpdate:modelValue":u[1]||(u[1]=v=>r.value=v),type:e.type,"btn-text":f.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":d,ok:s,open:l,onChange:c},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{"right-move":!1,right:560},(0,n.createSlots)({default:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=v=>i.value=v),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["modelValue","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{"model-value":e.example,mode:e.mode,readonly:""},null,8,["model-value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}}),Hg=Pg,ns=de(Hg),zg=(0,n.defineComponent)({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l=(0,n.ref)(),s=(0,n.computed)({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(m){l.value=m,r("update:modelValue",m),r("input",m)}}),d=m=>{r("input",m)},c=m=>{r("focus",m)},f=m=>{r("blur",m)},p=()=>{r("clear"),r("update:modelValue","")},u=m=>{r("change",m)},h=m=>{r("color-change",m),r("change",m)},g=m=>{r("active-change",m)};return t({focus:()=>{i.value?.focus()},blur:()=>{i.value?.blur()},select:()=>{i.value?.select()}}),(m,v)=>{const x=(0,n.resolveComponent)("el-color-picker"),w=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,n.createVNode)(w,(0,n.mergeProps)({ref_key:"inputRef",ref:i,modelValue:s.value,"onUpdate:modelValue":v[1]||(v[1]=y=>s.value=y),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},m.$attrs,{onInput:d,onFocus:c,onBlur:f,onClear:p,onChange:u}),{[e.inputType]:(0,n.withCtx)(()=>[(0,n.createVNode)(x,{modelValue:s.value,"onUpdate:modelValue":v[0]||(v[0]=y=>s.value=y),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:g},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}}),Og=zg,os=de(Og),Lg=(0,n.defineComponent)({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"},align:{default:"left"}},setup(e){const t=e,o=(0,n.computed)(()=>t.class||""),a=(0,n.computed)(()=>{const r={...t.style};return t.color&&(r.color=t.color),t.size&&(typeof t.size=="number"?r.fontSize=`${t.size}px`:r.fontSize=t.size),t.weight&&(r.fontWeight=t.weight),t.align&&(r.textAlign=t.align),r});return(r,i)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-title",o.value]),style:(0,n.normalizeStyle)(a.value)},(0,n.toDisplayString)(e.title),7))}}),Ig=Lg,as=de(Ig),Dg={class:"j-decorated-title-wrapper1"},Fg={class:"j-decorated-title-wrapper1-line"},$g={key:3,class:"j-decorated-title-wrapper2"},Wg={class:"wrapper2"},Ug={class:"wrapper2-line"},Jg={key:4,class:"j-decorated-title-wrapper3"},Yg={class:"wrapper3"},Gg={class:"wrapper3-line"},Kg={key:5,class:"j-decorated-title-wrapper4"},qg={class:"wrapper4"},Xg={class:"wrapper4-center"},Zg={key:6,class:"j-decorated-title-wrapper5"},Qg={class:"wrapper5"},e0={class:"wrapper5-left"},t0={class:"wrapper5-right"},n0=(0,n.defineComponent)({name:"JDecoratedTitle",__name:"decorated-title",props:{title:{default:""},content:{},style:{default:void 0},class:{default:void 0},color:{default:void 0},contentColor:{},backgroundColor:{},size:{default:14},contentSize:{default:12},align:{default:void 0},weight:{default:"normal"},titleType:{default:"title1"}},setup(e){const{t}=Ge(),o=e,a=(0,n.computed)(()=>o.class||""),r=(0,n.computed)(()=>({"font-size":o.size?`${["title5","title7","title8","title9"].includes(o.titleType)?14:o.size}px`:"","font-weight":o.weight,color:o.color})),i=(0,n.computed)(()=>({"font-size":o.contentSize?`${o.contentSize}px`:"",color:o.contentColor})),l=(0,n.computed)(()=>({"--el-border-style":o.titleType==="title3"?"solid":"dashed",borderColor:o.backgroundColor||"var(--j-color-primary)",margin:"0 !important"})),s=(0,n.computed)(()=>o.backgroundColor||"var(--j-color-primary-hover)"),d=(0,n.computed)(()=>({...o.style}));return(c,f)=>{const p=(0,n.resolveComponent)("el-divider");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-decorated-title",a.value]),style:(0,n.normalizeStyle)(d.value)},[e.titleType==="title2"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):["title3","title4"].includes(e.titleType||"")?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createVNode)(p,{class:"m-0",style:(0,n.normalizeStyle)(l.value)},null,8,["style"]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title5"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[(0,n.createElementVNode)("div",Dg,[(0,n.createElementVNode)("div",{class:"j-decorated-title-wrapper1-title",style:(0,n.normalizeStyle)([r.value,{backgroundColor:s.value}])},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",Fg,[(0,n.createElementVNode)("div",{class:"wrapper-line",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram1",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram2",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram3",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)([i.value,{textAlign:"left"}])},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title6"?((0,n.openBlock)(),(0,n.createElementBlock)("div",$g,[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",Wg,[(0,n.createElementVNode)("div",Ug,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper2-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title7"?((0,n.openBlock)(),(0,n.createElementBlock)("div",Jg,[(0,n.createElementVNode)("div",Yg,[(0,n.createElementVNode)("div",Gg,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper3-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title8"?((0,n.openBlock)(),(0,n.createElementBlock)("div",Kg,[(0,n.createElementVNode)("div",qg,[(0,n.createElementVNode)("div",{class:"wrapper4-bg",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",Xg,[(0,n.createElementVNode)("div",{class:"wrapper4-center-label",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border left-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border right-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title9"?((0,n.openBlock)(),(0,n.createElementBlock)("div",Zg,[(0,n.createElementVNode)("div",Qg,[(0,n.createElementVNode)("div",e0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-left-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[0]||(f[0]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-left-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-left-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-left-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper5-center",style:(0,n.normalizeStyle)([{backgroundColor:s.value}])},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",t0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-right-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[1]||(f[1]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-right-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-right-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-right-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:7,style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5))],6)}}}),o0=n0,rs=de(o0),a0={class:"j-block"},r0={class:"j-input-decorated-title-wrapper mb-0px"},i0=(0,n.defineComponent)({name:"JInputDecoratedTitle",__name:"input-decorated-title",props:{modelValue:{default:"title1"},backgroundColor:{default:void 0},color:{default:void 0},weight:{default:void 0},contentColor:{default:void 0},align:{default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Ge(),a=t,r=(0,n.ref)(),i=c=>{r.value?.hide(),a("update:modelValue",c),a("change",c)},l=(0,n.ref)("mdi:chevron-down"),s=()=>{l.value="mdi:chevron-up"},d=()=>{l.value="mdi:chevron-down"};return(c,f)=>{const p=(0,n.resolveComponent)("j-decorated-title"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createElementBlock)("div",a0,[(0,n.createVNode)(h,{width:270,placement:"top-start",trigger:"click","popper-class":"j-input-decorated-title-popover",ref_key:"popoverRef",ref:r,onShow:s,onHide:d},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",r0,[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:e.modelValue,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align"]),(0,n.createVNode)(u,{icon:l.value,size:20},null,8,["icon"])])]),default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(8,g=>(0,n.createElementVNode)("div",{class:"j-input-decorated-title-wrapper",key:g},[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:`title${g}`,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align,onClick:m=>i(`title${g}`)},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align","onClick"])])),64))]),_:1},512)])}}}),l0=i0,is=de(l0),s0=(0,n.defineComponent)({name:"JCodeMirror",__name:"code-mirror",props:{modelValue:{default:""},mode:{default:"javascript"},readonly:{type:Boolean,default:!1},height:{default:void 0},isHint:{type:Boolean,default:!1},handleHint:{type:Function,default:void 0},isScrollToBottom:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l=(0,n.ref)("");let s=null;const d=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,Zn.javascript)();case"css":case"text/css":return(0,ju.css)();case"html":case"text/html":return(0,Pu.html)();case"json":case"application/json":return(0,Hu.json)();case"sql":case"text/x-sql":return(0,zu.sql)();case"xml":case"text/xml":return(0,Ou.xml)();case"python":case"text/x-python":return(0,Lu.python)();case"markdown":case"text/markdown":return(0,Iu.markdown)();case"java":case"text/x-java":return(0,Du.java)();case"vue":case"text/x-vue":return(0,Zn.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,Zn.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,Zn.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,Zn.javascript)({jsx:!0,typescript:!0});default:return(0,Zn.javascript)()}},c=()=>{const m=[Nu.basicSetup,(0,Ft.lineNumbers)(),(0,Ft.highlightActiveLineGutter)(),(0,Ft.highlightSpecialChars)(),(0,lr.history)(),(0,Ft.drawSelection)(),(0,Ft.dropCursor)(),(0,Qn.indentOnInput)(),(0,Qn.bracketMatching)(),(0,ir.closeBrackets)(),(0,Ft.rectangularSelection)(),(0,Qn.foldGutter)(),Ft.keymap.of([...ir.closeBracketsKeymap,...lr.defaultKeymap,...lr.historyKeymap,...Qn.foldKeymap]),(0,Qn.syntaxHighlighting)(Qn.defaultHighlightStyle)];return m.push(d(a.mode)),a.readonly&&m.push(rr.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,ir.autocompletion)({override:[v=>{const x=v.matchBefore(/\w*/);if(!x||x.from===x.to)return null;const w=a.handleHint(x.text);return w.length===0?null:{from:x.from,options:w.map(y=>({label:typeof y=="string"?y:y.label||y.name||"",detail:typeof y=="string"?"":y.detail||"",type:typeof y=="string"?"variable":y.type||"variable",apply:typeof y=="string"?y:y.apply||y.name||y.label||""}))}}]})),m.push(Ft.EditorView.updateListener.of(v=>{if(v.docChanged){const x=v.state.doc.toString();l.value=x,r("update:modelValue",x),r("change",{value:x})}})),m},f=async()=>{i.value&&(s=new Ft.EditorView({state:rr.EditorState.create({doc:a.modelValue,extensions:c()}),parent:i.value}),l.value=a.modelValue)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const v=rr.EditorState.create({doc:m,extensions:c()});i.value&&(s=new Ft.EditorView({state:v,parent:i.value}));const x=s.state.doc.toString();x!==a.modelValue&&s.dispatch({changes:{from:0,to:x.length,insert:a.modelValue}})},u=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const v=s.state.doc.length;s.dispatch({selection:{anchor:v,head:v},scrollIntoView:!0})}},100)},h=()=>{let m=(0,Au.format)(a.modelValue);m=m.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),r("update:modelValue",m),r("change",{value:m})};let g=null;return(0,n.watch)(()=>a.modelValue,m=>{m!==l.value&&(l.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&u()}))}),(0,n.watch)(()=>a.mode,()=>{s&&p()}),(0,n.onMounted)(async()=>{await(0,n.nextTick)(),await f(),typeof window<"u"&&window.ResizeObserver&&i.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(i.value))}),(0,n.onUnmounted)(()=>{g&&i.value&&(g.unobserve(i.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,v)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"codeWraperRef",ref:i,class:"j-code-mirror",style:(0,n.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),c0=s0,ls=de(c0),d0=(0,n.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("actionRef"),r=(0,n.ref)("0"),i=(0,n.computed)(()=>{const{actionStyle:s,toLeft:d}=o;return{...s,left:d?"0":r.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:d?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=(0,n.computed)(()=>Number.parseInt(r.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{r.value=s}}),(s,d)=>{const c=(0,n.resolveComponent)("j-icon");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,n.normalizeStyle)(i.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,n.openBlock)(),(0,n.createBlock)(c,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),u0=d0,f0=(0,n.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("barRef"),r=(0,n.ref)("0"),i=(0,n.computed)(()=>{const{barStyle:l,toLeft:s}=o;return{...l,width:s?"0":r.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:l=>{r.value=l}}),(l,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,n.normalizeStyle)(i.value)},null,4))}}),p0=f0,h0=(0,n.defineComponent)({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("contentRef"),r=(0,n.computed)(()=>{const{contentStyle:l}=o;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const i=(0,n.computed)(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(l,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,n.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,n.normalizeStyle)(r.value)},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(i.value),class:"j-spine-text"},(0,n.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),g0=h0,m0=(0,n.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,n.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,n.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,r=(0,n.useModel)(e,"modelValue"),i=(0,n.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=(0,n.useTemplateRef)("wrapperRef"),s=(0,n.useTemplateRef)("barRef"),d=(0,n.useTemplateRef)("contentRef"),c=(0,n.useTemplateRef)("actionRef");(0,n.watch)(()=>i.isPassing,x=>{if(x){const{endTime:w,startTime:y}=i;a("success",{isPassing:x,time:((w-y)/1e3).toFixed(1)}),r.value=x}}),(0,n.watchEffect)(()=>{i.isPassing=!!r.value});function f(x){return"pageX"in x?x.pageX:"touches"in x&&x.touches[0]?x.touches[0].pageX:0}function p(x){i.isPassing||c.value&&(a("start",x),i.moveDistance=f(x)-Number.parseInt(c.value.getStyle().left.replace("px","")||"0",10),i.startTime=Date.now(),i.isMoving=!0)}function u(x){const w=l.value?.offsetWidth??220,y=x?.offsetWidth??40;return{actionWidth:y,offset:w-y-6,wrapperWidth:w}}function h(x){const{isMoving:w,moveDistance:y}=i;if(w){const C=(0,n.unref)(c),E=(0,n.unref)(s);if(!C||!E)return;const{actionWidth:b,offset:k,wrapperWidth:S}=u(C.getEl()),_=f(x)-y;a("move",{event:x,moveDistance:y,moveX:_}),_>0&&_<=k?(C.setLeft(`${_}px`),E.setWidth(`${_+b/2}px`)):_>k&&(C.setLeft(`${S-b}px`),E.setWidth(`${S-b/2}px`),m())}}function g(x){const{isMoving:w,isPassing:y,moveDistance:C}=i;if(w&&!y){a("end",x);const E=c.value,b=(0,n.unref)(s);if(!E||!b)return;const k=f(x)-C,{actionWidth:S,offset:_,wrapperWidth:T}=u(E.getEl());k<_?v():(E.setLeft(`${T-S}px`),b.setWidth(`${T-S/2}px`),m()),i.isMoving=!1}}function m(){i.endTime=Date.now(),i.isPassing=!0,i.isMoving=!1}function v(){i.isMoving=!1,i.isPassing=!1,i.moveDistance=0,i.toLeft=!1,i.startTime=0,i.endTime=0;const x=(0,n.unref)(c),w=(0,n.unref)(s),y=(0,n.unref)(d);!x||!w||!y||(y.getEl().style.width="100%",i.toLeft=!0,setTimeout(()=>{i.toLeft=!1,x.setLeft("0"),w.setWidth("0")},300))}return(x,w)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"wrapperRef",ref:l,class:(0,n.normalizeClass)(["j-slider-captcha slider-border",o.class]),style:(0,n.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,n.createVNode)(p0,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":i.toLeft},null,8,["bar-style","to-left"]),(0,n.createVNode)(g0,{ref_key:"contentRef",ref:d,"content-style":e.contentStyle,"is-passing":i.isPassing},null,8,["content-style","is-passing"]),(0,n.createVNode)(u0,{ref_key:"actionRef",ref:c,"action-style":e.actionStyle,"is-passing":i.isPassing,"to-left":i.toLeft,onMousedown:p,onTouchstart:p},null,8,["action-style","is-passing","to-left"])],38))}}),y0=m0,ss=de(y0),v0=(0,n.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:r,toArray:i,activeMenu:l,theme:s}=to(),{getHMoreMenus:d}=ll(),c=(0,n.ref)([]);o.pId==="moreId"?c.value=d.value:c.value=i(r()[o.pId||""]||[],[]);const f=g=>{const m=c.value.find(v=>v.active);m?.value!==g.value&&(m&&(m.active=!1),a("click",g))},{list:p,containerProps:u,wrapperProps:h}=(0,sr.useVirtualList)(c,{itemHeight:44});return(g,m)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,n.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,n.unref)(u)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(h))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p),v=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:v.data.value,"parent-actives":(0,n.unref)(l)?.pid?.split(".")||[],item:v.data,"is-sub":"",onClick:f},null,8,["parent-actives","item"]))),128))],16)],16))}}),b0=v0,w0={class:"j-menu-item-label"},C0={class:"j-menu-item-label"},x0={key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow","sub"])},k0={class:"j-menu-item-label"},S0=(0,n.defineComponent)({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=Ge(),{activeMenuId:a}=to(),r=t,i=l=>{r("click",l)};return(l,s)=>{const d=(0,n.resolveComponent)("j-icon"),c=(0,n.resolveComponent)("el-tooltip"),f=(0,n.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,placement:"right"},{content:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1)]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,n.withModifiers)(p=>i(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",w0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(f,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",C0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,n.openBlock)(),(0,n.createElementBlock)("div",x0)):(0,n.createCommentVNode)("",!0)],6)],2)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(b0,{"p-id":e.item.value,onClick:i},null,8,["p-id"])]),_:1},8,["placement"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,n.withModifiers)(p=>i(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",k0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2))}}}),pa=S0,E0=(0,n.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:i}=to(),l=f=>{a("click",f)},{list:s,containerProps:d,wrapperProps:c}=(0,sr.useVirtualList)((0,n.computed)(()=>o.menuList),{itemHeight:44});return(f,p)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,n.unref)(i)==="dark"}]},(0,n.unref)(d)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(c))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(s),u=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:u.data.value,"parent-actives":(0,n.unref)(r)?.pid?.split(".")||[],item:u.data,collapsed:e.collapsed,class:(0,n.normalizeClass)({"menu-item-entering":u.data.entering,"menu-item-leaving":u.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),_0=E0,B0=(0,n.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:i}=to(),l=(0,n.ref)(),s=(0,n.ref)(0);let d=null;(0,n.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(d=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),d.observe(l.value))});const c=(0,n.computed)(()=>{const h=[];let g=0,m=0;const v=o.menuList.length;return o.menuList.forEach(x=>{m++;const w=(Mt(x.label)||0)+32+16+4+8;g+=w,(m===v&&g<=s.value||m<v&&g+56<=s.value)&&h.push(x)}),h.length<o.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),f=(0,n.computed)(()=>{const h=[];let g=0;const m=c.value.length;return o.menuList.forEach(v=>{g++,g>=m&&h.push(v)}),h}),p=(0,n.computed)(()=>{const h=r.value?.pid?.split(".")||[];return(h.length>1&&f.value.findIndex(g=>g.value===h[1])>-1||f.value.findIndex(g=>g.value===r.value?.value)>-1)&&h.push("moreId"),h}),u=h=>{a("click",h)};return sl({getHMoreMenus:f}),(0,n.onUnmounted)(()=>{d&&l.value&&(d.unobserve(l.value),d.disconnect(),d=null)}),(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"menuRef",ref:l,class:(0,n.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,n.unref)(i)==="dark"}])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.value,m=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:u},null,8,["parent-actives","item"]))),128))],2))}}),R0=B0,T0=(0,n.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:i}=to(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,n.computed)(()=>(o.menuList.forEach((h,g)=>{h.color=l[g%l.length]}),o.menuList)),d=(0,n.computed)(()=>r.value?.pid?.split(".")||[]),c=h=>{a("click",h)},{list:f,containerProps:p,wrapperProps:u}=(0,sr.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,n.unref)(i)==="dark"}]},(0,n.unref)(p)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(u))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(f),m=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:m.data.value,"parent-actives":d.value,item:m.data,"is-vertical":"",onClick:c},null,8,["parent-actives","item"]))),128))],16)],16))}}),V0=T0,M0=(0,n.defineComponent)({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let r={};const i=(0,n.ref)("");i.value=o.activeId||"";const l=(m,v,x,w,y)=>{x=x||[];for(let C=0,E=x.length;C<E;C++){const b=x[C],k={};k.pid=v,k.indent=w,i.value===b.value&&(k.active=!0),Object.keys(b).forEach(_=>{_!=="children"&&(k[_]=b[_])}),y&&y.includes(b.value)&&(k.open=!0),m.push(k);const S=b.children||[];S.length>0&&(k.hasChildren=!0,y||(r[k.value]=S),(!y||k.open&&!o.collapsed)&&l(m,`${v}.${k.value}`,S,w+1,y))}},s=(m,v)=>{const x=[];return l(x,"0",m,0,v),x},d=(0,n.ref)([]);let c=[];const f=()=>{r={},c=s(o.menus);const m=[];if(i.value&&o.mode==="inline"){const v=c.find(x=>x.value===i.value);v&&m.push(...v.pid.split("."))}d.value=s(o.menus,m)};(0,n.watch)(()=>o.menus,()=>{f()},{immediate:!0}),(0,n.watch)(()=>o.mode,()=>{f()});const p=()=>{if(d.value.find(m=>m.active)?.value!==i.value){const m=c.find(v=>v.value===i.value);if(m){const v=[];o.mode==="inline"&&v.push(...m.pid.split(".")),d.value=s(o.menus,v)}}},u=(0,n.computed)(()=>c.find(m=>m.value===i.value));(0,n.watch)(()=>o.activeId,()=>{i.value=o.activeId||"",p()}),(0,n.watch)(()=>o.collapsed,()=>{if(o.collapsed)d.value=s(o.menus,[]);else{const m=[];if(i.value){const v=c.find(x=>x.value===i.value);v&&m.push(...v.pid.split("."))}d.value=s(o.menus,m)}});const h=(0,n.computed)(()=>o.theme),g=m=>{if(console.log(m),m.hasChildren){if(o.collapsed)return;const v=[];v.push(...m.pid.split(".")),m.open||v.push(m.value);const x=s(o.menus,v),w=new Set(d.value.map(C=>C.value)),y=new Set(x.map(C=>C.value));x.forEach(C=>{w.has(C.value)||(C.entering=!0)}),d.value.forEach(C=>{y.has(C.value)||(C.leaving=!0)}),d.value=x,setTimeout(()=>{d.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(i.value===m.value)return;i.value=m.value,a("click",m)}};return il({getMenuMap:()=>r,toArray:s,activeMenu:u,activeMenuId:i,theme:h}),(m,v)=>e.mode==="inline"?((0,n.openBlock)(),(0,n.createBlock)(_0,{key:0,"menu-list":d.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,n.openBlock)(),(0,n.createBlock)(R0,{key:1,"menu-list":d.value,onClick:g},null,8,["menu-list"])):((0,n.openBlock)(),(0,n.createBlock)(V0,{key:2,"menu-list":d.value,onClick:g},null,8,["menu-list"]))}}),A0=M0,cs=de(A0),N0={class:"j-keyword-panel"},j0={key:0},P0={key:1,class:"columns-wrapper"},H0=(0,n.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=Ge(),a=e,r=(0,n.useModel)(e,"checkAll"),i=(0,n.useModel)(e,"checkFields"),l=(0,n.ref)(!1),s=(0,n.ref)(""),d=(0,n.computed)(()=>a.columns.filter(u=>u.config?.filter?.isSearchKeyword?s.value?u.config?.label?.indexOf(s.value)!=-1:!0:!1).map(u=>({label:u.config?.label,value:u.id}))),c=()=>{r.value||(r.value=!0,l.value=!1,i.value=[])},f=u=>{u.length>0?r.value=!1:r.value=!0};return t({init:()=>{r.value?l.value=!1:l.value=!0}}),(u,h)=>{const g=(0,n.resolveComponent)("j-icon"),m=(0,n.resolveComponent)("el-input"),v=(0,n.resolveComponent)("j-checkbox");return(0,n.openBlock)(),(0,n.createElementBlock)("div",N0,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["range-item",{active:r.value}]),onClick:c},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索全部")),1),r.value?((0,n.openBlock)(),(0,n.createBlock)(g,{key:0,icon:"mdi:check"})):(0,n.createCommentVNode)("",!0)],2),(0,n.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=x=>l.value=!l.value)},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索特定字段")),1),(0,n.createVNode)(g,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",j0,[(0,n.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=x=>s.value=x),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,n.unref)(o)("搜索"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",P0,[(0,n.createVNode)(v,{modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=x=>i.value=x),options:d.value,style:{display:"flex","flex-direction":"column"},onChange:f},null,8,["modelValue","options"])])):(0,n.createCommentVNode)("",!0)])}}}),z0=H0,O0={key:0,class:"title"},L0={class:"content"},I0={class:"relation"},D0={style:{width:"72px"}},F0={class:"btn-wrapper"},$0={class:"field-wrapper"},W0={class:"buttons"},U0=(0,n.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,n.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=Ge(),r=e,i=(0,n.useModel)(e,"relation"),l=(0,n.useModel)(e,"isPin"),s=(0,n.ref)([]),d=()=>{l.value=!l.value},c=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:p.value.join(","),options:f.value}),config:{style:{width:l.value?"132px":"160px"},appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:w,row:y})=>{const C=r.columns.find(k=>k.id===w)?.config||{};let E="eq",b="text";["options"].includes(C.dataType||"")?E="in":["dateTime"].includes(C.type||"")?(E="range",b="dateTime"):["number"].includes(C.type||"")&&(b="number"),y.method=E,y.type=C.valueType||b,y.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:w})=>{const y=r.columns.find(C=>C.id===w.field)?.config||{};return["options","switch","dataItem","dataView"].includes(y.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"range",label:"选择范围"},{value:"formula",label:"动态筛选"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["number"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{style:{width:l.value?"134px":"130px"},appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:w})=>{w.value=void 0}}},{id:"value",type:"input",getCompType:({row:w})=>{const y=r.columns.find(C=>C.id===w.field)?.config||{};if(["options","dataItem","switch"].includes(y.dataType||"")){if(["in","nin"].includes(w.method)||["eq","ne"].includes(w.method))return"j-select"}else{if(["dateTime"].includes(y.type||""))return["formula"].includes(w.method)?"j-select":"j-date";if(["number"].includes(y.type||""))return"j-number"}return"j-input"},getCompConfig:({row:w})=>{if(["empty","not_empty"].includes(w.method||""))return{display:!1};const y=r.columns.find(E=>E.id===w.field)?.config||{},C={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(w.method||"")&&(C.multiple=!0,C.collapseTags=!0,C.collapseTagsTooltip=!0),["options","dataItem"].includes(y.dataType||"")?(C.collapseTags=!0,C.collapseTagsTooltip=!0,C.dataType=y.dataType,C.dataCode=y.dataCode,C.options=y.options):["switch"].includes(y.dataType||"")?(C.options=[],C.dataType="options",y.activeValue==null?C.options.push({label:"是",value:"1"}):C.options.push({label:"是",value:y.activeValue}),y.inactiveValue==null?C.options.push({label:"否",value:"0"}):C.options.push({label:"否",value:y.inactiveValue})):["dateTime"].includes(y.type||"")&&(["formula"].includes(w.method)?(C.placeholder="",C.options=[{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"明天",value:"tomorrow"},{label:"最近7天",value:"last7days"},{label:"最近30天",value:"last30days"},{label:"本周",value:"thisWeek"},{label:"上周",value:"lastWeek"},{label:"下周",value:"nextWeek"},{label:"本月",value:"thisMonth"},{label:"上月",value:"lastMonth"},{label:"下月",value:"nextMonth"},{label:"本季度",value:"thisQuarter"},{label:"上季度",value:"lastQuarter"},{label:"下季度",value:"nextQuarter"},{label:"今年",value:"thisYear"},{label:"去年",value:"lastYear"},{label:"明年",value:"nextYear"}],C.dataType="options"):(C.selectType="datetime",["range"].includes(w.method)?(C.selectType="datetimerange",C.startPlaceholder="开始时间",C.endPlaceholder="结束时间",C.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):C.placeholder="")),C},config:{style:{width:l.value?"246px":"296px",flex:l.value?"auto":"1"},appendTo:l.value?void 0:".j-filter-panel"}}];(0,n.onMounted)(()=>{s.value=r.searchFieldList});const f=(0,n.computed)(()=>r.columns.filter(w=>!w.children?.length&&!w.config?.isNotFilter).map(w=>({label:w.config?.label,value:w.id,dataType:w.config?.dataType,options:w.config?.options}))),p=(0,n.computed)(()=>s.value.map(w=>w.field)),u=({data:w})=>{if(p.value.includes(w.value))return;const y=r.columns.find(b=>b.id===w.value)?.config||{};let C="eq",E="text";["options","dataItem"].includes(y.dataType||"")?C="in":["dateTime"].includes(y.type||"")&&(C="range",E="dateTime"),s.value.push({field:w.value,method:C,type:y.valueType||E})},h=o,g=()=>{s.value.length=0},m=()=>{l.value?h("filter"):h("close",!0)},v=()=>{s.value.forEach(w=>{w.value=void 0}),h("filter")};return t({getSearchFields:()=>s.value}),(w,y)=>{const C=(0,n.resolveComponent)("j-icon"),E=(0,n.resolveComponent)("j-select"),b=(0,n.resolveComponent)("j-button-select"),k=(0,n.resolveComponent)("j-button"),S=(0,n.resolveComponent)("j-input-rows"),_=(0,n.resolveComponent)("el-tooltip");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-filter-panel",{"is-pin":l.value}])},[l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",O0,[(0,n.createVNode)(C,{icon:"mdi:filter-outline"}),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",L0,[(0,n.createElementVNode)("div",I0,[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选出符合以下")),1),(0,n.createElementVNode)("div",D0,[(0,n.createVNode)(E,{modelValue:i.value,"onUpdate:modelValue":y[0]||(y[0]=T=>i.value=T),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("条件的数据")),1)]),(0,n.createElementVNode)("div",F0,[(0,n.createVNode)(b,{label:"添加过滤条件",options:f.value,"model-value":p.value.join(","),onChange:u},null,8,["options","model-value"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(k,{key:0,type:"text",danger:"",label:"删除全部",onClick:g})):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",$0,[(0,n.createVNode)(S,{modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=T=>s.value=T),columns:c,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),(0,n.createVNode)(_,{placement:"bottom",content:l.value?(0,n.unref)(a)("取消固定"):(0,n.unref)(a)("固定显示")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"pin-btn",onClick:d},[(0,n.createVNode)(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,n.createElementVNode)("div",W0,[(0,n.createVNode)(k,{label:(0,n.unref)(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),(0,n.createVNode)(k,{label:(0,n.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:v},null,8,["label"])])],2)}}}),ds=U0,J0={class:"j-order-panel"},Y0={class:"content"},G0={class:"btn-wrapper"},K0={class:"field-wrapper"},q0={class:"buttons"},X0=(0,n.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=Ge(),r=e,i=o,l=(0,n.computed)(()=>r.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,n.ref)([]),d=(0,n.computed)(()=>s.value.map(g=>g.value)),c=[{id:"label",type:"j-title",getCompConfig:({row:g})=>({title:g?.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],f=({data:g})=>{d.value.includes(g.value)||s.value.push({label:g.label,value:g.value,sord:"ASC"})},p=g=>{s.value=JSON.parse(JSON.stringify(g))},u=()=>{i("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],i("clear")};return t({init:p}),(g,m)=>{const v=(0,n.resolveComponent)("j-button-select"),x=(0,n.resolveComponent)("j-input-rows"),w=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",J0,[(0,n.createElementVNode)("div",Y0,[(0,n.createElementVNode)("div",G0,[(0,n.createVNode)(v,{label:"添加排序规则",options:l.value,"model-value":d.value.join(","),onChange:f},null,8,["options","model-value"])]),(0,n.createElementVNode)("div",K0,[(0,n.createVNode)(x,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=y=>s.value=y),columns:c,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),(0,n.createElementVNode)("div",q0,[(0,n.createVNode)(w,{label:(0,n.unref)(a)("排序"),type:"primary",onClick:u},null,8,["label"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(w,{key:0,label:(0,n.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,n.createCommentVNode)("",!0)])])}}}),Z0=X0,Q0={class:"j-column-panel"},em={class:"content"},tm={class:"search-wrapper"},nm={class:"tree-wrapper"},om={class:"buttons"},am=(0,n.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=Ge(),r=e,i=o,l=(0,n.ref)(),s=(0,n.ref)(""),d={},c=(0,n.ref)([]),f=(0,n.ref)([]),p=(b,k)=>{const S=[],_=new Map;b.forEach(V=>{_.set(V.id||"",V),d[V.id||""]=V});const T=new Set;return k&&k.length>0&&k.forEach(V=>{const j=_.get(V.id);if(j){T.add(j.id||"");const z={id:j.id||"",label:j.config?.label||j.id||"",type:j.type,display:j.config?.display!==!1};j.children&&j.children.length>0&&(z.children=p(j.children,V.children)),S.push(z)}}),b.forEach(V=>{if(!T.has(V.id||"")){const j={id:V.id||"",label:V.config?.label||V.id||"",type:V.type,display:V.config?.display!==!1};V.children&&V.children.length>0&&(j.children=p(V.children)),S.push(j)}}),S},u=(b,k)=>k.length===0?b:b.map(S=>{const _=k.some(V=>S.label.toLowerCase().includes(V.toLowerCase())),T=S.children?u(S.children,k):[];return _||T.length>0?{...S,children:T.length>0?T:S.children}:null}).filter(Boolean),h=(0,n.computed)(()=>{if(!s.value)return f.value;const b=s.value.split(/\s+/).filter(Boolean);return u(f.value,b)}),g=(0,n.ref)([]),m=(0,n.computed)(()=>{const b=new Map;if(r.columnConfig&&r.columnConfig.length>0){const k=S=>{S.forEach(_=>{b.set(_.id,_),_.children&&k(_.children)})};k(r.columnConfig)}return b}),v=()=>{const b=k=>{const S=[];return k.forEach(_=>{let T=!0;if(m.value.size>0){const V=m.value.get(_.id||"");V?T=V.display:T=_.config?.display!==!1}else T=_.config?.display!==!1;T&&(S.push(_.id||""),_.children&&S.push(...b(_.children)))}),S};g.value=b(r.columns)},x=(b,{node:k})=>{b.includes(k.id)?g.value.push(k.id):g.value=g.value.filter(S=>S!==k.id)},w=(b,k,S)=>S==="inner"?!1:b.parent===k.parent,y=()=>{const b=k=>k.map(S=>{const _={...S,display:g.value.includes(S.id)};return S.children&&(_.children=b(S.children)),_});i("save",b(f.value))},C=()=>{if(v(),f.value=JSON.parse(JSON.stringify(c.value)),s.value="",l.value){const b=l.value;b.setCheck&&b.setCheck(g.value);const k=b.$refs?.treeRef||b;k?.setCheckedKeys&&k.setCheckedKeys(g.value)}i("save",void 0)};return t({init:()=>{v(),c.value=p(r.columns,r.columnConfig),f.value=JSON.parse(JSON.stringify(c.value))}}),(b,k)=>{const S=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("el-input"),T=(0,n.resolveComponent)("j-tree"),V=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Q0,[(0,n.createElementVNode)("div",em,[(0,n.createElementVNode)("div",tm,[(0,n.createVNode)(_,{modelValue:s.value,"onUpdate:modelValue":k[0]||(k[0]=j=>s.value=j),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(S,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",nm,[(0,n.createVNode)(T,{ref_key:"treeRef",ref:l,list:h.value,"is-tree-data":!0,"default-checked-keys":g.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":w,check:x},null,8,["list","default-checked-keys","draggable"])])]),(0,n.createElementVNode)("div",om,[(0,n.createVNode)(V,{label:(0,n.unref)(a)("确定"),type:"primary",onClick:y},null,8,["label"]),(0,n.createVNode)(V,{label:(0,n.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),rm=am,im={class:"j-table-panel-left"},lm={class:"j-table-panel-top"},sm={class:"j-table-panel-top-right"},cm={key:0,style:{width:"200px"}},dm={class:"j-table-panel-main"},um={class:"j-table-panel-loading"},fm={class:"j-table-panel-loading-content"},pm={class:"j-table-panel-loading-text"},hm={key:0,class:"j-table-panel-filter-panel"},gm=(0,n.defineComponent)({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},parentKey:{type:String,default:""},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},selectStateKey:{type:String,default:""},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},subColumns:{type:Array,default:()=>[]},isSubShowNumber:{type:Boolean,default:!0},subActions:{type:Array,default:()=>[]},loadChildren:{type:Function,default:null},rowKey:{type:String,default:void 0},sort:String,buttons:{type:Array,default:()=>[]},batchButtons:{type:Array,default:()=>[]},actions:{type:Array,default:()=>[]},actionsMaxCount:{type:Number,default:3},actionsLabel:{type:String,default:"操作"},actionFilter:{type:Function,default:null},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"},showFilterButton:{type:Boolean,default:!0},showOrderButton:{type:Boolean,default:!0},showColumnButton:{type:Boolean,default:!0},showRefreshButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=Ge(),{openLayer:r}=no(),i=e,l=o;i.isMultiple&&!i.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,n.ref)();let d=[];const c=(0,n.ref)(0),f=(0,n.ref)(1);let p=i.pageSize||100;const u=(0,n.ref)(0),h=(0,n.computed)(()=>u.value>0),g=(0,n.ref)([]),m=(0,n.ref)(!1),v=(0,n.computed)(()=>i.batchButtons&&i.batchButtons.length>0),x=(0,n.computed)(()=>g.value.length>0),w=(0,n.computed)(()=>v.value&&x.value&&i.isMultiple||m.value),y=(0,n.computed)(()=>i.isPage&&!w.value);v.value&&!i.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const C=pe=>i.rowKey?i.rowKey.split(",").map(Ce=>pe[Ce.trim()]).join("::"):"",E=(pe,Ce)=>{if(!Ce||Ce.length===0)return pe.filter(ce=>ce.config?.display!==!1).map(ce=>ce.children&&ce.children.length>0?{...ce,children:E(ce.children)}:ce);const Xe=new Map(pe.map(ce=>[ce.id,ce])),Ue=[];return Ce.forEach(ce=>{const Ze=Xe.get(ce.id);if(Ze){if(ce.display){let kt=Ze;Ze.children&&Ze.children.length>0&&(kt={...Ze,children:E(Ze.children,ce.children)}),Ue.push(kt)}Xe.delete(ce.id)}}),pe.forEach(ce=>{if(Xe.has(ce.id)&&ce.config?.display!==!1){let Ze=ce;ce.children&&ce.children.length>0&&(Ze={...ce,children:E(ce.children)}),Ue.push(Ze)}}),Ue},b=(0,n.computed)(()=>E(i.columns,Ae.value)),k=(0,n.computed)(()=>$i(i.columns,pe=>pe.config.label)),S=(0,n.ref)(""),_=(0,n.computed)(()=>k.value.some(pe=>pe.config?.filter?.isSearchKeyword)),T=(0,n.ref)(),V=(0,n.ref)(!0),j=(0,n.ref)([]),z=(0,n.computed)(()=>V.value?"搜索全部":`搜索范围:${k.value.filter(pe=>j.value.includes(pe.id)).map(pe=>pe.config?.label).join("、")}`),L=()=>{T.value.init()},M=(0,n.ref)(),B=(0,n.ref)(!1),D=(0,n.ref)(!1),U=(0,n.ref)(!1),te=(0,n.ref)([]),le=(0,n.ref)("and"),A=(0,n.ref)(),I=(0,n.ref)(!1),W=(0,n.ref)([]),N=()=>{A.value.init(W.value)},he=pe=>{W.value=pe,I.value=!1,ne()},_e=()=>{W.value=[],ne()},ue=(0,n.ref)(),Te=(0,n.ref)(!1),Ae=(0,n.ref)(),Q=(0,n.computed)(()=>Ae.value!=null),ge=()=>{ue.value?.init()},be=pe=>{Ae.value=pe,Te.value=!1},ke=(0,n.ref)(!1),lt=()=>{ke.value=!ke.value},et=()=>{g.value=[],s.value&&(s.value.setSelection?.([]),m.value&&(m.value=!1,s.value.setRecords(d)))},Ve=()=>{m.value=!m.value,m.value?s.value?.setRecords(g.value):(console.log(d,"tableData"),s.value?.setRecords(d)),s.value?.setSelection?.(g.value)},Ct=(0,n.computed)(()=>{if(g.value.length>0&&i.isMultiple){const pe=[{id:"selection_count",label:`已选${g.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:m.value?"全部":"仅选中",config:{type:"text"},click:Ve},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:et}],Ce=i.batchButtons.map(Xe=>({...Xe,click:()=>{Xe.click&&Xe.click({data:g.value,openLayer:r})}}));return[...pe,...Ce]}return i.buttons}),jt=(0,n.computed)(()=>Ct.value.filter(pe=>pe.config?.display!==!1)),xt=(0,n.ref)(null),dt=(0,n.ref)(0),ut=()=>{dt.value=xt.value?.clientWidth||0};let $e;(0,n.onMounted)(()=>{(0,n.nextTick)(ut),$e=new ResizeObserver(()=>{ut()}),xt.value&&$e.observe(xt.value)}),(0,n.onBeforeUnmount)(()=>{$e?.disconnect()}),(0,n.watch)(()=>jt.value,()=>{(0,n.nextTick)(ut)},{deep:!0}),(0,n.watch)(ke,()=>{(0,n.nextTick)(ut)});const mt=(0,n.computed)(()=>{const pe=jt.value;if(pe.length===0)return[];const Ce=dt.value;if(Ce<=0)return pe;const Xe=Math.max(0,Ce-4),Ue=(Me,st)=>Me.groupId||`__auto_${st}`,ce=Me=>{if(Me.config?.notLabel===!0||!Me.label)return 28;const st=24,Rt=Mt(Me.label||"")||0,Tt=Me.config?.icon?18:0;return Math.ceil(Rt+st+Tt+2)};if((Me=>{let st=0,Rt=null;return Me.forEach((Tt,An)=>{const Za=Ue(Tt,An);Rt!==null&&(st+=Za===Rt?-1:8),st+=ce(Tt),Rt=Za}),st})(pe)<=Xe)return pe;const kt={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},ft=28,Et=[];let Ne=0,Pt=null;for(let Me=0;Me<pe.length;Me++){const st=pe[Me],Rt=Ue(st,Me);let Tt=Ne;Pt!==null&&(Tt+=Rt===Pt?-1:8),Tt+=ce(st);const An=pe.length-(Me+1)>0?(Tt>0?8:0)+ft:0;if(Tt+An<=Xe)Et.push(st),Ne=Tt,Pt=Rt;else break}const Mn=pe.slice(Et.length);if(Mn.length===0)return pe;const Kn={...kt,children:Mn};return Et.length===0?[Kn]:[...Et,Kn]});let Xt;const J=async pe=>{u.value++;const Ce={};pe&&(Xt=pe),Xt&&(Ce.query=Xt);try{const Xe={};Xe.rel=le.value,Xe.cond=(M.value?.getSearchFields?.()||te.value).filter(ce=>ce.value!==void 0&&ce.value!==null&&ce.value!==""||["empty","not_empty"].includes(ce.method)).map(ce=>({field:ce.field,method:ce.method,value:ce.value,type:ce.type})),Xe.cond.length>0?U.value=!0:U.value=!1,Ce.filter=Xe;const Ue=W.value.map(ce=>ce.value+" "+ce.sord).join(",");if(S.value&&(Ce.keyword={value:S.value,fields:V.value?k.value.filter(ce=>ce.config?.filter?.isSearchKeyword).map(ce=>ce.id):(0,n.unref)(j)}),i.loadData){if(i.isPage){Ce.pagination={rows:p,page:f.value,sort:Ue||i.sort||i.rowKey};const ce=await i.loadData(Ce)||{};d=ce.rows||[],c.value=ce.records||0}else Ce.sort=Ue,d=await i.loadData(Ce)||[],c.value=d.length;s.value.setRecords(d),v.value?(g.value=[],m.value=!1):i.rowKey&&g.value.length>0&&s.value?.setSelection?.(g.value)}}finally{u.value=Math.max(0,u.value-1)}},ne=async()=>{f.value=1,await J()},q=({rows:pe,page:Ce})=>{p=pe,f.value=Ce,J()},Z=async()=>{g.value=[],m.value=!1,f.value=1,Xt=void 0,await J()},ie=async pe=>{g.value=[],m.value=!1,await J(pe)},we=async()=>{await Z()},Se=pe=>{l("ready",pe)},Le=({selections:pe,record:Ce,checked:Xe,isMultiple:Ue})=>{let ce=[];if(!i.isMultiple){g.value=pe,l("select",{selections:pe,record:Ce,checked:Xe,isMultiple:Ue});return}if(v.value)ce=pe;else if(!i.rowKey)ce=pe;else{const Ze=new Map(pe.map(ft=>[C(ft),ft])),kt=new Map(g.value.map(ft=>[C(ft),ft]));d.forEach(ft=>{const Et=C(ft);Ze.has(Et)?kt.set(Et,Ze.get(Et)):kt.delete(Et)}),ce=Array.from(kt.values())}g.value=ce,l("select",{selections:ce,record:Ce,checked:Xe,isMultiple:Ue}),m.value&&ce.length===0?(m.value=!1,s.value&&s.value.setRecords(d)):m.value&&ce.length>0&&s.value&&(s.value.setRecords(ce),s.value.setSelection?.(ce))},ot=pe=>{g.value=pe},We=()=>g.value||[],Zt=pe=>{g.value=pe,s.value?.setSelection?.(pe)},Qt=()=>s.value;return(0,n.onMounted)(async()=>{i.immediate&&await ie()}),t({refreshData:ie,resetData:Z,getSelection:We,setSelection:Zt,clearSelection:()=>{et()},getTableRef:Qt}),(pe,Ce)=>{const Xe=(0,n.resolveComponent)("j-buttons"),Ue=(0,n.resolveComponent)("j-icon"),ce=(0,n.resolveComponent)("el-popover"),Ze=(0,n.resolveComponent)("el-tooltip"),kt=(0,n.resolveComponent)("el-input"),ft=(0,n.resolveComponent)("j-button"),Et=(0,n.resolveComponent)("j-table");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-table-panel-wrapper",{fullscreen:ke.value,"no-padding":e.noPadding||ke.value}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":ke.value}])},[(0,n.createElementVNode)("div",im,[(0,n.createElementVNode)("div",lm,[(0,n.createElementVNode)("div",{ref_key:"topLeftRef",ref:xt,class:"j-table-panel-top-left"},[(0,n.createVNode)(Xe,{list:mt.value},null,8,["list"])],512),(0,n.createElementVNode)("div",sm,[_.value&&!w.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",cm,[(0,n.createVNode)(kt,{modelValue:S.value,"onUpdate:modelValue":Ce[2]||(Ce[2]=Ne=>S.value=Ne),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,n.withKeys)(ne,["enter"]),onClear:ne},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(Ue,{icon:"mdi:search"})]),suffix:(0,n.withCtx)(()=>[(0,n.createVNode)(Ze,{placement:"bottom",content:z.value},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(ce,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:L,onHide:ne},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Ue,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(z0,{ref_key:"keywordPanelRef",ref:T,"check-all":V.value,"onUpdate:checkAll":Ce[0]||(Ce[0]=Ne=>V.value=Ne),"check-fields":j.value,"onUpdate:checkFields":Ce[1]||(Ce[1]=Ne=>j.value=Ne),columns:k.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),e.showFilterButton&&!B.value&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(ce,{key:1,visible:D.value,"onUpdate:visible":Ce[6]||(Ce[6]=Ne=>D.value=Ne),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:ne},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,n.normalizeClass)({active:U.value})},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(ds,{ref_key:"filterPanelRef",ref:M,"is-pin":B.value,"onUpdate:isPin":Ce[3]||(Ce[3]=Ne=>B.value=Ne),relation:le.value,"onUpdate:relation":Ce[4]||(Ce[4]=Ne=>le.value=Ne),"search-field-list":te.value,columns:k.value,onFilter:ne,onClose:Ce[5]||(Ce[5]=Ne=>D.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):(0,n.createCommentVNode)("",!0),e.showOrderButton&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:2,placement:"bottom",content:(0,n.unref)(a)("排序")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(ce,{visible:I.value,"onUpdate:visible":Ce[7]||(Ce[7]=Ne=>I.value=Ne),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:N},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{class:(0,n.normalizeClass)({active:W.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(Z0,{ref_key:"orderPanelRef",ref:A,columns:k.value,onSave:he,onClear:_e},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showColumnButton&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:3,placement:"bottom",content:(0,n.unref)(a)("显示字段")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(ce,{visible:Te.value,"onUpdate:visible":Ce[8]||(Ce[8]=Ne=>Te.value=Ne),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:ge},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{class:(0,n.normalizeClass)({active:Q.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(rm,{ref_key:"columnPanelRef",ref:ue,columns:e.columns,"column-config":Ae.value,onSave:be},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showRefreshButton&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:4,placement:"bottom",content:(0,n.unref)(a)("刷新")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{type:"text",icon:"mdi:refresh",onClick:we})]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:5,placement:"bottom",content:ke.value?(0,n.unref)(a)("退出全屏"):(0,n.unref)(a)("全屏")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{type:"text",icon:ke.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:lt},null,8,["icon"])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0)])]),(0,n.createElementVNode)("div",dm,[(0,n.withDirectives)((0,n.createElementVNode)("div",um,[(0,n.createElementVNode)("div",fm,[(0,n.createVNode)(Ue,{icon:"mdi:loading",class:"loading-spin",size:24}),(0,n.createElementVNode)("div",pm,(0,n.toDisplayString)((0,n.unref)(a)("加载中")),1)])],512),[[n.vShow,h.value]]),(0,n.createVNode)(Et,{ref_key:"tableRef",ref:s,"table-page":f.value,"onUpdate:tablePage":Ce[9]||(Ce[9]=Ne=>f.value=Ne),columns:b.value,"sub-columns":e.subColumns,records:(0,n.unref)(d),"is-tree":e.isTree,"default-expand-all":e.defaultExpandAll,"parent-key":e.parentKey,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"select-state-key":e.selectStateKey,"is-page":y.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":c.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"action-filter":e.actionFilter,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,onLoadPageData:q,onReady:Se,onSelectionChanged:Le,onSelectRecordsChanged:ot},null,8,["table-page","columns","sub-columns","records","is-tree","default-expand-all","parent-key","is-show-number","is-sub-show-number","is-multiple","select-state-key","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","action-filter","highlight-mode","load-children"])])]),e.showFilterButton&&B.value&&!w.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",hm,[(0,n.createVNode)(ds,{ref_key:"filterPanelRef",ref:M,"is-pin":B.value,"onUpdate:isPin":Ce[10]||(Ce[10]=Ne=>B.value=Ne),relation:le.value,"onUpdate:relation":Ce[11]||(Ce[11]=Ne=>le.value=Ne),"search-field-list":te.value,columns:k.value,onFilter:ne},null,8,["is-pin","relation","search-field-list","columns"])])):(0,n.createCommentVNode)("",!0)],2)],2)}}}),mm=gm,Cr=de(mm),ym={class:"j-button-select"},vm={class:"search-wraper"},bm={class:"options-wraper"},wm=["onClick"],Cm=(0,n.defineComponent)({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=Ge(),i=(0,n.ref)(""),l=(0,n.computed)(()=>i.value===""?o.options:o.options.filter(c=>(c.label||"").includes(i.value))),s=(0,n.computed)(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),d=c=>{if(c.disabled||s.value.includes(c.value))return;const f=[...s.value,c.value].join(",");a("update:modelValue",f),a("change",{value:f,data:c})};return(c,f)=>{const p=(0,n.resolveComponent)("j-button"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-input"),g=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(p,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",ym,[(0,n.createElementVNode)("div",vm,[(0,n.createVNode)(h,{modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=m=>i.value=m),modelModifiers:{trim:!0},placeholder:(0,n.unref)(r)("搜索"),class:"no-border",clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(u,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",bm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l.value,m=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:m.value,class:(0,n.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,n.withModifiers)(v=>d(m),["stop"])},[m.icon?((0,n.openBlock)(),(0,n.createBlock)(u,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(r)(m.label)),1)],10,wm))),128))])])]),_:1},8,["width"])}}}),xm=Cm,us=de(xm),km={class:"j-tree-item-text"},Sm={key:2,class:"j-tree-item-button-group"},Em={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},_m=(0,n.defineComponent)({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,check:Function,emptyDes:{type:String,default:"暂无数据"},defaultIcon:{type:String,default:""},defaultIconColor:{type:String,default:""},treeButtons:{type:Array,default:()=>[]},filterButton:Function,buttonDefaultIcon:{type:String,default:""},buttonIconColor:{type:String,default:""},runFlow:{type:Function},nodeClickFlow:{type:String},isHeightAuto:{type:Boolean,default:!1},theme:{type:String,default:"default"},draggable:{type:Boolean,default:!1},expandOnClickNode:{type:Boolean,default:!1},allowDrop:Function},emits:["node-drop"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:i,t:l}=Ge(),{getDataByComp:s,loadDataByComp:d}=i(),c=(0,n.ref)(),f=(0,n.ref)(!1),p=(0,n.ref)(""),u=(0,n.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,n.computed)(()=>s?s({config:a})||[]:[]),m=(0,n.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,n.unref)(a.list):u.value),v=async()=>{f.value=!0,a.loadData&&(u.value=await a.loadData()||[]),d&&await d({type:"j-tree",config:a}),f.value=!1,(0,n.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},x=(L,M=!0)=>{c.value?.setCurrentKey(L,M)},w=()=>c.value?.getCurrentKey(),y=(L,M=!1)=>{c.value?.setCheckedKeys(L,M)},C=(L=!1)=>c.value?.getCheckedKeys(L),E=async(L,M,B,D)=>{if(p.value=L.value,a.nodeClickFlow&&a.runFlow){const U=JSON.parse(a.nodeClickFlow);await a.runFlow(U,{value:L.value})}a.click&&a.click(L.value,L,D)},b=(L,{checkedKeys:M,checkedNodes:B,halfCheckedKeys:D,halfCheckedNodes:U})=>{a.check&&a.check(M,{node:L,checkedNodes:B,halfCheckedKeys:D,halfCheckedNodes:U})},k=(L,M,B,D)=>{r("node-drop",L,M,B,D)},S=L=>{const M=Vt(a.treeButtons);return L&&a.filterButton?a.filterButton({buttons:M,node:L}):M},{openLayer:_}=no(),T=(L,M)=>{L.config?.disabled||L.click&&L.click({data:M,openLayer:_})},V=(0,n.ref)(""),j=(L,M)=>{V.value=L?M.value:"",console.log(V.value,"row")},z=(L,M,B)=>a.allowDrop?a.allowDrop(L,M,B):!(B=="inner"&&!M.data.canInner);return(0,n.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await v()}),(0,n.watch)(()=>a.list,()=>{f.value=!0,(0,n.nextTick)(()=>{f.value=!1})}),(0,n.watch)(()=>a.dataCode||a.dataType,()=>{v()}),t({refreshData:v,setValue:x,getValue:w,setCheck:y,getCheck:C}),(L,M)=>{const B=(0,n.resolveComponent)("j-icon"),D=(0,n.resolveComponent)("j-button"),U=(0,n.resolveComponent)("el-dropdown-item"),te=(0,n.resolveComponent)("el-dropdown-menu"),le=(0,n.resolveComponent)("el-dropdown"),A=(0,n.resolveComponent)("el-tree"),I=(0,n.resolveComponent)("el-empty"),W=(0,n.resolveDirective)("loading");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!f.value&&m.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(A,{key:0,ref_key:"treeRef",ref:c,"node-key":"value","default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":p.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":z,"expand-on-click-node":e.expandOnClickNode,onNodeClick:E,onCheck:b,onNodeDrop:k},{default:(0,n.withCtx)(({node:N})=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-tree-item-wraper",{"is-focus":V.value===N.data.value}])},[N.data.openIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,class:"j-tree-item-open-icon",size:18,icon:N.data.openIcon,color:N.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),N.data[e.iconKey]||e.defaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:1,class:"j-tree-item-default-icon",size:18,icon:N.data[e.iconKey]||e.defaultIcon||"",color:N.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",km,(0,n.toDisplayString)(N.label),1),S(N.data).length?((0,n.openBlock)(),(0,n.createElementBlock)("div",Sm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(S(N.data),(he,_e)=>((0,n.openBlock)(),(0,n.createBlock)(le,{key:_e,trigger:"click",onVisibleChange:ue=>j(ue,N.data)},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(te,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(he.children,(ue,Te)=>((0,n.openBlock)(),(0,n.createBlock)(U,{key:Te,disabled:ue.disabled,divided:ue.divided,onClick:(0,n.withModifiers)(Ae=>T(ue,N.data),["stop"])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"j-flex-item",style:(0,n.normalizeStyle)({color:ue.danger?"var(--j-color-danger)":ue.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ue.icon||e.buttonDefaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,icon:ue.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(l)(ue.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(D,{icon:he.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,n.createCommentVNode)("",!0)],2)]),_:1},8,["default-checked-keys","default-expanded-keys","current-node-key","data","default-expand-all","show-checkbox","highlight-current","accordion","filter-node-method","render-after-expand","draggable","expand-on-click-node"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",Em,[(0,n.createVNode)(I,{description:(0,n.unref)(l)(e.emptyDes)},null,8,["description"])]))],2)),[[W,f.value]])}}}),Bm=_m,fs=de(Bm),Rm=(0,n.defineComponent)({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:""},valueKey:{default:""},pidKey:{default:""},idKey:{default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,{useData:a}=Ge(),{getDataByComp:r}=a(),i=(0,n.computed)(()=>r?r({type:"j-tree-select",config:o})||[]:[]),l=(0,n.computed)(()=>o.options?o.options:o.dataCode||o.dataType?i.value:[]),s=t,d=(0,n.computed)({get(){return o.modelValue},set(f){s("update:modelValue",f)}}),c=f=>{s("change",f)};return(f,p)=>{const u=(0,n.resolveComponent)("el-tree-select");return(0,n.openBlock)(),(0,n.createBlock)(u,{modelValue:d.value,"onUpdate:modelValue":p[0]||(p[0]=h=>d.value=h),style:{width:"100%"},data:l.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:c},null,8,["modelValue","data","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}}),Tm=Rm,ps=de(Tm),hs=de(Nl),Vm=cr.default;async function Mm(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const r=new Vm({[e]:[a]});let i=[];try{await r.validate({[e]:t})}catch(l){l.errors?i=l.errors.map(({message:s})=>s):i=[a.message||"校验错误"]}return i.length>0?i[0]:""}async function Am(e,t,o){const a=o.map((r,i)=>({...r,ruleIndex:i})).sort(({warningOnly:r,ruleIndex:i},{warningOnly:l,ruleIndex:s})=>!!r==!!l?i-s:r?1:-1);for(let r=0;r<a.length;r+=1){const i=a[r];"pattern"in i&&(t+="");const l=await Mm(e,t,i);if(l!=="")return{name:e,errors:l}}}function Nm(e,t){const o=(i,l,s,d,c)=>{Object.keys(l).forEach(f=>{let p=f;s&&(p=`${s}.${f}`);const u=l[f],{rules:h,myGridtableId:g}=t(p,s?l:void 0,()=>d,c);if(h.length){const m=a(p,u,h);i.push(m)}g&&u.forEach(m=>{o(i,m,g,u,s?l:void 0)})})},a=(i,l,s)=>Am(i,l,s);return{validateForm:async()=>{const i=(0,n.unref)(e),l=[];o(l,i,"");const s=await Promise.all(l),d={};return s.forEach(c=>{c&&(d[c.name]={msg:c.errors})}),d},validateField:a}}var jm=({data:e,actions:t,utils:o,inputParams:a,notRunActions:r})=>{const i=s=>e.filter(d=>d.source===s).map(d=>d.target),l=async s=>{s=s||"start";const d=e.find(c=>c.id===s);if(d.config.type==="start"){const c=i(s);for(let f=0;f<c.length;f++)await l(c[f])}else{const c=t[d.config.type];c&&await c(d.config,o,async f=>{if(f=f||{},f.nodeId=s,f.next!==!1){const p=i(f.nodeId);for(let u=0;u<p.length;u++)await l(p[u])}},a,f=>{r[f]={data:e,inputParams:a}})}};return{run:l}},Pm=(0,n.defineComponent)({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1},actions:{type:Object,default:()=>({})}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:i,existField:l,httpGet:s,httpPost:d,success:c,warning:f,error:p,info:u,t:h}=Ge();let g;i&&(g=i());const m=J=>{p&&p(J)},v=(0,n.ref)(!1),x=(0,n.computed)(()=>a.config?.gutter||16),w=(0,n.computed)(()=>a.config?.span||24),y=(0,n.computed)(()=>a.config?.labelWidth),C=(0,n.computed)(()=>a.config?.labelPosition||"right"),E=(0,n.computed)(()=>S.length===1&&(S[0].type==="j-tabs"||S[0].type==="j-layout"||S[0].config?.isAutoWindow)),b=(0,n.reactive)({}),k=(0,n.ref)({}),S=[],_={};let T={},V={},j=[],z={};const L=async J=>{v.value&&D&&(J.getTableData||pr(D,J.id,J.formData[J.id])),r("change",J),_[J.id]?.config?.codeChange&&await mt(JSON.parse(_[J.id]?.config?.codeChange),{param:J}),a.config?.codeChange&&await mt(JSON.parse(a.config?.codeChange),{param:J})},M=J=>ia(_[J]?.type||"")&&!_[J]?.config?.notInput||_[J]?.config?.isInput,B=J=>["j-table","j-input-rows","j-input-cards"].includes(_[J]?.type||"");let D;const U=(J,ne)=>{Object.keys(J).forEach(q=>{const Z=J[q];ne&&(q=ne+"."+q),Z!=null&&typeof Z=="object"&&!oa(Z)&&U(Z,q),b[q]=Z})},te=(J,ne)=>{let q=J.id;return q||(J.config?.table&&J.config?.field?q=`${J.config.table}.${J.config.field}`:J.config?.table?q=J.config?.table:J.config?.field&&(q=J.config?.field),ne&&B(ne)&&(q=`${ne}.${q}`)),q||ra("j")},le=(J,ne,q,Z="")=>{J.forEach(ie=>{ie.id=te(ie,Z);const we={id:ie.id,slot:ie.slot,type:ie.type||"",getCompType:ie.getCompType,getCompConfig:ie.getCompConfig,config:{},children:[]};ne.push(we);const{children:Se}=ie;ko(we,ie,["children","config"]),ko(we.config,ie.config||{},[]),_[ie.id]&&console.warn("有重复的组件id:"+ie.id),_[ie.id]=we,a.readonly===!0&&(we.config.readonly=!0);let Le=!1,ot;Z!==""&&B(Z)&&(Le=!0,we.config=ie.config||{},we.config.parentTableId=Z,ot=_[Z]?.config?.table);const We=we.config||{};if(M(ie.id))!q&&Le===!1&&(We?.defaultValue===0?b[ie.id]=We?.defaultValue:b[ie.id]=We?.defaultValue||void 0),We.table&&We.field?T[`${We.table}_${We.field}`.toLowerCase()]=ie.id:We.field&&(Le?T[`${ot}_${We.field}`.toLowerCase()]=ie.id:T[`${We.field}`.toLowerCase()]=ie.id);else if(Le&&We.field)T[`${ot}_${We.field}`.toLowerCase()]=ie.id;else if(B(ie.id))!q&&!We.isSubTable&&(b[ie.id]=[]),We.table&&(T[We.table.toLowerCase()||""]=ie.id),We.isSubTable||j.push(we);else if(We?.defaultValue)b[ie.id]=We?.defaultValue;else if(ie.type==="collapse"&&We?.isExpand){const Zt=[];(We?.groups||[]).forEach(Qt=>{Zt.push(Qt.i)}),b[ie.id]=Zt}Se&&Se.length>0&&le(Se,we.children,q,we.id)})},A=async(J,ne)=>{v.value=!1;const q=!!ne;S.splice(0,S.length),T={},V={},j=[],D=ne,eo(b),eo(_),q&&U(ne,""),le(J,S,q),z=Vt(b),await(0,n.nextTick)(),v.value=!0,await(0,n.nextTick)(),a.config?.codeInit&&await mt(JSON.parse(a.config?.codeInit),{param:{}})},I=(J,ne,q)=>{const Z=[];return ne.forEach(ie=>{const we={};Object.keys(ie).forEach(Se=>{if(!q||q(Se,ie[Se],J)){const Le=be(Se);if(Le?.type==="j-table")we[Le?.id||""]=I(Se,ie[Se],q);else{let ot=T[`${J}_${Se}`.toLowerCase()]||Se;ot=ot.indexOf(".")!==-1?ot.split(".")[1]:ot,we[ot]=ie[Se]}}}),Z.push(we)}),Z},W=(J,ne)=>{Object.keys(J||{}).forEach(q=>{let Z=J[q];const ie=be(q);if(ie===void 0)Z&&(oa(Z)&&(Z=Z[0]||{}),typeof Z=="object"?Object.keys(Z).forEach(we=>{if(!ne||ne(q,Z[we],q)){let Se=we;q!=="main"&&(Se=`${q}_${we}`),V[Se]=q,b[T[Se.toLowerCase()]||we]=Z[we]}}):b[q]=Z);else if(B(ie.id||"")){if(!Array.isArray(Z)){console.warn("表格数据不是数组:"+q);return}Z?.length>0?b[T[q.toLowerCase()]||q]=I(q,Z,ne):b[T[q.toLowerCase()]||q]=[]}else(!ne||ne(q,Z,q))&&(b[T[q.toLowerCase()]||q]=Z)}),D&&Object.keys(b).forEach(q=>{const Z=be(q);(Z===void 0||!["j-tabs","j-collapse"].includes(Z.type||""))&&pr(D,q,b[q])})},N=new Set(["parentRow","_i","_compTypeByRender"]),he=(J,ne=!1)=>{const q={};return Object.keys(J).forEach(Z=>{if(N.has(Z))return;const ie=_[Z];if(ie){const we=ie.config?.table,Se=ie.config?.field;if(ne)Se?q[Se]=J[Z]:q[Z]=J[Z];else if(B(Z)){const Le=[];J[Z].forEach(ot=>{Le.push(he(ot,!0))}),q[we||Z]=Le}else we&&Se?(q[we]=q[we]||{},q[we][Se]=J[Z]):Se&&(q[Se]=J[Z])}else ne?Z!=="_X_ROW_KEY"&&Z!=="_isHover"&&(q[Z]=J[Z]):V[Z]?(q[V[Z]]=q[V[Z]]||{},q[V[Z]][Z.replace(`${V[Z]}_`,"")]=J[Z]):q[Z]=J[Z]}),q},_e=(J=!0)=>J?he(b):b,ue=(J,ne,q,Z)=>{let ie=_[J];if(ie==null){const Se=J.split(".");ie=_[Se[Se.length-1]]||{}}if(!ie)return{};const we=zt({config:ie.config||{},getCompConfig:ie.getCompConfig,formData:b,getTableData:q,row:ne,pRowData:Z});return we._componentId=ie?.id,we},Te=(J,ne,q,Z)=>{const ie=ue(J,ne,q,Z);if(ie.isNotRule!==!0&&ie.display!==!1){const we=ie.rule||[],Se=we.find(Le=>Le.type==="only");return Se&&(Se.validator=async(Le,ot)=>{if(ot&&!await l({table:Le.table,key:Le.key,keyName:Le.keyName,field:Le.field,keyValue:Le.getKeyValue?Le.getKeyValue():"",value:ot,paramNames:Le.paramNames,getParams:Le.getParams,withProjectId:Le.withProjectId,getValue:Le.getValue,formData:b}))throw h(Le.message)||h("数据值重复")}),{rules:we,myGridtableId:B(ie._componentId)?ie._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:Ae}=Nm(b,Te),Q=async()=>{k.value={};const J=await Ae();return Object.keys(J).length>0?(k.value=J,m(`${h(_[Object.keys(J)[0]]?.config?.label)}:${h(J[Object.keys(J)[0]].msg)}`),!1):!0},ge=()=>{k.value={},eo(b),Object.keys(z||{}).forEach(J=>{b[J]=z[J]})},be=J=>{let ne=_[J];return ne===void 0&&T[J.toLowerCase()]&&(ne=_[T[J.toLowerCase()]]),ne},ke=({id:J,i:ne,value:q,type:Z})=>{if(Z==="add")b[J].push(q);else if(Z==="delete")b[J].splice(ne,1);else{const ie=be(J);ie&&(ie.config.parentTableId?b[ie.config.parentTableId][ne][J]=q:b[J]=q)}},lt=({id:J,i:ne})=>{const q=be(J);if(q){if(q.config.parentTableId){const Z=b[q.config.parentTableId],ie=q.id?q.id.replace(`${q.config.parentTableId}.`,""):"";if(ne!=null)return(Z[ne]||{})[ie||""];const we=[];return Z&&Z.forEach(Se=>{we.push(Se[ie||""])}),we}if(B(q.id||"")){const Z=[];return b[q.id||""].forEach(ie=>{Z.push(he(ie,!0))}),Z}return b[q.id||""]}if(b[J])return b[J]},et=async({id:J,i:ne})=>{const q=lt({id:J,i:ne}),Z=be(J);if(Z&&g?.getLabel)if(ne!==void 0){const ie=q[ne],we=b[Z.config.parentTableId||""][ne],Se=zt({config:Z.config,getCompConfig:Z.getCompConfig,formData:b,tableData:b[Z.config.parentTableId||""],row:we});return await g?.getLabel({value:ie,config:Se,formData:b,tableData:b[Z.config.parentTableId||""],row:we})}else{const ie=zt({config:Z.config,getCompConfig:Z.getCompConfig,formData:b});return await g?.getLabel({value:q,config:ie,formData:b})}return q},Ve=async(J,ne)=>g?.loadViewDataList?await g?.loadViewDataList(J,ne,!1):[],Ct=J=>(J.set=ke,J.get=lt,J.setFormData=W,J.getFormData=_e,J.getLabel=et,J.getViewData=Ve,J.getDateNow=ne=>sa(new Date,ne||"YYYY-MM-DD HH:mm:ss"),J.httpGet=s||(()=>{console.log("当前状态不支持")}),J.httpPost=d||(()=>{console.log("当前状态不支持")}),J.loading=ne=>{Pn(ne)},J.showMsg=({text:ne,type:q})=>{switch(q){case"success":c&&c(ne);break;case"warning":f&&f(ne);break;case"error":p&&p(ne);break;case"info":u&&u(ne);break;default:u&&u(ne);break}console.log("showMsg",ne,q)},J),jt=async(J,ne)=>{if(J&&J.trim()){J=`async (jcode) => {${J}}`;const{res:q,fn:Z}=fr(J);q&&await Z(Ct(ne))}},xt=async()=>{a.config?.codeAfterSetData&&await mt(JSON.parse(a.config?.codeAfterSetData),{param:{}})},dt=async()=>{a.config?.codeBeforeSave&&await mt(JSON.parse(a.config?.codeBeforeSave),{param:{}})},ut=async()=>{a.config?.codeAfterSave&&await mt(JSON.parse(a.config?.codeAfterSave),{param:{}})};a.schema&&A(a.schema);const $e={},mt=async(J,ne)=>{const{run:q}=jm({data:J,actions:a.actions,utils:{showLoading:Pn,executeEvent:jt},inputParams:ne,notRunActions:$e});await q()};return mr({formData:b,components:_,errorFields:k,isAutoWindow:E,gutter:x,span:w,labelWidth:y,labelPosition:C,getValue:lt,formChange:L,runFlow:mt,runFlowByNotRunActions:async J=>{const ne=$e[J];ne&&(delete $e[J],await mt(ne.data,ne.inputParams))}}),vr({contextType:"form"}),t({init:A,reset:ge,validate:Q,setValue:ke,getValue:lt,getLabel:et,setFormData:W,getFormData:_e,afterSetData:xt,beforeSave:dt,afterSave:ut}),(J,ne)=>{const q=(0,n.resolveComponent)("j-form-item"),Z=(0,n.resolveComponent)("el-row"),ie=(0,n.resolveComponent)("el-form");return v.value?((0,n.openBlock)(),(0,n.createBlock)(ie,{key:0,class:(0,n.normalizeClass)(["j-form",e.isAutoSize&&"j-block",e.isAutoSize&&"j-form-auto"]),"label-position":C.value,"label-width":y.value,size:e.config?.size,onSubmit:ne[0]||(ne[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[E.value?((0,n.openBlock)(),(0,n.createBlock)(q,(0,n.mergeProps)({key:0},S[0],{"is-not-col":""}),null,16)):((0,n.openBlock)(),(0,n.createBlock)(Z,{key:1,gutter:x.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(S,we=>(0,n.createVNode)(q,(0,n.mergeProps)({key:we.id},{ref_for:!0},we),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,n.createCommentVNode)("",!0)}}}),Hm=Pm,gs=de(Hm),ms=de(Al),zm={class:"j-page"},Om=(0,n.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=(0,n.ref)(!1),r=(0,n.reactive)([]),i={},l=(0,n.reactive)({}),s=(g,m)=>{g.forEach(v=>{v.id=v.id||ra("c");const x={id:v.id,slot:v.slot,type:v.type||"",getCompConfig:v.getCompConfig,getCompType:v.getCompType},{children:w}=v;i[v.id]=x,x.config=[],ko(x.config,v.config||{},["defaultValue"]),v?.config?.defaultValue!==void 0&&(l[v.id]=v.config.defaultValue),m.push(x),w&&w.length>0&&(x.children=[],s(w,x.children))})},d=g=>{a.value=!1,r.splice(0,r.length),eo(i),eo(l),s(g,r),(0,n.nextTick)(()=>{a.value=!0})};o.schema&&d(o.schema);const c=new gr,f=new Map,p=(g,m,v,...x)=>{if(v?.immediate){const w=f.get(g)||new Map;w.set(m,x),f.set(g,w)}return c.emit(g,m,...x)},u=(g,m)=>{c.on(g,m);const v=f.get(g);v&&(f.delete(g),v.forEach((x,w)=>{m(w,...x||[])}))},h=(g,m)=>{c.off(g,m)};return pl({registerMethod:(g,m)=>(u(g,m),()=>{h(g,m)})}),vr({contextType:"page"}),t({init:d,call:p,on:u,off:h}),(g,m)=>{const v=(0,n.resolveComponent)("j-comp");return(0,n.openBlock)(),(0,n.createElementBlock)("div",zm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r,x=>((0,n.openBlock)(),(0,n.createBlock)(v,{key:x.id,id:x.id,type:x.type,config:x.config,children:x.children},null,8,["id","type","config","children"]))),128))])}}}),Lm=Om,ys=de(Lm),Im=(0,n.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)("");return(0,n.watch)(()=>o.modelValue,i=>{i?r.value=i:(r.value=an(),a("update:modelValue",r.value))},{immediate:!0}),(i,l)=>{const s=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(s,{modelValue:r.value,"onUpdate:modelValue":l[0]||(l[0]=d=>r.value=d),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),Dm=Im,vs=de(Dm),Fm={key:0,class:"j-panel-top"},$m=["title"],Wm={style:{margin:"0","font-size":"14px"}},Um={key:1},Jm={key:1,class:"j-panel-bottom"},Ym=(0,n.defineComponent)({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=no(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,r)=>{const i=(0,n.resolveComponent)("j-button"),l=(0,n.resolveComponent)("el-tooltip"),s=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-block",style:(0,n.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,n.createElementVNode)("div",{class:"j-panel",style:(0,n.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",Fm,[e.notTitle?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,n.renderSlot)(a.$slots,"title",{},()=>[(0,n.createElementVNode)("span",Wm,(0,n.toDisplayString)(e.title||""),1)])],8,$m)),e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("span",Um,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.toolBtns,d=>((0,n.openBlock)(),(0,n.createBlock)(l,{key:d.id,placement:"top",content:d.label||""},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(i,(0,n.mergeProps)({ref_for:!0},d.config,{onClick:c=>o(d),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"j-panel-body",style:(0,n.normalizeStyle)(e.bodyStyle)},[(0,n.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",Jm,[(0,n.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,n.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,n.createCommentVNode)("",!0)],4)],4)}}}),Gm=Ym,bs=de(Gm),Km={class:"j-input-rows"},qm={key:0,class:"j-input-rows-num"},Xm={key:1,class:"j-input-rows-char"},Zm=(0,n.defineComponent)({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""},actions:{type:Array,default:()=>[]}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=E=>E==null,a=e,r=t,{formData:i}=un(),l=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),c=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),f=(0,n.computed)(()=>a.editConfig.readonly),p=(0,n.computed)(()=>a.editConfig.drag),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)(),g=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],m=(0,n.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(E=>{E._i||(E._i=an())})):(m.value=[],r("update:modelValue",m.value)),(0,n.watch)(()=>a.modelValue,E=>{m.value=a.modelValue||[],m.value=E||[],m.value.forEach(b=>{b._i||(b._i=an())})},{deep:!0});const x=E=>{const b={};return!a.isCompact&&E.config?.width&&(b.width=`${E.config.width}px`),b},w=()=>{const E={_i:an()};a.columns.forEach(b=>{const k=b.config?.valueRowKey||b.id||"";k&&(E[k]=Vt(b.config?.defaultValue))}),m.value.push(E),r("change",{id:a.id,value:E,data:E,formData:i,tableData:m.value,type:"add"})},y=E=>{const b=m.value[E];m.value.splice(E,1),r("change",{id:a.id,value:b,data:b,formData:i,tableData:m.value,type:"delete"})},C=E=>{r("rowChange",E)};return(0,n.onMounted)(()=>{if(!p.value||!h.value)return;const E=h.value,{initSortable:b}=ol(E,{handle:".j-input-rows-drag",onEnd:k=>{const{oldIndex:S,newIndex:_}=k;if(o(S)||o(_)||S===_||S<0||_<0)return;const T=m.value.splice(S,1)[0];m.value.splice(_,0,T),r("change",{id:a.id,value:T,data:T,formData:i,tableData:m.value,type:"sort"})}});b()}),_o({getTableData:()=>m.value,rowChange:C}),(E,b)=>{const k=(0,n.resolveComponent)("j-comp"),S=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("j-button"),T=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Km,[(0,n.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(m.value,(V,j)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:V._i+j,class:(0,n.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,n.openBlock)(),(0,n.createElementBlock)("div",qm,(0,n.toDisplayString)(j+1),1)):(0,n.createCommentVNode)("",!0),e.showChar?((0,n.openBlock)(),(0,n.createElementBlock)("div",Xm,(0,n.toDisplayString)(g[j%26]),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,z=>((0,n.openBlock)(),(0,n.createBlock)(k,(0,n.mergeProps)({key:z.id,ref_for:!0},z,{row:V,style:x(z)}),null,16,["row","style"]))),128)),p.value?((0,n.openBlock)(),(0,n.createBlock)(S,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,n.createCommentVNode)("",!0),c.value&&(u.value||m.value.length>1)&&!f.value?((0,n.openBlock)(),(0,n.createBlock)(S,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:z=>y(j)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)],2))),128))],512),!f.value&&l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":d.value}),class:"j-input-rows-actions"},[l.value?((0,n.openBlock)(),(0,n.createBlock)(_,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:w},null,8,["label"])):(0,n.createCommentVNode)("",!0),e.actions&&e.actions.length>0?((0,n.openBlock)(),(0,n.createBlock)(T,{key:1,list:e.actions},null,8,["list"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)])}}}),Qm=Zm,ws=de(Qm),ey={class:"j-input-layer"},ty=(0,n.defineComponent)({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},buttonShape:{},buttonGhost:{type:Boolean},buttonDanger:{type:Boolean},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=g=>!!(g==null||typeof g=="string"&&g.trim()===""||Array.isArray(g)&&g.length===0),a=e,r=t,i=(0,n.ref)(),l=(0,n.ref)(),s=(0,n.ref)(""),d=(0,n.computed)({get(){return a.modelValue},set(g){r("update:modelValue",g)}}),c=(0,n.computed)({get(){return o(d.value)?"":o(s.value)?a.getText?a.getText(d.value):d.value:s.value},set(g){g||p()}});(0,n.watch)(()=>a.modelValue,()=>{s.value=""});const f=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||i.value.open()},p=()=>{s.value="",d.value="",r("change",{value:"",data:void 0})},u=async()=>{if(!l.value)return;const g=l.value.getSelection();if(a.isMultiSelect){const m=[],v=[];g.forEach(x=>{const w=x[a.labelKey],y=x[a.valueKey];m.push(w!=null?String(w):""),y===0||y?v.push(String(y)):v.push("")}),s.value=m.join(","),d.value=v.join(","),r("change",{value:v.join(","),data:g})}else if(g.length>0){const m=g[0],v=m[a.labelKey],x=m[a.valueKey];s.value=v!=null?String(v):"";const w=x!=null?String(x):"";d.value=w,r("change",{value:w,data:m})}else s.value="",d.value="",r("change",{value:"",data:void 0});console.log(i.value.close,"layerRef.value.close"),i.value.close()},h=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(g,m)=>{const v=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",ey,[e.onlyButton?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(aa),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,shape:e.buttonShape,ghost:e.buttonGhost,danger:e.buttonDanger,onClick:f},null,8,["type","size","label","icon","shape","ghost","danger"])):((0,n.openBlock)(),(0,n.createBlock)(v,{key:0,modelValue:c.value,"onUpdate:modelValue":m[0]||(m[0]=x=>c.value=x),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:f,onClear:p},(0,n.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(aa),{icon:e.icon,onClick:f},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),(0,n.createVNode)((0,n.unref)(wr),{ref_key:"layerRef",ref:i,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:u,onClosed:h},{default:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(Cr),{ref_key:"tableRef",ref:l,columns:e.columns,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,immediate:!0},null,8,["columns","row-key","is-tree","is-page","sort","is-multiple","load-data"])]),_:1},8,["title","width","height"])])}}}),ny=ty,Cs=de(ny),oy=(0,n.defineComponent)({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]}},setup(e){const t=e,o=un(),{t:a}=Ge(),r=(0,n.computed)(()=>t.formConfig?.gutter||16),i=(0,n.computed)(()=>t.formConfig?.span||24),l=(0,n.computed)(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=(0,n.computed)(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),d=(0,n.computed)(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),c=(0,n.ref)(!1),f=()=>{c.value=!0};return mr({...o,isAutoWindow:d,gutter:r,span:i,labelWidth:l}),(p,u)=>{const h=(0,n.resolveComponent)("j-button"),g=(0,n.resolveComponent)("j-form-item"),m=(0,n.resolveComponent)("el-row"),v=(0,n.resolveComponent)("el-form"),x=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(h,(0,n.mergeProps)(p.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:f}),null,16,["type","size","icon"]),(0,n.createVNode)(x,{visible:c.value,"onUpdate:visible":u[1]||(u[1]=w=>c.value=w),title:(0,n.unref)(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(v,{class:(0,n.normalizeClass)(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:u[0]||(u[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[d.value?((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.normalizeProps)((0,n.mergeProps)({key:0},e.schema[0])),null,16)):((0,n.openBlock)(),(0,n.createBlock)(m,{key:1,gutter:r.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.schema,w=>((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.mergeProps)({key:w.id,ref_for:!0},w),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}}),ay=oy,xs=de(ay),ry=(0,n.defineComponent)({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.computed)({get(){return o.modelValue},set(l){a("update:modelValue",l)}}),i=l=>{a("change",l)};return(0,n.onMounted)(()=>{o.autoFocus&&!o.readonly&&setTimeout(()=>{const l=r.value===o.activeValue?o.inactiveValue:o.activeValue;r.value=l,i(l)},100)}),(l,s)=>{const d=(0,n.resolveComponent)("el-switch");return(0,n.openBlock)(),(0,n.createBlock)(d,(0,n.mergeProps)(l.$attrs,{id:e.id,modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=c=>r.value=c),size:e.size,width:e.width,"inline-prompt":e.inlinePrompt,"active-icon":e.activeIcon,"inactive-icon":e.inactiveIcon,"active-action-icon":e.activeActionIcon,"inactive-action-icon":e.inactiveActionIcon,"active-text":e.activeText,"inactive-text":e.inactiveText,"active-value":e.activeValue,"inactive-value":e.inactiveValue,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:i}),(0,n.createSlots)({_:2},[l.$slots["active-action"]?{name:"active-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}}),iy=ry,ks=de(iy),ly=(0,n.defineComponent)({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{},isFill:{type:Boolean}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=c=>{o("update:modelValue",c)},r=(c,f)=>{o("tab-click",c,f)},i=c=>{o("tab-change",c)},l=c=>{o("tab-remove",c)},s=()=>{o("tab-add")},d=(c,f)=>{o("edit",c,f)};return(c,f)=>{const p=(0,n.resolveComponent)("el-tabs");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(c.$attrs,{class:{isFill:e.isFill},"model-value":e.modelValue,type:e.type,closable:e.closable,addable:e.addable,editable:e.editable,"tab-position":e.tabPosition,stretch:e.stretch,"before-leave":e.beforeLeave,"onUpdate:modelValue":a,onTabClick:r,onTabChange:i,onTabRemove:l,onTabAdd:s,onEdit:d}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),sy=ly,Ss=de(sy),cy=(0,n.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=i=>{o("update:modelValue",i)},r=i=>{o("change",i)};return(i,l)=>{const s=(0,n.resolveComponent)("el-collapse");return(0,n.openBlock)(),(0,n.createBlock)(s,(0,n.mergeProps)(i.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:r,"onUpdate:modelValue":a}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),dy=cy,Es=de(dy),uy={class:"j-editor"},fy=(0,n.defineComponent)({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),i=(0,n.ref)(),l=(0,n.shallowRef)(),s=(0,n.computed)(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let d=!1;const c=p=>{if(!p)return"";let u=p;return o.apiUrl&&o.token&&(u=u.replace(/{jcode_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{jcode_img_token}/g,`token=${o.token}`)),u},f=p=>{if(!p)return"";let u=p;if(o.apiUrl){const h=`${o.apiUrl}/system/annexesfile/`;u=u.split(h).join("{jcode_img_api}"),o.token&&(u=u.split(`token=${o.token}`).join("{jcode_img_token}"))}return u};return(0,n.onMounted)(()=>{const p={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};p.onChange=h=>{if(d)return;const g=f(h.getHtml());a("update:value",g),a("change",{value:g})};const u=(0,Vi.createEditor)({selector:r.value,html:c(o.value),config:p,mode:"default"});l.value=u,(0,Vi.createToolbar)({editor:u,selector:i.value,mode:"default"})}),(0,n.watch)(()=>o.value,p=>{const u=l.value;if(u){const h=u.getHtml(),g=c(p);f(h)!==p&&(d=!0,u.setHtml(g),d=!1)}}),(0,n.watch)(()=>o.readonly,p=>{const u=l.value;u&&(p?u.disable():u.enable())}),(0,n.onBeforeUnmount)(()=>{const p=l.value;p?.destroy()}),(p,u)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",uy,[(0,n.createElementVNode)("div",{ref_key:"toolbarRef",ref:i,class:"j-editor-toolbar"},null,512),(0,n.createElementVNode)("div",{ref_key:"editorRef",ref:r,class:"j-editor-content",style:(0,n.normalizeStyle)(s.value)},null,4)]))}}),py=Ul(fy,[["__scopeId","data-v-d513e01b"]]),_s=de(py),hy={key:0,class:"j-map-loading"},gy=(0,n.defineComponent)({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(!0),l=(0,n.ref)();let s=null,d=null,c=null,f=null;const p=async()=>{i.value=!0;try{s=await al(a.mapKey)}catch(x){console.error("Failed to load Baidu Map:",x),i.value=!1;return}if(d!=null){h(a.lng,a.lat),i.value=!1;return}if(!l.value)return;d=new s.Map(l.value,{enableMapClick:!1});const v=new s.Point(121.480248,31.236276);d.centerAndZoom(v,17),c=new s.Marker(v,{enableDragging:!0}),d.addOverlay(c),c.addEventListener("dragend",x=>{u(x.point)}),d.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),f=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),f.addEventListener("locationSuccess",x=>{u(x.point)}),f.addEventListener("locationError",x=>{alert(x.message)}),d.addControl(f),d.addEventListener("click",x=>{u(x.point)}),d.enableScrollWheelZoom(!0),h(a.lng,a.lat),i.value=!1},u=v=>{new s.Geocoder().getLocation(v,x=>{c.setPosition(v),d.panTo(v),r("update:address",x.address),r("update:lng",v.lng),r("update:lat",v.lat),r("change",{value:{address:x.address,lng:v.lng,lat:v.lat}})})},h=(v,x)=>{if(v&&x&&s){const w=new s.Point(v,x);c&&c.setPosition(w),d&&d.panTo(w)}};let g=null;return t({setPoint:h,querySearchAsync:(v,x)=>{!d||!s||(g||(g=new s.LocalSearch(d,{onSearchComplete:w=>{const y=[];if(w){const C=w.getCurrentNumPois();for(let E=0;E<C;E++)y.push(w.getPoi(E))}x(y)}})),g.search(v))}}),(0,n.onMounted)(()=>{p()}),(v,x)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-map",style:(0,n.normalizeStyle)({height:e.height})},[i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",hy,[(0,n.createVNode)(jn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}),my=gy,Bs=de(my),yy=(0,n.defineComponent)({name:"JInputMap",__name:"input-map",props:{modelValue:{type:[String],default:null},placeholder:{type:String,default:"请选择"},readonly:Boolean,size:{type:String},clearable:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=Ge(),i=(0,n.ref)(),l=(0,n.ref)(),s=(0,n.ref)(),d=(0,n.ref)(""),c=(0,n.ref)(0),f=(0,n.ref)(0),p=(0,n.ref)(""),u=(0,n.computed)(()=>{let C=o.modelValue||"";if(o.modelValue===null&&(C=(0,n.unref)(p)),wt(C))return{address:"",lng:0,lat:0};const E=C.split(",");return{address:E[0],lng:parseFloat(E[1]),lat:parseFloat(E[2])}}),h=(0,n.computed)({get(){return u.value.address},set(){p.value="",a("update:modelValue",void 0)}}),g=()=>{l.value.blur()},m=()=>{l.value.blur(),d.value=u.value.address,c.value=u.value.lng,f.value=u.value.lat,i.value.open("请选择地址"),setTimeout(()=>{s.value?.call("map","setPoint",null,c.value,f.value)},100)},v=(0,n.ref)([]),x=[{type:"j-layout",config:{class:["j-block"]},children:[{type:"div",slot:"top",config:{style:{padding:"8px"}},children:[{type:"el-autocomplete",config:{style:{width:"100%"},placeholder:r("请填写详细地址"),modelValue:d,value:d,fetchSuggestions:async(C,E)=>{E((0,n.unref)(v))},onInput:async C=>{d.value=C,s.value?.call("map","querySearchAsync",null,C,E=>{v.value=E.map(b=>({...b,value:`(${b.title}): ${b.address}`}))})},onSelect:C=>{d.value=`(${C.title})${C.address}`,c.value=C.point.lng,f.value=C.point.lat,s.value?.call("map","setPoint",null,C.point.lng,C.point.lat)}},children:[{slot:"option",config:{h:C=>(0,n.h)("div",{},[(0,n.h)("div",{style:{color:"var(--j-color-text)","font-size":"14px"}},C.title),(0,n.h)("div",{style:{color:"var(--color-text-secondary)","font-size":"12px","margin-bottom":"4px"}},C.address)])}}]}]},{type:"j-map",id:"map",config:{address:d,lng:c,lat:f,height:"100%",onChange:C=>{d.value=C.value.address,c.value=C.value.lng,f.value=C.value.lat}}}]}],w=()=>{!wt(d.value)&&!wt(c.value)&&!wt(f.value)?(p.value=`${d.value},${c.value},${f.value}`,a("update:modelValue",p.value),a("change",p.value)):(a("update:modelValue",void 0),a("change",void 0)),i.value.close()},y=()=>{};return(C,E)=>{const b=(0,n.resolveComponent)("j-button"),k=(0,n.resolveComponent)("el-input"),S=(0,n.resolveComponent)("j-page"),_=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(k,{modelValue:h.value,"onUpdate:modelValue":E[0]||(E[0]=T=>h.value=T),placeholder:e.placeholder?(0,n.unref)(r)(e.placeholder):void 0,readonly:e.readonly,size:e.size,clearable:e.readonly?!1:e.clearable,onFocus:g,ref_key:"inputRef",ref:l,class:"j-input-layer"},{append:(0,n.withCtx)(()=>[(0,n.createVNode)(b,{icon:"mdi:map-marker-outline",disabled:e.readonly,size:e.size,onClick:m},null,8,["disabled","size"])]),_:1},8,["modelValue","placeholder","readonly","size","clearable"]),(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)(C.$attrs)),null,16),(0,n.createVNode)(_,{ref_key:"layerRef",ref:i,width:900,height:500,"btn-text":"确认",destroyOnClose:!1,onOk:w,onClosed:y,style:{height:"0"}},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(S,{style:{padding:"0"},schema:x,ref_key:"indexRef",ref:s},null,512)]),_:1},512)],64)}}}),vy=yy,Rs=de(vy);function Ts(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ao(e){return e.originalEvent||e.srcEvent}function xr(e){Ts(e),Ts(ao(e))}function ro(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}var Vs=1500;function Ms(e,t,o){var a=this,r=o.get("dragging",!1);function i(l){if(!l.hover){var s=l.originalEvent,d=a._findTargetGfx(s),c=d&&e.get(d);d&&c&&(l.stopPropagation(),r.hover({element:c,gfx:d}),r.move(s))}}r&&t.on("drag.start",function(l){t.once("drag.move",Vs,function(s){i(s)})}),(function(){var l,s;t.on("element.hover",function(d){l=d.gfx,s=d.element}),t.on("element.hover",Vs,function(d){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,d;if(l instanceof MouseEvent)return s=ro(l),d=document.elementFromPoint(s.x,s.y),by(d)}}Ms.$inject=["elementRegistry","eventBus","injector"];function by(e){return(0,G.closest)(e,"svg, .djs-element",!0)}var wy={__init__:["hoverFix"],hoverFix:["type",Ms]};function As(){return/mac/i.test(navigator.platform)}function Ns(e,t){return(ao(e)||e).button===t}function fn(e){return Ns(e,0)}function Cy(e){return Ns(e,1)}function js(e){var t=ao(e)||e;return fn(e)?As()?t.metaKey:t.ctrlKey:!1}function kr(e){var t=ao(e)||e;return fn(e)&&t.shiftKey}function Ro(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function xy(e){return["M",e.x,e.y]}function Sr(e){return["L",e.x,e.y]}function ky(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function Sy(e,t){const o=e.length,a=[xy(e[0])];for(let r=1;r<o;r++){const i=e[r-1],l=e[r],s=e[r+1];if(!s||!t){a.push(Sr(l));continue}const d=Math.min(t,Er(l.x-i.x,l.y-i.y),Er(s.x-l.x,s.y-l.y));if(!d){a.push(Sr(l));continue}const c=ha(l,i,d),f=ha(l,i,d*.5),p=ha(l,s,d),u=ha(l,s,d*.5);a.push(Sr(c)),a.push(ky(f,u,p))}return a}function ha(e,t,o){const a=t.x-e.x,r=t.y-e.y,i=o/Er(a,r);return{x:e.x+a*i,y:e.y+r*i}}function Er(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function _r(e,t,o){(0,R.isNumber)(t)&&(o=t,t=null),t||(t={});const a=(0,P.create)("path",t);return(0,R.isNumber)(o)&&(a.dataset.cornerRadius=String(o)),Ps(a,e)}function Ps(e,t){return(0,P.attr)(e,{d:Ro(Sy(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Ey(e){return!0}function ga(e){return fn(e)||Cy(e)}var Hs=500;function zs(e,t,o){var a=this;function r(b,k,S){if(!s(b,k)){var _,T,V;S?T=t.getGraphics(S):(_=k.delegateTarget||k.target,_&&(T=_,S=t.get(T))),!(!T||!S)&&(V=e.fire(b,{element:S,gfx:T,originalEvent:k}),V===!1&&(k.stopPropagation(),k.preventDefault()))}}var i={};function l(b){return i[b]}function s(b,k){return!(c[b]||fn)(k)}var d={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},c={"element.contextmenu":Ey,"element.mousedown":ga,"element.mouseup":ga,"element.click":ga,"element.dblclick":ga};function f(b,k,S){var _=d[b];if(!_)throw new Error("unmapped DOM event name <"+b+">");return r(_,k,S)}var p="svg, .djs-element";function u(b,k,S,_){var T=i[S]=function(V){r(S,V)};_&&(c[S]=_),T.$delegate=G.delegate.bind(b,p,k,T)}function h(b,k,S){var _=l(S);_&&G.delegate.unbind(b,k,_.$delegate)}function g(b){(0,R.forEach)(d,function(k,S){u(b,S,k)})}function m(b){(0,R.forEach)(d,function(k,S){h(b,S,k)})}e.on("canvas.destroy",function(b){m(b.svg)}),e.on("canvas.init",function(b){g(b.svg)}),e.on(["shape.added","connection.added"],function(b){var k=b.element,S=b.gfx;e.fire("interactionEvents.createHit",{element:k,gfx:S})}),e.on(["shape.changed","connection.changed"],Hs,function(b){var k=b.element,S=b.gfx;e.fire("interactionEvents.updateHit",{element:k,gfx:S})}),e.on("interactionEvents.createHit",Hs,function(b){var k=b.element,S=b.gfx;a.createDefaultHit(k,S)}),e.on("interactionEvents.updateHit",function(b){var k=b.element,S=b.gfx;a.updateDefaultHit(k,S)});var v=y("djs-hit djs-hit-stroke"),x=y("djs-hit djs-hit-click-stroke"),w={all:y("djs-hit djs-hit-all"),"click-stroke":x,stroke:v,"no-move":y("djs-hit djs-hit-no-move")};function y(b,k){return k=(0,R.assign)({stroke:"white",strokeWidth:15},k||{}),o.cls(b,["no-fill","no-border"],k)}function C(b,k){var S=w[k];if(!S)throw new Error("invalid hit type <"+k+">");return(0,P.attr)(b,S),b}function E(b,k){(0,P.append)(b,k)}this.removeHits=function(b){(0,R.forEach)((0,G.queryAll)(".djs-hit",b),P.remove)},this.createDefaultHit=function(b,k){var S=b.waypoints,_=b.isFrame,T;return S?this.createWaypointsHit(k,S):(T=_?"stroke":"all",this.createBoxHit(k,T,{width:b.width,height:b.height}))},this.createWaypointsHit=function(b,k){var S=_r(k);return C(S,"stroke"),E(b,S),S},this.createBoxHit=function(b,k,S){S=(0,R.assign)({x:0,y:0},S);var _=(0,P.create)("rect");return C(_,k),(0,P.attr)(_,S),E(b,_),_},this.updateDefaultHit=function(b,k){var S=(0,G.query)(".djs-hit",k);if(S)return b.waypoints?Ps(S,b.waypoints):(0,P.attr)(S,{width:b.width,height:b.height}),S},this.fire=r,this.triggerMouseEvent=f,this.mouseHandler=l,this.registerEvent=u,this.unregisterEvent=h}zs.$inject=["eventBus","elementRegistry","styles"];var Br={__init__:["interactionEvents"],interactionEvents:["type",zs]};function io(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var r=a.element;o.deselect(r)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}io.$inject=["eventBus","canvas"],io.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},io.prototype.get=function(){return this._selectedElements},io.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},io.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();(0,R.isArray)(e)||(e=e?[e]:[]);var r=this._canvas,i=r.getRootElement();e=e.filter(function(l){return i===r.findRoot(l)}),t?(0,R.forEach)(e,function(l){o.indexOf(l)===-1&&o.push(l)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var Os="hover",Ls="selected";function Is(e,t){this._canvas=e;function o(r,i){e.addMarker(r,i)}function a(r,i){e.removeMarker(r,i)}t.on("element.hover",function(r){o(r.element,Os)}),t.on("element.out",function(r){a(r.element,Os)}),t.on("selection.changed",function(r){function i(c){a(c,Ls)}function l(c){o(c,Ls)}var s=r.oldSelection,d=r.newSelection;(0,R.forEach)(s,function(c){d.indexOf(c)===-1&&i(c)}),(0,R.forEach)(d,function(c){s.indexOf(c)===-1&&l(c)})})}Is.$inject=["canvas","eventBus"];function Ds(e,t,o,a){e.on("create.end",500,function(r){var i=r.context,l=i.canExecute,s=i.elements,d=(i.hints||{}).autoSelect;if(l){if(d===!1)return;(0,R.isArray)(d)?t.select(d):t.select(s.filter(_y))}}),e.on("connect.end",500,function(r){var i=r.context.connection;i&&t.select(i)}),e.on("shape.move.end",500,function(r){var i=r.previousSelection||[],l=a.get(r.context.shape.id);(0,R.find)(i,function(s){return l.id===s.id})||t.select(l)}),e.on("element.click",function(r){if(fn(r)){var i=r.element;i===o.getRootElement()&&(i=null);var l=t.isSelected(i),s=t.get().length>1,d=kr(r);if(l&&s)return d?t.deselect(i):t.select(i);l?t.deselect(i):t.select(i,d)}})}Ds.$inject=["eventBus","selection","canvas","elementRegistry"];function _y(e){return!e.hidden}var lo={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Br],selection:["type",io],selectionVisuals:["type",Is],selectionBehavior:["type",Ds]},By=/^djs-cursor-.*$/;function Rr(e){var t=(0,G.classes)(document.body);t.removeMatching(By),e&&t.add("djs-cursor-"+e)}function Fs(){Rr(null)}var Ry=5e3;function $s(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Ry,o),function(){e.off(t,o)}}function Ws(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function so(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Us(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Js(e,t){return e=(0,R.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var co=Math.round,Ys="djs-drag-active";function Hn(e){e.preventDefault()}function Ty(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Vy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Gs(e,t,o,a){var r={threshold:5,trapClick:!0},i;function l(y){var C=t.viewbox(),E=t._container.getBoundingClientRect();return{x:C.x+(y.x-E.left)/C.scale,y:C.y+(y.y-E.top)/C.scale}}function s(y,C){C=C||i;var E=e.createEvent((0,R.assign)({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+y,E)===!1?!1:e.fire(C.prefix+"."+y,E)}function d(y){var C=y.filter(function(E){return a.get(E.id)});C.length&&o.select(C)}function c(y,C){var E=i.payload,b=i.displacement,k=i.globalStart,S=ro(y),_=so(S,k),T=i.localStart,V=l(S),j=so(V,T);if(!i.active&&(C||Vy(_)>i.threshold)){if((0,R.assign)(E,{x:co(T.x+b.x),y:co(T.y+b.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return v();i.active=!0,i.keepSelection||(E.previousSelection=o.get(),o.select(null)),i.cursor&&Rr(i.cursor),t.addMarker(t.getRootElement(),Ys)}xr(y),i.active&&((0,R.assign)(E,{x:co(V.x+b.x),y:co(V.y+b.y),dx:co(j.x),dy:co(j.y)},{originalEvent:y}),s("move"))}function f(y){var C,E=!0;i.active&&(y&&(i.payload.originalEvent=y,xr(y)),E=s("end")),E===!1&&s("rejected"),C=x(E!==!0),s("ended",C)}function p(y){Js("Escape",y)&&(Hn(y),v())}function u(y){var C;i.active&&(C=$s(e),setTimeout(C,400),Hn(y)),f(y)}function h(y){c(y)}function g(y){var C=i.payload;C.hoverGfx=y.gfx,C.hover=y.element,s("hover")}function m(y){s("out");var C=i.payload;C.hoverGfx=null,C.hover=null}function v(y){var C;if(i){var E=i.active;E&&s("cancel"),C=x(y),E&&s("canceled",C)}}function x(y){var C,E;s("cleanup"),Fs(),i.trapClick?E=u:E=f,G.event.unbind(document,"mousemove",c),G.event.unbind(document,"dragstart",Hn),G.event.unbind(document,"selectstart",Hn),G.event.unbind(document,"mousedown",E,!0),G.event.unbind(document,"mouseup",E,!0),G.event.unbind(document,"keyup",p),G.event.unbind(document,"touchstart",h,!0),G.event.unbind(document,"touchcancel",v,!0),G.event.unbind(document,"touchmove",c,!0),G.event.unbind(document,"touchend",f,!0),e.off("element.hover",g),e.off("element.out",m),t.removeMarker(t.getRootElement(),Ys);var b=i.payload.previousSelection;return y!==!1&&b&&!o.get().length&&d(b),C=i,i=null,C}function w(y,C,E,b){i&&v(!1),typeof C=="string"&&(b=E,E=C,C=null),b=(0,R.assign)({},r,b||{});var k=b.data||{},S,_,T,V,j;b.trapClick?V=u:V=f,y?(S=ao(y)||y,_=ro(y),xr(y),S.type==="dragstart"&&Hn(S)):(S=null,_={x:0,y:0}),T=l(_),C||(C=T),j=Ty(S),i=(0,R.assign)({prefix:E,data:k,payload:{},globalStart:_,displacement:so(C,T),localStart:T,isTouch:j},b),b.manual||(j?(G.event.bind(document,"touchstart",h,!0),G.event.bind(document,"touchcancel",v,!0),G.event.bind(document,"touchmove",c,!0),G.event.bind(document,"touchend",f,!0)):(G.event.bind(document,"mousemove",c),G.event.bind(document,"dragstart",Hn),G.event.bind(document,"selectstart",Hn),G.event.bind(document,"mousedown",V,!0),G.event.bind(document,"mouseup",V,!0)),G.event.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",m)),s("init"),b.autoActivate&&c(y,!0)}e.on("diagram.destroy",v),this.init=w,this.move=c,this.hover=g,this.out=m,this.end=f,this.cancel=v,this.context=function(){return i},this.setOptions=function(y){(0,R.assign)(r,y)}}Gs.$inject=["eventBus","canvas","selection","elementRegistry"];var zn={__depends__:[wy,lo],dragging:["type",Gs]};function Tr(e){return e.childNodes[0]}function ma(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ma.prototype.next=function(){return this._prefix+ ++this._counter};var My=new ma("ps"),Ay=["marker-start","marker-mid","marker-end"],Ny=["circle","ellipse","line","path","polygon","polyline","path","rect"];function pn(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}pn.$inject=["elementRegistry","eventBus","canvas","styles"],pn.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},pn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},pn.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var r=(0,P.clone)(o),i=o.getBoundingClientRect();return this._cloneMarkers(Tr(r),a),(0,P.attr)(r,this._styles.cls(a,[],{x:i.top,y:i.left})),(0,P.append)(t,r),(0,P.attr)(r,"data-preview-support-element-id",e.id),r},pn.prototype.addFrame=function(e,t){var o=(0,P.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,P.append)(t,o),(0,P.attr)(o,"data-preview-support-element-id",e.id),o},pn.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(r=>{a._cloneMarkers(r,t,o)}),zy(e)&&Ay.forEach(function(r){if((0,P.attr)(e,r)){var i=jy(e,r,a._canvas.getContainer());i&&a._cloneMarker(o,e,i,r,t)}})},pn.prototype._cloneMarker=function(e,t,o,a,r="djs-dragger"){var i=[o.id,r,My.next()].join("-"),l=(0,G.query)("marker#"+o.id,e);e=e||this._canvas._svg;var s=l||(0,P.clone)(o);s.id=i,(0,P.classes)(s).add(r);var d=(0,G.query)(":scope > defs",e);d||(d=(0,P.create)("defs"),(0,P.append)(e,d)),(0,P.append)(d,s),(0,P.attr)(t,a,Hy(s.id))};function jy(e,t,o){return(0,G.query)("marker#"+Py((0,P.attr)(e,t)),o||document)}function Py(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Hy(e){return"url(#"+e+")"}function zy(e){return Ny.indexOf(e.nodeName)!==-1}var Vr={__init__:["previewSupport"],previewSupport:["type",pn]};function Mr(e){this._commandStack=e.get("commandStack",!1)}Mr.$inject=["injector"],Mr.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};var uo={__init__:["rules"],rules:["type",Mr]};function Oy(e){return(0,R.filter)(e,function(t){return!(0,R.find)(e,function(o){return o!==t&&Ks(t,o)})})}function Ks(e,t){if(t){if(e===t)return t;if(e.parent)return Ks(e.parent,t)}}function qs(e,t,o){var a=!o||e.indexOf(t)===-1;return a&&e.push(t),a}function Ar(e,t,o){o=o||0,(0,R.isArray)(e)||(e=[e]),(0,R.forEach)(e,function(a,r){var i=t(a,r,o);(0,R.isArray)(i)&&i.length&&Ar(i,t,o+1)})}function Ly(e,t,o){var a=[],r=[];return Ar(e,function(i,l,s){qs(a,i,t);var d=i.children;if((o===-1||s<o)&&d&&qs(r,d,t))return d}),a}function Iy(e,t){return Ly(e,!t,-1)}function Dy(e,t,o){(0,R.isUndefined)(t)&&(t=!0),(0,R.isObject)(t)&&(o=t,t=!0),o=o||{};var a=To(o.allShapes),r=To(o.allConnections),i=To(o.enclosedElements),l=To(o.enclosedConnections),s=To(o.topLevel,t&&(0,R.groupBy)(e,function(f){return f.id}));function d(f){s[f.source.id]&&s[f.target.id]&&(s[f.id]=[f]),a[f.source.id]&&a[f.target.id]&&(l[f.id]=i[f.id]=f),r[f.id]=f}function c(f){if(i[f.id]=f,f.waypoints)l[f.id]=r[f.id]=f;else return a[f.id]=f,(0,R.forEach)(f.incoming,d),(0,R.forEach)(f.outgoing,d),f.children}return Ar(e,c),{allShapes:a,allConnections:r,topLevel:s,enclosedConnections:l,enclosedElements:i}}function Ut(e,t){t=!!t,(0,R.isArray)(e)||(e=[e]);var o,a,r,i;return(0,R.forEach)(e,function(l){var s=l;l.waypoints&&!t&&(s=Ut(l.waypoints,!0));var d=s.x,c=s.y,f=s.height||0,p=s.width||0;(d<o||o===void 0)&&(o=d),(c<a||a===void 0)&&(a=c),(d+p>r||r===void 0)&&(r=d+p),(c+f>i||i===void 0)&&(i=c+f)}),{x:o,y:a,height:i-a,width:r-o}}function Xs(e,t){var o={};return(0,R.forEach)(e,function(a){var r=a;r.waypoints&&(r=Ut(r)),!(0,R.isNumber)(t.y)&&r.x>t.x&&(o[a.id]=a),!(0,R.isNumber)(t.x)&&r.y>t.y&&(o[a.id]=a),r.x>t.x&&r.y>t.y&&((0,R.isNumber)(t.width)&&(0,R.isNumber)(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!(0,R.isNumber)(t.width)||!(0,R.isNumber)(t.height))&&(o[a.id]=a)}),o}function Fy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function $y(e){return!!(e&&e.isFrame)}function To(e,t){return(0,R.assign)({},e||{},t||{})}function St(e){return(0,R.isObject)(e)&&(0,R.has)(e,"waypoints")}function fo(e){return(0,R.isObject)(e)&&(0,R.has)(e,"labelTarget")}var Wy="drop-ok",Zs="drop-not-ok",Qs="attach-ok",ec="new-parent",tc="create",Uy=2e3;function nc(e,t,o,a,r){function i(d,c,f,p,u){if(!c)return!1;d=(0,R.filter)(d,function(w){var y=w.labelTarget;return!w.parent&&!(fo(w)&&d.indexOf(y)!==-1)});var h=(0,R.find)(d,function(w){return!St(w)}),g=!1,m=!1,v=!1;ac(d)&&(g=r.allowed("shape.attach",{position:f,shape:h,target:c})),g||(ac(d)?v=r.allowed("shape.create",{position:f,shape:h,source:p,target:c}):v=r.allowed("elements.create",{elements:d,position:f,target:c}));var x=u.connectionTarget;return v||g?(h&&p&&(m=r.allowed("connection.create",{source:x===p?h:p,target:x===p?p:h,hints:{targetParent:c,targetAttach:g}})),{attach:g,connect:m}):v===null||g===null?null:!1}function l(d,c){[Qs,Wy,Zs,ec].forEach(function(f){f===c?e.addMarker(d,f):e.removeMarker(d,f)})}o.on(["create.move","create.hover"],function(d){var c=d.context,f=c.elements,p=d.hover,u=c.source,h=c.hints||{};if(!p){c.canExecute=!1,c.target=null;return}oc(d);var g={x:d.x,y:d.y},m=c.canExecute=p&&i(f,p,g,u,h);p&&m!==null&&(c.target=p,m&&m.attach?l(p,Qs):l(p,m?ec:Zs))}),o.on(["create.end","create.out","create.cleanup"],function(d){var c=d.hover;c&&l(c,null)}),o.on("create.end",function(d){var c=d.context,f=c.source,p=c.shape,u=c.elements,h=c.target,g=c.canExecute,m=g&&g.attach,v=g&&g.connect,x=c.hints||{};if(g===!1||!h)return!1;oc(d);var w={x:d.x,y:d.y};v?p=a.appendShape(f,p,w,h,{attach:m,connection:v===!0?{}:v,connectionTarget:x.connectionTarget}):(u=a.createElements(u,w,h,(0,R.assign)({},x,{attach:m})),p=(0,R.find)(u,function(y){return!St(y)})),(0,R.assign)(c,{elements:u,shape:p}),(0,R.assign)(d,{elements:u,shape:p})});function s(){var d=t.context();d&&d.prefix===tc&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],Uy,function(){o.off("elements.changed",s)})}),this.start=function(d,c,f){(0,R.isArray)(c)||(c=[c]);var p=(0,R.find)(c,function(h){return!St(h)});if(p){f=(0,R.assign)({elements:c,hints:{},shape:p},f||{}),(0,R.forEach)(c,function(h){(0,R.isNumber)(h.x)||(h.x=0),(0,R.isNumber)(h.y)||(h.y=0)});var u=Ut((0,R.filter)(c,function(h){return!h.hidden}));(0,R.forEach)(c,function(h){St(h)&&(h.waypoints=(0,R.map)(h.waypoints,function(g){return{x:g.x-u.x-u.width/2,y:g.y-u.y-u.height/2}})),(0,R.assign)(h,{x:h.x-u.x-u.width/2,y:h.y-u.y-u.height/2})}),t.init(d,tc,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:c,context:f}})}}}nc.$inject=["canvas","dragging","eventBus","modeling","rules"];function oc(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function ac(e){return e&&e.length===1&&!St(e[0])}function Jy(e,t,o,a,r){var i=(0,P.createTransform)();i.setTranslate(t,o);var l=(0,P.createTransform)();l.setRotate(a||0,0,0);var s=(0,P.createTransform)();s.setScale(r||1,r||1),(0,P.transform)(e,[i,l,s])}function Jt(e,t,o){var a=(0,P.createTransform)();a.setTranslate(t,o),(0,P.transform)(e,a)}function Yy(e,t){var o=(0,P.createTransform)();o.setRotate(t,0,0),(0,P.transform)(e,o)}var Gy=750;function rc(e,t,o,a,r){function i(l){var s=(0,P.create)("g");(0,P.attr)(s,r.cls("djs-drag-group",["no-events"]));var d=(0,P.create)("g");return l.forEach(function(c){var f;c.hidden||(c.waypoints?(f=o._createContainer("connection",d),o.drawConnection(Tr(f),c)):(f=o._createContainer("shape",d),o.drawShape(Tr(f),c),Jt(f,c.x,c.y)),a.addDragger(c,s,f))}),s}t.on("create.move",Gy,function(l){var s=l.hover,d=l.context,c=d.elements,f=d.dragGroup;f||(f=d.dragGroup=i(c));var p;s?(f.parentNode||(p=e.getActiveLayer(),(0,P.append)(p,f)),Jt(f,l.x,l.y)):(0,P.remove)(f)}),t.on("create.cleanup",function(l){var s=l.context.dragGroup;s&&(0,P.remove)(s)})}rc.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var ic={__depends__:[zn,Vr,uo,lo],__init__:["create","createPreview"],create:["type",nc],createPreview:["type",rc]};function Vo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Nr(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var r=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),i=Vo(e,t);return Math.abs(r/i)<=a}var Ky=2;function hn(e,t){var o=Array.from(arguments).flat();for(const[a,r]of Object.entries({x:"v",y:"h"}))if(qy(a,o))return r;return!1}function qy(e,t){const o=t[0];return(0,R.every)(t,function(a){return Math.abs(o[e]-a[e])<=Ky})}function lc(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function jr(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Xy=/,?([a-z]),?/gi,sc=parseFloat,at=Math,gn=at.PI,Yt=at.min,Gt=at.max,cc=at.pow,mn=at.abs,Zy=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Qy=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,dc=Array.isArray||function(e){return e instanceof Array};function ev(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tv(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function nv(e){function t(){var o=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},r=t.count=t.count||[];return ev(a,o)?(tv(r,o),a[o]):(r.length>=1e3&&delete a[r.shift()],r.push(o),a[o]=e(...arguments),a[o])}return t}function ov(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(Zy,function(a,r,i){var l=[],s=r.toLowerCase();for(i.replace(Qy,function(d,c){c&&l.push(+c)}),s=="m"&&l.length>2&&(o.push([r,...l.splice(0,2)]),s="l",r=r=="m"?"l":"L");l.length>=t[s]&&(o.push([r,...l.splice(0,t[s])]),!!t[s]););}),o.toString=Hr,o}function av(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function rv(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Pr(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Hr(){return this.join(",").replace(Xy,"$1")}function iv(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var r=e[o],i=t[o]=new Array(r.length),l=0,s=r.length;l<s;l++)i[l]=r[l];return t.toString=Hr,t}function uc(e,t,o,a,r,i,l,s,d){var c=1-d,f=cc(c,3),p=cc(c,2),u=d*d*d,h=f*e+p*3*d*o+c*3*d*d*r+u*l,g=f*t+p*3*d*a+c*3*d*d*i+u*s;return{x:ya(h),y:ya(g)}}function fc(e){var t=fv(...e);return Pr(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function yn(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function lv(e,t){return e=Pr(e),t=Pr(t),yn(t,e.x,e.y)||yn(t,e.x2,e.y)||yn(t,e.x,e.y2)||yn(t,e.x2,e.y2)||yn(e,t.x,t.y)||yn(e,t.x2,t.y)||yn(e,t.x,t.y2)||yn(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function pc(e,t,o,a,r){return e*(e*(-3*t+9*o-9*a+3*r)+6*t-12*o+6*a)-3*t+3*o}function hc(e,t,o,a,r,i,l,s,d){d==null&&(d=1),d=d>1?1:d<0?0:d;for(var c=d/2,f=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,g=0;g<f;g++){var m=c*p[g]+c,v=pc(m,e,o,r,l),x=pc(m,t,a,i,s),w=v*v+x*x;h+=u[g]*at.sqrt(w)}return c*h}function sv(e,t,o,a,r,i,l,s){if(!(Gt(e,o)<Yt(r,l)||Yt(e,o)>Gt(r,l)||Gt(t,a)<Yt(i,s)||Yt(t,a)>Gt(i,s))){var d=(e*a-t*o)*(r-l)-(e-o)*(r*s-i*l),c=(e*a-t*o)*(i-s)-(t-a)*(r*s-i*l),f=(e-o)*(i-s)-(t-a)*(r-l);if(f){var p=ya(d/f),u=ya(c/f),h=+p.toFixed(2),g=+u.toFixed(2);if(!(h<+Yt(e,o).toFixed(2)||h>+Gt(e,o).toFixed(2)||h<+Yt(r,l).toFixed(2)||h>+Gt(r,l).toFixed(2)||g<+Yt(t,a).toFixed(2)||g>+Gt(t,a).toFixed(2)||g<+Yt(i,s).toFixed(2)||g>+Gt(i,s).toFixed(2)))return{x:p,y:u}}}}function ya(e){return Math.round(e*1e11)/1e11}function cv(e,t,o){if(!lv(fc(e),fc(t)))return o?0:[];var a=hc(...e),r=hc(...t),i=mc(e)?1:~~(a/5)||1,l=mc(t)?1:~~(r/5)||1,s=new Array(i+1),d=new Array(l+1),c={},f=o?0:[],p,u;for(p=0;p<i+1;p++){var h=uc(...e,p/i);s[p]={x:h.x,y:h.y,t:p/i}}for(p=0;p<l+1;p++)h=uc(...t,p/l),d[p]={x:h.x,y:h.y,t:p/l};for(p=0;p<i;p++)for(u=0;u<l;u++){var g=s[p],m=s[p+1],v=d[u],x=d[u+1],w=mn(m.x-g.x)<.01?"y":"x",y=mn(x.x-v.x)<.01?"y":"x",C=sv(g.x,g.y,m.x,m.y,v.x,v.y,x.x,x.y),E;if(C){if(E=C.x.toFixed(9)+"#"+C.y.toFixed(9),c[E])continue;c[E]=!0;var b=g.t+mn((C[w]-g[w])/(m[w]-g[w]))*(m.t-g.t),k=v.t+mn((C[y]-v[y])/(x[y]-v[y]))*(x.t-v.t);b>=0&&b<=1&&k>=0&&k<=1&&(o?f++:f.push({x:C.x,y:C.y,t1:b,t2:k}))}}return f}function gc(e,t,o){e=bc(e),t=bc(t);for(var a,r,i,l,s,d,c,f,p,u,h=o?0:[],g=0,m=e.length;g<m;g++){var v=e[g];if(v[0]=="M")a=s=v[1],r=d=v[2];else{v[0]=="C"?(p=[a,r,...v.slice(1)],a=p[6],r=p[7]):(p=[a,r,a,r,s,d,s,d],a=s,r=d);for(var x=0,w=t.length;x<w;x++){var y=t[x];if(y[0]=="M")i=c=y[1],l=f=y[2];else{y[0]=="C"?(u=[i,l,...y.slice(1)],i=u[6],l=u[7]):(u=[i,l,i,l,c,f,c,f],i=c,l=f);var C=cv(p,u,o);if(o)h+=C;else{for(var E=0,b=C.length;E<b;E++)C[E].segment1=g,C[E].segment2=x,C[E].bez1=p,C[E].bez2=u;h=h.concat(C)}}}}}return h}function dv(e){return dc(e)&&dc(e[0])}function uv(e){if(av(e))return e;var t=new Array(e.length),o=0,a=0,r=0,i=0,l=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],r=o,i=a,l++,t[0]=["M",o,a]);for(var d,c,f=l,p=e.length;f<p;f++){if(c=e[f],s=c[0],t[f]=d=new Array(c.length),s!=s.toUpperCase())switch(d[0]=s.toUpperCase(),d[0]){case"A":d[1]=c[1],d[2]=c[2],d[3]=c[3],d[4]=c[4],d[5]=c[5],d[6]=+c[6]+o,d[7]=+c[7]+a;break;case"V":d[1]=+c[1]+a;break;case"H":d[1]=+c[1]+o;break;case"M":r=+c[1]+o,i=+c[2]+a;default:for(var u=1,h=c.length;u<h;u++)d[u]=+c[u]+(u%2?o:a)}else for(var g=0,m=c.length;g<m;g++)d[g]=c[g];switch(s=s.toUpperCase(),d[0]){case"Z":o=+r,a=+i;break;case"H":o=d[1];break;case"V":a=d[1];break;case"M":r=d[d.length-2],i=d[d.length-1];default:o=d[d.length-2],a=d[d.length-1]}}return t.toString=Hr,t}function mc(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function va(e,t,o,a){return[e,t,o,a,o,a]}function yc(e,t,o,a,r,i){var l=.3333333333333333,s=2/3;return[l*e+s*o,l*t+s*a,l*r+s*o,l*i+s*a,r,i]}function vc(e,t,o,a,r,i,l,s,d,c){var f=gn*120/180,p=gn/180*(+r||0),u=[],h,g=nv(function(ue,Te,Ae){return{x:ue*at.cos(Ae)-Te*at.sin(Ae),y:ue*at.sin(Ae)+Te*at.cos(Ae)}});if(c)k=c[0],S=c[1],E=c[2],b=c[3];else{h=g(e,t,-p),e=h.x,t=h.y,h=g(s,d,-p),s=h.x,d=h.y;var m=(e-s)/2,v=(t-d)/2,x=m*m/(o*o)+v*v/(a*a);x>1&&(x=at.sqrt(x),o=x*o,a=x*a);var w=o*o,y=a*a,C=(i==l?-1:1)*at.sqrt(mn((w*y-w*v*v-y*m*m)/(w*v*v+y*m*m))),E=C*o*v/a+(e+s)/2,b=C*-a*m/o+(t+d)/2,k=at.asin(((t-b)/a).toFixed(9)),S=at.asin(((d-b)/a).toFixed(9));k=e<E?gn-k:k,S=s<E?gn-S:S,k<0&&(k=gn*2+k),S<0&&(S=gn*2+S),l&&k>S&&(k=k-gn*2),!l&&S>k&&(S=S-gn*2)}var _=S-k;if(mn(_)>f){var T=S,V=s,j=d;S=k+f*(l&&S>k?1:-1),s=E+o*at.cos(S),d=b+a*at.sin(S),u=vc(s,d,o,a,r,0,l,V,j,[S,T,E,b])}_=S-k;var z=at.cos(k),L=at.sin(k),M=at.cos(S),B=at.sin(S),D=at.tan(_/4),U=4/3*o*D,te=4/3*a*D,le=[e,t],A=[e+U*L,t-te*z],I=[s+U*B,d-te*M],W=[s,d];if(A[0]=2*le[0]-A[0],A[1]=2*le[1]-A[1],c)return[A,I,W].concat(u);u=[A,I,W].concat(u).join().split(",");for(var N=[],he=0,_e=u.length;he<_e;he++)N[he]=he%2?g(u[he-1],u[he],p).y:g(u[he],u[he+1],p).x;return N}function fv(e,t,o,a,r,i,l,s){for(var d=[],c=[[],[]],f,p,u,h,g,m,v,x,w=0;w<2;++w){if(w==0?(p=6*e-12*o+6*r,f=-3*e+9*o-9*r+3*l,u=3*o-3*e):(p=6*t-12*a+6*i,f=-3*t+9*a-9*i+3*s,u=3*a-3*t),mn(f)<1e-12){if(mn(p)<1e-12)continue;h=-u/p,0<h&&h<1&&d.push(h);continue}v=p*p-4*u*f,x=at.sqrt(v),!(v<0)&&(g=(-p+x)/(2*f),0<g&&g<1&&d.push(g),m=(-p-x)/(2*f),0<m&&m<1&&d.push(m))}for(var y=d.length,C=y,E;y--;)h=d[y],E=1-h,c[0][y]=E*E*E*e+3*E*E*h*o+3*E*h*h*r+h*h*h*l,c[1][y]=E*E*E*t+3*E*E*h*a+3*E*h*h*i+h*h*h*s;return c[0][C]=e,c[1][C]=t,c[0][C+1]=l,c[1][C+1]=s,c[0].length=c[1].length=C+2,{x0:Yt(...c[0]),y0:Yt(...c[1]),x1:Gt(...c[0]),y1:Gt(...c[1])}}function bc(e){if(dv(e)||(e=ov(e)),rv(e))return e;for(var t=iv(uv(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(u,h,g){var m,v;if(!u)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(u[0]in{T:1,Q:1})&&(h.qx=h.qy=null),u[0]){case"M":h.X=u[1],h.Y=u[2];break;case"A":u=["C",...vc(h.x,h.y,...u.slice(1))];break;case"S":g=="C"||g=="S"?(m=h.x*2-h.bx,v=h.y*2-h.by):(m=h.x,v=h.y),u=["C",m,v,...u.slice(1)];break;case"T":g=="Q"||g=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),u=["C",...yc(h.x,h.y,h.qx,h.qy,u[1],u[2])];break;case"Q":h.qx=u[1],h.qy=u[2],u=["C",...yc(h.x,h.y,u[1],u[2],u[3],u[4])];break;case"L":u=["C",...va(h.x,h.y,u[1],u[2])];break;case"H":u=["C",...va(h.x,h.y,u[1],h.y)];break;case"V":u=["C",...va(h.x,h.y,h.x,u[1])];break;case"Z":u=["C",...va(h.x,h.y,h.X,h.Y)];break}return u},r=function(u,h){if(u[h].length>7){u[h].shift();for(var g=u[h];g.length;)i[h]="A",u.splice(h++,0,["C",...g.splice(0,6)]);u.splice(h,1),c=t.length}},i=[],l="",s="",d=0,c=t.length;d<c;d++){t[d]&&(l=t[d][0]),l!="C"&&(i[d]=l,d&&(s=i[d-1])),t[d]=a(t[d],o,s),i[d]!="A"&&l=="C"&&(i[d]="C"),r(t,d);var f=t[d],p=f.length;o.x=f[p-2],o.y=f[p-1],o.bx=sc(f[p-4])||o.x,o.by=sc(f[p-3])||o.y}return t}function pv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Mo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function wc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function hv(e){return Mo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function gv(e){for(var t=e.waypoints,o=t.reduce(function(s,d,c){var f=t[c-1];if(f){var p=s[s.length-1],u=p&&p.endLength||0,h=vv(f,d);s.push({start:f,end:d,startLength:u,endLength:u+h,length:h})}return s},[]),a=o.reduce(function(s,d){return s+d.length},0)/2,r=0,i=o[r];i.endLength<a;)i=o[++r];var l=(a-i.startLength)/i.length;return{x:i.start.x+(i.end.x-i.start.x)*l,y:i.start.y+(i.end.y-i.start.y)*l}}function tt(e){return St(e)?gv(e):hv(e)}function vn(e,t,o){o=o||0,(0,R.isObject)(o)||(o={x:o,y:o});var a=Ie(e),r=Ie(t),i=a.bottom+o.y<=r.top,l=a.left-o.x>=r.right,s=a.top-o.y>=r.bottom,d=a.right+o.x<=r.left,c=i?"top":s?"bottom":null,f=d?"left":l?"right":null;return f&&c?c+"-"+f:f||c||"intersect"}function zr(e,t,o){var a=mv(e,t);return a.length===1||a.length===2&&Vo(a[0],a[1])<1?Mo(a[0]):a.length>1?(a=(0,R.sortBy)(a,function(r){var i=Math.floor(r.t2*100)||1;return i=100-i,i=(i<10?"0":"")+i,r.segment2+"#"+i}),Mo(a[o?0:a.length-1])):null}function mv(e,t){return gc(e,t)}function yv(e){e=e.slice();for(var t=0,o,a,r;e[t];)o=e[t],a=e[t-1],r=e[t+1],Vo(o,r)===0||Nr(a,r,o)?e.splice(t,1):t++;return e}function vv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cc(e,t,o,a){function r(l,s){return a.allowed("connection.create",{source:l,target:s})}function i(l,s){return r(s,l)}e.on("connect.hover",function(l){var s=l.context,d=s.start,c=l.hover,f;if(s.hover=c,f=s.canExecute=r(d,c),!(0,R.isNil)(f)){if(f!==!1){s.source=d,s.target=c;return}f=s.canExecute=i(d,c),!(0,R.isNil)(f)&&f!==!1&&(s.source=c,s.target=d)}}),e.on(["connect.out","connect.cleanup"],function(l){var s=l.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(l){var s=l.context,d=s.canExecute,c=s.connectionStart,f={x:l.x,y:l.y},p=s.source,u=s.target;if(!d)return!1;var h=null,g={connectionStart:Or(s)?f:c,connectionEnd:Or(s)?c:f};(0,R.isObject)(d)&&(h=d),s.connection=o.connect(p,u,h,g)}),this.start=function(l,s,d,c){(0,R.isObject)(d)||(c=d,d=tt(s)),t.init(l,"connect",{autoActivate:c,data:{shape:s,context:{start:s,connectionStart:d}}})}}Cc.$inject=["eventBus","dragging","modeling","rules"];function Or(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var bv=1100,wv=900,xc="connect-ok",kc="connect-not-ok";function Sc(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(r){var i=r.context,l=i.canExecute,s=i.hover,d=i.source,c=i.start,f=i.startPosition,p=i.target,u=i.connectionStart||f,h=i.connectionEnd||{x:r.x,y:r.y},g=u,m=h;Or(i)&&(g=h,m=u),a.drawPreview(i,l,{source:d||c,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",wv,function(r){var i=r.context,l=r.hover,s=i.canExecute;s!==null&&o.addMarker(l,s?xc:kc)}),t.on(["connect.out","connect.cleanup"],bv,function(r){var i=r.hover;i&&(o.removeMarker(i,xc),o.removeMarker(i,kc))}),a&&t.on("connect.cleanup",function(r){a.cleanUp(r.context)})}Sc.$inject=["injector","eventBus","canvas"];var Lr={__depends__:[lo,uo,zn],__init__:["connectPreview"],connect:["type",Cc],connectPreview:["type",Sc]},Cv=15;function Ec(e,t){var o;function a(s){return l(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function r(s){var d=o.start,c=o.button,f=ro(s),p=so(f,d);!o.dragging&&xv(p)>Cv&&(o.dragging=!0,c===0&&$s(e),Rr("grab")),o.dragging&&(p=so(f,o.last||o.start),t.scroll({dx:p.x,dy:p.y}),o.last=f),s.preventDefault()}function i(s){G.event.unbind(document,"mousemove",r),G.event.unbind(document,"mouseup",i),o=null,Fs()}function l(s){if(!(0,G.closest)(s.target,".djs-draggable")){var d=s.button;if(!(d>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:d,start:ro(s)},G.event.bind(document,"mousemove",r),G.event.bind(document,"mouseup",i),!0}}this.isActive=function(){return!!o}}Ec.$inject=["eventBus","canvas"];function xv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var _c={__init__:["moveCanvas"],moveCanvas:["type",Ec]};function Ir(e){return Math.log(e)/Math.log(10)}function Bc(e,t){var o=Ir(e.min),a=Ir(e.max);return(Math.abs(o)+Math.abs(a))/t}function kv(e,t){return Math.max(e.min,Math.min(e.max,t))}var Sv=Math.sign||function(e){return e>=0?1:-1},Dr={min:.2,max:4},Rc=10,Ev=.1,_v=.75;function Kt(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=(0,R.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||_v;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Kt.$inject=["config.zoomScroll","eventBus","canvas"],Kt.prototype.scroll=function(t){this._canvas.scroll(t)},Kt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Kt.prototype.zoom=function(t,o){var a=Bc(Dr,Rc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Ev&&(this._zoom(t,o,a),this._totalDelta=0)},Kt.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||As()&&t.metaKey,r=t.shiftKey,i=-1*this._scale,l;if(a?i*=t.deltaMode===0?.02:.32:i*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),d={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Sv(t.deltaY)*i,this.zoom(l,d)}else r?l={dx:i*t.deltaY,dy:0}:l={dx:i*t.deltaX,dy:i*t.deltaY},this.scroll(l)}},Kt.prototype.stepZoom=function(t,o){var a=Bc(Dr,Rc);this._zoom(t,o,a)},Kt.prototype._zoom=function(e,t,o){var a=this._canvas,r=e>0?1:-1,i=Ir(a.zoom()),l=Math.round(i/o)*o;l+=o*r;var s=Math.pow(10,l);a.zoom(kv(Dr,s),t)},Kt.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&G.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},Kt.prototype._init=function(e){this.toggle(e)};var Tc={__init__:["zoomScroll"],zoomScroll:["type",Kt]};function qe(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}qe.$inject=["eventBus","injector"],qe.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},qe.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let r=this._fire(e,"canExecute",o);if(r===void 0){if(!a)return!1;a.canExecute&&(r=a.canExecute(t))}return r},qe.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},qe.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},qe.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},qe.prototype.register=function(e,t){this._setHandler(e,t)},qe.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},qe.prototype.canUndo=function(){return!!this._getUndoAction()},qe.prototype.canRedo=function(){return!!this._getRedoAction()},qe.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},qe.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},qe.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},qe.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let r;o=this._eventBus.createEvent(o);for(const i of a)if(r=this._eventBus.fire("commandStack."+i,o),o.cancelBubble)break;return r},qe.prototype._createId=function(){return this._uid++},qe.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},qe.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,r=this._getHandler(o);if(!r)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),r.preExecute&&r.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),r.execute&&this._markDirty(r.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),r.postExecute&&r.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},qe.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},qe.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:(0,R.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},qe.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,R.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},qe.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},qe.prototype._revertedAction=function(e){this._stackIdx--},qe.prototype._getHandler=function(e){return this._handlerMap[e]},qe.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var Bv={commandStack:["type",qe]};function On(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function ba(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function bn(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function Fr(e,t){return!e||!t?-1:e.indexOf(t)}function po(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Rv=1e3;function vt(e){this._eventBus=e}vt.$inject=["eventBus"];function Tv(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}vt.prototype.on=function(e,t,o,a,r,i){if(((0,R.isFunction)(t)||(0,R.isNumber)(t))&&(i=r,r=a,a=o,o=t,t=null),(0,R.isFunction)(o)&&(i=r,r=a,a=o,o=Rv),(0,R.isObject)(r)&&(i=r,r=!1),!(0,R.isFunction)(a))throw new Error("handlerFn must be a function");(0,R.isArray)(e)||(e=[e]);var l=this._eventBus;(0,R.forEach)(e,function(s){var d=["commandStack",s,t].filter(function(c){return c}).join(".");l.on(d,o,r?Tv(a,i):a,i)})},vt.prototype.canExecute=rn("canExecute"),vt.prototype.preExecute=rn("preExecute"),vt.prototype.preExecuted=rn("preExecuted"),vt.prototype.execute=rn("execute"),vt.prototype.executed=rn("executed"),vt.prototype.postExecute=rn("postExecute"),vt.prototype.postExecuted=rn("postExecuted"),vt.prototype.revert=rn("revert"),vt.prototype.reverted=rn("reverted");function rn(e){return function(o,a,r,i,l){((0,R.isFunction)(o)||(0,R.isNumber)(o))&&(l=i,i=r,r=a,a=o,o=null),this.on(o,e,a,r,i,l)}}var Vv=250,Vc=1400;function $r(e,t,o){vt.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Vc,function(r){var i=r.context,l=i.shapes,s=i.validatedShapes;i.shapes=Mc(l),i.validatedShapes=Mc(s)}),a&&t.on("shape.move.start",Vv,function(r){var i=r.context,l=i.shapes,s=[];(0,R.forEach)(l,function(d){(0,R.forEach)(d.labels,function(c){!c.hidden&&i.shapes.indexOf(c)===-1&&s.push(c),d.labelTarget&&s.push(d)})}),(0,R.forEach)(s,function(d){a.makeDraggable(i,d,!0)})}),this.preExecuted("elements.move",Vc,function(r){var i=r.context.closure,l=i.enclosedElements,s=[];(0,R.forEach)(l,function(d){(0,R.forEach)(d.labels,function(c){l[c.id]||s.push(c)})}),i.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(r){var i=r.context;po((i.connection||i.shape).labels,function(l){o.removeShape(l,{nested:!0})})}),this.execute("shape.delete",function(r){var i=r.context,l=i.shape,s=l.labelTarget;s&&(i.labelTargetIndex=Fr(s.labels,l),i.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(r){var i=r.context,l=i.shape,s=i.labelTarget,d=i.labelTargetIndex;s&&(bn(s.labels,l,d),l.labelTarget=s)})}On($r,vt),$r.$inject=["injector","eventBus","modeling"];function Mc(e){return(0,R.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var Mv={__init__:["labelSupport"],labelSupport:["type",$r]};function Ac(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Nc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function Av(e,t,o,a){var r=o.inverse;return Object.defineProperty(e,"remove",{value:function(i){var l=this.indexOf(i);return l!==-1&&(this.splice(l,1),t.unset(i,r,a)),i}}),Object.defineProperty(e,"contains",{value:function(i){return this.indexOf(i)!==-1}}),Object.defineProperty(e,"add",{value:function(i,l){var s=this.indexOf(i);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,i),s===-1&&t.set(i,r,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Nv(e){return e.__refs_collection===!0}function jv(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function jc(e,t,o){var a=Av(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(r){e.set(r,t.inverse,o)})}function Pv(e,t,o){var a=t.inverse,r=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(i){if(i!==r){var l=r;r=null,l&&e.unset(l,a,o),r=i,e.set(r,a,o)}}})}function Nt(e,t){if(!(this instanceof Nt))return new Nt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Nt.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?jc(this,t,e):Pv(this,t,e)},Nt.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Nv(o)||jc(this,t,e),o},Nt.prototype.ensureBound=function(e,t){jv(e,t)||this.bind(e,t)},Nt.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},Nt.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var Wr=new Nt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Pc=new Nt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Hc=new Nt({name:"attachers",collection:!0},{name:"host"}),zc=new Nt({name:"outgoing",collection:!0},{name:"source"}),Oc=new Nt({name:"incoming",collection:!0},{name:"target"});function ho(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),Wr.bind(this,"parent"),Pc.bind(this,"labels"),zc.bind(this,"outgoing"),Oc.bind(this,"incoming")}function Ao(){ho.call(this),Wr.bind(this,"children"),Hc.bind(this,"host"),Hc.bind(this,"attachers")}On(Ao,ho);function Lc(){ho.call(this),Wr.bind(this,"children")}On(Lc,Ao);function Ic(){Ao.call(this),Pc.bind(this,"labelTarget")}On(Ic,Ao);function Dc(){ho.call(this),zc.bind(this,"source"),Oc.bind(this,"target")}On(Dc,ho);var Hv={connection:Dc,shape:Ao,label:Ic,root:Lc};function zv(e,t){var o=Hv[e];if(!o)throw new Error("unknown type: <"+e+">");return(0,R.assign)(new o,t)}function Ov(e){return e instanceof ho}function wn(){this._uid=12}wn.prototype.createRoot=function(e){return this.create("root",e)},wn.prototype.createLabel=function(e){return this.create("label",e)},wn.prototype.createShape=function(e){return this.create("shape",e)},wn.prototype.createConnection=function(e){return this.create("connection",e)},wn.prototype.create=function(e,t){return t=(0,R.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),zv(e,t)};var Lv={width:90,height:20};function Ln(){wn.call(this),this._translate=Nc}(0,on.default)(Ln,wn),Ln.$inject=[],Ln.prototype.baseCreate=wn.prototype.create,Ln.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Ke({type:"label"},Lv,t)):this.createFlowElement(e,t)},Ln.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Ac()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=Ke({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Ln.prototype._getDefaultSize=function(e){let t={width:100,height:80};switch(e){case"startEvent":case"endEvent":case"myEvent":t={width:36,height:36};break;case"gatewayAnd":case"gatewayXor":case"gatewayInclusive":t={width:50,height:50};break;case"subprocess":case"userTask":case"scriptTask":t={width:100,height:80};break}return t};function wa(e,t){this._modeling=e,this._canvas=t}wa.$inject=["modeling","canvas"],wa.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;(0,R.forEach)(o,function(r){var i={x:0,y:0};(0,R.isDefined)(a.left)?i.x=a.left-r.x:(0,R.isDefined)(a.right)?i.x=a.right-r.width-r.x:(0,R.isDefined)(a.center)?i.x=a.center-Math.round(r.width/2)-r.x:(0,R.isDefined)(a.top)?i.y=a.top-r.y:(0,R.isDefined)(a.bottom)?i.y=a.bottom-r.height-r.y:(0,R.isDefined)(a.middle)&&(i.y=a.middle-Math.round(r.height/2)-r.y),t.moveElements([r],i,r.parent)})},wa.prototype.postExecute=function(e){};function Ca(e){this._modeling=e}Ca.$inject=["modeling"],Ca.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,r=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:r.attach}),e.shape=a},Ca.prototype.postExecute=function(e){var t=e.hints||{};Iv(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function Iv(e,t){return(0,R.some)(e.outgoing,function(o){return o.target===t})}function xa(e,t){this._canvas=e,this._layouter=t}xa.$inject=["canvas","layouter"],xa.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,r=e.parent,i=e.parentIndex,l=e.hints;if(!o||!a)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,r,i),t},xa.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ka=Math.round;function Ur(e){this._modeling=e}Ur.$inject=["modeling"],Ur.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,r=e.position,i=e.hints,l=this._modeling;(0,R.forEach)(t,function(f){(0,R.isNumber)(f.x)||(f.x=0),(0,R.isNumber)(f.y)||(f.y=0)});var s=Ut((0,R.filter)(t,function(f){return!f.hidden}));(0,R.forEach)(t,function(f){St(f)&&(f.waypoints=(0,R.map)(f.waypoints,function(p){return{x:ka(p.x-s.x-s.width/2+r.x),y:ka(p.y-s.y-s.height/2+r.y)}})),(0,R.assign)(f,{x:ka(f.x-s.x-s.width/2+r.x),y:ka(f.y-s.y-s.height/2+r.y)})});var d=Oy(t),c={};(0,R.forEach)(t,function(f){if(St(f)){c[f.id]=(0,R.isNumber)(a)?l.createConnection(c[f.source.id],c[f.target.id],a,f,f.parent||o,i):l.createConnection(c[f.source.id],c[f.target.id],f,f.parent||o,i);return}var p=(0,R.assign)({},i);d.indexOf(f)===-1&&(p.autoResize=!1),fo(f)&&(p=(0,R.omit)(p,["attach"])),c[f.id]=(0,R.isNumber)(a)?l.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,a,p):l.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,p)}),e.elements=(0,R.values)(c)};var Fc=Math.round;function Cn(e){this._canvas=e}Cn.$inject=["canvas"],Cn.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,r=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?(0,R.assign)(t,o):(0,R.assign)(t,{x:o.x-Fc(t.width/2),y:o.y-Fc(t.height/2)}),this._canvas.addShape(t,a,r),t},Cn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function No(e){Cn.call(this,e)}On(No,Cn),No.$inject=["canvas"];var Dv=Cn.prototype.execute;No.prototype.execute=function(e){var t=e.shape;return $v(t),t.labelTarget=e.labelTarget,Dv.call(this,e)};var Fv=Cn.prototype.revert;No.prototype.revert=function(e){return e.shape.labelTarget=null,Fv.call(this,e)};function $v(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function jo(e,t){this._canvas=e,this._modeling=t}jo.$inject=["canvas","modeling"],jo.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;po(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),po(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},jo.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=Fr(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},jo.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,bn(o.children,t,a),this._canvas.addConnection(t,o),t};function Jr(e,t){this._modeling=e,this._elementRegistry=t}Jr.$inject=["modeling","elementRegistry"],Jr.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;(0,R.forEach)(a,function(r){o.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Po(e,t){this._canvas=e,this._modeling=t}Po.$inject=["canvas","modeling"],Po.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;po(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),po(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),po(o.children,function(a){St(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},Po.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=Fr(a.children,o),t.removeShape(o),o},Po.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,r=e.oldParentIndex;return bn(a.children,o,r),t.addShape(o,a),o};function Sa(e){this._modeling=e}Sa.$inject=["modeling"];var $c={x:"y",y:"x"};Sa.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,r=e.dimension;function i(v,x){v.range.min=Math.min(x[a],v.range.min),v.range.max=Math.max(x[a]+x[r],v.range.max)}function l(v){return v[a]+v[r]/2}function s(v){return v.length-1}function d(v){return v.max-v.min}function c(v,x){var w={y:0};w[a]=v-l(x),w[a]&&(w[$c[a]]=0,t.moveElements([x],w,x.parent))}var f=o[0],p=s(o),u=o[p],h,g,m=0;(0,R.forEach)(o,function(v,x){var w,y,C;if(v.elements.length<2){x&&x!==o.length-1&&(i(v,v.elements[0]),m+=d(v.range));return}w=(0,R.sortBy)(v.elements,a),y=w[0],x===p&&(y=w[s(w)]),C=l(y),v.range=null,(0,R.forEach)(w,function(E){if(c(C,E),v.range===null){v.range={min:E[a],max:E[a]+E[r]};return}i(v,E)}),x&&x!==o.length-1&&(m+=d(v.range))}),g=Math.abs(u.range.min-f.range.max),h=Math.round((g-m)/(o.length-1)),!(h<o.length-1)&&(0,R.forEach)(o,function(v,x){var w={},y;v===f||v===u||(y=o[x-1],v.range.max=0,(0,R.forEach)(v.elements,function(C,E){w[$c[a]]=0,w[a]=y.range.max-C[a]+h,v.range.min!==C[a]&&(w[a]+=C[a]-v.range.min),w[a]&&t.moveElements([C],w,C.parent),v.range.max=Math.max(C[a]+C[r],E?v.range.max:0)}))})},Sa.prototype.postExecute=function(e){};function Ea(e,t){this._layouter=e,this._canvas=t}Ea.$inject=["layouter","canvas"],Ea.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return(0,R.assign)(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Ea.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Yr(){}Yr.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,i=t.parent;return e.oldParent=i,e.oldParentIndex=ba(i.children,t),bn(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(l){l.x+=o.x,l.y+=o.y,l.original&&(l.original.x+=o.x,l.original.y+=o.y)}),t},Yr.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,r=e.oldParentIndex,i=e.delta;return ba(o.children,t),bn(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(l){l.x-=i.x,l.y-=i.y,l.original&&(l.original.x-=i.x,l.original.y-=i.y)}),t};function _a(e,t,o){var a=Ws(t),r=Ws(o),i=so(e,a),l={x:i.x*(o.width/t.width),y:i.y*(o.height/t.height)};return Mo({x:r.x+l.x,y:r.y+l.y})}function Gr(e,t,o){var a=Ba(e),r=Uc(a,t),i=a[0];return r.length?r[r.length-1]:_a(i.original||i,o,t)}function Kr(e,t,o){var a=Ba(e),r=Uc(a,t),i=a[a.length-1];return r.length?r[0]:_a(i.original||i,o,t)}function qr(e,t,o){var a=Ba(e),r=Wc(t,o),i=a[0];return _a(i.original||i,r,t)}function Xr(e,t,o){var a=Ba(e),r=Wc(t,o),i=a[a.length-1];return _a(i.original||i,r,t)}function Wc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ba(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Uc(e,t){return(0,R.filter)((0,R.map)(e,Uv),function(o){return Wv(o,t)})}function Wv(e,t){return vn(t,e,1)==="intersect"}function Uv(e){return e.original||e}function Zr(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Zr.prototype.add=function(e,t){return this.addAll([e],t)},Zr.prototype.addAll=function(e,t){var o=Dy(e,!!t,this);return(0,R.assign)(this,o),this};function Ho(e){this._modeling=e}Ho.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},Ho.prototype.moveClosure=function(e,t,o,a,r){var i=this._modeling,l=e.allShapes,s=e.allConnections,d=e.enclosedConnections,c=e.topLevel,f=!1;r&&r.parent===o&&(f=!0),(0,R.forEach)(l,function(p){i.moveShape(p,t,c[p.id]&&!f&&o,{recurse:!1,layout:!1})}),(0,R.forEach)(s,function(p){var u=!!l[p.source.id],h=!!l[p.target.id];d[p.id]&&u&&h?i.moveConnection(p,t,c[p.id]&&!f&&o):i.layoutConnection(p,{connectionStart:u&&qr(p,p.source,t),connectionEnd:h&&Xr(p,p.target,t)})})},Ho.prototype.getClosure=function(e){return new Zr().addAll(e,!0)};function Ra(e){this._helper=new Ho(e)}Ra.$inject=["modeling"],Ra.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ra.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function In(e){this._modeling=e,this._helper=new Ho(e)}In.$inject=["modeling"],In.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,i=t.parent;return e.oldBounds=(0,R.pick)(t,["x","y","width","height"]),e.oldParent=i,e.oldParentIndex=ba(i.children,t),bn(a.children,t,r),(0,R.assign)(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},In.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,r=this._modeling;a.layout!==!1&&((0,R.forEach)(t.incoming,function(i){r.layoutConnection(i,{connectionEnd:Xr(i,t,o)})}),(0,R.forEach)(t.outgoing,function(i){r.layoutConnection(i,{connectionStart:qr(i,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},In.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,r=e.delta;return bn(o.children,t,a),(0,R.assign)(t,{parent:o,x:t.x-r.x,y:t.y-r.y}),t},In.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},In.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function zo(e){this._modeling=e}zo.$inject=["modeling"],zo.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,r=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return(0,R.isArray)(r)&&(e.oldWaypoints=a.waypoints,a.waypoints=r),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},zo.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,r=e.dockingOrPoints,i=e.hints||{},l={};i.connectionStart&&(l.connectionStart=i.connectionStart),i.connectionEnd&&(l.connectionEnd=i.connectionEnd),i.layoutConnection!==!1&&(o&&(!a||i.docking==="source")&&(l.connectionStart=l.connectionStart||Jc((0,R.isArray)(r)?r[0]:r)),a&&(!o||i.docking==="target")&&(l.connectionEnd=l.connectionEnd||Jc((0,R.isArray)(r)?r[r.length-1]:r)),i.newWaypoints&&(l.waypoints=i.newWaypoints),this._modeling.layoutConnection(t,l))},zo.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,r=e.connection;return t&&(r.source=t),o&&(r.target=o),a&&(r.waypoints=a),r};function Jc(e){return e.original||e}function ln(e,t){this._modeling=e,this._rules=t}ln.$inject=["modeling","rules"],ln.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,r=e.oldShape,i=e.newData,l=e.hints||{},s;function d(g,m,v){return a.allowed("connection.reconnect",{connection:v,source:g,target:m})}var c={x:i.x,y:i.y},f={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(i,c,r.parent,l),r.host&&o.updateAttachment(s,r.host);var p;l.moveChildren!==!1&&(p=r.children.slice(),o.moveElements(p,{x:0,y:0},s,l));var u=r.incoming.slice(),h=r.outgoing.slice();(0,R.forEach)(u,function(g){var m=g.source;d(m,s,g)&&t.reconnectEnd(g,s,Kr(g,s,f),l)}),(0,R.forEach)(h,function(g){var m=g.target;d(s,m,g)&&t.reconnectStart(g,s,Gr(g,s,f),l)})},ln.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ln.prototype.execute=function(e){},ln.prototype.revert=function(e){},ln.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},ln.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},ln.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Oo(e){this._modeling=e}Oo.$inject=["modeling"],Oo.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Oo.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,R.forEach)(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:Kr(r,o,a)})}),(0,R.forEach)(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:Gr(r,o,a)})}))},Oo.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function Jv(e,t){var o=[];return(0,R.forEach)(e.concat(t),function(a){var r=a.incoming,i=a.outgoing;(0,R.forEach)(r.concat(i),function(l){var s=l.source,d=l.target;(Lo(e,s)||Lo(e,d)||Lo(t,s)||Lo(t,d))&&(Lo(o,l)||o.push(l))})}),o}function Lo(e,t){return e.indexOf(t)!==-1}function Yv(e,t,o){var a=e.x,r=e.y,i=e.width,l=e.height,s=o.x,d=o.y;switch(t){case"n":return{x:a,y:r+d,width:i,height:l-d};case"s":return{x:a,y:r,width:i,height:l+d};case"w":return{x:a+s,y:r,width:i-s,height:l};case"e":return{x:a,y:r,width:i+s,height:l};default:throw new Error("unknown direction: "+t)}}function xn(e){this._modeling=e}xn.$inject=["modeling"],xn.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,r=e.resizingShapes,i=e.start,l={};this.moveShapes(a,t),(0,R.forEach)(r,function(s){l[s.id]=Kv(s)}),this.resizeShapes(r,t,o),this.updateConnectionWaypoints(Jv(a,r),t,o,i,a,r,l)},xn.prototype.execute=function(){},xn.prototype.revert=function(){},xn.prototype.moveShapes=function(e,t){var o=this;(0,R.forEach)(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},xn.prototype.resizeShapes=function(e,t,o){var a=this;(0,R.forEach)(e,function(r){var i=Yv(r,o,t);a._modeling.resizeShape(r,i,null,{attachSupport:!1,autoResize:!1,layout:!1})})},xn.prototype.updateConnectionWaypoints=function(e,t,o,a,r,i,l){var s=this,d=r.concat(i);(0,R.forEach)(e,function(c){var f=c.source,p=c.target,u=Gv(c),h=Gc(o),g={};kn(d,f)&&kn(d,p)?(u=(0,R.map)(u,function(m){return Kc(m,a,o)&&(m[h]=m[h]+t[h]),m.original&&Kc(m.original,a,o)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(c,u,{labelBehavior:!1})):(kn(d,f)||kn(d,p))&&(kn(r,f)?g.connectionStart=qr(c,f,t):kn(r,p)?g.connectionEnd=Xr(c,p,t):kn(i,f)?g.connectionStart=Gr(c,f,l[f.id]):kn(i,p)&&(g.connectionEnd=Kr(c,p,l[p.id])),s._modeling.layoutConnection(c,g))})};function Yc(e){return(0,R.assign)({},e)}function Gv(e){return(0,R.map)(e.waypoints,function(t){return t=Yc(t),t.original&&(t.original=Yc(t.original)),t})}function Gc(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Kc(e,t,o){var a=Gc(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function kn(e,t){return e.indexOf(t)!==-1}function Kv(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ta(e){this._modeling=e}Ta.$inject=["modeling"],Ta.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=qc(o),t.collapsed=!t.collapsed;var a=Xc(o,t.collapsed);return[t].concat(a)},Ta.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,r=Zc(a,o);return t.collapsed=!t.collapsed,[t].concat(r)};function qc(e){var t={};return(0,R.forEach)(e,function(o){t[o.id]=o.hidden,o.children&&(t=(0,R.assign)({},t,qc(o.children)))}),t}function Xc(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(Xc(a.children,a.collapsed||t)))}),o}function Zc(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Zc(a.children,t)))}),o}function Va(e){this._modeling=e}Va.$inject=["modeling"],Va.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Qc(a,t),ed(o,t),t.host=o,t},Va.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,r=e.attacherIdx;return t.host=a,Qc(o,t),ed(a,t,r),t};function Qc(e,t){return ba(e&&e.attachers,t)}function ed(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),bn(a,t,o)}}function Qr(){}Qr.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},Qr.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Oe(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}Oe.$inject=["eventBus","elementFactory","commandStack"],Oe.prototype.getHandlers=function(){return{"shape.append":Ca,"shape.create":Cn,"shape.delete":Po,"shape.move":In,"shape.resize":Oo,"shape.replace":ln,"shape.toggleCollapse":Ta,spaceTool:xn,"label.create":No,"connection.create":xa,"connection.delete":jo,"connection.move":Yr,"connection.layout":Ea,"connection.updateWaypoints":Qr,"connection.reconnect":zo,"elements.create":Ur,"elements.move":Ra,"elements.delete":Jr,"elements.distribute":Sa,"elements.align":wa,"element.updateAttachment":Va}},Oe.prototype.registerHandlers=function(e){(0,R.forEach)(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},Oe.prototype.moveShape=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=null);var i={shape:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("shape.move",i)},Oe.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},Oe.prototype.moveElements=function(e,t,o,a){a=a||{};var r=a.attach,i=o,l;r===!0?(l=o,i=o.parent):r===!1&&(l=null);var s={shapes:e,delta:t,newParent:i,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},Oe.prototype.moveConnection=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=void 0);var i={connection:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("connection.move",i)},Oe.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},Oe.prototype.createConnection=function(e,t,o,a,r,i){typeof o=="object"&&(i=r,r=a,a=o,o=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:r,parentIndex:o,connection:a,hints:i};return this._commandStack.execute("connection.create",l),l.connection},Oe.prototype.createShape=function(e,t,o,a,r){typeof a!="number"&&(r=a,a=void 0),r=r||{};var i=r.attach,l,s;e=this._create("shape",e),i?(l=o.parent,s=o):l=o;var d={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:r};return this._commandStack.execute("shape.create",d),d.shape},Oe.prototype.createElements=function(e,t,o,a,r){(0,R.isArray)(e)||(e=[e]),typeof a!="number"&&(r=a,a=void 0),r=r||{};var i={position:t,elements:e,parent:o,parentIndex:a,hints:r};return this._commandStack.execute("elements.create",i),i.elements},Oe.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var r={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",r),r.shape},Oe.prototype.appendShape=function(e,t,o,a,r){r=r||{},t=this._create("shape",t);var i={source:e,position:o,target:a,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",i),i.shape},Oe.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Oe.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},Oe.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},Oe.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},Oe.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},Oe.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},Oe.prototype.resizeShape=function(e,t,o,a){var r={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",r)},Oe.prototype.createSpace=function(e,t,o,a,r){var i={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",i)},Oe.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},Oe.prototype.reconnect=function(e,t,o,a,r){var i={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:r||{}};this._commandStack.execute("connection.reconnect",i)},Oe.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,(0,R.assign)(a,{docking:"source"}))},Oe.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,(0,R.assign)(a,{docking:"target"}))},Oe.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},Oe.prototype._create=function(e,t){return Ov(t)?t:this._elementFactory.create(e,t)},Oe.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function td(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ei(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function qv(e,t){Array.isArray(e)&&e.forEach(t)}function Ma(e){const t=e.businessObject;if(t)return t.name||""}function Xv(e,t){const o=e.businessObject;return o.name=t,e}var Zv={width:90,height:20},bx=15;function ti(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function nd(e){return Io(e.label)}function Qv(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],r=eb(e),i=Math.atan((a.y-o.y)/(a.x-o.x));let{x:l,y:s}=r;return Math.abs(i)<Math.PI/2?s-=15:l+=15,{x:l,y:s}}function eb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function od(e){return e.waypoints?Qv(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Zv.height/2}}function Io(e){return e&&!!e.labelTarget}var tb={width:0,height:0};function ad(e,t){function o(s,d){const c=s.label||s,f=s.labelTarget||s;return Xv(c,d,f!==c),[c,f]}function a(s){const{element:d,newLabel:c}=s,{businessObject:f}=d;if(!Io(d)&&ti(d)&&!nd(d)&&!rd(c)){let u=od(d);u={x:u.x,y:u.y+7},e.createLabel(d,u,{id:f.id+"_label",businessObject:f})}}function r(s){return s.oldLabel=Ma(s.element),o(s.element,s.newLabel)}function i(s){return o(s.element,s.oldLabel)}function l(s){const{element:d,newLabel:c}=s,f=d.label||d,p=s.hints||{};let{newBounds:u}=s;if(!Io(f))return;if(Io(f)&&rd(c)){p.removeShape!==!1&&e.removeShape(f,{unsetLabel:!1});return}const h=Ma(f);typeof u>"u"&&(u=t.getExternalLabelBounds(f,h)),u&&e.resizeShape(f,u,tb)}this.preExecute=a,this.execute=r,this.revert=i,this.postExecute=l}ad.$inject=["modeling","textRenderer"];function rd(e){return!e||!e.trim()}function Do(e,t,o){Oe.call(this,e,t,o)}(0,on.default)(Do,Oe),Do.$inject=["eventBus","elementFactory","commandStack"],Do.prototype.getHandlers=function(){const e=Oe.prototype.getHandlers.call(this);return e["element.updateLabel"]=ad,e},Do.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function ni(e,t){vt.call(this,e);function o(a){const{context:r}=a,i=r.hints||{};let l;!r.cropped&&i.createElementsBehavior!==!1&&(l=r.connection,l.waypoints=t.getCroppedWaypoints(l),r.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}(0,on.default)(ni,vt),ni.$inject=["eventBus","connectionDocking"];function id(){}id.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||tt(t.source||e.source),t.connectionEnd||tt(t.target||e.target)]};var Aa=20,nb=5,Na=Math.round,ld=20,ob={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ab(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function rb(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function sd(e,t,o){var a=vn(t,e,nb),r=o.split(":")[0],i=Na((t.x-e.x)/2+e.x),l=Na((t.y-e.y)/2+e.y),s,d,c=rb(r,a),f=/h|r|l/.test(r),p=!1,u=!1;return c?(s=f?{x:i,y:e.y}:{x:e.x,y:l},d=f?"h:h":"v:v"):(p=ab(a,r),d=f?"h:v":"v:h",p?f?(u=l===e.y,s={x:e.x+Aa*(/l/.test(r)?-1:1),y:u?l+Aa:l}):(u=i===e.x,s={x:u?i+Aa:i,y:e.y+Aa*(/t/.test(r)?-1:1)}):s={x:i,y:l}),{waypoints:oi(e,s,d).concat(s),directions:d,turnNextDirections:u}}function ib(e,t,o){return sd(e,t,o)}function lb(e,t,o){var a=sd(t,e,cd(o));return{waypoints:a.waypoints.slice().reverse(),directions:cd(a.directions),turnNextDirections:a.turnNextDirections}}function sb(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var r=o+":"+a;return{waypoints:oi(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}function cd(e){return e.split(":").reverse().join(":")}function cb(e,t,o){var a=Na((t.x-e.x)/2+e.x),r=Na((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function oi(e,t,o){if(o=o||"h:h",!vb(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ud(o)){var a=ib(e,t,o),r=lb(e,t,o),i=sb(a,r);return[].concat(a.waypoints,i.waypoints,r.waypoints)}return cb(e,t,o)}function db(e,t,o){var a=oi(e,t,o);return a.unshift(e),a.push(t),pd(a)}function ub(e,t,o,a,r){var i=(0,R.without)(r&&r.preferredLayouts||[],"straight")[0]||"h:h",l=vn(e,t,ob[i]||0),s=yb(l,i);o=o||tt(e),a=a||tt(t);var d=s.split(":");return db(fd(o,e,d[0],bb(l)),fd(a,t,d[1],l),s)}function fb(e,t,o,a,r,i){(0,R.isArray)(o)&&(r=o,i=a,o=tt(e),a=tt(t)),i=(0,R.assign)({preferredLayouts:[]},i),r=r||[];var l=i.preferredLayouts.indexOf("straight")!==-1&&hb(e,t,o,a,i);return l||(l=i.connectionEnd&&mb(t,e,a,r),l)||(l=i.connectionStart&&gb(e,t,o,r),l)?l:!i.connectionStart&&!i.connectionEnd&&r&&r.length?r:ub(e,t,o,a,i)}function pb(e,t,o){return e>=t&&e<=o}function dd(e,t,o){return pb(t[e],o[e],o[e]+o[{x:"width",y:"height"}[e]])}function hb(e,t,o,a,r){var i={},l,s=vn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),r.preserveDocking==="target"?dd(l,a,e)?(i[l]=a[l],[{x:i.x!==void 0?i.x:o.x,y:i.y!==void 0?i.y:o.y,original:{x:i.x!==void 0?i.x:o.x,y:i.y!==void 0?i.y:o.y}},{x:a.x,y:a.y}]):null:dd(l,o,t)?(i[l]=o[l],[{x:o.x,y:o.y},{x:i.x!==void 0?i.x:a.x,y:i.y!==void 0?i.y:a.y,original:{x:i.x!==void 0?i.x:a.x,y:i.y!==void 0?i.y:a.y}}]):null):null}function gb(e,t,o,a){return ai(e,t,o,a)}function mb(e,t,o,a){var r=a.slice().reverse();return r=ai(e,t,o,r),r?r.reverse():null}function ai(e,t,o,a){function r(f){return f.length<3?!0:f.length>4?!1:!!(0,R.find)(f,function(p,u){var h=f[u-1];return h&&Vo(p,h)<3})}function i(f,p,u){switch(hn(p,f)){case"v":return{x:u.x,y:f.y};case"h":return{x:f.x,y:u.y}}return{x:f.x,y:f.y}}function l(f,p,u){var h;for(h=f.length-2;h!==0;h--)if(lc(f[h],p,ld)||lc(f[h],u,ld))return f.slice(h);return f}if(r(a))return null;var s=a[0],d=a.slice(),c;return d[0]=o,d[1]=i(d[1],s,o),c=l(d,e,t),c!==d&&(d=ai(e,t,o,c)),d&&hn(d)?null:d}function yb(e,t){if(ud(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function vb(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ud(e){return e&&/t|r|b|l/.test(e)}function bb(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function fd(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function pd(e){return e.reduce(function(t,o,a){var r=t[t.length-1],i=e[a+1];return Nr(r,i,o,0)||t.push(o),t},[])}function ri(){}(0,on.default)(ri,id);var Dn=(e,t)=>e.type===t;ri.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,r=t.waypoints||e.waypoints;let{connectionStart:i,connectionEnd:l}=t,s,d;return l===void 0&&(i=ja(r&&r[0],o),l=ja(r&&r[r.length-1],a)),i||(i=ja(r&&r[0],o)),l||(l=ja(r&&r[r.length-1],a)),Dn(e,"myline")&&(o===a?s={preferredLayouts:wb(o,e)}:Dn(o,"gatewayAnd")||Dn(o,"gatewayXor")||Dn(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Dn(a,"gatewayAnd")||Dn(a,"gatewayXor")||Dn(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Ke(s,t),d=pd(fb(o,a,i,l,r,s))),d||[i,l]};function ja(e,t){return e?e.original||e:tt(t)}function wb(e,t){const{waypoints:o}=t,a=o&&o.length&&vn(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function hd(e){return(0,R.assign)({original:e.point.original||e.point},e.actual)}function Sn(e,t){this._elementRegistry=e,this._graphicsFactory=t}Sn.$inject=["elementRegistry","graphicsFactory"],Sn.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,o),i=e.waypoints.slice(a.idx+1,r.idx);return i.unshift(hd(a)),i.push(hd(r)),i},Sn.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,r=o?0:a.length-1,i=a[r];return{point:i,actual:this._getIntersection(t,e,o)||i,idx:r}},Sn.prototype._getIntersection=function(e,t,o){return zr(this._getShapePath(e),this._getConnectionPath(t),o)},Sn.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Sn.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Sn.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var gd={__depends__:[Bv,Mv,lo],__init__:["modeling","elementUpdater"],modeling:["type",Do],layouter:["type",ri],elementUpdater:["type",ni],elementFactory:["type",Ln],connectionDocking:["type",Sn]},Cb=1e3;function Fn(e,t){var o=this;t=t||Cb,e.on(["render.shape","render.connection"],t,function(a,r){var i=a.type,l=r.element,s=r.gfx,d=r.attrs;if(o.canRender(l))return i==="render.shape"?o.drawShape(s,l,d):o.drawConnection(s,l,d)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,r){if(o.canRender(r))return a.type==="render.getShapePath"?o.getShapePath(r):o.getConnectionPath(r)})}Fn.prototype.canRender=function(e){},Fn.prototype.drawShape=function(e,t){},Fn.prototype.drawConnection=function(e,t){},Fn.prototype.getShapePath=function(e){},Fn.prototype.getConnectionPath=function(e){};function xb(e){return e.businessObject}function Pa(e,t){return e.businessObject.strokeWidth||t||1}function Lt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function nt(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function kb(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2;return Ro([["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function Sb(e,t){const{x:o,y:a,width:r,height:i}=e;return Ro([["M",o+t,a],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,i-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-i],["a",t,t,0,0,1,t,-t],["z"]])}function Eb(e){const{x:t,y:o,width:a,height:r}=e,i=a/2,l=r/2;return Ro([["M",t+i,o],["l",i,l],["l",-i,l],["l",-i,-l],["z"]])}function _b(e){const{x:t,y:o,width:a,height:r}=e;return Ro([["M",t,o],["l",a,0],["l",0,r],["l",-a,0],["z"]])}var ii=10,li=.95,En=(e,t)=>e.type===t;function $n(e,t,o,a,r,i,l){Fn.call(this,e,l);const s="var(--j-color-bg-container)",d="var(--j-color-text)",c={};Object.keys(i.palette).forEach(M=>{const B=i.palette[M];c[B.type]=B.options});const{computeStyle:f}=t;function p(M){return L[M]}function u(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2})}function h(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2,fill:"white"})}function g(M,B,D,U){D=u(D);const te=_r(B,D,U);return(0,P.append)(M,te),te}function m(M,B,D){return g(M,B,D,5)}function v(M,B,D,U,te){td(U)&&(te=U,U=0),U=U||0,te=f(te,{stroke:d,strokeWidth:2,fill:s}),te.fill==="none"&&delete te.fillOpacity;const le=B/2,A=D/2,I=(0,P.create)("circle");return(0,P.attr)(I,{cx:le,cy:A,r:Math.round((B+D)/4-U)}),(0,P.attr)(I,te),(0,P.append)(M,I),I}function x(M,B,D,U,te,le){td(te)&&(le=te,te=0),te=te||0,le=f(le,{stroke:d,strokeWidth:2,fill:s});const A=(0,P.create)("rect");return(0,P.attr)(A,{x:te,y:te,width:B-te*2,height:D-te*2,rx:U,ry:U}),(0,P.attr)(A,le),(0,P.append)(M,A),A}function w(M,B,D){D=f(D,["no-fill"],{strokeWidth:2,stroke:d});const U=(0,P.create)("path");return(0,P.attr)(U,{d:B}),(0,P.attr)(U,D),(0,P.append)(M,U),U}function y(M,B,D,U){const te=B/2,le=D/2,A=[{x:te,y:0},{x:B,y:le},{x:te,y:D},{x:0,y:le}].map(W=>W.x+","+W.y).join(" ");U=f(U,{stroke:d,strokeWidth:2,fill:s});const I=(0,P.create)("polygon");return(0,P.attr)(I,{points:A}),(0,P.attr)(I,U),(0,P.append)(M,I),I}function C(M,B,D,U){return w(B,D,Ke({"data-marker":M},U))}function E(M,B,D){D=Ke({size:{width:100}},D);const U=r.createText(B||"",D);return(0,P.classes)(U).add("djs-label"),(0,P.append)(M,U),U}function b(M,B,D){return E(M,xb(B).name,{box:B,align:D,padding:5,style:{fill:nt(B,d)}})}function k(M,B){const D={width:90,height:30,x:B.width/2+B.x,y:B.height/2+B.y};return E(M,Ma(B),{box:D,fitBox:!0,style:Ke({},r.getExternalStyle(),{fill:nt(B,d)})})}function S(M,B,D){const U=D&&D.indexOf("SubProcessMarker")!==-1;let te;U?te={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:te={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},qv(D,le=>{p(le)(M,B,te)})}function _(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function T(M,B){const{ref:D={x:0,y:0},scale:U=1,element:te,parentGfx:le=a._svg}=B,A=(0,P.create)("marker",{id:M,viewBox:"0 0 20 20",refX:D.x,refY:D.y,markerWidth:20*U,markerHeight:20*U,orient:"auto"});(0,P.append)(A,te);let I=(0,G.query)(":scope > defs",le);I||(I=(0,P.create)("defs"),(0,P.append)(le,I)),(0,P.append)(I,A)}function V(M,B,D,U){const te=B+"-"+_(D)+"-"+_(U)+"-"+Ac();return j(M,te,B,D,U),"url(#"+te+")"}function j(M,B,D,U,te){D==="sequenceflow-end"&&T(B,{element:(0,P.create)("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:te,stroke:te,strokeWidth:1})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),D==="messageflow-start"&&T(B,{element:(0,P.create)("circle",{cx:6,cy:6,r:3.5,...h({fill:U,stroke:te,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6},parentGfx:M}),D==="messageflow-end"&&T(B,{element:(0,P.create)("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:U,stroke:te,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5},parentGfx:M}),D==="association-start"&&T(B,{element:(0,P.create)("path",{d:"M 11 5 L 1 10 L 11 15",...u({fill:"none",stroke:te,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5,parentGfx:M}),D==="association-end"&&T(B,{element:(0,P.create)("path",{d:"M 1 5 L 11 10 L 1 15",...u({fill:"none",stroke:te,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),D==="conditional-flow-marker"&&T(B,{element:(0,P.create)("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:U,stroke:te})}),ref:{x:-1,y:10},scale:.5,parentGfx:M}),D==="conditional-default-flow-marker"&&T(B,{element:(0,P.create)("path",{d:"M 6 4 L 10 16",...h({stroke:te,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function z(M,B,D,U){const te=c[B.type]?.icon||B.icon;te&&w(M,o.getScaledPath(te,{abspos:{x:D,y:U}}),{strokeWidth:0,fill:nt(B,c[B.type]?.iconFill||B.iconFill)})}const L={event(M,B,D){return"fillOpacity"in D||(D.fillOpacity=li),v(M,B.width,B.height,D)},startEvent(M,B){const D={fill:Lt(B,c.startEvent?.fill||B.fill),stroke:nt(B,c.startEvent?.stroke||B.stroke),strokeWidth:Pa(B,c.startEvent?.strokeWidth||B.strokeWidth)},U=p("event")(M,B,D);return z(M,B,18,18),U},endEvent(M,B){const D=p("event")(M,B,{strokeWidth:Pa(B,c.endEvent?.strokeWidth||B.strokeWidth||4),fill:Lt(B,c.endEvent?.fill||B.fill),stroke:nt(B,c.endEvent?.stroke||B.stroke)});return z(M,B,18,18),D},gateway(M,B){const D={fillOpacity:li,strokeWidth:Pa(B,c[B.type]?.strokeWidth||B.strokeWidth||4),fill:Lt(B,c[B.type]?.fill||B.fill),stroke:nt(B,c[B.type]?.stroke||B.stroke)};return y(M,B.width,B.height,D)},gatewayAnd(M,B){const D=p("gateway")(M,B);return w(M,o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:c[B.type]?.width||B.width,containerHeight:c[B.type]?.height||B.height,position:{mx:.47,my:.29}}),{strokeWidth:1,fill:nt(B,c[B.type]?.iconFill||B.iconFill),stroke:nt(B,c[B.type]?.iconFill||B.iconFill)}),D},gatewayXor(M,B){const D=p("gateway")(M,B);return w(M,o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:B.width,containerHeight:B.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:nt(B,c[B.type]?.iconFill||B.iconFill),stroke:nt(B,c[B.type]?.iconFill||B.iconFill)}),D},gatewayInclusive(M,B){const D=p("gateway")(M,B);return v(M,B.width,B.height,B.height*.24,{strokeWidth:2.5,fill:nt(B,s),stroke:nt(B,c[B.type]?.iconFill||B.iconFill)}),D},activity(M,B,D){return D=D||{},"fillOpacity"in D||(D.fillOpacity=li),x(M,B.width,B.height,ii,D)},task(M,B){const D={fill:Lt(B,s),stroke:nt(B,d)},U=p("activity")(M,B,D);return b(M,B,"center-middle"),S(M,B),U},userTask(M,B){const D=p("task")(M,B),U=15,te=12;return w(M,o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:te}}),{strokeWidth:.5,fill:Lt(B,s),stroke:nt(B,d)}),w(M,o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:te}}),{strokeWidth:.5,fill:Lt(B,s),stroke:nt(B,d)}),w(M,o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:te}}),{strokeWidth:.5,fill:nt(B,d),stroke:nt(B,d)}),D},scriptTask(M,B){const D=p("task")(M,B);return w(M,o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:nt(B,d)}),D},SubProcessMarker(M,B){Jt(x(M,14,14,0,{strokeWidth:1,fill:Lt(B,s),stroke:nt(B,d)}),B.width/2-7.5,B.height-20),C("sub-process",M,o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:B.width,containerHeight:B.height,position:{mx:(B.width/2-7.5)/B.width,my:(B.height-20)/B.height}}),{fill:Lt(B,s),stroke:nt(B,d)})},subprocess(M,B,D){D=Ke({fill:Lt(B,s),stroke:nt(B,d)},D);const U=p("activity")(M,B,D);return b(M,B,"center-middle"),S(M,B,["SubProcessMarker"]),U},label(M,B){return k(M,B)},myline(M,B){const D=Lt(B,i.lineStroke||s),U=nt(B,i.lineStroke||d);return m(M,B.waypoints,{markerEnd:V(M,"sequenceflow-end",D,U),stroke:U})},default(M,B){const D={strokeWidth:Pa(B,c[B.type]?.strokeWidth||B.strokeWidth||1),fill:Lt(B,c[B.type]?.fill||B.fill),stroke:nt(B,c[B.type]?.stroke||B.stroke)},U=x(M,B.width,B.height,B.radius||ii,D);return b(M,B,"center-middle"),S(M,B),z(M,B,B.iconX,B.iconY),U}};this.handlers=L,this._drawPath=w}(0,on.default)($n,Fn),$n.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],$n.prototype.canRender=function(){return!0},$n.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},$n.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},$n.prototype.getShapePath=function(e){return En(e,"startEvent")||En(e,"endEvent")?kb(e):En(e,"userTask")||En(e,"scriptTask")||En(e,"subprocess")?Sb(e,ii):En(e,"gatewayAnd")||En(e,"gatewayXor")||En(e,"gatewayInclusive")?Eb(e):_b(e)};var Bb=0,Rb={width:150,height:50};function Tb(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Vb(e){return(0,R.isObject)(e)?(0,R.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var si=null;function Mb(){return si||(si=document.createElement("canvas").getContext("2d")),si}function Ab(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(md(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function md(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Nb(e,t){var o=Mb();if(!o)return{width:0,height:0};o.font=Ab(t),"letterSpacing"in o&&(o.letterSpacing=md(t.letterSpacing)||"0px");var a=e==="",r=a?"dummy":e.replace(/\s+$/,""),i=o.measureText(r);return{width:a?0:i.width,height:"fontBoundingBoxAscent"in i?i.fontBoundingBoxAscent+i.fontBoundingBoxDescent:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent}}function jb(e,t,o){for(var a=e.shift(),r=a,i;;){if(i=Nb(r,o),i.width=r?i.width:0,r===" "||r===""||i.width<Math.round(t)||r.length<2)return Pb(e,r,a,i);r=zb(r,i.width,t)}}function Pb(e,t,o,a){if(t.length<o.length){var r=o.slice(t.length).trim();e.unshift(r)}return{width:a.width,height:a.height,text:t}}var yd="";function Hb(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,r=[],i=0;if(o.length>1)for(;a=o.shift();)if(a.length+i<t)r.push(a),i+=a.length;else{(a==="-"||a===yd)&&r.pop();break}var l=r[r.length-1];return l&&l===yd&&(r[r.length-1]="-"),r.join("")}function zb(e,t,o){var a=Math.max(e.length*(o/t),1),r=Hb(e,a);return r||(r=e.slice(0,Math.max(Math.round(a-1),1))),r}function Ha(e){this._config=(0,R.assign)({},{size:Rb,padding:Bb,style:{},align:"center-top"},e||{})}Ha.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ha.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ha.prototype.layoutText=function(e,t){for(var o=(0,R.assign)({},this._config.size,t.box),a=(0,R.assign)({},this._config.style,t.style),r=Tb(t.align||this._config.align),i=Vb(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Ob(a),d=e.split(/\u00AD?\r?\n/),c=[],f=o.width-i.left-i.right;d.length;)c.push(jb(d,f,a));r.vertical==="middle"&&(i.top=i.bottom=0);var p=(0,R.reduce)(c,function(m,v,x){return m+(s||v.height)},0)+i.top+i.bottom,u=(0,R.reduce)(c,function(m,v,x){return v.width>m?v.width:m},0),h=i.top;r.vertical==="middle"&&(h+=(o.height-p)/2),h-=(s||c[0].height)/4;var g=(0,P.create)("text");return(0,P.attr)(g,a),(0,R.forEach)(c,function(m){var v;switch(h+=s||m.height,r.horizontal){case"left":v=i.left;break;case"right":v=(l?u:f)-i.right-m.width;break;default:v=Math.max(((l?u:f)-m.width)/2+i.left,0)}var x=(0,P.create)("tspan");(0,P.attr)(x,{x:v,y:h}),x.textContent=m.text,(0,P.append)(g,x)}),{dimensions:{width:u,height:p},element:g}};function Ob(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Lb=12,Ib=1.2,Db=30;function vd(e){const t=Ke({fontFamily:"Arial, sans-serif",fontSize:Lb,fontWeight:"normal",lineHeight:Ib},e&&e.defaultStyle||{}),o=Ke({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Ha({style:t});this.getExternalLabelBounds=function(r,i){const l=a.getDimensions(i,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:o});return{x:Math.round(r.x+r.width/2-l.width/2),y:Math.round(r.y),width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(r,i){const l=a.getDimensions(i,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(Db,Math.round(l.height))}},this.createText=function(r,i){return a.createText(r,i||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return o}}vd.$inject=["config.textRenderer"];function Fb(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,r;o.abspos?(a=o.abspos.x,r=o.abspos.y):(a=o.containerWidth*o.position.mx,r=o.containerHeight*o.position.my);let i={};typeof t=="object"?(i=t,i.d.indexOf("{mx},{my}")===-1&&(i.d="m {mx},{my}"+i.d),i.width&&(a-=i.width/2),i.height&&(r-=i.height/2)):i=this.pathMap[t];const l={};if(o.position){const s=o.containerHeight/i.height*o.yScaleFactor,d=o.containerWidth/i.width*o.xScaleFactor;for(let c=0;c<i.heightElements.length;c++)l["y"+c]=i.heightElements[c]*s;for(let c=0;c<i.widthElements.length;c++)l["x"+c]=i.widthElements[c]*d}return Jb(i.d,{mx:a,my:r,e:l})}}var $b=/\{([^}]+)\}/g,Wb=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Ub(e,t,o){let a=o;return t.replace(Wb,(r,i,l,s,d)=>{i=i||s,a&&(i in a&&(a=a[i]),typeof a=="function"&&d&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function Jb(e,t){return String(e).replace($b,(o,a)=>Ub(o,a,t))}var bd={__init__:["myRenderer"],myRenderer:["type",$n],textRenderer:["type",vd],pathMap:["type",Fb]};function wd(e,t){return Ke({id:e.id,type:e.type,businessObject:e},t)}function Yb(e,t,o){const a=e.waypoint;return!a||a.length<2?[tt(t),tt(o)]:a.map(r=>({x:r.x,y:r.y}))}function _n(e,t,o,a,r,i){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=r,this._translate=Nc,this._textRenderer=i,this._modeling=t}_n.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],_n.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),r=this._getTarget(e);t=this._elementFactory.createConnection(wd(e,{source:a,target:r,waypoints:Yb(e,a,r)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(wd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},_n.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},_n.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Ke(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:r}=t;if(r&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const i={x:t.x+12,y:t.y+42,width:10,height:10,name:r,id:e},l=this._textRenderer.getExternalLabelBounds(i,t.name);this._modeling.resizeShape(i,l,{width:0,height:0}),o&&this.addLabel(i,o)}}},_n.prototype._getSource=function(e){return this._getElement(e.from)},_n.prototype._getTarget=function(e){return this._getElement(e.to)},_n.prototype._getElement=function(e){return this._elementRegistry.get(e)};var Cd={myImporter:["type",_n]},xd=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(r=>({x:r.x,y:r.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const r=t.find(i=>i.id===a.id);r&&(r.name=a.name||"",r.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},kd=(e,t)=>{const o=t.get("myImporter"),a=e.filter(i=>i.type!=="myline"),r=e.filter(i=>i.type==="myline");a.forEach(i=>{o.add(i)}),r.forEach(i=>{o.add(i)})},Gb=(0,n.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const b=s.get("eventBus");b.on("element.dblclick",k=>{r("elementDblclick",k.element.businessObject)}),b.on("element.click",k=>{r("elementClick",k.element.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},u=()=>{let b={__init__:["myOptions"],myOptions:["type",p]};s=new na.default({canvas:{container:i.value},modules:[Lr,ic,gd,_c,Tc,b,bd,Cd]});const k=s.get("canvas"),S=s.get("elementFactory");c();const _=S.createRoot();k.setRootElement(_),f()};(0,n.onMounted)(()=>{u()});const h=b=>{const k=b==null?1:d+b;s.get("canvas").zoom(k),d=k},g=()=>(s.get("canvas").zoom(1),xd(s.get("elementRegistry").getAll())),m=b=>{s.clear(),c(),kd(b,s)},v=b=>{s.get("myImporter").update(b.id,b)};return t({reset:()=>{c()},zoom:b=>{h(b)},getData:()=>g(),setData:b=>{m(b)},updateElemet:b=>{v(b)}}),(b,k)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:i,class:"j-work-flow"},null,512))}}),Kb=Gb;function ci(e){return e&&e[e.length-1]}function Sd(e){return e.y}function Ed(e){return e.x}var qb={left:Ed,center:Ed,right:function(e){return e.x+e.width},top:Sd,middle:Sd,bottom:function(e){return e.y+e.height}};function go(e,t){this._modeling=e,this._rules=t}go.$inject=["modeling","rules"],go.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},go.prototype._isType=function(e,t){return t.indexOf(e)!==-1},go.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,r=o.dimension,i={},l={},s=!1,d,c,f;function p(u,h){return Math.round((u[a]+h[a]+h[r])/2)}if(this._isType(e,["left","top"]))i[e]=t[0][a];else if(this._isType(e,["right","bottom"]))f=ci(t),i[e]=f[a]+f[r];else if(this._isType(e,["center","middle"])){if((0,R.forEach)(t,function(u){var h=u[a]+Math.round(u[r]/2);l[h]?l[h].elements.push(u):l[h]={elements:[u],center:h}}),d=(0,R.sortBy)(l,function(u){return u.elements.length>1&&(s=!0),u.elements.length}),s)return i[e]=ci(d).center,i;c=t[0],t=(0,R.sortBy)(t,function(u){return u[a]+u[r]}),f=ci(t),i[e]=p(c,f)}return i},go.prototype.trigger=function(e,t){var o=this._modeling,a,r=(0,R.filter)(e,function(d){return!(d.waypoints||d.host||d.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:r}),(0,R.isArray)(a)&&(r=a),!(r.length<2||!a)){var i=qb[t],l=(0,R.sortBy)(r,i),s=this._alignmentPosition(t,l);o.alignElements(l,s)}};var Xb={__init__:["alignElements"],alignElements:["type",go]},za=Math.round,Zb=Math.max;function Qb(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function ew(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var _d=10;function tw(e,t){var o,a;for(o=0;a=e[o];o++)if(Vo(a,t)<=_d)return{point:e[o],bendpoint:!0,index:o};return null}function nw(e,t){var o=gc(Qb(t,_d),ew(e)),a=o[0],r=o[o.length-1],i;return a?a!==r?a.segment2!==r.segment2?(i=Zb(a.segment2,r.segment2)-1,{point:e[i],bendpoint:!0,index:i}):{point:{x:za(a.x+r.x)/2,y:za(a.y+r.y)/2},index:a.segment2}:{point:{x:za(a.x),y:za(a.y)},index:a.segment2}:null}function ow(e,t){return tw(e,t)||nw(e,t)}function aw(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function rw(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],r=a[0].n*t[0]+a[1].n*t[1],i=a[0].lambda*t[0]+a[1].lambda*t[1];return-r/i}function Bd(e,t){var o=t[0],a=t[1],r={x:a.x-o.x,y:a.y-o.y},i=rw([o.x,o.y],[r.x,r.y],[e.x,e.y]);return{x:o.x+i*r.x,y:o.y+i*r.y}}function iw(e,t){var o=Bd(e,t);return aw({x:o.x-e.x,y:o.y-e.y})}var Rd="djs-bendpoint",Td="djs-segment-dragger";function lw(e,t){var o=ro(t),a=e._container.getBoundingClientRect(),r={x:a.left,y:a.top},i=e.viewbox();return{x:i.x+(o.x-r.x)/i.scale,y:i.y+(o.y-r.y)/i.scale}}function di(e,t,o){return ow(t,lw(e,o))}function ui(e,t){var o=(0,P.create)("g");(0,P.classes)(o).add(Rd),(0,P.append)(e,o);var a=(0,P.create)("circle");(0,P.attr)(a,{cx:0,cy:0,r:4}),(0,P.classes)(a).add("djs-visual"),(0,P.append)(o,a);var r=(0,P.create)("circle");return(0,P.attr)(r,{cx:0,cy:0,r:10}),(0,P.classes)(r).add("djs-hit"),(0,P.append)(o,r),t&&(0,P.classes)(o).add(t),o}function sw(e,t,o,a){var r=(0,P.create)("g");(0,P.append)(e,r);var i=18,l=6,s=11,d=dw(t,o,a),c=l+s,f=(0,P.create)("rect");(0,P.attr)(f,{x:-i/2,y:-l/2,width:i,height:l}),(0,P.classes)(f).add("djs-visual"),(0,P.append)(r,f);var p=(0,P.create)("rect");return(0,P.attr)(p,{x:-d/2,y:-c/2,width:d,height:c}),(0,P.classes)(p).add("djs-hit"),(0,P.append)(r,p),Yy(r,a==="v"?90:0,0,0),r}function Vd(e,t,o){var a=(0,P.create)("g"),r=jr(t,o),i=hn(t,o);return(0,P.append)(e,a),sw(a,t,o,i),(0,P.classes)(a).add(Td),(0,P.classes)(a).add(i==="h"?"horizontal":"vertical"),Jt(a,r.x,r.y),a}function fi(e){return Math.abs(Math.round(e*2/3))}function cw(e,t){return Bd(e,uw(e,t))}function dw(e,t,o){var a=t.x-e.x,r=t.y-e.y;return fi(o==="h"?a:r)}function uw(e,t){for(var o=t.waypoints,a=1/0,r,i=0;i<o.length-1;i++){var l=o[i],s=o[i+1],d=iw(e,[l,s]);d<a&&(a=d,r=i)}return[o[r],o[r+1]]}function pi(e){return CSS.escape(e)}function Md(e,t,o,a,r){function i(y,C,E){var b=y.index,k=y.point,S,_,T,V,j,z;return b<=0||y.bendpoint?!1:(S=C[b-1],_=C[b],T=jr(S,_),V=hn(S,_),j=Math.abs(k.x-T.x),z=Math.abs(k.y-T.y),V&&j<=E&&z<=E)}function l(y,C){var E=y.waypoints,b,k,S,_;return C.index<=0||C.bendpoint||(b={start:E[C.index-1],end:E[C.index]},k=hn(b.start,b.end),!k)?null:(k==="h"?S=b.end.x-b.start.x:S=b.end.y-b.start.y,_=fi(S)/2,_)}function s(y,C){var E=C.waypoints,b=di(t,E,y),k;if(b)return k=l(C,b),i(b,E,k)?r.start(y,C,b.index):a.start(y,C,b.index,!b.bendpoint),!0}function d(y,C,E){G.event.bind(y,C,function(b){o.triggerMouseEvent(C,b,E),b.stopPropagation()})}function c(y,C){var E=t.getLayer("overlays"),b=(0,G.query)('.djs-bendpoints[data-element-id="'+pi(y.id)+'"]',E);return!b&&C&&(b=(0,P.create)("g"),(0,P.attr)(b,{"data-element-id":y.id}),(0,P.classes)(b).add("djs-bendpoints"),(0,P.append)(E,b),d(b,"mousedown",y),d(b,"click",y),d(b,"dblclick",y)),b}function f(y,C){return(0,G.query)('.djs-segment-dragger[data-segment-idx="'+y+'"]',C)}function p(y,C){C.waypoints.forEach(function(E,b){var k=ui(y);(0,P.append)(y,k),Jt(k,E.x,E.y)}),ui(y,"floating")}function u(y,C){for(var E=C.waypoints,b,k,S,_=1;_<E.length;_++)b=E[_-1],k=E[_],hn(b,k)&&(S=Vd(y,b,k),(0,P.attr)(S,{"data-segment-idx":_}),d(S,"mousemove",C))}function h(y){(0,R.forEach)((0,G.queryAll)("."+Rd,y),function(C){(0,P.remove)(C)})}function g(y){(0,R.forEach)((0,G.queryAll)("."+Td,y),function(C){(0,P.remove)(C)})}function m(y){var C=c(y);return C||(C=c(y,!0),p(C,y),u(C,y)),C}function v(y){var C=c(y);C&&(g(C),h(C),u(C,y),p(C,y))}function x(y,C){var E=(0,G.query)(".floating",y),b=C.point;E&&Jt(E,b.x,b.y)}function w(y,C,E){var b=f(C.index,y),k=E[C.index-1],S=E[C.index],_=C.point,T=jr(k,S),V=hn(k,S),j,z;b&&(j=fw(b),z={x:_.x-T.x,y:_.y-T.y},V==="v"&&(z={x:z.y,y:z.x}),Jt(j,z.x,z.y))}e.on("connection.changed",function(y){v(y.element)}),e.on("connection.remove",function(y){var C=c(y.element);C&&(0,P.remove)(C)}),e.on("element.marker.update",function(y){var C=y.element,E;C.waypoints&&(E=m(C),y.add?(0,P.classes)(E).add(y.marker):(0,P.classes)(E).remove(y.marker))}),e.on("element.mousemove",function(y){var C=y.element,E=C.waypoints,b,k;if(E){if(b=c(C,!0),k=di(t,E,y.originalEvent),!k)return;x(b,k),k.bendpoint||w(b,k,E)}}),e.on("element.mousedown",function(y){if(fn(y)){var C=y.originalEvent,E=y.element;if(E.waypoints)return s(C,E)}}),e.on("selection.changed",function(y){var C=y.newSelection[0];C&&C.waypoints&&m(C)}),e.on("element.hover",function(y){var C=y.element;C.waypoints&&(m(C),o.registerEvent(y.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(y){o.unregisterEvent(y.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(y){var C=y.element,E=y.newId;if(C.waypoints){var b=c(C);b&&(0,P.attr)(b,{"data-element-id":E})}}),this.addHandles=m,this.updateHandles=v,this.getBendpointsContainer=c,this.getSegmentDragger=f}Md.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function fw(e){return(0,G.query)(".djs-visual",e)}var Ad=Math.round,Wn="reconnectStart",Un="reconnectEnd",Fo="updateWaypoints";function hi(e,t,o,a,r,i){this._injector=e,this.start=function(l,s,d,c){var f=o.getGraphics(s),p=s.source,u=s.target,h=s.waypoints,g;!c&&d===0?g=Wn:!c&&d===h.length-1?g=Un:g=Fo;var m=g===Fo?"connection.updateWaypoints":"connection.reconnect",v=r.allowed(m,{connection:s,source:p,target:u});v===!1&&(v=r.allowed(m,{connection:s,source:u,target:p})),v!==!1&&a.init(l,"bendpoint.move",{data:{connection:s,connectionGfx:f,context:{allowed:v,bendpointIndex:d,connection:s,source:p,target:u,insert:c,type:g}}})},t.on("bendpoint.move.hover",function(l){var s=l.context,d=s.connection,c=d.source,f=d.target,p=l.hover,u=s.type;s.hover=p;var h;if(p){var g=u===Fo?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=r.allowed(g,{connection:d,source:u===Wn?p:c,target:u===Un?p:f}),h){s.source=u===Wn?p:c,s.target=u===Un?p:f;return}h===!1&&(h=s.allowed=r.allowed(g,{connection:d,source:u===Un?p:f,target:u===Wn?p:c})),h&&(s.source=u===Un?p:f,s.target=u===Wn?p:c)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,d=s.type;s.hover=null,s.source=null,s.target=null,d!==Fo&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.context,d=s.allowed,c=s.bendpointIndex,f=s.connection,p=s.insert,u=f.waypoints.slice(),h=s.source,g=s.target,m=s.type,v=s.hints||{},x={x:Ad(l.x),y:Ad(l.y)};if(!d)return!1;m===Fo?(p?u.splice(c,0,x):u[c]=x,v.bendpointMove={insert:p,bendpointIndex:c},u=this.cropWaypoints(f,u),i.updateWaypoints(f,yv(u),v)):(m===Wn?(v.docking="source",Oa(s)&&(v.docking="target",v.newWaypoints=u.reverse())):m===Un&&(v.docking="target",Oa(s)&&(v.docking="source",v.newWaypoints=u.reverse())),i.reconnect(f,h,g,x,v))},this)}hi.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],hi.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Oa(e){var t=e.hover,o=e.source,a=e.target,r=e.type;if(r===Wn)return t&&a&&t===a&&o!==a;if(r===Un)return t&&o&&t===o&&o!==a}var pw="reconnectStart",hw="reconnectEnd",Nd="updateWaypoints",$o="connect-ok",La="connect-not-ok",jd="connect-hover",Pd="djs-updating",Hd="djs-dragging",zd=1100;function Od(e,t,o,a){this._injector=t;var r=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(i){var l=i.context,s=l.bendpointIndex,d=l.connection,c=l.insert,f=d.waypoints,p=f.slice();l.waypoints=f,c&&p.splice(s,0,{x:i.x,y:i.y}),d.waypoints=p,(0,P.classes)(l.draggerGfx=ui(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(d,Hd),a.addMarker(d,Pd)}),o.on("bendpoint.move.hover",function(i){var l=i.context,s=l.allowed,d=l.hover,c=l.type;if(d){if(a.addMarker(d,jd),c===Nd)return;s?(a.removeMarker(d,La),a.addMarker(d,$o)):s===!1&&(a.removeMarker(d,$o),a.addMarker(d,La))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],zd,function(i){var l=i.context,s=l.hover,d=l.target;s&&(a.removeMarker(s,jd),a.removeMarker(s,d?$o:La))}),o.on("bendpoint.move.move",function(i){var l=i.context,s=l.allowed,d=l.bendpointIndex,c=l.draggerGfx,f=l.hover,p=l.type,u=l.connection,h=u.source,g=u.target,m=u.waypoints.slice(),v={x:i.x,y:i.y},x=l.hints||{},w={};r&&(x.connectionStart&&(w.connectionStart=x.connectionStart),x.connectionEnd&&(w.connectionEnd=x.connectionEnd),p===pw?Oa(l)?(w.connectionEnd=w.connectionEnd||v,w.source=g,w.target=f||h,m=m.reverse()):(w.connectionStart=w.connectionStart||v,w.source=f||h,w.target=g):p===hw?Oa(l)?(w.connectionStart=w.connectionStart||v,w.source=f||g,w.target=h,m=m.reverse()):(w.connectionEnd=w.connectionEnd||v,w.source=h,w.target=f||g):(w.noCropping=!0,w.noLayout=!0,m[d]=v),p===Nd&&(m=e.cropWaypoints(u,m)),w.waypoints=m,r.drawPreview(l,s,w)),Jt(c,i.x,i.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],zd,function(i){var l=i.context,s=l.connection,d=l.draggerGfx,c=l.hover,f=l.target;s.waypoints=l.waypoints,(0,P.remove)(d),a.removeMarker(s,Pd),a.removeMarker(s,Hd),c&&(a.removeMarker(c,$o),a.removeMarker(c,f?$o:La)),r&&r.cleanUp(l)})}Od.$inject=["bendpointMove","injector","eventBus","canvas"];var Ld="connect-hover",Id="djs-updating";function Dd(e,t,o){return gi(e,t,e[t]+o)}function gi(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function gw(e,t,o,a){var r=Math.max(t[a],o[a]),i=Math.min(t[a],o[a]),l=20;return gi(t,a,Math.min(Math.max(i+l,e[a]),r-l))}function Fd(e){return e==="x"?"y":"x"}function $d(e,t,o){var a,r;return e.original?e.original:(a=tt(t),r=Fd(o),gi(e,r,a[r]))}function Wd(e,t,o,a,r,i){var l=e.get("connectionDocking",!1);this.start=function(p,u,h){var g,m=o.getGraphics(u),v=h-1,x=h,w=u.waypoints,y=w[v],C=w[x],E=di(o,w,p),b=hn(y,C),k,S;b&&(k=b==="v"?"x":"y",v===0&&(y=$d(y,u.source,k)),x===w.length-1&&(C=$d(C,u.target,k)),E?S=E.point:S={x:(y.x+C.x)/2,y:(y.y+C.y)/2},g={connection:u,segmentStartIndex:v,segmentEndIndex:x,segmentStart:y,segmentEnd:C,axis:k,dragPosition:S},a.init(p,S,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:u,connectionGfx:m,context:g}}))};function s(p,u){if(!l)return u;var h=p.waypoints,g;return p.waypoints=u,g=l.getCroppedWaypoints(p),p.waypoints=h,g}function d(p){r.update("connection",p.connection,p.connectionGfx)}function c(p,u,h){var g=p.newWaypoints,m=g[p.segmentStartIndex+u],v=g[p.segmentEndIndex+u],x=gw(h,m,v,Fd(p.axis));Jt(p.draggerGfx,x.x,x.y)}function f(p,u){var h=0;return{waypoints:p.filter(function(g,m){return Nr(p[m-1],p[m+1],g)?(h=m<=u?h-1:h,!1):!0}),segmentOffset:h}}t.on("connectionSegment.move.start",function(p){var u=p.context,h=p.connection,g=o.getLayer("overlays");u.originalWaypoints=h.waypoints.slice(),u.draggerGfx=Vd(g,u.segmentStart,u.segmentEnd),(0,P.classes)(u.draggerGfx).add("djs-dragging"),o.addMarker(h,Id)}),t.on("connectionSegment.move.move",function(p){var u=p.context,h=u.connection,g=u.segmentStartIndex,m=u.segmentEndIndex,v=u.segmentStart,x=u.segmentEnd,w=u.axis,y=u.originalWaypoints.slice(),C=Dd(v,w,p["d"+w]),E=Dd(x,w,p["d"+w]),b=y.length,k=0;y[g]=C,y[m]=E;var S,_;g<2&&(S=vn(h.source,C),g===1?S==="intersect"&&(y.shift(),y[0]=C,k--):S!=="intersect"&&(y.unshift(v),k++)),m>b-3&&(_=vn(h.target,E),m===b-2?_==="intersect"&&(y.pop(),y[y.length-1]=E):_!=="intersect"&&y.push(x)),u.newWaypoints=h.waypoints=s(h,y),c(u,k,p),u.newSegmentStartIndex=g+k,d(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,o.addMarker(p.hover,Ld)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var u=p.context.hover;u&&o.removeMarker(u,Ld)}),t.on("connectionSegment.move.cleanup",function(p){var u=p.context,h=u.connection;u.draggerGfx&&(0,P.remove)(u.draggerGfx),o.removeMarker(h,Id)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var u=p.context,h=u.connection;h.waypoints=u.originalWaypoints,d(p)}),t.on("connectionSegment.move.end",function(p){var u=p.context,h=u.connection,g=u.newWaypoints,m=u.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var v=f(g,m),x=v.waypoints,w=s(h,x),y=v.segmentOffset,C={segmentMove:{segmentStartIndex:u.segmentStartIndex,newSegmentStartIndex:m+y}};i.updateWaypoints(h,w,C)})}Wd.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var mw=Math.abs,Ud=Math.round;function yw(e,t,o){o=o===void 0?10:o;var a,r;for(a=0;a<t.length;a++)if(r=t[a],mw(r-e)<=o)return r}function vw(e){return{x:e.x,y:e.y}}function bw(e){return{x:e.x+e.width,y:e.y+e.height}}function mo(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Ud(e.x+e.width/2),y:Ud(e.y+e.height/2)}}function Ia(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function sn(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,r=e[t],i=e.snapped=e.snapped||{};return o===!1?i[t]=!1:(i[t]=!0,a=o-r,e[t]+=a,e["d"+t]+=a),r}function Jd(e){return e.children||[]}var ww=Math.abs,Yd=Math.round,mi=10;function Gd(e){function t(i,l){if((0,R.isArray)(i)){for(var s=i.length;s--;)if(ww(i[s]-l)<=mi)return i[s]}else{i=+i;var d=l%i;if(d<mi)return l-d;if(d>i-mi)return l-d+i}return l}function o(i,l){if(i.waypoints)return cw(l,i);if(i.width)return{x:Yd(i.width/2+i.x),y:Yd(i.height/2+i.y)}}function a(i){var l=i.context,s=l.snapPoints,d=l.connection,c=d.waypoints,f=l.segmentStart,p=l.segmentStartIndex,u=l.segmentEnd,h=l.segmentEndIndex,g=l.axis;if(s)return s;var m=[c[p-1],f,u,c[h+1]];return p<2&&m.unshift(o(d.source,i)),h>c.length-3&&m.unshift(o(d.target,i)),l.snapPoints=s={horizontal:[],vertical:[]},(0,R.forEach)(m,function(v){v&&(v=v.original||v,g==="y"&&s.horizontal.push(v.y),g==="x"&&s.vertical.push(v.x))}),s}e.on("connectionSegment.move.move",1500,function(i){var l=a(i),s=i.x,d=i.y,c,f;if(l){c=t(l.vertical,s),f=t(l.horizontal,d);var p=s-c,u=d-f;(0,R.assign)(i,{dx:i.dx-p,dy:i.dy-u,x:c,y:f}),(p||l.vertical.indexOf(s)!==-1)&&sn(i,"x",c),(u||l.horizontal.indexOf(d)!==-1)&&sn(i,"y",f)}});function r(i){var l=i.snapPoints,s=i.connection.waypoints,d=i.bendpointIndex;if(l)return l;var c=[s[d-1],s[d+1]];return i.snapPoints=l={horizontal:[],vertical:[]},(0,R.forEach)(c,function(f){f&&(f=f.original||f,l.horizontal.push(f.y),l.vertical.push(f.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(i){var l=i.context.hover,s=l&&o(l,i);!St(l)||!s||!s.x||!s.y||(sn(i,"x",s.x),sn(i,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(i){var l=i.context,s=r(l),d=l.hover,c=d&&o(d,i),f=i.x,p=i.y,u,h;if(s){u=t(c?s.vertical.concat([c.x]):s.vertical,f),h=t(c?s.horizontal.concat([c.y]):s.horizontal,p);var g=f-u,m=p-h;(0,R.assign)(i,{dx:i.dx-g,dy:i.dy-m,x:i.x-g,y:i.y-m}),(g||s.vertical.indexOf(f)!==-1)&&sn(i,"x",u),(m||s.horizontal.indexOf(p)!==-1)&&sn(i,"y",h)}})}Gd.$inject=["eventBus"];var Cw={__depends__:[zn,uo],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Md],bendpointMove:["type",hi],bendpointMovePreview:["type",Od],connectionSegmentMove:["type",Wd],bendpointSnapping:["type",Gd]},xw="djs-dragger";function cn(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}cn.$inject=["injector","canvas","graphicsFactory","elementFactory"],cn.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,r=e.getConnection,i=o.source,l=o.target,s=o.waypoints,d=o.connectionStart,c=o.connectionEnd,f=o.noLayout,p=o.noCropping,u=o.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,P.clear)(a),r||(r=e.getConnection=kw(function(m,v,x){return g.getConnection(m,v,x)})),t&&(h=r(t,i,l)),!h){!u&&this.drawNoopPreview(a,o);return}h.waypoints=s||[],this._layouter&&!f&&(h.waypoints=this._layouter.layoutConnection(h,{source:i,target:l,connectionStart:d,connectionEnd:c,waypoints:o.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[i?tt(i):d,l?tt(l):c]),this._connectionDocking&&(i||l)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,i,l)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},cn.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,r=t.connectionStart||tt(o),i=t.connectionEnd||tt(a),l=this.cropWaypoints(r,i,o,a);(0,P.append)(e,this.createNoopConnection(l[0],l[1]))},cn.prototype.cropWaypoints=function(e,t,o,a){var r=this._graphicsFactory,i=o&&r.getShapePath(o),l=a&&r.getShapePath(a),s=r.getConnectionPath({waypoints:[e,t]});return e=o&&zr(i,s,!0)||e,t=a&&zr(l,s,!1)||t,[e,t]},cn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,P.remove)(e.connectionPreviewGfx)},cn.prototype.getConnection=function(e){var t=Sw(e);return this._elementFactory.createConnection(t)},cn.prototype.createConnectionPreviewGfx=function(){var e=(0,P.create)("g");return(0,P.attr)(e,{pointerEvents:"none"}),(0,P.classes)(e).add(xw),(0,P.append)(this._canvas.getActiveLayer(),e),e},cn.prototype.createNoopConnection=function(e,t){return _r([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function kw(e){var t={};return function(o){var a=JSON.stringify(o),r=t[a];return r||(r=t[a]=e.apply(null,arguments)),r}}function Sw(e){return(0,R.isObject)(e)?e:{}}var Ew={__init__:["connectionPreview"],connectionPreview:["type",cn]},_w=new ma("ov"),Bw=500;function gt(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=_w,this._overlayDefaults=(0,R.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Rw(o.getContainer()),this._init()}gt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],gt.prototype.get=function(e){if((0,R.isString)(e)&&(e={id:e}),(0,R.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,R.filter)(t.overlays,(0,R.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,R.filter)(this._overlays,(0,R.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},gt.prototype.add=function(e,t,o){if((0,R.isObject)(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=(0,R.assign)({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},gt.prototype.remove=function(e){var t=this.get(e)||[];(0,R.isArray)(t)||(t=[t]);var o=this;(0,R.forEach)(t,function(a){var r=o._getOverlayContainer(a.element,!0);if(a&&((0,G.remove)(a.html),(0,G.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),r){var i=r.overlays.indexOf(a);i!==-1&&r.overlays.splice(i,1)}})},gt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},gt.prototype.show=function(){Da(this._overlayRoot)},gt.prototype.hide=function(){Da(this._overlayRoot,!1)},gt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,G.clear)(this._overlayRoot)},gt.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,r=t.y;if(t.waypoints){var i=Ut(t);a=i.x,r=i.y}Kd(o,a,r),(0,G.attr)(e.html,"data-container-id",t.id)},gt.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,r=t.left,i=t.top;if(t.right!==void 0){var l;a.waypoints?l=Ut(a).width:l=a.width,r=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=Ut(a).height:s=a.height,i=t.bottom*-1+s}Kd(o,r||0,i||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},gt.prototype._createOverlayContainer=function(e){var t=(0,G.domify)('<div class="djs-overlays" />');(0,G.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},gt.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";qd(this._overlayRoot,o)},gt.prototype._getOverlayContainer=function(e,t){var o=(0,R.find)(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},gt.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,r,i;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,R.isString)(a)&&(a=(0,G.domify)(a)),i=this._getOverlayContainer(o),r=(0,G.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,G.assignStyle)(r,{position:"absolute"}),r.appendChild(a),e.type&&(0,G.classes)(r).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(o),s=this._canvas.getRootElement();Da(r,l===s),e.htmlContainer=r,i.overlays.push(e),i.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},gt.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),r=o&&o.minZoom,i=o&&o.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),d=!0;(a!==s||o&&((0,R.isDefined)(r)&&r>t.scale||(0,R.isDefined)(i)&&i<t.scale))&&(d=!1),Da(l,d),this._updateOverlayScale(e,t)},gt.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,r,i=e.htmlContainer,l,s="";o!==!0&&(o===!1?(a=1,r=1):(a=o.min,r=o.max),(0,R.isDefined)(a)&&t.scale<a&&(l=(1/t.scale||1)*a),(0,R.isDefined)(r)&&t.scale>r&&(l=(1/t.scale||1)*r)),(0,R.isDefined)(l)&&(s="scale("+l+","+l+")"),qd(i,s)},gt.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,R.forEach)(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},gt.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var r=a.element;(0,R.forEach)(t.get({element:r}),function(s){t.remove(s.id)});var i=t._getOverlayContainer(r);if(i){(0,G.remove)(i.html);var l=t._overlayContainers.indexOf(i);l!==-1&&t._overlayContainers.splice(l,1)}}),e.on("element.changed",Bw,function(a){var r=a.element,i=t._getOverlayContainer(r,!0);i&&((0,R.forEach)(i.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(a){var r=t._getOverlayContainer(a.element,!0);r&&(0,G.classes)(r.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function Rw(e){var t=(0,G.domify)('<div class="djs-overlay-container" />');return(0,G.assignStyle)(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Kd(e,t,o){(0,G.assignStyle)(e,{left:t+"px",top:o+"px"})}function Da(e,t){e.style.display=t===!1?"none":""}function qd(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}var Tw={__init__:["overlays"],overlays:["type",gt]},Vw=new ma;function yo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}yo.$inject=["eventBus"],yo.prototype.schedule=function(e,t=Vw.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},yo.prototype._schedule=function(e,t){const o=Mw();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(a){o.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:o.promise}},yo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},yo.prototype._cancel=function(e){clearTimeout(e.executionId)};function Mw(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}var Aw={scheduler:["type",yo]},Nw="djs-element-hidden",Fa=".entry",jw=1e3,Xd=8,Pw=300;function rt(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}rt.$inject=["canvas","elementRegistry","eventBus","scheduler"],rt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var r=a.target,i=(0,R.isArray)(r)?r:[r];if(i.filter(function(s){return o.includes(s)}).length){e.close();var l=i.filter(function(s){return e._elementRegistry.get(s.id)});l.length&&e._updateAndOpen(l.length>1?l:l[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current;((0,R.isArray)(a.target)?a.target:[a.target]).includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},rt.prototype._createContainer=function(){var e=(0,G.domify)('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},rt.prototype.registerProvider=function(e,t){t||(t=e,e=jw),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},rt.prototype.getEntries=function(e){var t=this._getProviders(),o=(0,R.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,R.forEach)(t,function(r){if((0,R.isFunction)(r[o])){var i=r[o](e);(0,R.isFunction)(i)?a=i(a):(0,R.forEach)(i,function(l,s){a[s]=l})}}),a},rt.prototype.trigger=function(e,t,o){var a=this,r,i,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(r=(0,G.attr)(l,"data-action"),i=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(r,"hover",i,o)},Pw);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,i,o)},rt.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var r=this._current.target,i=this._current.entries[e];if(i){var l=i.action;if(this._eventBus.fire("contextPad.trigger",{entry:i,event:o})!==!1){if((0,R.isFunction)(l)){if(t==="click")return l(o,r,a)}else if(l[t])return l[t](o,r,a);o.preventDefault()}}}},rt.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},rt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},rt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;(0,R.forEach)(t,function(r,i){var l=r.group||"default",s=(0,G.domify)(r.html||'<div class="entry" draggable="true"></div>'),d;(0,G.attr)(s,"data-action",i),d=(0,G.query)("[data-group="+pi(l)+"]",o),d||(d=(0,G.domify)('<div class="group"></div>'),(0,G.attr)(d,"data-group",l),o.appendChild(d)),d.appendChild(s),r.className&&Hw(s,r.className),r.title&&(0,G.attr)(s,"title",r.title),r.imageUrl&&(a=(0,G.domify)("<img>"),(0,G.attr)(a,"src",r.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,G.classes)(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},rt.prototype._createHtml=function(e){var t=this,o=(0,G.domify)('<div class="djs-context-pad"></div>');return G.delegate.bind(o,Fa,"click",function(a){t.trigger("click",a)}),G.delegate.bind(o,Fa,"dragstart",function(a){t.trigger("dragstart",a)}),G.delegate.bind(o,Fa,"mouseover",function(a){t.trigger("mouseover",a)}),G.delegate.bind(o,Fa,"mouseout",function(a){t.trigger("mouseout",a)}),G.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},rt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&Ow(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},rt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},rt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return(0,R.isArray)(e)!==(0,R.isArray)(o)?!1:(0,R.isArray)(e)?e.length===o.length&&(0,R.every)(e,function(a){return o.includes(a)}):o===e},rt.prototype.isShown=function(){return this.isOpen()&&(0,G.classes)(this._current.html).has("open")},rt.prototype.show=function(){this.isOpen()&&((0,G.classes)(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},rt.prototype.hide=function(){this.isOpen()&&((0,G.classes)(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},rt.prototype._getPosition=function(e){if(!(0,R.isArray)(e)&&St(e)){var t=this._canvas.viewbox(),o=zw(e),a=o.x*t.scale-t.x*t.scale,r=o.y*t.scale-t.y*t.scale;return{left:a+Xd*this._canvas.zoom(),top:r}}var i=this._canvas.getContainer().getBoundingClientRect(),l=this._getTargetBounds(e);return{left:l.right-i.left+Xd*this._canvas.zoom(),top:l.top-i.top}},rt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},rt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target;((0,R.isArray)(o)?o:[o]).some(function(a){return t._canvas.hasMarker(a,Nw)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},rt.prototype._getTargetBounds=function(e){var t=this;return((0,R.isArray)(e)?e:[e]).map(function(o){return t._canvas.getGraphics(o)}).reduce(function(o,a){const r=a.getBoundingClientRect();return o.top=Math.min(o.top,r.top),o.right=Math.max(o.right,r.right),o.bottom=Math.max(o.bottom,r.bottom),o.left=Math.min(o.left,r.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Hw(e,t){var o=(0,G.classes)(e);t=(0,R.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function zw(e){return e.waypoints[e.waypoints.length-1]}function Ow(e,t){return e=(0,R.isArray)(e)?e:[e],t=(0,R.isArray)(t)?t:[t],e.length===t.length&&(0,R.every)(e,function(o){return t.includes(o)})}var Lw={__depends__:[Br,Aw,Tw],contextPad:["type",rt]},Iw=250;function Jn(e){this._eventBus=e,this._tools=[],this._active=null}Jn.$inject=["eventBus"],Jn.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},Jn.prototype.isActive=function(e){return e&&this._active===e},Jn.prototype.length=function(e){return this._tools.length},Jn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Jn.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(r){if(!r.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,R.forEach)(t,function(r){a.push(r+".ended"),a.push(r+".canceled")}),o.on(a,Iw,function(r){this._active&&(Dw(r)||this.setActive(null))},this)};function Dw(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,G.closest)(t,'.group[data-group="tools"]')}var yi={__depends__:[zn],__init__:["toolManager"],toolManager:["type",Jn]};function vi(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}vi.$inject=["eventBus"],vi.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Fw(0,0)};function Fw(e,t){var o=document.createEvent("MouseEvent"),a=e,r=t,i=e,l=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,r,i,l,!1,!1,!1,!1,0,null),o}var bi={__init__:["mouse"],mouse:["type",vi]},wi=1500,Zd="grab";function vo(e,t,o,a,r,i){this._dragging=o,this._mouse=i;var l=this,s=a.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",wi,function(d){if(js(d))return l.activateMove(d.originalEvent,!0),!1}),s&&s.addListener(wi,function(d){if(!(!Qd(d.keyEvent)||l.isActive())){var c=l._mouse.getLastMoveEvent();l.activateMove(c,!!c)}},"keyboard.keydown"),s&&s.addListener(wi,function(d){!Qd(d.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(d){var c=d.originalEvent.target;if(!d.hover&&!(c instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(d.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(d){var c=t.viewbox().scale;t.scroll({dx:d.dx*c,dy:d.dy*c})}),e.on("hand.move.end",function(d){var c=d.context.reactivate;return!js(d)&&c&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}vo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],vo.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Zd,data:{context:o||{}}})},vo.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Zd,data:{context:{reactivate:o}}})},vo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},vo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Qd(e){return Js("Space",e)}var $w={__depends__:[yi,bi],__init__:["handTool"],handTool:["type",vo]},eu="crosshair",tu="selected",Ww="djs-dragging-active-lasso";function Bn(e,t,o,a,r,i,l){this._selection=r,this._dragging=o,this._mouse=l;var s=this,d={create:function(p){var u=t.getActiveLayer(),h=p.frame=(0,P.create)("rect");(0,P.attr)(h,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,P.append)(u,h),c(!0),this.update(p)},update:function(p){var u=p.frame,h=p.bbox;u&&h&&(0,P.attr)(u,{x:h.x,y:h.y,width:h.width,height:h.height});var g=p.marked,m=p.lastMarked;if(g&&m){for(const v of m)g.has(v)||t.removeMarker(v,tu);for(const v of g)m.has(v)||t.addMarker(v,tu)}},remove:function(p){this.update(p),p.frame&&(0,P.remove)(p.frame),c(!1)}};function c(p){(0,P.classes)(t.getContainer()).toggle(Ww,p)}function f(p){var u=a.getAll();return new Set((0,R.values)(Xs(u,p)))}i.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var u=p.originalEvent.target;!p.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var u=p.context;s._select(Array.from(u.marked))}),e.on("lasso.start",function(p){var u=p.context;u.bbox=nu(p),u.add=kr(p),u.lastMarked=new Set(r.get()),u.add?u.marked=u.lastMarked:u.marked=new Set,u.initialMarked=u.marked,d.create(u)}),e.on("lasso.move",function(p){var u=p.context,h=f(u.bbox=nu(p)),g=u.initialMarked.union(h);u.lastMarked=u.marked,u.marked=g,d.update(u)}),e.on("lasso.cleanup",function(p){var u=p.context;u.lastMarked=u.marked,u.marked=new Set(r.get()),d.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(kr(p))return s.activateLasso(p.originalEvent),!0})}Bn.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Bn.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:eu,data:{context:{}},keepSelection:!0})},Bn.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:eu,data:{context:{}},keepSelection:!0})},Bn.prototype._select=function(e){this._selection.select(e)},Bn.prototype.select=function(e,t,o=[]){var a=(0,R.values)(Xs(e,t));this._select([...o,...a])},Bn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Bn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function nu(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}var Uw={__depends__:[yi,bi],__init__:["lassoTool"],lassoTool:["type",Bn]},ou="connect-ok",au="connect-not-ok";function bo(e,t,o,a,r,i,l){var s=this;this._dragging=t,this._rules=i,this._mouse=l,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(d){var c=d.context,f=d.hover,p=c.canStartConnect=s.canStartConnect(f);p!==null&&(c.startTarget=f,a.addMarker(f,p?ou:au))}),e.on(["global-connect.out","global-connect.cleanup"],function(d){var c=d.context.startTarget,f=d.context.canStartConnect;c&&a.removeMarker(c,f?ou:au)}),e.on(["global-connect.ended"],function(d){var c=d.context.startTarget,f={x:d.x,y:d.y};if(s.canStartConnect(c))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,c,f)}),!1})}bo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],bo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},bo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},bo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Jw={__depends__:[Lr,uo,zn,yi,bi],globalConnect:["type",bo]},Yw=500,Gw=1e3;function Yn(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function r(i){var l=(0,P.create)("rect");return(0,P.attr)(l,(0,R.assign)({x:0,y:0,rx:4,width:100,height:100},o)),l}e.on(["shape.added","shape.changed"],Yw,function(i){var l=i.element,s=i.gfx,d=(0,G.query)(".djs-outline",s);d||(d=a.getOutline(l)||r(s),(0,P.append)(s,d)),a.updateShapeOutline(d,l)}),e.on(["connection.added","connection.changed"],function(i){var l=i.element,s=i.gfx,d=(0,G.query)(".djs-outline",s);d||(d=r(s),(0,P.append)(s,d)),a.updateConnectionOutline(d,l)})}Yn.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&(0,R.forEach)(a,function(r){o=o||r.updateOutline(t,e)}),o||(0,P.attr)(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},Yn.prototype.updateConnectionOutline=function(e,t){var o=Ut(t);(0,P.attr)(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},Yn.prototype.registerProvider=function(e,t){t||(t=e,e=Gw),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},Yn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Yn.prototype.getOutline=function(e){var t;return(0,R.forEach)(this._getProviders(),function(o){(0,R.isFunction)(o.getOutline)&&(t=t||o.getOutline(e))}),t},Yn.$inject=["eventBus","styles","elementRegistry"];var $a=6;function Ci(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(r){o.isSelected(r.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(r){var i=r.newSelection;a._updateMultiSelectionOutline(i)})}Ci.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,P.clear)(t);var o=e.length>1;if((0,P.classes)(this._canvas.getContainer())[o?"add":"remove"]("djs-multi-select"),!!o){var a=Kw(Ut(e)),r=(0,P.create)("rect");(0,P.attr)(r,(0,R.assign)({rx:3},a)),(0,P.classes)(r).add("djs-selection-outline"),(0,P.append)(t,r)}},Ci.$inject=["eventBus","canvas","selection"];function Kw(e){return{x:e.x-$a,y:e.y-$a,width:e.width+$a*2,height:e.height+$a*2}}var ru={__depends__:[lo],__init__:["outline","multiSelectionOutline"],outline:["type",Yn],multiSelectionOutline:["type",Ci]},qw=500,Xw=1250,Zw=1500,Wa=Math.round;function Qw(e){return{x:e.x+Wa(e.width/2),y:e.y+Wa(e.height/2)}}function iu(e,t,o,a,r){function i(s,d,c,f){return r.allowed("elements.move",{shapes:s,delta:d,position:c,target:f})}e.on("shape.move.start",Zw,function(s){var d=s.context,c=s.shape,f=a.get().slice();f.indexOf(c)===-1&&(f=[c]),f=eC(f),(0,R.assign)(d,{shapes:f,validatedShapes:f,shape:c})}),e.on("shape.move.start",Xw,function(s){var d=s.context,c=d.validatedShapes;if(!(d.canExecute=i(c)))return!1}),e.on("shape.move.move",qw,function(s){var d=s.context,c=d.validatedShapes,f=s.hover,p={x:s.dx,y:s.dy},u=i(c,p,{x:s.x,y:s.y},f);if(d.delta=p,d.canExecute=u,u===null){d.target=null;return}d.target=f}),e.on("shape.move.end",function(s){var d=s.context,c=d.delta,f=d.canExecute,p=f==="attach",u=d.shapes;if(f===!1)return!1;c.x=Wa(c.x),c.y=Wa(c.y),!(c.x===0&&c.y===0)&&o.moveElements(u,c,d.target,{primaryShape:d.shape,attach:p})}),e.on("element.mousedown",function(s){if(fn(s)){var d=ao(s);if(!d)throw new Error("must supply DOM mousedown event");return l(d,s.element)}});function l(s,d,c,f){if((0,R.isObject)(c)&&(f=c,c=!1),!(d.waypoints||!d.parent)&&!(0,P.classes)(s.target).has("djs-hit-no-move")){var p=Qw(d);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:c,data:{shape:d,context:f||{}}}),!0}}this.start=l}iu.$inject=["eventBus","dragging","modeling","selection","rules"];function eC(e){var t=(0,R.groupBy)(e,"id");return(0,R.filter)(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var lu=499,xi="djs-dragging",su="drop-ok",cu="drop-not-ok",du="new-parent",uu="attach-ok";function fu(e,t,o,a){function r(d){return tC(i(d))}function i(d){var c=Iy(d,!0),f=c.flatMap(u=>(u.incoming||[]).concat(u.outgoing||[])),p=c.concat(f);return[...new Set(p)]}function l(d,c){[uu,su,cu,du].forEach(function(f){f===c?t.addMarker(d,f):t.removeMarker(d,f)})}function s(d,c,f){a.addDragger(c,d.dragGroup),f&&t.addMarker(c,xi),d.allDraggedElements?d.allDraggedElements.push(c):d.allDraggedElements=[c]}e.on("shape.move.start",lu,function(d){var c=d.context,f=c.shapes,p=c.allDraggedElements,u=r(f);if(!c.dragGroup){var h=(0,P.create)("g");(0,P.attr)(h,o.cls("djs-drag-group",["no-events"])),(0,P.append)(t.getActiveLayer(),h),c.dragGroup=h}u.forEach(function(g){a.addDragger(g,c.dragGroup)}),p?p=(0,R.flatten)([p,i(f)]):p=i(f),(0,R.forEach)(p,function(g){t.addMarker(g,xi)}),c.allDraggedElements=p,c.differentParents=nC(f)}),e.on("shape.move.move",lu,function(d){var c=d.context,f=c.dragGroup,p=c.target,u=c.shape.parent,h=c.canExecute;p&&(h==="attach"?l(p,uu):c.canExecute&&u&&p.id!==u.id?l(p,du):l(p,c.canExecute?su:cu)),Jt(f,d.dx,d.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(d){var c=d.context.target;c&&l(c,null)}),e.on("shape.move.cleanup",function(d){var c=d.context,f=c.allDraggedElements,p=c.dragGroup;(0,R.forEach)(f,function(u){t.removeMarker(u,xi)}),p&&(0,P.remove)(p)}),this.makeDraggable=s}fu.$inject=["eventBus","canvas","styles","previewSupport"];function tC(e){return(0,R.filter)(e,function(t){return St(t)?(0,R.find)(e,(0,R.matchPattern)({id:t.source.id}))&&(0,R.find)(e,(0,R.matchPattern)({id:t.target.id})):!0})}function nC(e){return(0,R.size)((0,R.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var oC={__depends__:[Br,lo,ru,uo,zn,Vr],__init__:["move","movePreview"],move:["type",iu],movePreview:["type",fu]},pu=".djs-palette-toggle",hu=".entry",aC=pu+", "+hu,ki="djs-palette-",rC="shown",Si="open",gu="two-column",iC=1e3;function it(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var r=a.tool;o.updateToolHighlight(r)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}it.$inject=["eventBus","canvas"],it.prototype.registerProvider=function(e,t){t||(t=e,e=iC),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},it.prototype.getEntries=function(){return this._getProviders().reduce(sC,{})},it.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},it.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=(0,G.domify)(it.HTML_MARKUP);o.appendChild(a),(0,G.classes)(o).add(ki+rC),G.delegate.bind(a,aC,"click",function(r){var i=r.delegateTarget;if((0,G.matches)(i,pu))return e.toggle();e.trigger("click",r)}),G.event.bind(a,"mousedown",function(r){r.stopPropagation()}),G.delegate.bind(a,hu,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},it.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},it.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,r,i=(0,G.classes)(o),l=(0,G.classes)(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),i.toggle(gu,r),l.toggle(ki+gu,r),"open"in e&&(i.toggle(Si,e.open),l.toggle(ki+Si,e.open)),a.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},it.prototype._update=function(){var e=(0,G.query)(".djs-palette-entries",this._container),t=this._entries=this.getEntries();(0,G.clear)(e),(0,R.forEach)(t,function(o,a){var r=o.group||"default",i=(0,G.query)("[data-group="+pi(r)+"]",e);i||(i=(0,G.domify)('<div class="group"></div>'),(0,G.attr)(i,"data-group",r),e.appendChild(i));var l=(0,G.domify)(o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(i.appendChild(l),!o.separator&&((0,G.attr)(l,"data-action",a),o.title&&(0,G.attr)(l,"title",o.title),o.className&&lC(l,o.className),o.imageUrl)){var s=(0,G.domify)("<img>");(0,G.attr)(s,"src",o.imageUrl),l.appendChild(s)}}),this.open()},it.prototype.trigger=function(e,t,o){var a,r,i=t.delegateTarget||t.target;return i?(a=(0,G.attr)(i,"data-action"),r=t.originalEvent||t,this.triggerEntry(a,e,r,o)):t.preventDefault()},it.prototype.triggerEntry=function(e,t,o,a){var r=this._entries[e],i;if(r&&(i=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if((0,R.isFunction)(i)){if(t==="click")return i(o,a)}else if(i[t])return i[t](o,a);o.preventDefault()}},it.prototype._layoutChanged=function(){this._toggleState({})},it.prototype._needsCollapse=function(e,t){return e<Object.keys(t).length*46+50},it.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},it.prototype.open=function(){this._toggleState({open:!0})},it.prototype.toggle=function(){this.isOpen()?this.close():this.open()},it.prototype.isActiveTool=function(e){return e&&this._activeTool===e},it.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=(0,G.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,G.query)("[data-group=tools]",t)),o=this._toolsContainer,(0,R.forEach)(o.children,function(a){var r=a.getAttribute("data-action");if(r){var i=(0,G.classes)(a);r=r.replace("-tool",""),i.contains("entry")&&r===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}})},it.prototype.isOpen=function(){return(0,G.classes)(this._container).has(Si)},it.prototype._getParentContainer=function(){return this._canvas.getContainer()},it.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function lC(e,t){var o=(0,G.classes)(e);((0,R.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){o.add(a)})}function sC(e,t){var o=t.getPaletteEntries();return(0,R.isFunction)(o)?o(e):((0,R.forEach)(o,function(a,r){e[r]=a}),e)}var cC={__init__:["palette"],palette:["type",it]};function mu(e,t,o,a){e.on("element.changed",function(r){var i=r.element;(i.parent||i===t.getRootElement())&&(r.gfx=o.getGraphics(i)),r.gfx&&e.fire(Fy(i)+".changed",r)}),e.on("elements.changed",function(r){var i=r.elements;i.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(i)}),e.on("shape.changed",function(r){a.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){a.update("connection",r.element,r.gfx)})}mu.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var dC={__init__:["changeSupport"],changeSupport:["type",mu]},Ua=Math.max,Ja=Math.min,uC=20;function fC(e,t,o){var a=o.x,r=o.y,i={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(i.y=e.y+r,i.height=e.height-r):t.indexOf("s")!==-1&&(i.height=e.height+r),t.indexOf("e")!==-1?i.width=e.width+a:t.indexOf("w")!==-1&&(i.x=e.x+a,i.width=e.width-a),i}function Ya(e,t,o){var a=t[e],r=o.min&&o.min[e],i=o.max&&o.max[e];return(0,R.isNumber)(r)&&(a=(/top|left/.test(e)?Ja:Ua)(a,r)),(0,R.isNumber)(i)&&(a=(/top|left/.test(e)?Ua:Ja)(a,i)),a}function pC(e,t){if(!t)return e;var o=Ie(e);return wc({top:Ya("top",o,t),right:Ya("right",o,t),bottom:Ya("bottom",o,t),left:Ya("left",o,t)})}function hC(e,t,o,a){var r=Ie(t),i={top:/n/.test(e)?r.bottom-o.height:r.top,left:/w/.test(e)?r.right-o.width:r.left,bottom:/s/.test(e)?r.top+o.height:r.bottom,right:/e/.test(e)?r.left+o.width:r.right},l=a?Ie(a):i;return wc({top:Ja(i.top,l.top),left:Ja(i.left,l.left),bottom:Ua(i.bottom,l.bottom),right:Ua(i.right,l.right)})}function Wo(e,t){return typeof e<"u"?e:uC}function gC(e,t){var o,a,r,i;return typeof t=="object"?(o=Wo(t.left),a=Wo(t.right),r=Wo(t.top),i=Wo(t.bottom)):o=a=r=i=Wo(t),{x:e.x-o,y:e.y-r,width:e.width+o+a,height:e.height+r+i}}function mC(e){return!(e.waypoints||e.type==="label")}function yC(e,t){var o;if(e.length===void 0?o=(0,R.filter)(e.children,mC):o=e,o.length)return gC(Ut(o),t)}var yu=10;function Uo(e,t,o,a){this._dragging=a,this._rules=t;var r=this;function i(d,c){var f=d.shape,p=d.direction,u=d.resizeConstraints,h;d.delta=c,h=fC(f,p,c),d.newBounds=pC(h,u),d.canExecute=r.canResize(d)}function l(d){var c=d.resizeConstraints,f=d.minBounds;c===void 0&&(f===void 0&&(f=r.computeMinResizeBox(d)),d.resizeConstraints={min:Ie(f)})}function s(d){var c=d.shape,f=d.canExecute,p=d.newBounds;if(f){if(p=pv(p),!vC(c,p))return;o.resizeShape(c,p)}}e.on("resize.start",function(d){l(d.context)}),e.on("resize.move",function(d){var c={x:d.dx,y:d.dy};i(d.context,c)}),e.on("resize.end",function(d){s(d.context)})}Uo.prototype.canResize=function(e){var t=this._rules,o=(0,R.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},Uo.prototype.activate=function(e,t,o){var a=this._dragging,r,i;if(typeof o=="string"&&(o={direction:o}),r=(0,R.assign)({shape:t},o),i=r.direction,!i)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,vu(t,i),"resize",{autoActivate:!0,cursor:bC(i),data:{shape:t,context:r}})},Uo.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction;return hC(o,t,e.minDimensions||{width:yu,height:yu},yC(t,e.childrenBoxPadding))},Uo.$inject=["eventBus","rules","modeling","dragging"];function vC(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function vu(e,t){var o=tt(e),a=Ie(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function bC(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var bu="djs-resizing",wu="resize-not-ok",wC=500;function Cu(e,t,o){function a(i){var l=i.shape,s=i.newBounds,d=i.frame;d||(d=i.frame=o.addFrame(l,t.getActiveLayer()),t.addMarker(l,bu)),s.width>5&&(0,P.attr)(d,{x:s.x,width:s.width}),s.height>5&&(0,P.attr)(d,{y:s.y,height:s.height}),i.canExecute?(0,P.classes)(d).remove(wu):(0,P.classes)(d).add(wu)}function r(i){var l=i.shape;i.frame&&(0,P.remove)(i.frame),t.removeMarker(l,bu)}e.on("resize.move",wC,function(i){a(i.context)}),e.on("resize.cleanup",function(i){r(i.context)})}Cu.$inject=["eventBus","canvas","previewSupport"];var Ga=-6,Ka=8,qa=20,Jo="djs-resizer",CC=["n","w","s","e","nw","ne","se","sw"];function Rn(e,t,o,a){this._resize=a,this._canvas=t;var r=this;e.on("selection.changed",function(i){var l=i.newSelection;r.removeResizers(),l.length===1&&(0,R.forEach)(l,(0,R.bind)(r.addResizer,r))}),e.on("shape.changed",function(i){var l=i.element;o.isSelected(l)&&(r.removeResizers(),r.addResizer(l))})}Rn.prototype.makeDraggable=function(e,t,o){var a=this._resize;function r(i){fn(i)&&a.activate(i,e,o)}G.event.bind(t,"mousedown",r),G.event.bind(t,"touchstart",r)},Rn.prototype._createResizer=function(e,t,o,a){var r=this._getResizersParent(),i=xC(a),l=(0,P.create)("g");(0,P.classes)(l).add(Jo),(0,P.classes)(l).add(Jo+"-"+e.id),(0,P.classes)(l).add(Jo+"-"+a),(0,P.append)(r,l);var s=(0,P.create)("rect");(0,P.attr)(s,{x:-Ka/2+i.x,y:-Ka/2+i.y,width:Ka,height:Ka}),(0,P.classes)(s).add(Jo+"-visual"),(0,P.append)(l,s);var d=(0,P.create)("rect");return(0,P.attr)(d,{x:-qa/2+i.x,y:-qa/2+i.y,width:qa,height:qa}),(0,P.classes)(d).add(Jo+"-hit"),(0,P.append)(l,d),Jy(l,t,o),l},Rn.prototype.createResizer=function(e,t){var o=vu(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},Rn.prototype.addResizer=function(e){var t=this;St(e)||!this._resize.canResize({shape:e})||(0,R.forEach)(CC,function(o){t.createResizer(e,o)})},Rn.prototype.removeResizers=function(){(0,P.clear)(this._getResizersParent())},Rn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Rn.$inject=["eventBus","canvas","selection","resize"];function xC(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ga:e.indexOf("w")!==-1&&(t.x=Ga),e.indexOf("s")!==-1?t.y=-Ga:e.indexOf("n")!==-1&&(t.y=Ga),t}var kC={__depends__:[uo,zn,Vr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Uo],resizePreview:["type",Cu],resizeHandles:["type",Rn]};function Yo(e,t,o,a,r,i){this._canvas=t,this._modeling=a,this._textRenderer=i,o.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{r.removeResizers()}),e.on("create.end",500,s=>{const{context:d,isTouch:c}=s,f=d.shape,{canExecute:p}=s.context;c||p&&(d.hints&&d.hints.createElementsBehavior===!1||l(f))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,d){(d||ei(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}Yo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Yo.prototype.activate=function(e){const t=Ma(e);if(t===void 0)return;const o={text:t};Ke(o,this.getEditingBBox(e));const a={};return(ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Ke(a,{centerVertically:!0}),ti(e)&&Ke(a,{autoResize:!0}),Ke(o,{options:a}),o},Yo.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),r={x:a.x+a.width/2,y:a.y+a.height/2},i={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),d=this._textRenderer.getExternalStyle(),c=d.fontSize*l,f=d.lineHeight,p=s.fontSize*l,u=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Ke(i,{width:a.width,height:a.height}),Ke(h,{fontSize:p+"px",lineHeight:u,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const g=90*l,m=7*l,v=4*l;if(o.labelTarget&&(Ke(i,{width:g,height:a.height+m+v,x:r.x-g/2,y:a.y-m}),Ke(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:v+"px"})),ti(o)&&!nd(o)&&!Io(o)){const x=od(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),y=c+m+v;Ke(i,{width:g,height:y,x:w.x-g/2,y:w.y-y/2}),Ke(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:v+"px"})}return{bounds:i,style:h}},Yo.prototype.update=function(e,t){let o;SC(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function SC(e){return!e||!e.trim()}var EC={__depends__:[dC,kC,dr.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",Yo]};function Tn(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Tn.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Tn.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Tn.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},Tn.prototype.getSnapLocations=function(){return this._snapLocations},Tn.prototype.setSnapLocations=function(e){this._snapLocations=e},Tn.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new Xa,o.initDefaults(this._defaultSnaps)),o};function Xa(){this._snapValues={}}Xa.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},Xa.prototype.snap=function(e,t,o,a){var r=this._snapValues[t];return r&&yw(e[o],r[o],a)},Xa.prototype.initDefaults=function(e){var t=this;(0,R.forEach)(e||{},function(o,a){(0,R.forEach)(o,function(r){t.add(a,r)})})};var _C=1250;function qt(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){a.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],_C,function(r){var i=r.context,l=i.shape,s=i.snapContext,d=i.target;if(!(r.originalEvent&&Us(r.originalEvent))&&!(Ia(r)||!d)){var c=s.pointsForTarget(d);c.initialized||(c=a.addSnapTargetPoints(c,l,d),c.initialized=!0),o.snap(r,c)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}qt.$inject=["elementRegistry","eventBus","snapping"],qt.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,r=o.snapContext;r||(r=o.snapContext=new Tn);var i;t.get(a.id)?i=mo(a,e):i={x:e.x+mo(a).x,y:e.y+mo(a).y};var l={x:i.x-a.width/2,y:i.y-a.height/2},s={x:i.x+a.width/2,y:i.y+a.height/2};return r.setSnapOrigin("mid",{x:i.x-e.x,y:i.y-e.y}),fo(a)||(r.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},qt.prototype.addSnapTargetPoints=function(e,t,o){return(0,R.forEach)(this.getSnapTargets(t,o),function(a){if(fo(a)){fo(t)&&e.add("mid",mo(a));return}if(St(a)){if(a.waypoints.length<3)return;(0,R.forEach)(a.waypoints.slice(1,-1),function(r){e.add("mid",r)});return}e.add("mid",mo(a))}),!(0,R.isNumber)(t.x)||!(0,R.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",mo(t)),e},qt.prototype.getSnapTargets=function(e,t){return Jd(t).filter(function(o){return!BC(o)})};function BC(e){return!!e.hidden}function wo(e){e.invoke(qt,this)}(0,on.default)(wo,qt),wo.$inject=["injector"],wo.prototype.initSnap=function(e){return qt.prototype.initSnap.call(this,e)},wo.prototype.addSnapTargetPoints=function(e,t,o){return qt.prototype.addSnapTargetPoints.call(this,e,t,o)},wo.prototype.getSnapTargets=function(e,t){return qt.prototype.getSnapTargets.call(this,e,t)};var RC=1250;function Go(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],RC,function(a){var r=a.context,i=r.shape,l=i.parent,s=r.direction,d=r.snapContext;if(!(a.originalEvent&&Us(a.originalEvent))&&!Ia(a)){var c=d.pointsForTarget(l);c.initialized||(c=o.addSnapTargetPoints(c,i,l,s),c.initialized=!0),MC(s)&&sn(a,"x",a.x),AC(s)&&sn(a,"y",a.y),t.snap(a,c)}}),e.on(["resize.cleanup"],function(){t.hide()})}Go.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,r=t.snapContext;r||(r=t.snapContext=new Tn);var i=xu(o,a);return r.setSnapOrigin("corner",{x:i.x-e.x,y:i.y-e.y}),r},Go.prototype.addSnapTargetPoints=function(e,t,o,a){return(0,R.forEach)(this.getSnapTargets(t,o),function(r){e.add("corner",bw(r)),e.add("corner",vw(r))}),e.add("corner",xu(t,a)),e},Go.$inject=["eventBus","snapping"],Go.prototype.getSnapTargets=function(e,t){return Jd(t).filter(function(o){return!TC(o,e)&&!St(o)&&!VC(o)&&!fo(o)})};function xu(e,t){var o=tt(e),a=Ie(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function TC(e,t){return e.host===t}function VC(e){return!!e.hidden}function MC(e){return e==="n"||e==="s"}function AC(e){return e==="e"||e==="w"}var NC=7,jC=1e3;function Vn(e){this._canvas=e,this._asyncHide=(0,R.debounce)((0,R.bind)(this.hide,this),jC)}Vn.$inject=["canvas"],Vn.prototype.snap=function(e,t){var o=e.context.snapContext,a=o.getSnapLocations(),r={x:Ia(e,"x"),y:Ia(e,"y")};(0,R.forEach)(a,function(i){var l=o.getSnapOrigin(i),s={x:e.x+l.x,y:e.y+l.y};if((0,R.forEach)(["x","y"],function(d){var c;r[d]||(c=t.snap(s,i,d,NC),c!==void 0&&(r[d]={value:c,originValue:c-l[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),(0,R.forEach)(["x","y"],function(i){var l=r[i];(0,R.isObject)(l)&&sn(e,i,l.originValue)})},Vn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=(0,P.create)("path");return(0,P.attr)(o,{d:"M0,0 L0,0"}),(0,P.classes)(o).add("djs-snap-line"),(0,P.append)(t,o),{update:function(a){(0,R.isNumber)(a)?e==="horizontal"?(0,P.attr)(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,P.attr)(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,P.attr)(o,{display:"none"})}}},Vn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Vn.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Vn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Vn.prototype.hide=function(){(0,R.forEach)(this._snapLines,function(e){e.update()})};var PC={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",qt],resizeSnapping:["type",Go],snapping:["type",Vn]},HC={__depends__:[PC],__init__:["createMoveSnapping"],createMoveSnapping:["type",wo]};function Co(e){vt.call(this,e),this.init()}Co.$inject=["eventBus"],On(Co,vt),Co.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){a.canExecute(r,t,function(i,l,s){return o(i)},!0)})},Co.prototype.init=function(){};function Ko(e){Co.call(this,e)}Ko.$inject=["eventBus"],(0,on.default)(Ko,Co),Ko.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},r=a.targetParent;if(a.targetAttach)return!1;r&&(o.parent=r);try{return Ei(t,o)}finally{r&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,o=e.source,a=e.target;return Ei(o,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return $y(t)})},Ko.prototype.canConnect=Ei;function Ei(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var zC={__init__:["myRuleProvider"],myRuleProvider:["type",Ko]};function _i(e,t,o,a,r,i,l){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=r,this._palette=i,this._myOptions=l,i.registerProvider(this)}_i.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],_i.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,r=this._globalConnect,i=this._myOptions;function l(d,c,f,p,u){function h(g){const m=t.createShape(Ke({type:d},u));e.start(g,m)}return{group:c,className:f,title:p,action:{dragstart:h,click:h}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(d){o.activateHand(d)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(d){a.activateSelection(d)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(d){r.toggle(d)}}},"tool-separator":{group:"tools",separator:!0}};for(const d in i.palette){const c=i.palette[d];s[d]=l(c.type,c.group,c.className,c.title,c.options)}return s};var OC={__init__:["paletteProvider"],paletteProvider:["type",_i]},wx=50,LC=250;function IC(e,t){t||(t={});function o(u){return u.source===e?1:-1}var a=t.defaultDistance||50,r=t.direction||"e",i=t.filter,l=t.getWeight||o,s=t.maxDistance||LC,d=t.reference||"start";i||(i=DC);function c(u,h){return r==="n"?d==="start"?Ie(u).top-Ie(h).bottom:d==="center"?Ie(u).top-tt(h).y:Ie(u).top-Ie(h).top:r==="w"?d==="start"?Ie(u).left-Ie(h).right:d==="center"?Ie(u).left-tt(h).x:Ie(u).left-Ie(h).left:r==="s"?d==="start"?Ie(h).top-Ie(u).bottom:d==="center"?tt(h).y-Ie(u).bottom:Ie(h).bottom-Ie(u).bottom:d==="start"?Ie(h).left-Ie(u).right:d==="center"?tt(h).x-Ie(u).right:Ie(h).right-Ie(u).right}var f=e.incoming.filter(i).map(function(u){var h=l(u),g=h<0?c(u.source,e):c(e,u.source);return{id:u.source.id,distance:g,weight:h}}),p=e.outgoing.filter(i).map(function(u){var h=l(u),g=h>0?c(e,u.target):c(u.target,e);return{id:u.target.id,distance:g,weight:h}});return(0,R.reduce)(f.concat(p).reduce(function(u,h){return u[h.id+"__weight_"+h.weight]=h,u},{}),function(u,h){var g=h.distance,m=h.weight;return g<0||g>s||(u[String(g)]||(u[String(g)]=0),u[String(g)]+=1*m,(!u.distance||u[u.distance]<u[String(g)])&&(u.distance=g)),u},{}).distance||a}function DC(){return!0}var FC=100;function ku(e,t,o){e.on("autoPlace",FC,function(a){var r=a.shape,i=a.source;return $C(i,r)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,r,i){e.fire("autoPlace.start",{source:a,shape:r});var l=e.fire("autoPlace",{source:a,shape:r}),s=t.appendShape(a,r,l,a.parent,i);return e.fire("autoPlace.end",{source:a,shape:s}),s}}ku.$inject=["eventBus","modeling","canvas"];function $C(e,t,o){o||(o={});var a=o.defaultDistance||50,r=tt(e);return{x:Ie(e).right+a+t.width/2,y:r.y}}function Su(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}Su.$inject=["eventBus","selection"];var WC={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ku],autoPlaceSelectionBehavior:["type",Su]},UC=10,JC=(e,t)=>e.type===t;function YC(e){return e.incoming.map(t=>t.source)}function GC(e){return e.outgoing.map(t=>t.target)}function Bi(e){return GC(e).concat(YC(e))}function KC(e){let t=Bi(e);return e.host&&(t=t.concat(Bi(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(Bi(a)),[]))),t.filter(o=>o.type!=="myline")}function qC(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height};return(0,R.find)(KC(e),r=>r===o?!1:vn(r,a,UC)==="intersect")}function XC(e,t,o,a){let r;for(;r=qC(e,o,t);)o=a(t,o,r);return o}function ZC(e){return function(t,o,a){const r={x:o.x,y:o.y};return["x","y"].forEach(i=>{const l=e[i];if(!l)return;const s=i==="x"?"width":"height",{margin:d,minDistance:c}=l;d<0?r[i]=Math.min(a[i]+d-t[s]/2,o[i]-c+d):r[i]=Math.max(a[i]+a[s]+d+t[s]/2,o[i]+c+d)}),r}}function QC(e,t){return ex(e,t)}function ex(e,t){const o=Ie(e),a=tt(e),r=IC(e,{filter:s=>JC(s,"myline")}),i=30,l=80;return XC(e,t,{x:o.right+r+t.width/2,y:a.y+tx("left",l)},ZC({y:{margin:i,minDistance:l}}))}function tx(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Eu(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return QC(a,o)})}Eu.$inject=["eventBus"];var nx={__depends__:[WC],__init__:["myAutoPlace"],myAutoPlace:["type",Eu]};function Ri(e,t,o,a,r,i,l){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=r,this._create=i,this._myOptions=l,t.registerProvider(this)}Ri.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Ri.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,r=this._autoPlace,i=this._create,l=this._myOptions;function s(){o.removeElements([e])}function d(p,u,h){t.start(p,u,h)}function c(p,u,h,g){typeof h!="string"&&(g=h);function m(x,w){const y=a.createShape(Ke({type:p},g));i.start(x,y,{source:w})}function v(x,w){const y=a.createShape(Ke({type:p},g));r.append(w,y)}return{group:"model",className:u,title:h,action:{dragstart:m,click:v}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const f={};for(const p in l.palette)if(p!=="create.start-event"){const u=l.palette[p];f[p]=c(u.type,u.className,u.title,u.options)}return f.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:d,dragstart:d}},f.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},f};var ox={__init__:["ContextPadProvider"],ContextPadProvider:["type",Ri]},ax=(0,n.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const T=s.get("eventBus");T.on("element.dblclick",V=>{r("elementDblclick",V.element.businessObject)}),T.on("element.click",V=>{r("elementClick",V.element.businessObject)}),T.on("create.end",V=>{r("elementCreate",V.elements[0].businessObject)}),T.on("autoPlace.end",V=>{r("elementCreate",V.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},u=()=>{let T={__init__:["myOptions"],myOptions:["type",p]};s=new na.default({canvas:{container:i.value},modules:[Cw,Lr,Ew,Lw,ic,Xb,$w,Uw,Jw,gd,_c,oC,ru,cC,Tc,T,nx,bd,EC,ox,OC,zC,HC,Cd]});const V=s.get("canvas"),j=s.get("elementFactory");c();const z=j.createRoot();V.setRootElement(z),f()};(0,n.onMounted)(()=>{u()});const h=T=>{const V=T==null?1:d+T;s.get("canvas").zoom(V),d=V},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},v=()=>(s.get("canvas").zoom(1),xd(s.get("elementRegistry").getAll())),x=T=>{s.clear(),c(),kd(T,s)},w=T=>{s.get("myImporter").update(T.id,T)};return t({reset:()=>{c()},zoom:T=>{h(T)},redo:()=>{g()},undo:()=>{m()},getData:()=>v(),setData:T=>{x(T)},updateElemet:T=>{w(T)}}),(T,V)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:i,class:"j-work-flow"},null,512))}}),rx=ax,_u=de(Kb),Bu=de(rx),ix=(0,n.defineComponent)({name:"JInputCards",__name:"input-cards",props:{id:{type:String,default:""},modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},gutter:{type:Number,default:16},span:Number,labelWidth:[String,Number],required:{type:Boolean,default:!1}},emits:["update:modelValue","change","rowChange"],setup(e,{expose:t,emit:o}){const a=e,r=o,{t:i}=Ge(),{formData:l}=un(),s=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),d=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),f=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,n.computed)(()=>a.editConfig.readonly),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)([]),g=b=>{r("rowChange",b)},m=()=>{const b={_i:an()};a.columns.forEach(k=>{const S=k.config?.valueRowKey||k.id||"";S&&(b[S]=Vt(k.config?.defaultValue))}),h.value.push(b),r("change",{id:a.id,value:b,data:b,formData:l,tableData:h.value,type:"add"})},v=b=>{const k=h.value[b];h.value.splice(b,1),r("change",{id:a.id,value:k,data:k,formData:l,tableData:h.value,type:"delete"})},x=()=>{const b={isOk:!0,info:""};if(a.required&&h.value.length===0)return b.isOk=!1,b.info="请添加表格数据",b;const k=h.value.length,S=a.columns,_=S.length;for(let T=0;T<k;T++){const V=h.value[T];for(let j=0;j<_;j++){const z=S[j];if(y(z.config,T).display!==!1&&z.rule&&z.rule.length>0){const L=z.rule.length;for(let M=0;M<L;M++){const B=z.rule[M];if(B.pattern=B.pattern?B.pattern+"":"",B.pattern&&!wt(V[z.prop||""])&&!new RegExp(B.pattern.substring(1,B.pattern.length-1)).test(V[z.prop||""]))return b.info=`${i("第")}${T+1}${i("行")},${i("第")}${j+1}${i("列")},${i(z.label)}:${i(B.message)}`,b.isOk=!1,b;if(B.required&&wt(V[z.prop||""]))return b.isOk=!1,b.info=`${i("第")}${T+1}${i("行")},${i("第")}${j+1}${i("列")},${i(z.label)}:${i("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(b=>{b._i||(b._i=an())})):(h.value=[],r("update:modelValue",h.value));const y=(b,k)=>{const S={...b};if(S.getUpConfig){const _=b.getUpConfig({formData:l,index:k,row:h.value[k],tableData:h.value,config:S});_&&Object.keys(_).forEach(T=>{S[T]=_[T]})}return S},C=b=>{const k=b||a.labelWidth;return typeof k=="string"?k:typeof k=="number"?k+"px":k};return t({validate:()=>x()}),_o({getTableData:()=>h.value,rowChange:g}),(b,k)=>{const S=(0,n.resolveComponent)("j-comp"),_=(0,n.resolveComponent)("el-form-item"),T=(0,n.resolveComponent)("el-col"),V=(0,n.resolveComponent)("j-button"),j=(0,n.resolveComponent)("el-row");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createElementVNode)("div",(0,n.mergeProps)({class:"j-input-cards"},b.$attrs),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.value,(z,L)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-input-cards-item",key:z.i,style:{"margin-bottom":"8px"}},[(0,n.createVNode)(j,{gutter:e.gutter},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,M=>((0,n.openBlock)(),(0,n.createBlock)(T,{key:M.prop,span:M.config?.span||e.span||24,style:(0,n.normalizeStyle)({"margin-bottom":(M.getInputType?M.getInputType(z):M.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,n.withCtx)(()=>[(0,n.withDirectives)((0,n.createVNode)(_,{"label-width":C(M.config?.labelWidth),label:(0,n.unref)(i)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(S,(0,n.mergeProps)({ref_for:!0},M,{row:z}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[n.vShow,y(M.config,L).display!==!1]])]),_:2},1032,["span","style"]))),128)),f.value&&(u.value||h.value.length>1)&&!p.value?((0,n.openBlock)(),(0,n.createBlock)(V,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>v(L)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":c.value})},[s.value?((0,n.openBlock)(),(0,n.createBlock)(V,{key:0,type:"link",style:{"margin-right":"8px"},label:d.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)],64)}}}),lx=ix,Ru=de(lx),sx=[aa,ml,yl,vl,bl,wl,Cl,xl,kl,Sl,El,_l,Bl,Rl,Hl,zl,Ol,Ll,wr,gl,Il,Dl,Fl,Wl,Jl,Yl,ls,Gl,Kl,ql,Xl,Zl,Ql,es,ts,ns,os,as,rs,is,us,fs,ps,hs,gs,ms,ys,vs,bs,ss,cs,Cr,ws,Cs,xs,ks,Ss,Es,_s,Bs,Rs,_u,Bu,Ru],cx=e=>{sx.forEach(t=>{e.component(t.name,t)})},dx={install:cx};H.EncryptionFactory=nl,H.EventBus=gr,H.HashingFactory=Tf,H.INJECT_KEYS=ht,H.JAutoComplete=Bl,H.JBarcode=Yl,H.JButton=aa,H.JButtonSelect=us,H.JButtons=ml,H.JCascaderSelect=Sl,H.JCheckbox=El,H.JCodeMirror=ls,H.JCollapse=Es,H.JComp=hs,H.JCount=Gl,H.JCountUp=ql,H.JDataPanel=Xl,H.JDate=vl,H.JDecoratedTitle=rs,H.JDialog=zl,H.JDialogFull=Ol,H.JDivider=Zl,H.JDrawer=Ll,H.JDynamicLayer=gl,H.JEcharts=Jl,H.JEditor=_s,H.JForm=gs,H.JFormItem=ms,H.JGuid=vs,H.JHpanel=Ql,H.JIcon=Cl,H.JInput=yl,H.JInputButton=ts,H.JInputCards=Ru,H.JInputCode=ns,H.JInputColor=os,H.JInputCount=Kl,H.JInputDecoratedTitle=is,H.JInputLayer=Cs,H.JInputMap=Rs,H.JInputRows=ws,H.JInputTag=Il,H.JLayer=wr,H.JLayerForm=xs,H.JLayout=Rl,H.JMap=Bs,H.JMenu=cs,H.JNowTime=wl,H.JNumber=_l,H.JPage=ys,H.JPanel=bs,H.JRadio=xl,H.JRate=Dl,H.JSelect=kl,H.JSlider=Fl,H.JSliderCaptcha=ss,H.JSwitch=ks,H.JTable=Hl,H.JTablePanel=Cr,H.JTabs=Ss,H.JTime=bl,H.JTitle=as,H.JTree=fs,H.JTreeSelect=ps,H.JUpload=Wl,H.JVpanel=es,H.JWorkflow=Bu,H.JWorkflowViewer=_u,H.assign=Ke,H.buildShortUUID=ra,H.buildUUID=an,H.clearJson=eo,H.clone=ko,H.deepClone=Vt,H.default=dx,H.eventBus=Mf,H.formatToDate=Eo,H.formatToDateTime=sa,H.fullScreenLoading=Pn,H.getCompConfig=zt,H.getCompType=la,H.getFunction=fr,H.getIsInputComp=ia,H.getIsTableInputComp=Wi,H.getLabel=Ui,H.getObjType=Ni,H.getTextWidth=Mt,H.is=Ai,H.isArray=oa,H.isNullOrEmpty=wt,H.isObject=Gu,H.loadBMap=al,H.lowerFirst=of,H.myAesDecrypt=Vf,H.numberToChinese=ji,H.numberToThousandSeparator=Pi,H.pagination=ef,H.paginationEx=tf,H.set=pr,H.setGroupMap=zi,H.toArray=Ii,H.toDecimal=So,H.toLeafArray=$i,H.toSimpleTree=af,H.toTree=Oi,H.uniqueArray=nf,H.upFirst=Hi,H.useAppInject=Ge,H.useAppProvide=Af,H.useAuthPageInject=cl,H.useAuthPageProvide=dl,H.useCompInject=rl,H.useCompProvide=vr,H.useFormInject=un,H.useFormProvide=mr,H.useHMenuInject=ll,H.useHMenuProvide=sl,H.useInject=$t,H.useLayer=no,H.useLayerInject=Nf,H.useLayerProvide=ul,H.useMenuInject=to,H.useMenuProvide=il,H.usePageInject=fl,H.usePageProvide=pl,H.useProvide=Wt,H.useSortable=ol,H.useTableInject=yr,H.useTableProvide=_o});
|
|
16
|
+
getCompValue)=>{ return ${k} }`;let S;const _=fr(k);if(_.res)try{S=_.fn(a,r,i,l,s,d,c,f,p,u,h,g,m,v,y)}catch(T){console.log(T,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(S)?"":(o.decimal!==void 0&&(S=S.toFixed(o.decimal)),S)}),E=(0,n.computed)(()=>{let b=C.value;return o.thousandSeparator&&(b=Pi(b)),o.isChinese&&(b=ji(b)),b});return(0,n.watch)(C,b=>{x("update:modelValue",b),x("change",{value:b,data:E.value})}),(b,k)=>{const S=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(S,{modelValue:E.value,"onUpdate:modelValue":k[0]||(k[0]=_=>E.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),Wh=$h,Gl=de(Wh),Uh={class:"j-block j-input-count"},Jh={class:"j-input-count-top"},Yh={class:"j-input-count-tool"},Gh={style:{"font-weight":"600"}},Kh={class:"j-input-count-codebox"},qh={key:0,class:"j-input-count-cursor"},Xh={key:0,class:"fun_color"},Zh={key:1,class:"comp_color"},Qh={key:2,class:"num_color"},eg={key:3,class:"j-input-count-cursor"},tg={class:"j-input-count-bottom"},ng={class:"j-input-count-left"},og={class:"mb-8px fw-600"},ag={class:"j-input-count-right"},rg={class:"j-input-count-funs"},ig={style:{"font-weight":"600",padding:"8px"}},lg={class:"j-input-count-funs-content"},sg={class:"j-input-count-fundes"},cg={style:{"font-size":"14px","font-weight":"300"}},dg=(0,n.defineComponent)({name:"JInputCount",__name:"input-count",props:{modelValue:String,list:{type:Array,default:()=>[]},type:{type:String,default:"primary"},size:{type:String},label:{type:String,default:"公式设置"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Ge(),a=e,r=t,i=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4},{label:5,value:5},{label:6,value:6},{label:7,value:7},{label:8,value:8},{label:9,value:9},{label:0,value:0},{label:"i",value:"i"},{label:"+",value:"+"},{label:"-",value:"-"},{label:"*",value:"*"},{label:"/",value:"/"},{label:">",value:">"},{label:"<",value:"<"},{label:"=",value:"="},{label:"(",value:"("},{label:")",value:")"},{label:"[",value:"["},{label:"]",value:"]"},{label:"'",value:"'"},{label:'"',value:'"'},{label:",",value:","},{label:".",value:"."}],l=[{label:"ABS",value:"abs",des:["ABS函数可以获取一个数的绝对值","用法:ABS(数字)","示例:ABS(-8)可以返回8,也就是-8的绝对值"]},{label:"AVERAGE",value:"average",des:["AVERAGE函数可以获取一组数值的算术平均值","用法:AVERAGE(数字1,数字2,...)","示例:AVERAGE({语文成绩},{数学成绩}, {英语成绩})返回三门课程的平均分"]},{label:"CEILING",value:"ceiling",des:["CEILING函数可以将数字增大到最接近原值的指定因数的倍数","用法:CEILING(数字,因数)","示例:CEILING(7,6)返回12,因为12比7大的同时,也是6的倍数中最接近7的数字"]},{label:"COUNT",value:"count",des:["COUNT函数可以获取参数的数量","用法:COUNT(值,值,...)","示例:COUNT(小明,小王,小张,小李)返回4,也就是人员的数量"]},{label:"COUNTIF",value:"countif",des:["COUNTIF函数可以获取数组中满足条件的参数个数","用法:COUNTIF(数组,'条件')","示例:COUNTIF(子表单.性别, '女'),可得到子表单中性别填的是'女'的数据条数;COUNTIF([1,2,3,4],'>2'),可得到1,2,3,4中大于2的数字数量,结果为2。"]},{label:"FIXED",value:"fixed",des:["FIXED函数可将数字舍入到指定的小数位数并输出为文本","用法:FIXED(数字,小数位数)","示例:FIXED(3.1415,2)返回'3.14'"]},{label:"FLOOR",value:"floor",des:["FLOOR函数可将数字减小到最接近原值的指定因数的倍数","用法:FLOOR(数字,因数)","示例:FLOOR(7,6)返回6,因为6比7小的同时,也是6的倍数中最接近7的数字"]},{label:"INT",value:"int",des:["INT函数可以获取一个数的整数部分","用法:INT(数字)","示例:INT(3.1415)返回3,也就是3.1415的整数部分"]},{label:"LARGE",value:"large",des:["LARGE函数可以获取数据集中第k个最大值","用法:LARGE(数组,k)","示例:LARGE({学生成绩.数学成绩},1)返回子表单'学生成绩'中排名第1的'数学成绩'"]},{label:"LOG",value:"log",des:["LOG函数可以根据指定底数返回数字的对数","用法:LOG(数字,底数)","示例:LOG(100,10)返回2,也就是以10为底数100的对数"]},{label:"MAX",value:"max",des:["MAX函数可以获取一组数值的最大值","用法:MAX(数字1,数字2,...)","示例:MAX({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最高分"]},{label:"MIN",value:"min",des:["MIN函数可以获取一组数值的最小值","用法:MIN(数字1,数字2,...)","示例:MIN({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最低分"]},{label:"MOD",value:"mod",des:["MOD函数可以获取两数相除的余数","用法:MOD(被除数,除数)","示例:MOD(4,3)返回1,也就是4/3的余数"]},{label:"POWER",value:"power",des:["POWER函数可以获取数字乘幂的结果","用法:POWER(数字,指数)","示例:POWER(3,2)返回9,也就是3的2次方"]},{label:"PRODUCT",value:"product",des:["PRODUCT函数可以获取一组数值的乘积","用法:PRODUCT(数字1,数字2,...)","示例:PRODUCT({单价}, {数量})获取总价,也就是单价和数量的乘积"]},{label:"RAND",value:"rand",des:["RAND函数可返回大于等于0且小于1的均匀分布随机实数","用法:RAND()","示例:RAND()返回0.424656"]},{label:"ROUND",value:"round",des:["ROUND函数可以将数字四舍五入到指定的位数","用法:ROUND(数字,数字位数)","示例:ROUND(3.1485,2)返回3.15"]},{label:"SMALL",value:"small",des:["SMALL函数可以返回数据集中第k个最小值","用法:SMALL(数组,k)","示例:SMALL({学生成绩.数学成绩}, 1)返回子表单'学生成绩'中排名倒数第一的'数学成绩'"]},{label:"SQRT",value:"sqrt",des:["SQRT函数可以获取一个数字的正平方根","用法:SQRT(数字)","示例:SQRT(9)返回3,也就是9的正平方根"]},{label:"SUM",value:"sum",des:["SUM函数可以获取一组数值的总和","用法:SUM(数字1,数字2,...)","示例:SUM({语文成绩},{数学成绩}, {英语成绩})返回三门课程的总分"]},{label:"SUMPRODUCT",value:"sumproduct",des:["SUMPRODUCT函数可以将数组间对应的元素相乘,并返回乘积之和,适用于加权求和","用法:SUMPRODUCT(数组,数组...)","示例:SUMPRODUCT([1,2,3],[0.1,0.2,0.3])返回1.4,也就是 1×0.1 + 2×0.2 + 3×0.3的值"]}],s=(0,n.ref)(!1),d=(0,n.ref)([]),c=(0,n.reactive)({cells:[],cursor:0}),f=(0,n.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(b){r("update:modelValue",b.length>0?JSON.stringify(b):""),r("change",{value:b.length>0?JSON.stringify(b):"",data:b})}}),p=b=>{d.value=b},u=(b,k)=>{const S={value:b,type:k};if(c.cells.splice(c.cursor,0,S),c.cursor+=1,k==="fun"){const _={value:"(",type:k},T={value:")",type:k};c.cells.splice(c.cursor,0,_,T),c.cursor+=1}},h=()=>{c.cursor>0&&(c.cursor-=1)},g=()=>{c.cursor<c.cells.length&&(c.cursor+=1)},m=()=>{c.cursor>0&&(c.cells.splice(c.cursor-1,1),c.cursor-=1)},v=()=>{c.cells=[],c.cursor=0},x=()=>{c.cells=Vt(f.value),c.cursor=c.cells.length,s.value=!0},w=()=>{f.value=c.cells,s.value=!1},y=()=>{c.cells=[],c.cursor=0,s.value=!1},C=(0,n.computed)(()=>{const b={};return a.list.forEach(k=>{k.children.forEach(S=>{b[S.value]=`${k.label}.${S.label}`})}),b}),E=b=>C.value[b]||b;return(b,k)=>{const S=(0,n.resolveComponent)("j-button"),_=(0,n.resolveComponent)("j-icon"),T=(0,n.resolveComponent)("el-space"),V=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(S,(0,n.mergeProps)(b.$attrs,{type:e.type,size:e.size,label:e.label,onClick:x}),null,16,["type","size","label"]),(0,n.createVNode)(V,{visible:s.value,title:(0,n.unref)(o)("公式设置"),height:800,width:1200,onOk:w,onClosed:y},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Uh,[(0,n.createElementVNode)("div",Jh,[(0,n.createElementVNode)("div",Yh,[(0,n.createElementVNode)("span",Gh,(0,n.toDisplayString)((0,n.unref)(o)("计算公式"))+"=",1),(0,n.createVNode)(T,null,{default:(0,n.withCtx)(()=>[(0,n.createVNode)(S,{type:"text",onClick:h},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowLeft"})]),_:1}),(0,n.createVNode)(S,{type:"text",onClick:g},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowRight"})]),_:1}),(0,n.createVNode)(S,{type:"link",label:"退格",onClick:m}),(0,n.createVNode)(S,{type:"link",danger:"",label:"清空",onClick:v})]),_:1})]),(0,n.createElementVNode)("div",Kh,[c.cells.length==0?((0,n.openBlock)(),(0,n.createElementBlock)("span",qh)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.cells,(j,z)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:z},[j.type=="fun"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Xh,(0,n.toDisplayString)(j.value.toUpperCase()),1)):j.type=="comp"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Zh," #"+(0,n.toDisplayString)(E(j.value))+"# ",1)):j.type=="num"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Qh,(0,n.toDisplayString)(j.value),1)):(0,n.createCommentVNode)("",!0),z+1==c.cursor?((0,n.openBlock)(),(0,n.createElementBlock)("span",eg)):(0,n.createCommentVNode)("",!0)],64))),128))])]),(0,n.createVNode)(T,{class:"j-input-count-mid"},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,(j,z)=>(0,n.createVNode)(S,{key:z,label:j.label+"",onClick:L=>u(j.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,n.createElementVNode)("div",tg,[(0,n.createElementVNode)("div",ng,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.list,(j,z)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:z},[(0,n.createElementVNode)("div",og,(0,n.toDisplayString)((0,n.unref)(o)(j.label)),1),(0,n.createVNode)(T,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(j.children,L=>((0,n.openBlock)(),(0,n.createBlock)(S,{key:L.value,onClick:M=>u(L.value,"comp"),label:(0,n.unref)(o)(L.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,n.createElementVNode)("div",ag,[(0,n.createElementVNode)("div",rg,[(0,n.createElementVNode)("span",ig,(0,n.toDisplayString)((0,n.unref)(o)("函数列表")),1),(0,n.createElementVNode)("div",lg,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l,(j,z)=>(0,n.createVNode)(S,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:z,onMouseover:L=>p(j.des),onClick:L=>u(j.value,"fun"),label:j.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,n.createElementVNode)("div",sg,[(0,n.createElementVNode)("div",null,[(0,n.createElementVNode)("ul",null,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.value,(j,z)=>((0,n.openBlock)(),(0,n.createElementBlock)("li",{key:z,style:{"margin-bottom":"8px"}},[(0,n.createElementVNode)("span",cg,(0,n.toDisplayString)((0,n.unref)(o)(j)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),ug=dg,Kl=de(ug),fg={key:0},pg=(0,n.defineComponent)({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=(0,n.computed)(()=>({...o})),r=(0,n.ref)(),i=(0,n.ref)(null),l=(0,n.computed)(()=>o.options);(0,n.onMounted)(()=>{o.animation&&s()}),(0,n.watch)(()=>o.decimals,()=>{i.value&&i.value.update&&(i.value.options.decimalPlaces=o.decimals,i.value.reset(),i.value.update(o.endValue))},{deep:!0}),(0,n.watch)(()=>o.endValue,u=>{i.value&&i.value.update&&i.value.update(u)});const s=()=>{i.value||(l.value.startVal=o.startValue,l.value.decimalPlaces=o.decimals,l.value.duration=o.duration,i.value=new Mu.CountUp(r.value,Number(o.endValue),l.value),i.value.start(()=>{o.callback?.(i.value)}))};return(0,n.onUnmounted)(()=>{i.value=null}),(0,n.onBeforeUnmount)(()=>{i.value=null}),t({myProps:a,el:r,init:s,start:u=>{i.value&&i.value.start&&i.value.start(()=>{u?.(i.value)})},pauseResume:()=>{i.value&&i.value.pauseResume&&i.value.pauseResume()},reset:()=>{i.value&&i.value.reset&&i.value.reset()},update:u=>{i.value&&i.value.update&&i.value.update(u)}}),(u,h)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"el",ref:r},[e.animation?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",fg,(0,n.toDisplayString)(e.endValue),1))],512))}}),hg=pg,ql=de(hg),gg={class:"j-block j-data-panel"},mg={key:0,class:"j-data-panel-header"},yg={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},vg={class:"j-data-panel-header-right"},bg={class:"j-data-panel-body"},wg=(0,n.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",gg,[e.title?((0,n.openBlock)(),(0,n.createElementBlock)("div",mg,[(0,n.createElementVNode)("div",yg,(0,n.toDisplayString)(e.title),1),(0,n.createElementVNode)("div",vg,[(0,n.renderSlot)(t.$slots,"titleRight")])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",bg,[(0,n.renderSlot)(t.$slots,"default")])]))}}),Cg=wg,Xl=de(Cg),xg={class:"j-divider-content"},kg=(0,n.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=(0,n.computed)(()=>{const r={color:t.color};return t.size&&Number(t.size)&&(r.fontSize=`${t.size}px`),r}),a=(0,n.computed)(()=>({borderTopStyle:t.borderStyle}));return(r,i)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,n.normalizeStyle)(o.value)},[(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,n.normalizeStyle)(a.value)},null,4),(0,n.createElementVNode)("div",xg,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.content||""),1)]),(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,n.normalizeStyle)(a.value)},null,4)],6))}}),Sg=kg,Zl=de(Sg),Eg={class:"j-hpanel"},_g={class:"j-hpanel-main"},Bg=(0,n.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Eg,[(0,n.renderSlot)(t.$slots,"left"),(0,n.createElementVNode)("div",_g,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"right")]))}}),Rg=Bg,Ql=de(Rg),Tg={class:"j-vpanel"},Vg={class:"j-vpanel-main"},Mg=(0,n.defineComponent)({name:"JVpanel",__name:"vpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Tg,[(0,n.renderSlot)(t.$slots,"top"),(0,n.createElementVNode)("div",Vg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"bottom")]))}}),Ag=Mg,es=de(Ag),Ng=(0,n.defineComponent)({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),i=(0,n.ref)(),l=async(f,p)=>{o.ok&&(f("保存数据中..."),i.value=await o.ok(),a("update:modelValue",i.value),a("change",{value:i.value}),p(),r.value.close())},s=()=>o.beforeClose?o.beforeClose(i.value):!0,d=()=>{o.closed?.()},c=()=>{r.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(i.value)},200)};return(0,n.watch)(()=>o.modelValue,f=>{i.value=f},{immediate:!0}),(f,p)=>{const u=(0,n.resolveComponent)("j-button"),h=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(u,(0,n.mergeProps)({style:{width:"auto"}},f.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:c}),null,16,["type","label","size"]),(0,n.createVNode)(h,{ref_key:"layerRef",ref:r,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:d},{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(f.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),jg=Ng,ts=de(jg),Pg=(0,n.defineComponent)({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.computed)({get:()=>o.modelValue,set:p=>{a("update:modelValue",p)}}),i=(0,n.ref)(""),l=p=>{i.value=p},s=()=>i.value,d=p=>o.beforeClose?o.beforeClose(p):!0,c=p=>{a("change",p)},f=(0,n.computed)(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(p,u)=>{const h=(0,n.resolveComponent)("j-code-mirror"),g=(0,n.resolveComponent)("j-layout"),m=(0,n.resolveComponent)("j-input-button");return(0,n.openBlock)(),(0,n.createBlock)(m,{modelValue:r.value,"onUpdate:modelValue":u[1]||(u[1]=v=>r.value=v),type:e.type,"btn-text":f.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":d,ok:s,open:l,onChange:c},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{"right-move":!1,right:560},(0,n.createSlots)({default:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=v=>i.value=v),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["modelValue","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{"model-value":e.example,mode:e.mode,readonly:""},null,8,["model-value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}}),Hg=Pg,ns=de(Hg),zg=(0,n.defineComponent)({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l=(0,n.ref)(),s=(0,n.computed)({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(m){l.value=m,r("update:modelValue",m),r("input",m)}}),d=m=>{r("input",m)},c=m=>{r("focus",m)},f=m=>{r("blur",m)},p=()=>{r("clear"),r("update:modelValue","")},u=m=>{r("change",m)},h=m=>{r("color-change",m),r("change",m)},g=m=>{r("active-change",m)};return t({focus:()=>{i.value?.focus()},blur:()=>{i.value?.blur()},select:()=>{i.value?.select()}}),(m,v)=>{const x=(0,n.resolveComponent)("el-color-picker"),w=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,n.createVNode)(w,(0,n.mergeProps)({ref_key:"inputRef",ref:i,modelValue:s.value,"onUpdate:modelValue":v[1]||(v[1]=y=>s.value=y),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},m.$attrs,{onInput:d,onFocus:c,onBlur:f,onClear:p,onChange:u}),{[e.inputType]:(0,n.withCtx)(()=>[(0,n.createVNode)(x,{modelValue:s.value,"onUpdate:modelValue":v[0]||(v[0]=y=>s.value=y),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:g},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}}),Og=zg,os=de(Og),Lg=(0,n.defineComponent)({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"},align:{default:"left"}},setup(e){const t=e,o=(0,n.computed)(()=>t.class||""),a=(0,n.computed)(()=>{const r={...t.style};return t.color&&(r.color=t.color),t.size&&(typeof t.size=="number"?r.fontSize=`${t.size}px`:r.fontSize=t.size),t.weight&&(r.fontWeight=t.weight),t.align&&(r.textAlign=t.align),r});return(r,i)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-title",o.value]),style:(0,n.normalizeStyle)(a.value)},(0,n.toDisplayString)(e.title),7))}}),Ig=Lg,as=de(Ig),Dg={class:"j-decorated-title-wrapper1"},Fg={class:"j-decorated-title-wrapper1-line"},$g={key:3,class:"j-decorated-title-wrapper2"},Wg={class:"wrapper2"},Ug={class:"wrapper2-line"},Jg={key:4,class:"j-decorated-title-wrapper3"},Yg={class:"wrapper3"},Gg={class:"wrapper3-line"},Kg={key:5,class:"j-decorated-title-wrapper4"},qg={class:"wrapper4"},Xg={class:"wrapper4-center"},Zg={key:6,class:"j-decorated-title-wrapper5"},Qg={class:"wrapper5"},e0={class:"wrapper5-left"},t0={class:"wrapper5-right"},n0=(0,n.defineComponent)({name:"JDecoratedTitle",__name:"decorated-title",props:{title:{default:""},content:{},style:{default:void 0},class:{default:void 0},color:{default:void 0},contentColor:{},backgroundColor:{},size:{default:14},contentSize:{default:12},align:{default:void 0},weight:{default:"normal"},titleType:{default:"title1"}},setup(e){const{t}=Ge(),o=e,a=(0,n.computed)(()=>o.class||""),r=(0,n.computed)(()=>({"font-size":o.size?`${["title5","title7","title8","title9"].includes(o.titleType)?14:o.size}px`:"","font-weight":o.weight,color:o.color})),i=(0,n.computed)(()=>({"font-size":o.contentSize?`${o.contentSize}px`:"",color:o.contentColor})),l=(0,n.computed)(()=>({"--el-border-style":o.titleType==="title3"?"solid":"dashed",borderColor:o.backgroundColor||"var(--j-color-primary)",margin:"0 !important"})),s=(0,n.computed)(()=>o.backgroundColor||"var(--j-color-primary-hover)"),d=(0,n.computed)(()=>({...o.style}));return(c,f)=>{const p=(0,n.resolveComponent)("el-divider");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-decorated-title",a.value]),style:(0,n.normalizeStyle)(d.value)},[e.titleType==="title2"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):["title3","title4"].includes(e.titleType||"")?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createVNode)(p,{class:"m-0",style:(0,n.normalizeStyle)(l.value)},null,8,["style"]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title5"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[(0,n.createElementVNode)("div",Dg,[(0,n.createElementVNode)("div",{class:"j-decorated-title-wrapper1-title",style:(0,n.normalizeStyle)([r.value,{backgroundColor:s.value}])},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",Fg,[(0,n.createElementVNode)("div",{class:"wrapper-line",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram1",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram2",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram3",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)([i.value,{textAlign:"left"}])},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title6"?((0,n.openBlock)(),(0,n.createElementBlock)("div",$g,[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",Wg,[(0,n.createElementVNode)("div",Ug,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper2-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title7"?((0,n.openBlock)(),(0,n.createElementBlock)("div",Jg,[(0,n.createElementVNode)("div",Yg,[(0,n.createElementVNode)("div",Gg,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper3-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title8"?((0,n.openBlock)(),(0,n.createElementBlock)("div",Kg,[(0,n.createElementVNode)("div",qg,[(0,n.createElementVNode)("div",{class:"wrapper4-bg",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",Xg,[(0,n.createElementVNode)("div",{class:"wrapper4-center-label",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border left-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border right-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title9"?((0,n.openBlock)(),(0,n.createElementBlock)("div",Zg,[(0,n.createElementVNode)("div",Qg,[(0,n.createElementVNode)("div",e0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-left-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[0]||(f[0]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-left-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-left-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-left-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper5-center",style:(0,n.normalizeStyle)([{backgroundColor:s.value}])},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",t0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-right-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[1]||(f[1]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-right-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-right-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-right-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(i.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:7,style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5))],6)}}}),o0=n0,rs=de(o0),a0={class:"j-block"},r0={class:"j-input-decorated-title-wrapper mb-0px"},i0=(0,n.defineComponent)({name:"JInputDecoratedTitle",__name:"input-decorated-title",props:{modelValue:{default:"title1"},backgroundColor:{default:void 0},color:{default:void 0},weight:{default:void 0},contentColor:{default:void 0},align:{default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Ge(),a=t,r=(0,n.ref)(),i=c=>{r.value?.hide(),a("update:modelValue",c),a("change",c)},l=(0,n.ref)("mdi:chevron-down"),s=()=>{l.value="mdi:chevron-up"},d=()=>{l.value="mdi:chevron-down"};return(c,f)=>{const p=(0,n.resolveComponent)("j-decorated-title"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createElementBlock)("div",a0,[(0,n.createVNode)(h,{width:270,placement:"top-start",trigger:"click","popper-class":"j-input-decorated-title-popover",ref_key:"popoverRef",ref:r,onShow:s,onHide:d},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",r0,[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:e.modelValue,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align"]),(0,n.createVNode)(u,{icon:l.value,size:20},null,8,["icon"])])]),default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(8,g=>(0,n.createElementVNode)("div",{class:"j-input-decorated-title-wrapper",key:g},[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:`title${g}`,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align,onClick:m=>i(`title${g}`)},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align","onClick"])])),64))]),_:1},512)])}}}),l0=i0,is=de(l0),s0=(0,n.defineComponent)({name:"JCodeMirror",__name:"code-mirror",props:{modelValue:{default:""},mode:{default:"javascript"},readonly:{type:Boolean,default:!1},height:{default:void 0},isHint:{type:Boolean,default:!1},handleHint:{type:Function,default:void 0},isScrollToBottom:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l=(0,n.ref)("");let s=null;const d=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,Zn.javascript)();case"css":case"text/css":return(0,ju.css)();case"html":case"text/html":return(0,Pu.html)();case"json":case"application/json":return(0,Hu.json)();case"sql":case"text/x-sql":return(0,zu.sql)();case"xml":case"text/xml":return(0,Ou.xml)();case"python":case"text/x-python":return(0,Lu.python)();case"markdown":case"text/markdown":return(0,Iu.markdown)();case"java":case"text/x-java":return(0,Du.java)();case"vue":case"text/x-vue":return(0,Zn.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,Zn.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,Zn.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,Zn.javascript)({jsx:!0,typescript:!0});default:return(0,Zn.javascript)()}},c=()=>{const m=[Nu.basicSetup,(0,Ft.lineNumbers)(),(0,Ft.highlightActiveLineGutter)(),(0,Ft.highlightSpecialChars)(),(0,lr.history)(),(0,Ft.drawSelection)(),(0,Ft.dropCursor)(),(0,Qn.indentOnInput)(),(0,Qn.bracketMatching)(),(0,ir.closeBrackets)(),(0,Ft.rectangularSelection)(),(0,Qn.foldGutter)(),Ft.keymap.of([...ir.closeBracketsKeymap,...lr.defaultKeymap,...lr.historyKeymap,...Qn.foldKeymap]),(0,Qn.syntaxHighlighting)(Qn.defaultHighlightStyle)];return m.push(d(a.mode)),a.readonly&&m.push(rr.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,ir.autocompletion)({override:[v=>{const x=v.matchBefore(/\w*/);if(!x||x.from===x.to)return null;const w=a.handleHint(x.text);return w.length===0?null:{from:x.from,options:w.map(y=>({label:typeof y=="string"?y:y.label||y.name||"",detail:typeof y=="string"?"":y.detail||"",type:typeof y=="string"?"variable":y.type||"variable",apply:typeof y=="string"?y:y.apply||y.name||y.label||""}))}}]})),m.push(Ft.EditorView.updateListener.of(v=>{if(v.docChanged){const x=v.state.doc.toString();l.value=x,r("update:modelValue",x),r("change",{value:x})}})),m},f=async()=>{i.value&&(s=new Ft.EditorView({state:rr.EditorState.create({doc:a.modelValue,extensions:c()}),parent:i.value}),l.value=a.modelValue)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const v=rr.EditorState.create({doc:m,extensions:c()});i.value&&(s=new Ft.EditorView({state:v,parent:i.value}));const x=s.state.doc.toString();x!==a.modelValue&&s.dispatch({changes:{from:0,to:x.length,insert:a.modelValue}})},u=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const v=s.state.doc.length;s.dispatch({selection:{anchor:v,head:v},scrollIntoView:!0})}},100)},h=()=>{let m=(0,Au.format)(a.modelValue);m=m.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),r("update:modelValue",m),r("change",{value:m})};let g=null;return(0,n.watch)(()=>a.modelValue,m=>{m!==l.value&&(l.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&u()}))}),(0,n.watch)(()=>a.mode,()=>{s&&p()}),(0,n.onMounted)(async()=>{await(0,n.nextTick)(),await f(),typeof window<"u"&&window.ResizeObserver&&i.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(i.value))}),(0,n.onUnmounted)(()=>{g&&i.value&&(g.unobserve(i.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,v)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"codeWraperRef",ref:i,class:"j-code-mirror",style:(0,n.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),c0=s0,ls=de(c0),d0=(0,n.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("actionRef"),r=(0,n.ref)("0"),i=(0,n.computed)(()=>{const{actionStyle:s,toLeft:d}=o;return{...s,left:d?"0":r.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:d?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=(0,n.computed)(()=>Number.parseInt(r.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{r.value=s}}),(s,d)=>{const c=(0,n.resolveComponent)("j-icon");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,n.normalizeStyle)(i.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,n.openBlock)(),(0,n.createBlock)(c,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),u0=d0,f0=(0,n.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("barRef"),r=(0,n.ref)("0"),i=(0,n.computed)(()=>{const{barStyle:l,toLeft:s}=o;return{...l,width:s?"0":r.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:l=>{r.value=l}}),(l,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,n.normalizeStyle)(i.value)},null,4))}}),p0=f0,h0=(0,n.defineComponent)({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("contentRef"),r=(0,n.computed)(()=>{const{contentStyle:l}=o;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const i=(0,n.computed)(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(l,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,n.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,n.normalizeStyle)(r.value)},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(i.value),class:"j-spine-text"},(0,n.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),g0=h0,m0=(0,n.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,n.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,n.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,r=(0,n.useModel)(e,"modelValue"),i=(0,n.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=(0,n.useTemplateRef)("wrapperRef"),s=(0,n.useTemplateRef)("barRef"),d=(0,n.useTemplateRef)("contentRef"),c=(0,n.useTemplateRef)("actionRef");(0,n.watch)(()=>i.isPassing,x=>{if(x){const{endTime:w,startTime:y}=i;a("success",{isPassing:x,time:((w-y)/1e3).toFixed(1)}),r.value=x}}),(0,n.watchEffect)(()=>{i.isPassing=!!r.value});function f(x){return"pageX"in x?x.pageX:"touches"in x&&x.touches[0]?x.touches[0].pageX:0}function p(x){i.isPassing||c.value&&(a("start",x),i.moveDistance=f(x)-Number.parseInt(c.value.getStyle().left.replace("px","")||"0",10),i.startTime=Date.now(),i.isMoving=!0)}function u(x){const w=l.value?.offsetWidth??220,y=x?.offsetWidth??40;return{actionWidth:y,offset:w-y-6,wrapperWidth:w}}function h(x){const{isMoving:w,moveDistance:y}=i;if(w){const C=(0,n.unref)(c),E=(0,n.unref)(s);if(!C||!E)return;const{actionWidth:b,offset:k,wrapperWidth:S}=u(C.getEl()),_=f(x)-y;a("move",{event:x,moveDistance:y,moveX:_}),_>0&&_<=k?(C.setLeft(`${_}px`),E.setWidth(`${_+b/2}px`)):_>k&&(C.setLeft(`${S-b}px`),E.setWidth(`${S-b/2}px`),m())}}function g(x){const{isMoving:w,isPassing:y,moveDistance:C}=i;if(w&&!y){a("end",x);const E=c.value,b=(0,n.unref)(s);if(!E||!b)return;const k=f(x)-C,{actionWidth:S,offset:_,wrapperWidth:T}=u(E.getEl());k<_?v():(E.setLeft(`${T-S}px`),b.setWidth(`${T-S/2}px`),m()),i.isMoving=!1}}function m(){i.endTime=Date.now(),i.isPassing=!0,i.isMoving=!1}function v(){i.isMoving=!1,i.isPassing=!1,i.moveDistance=0,i.toLeft=!1,i.startTime=0,i.endTime=0;const x=(0,n.unref)(c),w=(0,n.unref)(s),y=(0,n.unref)(d);!x||!w||!y||(y.getEl().style.width="100%",i.toLeft=!0,setTimeout(()=>{i.toLeft=!1,x.setLeft("0"),w.setWidth("0")},300))}return(x,w)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"wrapperRef",ref:l,class:(0,n.normalizeClass)(["j-slider-captcha slider-border",o.class]),style:(0,n.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,n.createVNode)(p0,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":i.toLeft},null,8,["bar-style","to-left"]),(0,n.createVNode)(g0,{ref_key:"contentRef",ref:d,"content-style":e.contentStyle,"is-passing":i.isPassing},null,8,["content-style","is-passing"]),(0,n.createVNode)(u0,{ref_key:"actionRef",ref:c,"action-style":e.actionStyle,"is-passing":i.isPassing,"to-left":i.toLeft,onMousedown:p,onTouchstart:p},null,8,["action-style","is-passing","to-left"])],38))}}),y0=m0,ss=de(y0),v0=(0,n.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:r,toArray:i,activeMenu:l,theme:s}=to(),{getHMoreMenus:d}=ll(),c=(0,n.ref)([]);o.pId==="moreId"?c.value=d.value:c.value=i(r()[o.pId||""]||[],[]);const f=g=>{const m=c.value.find(v=>v.active);m?.value!==g.value&&(m&&(m.active=!1),a("click",g))},{list:p,containerProps:u,wrapperProps:h}=(0,sr.useVirtualList)(c,{itemHeight:44});return(g,m)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,n.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,n.unref)(u)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(h))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p),v=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:v.data.value,"parent-actives":(0,n.unref)(l)?.pid?.split(".")||[],item:v.data,"is-sub":"",onClick:f},null,8,["parent-actives","item"]))),128))],16)],16))}}),b0=v0,w0={class:"j-menu-item-label"},C0={class:"j-menu-item-label"},x0={key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow","sub"])},k0={class:"j-menu-item-label"},S0=(0,n.defineComponent)({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=Ge(),{activeMenuId:a}=to(),r=t,i=l=>{r("click",l)};return(l,s)=>{const d=(0,n.resolveComponent)("j-icon"),c=(0,n.resolveComponent)("el-tooltip"),f=(0,n.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,placement:"right"},{content:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1)]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,n.withModifiers)(p=>i(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",w0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(f,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",C0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,n.openBlock)(),(0,n.createElementBlock)("div",x0)):(0,n.createCommentVNode)("",!0)],6)],2)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(b0,{"p-id":e.item.value,onClick:i},null,8,["p-id"])]),_:1},8,["placement"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,n.withModifiers)(p=>i(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",k0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2))}}}),pa=S0,E0=(0,n.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:i}=to(),l=f=>{a("click",f)},{list:s,containerProps:d,wrapperProps:c}=(0,sr.useVirtualList)((0,n.computed)(()=>o.menuList),{itemHeight:44});return(f,p)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,n.unref)(i)==="dark"}]},(0,n.unref)(d)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(c))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(s),u=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:u.data.value,"parent-actives":(0,n.unref)(r)?.pid?.split(".")||[],item:u.data,collapsed:e.collapsed,class:(0,n.normalizeClass)({"menu-item-entering":u.data.entering,"menu-item-leaving":u.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),_0=E0,B0=(0,n.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:i}=to(),l=(0,n.ref)(),s=(0,n.ref)(0);let d=null;(0,n.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(d=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),d.observe(l.value))});const c=(0,n.computed)(()=>{const h=[];let g=0,m=0;const v=o.menuList.length;return o.menuList.forEach(x=>{m++;const w=(Mt(x.label)||0)+32+16+4+8;g+=w,(m===v&&g<=s.value||m<v&&g+56<=s.value)&&h.push(x)}),h.length<o.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),f=(0,n.computed)(()=>{const h=[];let g=0;const m=c.value.length;return o.menuList.forEach(v=>{g++,g>=m&&h.push(v)}),h}),p=(0,n.computed)(()=>{const h=r.value?.pid?.split(".")||[];return(h.length>1&&f.value.findIndex(g=>g.value===h[1])>-1||f.value.findIndex(g=>g.value===r.value?.value)>-1)&&h.push("moreId"),h}),u=h=>{a("click",h)};return sl({getHMoreMenus:f}),(0,n.onUnmounted)(()=>{d&&l.value&&(d.unobserve(l.value),d.disconnect(),d=null)}),(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"menuRef",ref:l,class:(0,n.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,n.unref)(i)==="dark"}])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.value,m=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:u},null,8,["parent-actives","item"]))),128))],2))}}),R0=B0,T0=(0,n.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:i}=to(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,n.computed)(()=>(o.menuList.forEach((h,g)=>{h.color=l[g%l.length]}),o.menuList)),d=(0,n.computed)(()=>r.value?.pid?.split(".")||[]),c=h=>{a("click",h)},{list:f,containerProps:p,wrapperProps:u}=(0,sr.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,n.unref)(i)==="dark"}]},(0,n.unref)(p)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(u))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(f),m=>((0,n.openBlock)(),(0,n.createBlock)(pa,{key:m.data.value,"parent-actives":d.value,item:m.data,"is-vertical":"",onClick:c},null,8,["parent-actives","item"]))),128))],16)],16))}}),V0=T0,M0=(0,n.defineComponent)({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let r={};const i=(0,n.ref)("");i.value=o.activeId||"";const l=(m,v,x,w,y)=>{x=x||[];for(let C=0,E=x.length;C<E;C++){const b=x[C],k={};k.pid=v,k.indent=w,i.value===b.value&&(k.active=!0),Object.keys(b).forEach(_=>{_!=="children"&&(k[_]=b[_])}),y&&y.includes(b.value)&&(k.open=!0),m.push(k);const S=b.children||[];S.length>0&&(k.hasChildren=!0,y||(r[k.value]=S),(!y||k.open&&!o.collapsed)&&l(m,`${v}.${k.value}`,S,w+1,y))}},s=(m,v)=>{const x=[];return l(x,"0",m,0,v),x},d=(0,n.ref)([]);let c=[];const f=()=>{r={},c=s(o.menus);const m=[];if(i.value&&o.mode==="inline"){const v=c.find(x=>x.value===i.value);v&&m.push(...v.pid.split("."))}d.value=s(o.menus,m)};(0,n.watch)(()=>o.menus,()=>{f()},{immediate:!0}),(0,n.watch)(()=>o.mode,()=>{f()});const p=()=>{if(d.value.find(m=>m.active)?.value!==i.value){const m=c.find(v=>v.value===i.value);if(m){const v=[];o.mode==="inline"&&v.push(...m.pid.split(".")),d.value=s(o.menus,v)}}},u=(0,n.computed)(()=>c.find(m=>m.value===i.value));(0,n.watch)(()=>o.activeId,()=>{i.value=o.activeId||"",p()}),(0,n.watch)(()=>o.collapsed,()=>{if(o.collapsed)d.value=s(o.menus,[]);else{const m=[];if(i.value){const v=c.find(x=>x.value===i.value);v&&m.push(...v.pid.split("."))}d.value=s(o.menus,m)}});const h=(0,n.computed)(()=>o.theme),g=m=>{if(console.log(m),m.hasChildren){if(o.collapsed)return;const v=[];v.push(...m.pid.split(".")),m.open||v.push(m.value);const x=s(o.menus,v),w=new Set(d.value.map(C=>C.value)),y=new Set(x.map(C=>C.value));x.forEach(C=>{w.has(C.value)||(C.entering=!0)}),d.value.forEach(C=>{y.has(C.value)||(C.leaving=!0)}),d.value=x,setTimeout(()=>{d.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(i.value===m.value)return;i.value=m.value,a("click",m)}};return il({getMenuMap:()=>r,toArray:s,activeMenu:u,activeMenuId:i,theme:h}),(m,v)=>e.mode==="inline"?((0,n.openBlock)(),(0,n.createBlock)(_0,{key:0,"menu-list":d.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,n.openBlock)(),(0,n.createBlock)(R0,{key:1,"menu-list":d.value,onClick:g},null,8,["menu-list"])):((0,n.openBlock)(),(0,n.createBlock)(V0,{key:2,"menu-list":d.value,onClick:g},null,8,["menu-list"]))}}),A0=M0,cs=de(A0),N0={class:"j-keyword-panel"},j0={key:0},P0={key:1,class:"columns-wrapper"},H0=(0,n.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=Ge(),a=e,r=(0,n.useModel)(e,"checkAll"),i=(0,n.useModel)(e,"checkFields"),l=(0,n.ref)(!1),s=(0,n.ref)(""),d=(0,n.computed)(()=>a.columns.filter(u=>u.config?.filter?.isSearchKeyword?s.value?u.config?.label?.indexOf(s.value)!=-1:!0:!1).map(u=>({label:u.config?.label,value:u.id}))),c=()=>{r.value||(r.value=!0,l.value=!1,i.value=[])},f=u=>{u.length>0?r.value=!1:r.value=!0};return t({init:()=>{r.value?l.value=!1:l.value=!0}}),(u,h)=>{const g=(0,n.resolveComponent)("j-icon"),m=(0,n.resolveComponent)("el-input"),v=(0,n.resolveComponent)("j-checkbox");return(0,n.openBlock)(),(0,n.createElementBlock)("div",N0,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["range-item",{active:r.value}]),onClick:c},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索全部")),1),r.value?((0,n.openBlock)(),(0,n.createBlock)(g,{key:0,icon:"mdi:check"})):(0,n.createCommentVNode)("",!0)],2),(0,n.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=x=>l.value=!l.value)},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索特定字段")),1),(0,n.createVNode)(g,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",j0,[(0,n.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=x=>s.value=x),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,n.unref)(o)("搜索"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",P0,[(0,n.createVNode)(v,{modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=x=>i.value=x),options:d.value,style:{display:"flex","flex-direction":"column"},onChange:f},null,8,["modelValue","options"])])):(0,n.createCommentVNode)("",!0)])}}}),z0=H0,O0={key:0,class:"title"},L0={class:"content"},I0={class:"relation"},D0={style:{width:"72px"}},F0={class:"btn-wrapper"},$0={class:"field-wrapper"},W0={class:"buttons"},U0=(0,n.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,n.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=Ge(),r=e,i=(0,n.useModel)(e,"relation"),l=(0,n.useModel)(e,"isPin"),s=(0,n.ref)([]),d=()=>{l.value=!l.value},c=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:p.value.join(","),options:f.value}),config:{style:{width:l.value?"132px":"160px"},appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:w,row:y})=>{const C=r.columns.find(k=>k.id===w)?.config||{};let E="eq",b="text";["options"].includes(C.dataType||"")?E="in":["dateTime"].includes(C.type||"")?(E="range",b="dateTime"):["number"].includes(C.type||"")&&(b="number"),y.method=E,y.type=C.valueType||b,y.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:w})=>{const y=r.columns.find(C=>C.id===w.field)?.config||{};return["options","switch","dataItem","dataView"].includes(y.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"range",label:"选择范围"},{value:"formula",label:"动态筛选"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["number"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{style:{width:l.value?"134px":"130px"},appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:w})=>{w.value=void 0}}},{id:"value",type:"input",getCompType:({row:w})=>{const y=r.columns.find(C=>C.id===w.field)?.config||{};if(["options","dataItem","switch"].includes(y.dataType||"")){if(["in","nin"].includes(w.method)||["eq","ne"].includes(w.method))return"j-select"}else{if(["dateTime"].includes(y.type||""))return["formula"].includes(w.method)?"j-select":"j-date";if(["number"].includes(y.type||""))return"j-number"}return"j-input"},getCompConfig:({row:w})=>{if(["empty","not_empty"].includes(w.method||""))return{display:!1};const y=r.columns.find(E=>E.id===w.field)?.config||{},C={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(w.method||"")&&(C.multiple=!0,C.collapseTags=!0,C.collapseTagsTooltip=!0),["options","dataItem"].includes(y.dataType||"")?(C.collapseTags=!0,C.collapseTagsTooltip=!0,C.dataType=y.dataType,C.dataCode=y.dataCode,C.options=y.options):["switch"].includes(y.dataType||"")?(C.options=[],C.dataType="options",y.activeValue==null?C.options.push({label:"是",value:"1"}):C.options.push({label:"是",value:y.activeValue}),y.inactiveValue==null?C.options.push({label:"否",value:"0"}):C.options.push({label:"否",value:y.inactiveValue})):["dateTime"].includes(y.type||"")&&(["formula"].includes(w.method)?(C.placeholder="",C.options=[{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"明天",value:"tomorrow"},{label:"最近7天",value:"last7days"},{label:"最近30天",value:"last30days"},{label:"本周",value:"thisWeek"},{label:"上周",value:"lastWeek"},{label:"下周",value:"nextWeek"},{label:"本月",value:"thisMonth"},{label:"上月",value:"lastMonth"},{label:"下月",value:"nextMonth"},{label:"本季度",value:"thisQuarter"},{label:"上季度",value:"lastQuarter"},{label:"下季度",value:"nextQuarter"},{label:"今年",value:"thisYear"},{label:"去年",value:"lastYear"},{label:"明年",value:"nextYear"}],C.dataType="options"):(C.selectType="datetime",["range"].includes(w.method)?(C.selectType="datetimerange",C.startPlaceholder="开始时间",C.endPlaceholder="结束时间",C.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):C.placeholder="")),C},config:{style:{width:l.value?"246px":"296px",flex:l.value?"auto":"1"},appendTo:l.value?void 0:".j-filter-panel"}}];(0,n.onMounted)(()=>{s.value=r.searchFieldList});const f=(0,n.computed)(()=>r.columns.filter(w=>!w.children?.length&&!w.config?.isNotFilter).map(w=>({label:w.config?.label,value:w.id,dataType:w.config?.dataType,options:w.config?.options}))),p=(0,n.computed)(()=>s.value.map(w=>w.field)),u=({data:w})=>{if(p.value.includes(w.value))return;const y=r.columns.find(b=>b.id===w.value)?.config||{};let C="eq",E="text";["options","dataItem"].includes(y.dataType||"")?C="in":["dateTime"].includes(y.type||"")&&(C="range",E="dateTime"),s.value.push({field:w.value,method:C,type:y.valueType||E})},h=o,g=()=>{s.value.length=0},m=()=>{l.value?h("filter"):h("close",!0)},v=()=>{s.value.forEach(w=>{w.value=void 0}),h("filter")};return t({getSearchFields:()=>s.value}),(w,y)=>{const C=(0,n.resolveComponent)("j-icon"),E=(0,n.resolveComponent)("j-select"),b=(0,n.resolveComponent)("j-button-select"),k=(0,n.resolveComponent)("j-button"),S=(0,n.resolveComponent)("j-input-rows"),_=(0,n.resolveComponent)("el-tooltip");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-filter-panel",{"is-pin":l.value}])},[l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",O0,[(0,n.createVNode)(C,{icon:"mdi:filter-outline"}),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",L0,[(0,n.createElementVNode)("div",I0,[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选出符合以下")),1),(0,n.createElementVNode)("div",D0,[(0,n.createVNode)(E,{modelValue:i.value,"onUpdate:modelValue":y[0]||(y[0]=T=>i.value=T),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("条件的数据")),1)]),(0,n.createElementVNode)("div",F0,[(0,n.createVNode)(b,{label:"添加过滤条件",options:f.value,"model-value":p.value.join(","),onChange:u},null,8,["options","model-value"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(k,{key:0,type:"text",danger:"",label:"删除全部",onClick:g})):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",$0,[(0,n.createVNode)(S,{modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=T=>s.value=T),columns:c,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),(0,n.createVNode)(_,{placement:"bottom",content:l.value?(0,n.unref)(a)("取消固定"):(0,n.unref)(a)("固定显示")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"pin-btn",onClick:d},[(0,n.createVNode)(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,n.createElementVNode)("div",W0,[(0,n.createVNode)(k,{label:(0,n.unref)(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),(0,n.createVNode)(k,{label:(0,n.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:v},null,8,["label"])])],2)}}}),ds=U0,J0={class:"j-order-panel"},Y0={class:"content"},G0={class:"btn-wrapper"},K0={class:"field-wrapper"},q0={class:"buttons"},X0=(0,n.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=Ge(),r=e,i=o,l=(0,n.computed)(()=>r.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,n.ref)([]),d=(0,n.computed)(()=>s.value.map(g=>g.value)),c=[{id:"label",type:"j-title",getCompConfig:({row:g})=>({title:g?.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],f=({data:g})=>{d.value.includes(g.value)||s.value.push({label:g.label,value:g.value,sord:"ASC"})},p=g=>{s.value=JSON.parse(JSON.stringify(g))},u=()=>{i("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],i("clear")};return t({init:p}),(g,m)=>{const v=(0,n.resolveComponent)("j-button-select"),x=(0,n.resolveComponent)("j-input-rows"),w=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",J0,[(0,n.createElementVNode)("div",Y0,[(0,n.createElementVNode)("div",G0,[(0,n.createVNode)(v,{label:"添加排序规则",options:l.value,"model-value":d.value.join(","),onChange:f},null,8,["options","model-value"])]),(0,n.createElementVNode)("div",K0,[(0,n.createVNode)(x,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=y=>s.value=y),columns:c,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),(0,n.createElementVNode)("div",q0,[(0,n.createVNode)(w,{label:(0,n.unref)(a)("排序"),type:"primary",onClick:u},null,8,["label"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(w,{key:0,label:(0,n.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,n.createCommentVNode)("",!0)])])}}}),Z0=X0,Q0={class:"j-column-panel"},em={class:"content"},tm={class:"search-wrapper"},nm={class:"tree-wrapper"},om={class:"buttons"},am=(0,n.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=Ge(),r=e,i=o,l=(0,n.ref)(),s=(0,n.ref)(""),d={},c=(0,n.ref)([]),f=(0,n.ref)([]),p=(b,k)=>{const S=[],_=new Map;b.forEach(V=>{_.set(V.id||"",V),d[V.id||""]=V});const T=new Set;return k&&k.length>0&&k.forEach(V=>{const j=_.get(V.id);if(j){T.add(j.id||"");const z={id:j.id||"",label:j.config?.label||j.id||"",type:j.type,display:j.config?.display!==!1};j.children&&j.children.length>0&&(z.children=p(j.children,V.children)),S.push(z)}}),b.forEach(V=>{if(!T.has(V.id||"")){const j={id:V.id||"",label:V.config?.label||V.id||"",type:V.type,display:V.config?.display!==!1};V.children&&V.children.length>0&&(j.children=p(V.children)),S.push(j)}}),S},u=(b,k)=>k.length===0?b:b.map(S=>{const _=k.some(V=>S.label.toLowerCase().includes(V.toLowerCase())),T=S.children?u(S.children,k):[];return _||T.length>0?{...S,children:T.length>0?T:S.children}:null}).filter(Boolean),h=(0,n.computed)(()=>{if(!s.value)return f.value;const b=s.value.split(/\s+/).filter(Boolean);return u(f.value,b)}),g=(0,n.ref)([]),m=(0,n.computed)(()=>{const b=new Map;if(r.columnConfig&&r.columnConfig.length>0){const k=S=>{S.forEach(_=>{b.set(_.id,_),_.children&&k(_.children)})};k(r.columnConfig)}return b}),v=()=>{const b=k=>{const S=[];return k.forEach(_=>{let T=!0;if(m.value.size>0){const V=m.value.get(_.id||"");V?T=V.display:T=_.config?.display!==!1}else T=_.config?.display!==!1;T&&(S.push(_.id||""),_.children&&S.push(...b(_.children)))}),S};g.value=b(r.columns)},x=(b,{node:k})=>{b.includes(k.id)?g.value.push(k.id):g.value=g.value.filter(S=>S!==k.id)},w=(b,k,S)=>S==="inner"?!1:b.parent===k.parent,y=()=>{const b=k=>k.map(S=>{const _={...S,display:g.value.includes(S.id)};return S.children&&(_.children=b(S.children)),_});i("save",b(f.value))},C=()=>{if(v(),f.value=JSON.parse(JSON.stringify(c.value)),s.value="",l.value){const b=l.value;b.setCheck&&b.setCheck(g.value);const k=b.$refs?.treeRef||b;k?.setCheckedKeys&&k.setCheckedKeys(g.value)}i("save",void 0)};return t({init:()=>{v(),c.value=p(r.columns,r.columnConfig),f.value=JSON.parse(JSON.stringify(c.value))}}),(b,k)=>{const S=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("el-input"),T=(0,n.resolveComponent)("j-tree"),V=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Q0,[(0,n.createElementVNode)("div",em,[(0,n.createElementVNode)("div",tm,[(0,n.createVNode)(_,{modelValue:s.value,"onUpdate:modelValue":k[0]||(k[0]=j=>s.value=j),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(S,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",nm,[(0,n.createVNode)(T,{ref_key:"treeRef",ref:l,list:h.value,"is-tree-data":!0,"default-checked-keys":g.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":w,check:x},null,8,["list","default-checked-keys","draggable"])])]),(0,n.createElementVNode)("div",om,[(0,n.createVNode)(V,{label:(0,n.unref)(a)("确定"),type:"primary",onClick:y},null,8,["label"]),(0,n.createVNode)(V,{label:(0,n.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),rm=am,im={class:"j-table-panel-left"},lm={class:"j-table-panel-top"},sm={class:"j-table-panel-top-right"},cm={key:0,style:{width:"200px"}},dm={class:"j-table-panel-main"},um={class:"j-table-panel-loading"},fm={class:"j-table-panel-loading-content"},pm={class:"j-table-panel-loading-text"},hm={key:0,class:"j-table-panel-filter-panel"},gm=(0,n.defineComponent)({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},parentKey:{type:String,default:""},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},selectStateKey:{type:String,default:""},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},subColumns:{type:Array,default:()=>[]},isSubShowNumber:{type:Boolean,default:!0},subActions:{type:Array,default:()=>[]},loadChildren:{type:Function,default:null},rowKey:{type:String,default:void 0},sort:String,buttons:{type:Array,default:()=>[]},batchButtons:{type:Array,default:()=>[]},actions:{type:Array,default:()=>[]},actionsMaxCount:{type:Number,default:3},actionsLabel:{type:String,default:"操作"},actionFilter:{type:Function,default:null},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"},showFilterButton:{type:Boolean,default:!0},showOrderButton:{type:Boolean,default:!0},showColumnButton:{type:Boolean,default:!0},showRefreshButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=Ge(),{openLayer:r}=no(),i=e,l=o;i.isMultiple&&!i.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,n.ref)();let d=[];const c=(0,n.ref)(0),f=(0,n.ref)(1);let p=i.pageSize||100;const u=(0,n.ref)(0),h=(0,n.computed)(()=>u.value>0),g=(0,n.ref)([]),m=(0,n.ref)(!1),v=(0,n.computed)(()=>i.batchButtons&&i.batchButtons.length>0),x=(0,n.computed)(()=>g.value.length>0),w=(0,n.computed)(()=>v.value&&x.value&&i.isMultiple||m.value),y=(0,n.computed)(()=>i.isPage&&!w.value);v.value&&!i.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const C=pe=>i.rowKey?i.rowKey.split(",").map(Ce=>pe[Ce.trim()]).join("::"):"",E=(pe,Ce)=>{if(!Ce||Ce.length===0)return pe.filter(ce=>ce.config?.display!==!1).map(ce=>ce.children&&ce.children.length>0?{...ce,children:E(ce.children)}:ce);const Xe=new Map(pe.map(ce=>[ce.id,ce])),Ue=[];return Ce.forEach(ce=>{const Ze=Xe.get(ce.id);if(Ze){if(ce.display){let kt=Ze;Ze.children&&Ze.children.length>0&&(kt={...Ze,children:E(Ze.children,ce.children)}),Ue.push(kt)}Xe.delete(ce.id)}}),pe.forEach(ce=>{if(Xe.has(ce.id)&&ce.config?.display!==!1){let Ze=ce;ce.children&&ce.children.length>0&&(Ze={...ce,children:E(ce.children)}),Ue.push(Ze)}}),Ue},b=(0,n.computed)(()=>E(i.columns,Ae.value)),k=(0,n.computed)(()=>$i(i.columns,pe=>pe.config.label)),S=(0,n.ref)(""),_=(0,n.computed)(()=>k.value.some(pe=>pe.config?.filter?.isSearchKeyword)),T=(0,n.ref)(),V=(0,n.ref)(!0),j=(0,n.ref)([]),z=(0,n.computed)(()=>V.value?"搜索全部":`搜索范围:${k.value.filter(pe=>j.value.includes(pe.id)).map(pe=>pe.config?.label).join("、")}`),L=()=>{T.value.init()},M=(0,n.ref)(),B=(0,n.ref)(!1),D=(0,n.ref)(!1),U=(0,n.ref)(!1),te=(0,n.ref)([]),le=(0,n.ref)("and"),A=(0,n.ref)(),I=(0,n.ref)(!1),W=(0,n.ref)([]),N=()=>{A.value.init(W.value)},he=pe=>{W.value=pe,I.value=!1,ne()},_e=()=>{W.value=[],ne()},ue=(0,n.ref)(),Te=(0,n.ref)(!1),Ae=(0,n.ref)(),Q=(0,n.computed)(()=>Ae.value!=null),ge=()=>{ue.value?.init()},be=pe=>{Ae.value=pe,Te.value=!1},ke=(0,n.ref)(!1),lt=()=>{ke.value=!ke.value},et=()=>{g.value=[],s.value&&(s.value.setSelection?.([]),m.value&&(m.value=!1,s.value.setRecords(d)))},Ve=()=>{m.value=!m.value,m.value?s.value?.setRecords(g.value):(console.log(d,"tableData"),s.value?.setRecords(d)),s.value?.setSelection?.(g.value)},Ct=(0,n.computed)(()=>{if(g.value.length>0&&i.isMultiple){const pe=[{id:"selection_count",label:`已选${g.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:m.value?"全部":"仅选中",config:{type:"text"},click:Ve},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:et}],Ce=i.batchButtons.map(Xe=>({...Xe,click:()=>{Xe.click&&Xe.click({data:g.value,openLayer:r})}}));return[...pe,...Ce]}return i.buttons}),jt=(0,n.computed)(()=>Ct.value.filter(pe=>pe.config?.display!==!1)),xt=(0,n.ref)(null),dt=(0,n.ref)(0),ut=()=>{dt.value=xt.value?.clientWidth||0};let $e;(0,n.onMounted)(()=>{(0,n.nextTick)(ut),$e=new ResizeObserver(()=>{ut()}),xt.value&&$e.observe(xt.value)}),(0,n.onBeforeUnmount)(()=>{$e?.disconnect()}),(0,n.watch)(()=>jt.value,()=>{(0,n.nextTick)(ut)},{deep:!0}),(0,n.watch)(ke,()=>{(0,n.nextTick)(ut)});const mt=(0,n.computed)(()=>{const pe=jt.value;if(pe.length===0)return[];const Ce=dt.value;if(Ce<=0)return pe;const Xe=Math.max(0,Ce-4),Ue=(Me,st)=>Me.groupId||`__auto_${st}`,ce=Me=>{if(Me.config?.notLabel===!0||!Me.label)return 28;const st=24,Rt=Mt(Me.label||"")||0,Tt=Me.config?.icon?18:0;return Math.ceil(Rt+st+Tt+2)};if((Me=>{let st=0,Rt=null;return Me.forEach((Tt,An)=>{const Za=Ue(Tt,An);Rt!==null&&(st+=Za===Rt?-1:8),st+=ce(Tt),Rt=Za}),st})(pe)<=Xe)return pe;const kt={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},ft=28,Et=[];let Ne=0,Pt=null;for(let Me=0;Me<pe.length;Me++){const st=pe[Me],Rt=Ue(st,Me);let Tt=Ne;Pt!==null&&(Tt+=Rt===Pt?-1:8),Tt+=ce(st);const An=pe.length-(Me+1)>0?(Tt>0?8:0)+ft:0;if(Tt+An<=Xe)Et.push(st),Ne=Tt,Pt=Rt;else break}const Mn=pe.slice(Et.length);if(Mn.length===0)return pe;const Kn={...kt,children:Mn};return Et.length===0?[Kn]:[...Et,Kn]});let Xt;const J=async pe=>{u.value++;const Ce={};pe&&(Xt=pe),Xt&&(Ce.query=Xt);try{const Xe={};Xe.rel=le.value,Xe.cond=(M.value?.getSearchFields?.()||te.value).filter(ce=>ce.value!==void 0&&ce.value!==null&&ce.value!==""||["empty","not_empty"].includes(ce.method)).map(ce=>({field:ce.field,method:ce.method,value:ce.value,type:ce.type})),Xe.cond.length>0?U.value=!0:U.value=!1,Ce.filter=Xe;const Ue=W.value.map(ce=>ce.value+" "+ce.sord).join(",");if(S.value&&(Ce.keyword={value:S.value,fields:V.value?k.value.filter(ce=>ce.config?.filter?.isSearchKeyword).map(ce=>ce.id):(0,n.unref)(j)}),i.loadData){if(i.isPage){Ce.pagination={rows:p,page:f.value,sort:Ue||i.sort||i.rowKey};const ce=await i.loadData(Ce)||{};d=ce.rows||[],c.value=ce.records||0}else Ce.sort=Ue,d=await i.loadData(Ce)||[],c.value=d.length;s.value.setRecords(d),v.value?(g.value=[],m.value=!1):i.rowKey&&g.value.length>0&&s.value?.setSelection?.(g.value)}}finally{u.value=Math.max(0,u.value-1)}},ne=async()=>{f.value=1,await J()},q=({rows:pe,page:Ce})=>{p=pe,f.value=Ce,J()},Z=async()=>{g.value=[],m.value=!1,f.value=1,Xt=void 0,await J()},ie=async pe=>{g.value=[],m.value=!1,await J(pe)},we=async()=>{await Z()},Se=pe=>{l("ready",pe)},Le=({selections:pe,record:Ce,checked:Xe,isMultiple:Ue})=>{let ce=[];if(!i.isMultiple){g.value=pe,l("select",{selections:pe,record:Ce,checked:Xe,isMultiple:Ue});return}if(v.value)ce=pe;else if(!i.rowKey)ce=pe;else{const Ze=new Map(pe.map(ft=>[C(ft),ft])),kt=new Map(g.value.map(ft=>[C(ft),ft]));d.forEach(ft=>{const Et=C(ft);Ze.has(Et)?kt.set(Et,Ze.get(Et)):kt.delete(Et)}),ce=Array.from(kt.values())}g.value=ce,l("select",{selections:ce,record:Ce,checked:Xe,isMultiple:Ue}),m.value&&ce.length===0?(m.value=!1,s.value&&s.value.setRecords(d)):m.value&&ce.length>0&&s.value&&(s.value.setRecords(ce),s.value.setSelection?.(ce))},ot=pe=>{g.value=pe},We=()=>g.value||[],Zt=pe=>{g.value=pe,s.value?.setSelection?.(pe)},Qt=()=>s.value;return(0,n.onMounted)(async()=>{i.immediate&&await ie()}),t({refreshData:ie,resetData:Z,getSelection:We,setSelection:Zt,clearSelection:()=>{et()},getTableRef:Qt}),(pe,Ce)=>{const Xe=(0,n.resolveComponent)("j-buttons"),Ue=(0,n.resolveComponent)("j-icon"),ce=(0,n.resolveComponent)("el-popover"),Ze=(0,n.resolveComponent)("el-tooltip"),kt=(0,n.resolveComponent)("el-input"),ft=(0,n.resolveComponent)("j-button"),Et=(0,n.resolveComponent)("j-table");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-table-panel-wrapper",{fullscreen:ke.value,"no-padding":e.noPadding||ke.value}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":ke.value}])},[(0,n.createElementVNode)("div",im,[(0,n.createElementVNode)("div",lm,[(0,n.createElementVNode)("div",{ref_key:"topLeftRef",ref:xt,class:"j-table-panel-top-left"},[(0,n.createVNode)(Xe,{list:mt.value},null,8,["list"])],512),(0,n.createElementVNode)("div",sm,[_.value&&!w.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",cm,[(0,n.createVNode)(kt,{modelValue:S.value,"onUpdate:modelValue":Ce[2]||(Ce[2]=Ne=>S.value=Ne),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,n.withKeys)(ne,["enter"]),onClear:ne},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(Ue,{icon:"mdi:search"})]),suffix:(0,n.withCtx)(()=>[(0,n.createVNode)(Ze,{placement:"bottom",content:z.value},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(ce,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:L,onHide:ne},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Ue,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(z0,{ref_key:"keywordPanelRef",ref:T,"check-all":V.value,"onUpdate:checkAll":Ce[0]||(Ce[0]=Ne=>V.value=Ne),"check-fields":j.value,"onUpdate:checkFields":Ce[1]||(Ce[1]=Ne=>j.value=Ne),columns:k.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),e.showFilterButton&&!B.value&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(ce,{key:1,visible:D.value,"onUpdate:visible":Ce[6]||(Ce[6]=Ne=>D.value=Ne),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:ne},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,n.normalizeClass)({active:U.value})},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(ds,{ref_key:"filterPanelRef",ref:M,"is-pin":B.value,"onUpdate:isPin":Ce[3]||(Ce[3]=Ne=>B.value=Ne),relation:le.value,"onUpdate:relation":Ce[4]||(Ce[4]=Ne=>le.value=Ne),"search-field-list":te.value,columns:k.value,onFilter:ne,onClose:Ce[5]||(Ce[5]=Ne=>D.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):(0,n.createCommentVNode)("",!0),e.showOrderButton&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:2,placement:"bottom",content:(0,n.unref)(a)("排序")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(ce,{visible:I.value,"onUpdate:visible":Ce[7]||(Ce[7]=Ne=>I.value=Ne),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:N},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{class:(0,n.normalizeClass)({active:W.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(Z0,{ref_key:"orderPanelRef",ref:A,columns:k.value,onSave:he,onClear:_e},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showColumnButton&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:3,placement:"bottom",content:(0,n.unref)(a)("显示字段")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(ce,{visible:Te.value,"onUpdate:visible":Ce[8]||(Ce[8]=Ne=>Te.value=Ne),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:ge},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{class:(0,n.normalizeClass)({active:Q.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(rm,{ref_key:"columnPanelRef",ref:ue,columns:e.columns,"column-config":Ae.value,onSave:be},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showRefreshButton&&!w.value?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:4,placement:"bottom",content:(0,n.unref)(a)("刷新")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{type:"text",icon:"mdi:refresh",onClick:we})]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)(Ze,{key:5,placement:"bottom",content:ke.value?(0,n.unref)(a)("退出全屏"):(0,n.unref)(a)("全屏")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(ft,{type:"text",icon:ke.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:lt},null,8,["icon"])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0)])]),(0,n.createElementVNode)("div",dm,[(0,n.withDirectives)((0,n.createElementVNode)("div",um,[(0,n.createElementVNode)("div",fm,[(0,n.createVNode)(Ue,{icon:"mdi:loading",class:"loading-spin",size:24}),(0,n.createElementVNode)("div",pm,(0,n.toDisplayString)((0,n.unref)(a)("加载中")),1)])],512),[[n.vShow,h.value]]),(0,n.createVNode)(Et,{ref_key:"tableRef",ref:s,"table-page":f.value,"onUpdate:tablePage":Ce[9]||(Ce[9]=Ne=>f.value=Ne),columns:b.value,"sub-columns":e.subColumns,records:(0,n.unref)(d),"is-tree":e.isTree,"default-expand-all":e.defaultExpandAll,"parent-key":e.parentKey,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"select-state-key":e.selectStateKey,"is-page":y.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":c.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"action-filter":e.actionFilter,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,onLoadPageData:q,onReady:Se,onSelectionChanged:Le,onSelectRecordsChanged:ot},null,8,["table-page","columns","sub-columns","records","is-tree","default-expand-all","parent-key","is-show-number","is-sub-show-number","is-multiple","select-state-key","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","action-filter","highlight-mode","load-children"])])]),e.showFilterButton&&B.value&&!w.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",hm,[(0,n.createVNode)(ds,{ref_key:"filterPanelRef",ref:M,"is-pin":B.value,"onUpdate:isPin":Ce[10]||(Ce[10]=Ne=>B.value=Ne),relation:le.value,"onUpdate:relation":Ce[11]||(Ce[11]=Ne=>le.value=Ne),"search-field-list":te.value,columns:k.value,onFilter:ne},null,8,["is-pin","relation","search-field-list","columns"])])):(0,n.createCommentVNode)("",!0)],2)],2)}}}),mm=gm,Cr=de(mm),ym={class:"j-button-select"},vm={class:"search-wraper"},bm={class:"options-wraper"},wm=["onClick"],Cm=(0,n.defineComponent)({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=Ge(),i=(0,n.ref)(""),l=(0,n.computed)(()=>i.value===""?o.options:o.options.filter(c=>(c.label||"").includes(i.value))),s=(0,n.computed)(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),d=c=>{if(c.disabled||s.value.includes(c.value))return;const f=[...s.value,c.value].join(",");a("update:modelValue",f),a("change",{value:f,data:c})};return(c,f)=>{const p=(0,n.resolveComponent)("j-button"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-input"),g=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(p,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",ym,[(0,n.createElementVNode)("div",vm,[(0,n.createVNode)(h,{modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=m=>i.value=m),modelModifiers:{trim:!0},placeholder:(0,n.unref)(r)("搜索"),class:"no-border",clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(u,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",bm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l.value,m=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:m.value,class:(0,n.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,n.withModifiers)(v=>d(m),["stop"])},[m.icon?((0,n.openBlock)(),(0,n.createBlock)(u,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(r)(m.label)),1)],10,wm))),128))])])]),_:1},8,["width"])}}}),xm=Cm,us=de(xm),km={class:"j-tree-item-text"},Sm={key:2,class:"j-tree-item-button-group"},Em={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},_m=(0,n.defineComponent)({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,check:Function,emptyDes:{type:String,default:"暂无数据"},defaultIcon:{type:String,default:""},defaultIconColor:{type:String,default:""},treeButtons:{type:Array,default:()=>[]},filterButton:Function,buttonDefaultIcon:{type:String,default:""},buttonIconColor:{type:String,default:""},runFlow:{type:Function},nodeClickFlow:{type:String},isHeightAuto:{type:Boolean,default:!1},theme:{type:String,default:"default"},draggable:{type:Boolean,default:!1},expandOnClickNode:{type:Boolean,default:!1},allowDrop:Function},emits:["node-drop"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:i,t:l}=Ge(),{getDataByComp:s,loadDataByComp:d}=i(),c=(0,n.ref)(),f=(0,n.ref)(!1),p=(0,n.ref)(""),u=(0,n.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,n.computed)(()=>s?s({config:a})||[]:[]),m=(0,n.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,n.unref)(a.list):u.value),v=async()=>{f.value=!0,a.loadData&&(u.value=await a.loadData()||[]),d&&await d({type:"j-tree",config:a}),f.value=!1,(0,n.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},x=(L,M=!0)=>{c.value?.setCurrentKey(L,M)},w=()=>c.value?.getCurrentKey(),y=(L,M=!1)=>{c.value?.setCheckedKeys(L,M)},C=(L=!1)=>c.value?.getCheckedKeys(L),E=async(L,M,B,D)=>{if(p.value=L.value,a.nodeClickFlow&&a.runFlow){const U=JSON.parse(a.nodeClickFlow);await a.runFlow(U,{value:L.value})}a.click&&a.click(L.value,L,D)},b=(L,{checkedKeys:M,checkedNodes:B,halfCheckedKeys:D,halfCheckedNodes:U})=>{a.check&&a.check(M,{node:L,checkedNodes:B,halfCheckedKeys:D,halfCheckedNodes:U})},k=(L,M,B,D)=>{r("node-drop",L,M,B,D)},S=L=>{const M=Vt(a.treeButtons);return L&&a.filterButton?a.filterButton({buttons:M,node:L}):M},{openLayer:_}=no(),T=(L,M)=>{L.config?.disabled||L.click&&L.click({data:M,openLayer:_})},V=(0,n.ref)(""),j=(L,M)=>{V.value=L?M.value:"",console.log(V.value,"row")},z=(L,M,B)=>a.allowDrop?a.allowDrop(L,M,B):!(B=="inner"&&!M.data.canInner);return(0,n.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await v()}),(0,n.watch)(()=>a.dataCode||a.dataType,()=>{v()}),t({refreshData:v,setValue:x,getValue:w,setCheck:y,getCheck:C}),(L,M)=>{const B=(0,n.resolveComponent)("j-icon"),D=(0,n.resolveComponent)("j-button"),U=(0,n.resolveComponent)("el-dropdown-item"),te=(0,n.resolveComponent)("el-dropdown-menu"),le=(0,n.resolveComponent)("el-dropdown"),A=(0,n.resolveComponent)("el-tree"),I=(0,n.resolveComponent)("el-empty"),W=(0,n.resolveDirective)("loading");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!f.value&&m.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(A,{key:0,ref_key:"treeRef",ref:c,"node-key":"value","default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":p.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":z,"expand-on-click-node":e.expandOnClickNode,onNodeClick:E,onCheck:b,onNodeDrop:k},{default:(0,n.withCtx)(({node:N})=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-tree-item-wraper",{"is-focus":V.value===N.data.value}])},[N.data.openIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,class:"j-tree-item-open-icon",size:18,icon:N.data.openIcon,color:N.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),N.data[e.iconKey]||e.defaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:1,class:"j-tree-item-default-icon",size:18,icon:N.data[e.iconKey]||e.defaultIcon||"",color:N.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",km,(0,n.toDisplayString)(N.label),1),S(N.data).length?((0,n.openBlock)(),(0,n.createElementBlock)("div",Sm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(S(N.data),(he,_e)=>((0,n.openBlock)(),(0,n.createBlock)(le,{key:_e,trigger:"click",onVisibleChange:ue=>j(ue,N.data)},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(te,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(he.children,(ue,Te)=>((0,n.openBlock)(),(0,n.createBlock)(U,{key:Te,disabled:ue.disabled,divided:ue.divided,onClick:(0,n.withModifiers)(Ae=>T(ue,N.data),["stop"])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"j-flex-item",style:(0,n.normalizeStyle)({color:ue.danger?"var(--j-color-danger)":ue.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ue.icon||e.buttonDefaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,icon:ue.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(l)(ue.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(D,{icon:he.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,n.createCommentVNode)("",!0)],2)]),_:1},8,["default-checked-keys","default-expanded-keys","current-node-key","data","default-expand-all","show-checkbox","highlight-current","accordion","filter-node-method","render-after-expand","draggable","expand-on-click-node"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",Em,[(0,n.createVNode)(I,{description:(0,n.unref)(l)(e.emptyDes)},null,8,["description"])]))],2)),[[W,f.value]])}}}),Bm=_m,fs=de(Bm),Rm=(0,n.defineComponent)({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:""},valueKey:{default:""},pidKey:{default:""},idKey:{default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,{useData:a}=Ge(),{getDataByComp:r}=a(),i=(0,n.computed)(()=>r?r({type:"j-tree-select",config:o})||[]:[]),l=(0,n.computed)(()=>o.options?o.options:o.dataCode||o.dataType?i.value:[]),s=t,d=(0,n.computed)({get(){return o.modelValue},set(f){s("update:modelValue",f)}}),c=f=>{s("change",f)};return(f,p)=>{const u=(0,n.resolveComponent)("el-tree-select");return(0,n.openBlock)(),(0,n.createBlock)(u,{modelValue:d.value,"onUpdate:modelValue":p[0]||(p[0]=h=>d.value=h),style:{width:"100%"},data:l.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:c},null,8,["modelValue","data","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}}),Tm=Rm,ps=de(Tm),hs=de(Nl),Vm=cr.default;async function Mm(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const r=new Vm({[e]:[a]});let i=[];try{await r.validate({[e]:t})}catch(l){l.errors?i=l.errors.map(({message:s})=>s):i=[a.message||"校验错误"]}return i.length>0?i[0]:""}async function Am(e,t,o){const a=o.map((r,i)=>({...r,ruleIndex:i})).sort(({warningOnly:r,ruleIndex:i},{warningOnly:l,ruleIndex:s})=>!!r==!!l?i-s:r?1:-1);for(let r=0;r<a.length;r+=1){const i=a[r];"pattern"in i&&(t+="");const l=await Mm(e,t,i);if(l!=="")return{name:e,errors:l}}}function Nm(e,t){const o=(i,l,s,d,c)=>{Object.keys(l).forEach(f=>{let p=f;s&&(p=`${s}.${f}`);const u=l[f],{rules:h,myGridtableId:g}=t(p,s?l:void 0,()=>d,c);if(h.length){const m=a(p,u,h);i.push(m)}g&&u.forEach(m=>{o(i,m,g,u,s?l:void 0)})})},a=(i,l,s)=>Am(i,l,s);return{validateForm:async()=>{const i=(0,n.unref)(e),l=[];o(l,i,"");const s=await Promise.all(l),d={};return s.forEach(c=>{c&&(d[c.name]={msg:c.errors})}),d},validateField:a}}var jm=({data:e,actions:t,utils:o,inputParams:a,notRunActions:r})=>{const i=s=>e.filter(d=>d.source===s).map(d=>d.target),l=async s=>{s=s||"start";const d=e.find(c=>c.id===s);if(d.config.type==="start"){const c=i(s);for(let f=0;f<c.length;f++)await l(c[f])}else{const c=t[d.config.type];c&&await c(d.config,o,async f=>{if(f=f||{},f.nodeId=s,f.next!==!1){const p=i(f.nodeId);for(let u=0;u<p.length;u++)await l(p[u])}},a,f=>{r[f]={data:e,inputParams:a}})}};return{run:l}},Pm=(0,n.defineComponent)({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1},actions:{type:Object,default:()=>({})}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:i,existField:l,httpGet:s,httpPost:d,success:c,warning:f,error:p,info:u,t:h}=Ge();let g;i&&(g=i());const m=J=>{p&&p(J)},v=(0,n.ref)(!1),x=(0,n.computed)(()=>a.config?.gutter||16),w=(0,n.computed)(()=>a.config?.span||24),y=(0,n.computed)(()=>a.config?.labelWidth),C=(0,n.computed)(()=>a.config?.labelPosition||"right"),E=(0,n.computed)(()=>S.length===1&&(S[0].type==="j-tabs"||S[0].type==="j-layout"||S[0].config?.isAutoWindow)),b=(0,n.reactive)({}),k=(0,n.ref)({}),S=[],_={};let T={},V={},j=[],z={};const L=async J=>{v.value&&D&&(J.getTableData||pr(D,J.id,J.formData[J.id])),r("change",J),_[J.id]?.config?.codeChange&&await mt(JSON.parse(_[J.id]?.config?.codeChange),{param:J}),a.config?.codeChange&&await mt(JSON.parse(a.config?.codeChange),{param:J})},M=J=>ia(_[J]?.type||"")&&!_[J]?.config?.notInput||_[J]?.config?.isInput,B=J=>["j-table","j-input-rows","j-input-cards"].includes(_[J]?.type||"");let D;const U=(J,ne)=>{Object.keys(J).forEach(q=>{const Z=J[q];ne&&(q=ne+"."+q),Z!=null&&typeof Z=="object"&&!oa(Z)&&U(Z,q),b[q]=Z})},te=(J,ne)=>{let q=J.id;return q||(J.config?.table&&J.config?.field?q=`${J.config.table}.${J.config.field}`:J.config?.table?q=J.config?.table:J.config?.field&&(q=J.config?.field),ne&&B(ne)&&(q=`${ne}.${q}`)),q||ra("j")},le=(J,ne,q,Z="")=>{J.forEach(ie=>{ie.id=te(ie,Z);const we={id:ie.id,slot:ie.slot,type:ie.type||"",getCompType:ie.getCompType,getCompConfig:ie.getCompConfig,config:{},children:[]};ne.push(we);const{children:Se}=ie;ko(we,ie,["children","config"]),ko(we.config,ie.config||{},[]),_[ie.id]&&console.warn("有重复的组件id:"+ie.id),_[ie.id]=we,a.readonly===!0&&(we.config.readonly=!0);let Le=!1,ot;Z!==""&&B(Z)&&(Le=!0,we.config=ie.config||{},we.config.parentTableId=Z,ot=_[Z]?.config?.table);const We=we.config||{};if(M(ie.id))!q&&Le===!1&&(We?.defaultValue===0?b[ie.id]=We?.defaultValue:b[ie.id]=We?.defaultValue||void 0),We.table&&We.field?T[`${We.table}_${We.field}`.toLowerCase()]=ie.id:We.field&&(Le?T[`${ot}_${We.field}`.toLowerCase()]=ie.id:T[`${We.field}`.toLowerCase()]=ie.id);else if(Le&&We.field)T[`${ot}_${We.field}`.toLowerCase()]=ie.id;else if(B(ie.id))!q&&!We.isSubTable&&(b[ie.id]=[]),We.table&&(T[We.table.toLowerCase()||""]=ie.id),We.isSubTable||j.push(we);else if(We?.defaultValue)b[ie.id]=We?.defaultValue;else if(ie.type==="collapse"&&We?.isExpand){const Zt=[];(We?.groups||[]).forEach(Qt=>{Zt.push(Qt.i)}),b[ie.id]=Zt}Se&&Se.length>0&&le(Se,we.children,q,we.id)})},A=async(J,ne)=>{v.value=!1;const q=!!ne;S.splice(0,S.length),T={},V={},j=[],D=ne,eo(b),eo(_),q&&U(ne,""),le(J,S,q),z=Vt(b),await(0,n.nextTick)(),v.value=!0,await(0,n.nextTick)(),a.config?.codeInit&&await mt(JSON.parse(a.config?.codeInit),{param:{}})},I=(J,ne,q)=>{const Z=[];return ne.forEach(ie=>{const we={};Object.keys(ie).forEach(Se=>{if(!q||q(Se,ie[Se],J)){const Le=be(Se);if(Le?.type==="j-table")we[Le?.id||""]=I(Se,ie[Se],q);else{let ot=T[`${J}_${Se}`.toLowerCase()]||Se;ot=ot.indexOf(".")!==-1?ot.split(".")[1]:ot,we[ot]=ie[Se]}}}),Z.push(we)}),Z},W=(J,ne)=>{Object.keys(J||{}).forEach(q=>{let Z=J[q];const ie=be(q);if(ie===void 0)Z&&(oa(Z)&&(Z=Z[0]||{}),typeof Z=="object"?Object.keys(Z).forEach(we=>{if(!ne||ne(q,Z[we],q)){let Se=we;q!=="main"&&(Se=`${q}_${we}`),V[Se]=q,b[T[Se.toLowerCase()]||we]=Z[we]}}):b[q]=Z);else if(B(ie.id||"")){if(!Array.isArray(Z)){console.warn("表格数据不是数组:"+q);return}Z?.length>0?b[T[q.toLowerCase()]||q]=I(q,Z,ne):b[T[q.toLowerCase()]||q]=[]}else(!ne||ne(q,Z,q))&&(b[T[q.toLowerCase()]||q]=Z)}),D&&Object.keys(b).forEach(q=>{const Z=be(q);(Z===void 0||!["j-tabs","j-collapse"].includes(Z.type||""))&&pr(D,q,b[q])})},N=new Set(["parentRow","_i","_compTypeByRender"]),he=(J,ne=!1)=>{const q={};return Object.keys(J).forEach(Z=>{if(N.has(Z))return;const ie=_[Z];if(ie){const we=ie.config?.table,Se=ie.config?.field;if(ne)Se?q[Se]=J[Z]:q[Z]=J[Z];else if(B(Z)){const Le=[];J[Z].forEach(ot=>{Le.push(he(ot,!0))}),q[we||Z]=Le}else we&&Se?(q[we]=q[we]||{},q[we][Se]=J[Z]):Se&&(q[Se]=J[Z])}else ne?Z!=="_X_ROW_KEY"&&Z!=="_isHover"&&(q[Z]=J[Z]):V[Z]?(q[V[Z]]=q[V[Z]]||{},q[V[Z]][Z.replace(`${V[Z]}_`,"")]=J[Z]):q[Z]=J[Z]}),q},_e=(J=!0)=>J?he(b):b,ue=(J,ne,q,Z)=>{let ie=_[J];if(ie==null){const Se=J.split(".");ie=_[Se[Se.length-1]]||{}}if(!ie)return{};const we=zt({config:ie.config||{},getCompConfig:ie.getCompConfig,formData:b,getTableData:q,row:ne,pRowData:Z});return we._componentId=ie?.id,we},Te=(J,ne,q,Z)=>{const ie=ue(J,ne,q,Z);if(ie.isNotRule!==!0&&ie.display!==!1){const we=ie.rule||[],Se=we.find(Le=>Le.type==="only");return Se&&(Se.validator=async(Le,ot)=>{if(ot&&!await l({table:Le.table,key:Le.key,keyName:Le.keyName,field:Le.field,keyValue:Le.getKeyValue?Le.getKeyValue():"",value:ot,paramNames:Le.paramNames,getParams:Le.getParams,withProjectId:Le.withProjectId,getValue:Le.getValue,formData:b}))throw h(Le.message)||h("数据值重复")}),{rules:we,myGridtableId:B(ie._componentId)?ie._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:Ae}=Nm(b,Te),Q=async()=>{k.value={};const J=await Ae();return Object.keys(J).length>0?(k.value=J,m(`${h(_[Object.keys(J)[0]]?.config?.label)}:${h(J[Object.keys(J)[0]].msg)}`),!1):!0},ge=()=>{k.value={},eo(b),Object.keys(z||{}).forEach(J=>{b[J]=z[J]})},be=J=>{let ne=_[J];return ne===void 0&&T[J.toLowerCase()]&&(ne=_[T[J.toLowerCase()]]),ne},ke=({id:J,i:ne,value:q,type:Z})=>{if(Z==="add")b[J].push(q);else if(Z==="delete")b[J].splice(ne,1);else{const ie=be(J);ie&&(ie.config.parentTableId?b[ie.config.parentTableId][ne][J]=q:b[J]=q)}},lt=({id:J,i:ne})=>{const q=be(J);if(q){if(q.config.parentTableId){const Z=b[q.config.parentTableId],ie=q.id?q.id.replace(`${q.config.parentTableId}.`,""):"";if(ne!=null)return(Z[ne]||{})[ie||""];const we=[];return Z&&Z.forEach(Se=>{we.push(Se[ie||""])}),we}if(B(q.id||"")){const Z=[];return b[q.id||""].forEach(ie=>{Z.push(he(ie,!0))}),Z}return b[q.id||""]}if(b[J])return b[J]},et=async({id:J,i:ne})=>{const q=lt({id:J,i:ne}),Z=be(J);if(Z&&g?.getLabel)if(ne!==void 0){const ie=q[ne],we=b[Z.config.parentTableId||""][ne],Se=zt({config:Z.config,getCompConfig:Z.getCompConfig,formData:b,tableData:b[Z.config.parentTableId||""],row:we});return await g?.getLabel({value:ie,config:Se,formData:b,tableData:b[Z.config.parentTableId||""],row:we})}else{const ie=zt({config:Z.config,getCompConfig:Z.getCompConfig,formData:b});return await g?.getLabel({value:q,config:ie,formData:b})}return q},Ve=async(J,ne)=>g?.loadViewDataList?await g?.loadViewDataList(J,ne,!1):[],Ct=J=>(J.set=ke,J.get=lt,J.setFormData=W,J.getFormData=_e,J.getLabel=et,J.getViewData=Ve,J.getDateNow=ne=>sa(new Date,ne||"YYYY-MM-DD HH:mm:ss"),J.httpGet=s||(()=>{console.log("当前状态不支持")}),J.httpPost=d||(()=>{console.log("当前状态不支持")}),J.loading=ne=>{Pn(ne)},J.showMsg=({text:ne,type:q})=>{switch(q){case"success":c&&c(ne);break;case"warning":f&&f(ne);break;case"error":p&&p(ne);break;case"info":u&&u(ne);break;default:u&&u(ne);break}console.log("showMsg",ne,q)},J),jt=async(J,ne)=>{if(J&&J.trim()){J=`async (jcode) => {${J}}`;const{res:q,fn:Z}=fr(J);q&&await Z(Ct(ne))}},xt=async()=>{a.config?.codeAfterSetData&&await mt(JSON.parse(a.config?.codeAfterSetData),{param:{}})},dt=async()=>{a.config?.codeBeforeSave&&await mt(JSON.parse(a.config?.codeBeforeSave),{param:{}})},ut=async()=>{a.config?.codeAfterSave&&await mt(JSON.parse(a.config?.codeAfterSave),{param:{}})};a.schema&&A(a.schema);const $e={},mt=async(J,ne)=>{const{run:q}=jm({data:J,actions:a.actions,utils:{showLoading:Pn,executeEvent:jt},inputParams:ne,notRunActions:$e});await q()};return mr({formData:b,components:_,errorFields:k,isAutoWindow:E,gutter:x,span:w,labelWidth:y,labelPosition:C,getValue:lt,formChange:L,runFlow:mt,runFlowByNotRunActions:async J=>{const ne=$e[J];ne&&(delete $e[J],await mt(ne.data,ne.inputParams))}}),vr({contextType:"form"}),t({init:A,reset:ge,validate:Q,setValue:ke,getValue:lt,getLabel:et,setFormData:W,getFormData:_e,afterSetData:xt,beforeSave:dt,afterSave:ut}),(J,ne)=>{const q=(0,n.resolveComponent)("j-form-item"),Z=(0,n.resolveComponent)("el-row"),ie=(0,n.resolveComponent)("el-form");return v.value?((0,n.openBlock)(),(0,n.createBlock)(ie,{key:0,class:(0,n.normalizeClass)(["j-form",e.isAutoSize&&"j-block",e.isAutoSize&&"j-form-auto"]),"label-position":C.value,"label-width":y.value,size:e.config?.size,onSubmit:ne[0]||(ne[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[E.value?((0,n.openBlock)(),(0,n.createBlock)(q,(0,n.mergeProps)({key:0},S[0],{"is-not-col":""}),null,16)):((0,n.openBlock)(),(0,n.createBlock)(Z,{key:1,gutter:x.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(S,we=>(0,n.createVNode)(q,(0,n.mergeProps)({key:we.id},{ref_for:!0},we),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,n.createCommentVNode)("",!0)}}}),Hm=Pm,gs=de(Hm),ms=de(Al),zm={class:"j-page"},Om=(0,n.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=(0,n.ref)(!1),r=(0,n.reactive)([]),i={},l=(0,n.reactive)({}),s=(g,m)=>{g.forEach(v=>{v.id=v.id||ra("c");const x={id:v.id,slot:v.slot,type:v.type||"",getCompConfig:v.getCompConfig,getCompType:v.getCompType},{children:w}=v;i[v.id]=x,x.config=[],ko(x.config,v.config||{},["defaultValue"]),v?.config?.defaultValue!==void 0&&(l[v.id]=v.config.defaultValue),m.push(x),w&&w.length>0&&(x.children=[],s(w,x.children))})},d=g=>{a.value=!1,r.splice(0,r.length),eo(i),eo(l),s(g,r),(0,n.nextTick)(()=>{a.value=!0})};o.schema&&d(o.schema);const c=new gr,f=new Map,p=(g,m,v,...x)=>{if(v?.immediate){const w=f.get(g)||new Map;w.set(m,x),f.set(g,w)}return c.emit(g,m,...x)},u=(g,m)=>{c.on(g,m);const v=f.get(g);v&&(f.delete(g),v.forEach((x,w)=>{m(w,...x||[])}))},h=(g,m)=>{c.off(g,m)};return pl({registerMethod:(g,m)=>(u(g,m),()=>{h(g,m)})}),vr({contextType:"page"}),t({init:d,call:p,on:u,off:h}),(g,m)=>{const v=(0,n.resolveComponent)("j-comp");return(0,n.openBlock)(),(0,n.createElementBlock)("div",zm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r,x=>((0,n.openBlock)(),(0,n.createBlock)(v,{key:x.id,id:x.id,type:x.type,config:x.config,children:x.children},null,8,["id","type","config","children"]))),128))])}}}),Lm=Om,ys=de(Lm),Im=(0,n.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)("");return(0,n.watch)(()=>o.modelValue,i=>{i?r.value=i:(r.value=an(),a("update:modelValue",r.value))},{immediate:!0}),(i,l)=>{const s=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(s,{modelValue:r.value,"onUpdate:modelValue":l[0]||(l[0]=d=>r.value=d),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),Dm=Im,vs=de(Dm),Fm={key:0,class:"j-panel-top"},$m=["title"],Wm={style:{margin:"0","font-size":"14px"}},Um={key:1},Jm={key:1,class:"j-panel-bottom"},Ym=(0,n.defineComponent)({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=no(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,r)=>{const i=(0,n.resolveComponent)("j-button"),l=(0,n.resolveComponent)("el-tooltip"),s=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-block",style:(0,n.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,n.createElementVNode)("div",{class:"j-panel",style:(0,n.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",Fm,[e.notTitle?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,n.renderSlot)(a.$slots,"title",{},()=>[(0,n.createElementVNode)("span",Wm,(0,n.toDisplayString)(e.title||""),1)])],8,$m)),e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("span",Um,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.toolBtns,d=>((0,n.openBlock)(),(0,n.createBlock)(l,{key:d.id,placement:"top",content:d.label||""},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(i,(0,n.mergeProps)({ref_for:!0},d.config,{onClick:c=>o(d),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"j-panel-body",style:(0,n.normalizeStyle)(e.bodyStyle)},[(0,n.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",Jm,[(0,n.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,n.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,n.createCommentVNode)("",!0)],4)],4)}}}),Gm=Ym,bs=de(Gm),Km={class:"j-input-rows"},qm={key:0,class:"j-input-rows-num"},Xm={key:1,class:"j-input-rows-char"},Zm=(0,n.defineComponent)({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""},actions:{type:Array,default:()=>[]}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=E=>E==null,a=e,r=t,{formData:i}=un(),l=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),c=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),f=(0,n.computed)(()=>a.editConfig.readonly),p=(0,n.computed)(()=>a.editConfig.drag),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)(),g=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],m=(0,n.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(E=>{E._i||(E._i=an())})):(m.value=[],r("update:modelValue",m.value)),(0,n.watch)(()=>a.modelValue,E=>{m.value=a.modelValue||[],m.value=E||[],m.value.forEach(b=>{b._i||(b._i=an())})},{deep:!0});const x=E=>{const b={};return!a.isCompact&&E.config?.colWidth&&(b.width=`${E.config.colWidth}px`),b},w=()=>{const E={_i:an()};a.columns.forEach(b=>{const k=b.config?.valueRowKey||b.id||"";k&&(E[k]=Vt(b.config?.defaultValue))}),m.value.push(E),r("change",{id:a.id,value:E,data:E,formData:i,tableData:m.value,type:"add"})},y=E=>{const b=m.value[E];m.value.splice(E,1),r("change",{id:a.id,value:b,data:b,formData:i,tableData:m.value,type:"delete"})},C=E=>{r("rowChange",E)};return(0,n.onMounted)(()=>{if(!p.value||!h.value)return;const E=h.value,{initSortable:b}=ol(E,{handle:".j-input-rows-drag",onEnd:k=>{const{oldIndex:S,newIndex:_}=k;if(o(S)||o(_)||S===_||S<0||_<0)return;const T=m.value.splice(S,1)[0];m.value.splice(_,0,T),r("change",{id:a.id,value:T,data:T,formData:i,tableData:m.value,type:"sort"})}});b()}),_o({getTableData:()=>m.value,rowChange:C}),(E,b)=>{const k=(0,n.resolveComponent)("j-comp"),S=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("j-button"),T=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Km,[(0,n.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(m.value,(V,j)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:V._i+j,class:(0,n.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,n.openBlock)(),(0,n.createElementBlock)("div",qm,(0,n.toDisplayString)(j+1),1)):(0,n.createCommentVNode)("",!0),e.showChar?((0,n.openBlock)(),(0,n.createElementBlock)("div",Xm,(0,n.toDisplayString)(g[j%26]),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,z=>((0,n.openBlock)(),(0,n.createBlock)(k,(0,n.mergeProps)({key:z.id,ref_for:!0},z,{row:V,style:x(z)}),null,16,["row","style"]))),128)),p.value?((0,n.openBlock)(),(0,n.createBlock)(S,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,n.createCommentVNode)("",!0),c.value&&(u.value||m.value.length>1)&&!f.value?((0,n.openBlock)(),(0,n.createBlock)(S,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:z=>y(j)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)],2))),128))],512),!f.value&&l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":d.value}),class:"j-input-rows-actions"},[l.value?((0,n.openBlock)(),(0,n.createBlock)(_,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:w},null,8,["label"])):(0,n.createCommentVNode)("",!0),e.actions&&e.actions.length>0?((0,n.openBlock)(),(0,n.createBlock)(T,{key:1,list:e.actions},null,8,["list"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)])}}}),Qm=Zm,ws=de(Qm),ey={class:"j-input-layer"},ty=(0,n.defineComponent)({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},buttonShape:{},buttonGhost:{type:Boolean},buttonDanger:{type:Boolean},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=g=>!!(g==null||typeof g=="string"&&g.trim()===""||Array.isArray(g)&&g.length===0),a=e,r=t,i=(0,n.ref)(),l=(0,n.ref)(),s=(0,n.ref)(""),d=(0,n.computed)({get(){return a.modelValue},set(g){r("update:modelValue",g)}}),c=(0,n.computed)({get(){return o(d.value)?"":o(s.value)?a.getText?a.getText(d.value):d.value:s.value},set(g){g||p()}});(0,n.watch)(()=>a.modelValue,()=>{s.value=""});const f=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||i.value.open()},p=()=>{s.value="",d.value="",r("change",{value:"",data:void 0})},u=async()=>{if(!l.value)return;const g=l.value.getSelection();if(a.isMultiSelect){const m=[],v=[];g.forEach(x=>{const w=x[a.labelKey],y=x[a.valueKey];m.push(w!=null?String(w):""),y===0||y?v.push(String(y)):v.push("")}),s.value=m.join(","),d.value=v.join(","),r("change",{value:v.join(","),data:g})}else if(g.length>0){const m=g[0],v=m[a.labelKey],x=m[a.valueKey];s.value=v!=null?String(v):"";const w=x!=null?String(x):"";d.value=w,r("change",{value:w,data:m})}else s.value="",d.value="",r("change",{value:"",data:void 0});console.log(i.value.close,"layerRef.value.close"),i.value.close()},h=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(g,m)=>{const v=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",ey,[e.onlyButton?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(aa),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,shape:e.buttonShape,ghost:e.buttonGhost,danger:e.buttonDanger,onClick:f},null,8,["type","size","label","icon","shape","ghost","danger"])):((0,n.openBlock)(),(0,n.createBlock)(v,{key:0,modelValue:c.value,"onUpdate:modelValue":m[0]||(m[0]=x=>c.value=x),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:f,onClear:p},(0,n.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(aa),{icon:e.icon,onClick:f},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),(0,n.createVNode)((0,n.unref)(wr),{ref_key:"layerRef",ref:i,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:u,onClosed:h},{default:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(Cr),{ref_key:"tableRef",ref:l,columns:e.columns,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,immediate:!0},null,8,["columns","row-key","is-tree","is-page","sort","is-multiple","load-data"])]),_:1},8,["title","width","height"])])}}}),ny=ty,Cs=de(ny),oy=(0,n.defineComponent)({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]}},setup(e){const t=e,o=un(),{t:a}=Ge(),r=(0,n.computed)(()=>t.formConfig?.gutter||16),i=(0,n.computed)(()=>t.formConfig?.span||24),l=(0,n.computed)(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=(0,n.computed)(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),d=(0,n.computed)(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),c=(0,n.ref)(!1),f=()=>{c.value=!0};return mr({...o,isAutoWindow:d,gutter:r,span:i,labelWidth:l}),(p,u)=>{const h=(0,n.resolveComponent)("j-button"),g=(0,n.resolveComponent)("j-form-item"),m=(0,n.resolveComponent)("el-row"),v=(0,n.resolveComponent)("el-form"),x=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(h,(0,n.mergeProps)(p.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:f}),null,16,["type","size","icon"]),(0,n.createVNode)(x,{visible:c.value,"onUpdate:visible":u[1]||(u[1]=w=>c.value=w),title:(0,n.unref)(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(v,{class:(0,n.normalizeClass)(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:u[0]||(u[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[d.value?((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.normalizeProps)((0,n.mergeProps)({key:0},e.schema[0])),null,16)):((0,n.openBlock)(),(0,n.createBlock)(m,{key:1,gutter:r.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.schema,w=>((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.mergeProps)({key:w.id,ref_for:!0},w),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}}),ay=oy,xs=de(ay),ry=(0,n.defineComponent)({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.computed)({get(){return o.modelValue},set(l){a("update:modelValue",l)}}),i=l=>{a("change",l)};return(0,n.onMounted)(()=>{o.autoFocus&&!o.readonly&&setTimeout(()=>{const l=r.value===o.activeValue?o.inactiveValue:o.activeValue;r.value=l,i(l)},100)}),(l,s)=>{const d=(0,n.resolveComponent)("el-switch");return(0,n.openBlock)(),(0,n.createBlock)(d,(0,n.mergeProps)(l.$attrs,{id:e.id,modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=c=>r.value=c),size:e.size,width:e.width,"inline-prompt":e.inlinePrompt,"active-icon":e.activeIcon,"inactive-icon":e.inactiveIcon,"active-action-icon":e.activeActionIcon,"inactive-action-icon":e.inactiveActionIcon,"active-text":e.activeText,"inactive-text":e.inactiveText,"active-value":e.activeValue,"inactive-value":e.inactiveValue,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:i}),(0,n.createSlots)({_:2},[l.$slots["active-action"]?{name:"active-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}}),iy=ry,ks=de(iy),ly=(0,n.defineComponent)({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{},isFill:{type:Boolean}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=c=>{o("update:modelValue",c)},r=(c,f)=>{o("tab-click",c,f)},i=c=>{o("tab-change",c)},l=c=>{o("tab-remove",c)},s=()=>{o("tab-add")},d=(c,f)=>{o("edit",c,f)};return(c,f)=>{const p=(0,n.resolveComponent)("el-tabs");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(c.$attrs,{class:{isFill:e.isFill},"model-value":e.modelValue,type:e.type,closable:e.closable,addable:e.addable,editable:e.editable,"tab-position":e.tabPosition,stretch:e.stretch,"before-leave":e.beforeLeave,"onUpdate:modelValue":a,onTabClick:r,onTabChange:i,onTabRemove:l,onTabAdd:s,onEdit:d}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),sy=ly,Ss=de(sy),cy=(0,n.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=i=>{o("update:modelValue",i)},r=i=>{o("change",i)};return(i,l)=>{const s=(0,n.resolveComponent)("el-collapse");return(0,n.openBlock)(),(0,n.createBlock)(s,(0,n.mergeProps)(i.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:r,"onUpdate:modelValue":a}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),dy=cy,Es=de(dy),uy={class:"j-editor"},fy=(0,n.defineComponent)({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),i=(0,n.ref)(),l=(0,n.shallowRef)(),s=(0,n.computed)(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let d=!1;const c=p=>{if(!p)return"";let u=p;return o.apiUrl&&o.token&&(u=u.replace(/{jcode_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{jcode_img_token}/g,`token=${o.token}`)),u},f=p=>{if(!p)return"";let u=p;if(o.apiUrl){const h=`${o.apiUrl}/system/annexesfile/`;u=u.split(h).join("{jcode_img_api}"),o.token&&(u=u.split(`token=${o.token}`).join("{jcode_img_token}"))}return u};return(0,n.onMounted)(()=>{const p={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};p.onChange=h=>{if(d)return;const g=f(h.getHtml());a("update:value",g),a("change",{value:g})};const u=(0,Vi.createEditor)({selector:r.value,html:c(o.value),config:p,mode:"default"});l.value=u,(0,Vi.createToolbar)({editor:u,selector:i.value,mode:"default"})}),(0,n.watch)(()=>o.value,p=>{const u=l.value;if(u){const h=u.getHtml(),g=c(p);f(h)!==p&&(d=!0,u.setHtml(g),d=!1)}}),(0,n.watch)(()=>o.readonly,p=>{const u=l.value;u&&(p?u.disable():u.enable())}),(0,n.onBeforeUnmount)(()=>{const p=l.value;p?.destroy()}),(p,u)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",uy,[(0,n.createElementVNode)("div",{ref_key:"toolbarRef",ref:i,class:"j-editor-toolbar"},null,512),(0,n.createElementVNode)("div",{ref_key:"editorRef",ref:r,class:"j-editor-content",style:(0,n.normalizeStyle)(s.value)},null,4)]))}}),py=Ul(fy,[["__scopeId","data-v-d513e01b"]]),_s=de(py),hy={key:0,class:"j-map-loading"},gy=(0,n.defineComponent)({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(!0),l=(0,n.ref)();let s=null,d=null,c=null,f=null;const p=async()=>{i.value=!0;try{s=await al(a.mapKey)}catch(x){console.error("Failed to load Baidu Map:",x),i.value=!1;return}if(d!=null){h(a.lng,a.lat),i.value=!1;return}if(!l.value)return;d=new s.Map(l.value,{enableMapClick:!1});const v=new s.Point(121.480248,31.236276);d.centerAndZoom(v,17),c=new s.Marker(v,{enableDragging:!0}),d.addOverlay(c),c.addEventListener("dragend",x=>{u(x.point)}),d.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),f=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),f.addEventListener("locationSuccess",x=>{u(x.point)}),f.addEventListener("locationError",x=>{alert(x.message)}),d.addControl(f),d.addEventListener("click",x=>{u(x.point)}),d.enableScrollWheelZoom(!0),h(a.lng,a.lat),i.value=!1},u=v=>{new s.Geocoder().getLocation(v,x=>{c.setPosition(v),d.panTo(v),r("update:address",x.address),r("update:lng",v.lng),r("update:lat",v.lat),r("change",{value:{address:x.address,lng:v.lng,lat:v.lat}})})},h=(v,x)=>{if(v&&x&&s){const w=new s.Point(v,x);c&&c.setPosition(w),d&&d.panTo(w)}};let g=null;return t({setPoint:h,querySearchAsync:(v,x)=>{!d||!s||(g||(g=new s.LocalSearch(d,{onSearchComplete:w=>{const y=[];if(w){const C=w.getCurrentNumPois();for(let E=0;E<C;E++)y.push(w.getPoi(E))}x(y)}})),g.search(v))}}),(0,n.onMounted)(()=>{p()}),(v,x)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-map",style:(0,n.normalizeStyle)({height:e.height})},[i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",hy,[(0,n.createVNode)(jn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}),my=gy,Bs=de(my),yy=(0,n.defineComponent)({name:"JInputMap",__name:"input-map",props:{modelValue:{type:[String],default:null},placeholder:{type:String,default:"请选择"},readonly:Boolean,size:{type:String},clearable:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=Ge(),i=(0,n.ref)(),l=(0,n.ref)(),s=(0,n.ref)(),d=(0,n.ref)(""),c=(0,n.ref)(0),f=(0,n.ref)(0),p=(0,n.ref)(""),u=(0,n.computed)(()=>{let C=o.modelValue||"";if(o.modelValue===null&&(C=(0,n.unref)(p)),wt(C))return{address:"",lng:0,lat:0};const E=C.split(",");return{address:E[0],lng:parseFloat(E[1]),lat:parseFloat(E[2])}}),h=(0,n.computed)({get(){return u.value.address},set(){p.value="",a("update:modelValue",void 0)}}),g=()=>{l.value.blur()},m=()=>{l.value.blur(),d.value=u.value.address,c.value=u.value.lng,f.value=u.value.lat,i.value.open("请选择地址"),setTimeout(()=>{s.value?.call("map","setPoint",null,c.value,f.value)},100)},v=(0,n.ref)([]),x=[{type:"j-layout",config:{class:["j-block"]},children:[{type:"div",slot:"top",config:{style:{padding:"8px"}},children:[{type:"el-autocomplete",config:{style:{width:"100%"},placeholder:r("请填写详细地址"),modelValue:d,value:d,fetchSuggestions:async(C,E)=>{E((0,n.unref)(v))},onInput:async C=>{d.value=C,s.value?.call("map","querySearchAsync",null,C,E=>{v.value=E.map(b=>({...b,value:`(${b.title}): ${b.address}`}))})},onSelect:C=>{d.value=`(${C.title})${C.address}`,c.value=C.point.lng,f.value=C.point.lat,s.value?.call("map","setPoint",null,C.point.lng,C.point.lat)}},children:[{slot:"option",config:{h:C=>(0,n.h)("div",{},[(0,n.h)("div",{style:{color:"var(--j-color-text)","font-size":"14px"}},C.title),(0,n.h)("div",{style:{color:"var(--color-text-secondary)","font-size":"12px","margin-bottom":"4px"}},C.address)])}}]}]},{type:"j-map",id:"map",config:{address:d,lng:c,lat:f,height:"100%",onChange:C=>{d.value=C.value.address,c.value=C.value.lng,f.value=C.value.lat}}}]}],w=()=>{!wt(d.value)&&!wt(c.value)&&!wt(f.value)?(p.value=`${d.value},${c.value},${f.value}`,a("update:modelValue",p.value),a("change",p.value)):(a("update:modelValue",void 0),a("change",void 0)),i.value.close()},y=()=>{};return(C,E)=>{const b=(0,n.resolveComponent)("j-button"),k=(0,n.resolveComponent)("el-input"),S=(0,n.resolveComponent)("j-page"),_=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(k,{modelValue:h.value,"onUpdate:modelValue":E[0]||(E[0]=T=>h.value=T),placeholder:e.placeholder?(0,n.unref)(r)(e.placeholder):void 0,readonly:e.readonly,size:e.size,clearable:e.readonly?!1:e.clearable,onFocus:g,ref_key:"inputRef",ref:l,class:"j-input-layer"},{append:(0,n.withCtx)(()=>[(0,n.createVNode)(b,{icon:"mdi:map-marker-outline",disabled:e.readonly,size:e.size,onClick:m},null,8,["disabled","size"])]),_:1},8,["modelValue","placeholder","readonly","size","clearable"]),(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)(C.$attrs)),null,16),(0,n.createVNode)(_,{ref_key:"layerRef",ref:i,width:900,height:500,"btn-text":"确认",destroyOnClose:!1,onOk:w,onClosed:y,style:{height:"0"}},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(S,{style:{padding:"0"},schema:x,ref_key:"indexRef",ref:s},null,512)]),_:1},512)],64)}}}),vy=yy,Rs=de(vy);function Ts(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ao(e){return e.originalEvent||e.srcEvent}function xr(e){Ts(e),Ts(ao(e))}function ro(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}var Vs=1500;function Ms(e,t,o){var a=this,r=o.get("dragging",!1);function i(l){if(!l.hover){var s=l.originalEvent,d=a._findTargetGfx(s),c=d&&e.get(d);d&&c&&(l.stopPropagation(),r.hover({element:c,gfx:d}),r.move(s))}}r&&t.on("drag.start",function(l){t.once("drag.move",Vs,function(s){i(s)})}),(function(){var l,s;t.on("element.hover",function(d){l=d.gfx,s=d.element}),t.on("element.hover",Vs,function(d){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,d;if(l instanceof MouseEvent)return s=ro(l),d=document.elementFromPoint(s.x,s.y),by(d)}}Ms.$inject=["elementRegistry","eventBus","injector"];function by(e){return(0,G.closest)(e,"svg, .djs-element",!0)}var wy={__init__:["hoverFix"],hoverFix:["type",Ms]};function As(){return/mac/i.test(navigator.platform)}function Ns(e,t){return(ao(e)||e).button===t}function fn(e){return Ns(e,0)}function Cy(e){return Ns(e,1)}function js(e){var t=ao(e)||e;return fn(e)?As()?t.metaKey:t.ctrlKey:!1}function kr(e){var t=ao(e)||e;return fn(e)&&t.shiftKey}function Ro(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function xy(e){return["M",e.x,e.y]}function Sr(e){return["L",e.x,e.y]}function ky(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function Sy(e,t){const o=e.length,a=[xy(e[0])];for(let r=1;r<o;r++){const i=e[r-1],l=e[r],s=e[r+1];if(!s||!t){a.push(Sr(l));continue}const d=Math.min(t,Er(l.x-i.x,l.y-i.y),Er(s.x-l.x,s.y-l.y));if(!d){a.push(Sr(l));continue}const c=ha(l,i,d),f=ha(l,i,d*.5),p=ha(l,s,d),u=ha(l,s,d*.5);a.push(Sr(c)),a.push(ky(f,u,p))}return a}function ha(e,t,o){const a=t.x-e.x,r=t.y-e.y,i=o/Er(a,r);return{x:e.x+a*i,y:e.y+r*i}}function Er(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function _r(e,t,o){(0,R.isNumber)(t)&&(o=t,t=null),t||(t={});const a=(0,P.create)("path",t);return(0,R.isNumber)(o)&&(a.dataset.cornerRadius=String(o)),Ps(a,e)}function Ps(e,t){return(0,P.attr)(e,{d:Ro(Sy(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Ey(e){return!0}function ga(e){return fn(e)||Cy(e)}var Hs=500;function zs(e,t,o){var a=this;function r(b,k,S){if(!s(b,k)){var _,T,V;S?T=t.getGraphics(S):(_=k.delegateTarget||k.target,_&&(T=_,S=t.get(T))),!(!T||!S)&&(V=e.fire(b,{element:S,gfx:T,originalEvent:k}),V===!1&&(k.stopPropagation(),k.preventDefault()))}}var i={};function l(b){return i[b]}function s(b,k){return!(c[b]||fn)(k)}var d={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},c={"element.contextmenu":Ey,"element.mousedown":ga,"element.mouseup":ga,"element.click":ga,"element.dblclick":ga};function f(b,k,S){var _=d[b];if(!_)throw new Error("unmapped DOM event name <"+b+">");return r(_,k,S)}var p="svg, .djs-element";function u(b,k,S,_){var T=i[S]=function(V){r(S,V)};_&&(c[S]=_),T.$delegate=G.delegate.bind(b,p,k,T)}function h(b,k,S){var _=l(S);_&&G.delegate.unbind(b,k,_.$delegate)}function g(b){(0,R.forEach)(d,function(k,S){u(b,S,k)})}function m(b){(0,R.forEach)(d,function(k,S){h(b,S,k)})}e.on("canvas.destroy",function(b){m(b.svg)}),e.on("canvas.init",function(b){g(b.svg)}),e.on(["shape.added","connection.added"],function(b){var k=b.element,S=b.gfx;e.fire("interactionEvents.createHit",{element:k,gfx:S})}),e.on(["shape.changed","connection.changed"],Hs,function(b){var k=b.element,S=b.gfx;e.fire("interactionEvents.updateHit",{element:k,gfx:S})}),e.on("interactionEvents.createHit",Hs,function(b){var k=b.element,S=b.gfx;a.createDefaultHit(k,S)}),e.on("interactionEvents.updateHit",function(b){var k=b.element,S=b.gfx;a.updateDefaultHit(k,S)});var v=y("djs-hit djs-hit-stroke"),x=y("djs-hit djs-hit-click-stroke"),w={all:y("djs-hit djs-hit-all"),"click-stroke":x,stroke:v,"no-move":y("djs-hit djs-hit-no-move")};function y(b,k){return k=(0,R.assign)({stroke:"white",strokeWidth:15},k||{}),o.cls(b,["no-fill","no-border"],k)}function C(b,k){var S=w[k];if(!S)throw new Error("invalid hit type <"+k+">");return(0,P.attr)(b,S),b}function E(b,k){(0,P.append)(b,k)}this.removeHits=function(b){(0,R.forEach)((0,G.queryAll)(".djs-hit",b),P.remove)},this.createDefaultHit=function(b,k){var S=b.waypoints,_=b.isFrame,T;return S?this.createWaypointsHit(k,S):(T=_?"stroke":"all",this.createBoxHit(k,T,{width:b.width,height:b.height}))},this.createWaypointsHit=function(b,k){var S=_r(k);return C(S,"stroke"),E(b,S),S},this.createBoxHit=function(b,k,S){S=(0,R.assign)({x:0,y:0},S);var _=(0,P.create)("rect");return C(_,k),(0,P.attr)(_,S),E(b,_),_},this.updateDefaultHit=function(b,k){var S=(0,G.query)(".djs-hit",k);if(S)return b.waypoints?Ps(S,b.waypoints):(0,P.attr)(S,{width:b.width,height:b.height}),S},this.fire=r,this.triggerMouseEvent=f,this.mouseHandler=l,this.registerEvent=u,this.unregisterEvent=h}zs.$inject=["eventBus","elementRegistry","styles"];var Br={__init__:["interactionEvents"],interactionEvents:["type",zs]};function io(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var r=a.element;o.deselect(r)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}io.$inject=["eventBus","canvas"],io.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},io.prototype.get=function(){return this._selectedElements},io.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},io.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();(0,R.isArray)(e)||(e=e?[e]:[]);var r=this._canvas,i=r.getRootElement();e=e.filter(function(l){return i===r.findRoot(l)}),t?(0,R.forEach)(e,function(l){o.indexOf(l)===-1&&o.push(l)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var Os="hover",Ls="selected";function Is(e,t){this._canvas=e;function o(r,i){e.addMarker(r,i)}function a(r,i){e.removeMarker(r,i)}t.on("element.hover",function(r){o(r.element,Os)}),t.on("element.out",function(r){a(r.element,Os)}),t.on("selection.changed",function(r){function i(c){a(c,Ls)}function l(c){o(c,Ls)}var s=r.oldSelection,d=r.newSelection;(0,R.forEach)(s,function(c){d.indexOf(c)===-1&&i(c)}),(0,R.forEach)(d,function(c){s.indexOf(c)===-1&&l(c)})})}Is.$inject=["canvas","eventBus"];function Ds(e,t,o,a){e.on("create.end",500,function(r){var i=r.context,l=i.canExecute,s=i.elements,d=(i.hints||{}).autoSelect;if(l){if(d===!1)return;(0,R.isArray)(d)?t.select(d):t.select(s.filter(_y))}}),e.on("connect.end",500,function(r){var i=r.context.connection;i&&t.select(i)}),e.on("shape.move.end",500,function(r){var i=r.previousSelection||[],l=a.get(r.context.shape.id);(0,R.find)(i,function(s){return l.id===s.id})||t.select(l)}),e.on("element.click",function(r){if(fn(r)){var i=r.element;i===o.getRootElement()&&(i=null);var l=t.isSelected(i),s=t.get().length>1,d=kr(r);if(l&&s)return d?t.deselect(i):t.select(i);l?t.deselect(i):t.select(i,d)}})}Ds.$inject=["eventBus","selection","canvas","elementRegistry"];function _y(e){return!e.hidden}var lo={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Br],selection:["type",io],selectionVisuals:["type",Is],selectionBehavior:["type",Ds]},By=/^djs-cursor-.*$/;function Rr(e){var t=(0,G.classes)(document.body);t.removeMatching(By),e&&t.add("djs-cursor-"+e)}function Fs(){Rr(null)}var Ry=5e3;function $s(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Ry,o),function(){e.off(t,o)}}function Ws(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function so(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Us(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Js(e,t){return e=(0,R.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var co=Math.round,Ys="djs-drag-active";function Hn(e){e.preventDefault()}function Ty(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Vy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Gs(e,t,o,a){var r={threshold:5,trapClick:!0},i;function l(y){var C=t.viewbox(),E=t._container.getBoundingClientRect();return{x:C.x+(y.x-E.left)/C.scale,y:C.y+(y.y-E.top)/C.scale}}function s(y,C){C=C||i;var E=e.createEvent((0,R.assign)({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+y,E)===!1?!1:e.fire(C.prefix+"."+y,E)}function d(y){var C=y.filter(function(E){return a.get(E.id)});C.length&&o.select(C)}function c(y,C){var E=i.payload,b=i.displacement,k=i.globalStart,S=ro(y),_=so(S,k),T=i.localStart,V=l(S),j=so(V,T);if(!i.active&&(C||Vy(_)>i.threshold)){if((0,R.assign)(E,{x:co(T.x+b.x),y:co(T.y+b.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return v();i.active=!0,i.keepSelection||(E.previousSelection=o.get(),o.select(null)),i.cursor&&Rr(i.cursor),t.addMarker(t.getRootElement(),Ys)}xr(y),i.active&&((0,R.assign)(E,{x:co(V.x+b.x),y:co(V.y+b.y),dx:co(j.x),dy:co(j.y)},{originalEvent:y}),s("move"))}function f(y){var C,E=!0;i.active&&(y&&(i.payload.originalEvent=y,xr(y)),E=s("end")),E===!1&&s("rejected"),C=x(E!==!0),s("ended",C)}function p(y){Js("Escape",y)&&(Hn(y),v())}function u(y){var C;i.active&&(C=$s(e),setTimeout(C,400),Hn(y)),f(y)}function h(y){c(y)}function g(y){var C=i.payload;C.hoverGfx=y.gfx,C.hover=y.element,s("hover")}function m(y){s("out");var C=i.payload;C.hoverGfx=null,C.hover=null}function v(y){var C;if(i){var E=i.active;E&&s("cancel"),C=x(y),E&&s("canceled",C)}}function x(y){var C,E;s("cleanup"),Fs(),i.trapClick?E=u:E=f,G.event.unbind(document,"mousemove",c),G.event.unbind(document,"dragstart",Hn),G.event.unbind(document,"selectstart",Hn),G.event.unbind(document,"mousedown",E,!0),G.event.unbind(document,"mouseup",E,!0),G.event.unbind(document,"keyup",p),G.event.unbind(document,"touchstart",h,!0),G.event.unbind(document,"touchcancel",v,!0),G.event.unbind(document,"touchmove",c,!0),G.event.unbind(document,"touchend",f,!0),e.off("element.hover",g),e.off("element.out",m),t.removeMarker(t.getRootElement(),Ys);var b=i.payload.previousSelection;return y!==!1&&b&&!o.get().length&&d(b),C=i,i=null,C}function w(y,C,E,b){i&&v(!1),typeof C=="string"&&(b=E,E=C,C=null),b=(0,R.assign)({},r,b||{});var k=b.data||{},S,_,T,V,j;b.trapClick?V=u:V=f,y?(S=ao(y)||y,_=ro(y),xr(y),S.type==="dragstart"&&Hn(S)):(S=null,_={x:0,y:0}),T=l(_),C||(C=T),j=Ty(S),i=(0,R.assign)({prefix:E,data:k,payload:{},globalStart:_,displacement:so(C,T),localStart:T,isTouch:j},b),b.manual||(j?(G.event.bind(document,"touchstart",h,!0),G.event.bind(document,"touchcancel",v,!0),G.event.bind(document,"touchmove",c,!0),G.event.bind(document,"touchend",f,!0)):(G.event.bind(document,"mousemove",c),G.event.bind(document,"dragstart",Hn),G.event.bind(document,"selectstart",Hn),G.event.bind(document,"mousedown",V,!0),G.event.bind(document,"mouseup",V,!0)),G.event.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",m)),s("init"),b.autoActivate&&c(y,!0)}e.on("diagram.destroy",v),this.init=w,this.move=c,this.hover=g,this.out=m,this.end=f,this.cancel=v,this.context=function(){return i},this.setOptions=function(y){(0,R.assign)(r,y)}}Gs.$inject=["eventBus","canvas","selection","elementRegistry"];var zn={__depends__:[wy,lo],dragging:["type",Gs]};function Tr(e){return e.childNodes[0]}function ma(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ma.prototype.next=function(){return this._prefix+ ++this._counter};var My=new ma("ps"),Ay=["marker-start","marker-mid","marker-end"],Ny=["circle","ellipse","line","path","polygon","polyline","path","rect"];function pn(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}pn.$inject=["elementRegistry","eventBus","canvas","styles"],pn.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},pn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},pn.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var r=(0,P.clone)(o),i=o.getBoundingClientRect();return this._cloneMarkers(Tr(r),a),(0,P.attr)(r,this._styles.cls(a,[],{x:i.top,y:i.left})),(0,P.append)(t,r),(0,P.attr)(r,"data-preview-support-element-id",e.id),r},pn.prototype.addFrame=function(e,t){var o=(0,P.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,P.append)(t,o),(0,P.attr)(o,"data-preview-support-element-id",e.id),o},pn.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(r=>{a._cloneMarkers(r,t,o)}),zy(e)&&Ay.forEach(function(r){if((0,P.attr)(e,r)){var i=jy(e,r,a._canvas.getContainer());i&&a._cloneMarker(o,e,i,r,t)}})},pn.prototype._cloneMarker=function(e,t,o,a,r="djs-dragger"){var i=[o.id,r,My.next()].join("-"),l=(0,G.query)("marker#"+o.id,e);e=e||this._canvas._svg;var s=l||(0,P.clone)(o);s.id=i,(0,P.classes)(s).add(r);var d=(0,G.query)(":scope > defs",e);d||(d=(0,P.create)("defs"),(0,P.append)(e,d)),(0,P.append)(d,s),(0,P.attr)(t,a,Hy(s.id))};function jy(e,t,o){return(0,G.query)("marker#"+Py((0,P.attr)(e,t)),o||document)}function Py(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Hy(e){return"url(#"+e+")"}function zy(e){return Ny.indexOf(e.nodeName)!==-1}var Vr={__init__:["previewSupport"],previewSupport:["type",pn]};function Mr(e){this._commandStack=e.get("commandStack",!1)}Mr.$inject=["injector"],Mr.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};var uo={__init__:["rules"],rules:["type",Mr]};function Oy(e){return(0,R.filter)(e,function(t){return!(0,R.find)(e,function(o){return o!==t&&Ks(t,o)})})}function Ks(e,t){if(t){if(e===t)return t;if(e.parent)return Ks(e.parent,t)}}function qs(e,t,o){var a=!o||e.indexOf(t)===-1;return a&&e.push(t),a}function Ar(e,t,o){o=o||0,(0,R.isArray)(e)||(e=[e]),(0,R.forEach)(e,function(a,r){var i=t(a,r,o);(0,R.isArray)(i)&&i.length&&Ar(i,t,o+1)})}function Ly(e,t,o){var a=[],r=[];return Ar(e,function(i,l,s){qs(a,i,t);var d=i.children;if((o===-1||s<o)&&d&&qs(r,d,t))return d}),a}function Iy(e,t){return Ly(e,!t,-1)}function Dy(e,t,o){(0,R.isUndefined)(t)&&(t=!0),(0,R.isObject)(t)&&(o=t,t=!0),o=o||{};var a=To(o.allShapes),r=To(o.allConnections),i=To(o.enclosedElements),l=To(o.enclosedConnections),s=To(o.topLevel,t&&(0,R.groupBy)(e,function(f){return f.id}));function d(f){s[f.source.id]&&s[f.target.id]&&(s[f.id]=[f]),a[f.source.id]&&a[f.target.id]&&(l[f.id]=i[f.id]=f),r[f.id]=f}function c(f){if(i[f.id]=f,f.waypoints)l[f.id]=r[f.id]=f;else return a[f.id]=f,(0,R.forEach)(f.incoming,d),(0,R.forEach)(f.outgoing,d),f.children}return Ar(e,c),{allShapes:a,allConnections:r,topLevel:s,enclosedConnections:l,enclosedElements:i}}function Ut(e,t){t=!!t,(0,R.isArray)(e)||(e=[e]);var o,a,r,i;return(0,R.forEach)(e,function(l){var s=l;l.waypoints&&!t&&(s=Ut(l.waypoints,!0));var d=s.x,c=s.y,f=s.height||0,p=s.width||0;(d<o||o===void 0)&&(o=d),(c<a||a===void 0)&&(a=c),(d+p>r||r===void 0)&&(r=d+p),(c+f>i||i===void 0)&&(i=c+f)}),{x:o,y:a,height:i-a,width:r-o}}function Xs(e,t){var o={};return(0,R.forEach)(e,function(a){var r=a;r.waypoints&&(r=Ut(r)),!(0,R.isNumber)(t.y)&&r.x>t.x&&(o[a.id]=a),!(0,R.isNumber)(t.x)&&r.y>t.y&&(o[a.id]=a),r.x>t.x&&r.y>t.y&&((0,R.isNumber)(t.width)&&(0,R.isNumber)(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!(0,R.isNumber)(t.width)||!(0,R.isNumber)(t.height))&&(o[a.id]=a)}),o}function Fy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function $y(e){return!!(e&&e.isFrame)}function To(e,t){return(0,R.assign)({},e||{},t||{})}function St(e){return(0,R.isObject)(e)&&(0,R.has)(e,"waypoints")}function fo(e){return(0,R.isObject)(e)&&(0,R.has)(e,"labelTarget")}var Wy="drop-ok",Zs="drop-not-ok",Qs="attach-ok",ec="new-parent",tc="create",Uy=2e3;function nc(e,t,o,a,r){function i(d,c,f,p,u){if(!c)return!1;d=(0,R.filter)(d,function(w){var y=w.labelTarget;return!w.parent&&!(fo(w)&&d.indexOf(y)!==-1)});var h=(0,R.find)(d,function(w){return!St(w)}),g=!1,m=!1,v=!1;ac(d)&&(g=r.allowed("shape.attach",{position:f,shape:h,target:c})),g||(ac(d)?v=r.allowed("shape.create",{position:f,shape:h,source:p,target:c}):v=r.allowed("elements.create",{elements:d,position:f,target:c}));var x=u.connectionTarget;return v||g?(h&&p&&(m=r.allowed("connection.create",{source:x===p?h:p,target:x===p?p:h,hints:{targetParent:c,targetAttach:g}})),{attach:g,connect:m}):v===null||g===null?null:!1}function l(d,c){[Qs,Wy,Zs,ec].forEach(function(f){f===c?e.addMarker(d,f):e.removeMarker(d,f)})}o.on(["create.move","create.hover"],function(d){var c=d.context,f=c.elements,p=d.hover,u=c.source,h=c.hints||{};if(!p){c.canExecute=!1,c.target=null;return}oc(d);var g={x:d.x,y:d.y},m=c.canExecute=p&&i(f,p,g,u,h);p&&m!==null&&(c.target=p,m&&m.attach?l(p,Qs):l(p,m?ec:Zs))}),o.on(["create.end","create.out","create.cleanup"],function(d){var c=d.hover;c&&l(c,null)}),o.on("create.end",function(d){var c=d.context,f=c.source,p=c.shape,u=c.elements,h=c.target,g=c.canExecute,m=g&&g.attach,v=g&&g.connect,x=c.hints||{};if(g===!1||!h)return!1;oc(d);var w={x:d.x,y:d.y};v?p=a.appendShape(f,p,w,h,{attach:m,connection:v===!0?{}:v,connectionTarget:x.connectionTarget}):(u=a.createElements(u,w,h,(0,R.assign)({},x,{attach:m})),p=(0,R.find)(u,function(y){return!St(y)})),(0,R.assign)(c,{elements:u,shape:p}),(0,R.assign)(d,{elements:u,shape:p})});function s(){var d=t.context();d&&d.prefix===tc&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],Uy,function(){o.off("elements.changed",s)})}),this.start=function(d,c,f){(0,R.isArray)(c)||(c=[c]);var p=(0,R.find)(c,function(h){return!St(h)});if(p){f=(0,R.assign)({elements:c,hints:{},shape:p},f||{}),(0,R.forEach)(c,function(h){(0,R.isNumber)(h.x)||(h.x=0),(0,R.isNumber)(h.y)||(h.y=0)});var u=Ut((0,R.filter)(c,function(h){return!h.hidden}));(0,R.forEach)(c,function(h){St(h)&&(h.waypoints=(0,R.map)(h.waypoints,function(g){return{x:g.x-u.x-u.width/2,y:g.y-u.y-u.height/2}})),(0,R.assign)(h,{x:h.x-u.x-u.width/2,y:h.y-u.y-u.height/2})}),t.init(d,tc,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:c,context:f}})}}}nc.$inject=["canvas","dragging","eventBus","modeling","rules"];function oc(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function ac(e){return e&&e.length===1&&!St(e[0])}function Jy(e,t,o,a,r){var i=(0,P.createTransform)();i.setTranslate(t,o);var l=(0,P.createTransform)();l.setRotate(a||0,0,0);var s=(0,P.createTransform)();s.setScale(r||1,r||1),(0,P.transform)(e,[i,l,s])}function Jt(e,t,o){var a=(0,P.createTransform)();a.setTranslate(t,o),(0,P.transform)(e,a)}function Yy(e,t){var o=(0,P.createTransform)();o.setRotate(t,0,0),(0,P.transform)(e,o)}var Gy=750;function rc(e,t,o,a,r){function i(l){var s=(0,P.create)("g");(0,P.attr)(s,r.cls("djs-drag-group",["no-events"]));var d=(0,P.create)("g");return l.forEach(function(c){var f;c.hidden||(c.waypoints?(f=o._createContainer("connection",d),o.drawConnection(Tr(f),c)):(f=o._createContainer("shape",d),o.drawShape(Tr(f),c),Jt(f,c.x,c.y)),a.addDragger(c,s,f))}),s}t.on("create.move",Gy,function(l){var s=l.hover,d=l.context,c=d.elements,f=d.dragGroup;f||(f=d.dragGroup=i(c));var p;s?(f.parentNode||(p=e.getActiveLayer(),(0,P.append)(p,f)),Jt(f,l.x,l.y)):(0,P.remove)(f)}),t.on("create.cleanup",function(l){var s=l.context.dragGroup;s&&(0,P.remove)(s)})}rc.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var ic={__depends__:[zn,Vr,uo,lo],__init__:["create","createPreview"],create:["type",nc],createPreview:["type",rc]};function Vo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Nr(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var r=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),i=Vo(e,t);return Math.abs(r/i)<=a}var Ky=2;function hn(e,t){var o=Array.from(arguments).flat();for(const[a,r]of Object.entries({x:"v",y:"h"}))if(qy(a,o))return r;return!1}function qy(e,t){const o=t[0];return(0,R.every)(t,function(a){return Math.abs(o[e]-a[e])<=Ky})}function lc(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function jr(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Xy=/,?([a-z]),?/gi,sc=parseFloat,at=Math,gn=at.PI,Yt=at.min,Gt=at.max,cc=at.pow,mn=at.abs,Zy=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Qy=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,dc=Array.isArray||function(e){return e instanceof Array};function ev(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tv(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function nv(e){function t(){var o=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},r=t.count=t.count||[];return ev(a,o)?(tv(r,o),a[o]):(r.length>=1e3&&delete a[r.shift()],r.push(o),a[o]=e(...arguments),a[o])}return t}function ov(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(Zy,function(a,r,i){var l=[],s=r.toLowerCase();for(i.replace(Qy,function(d,c){c&&l.push(+c)}),s=="m"&&l.length>2&&(o.push([r,...l.splice(0,2)]),s="l",r=r=="m"?"l":"L");l.length>=t[s]&&(o.push([r,...l.splice(0,t[s])]),!!t[s]););}),o.toString=Hr,o}function av(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function rv(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Pr(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Hr(){return this.join(",").replace(Xy,"$1")}function iv(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var r=e[o],i=t[o]=new Array(r.length),l=0,s=r.length;l<s;l++)i[l]=r[l];return t.toString=Hr,t}function uc(e,t,o,a,r,i,l,s,d){var c=1-d,f=cc(c,3),p=cc(c,2),u=d*d*d,h=f*e+p*3*d*o+c*3*d*d*r+u*l,g=f*t+p*3*d*a+c*3*d*d*i+u*s;return{x:ya(h),y:ya(g)}}function fc(e){var t=fv(...e);return Pr(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function yn(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function lv(e,t){return e=Pr(e),t=Pr(t),yn(t,e.x,e.y)||yn(t,e.x2,e.y)||yn(t,e.x,e.y2)||yn(t,e.x2,e.y2)||yn(e,t.x,t.y)||yn(e,t.x2,t.y)||yn(e,t.x,t.y2)||yn(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function pc(e,t,o,a,r){return e*(e*(-3*t+9*o-9*a+3*r)+6*t-12*o+6*a)-3*t+3*o}function hc(e,t,o,a,r,i,l,s,d){d==null&&(d=1),d=d>1?1:d<0?0:d;for(var c=d/2,f=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,g=0;g<f;g++){var m=c*p[g]+c,v=pc(m,e,o,r,l),x=pc(m,t,a,i,s),w=v*v+x*x;h+=u[g]*at.sqrt(w)}return c*h}function sv(e,t,o,a,r,i,l,s){if(!(Gt(e,o)<Yt(r,l)||Yt(e,o)>Gt(r,l)||Gt(t,a)<Yt(i,s)||Yt(t,a)>Gt(i,s))){var d=(e*a-t*o)*(r-l)-(e-o)*(r*s-i*l),c=(e*a-t*o)*(i-s)-(t-a)*(r*s-i*l),f=(e-o)*(i-s)-(t-a)*(r-l);if(f){var p=ya(d/f),u=ya(c/f),h=+p.toFixed(2),g=+u.toFixed(2);if(!(h<+Yt(e,o).toFixed(2)||h>+Gt(e,o).toFixed(2)||h<+Yt(r,l).toFixed(2)||h>+Gt(r,l).toFixed(2)||g<+Yt(t,a).toFixed(2)||g>+Gt(t,a).toFixed(2)||g<+Yt(i,s).toFixed(2)||g>+Gt(i,s).toFixed(2)))return{x:p,y:u}}}}function ya(e){return Math.round(e*1e11)/1e11}function cv(e,t,o){if(!lv(fc(e),fc(t)))return o?0:[];var a=hc(...e),r=hc(...t),i=mc(e)?1:~~(a/5)||1,l=mc(t)?1:~~(r/5)||1,s=new Array(i+1),d=new Array(l+1),c={},f=o?0:[],p,u;for(p=0;p<i+1;p++){var h=uc(...e,p/i);s[p]={x:h.x,y:h.y,t:p/i}}for(p=0;p<l+1;p++)h=uc(...t,p/l),d[p]={x:h.x,y:h.y,t:p/l};for(p=0;p<i;p++)for(u=0;u<l;u++){var g=s[p],m=s[p+1],v=d[u],x=d[u+1],w=mn(m.x-g.x)<.01?"y":"x",y=mn(x.x-v.x)<.01?"y":"x",C=sv(g.x,g.y,m.x,m.y,v.x,v.y,x.x,x.y),E;if(C){if(E=C.x.toFixed(9)+"#"+C.y.toFixed(9),c[E])continue;c[E]=!0;var b=g.t+mn((C[w]-g[w])/(m[w]-g[w]))*(m.t-g.t),k=v.t+mn((C[y]-v[y])/(x[y]-v[y]))*(x.t-v.t);b>=0&&b<=1&&k>=0&&k<=1&&(o?f++:f.push({x:C.x,y:C.y,t1:b,t2:k}))}}return f}function gc(e,t,o){e=bc(e),t=bc(t);for(var a,r,i,l,s,d,c,f,p,u,h=o?0:[],g=0,m=e.length;g<m;g++){var v=e[g];if(v[0]=="M")a=s=v[1],r=d=v[2];else{v[0]=="C"?(p=[a,r,...v.slice(1)],a=p[6],r=p[7]):(p=[a,r,a,r,s,d,s,d],a=s,r=d);for(var x=0,w=t.length;x<w;x++){var y=t[x];if(y[0]=="M")i=c=y[1],l=f=y[2];else{y[0]=="C"?(u=[i,l,...y.slice(1)],i=u[6],l=u[7]):(u=[i,l,i,l,c,f,c,f],i=c,l=f);var C=cv(p,u,o);if(o)h+=C;else{for(var E=0,b=C.length;E<b;E++)C[E].segment1=g,C[E].segment2=x,C[E].bez1=p,C[E].bez2=u;h=h.concat(C)}}}}}return h}function dv(e){return dc(e)&&dc(e[0])}function uv(e){if(av(e))return e;var t=new Array(e.length),o=0,a=0,r=0,i=0,l=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],r=o,i=a,l++,t[0]=["M",o,a]);for(var d,c,f=l,p=e.length;f<p;f++){if(c=e[f],s=c[0],t[f]=d=new Array(c.length),s!=s.toUpperCase())switch(d[0]=s.toUpperCase(),d[0]){case"A":d[1]=c[1],d[2]=c[2],d[3]=c[3],d[4]=c[4],d[5]=c[5],d[6]=+c[6]+o,d[7]=+c[7]+a;break;case"V":d[1]=+c[1]+a;break;case"H":d[1]=+c[1]+o;break;case"M":r=+c[1]+o,i=+c[2]+a;default:for(var u=1,h=c.length;u<h;u++)d[u]=+c[u]+(u%2?o:a)}else for(var g=0,m=c.length;g<m;g++)d[g]=c[g];switch(s=s.toUpperCase(),d[0]){case"Z":o=+r,a=+i;break;case"H":o=d[1];break;case"V":a=d[1];break;case"M":r=d[d.length-2],i=d[d.length-1];default:o=d[d.length-2],a=d[d.length-1]}}return t.toString=Hr,t}function mc(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function va(e,t,o,a){return[e,t,o,a,o,a]}function yc(e,t,o,a,r,i){var l=.3333333333333333,s=2/3;return[l*e+s*o,l*t+s*a,l*r+s*o,l*i+s*a,r,i]}function vc(e,t,o,a,r,i,l,s,d,c){var f=gn*120/180,p=gn/180*(+r||0),u=[],h,g=nv(function(ue,Te,Ae){return{x:ue*at.cos(Ae)-Te*at.sin(Ae),y:ue*at.sin(Ae)+Te*at.cos(Ae)}});if(c)k=c[0],S=c[1],E=c[2],b=c[3];else{h=g(e,t,-p),e=h.x,t=h.y,h=g(s,d,-p),s=h.x,d=h.y;var m=(e-s)/2,v=(t-d)/2,x=m*m/(o*o)+v*v/(a*a);x>1&&(x=at.sqrt(x),o=x*o,a=x*a);var w=o*o,y=a*a,C=(i==l?-1:1)*at.sqrt(mn((w*y-w*v*v-y*m*m)/(w*v*v+y*m*m))),E=C*o*v/a+(e+s)/2,b=C*-a*m/o+(t+d)/2,k=at.asin(((t-b)/a).toFixed(9)),S=at.asin(((d-b)/a).toFixed(9));k=e<E?gn-k:k,S=s<E?gn-S:S,k<0&&(k=gn*2+k),S<0&&(S=gn*2+S),l&&k>S&&(k=k-gn*2),!l&&S>k&&(S=S-gn*2)}var _=S-k;if(mn(_)>f){var T=S,V=s,j=d;S=k+f*(l&&S>k?1:-1),s=E+o*at.cos(S),d=b+a*at.sin(S),u=vc(s,d,o,a,r,0,l,V,j,[S,T,E,b])}_=S-k;var z=at.cos(k),L=at.sin(k),M=at.cos(S),B=at.sin(S),D=at.tan(_/4),U=4/3*o*D,te=4/3*a*D,le=[e,t],A=[e+U*L,t-te*z],I=[s+U*B,d-te*M],W=[s,d];if(A[0]=2*le[0]-A[0],A[1]=2*le[1]-A[1],c)return[A,I,W].concat(u);u=[A,I,W].concat(u).join().split(",");for(var N=[],he=0,_e=u.length;he<_e;he++)N[he]=he%2?g(u[he-1],u[he],p).y:g(u[he],u[he+1],p).x;return N}function fv(e,t,o,a,r,i,l,s){for(var d=[],c=[[],[]],f,p,u,h,g,m,v,x,w=0;w<2;++w){if(w==0?(p=6*e-12*o+6*r,f=-3*e+9*o-9*r+3*l,u=3*o-3*e):(p=6*t-12*a+6*i,f=-3*t+9*a-9*i+3*s,u=3*a-3*t),mn(f)<1e-12){if(mn(p)<1e-12)continue;h=-u/p,0<h&&h<1&&d.push(h);continue}v=p*p-4*u*f,x=at.sqrt(v),!(v<0)&&(g=(-p+x)/(2*f),0<g&&g<1&&d.push(g),m=(-p-x)/(2*f),0<m&&m<1&&d.push(m))}for(var y=d.length,C=y,E;y--;)h=d[y],E=1-h,c[0][y]=E*E*E*e+3*E*E*h*o+3*E*h*h*r+h*h*h*l,c[1][y]=E*E*E*t+3*E*E*h*a+3*E*h*h*i+h*h*h*s;return c[0][C]=e,c[1][C]=t,c[0][C+1]=l,c[1][C+1]=s,c[0].length=c[1].length=C+2,{x0:Yt(...c[0]),y0:Yt(...c[1]),x1:Gt(...c[0]),y1:Gt(...c[1])}}function bc(e){if(dv(e)||(e=ov(e)),rv(e))return e;for(var t=iv(uv(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(u,h,g){var m,v;if(!u)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(u[0]in{T:1,Q:1})&&(h.qx=h.qy=null),u[0]){case"M":h.X=u[1],h.Y=u[2];break;case"A":u=["C",...vc(h.x,h.y,...u.slice(1))];break;case"S":g=="C"||g=="S"?(m=h.x*2-h.bx,v=h.y*2-h.by):(m=h.x,v=h.y),u=["C",m,v,...u.slice(1)];break;case"T":g=="Q"||g=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),u=["C",...yc(h.x,h.y,h.qx,h.qy,u[1],u[2])];break;case"Q":h.qx=u[1],h.qy=u[2],u=["C",...yc(h.x,h.y,u[1],u[2],u[3],u[4])];break;case"L":u=["C",...va(h.x,h.y,u[1],u[2])];break;case"H":u=["C",...va(h.x,h.y,u[1],h.y)];break;case"V":u=["C",...va(h.x,h.y,h.x,u[1])];break;case"Z":u=["C",...va(h.x,h.y,h.X,h.Y)];break}return u},r=function(u,h){if(u[h].length>7){u[h].shift();for(var g=u[h];g.length;)i[h]="A",u.splice(h++,0,["C",...g.splice(0,6)]);u.splice(h,1),c=t.length}},i=[],l="",s="",d=0,c=t.length;d<c;d++){t[d]&&(l=t[d][0]),l!="C"&&(i[d]=l,d&&(s=i[d-1])),t[d]=a(t[d],o,s),i[d]!="A"&&l=="C"&&(i[d]="C"),r(t,d);var f=t[d],p=f.length;o.x=f[p-2],o.y=f[p-1],o.bx=sc(f[p-4])||o.x,o.by=sc(f[p-3])||o.y}return t}function pv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Mo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function wc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function hv(e){return Mo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function gv(e){for(var t=e.waypoints,o=t.reduce(function(s,d,c){var f=t[c-1];if(f){var p=s[s.length-1],u=p&&p.endLength||0,h=vv(f,d);s.push({start:f,end:d,startLength:u,endLength:u+h,length:h})}return s},[]),a=o.reduce(function(s,d){return s+d.length},0)/2,r=0,i=o[r];i.endLength<a;)i=o[++r];var l=(a-i.startLength)/i.length;return{x:i.start.x+(i.end.x-i.start.x)*l,y:i.start.y+(i.end.y-i.start.y)*l}}function tt(e){return St(e)?gv(e):hv(e)}function vn(e,t,o){o=o||0,(0,R.isObject)(o)||(o={x:o,y:o});var a=Ie(e),r=Ie(t),i=a.bottom+o.y<=r.top,l=a.left-o.x>=r.right,s=a.top-o.y>=r.bottom,d=a.right+o.x<=r.left,c=i?"top":s?"bottom":null,f=d?"left":l?"right":null;return f&&c?c+"-"+f:f||c||"intersect"}function zr(e,t,o){var a=mv(e,t);return a.length===1||a.length===2&&Vo(a[0],a[1])<1?Mo(a[0]):a.length>1?(a=(0,R.sortBy)(a,function(r){var i=Math.floor(r.t2*100)||1;return i=100-i,i=(i<10?"0":"")+i,r.segment2+"#"+i}),Mo(a[o?0:a.length-1])):null}function mv(e,t){return gc(e,t)}function yv(e){e=e.slice();for(var t=0,o,a,r;e[t];)o=e[t],a=e[t-1],r=e[t+1],Vo(o,r)===0||Nr(a,r,o)?e.splice(t,1):t++;return e}function vv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cc(e,t,o,a){function r(l,s){return a.allowed("connection.create",{source:l,target:s})}function i(l,s){return r(s,l)}e.on("connect.hover",function(l){var s=l.context,d=s.start,c=l.hover,f;if(s.hover=c,f=s.canExecute=r(d,c),!(0,R.isNil)(f)){if(f!==!1){s.source=d,s.target=c;return}f=s.canExecute=i(d,c),!(0,R.isNil)(f)&&f!==!1&&(s.source=c,s.target=d)}}),e.on(["connect.out","connect.cleanup"],function(l){var s=l.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(l){var s=l.context,d=s.canExecute,c=s.connectionStart,f={x:l.x,y:l.y},p=s.source,u=s.target;if(!d)return!1;var h=null,g={connectionStart:Or(s)?f:c,connectionEnd:Or(s)?c:f};(0,R.isObject)(d)&&(h=d),s.connection=o.connect(p,u,h,g)}),this.start=function(l,s,d,c){(0,R.isObject)(d)||(c=d,d=tt(s)),t.init(l,"connect",{autoActivate:c,data:{shape:s,context:{start:s,connectionStart:d}}})}}Cc.$inject=["eventBus","dragging","modeling","rules"];function Or(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var bv=1100,wv=900,xc="connect-ok",kc="connect-not-ok";function Sc(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(r){var i=r.context,l=i.canExecute,s=i.hover,d=i.source,c=i.start,f=i.startPosition,p=i.target,u=i.connectionStart||f,h=i.connectionEnd||{x:r.x,y:r.y},g=u,m=h;Or(i)&&(g=h,m=u),a.drawPreview(i,l,{source:d||c,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",wv,function(r){var i=r.context,l=r.hover,s=i.canExecute;s!==null&&o.addMarker(l,s?xc:kc)}),t.on(["connect.out","connect.cleanup"],bv,function(r){var i=r.hover;i&&(o.removeMarker(i,xc),o.removeMarker(i,kc))}),a&&t.on("connect.cleanup",function(r){a.cleanUp(r.context)})}Sc.$inject=["injector","eventBus","canvas"];var Lr={__depends__:[lo,uo,zn],__init__:["connectPreview"],connect:["type",Cc],connectPreview:["type",Sc]},Cv=15;function Ec(e,t){var o;function a(s){return l(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function r(s){var d=o.start,c=o.button,f=ro(s),p=so(f,d);!o.dragging&&xv(p)>Cv&&(o.dragging=!0,c===0&&$s(e),Rr("grab")),o.dragging&&(p=so(f,o.last||o.start),t.scroll({dx:p.x,dy:p.y}),o.last=f),s.preventDefault()}function i(s){G.event.unbind(document,"mousemove",r),G.event.unbind(document,"mouseup",i),o=null,Fs()}function l(s){if(!(0,G.closest)(s.target,".djs-draggable")){var d=s.button;if(!(d>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:d,start:ro(s)},G.event.bind(document,"mousemove",r),G.event.bind(document,"mouseup",i),!0}}this.isActive=function(){return!!o}}Ec.$inject=["eventBus","canvas"];function xv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var _c={__init__:["moveCanvas"],moveCanvas:["type",Ec]};function Ir(e){return Math.log(e)/Math.log(10)}function Bc(e,t){var o=Ir(e.min),a=Ir(e.max);return(Math.abs(o)+Math.abs(a))/t}function kv(e,t){return Math.max(e.min,Math.min(e.max,t))}var Sv=Math.sign||function(e){return e>=0?1:-1},Dr={min:.2,max:4},Rc=10,Ev=.1,_v=.75;function Kt(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=(0,R.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||_v;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Kt.$inject=["config.zoomScroll","eventBus","canvas"],Kt.prototype.scroll=function(t){this._canvas.scroll(t)},Kt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Kt.prototype.zoom=function(t,o){var a=Bc(Dr,Rc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Ev&&(this._zoom(t,o,a),this._totalDelta=0)},Kt.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||As()&&t.metaKey,r=t.shiftKey,i=-1*this._scale,l;if(a?i*=t.deltaMode===0?.02:.32:i*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),d={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Sv(t.deltaY)*i,this.zoom(l,d)}else r?l={dx:i*t.deltaY,dy:0}:l={dx:i*t.deltaX,dy:i*t.deltaY},this.scroll(l)}},Kt.prototype.stepZoom=function(t,o){var a=Bc(Dr,Rc);this._zoom(t,o,a)},Kt.prototype._zoom=function(e,t,o){var a=this._canvas,r=e>0?1:-1,i=Ir(a.zoom()),l=Math.round(i/o)*o;l+=o*r;var s=Math.pow(10,l);a.zoom(kv(Dr,s),t)},Kt.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&G.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},Kt.prototype._init=function(e){this.toggle(e)};var Tc={__init__:["zoomScroll"],zoomScroll:["type",Kt]};function qe(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}qe.$inject=["eventBus","injector"],qe.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},qe.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let r=this._fire(e,"canExecute",o);if(r===void 0){if(!a)return!1;a.canExecute&&(r=a.canExecute(t))}return r},qe.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},qe.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},qe.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},qe.prototype.register=function(e,t){this._setHandler(e,t)},qe.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},qe.prototype.canUndo=function(){return!!this._getUndoAction()},qe.prototype.canRedo=function(){return!!this._getRedoAction()},qe.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},qe.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},qe.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},qe.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let r;o=this._eventBus.createEvent(o);for(const i of a)if(r=this._eventBus.fire("commandStack."+i,o),o.cancelBubble)break;return r},qe.prototype._createId=function(){return this._uid++},qe.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},qe.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,r=this._getHandler(o);if(!r)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),r.preExecute&&r.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),r.execute&&this._markDirty(r.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),r.postExecute&&r.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},qe.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},qe.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:(0,R.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},qe.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,R.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},qe.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},qe.prototype._revertedAction=function(e){this._stackIdx--},qe.prototype._getHandler=function(e){return this._handlerMap[e]},qe.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var Bv={commandStack:["type",qe]};function On(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function ba(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function bn(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function Fr(e,t){return!e||!t?-1:e.indexOf(t)}function po(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Rv=1e3;function vt(e){this._eventBus=e}vt.$inject=["eventBus"];function Tv(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}vt.prototype.on=function(e,t,o,a,r,i){if(((0,R.isFunction)(t)||(0,R.isNumber)(t))&&(i=r,r=a,a=o,o=t,t=null),(0,R.isFunction)(o)&&(i=r,r=a,a=o,o=Rv),(0,R.isObject)(r)&&(i=r,r=!1),!(0,R.isFunction)(a))throw new Error("handlerFn must be a function");(0,R.isArray)(e)||(e=[e]);var l=this._eventBus;(0,R.forEach)(e,function(s){var d=["commandStack",s,t].filter(function(c){return c}).join(".");l.on(d,o,r?Tv(a,i):a,i)})},vt.prototype.canExecute=rn("canExecute"),vt.prototype.preExecute=rn("preExecute"),vt.prototype.preExecuted=rn("preExecuted"),vt.prototype.execute=rn("execute"),vt.prototype.executed=rn("executed"),vt.prototype.postExecute=rn("postExecute"),vt.prototype.postExecuted=rn("postExecuted"),vt.prototype.revert=rn("revert"),vt.prototype.reverted=rn("reverted");function rn(e){return function(o,a,r,i,l){((0,R.isFunction)(o)||(0,R.isNumber)(o))&&(l=i,i=r,r=a,a=o,o=null),this.on(o,e,a,r,i,l)}}var Vv=250,Vc=1400;function $r(e,t,o){vt.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Vc,function(r){var i=r.context,l=i.shapes,s=i.validatedShapes;i.shapes=Mc(l),i.validatedShapes=Mc(s)}),a&&t.on("shape.move.start",Vv,function(r){var i=r.context,l=i.shapes,s=[];(0,R.forEach)(l,function(d){(0,R.forEach)(d.labels,function(c){!c.hidden&&i.shapes.indexOf(c)===-1&&s.push(c),d.labelTarget&&s.push(d)})}),(0,R.forEach)(s,function(d){a.makeDraggable(i,d,!0)})}),this.preExecuted("elements.move",Vc,function(r){var i=r.context.closure,l=i.enclosedElements,s=[];(0,R.forEach)(l,function(d){(0,R.forEach)(d.labels,function(c){l[c.id]||s.push(c)})}),i.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(r){var i=r.context;po((i.connection||i.shape).labels,function(l){o.removeShape(l,{nested:!0})})}),this.execute("shape.delete",function(r){var i=r.context,l=i.shape,s=l.labelTarget;s&&(i.labelTargetIndex=Fr(s.labels,l),i.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(r){var i=r.context,l=i.shape,s=i.labelTarget,d=i.labelTargetIndex;s&&(bn(s.labels,l,d),l.labelTarget=s)})}On($r,vt),$r.$inject=["injector","eventBus","modeling"];function Mc(e){return(0,R.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var Mv={__init__:["labelSupport"],labelSupport:["type",$r]};function Ac(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Nc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function Av(e,t,o,a){var r=o.inverse;return Object.defineProperty(e,"remove",{value:function(i){var l=this.indexOf(i);return l!==-1&&(this.splice(l,1),t.unset(i,r,a)),i}}),Object.defineProperty(e,"contains",{value:function(i){return this.indexOf(i)!==-1}}),Object.defineProperty(e,"add",{value:function(i,l){var s=this.indexOf(i);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,i),s===-1&&t.set(i,r,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Nv(e){return e.__refs_collection===!0}function jv(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function jc(e,t,o){var a=Av(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(r){e.set(r,t.inverse,o)})}function Pv(e,t,o){var a=t.inverse,r=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(i){if(i!==r){var l=r;r=null,l&&e.unset(l,a,o),r=i,e.set(r,a,o)}}})}function Nt(e,t){if(!(this instanceof Nt))return new Nt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Nt.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?jc(this,t,e):Pv(this,t,e)},Nt.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Nv(o)||jc(this,t,e),o},Nt.prototype.ensureBound=function(e,t){jv(e,t)||this.bind(e,t)},Nt.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},Nt.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var Wr=new Nt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Pc=new Nt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Hc=new Nt({name:"attachers",collection:!0},{name:"host"}),zc=new Nt({name:"outgoing",collection:!0},{name:"source"}),Oc=new Nt({name:"incoming",collection:!0},{name:"target"});function ho(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),Wr.bind(this,"parent"),Pc.bind(this,"labels"),zc.bind(this,"outgoing"),Oc.bind(this,"incoming")}function Ao(){ho.call(this),Wr.bind(this,"children"),Hc.bind(this,"host"),Hc.bind(this,"attachers")}On(Ao,ho);function Lc(){ho.call(this),Wr.bind(this,"children")}On(Lc,Ao);function Ic(){Ao.call(this),Pc.bind(this,"labelTarget")}On(Ic,Ao);function Dc(){ho.call(this),zc.bind(this,"source"),Oc.bind(this,"target")}On(Dc,ho);var Hv={connection:Dc,shape:Ao,label:Ic,root:Lc};function zv(e,t){var o=Hv[e];if(!o)throw new Error("unknown type: <"+e+">");return(0,R.assign)(new o,t)}function Ov(e){return e instanceof ho}function wn(){this._uid=12}wn.prototype.createRoot=function(e){return this.create("root",e)},wn.prototype.createLabel=function(e){return this.create("label",e)},wn.prototype.createShape=function(e){return this.create("shape",e)},wn.prototype.createConnection=function(e){return this.create("connection",e)},wn.prototype.create=function(e,t){return t=(0,R.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),zv(e,t)};var Lv={width:90,height:20};function Ln(){wn.call(this),this._translate=Nc}(0,on.default)(Ln,wn),Ln.$inject=[],Ln.prototype.baseCreate=wn.prototype.create,Ln.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Ke({type:"label"},Lv,t)):this.createFlowElement(e,t)},Ln.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Ac()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=Ke({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Ln.prototype._getDefaultSize=function(e){let t={width:100,height:80};switch(e){case"startEvent":case"endEvent":case"myEvent":t={width:36,height:36};break;case"gatewayAnd":case"gatewayXor":case"gatewayInclusive":t={width:50,height:50};break;case"subprocess":case"userTask":case"scriptTask":t={width:100,height:80};break}return t};function wa(e,t){this._modeling=e,this._canvas=t}wa.$inject=["modeling","canvas"],wa.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;(0,R.forEach)(o,function(r){var i={x:0,y:0};(0,R.isDefined)(a.left)?i.x=a.left-r.x:(0,R.isDefined)(a.right)?i.x=a.right-r.width-r.x:(0,R.isDefined)(a.center)?i.x=a.center-Math.round(r.width/2)-r.x:(0,R.isDefined)(a.top)?i.y=a.top-r.y:(0,R.isDefined)(a.bottom)?i.y=a.bottom-r.height-r.y:(0,R.isDefined)(a.middle)&&(i.y=a.middle-Math.round(r.height/2)-r.y),t.moveElements([r],i,r.parent)})},wa.prototype.postExecute=function(e){};function Ca(e){this._modeling=e}Ca.$inject=["modeling"],Ca.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,r=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:r.attach}),e.shape=a},Ca.prototype.postExecute=function(e){var t=e.hints||{};Iv(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function Iv(e,t){return(0,R.some)(e.outgoing,function(o){return o.target===t})}function xa(e,t){this._canvas=e,this._layouter=t}xa.$inject=["canvas","layouter"],xa.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,r=e.parent,i=e.parentIndex,l=e.hints;if(!o||!a)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,r,i),t},xa.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ka=Math.round;function Ur(e){this._modeling=e}Ur.$inject=["modeling"],Ur.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,r=e.position,i=e.hints,l=this._modeling;(0,R.forEach)(t,function(f){(0,R.isNumber)(f.x)||(f.x=0),(0,R.isNumber)(f.y)||(f.y=0)});var s=Ut((0,R.filter)(t,function(f){return!f.hidden}));(0,R.forEach)(t,function(f){St(f)&&(f.waypoints=(0,R.map)(f.waypoints,function(p){return{x:ka(p.x-s.x-s.width/2+r.x),y:ka(p.y-s.y-s.height/2+r.y)}})),(0,R.assign)(f,{x:ka(f.x-s.x-s.width/2+r.x),y:ka(f.y-s.y-s.height/2+r.y)})});var d=Oy(t),c={};(0,R.forEach)(t,function(f){if(St(f)){c[f.id]=(0,R.isNumber)(a)?l.createConnection(c[f.source.id],c[f.target.id],a,f,f.parent||o,i):l.createConnection(c[f.source.id],c[f.target.id],f,f.parent||o,i);return}var p=(0,R.assign)({},i);d.indexOf(f)===-1&&(p.autoResize=!1),fo(f)&&(p=(0,R.omit)(p,["attach"])),c[f.id]=(0,R.isNumber)(a)?l.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,a,p):l.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,p)}),e.elements=(0,R.values)(c)};var Fc=Math.round;function Cn(e){this._canvas=e}Cn.$inject=["canvas"],Cn.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,r=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?(0,R.assign)(t,o):(0,R.assign)(t,{x:o.x-Fc(t.width/2),y:o.y-Fc(t.height/2)}),this._canvas.addShape(t,a,r),t},Cn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function No(e){Cn.call(this,e)}On(No,Cn),No.$inject=["canvas"];var Dv=Cn.prototype.execute;No.prototype.execute=function(e){var t=e.shape;return $v(t),t.labelTarget=e.labelTarget,Dv.call(this,e)};var Fv=Cn.prototype.revert;No.prototype.revert=function(e){return e.shape.labelTarget=null,Fv.call(this,e)};function $v(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function jo(e,t){this._canvas=e,this._modeling=t}jo.$inject=["canvas","modeling"],jo.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;po(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),po(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},jo.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=Fr(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},jo.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,bn(o.children,t,a),this._canvas.addConnection(t,o),t};function Jr(e,t){this._modeling=e,this._elementRegistry=t}Jr.$inject=["modeling","elementRegistry"],Jr.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;(0,R.forEach)(a,function(r){o.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Po(e,t){this._canvas=e,this._modeling=t}Po.$inject=["canvas","modeling"],Po.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;po(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),po(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),po(o.children,function(a){St(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},Po.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=Fr(a.children,o),t.removeShape(o),o},Po.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,r=e.oldParentIndex;return bn(a.children,o,r),t.addShape(o,a),o};function Sa(e){this._modeling=e}Sa.$inject=["modeling"];var $c={x:"y",y:"x"};Sa.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,r=e.dimension;function i(v,x){v.range.min=Math.min(x[a],v.range.min),v.range.max=Math.max(x[a]+x[r],v.range.max)}function l(v){return v[a]+v[r]/2}function s(v){return v.length-1}function d(v){return v.max-v.min}function c(v,x){var w={y:0};w[a]=v-l(x),w[a]&&(w[$c[a]]=0,t.moveElements([x],w,x.parent))}var f=o[0],p=s(o),u=o[p],h,g,m=0;(0,R.forEach)(o,function(v,x){var w,y,C;if(v.elements.length<2){x&&x!==o.length-1&&(i(v,v.elements[0]),m+=d(v.range));return}w=(0,R.sortBy)(v.elements,a),y=w[0],x===p&&(y=w[s(w)]),C=l(y),v.range=null,(0,R.forEach)(w,function(E){if(c(C,E),v.range===null){v.range={min:E[a],max:E[a]+E[r]};return}i(v,E)}),x&&x!==o.length-1&&(m+=d(v.range))}),g=Math.abs(u.range.min-f.range.max),h=Math.round((g-m)/(o.length-1)),!(h<o.length-1)&&(0,R.forEach)(o,function(v,x){var w={},y;v===f||v===u||(y=o[x-1],v.range.max=0,(0,R.forEach)(v.elements,function(C,E){w[$c[a]]=0,w[a]=y.range.max-C[a]+h,v.range.min!==C[a]&&(w[a]+=C[a]-v.range.min),w[a]&&t.moveElements([C],w,C.parent),v.range.max=Math.max(C[a]+C[r],E?v.range.max:0)}))})},Sa.prototype.postExecute=function(e){};function Ea(e,t){this._layouter=e,this._canvas=t}Ea.$inject=["layouter","canvas"],Ea.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return(0,R.assign)(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Ea.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Yr(){}Yr.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,i=t.parent;return e.oldParent=i,e.oldParentIndex=ba(i.children,t),bn(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(l){l.x+=o.x,l.y+=o.y,l.original&&(l.original.x+=o.x,l.original.y+=o.y)}),t},Yr.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,r=e.oldParentIndex,i=e.delta;return ba(o.children,t),bn(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(l){l.x-=i.x,l.y-=i.y,l.original&&(l.original.x-=i.x,l.original.y-=i.y)}),t};function _a(e,t,o){var a=Ws(t),r=Ws(o),i=so(e,a),l={x:i.x*(o.width/t.width),y:i.y*(o.height/t.height)};return Mo({x:r.x+l.x,y:r.y+l.y})}function Gr(e,t,o){var a=Ba(e),r=Uc(a,t),i=a[0];return r.length?r[r.length-1]:_a(i.original||i,o,t)}function Kr(e,t,o){var a=Ba(e),r=Uc(a,t),i=a[a.length-1];return r.length?r[0]:_a(i.original||i,o,t)}function qr(e,t,o){var a=Ba(e),r=Wc(t,o),i=a[0];return _a(i.original||i,r,t)}function Xr(e,t,o){var a=Ba(e),r=Wc(t,o),i=a[a.length-1];return _a(i.original||i,r,t)}function Wc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ba(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Uc(e,t){return(0,R.filter)((0,R.map)(e,Uv),function(o){return Wv(o,t)})}function Wv(e,t){return vn(t,e,1)==="intersect"}function Uv(e){return e.original||e}function Zr(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Zr.prototype.add=function(e,t){return this.addAll([e],t)},Zr.prototype.addAll=function(e,t){var o=Dy(e,!!t,this);return(0,R.assign)(this,o),this};function Ho(e){this._modeling=e}Ho.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},Ho.prototype.moveClosure=function(e,t,o,a,r){var i=this._modeling,l=e.allShapes,s=e.allConnections,d=e.enclosedConnections,c=e.topLevel,f=!1;r&&r.parent===o&&(f=!0),(0,R.forEach)(l,function(p){i.moveShape(p,t,c[p.id]&&!f&&o,{recurse:!1,layout:!1})}),(0,R.forEach)(s,function(p){var u=!!l[p.source.id],h=!!l[p.target.id];d[p.id]&&u&&h?i.moveConnection(p,t,c[p.id]&&!f&&o):i.layoutConnection(p,{connectionStart:u&&qr(p,p.source,t),connectionEnd:h&&Xr(p,p.target,t)})})},Ho.prototype.getClosure=function(e){return new Zr().addAll(e,!0)};function Ra(e){this._helper=new Ho(e)}Ra.$inject=["modeling"],Ra.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ra.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function In(e){this._modeling=e,this._helper=new Ho(e)}In.$inject=["modeling"],In.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,i=t.parent;return e.oldBounds=(0,R.pick)(t,["x","y","width","height"]),e.oldParent=i,e.oldParentIndex=ba(i.children,t),bn(a.children,t,r),(0,R.assign)(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},In.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,r=this._modeling;a.layout!==!1&&((0,R.forEach)(t.incoming,function(i){r.layoutConnection(i,{connectionEnd:Xr(i,t,o)})}),(0,R.forEach)(t.outgoing,function(i){r.layoutConnection(i,{connectionStart:qr(i,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},In.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,r=e.delta;return bn(o.children,t,a),(0,R.assign)(t,{parent:o,x:t.x-r.x,y:t.y-r.y}),t},In.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},In.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function zo(e){this._modeling=e}zo.$inject=["modeling"],zo.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,r=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return(0,R.isArray)(r)&&(e.oldWaypoints=a.waypoints,a.waypoints=r),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},zo.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,r=e.dockingOrPoints,i=e.hints||{},l={};i.connectionStart&&(l.connectionStart=i.connectionStart),i.connectionEnd&&(l.connectionEnd=i.connectionEnd),i.layoutConnection!==!1&&(o&&(!a||i.docking==="source")&&(l.connectionStart=l.connectionStart||Jc((0,R.isArray)(r)?r[0]:r)),a&&(!o||i.docking==="target")&&(l.connectionEnd=l.connectionEnd||Jc((0,R.isArray)(r)?r[r.length-1]:r)),i.newWaypoints&&(l.waypoints=i.newWaypoints),this._modeling.layoutConnection(t,l))},zo.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,r=e.connection;return t&&(r.source=t),o&&(r.target=o),a&&(r.waypoints=a),r};function Jc(e){return e.original||e}function ln(e,t){this._modeling=e,this._rules=t}ln.$inject=["modeling","rules"],ln.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,r=e.oldShape,i=e.newData,l=e.hints||{},s;function d(g,m,v){return a.allowed("connection.reconnect",{connection:v,source:g,target:m})}var c={x:i.x,y:i.y},f={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(i,c,r.parent,l),r.host&&o.updateAttachment(s,r.host);var p;l.moveChildren!==!1&&(p=r.children.slice(),o.moveElements(p,{x:0,y:0},s,l));var u=r.incoming.slice(),h=r.outgoing.slice();(0,R.forEach)(u,function(g){var m=g.source;d(m,s,g)&&t.reconnectEnd(g,s,Kr(g,s,f),l)}),(0,R.forEach)(h,function(g){var m=g.target;d(s,m,g)&&t.reconnectStart(g,s,Gr(g,s,f),l)})},ln.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ln.prototype.execute=function(e){},ln.prototype.revert=function(e){},ln.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},ln.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},ln.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Oo(e){this._modeling=e}Oo.$inject=["modeling"],Oo.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Oo.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,R.forEach)(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:Kr(r,o,a)})}),(0,R.forEach)(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:Gr(r,o,a)})}))},Oo.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function Jv(e,t){var o=[];return(0,R.forEach)(e.concat(t),function(a){var r=a.incoming,i=a.outgoing;(0,R.forEach)(r.concat(i),function(l){var s=l.source,d=l.target;(Lo(e,s)||Lo(e,d)||Lo(t,s)||Lo(t,d))&&(Lo(o,l)||o.push(l))})}),o}function Lo(e,t){return e.indexOf(t)!==-1}function Yv(e,t,o){var a=e.x,r=e.y,i=e.width,l=e.height,s=o.x,d=o.y;switch(t){case"n":return{x:a,y:r+d,width:i,height:l-d};case"s":return{x:a,y:r,width:i,height:l+d};case"w":return{x:a+s,y:r,width:i-s,height:l};case"e":return{x:a,y:r,width:i+s,height:l};default:throw new Error("unknown direction: "+t)}}function xn(e){this._modeling=e}xn.$inject=["modeling"],xn.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,r=e.resizingShapes,i=e.start,l={};this.moveShapes(a,t),(0,R.forEach)(r,function(s){l[s.id]=Kv(s)}),this.resizeShapes(r,t,o),this.updateConnectionWaypoints(Jv(a,r),t,o,i,a,r,l)},xn.prototype.execute=function(){},xn.prototype.revert=function(){},xn.prototype.moveShapes=function(e,t){var o=this;(0,R.forEach)(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},xn.prototype.resizeShapes=function(e,t,o){var a=this;(0,R.forEach)(e,function(r){var i=Yv(r,o,t);a._modeling.resizeShape(r,i,null,{attachSupport:!1,autoResize:!1,layout:!1})})},xn.prototype.updateConnectionWaypoints=function(e,t,o,a,r,i,l){var s=this,d=r.concat(i);(0,R.forEach)(e,function(c){var f=c.source,p=c.target,u=Gv(c),h=Gc(o),g={};kn(d,f)&&kn(d,p)?(u=(0,R.map)(u,function(m){return Kc(m,a,o)&&(m[h]=m[h]+t[h]),m.original&&Kc(m.original,a,o)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(c,u,{labelBehavior:!1})):(kn(d,f)||kn(d,p))&&(kn(r,f)?g.connectionStart=qr(c,f,t):kn(r,p)?g.connectionEnd=Xr(c,p,t):kn(i,f)?g.connectionStart=Gr(c,f,l[f.id]):kn(i,p)&&(g.connectionEnd=Kr(c,p,l[p.id])),s._modeling.layoutConnection(c,g))})};function Yc(e){return(0,R.assign)({},e)}function Gv(e){return(0,R.map)(e.waypoints,function(t){return t=Yc(t),t.original&&(t.original=Yc(t.original)),t})}function Gc(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Kc(e,t,o){var a=Gc(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function kn(e,t){return e.indexOf(t)!==-1}function Kv(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ta(e){this._modeling=e}Ta.$inject=["modeling"],Ta.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=qc(o),t.collapsed=!t.collapsed;var a=Xc(o,t.collapsed);return[t].concat(a)},Ta.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,r=Zc(a,o);return t.collapsed=!t.collapsed,[t].concat(r)};function qc(e){var t={};return(0,R.forEach)(e,function(o){t[o.id]=o.hidden,o.children&&(t=(0,R.assign)({},t,qc(o.children)))}),t}function Xc(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(Xc(a.children,a.collapsed||t)))}),o}function Zc(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Zc(a.children,t)))}),o}function Va(e){this._modeling=e}Va.$inject=["modeling"],Va.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Qc(a,t),ed(o,t),t.host=o,t},Va.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,r=e.attacherIdx;return t.host=a,Qc(o,t),ed(a,t,r),t};function Qc(e,t){return ba(e&&e.attachers,t)}function ed(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),bn(a,t,o)}}function Qr(){}Qr.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},Qr.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Oe(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}Oe.$inject=["eventBus","elementFactory","commandStack"],Oe.prototype.getHandlers=function(){return{"shape.append":Ca,"shape.create":Cn,"shape.delete":Po,"shape.move":In,"shape.resize":Oo,"shape.replace":ln,"shape.toggleCollapse":Ta,spaceTool:xn,"label.create":No,"connection.create":xa,"connection.delete":jo,"connection.move":Yr,"connection.layout":Ea,"connection.updateWaypoints":Qr,"connection.reconnect":zo,"elements.create":Ur,"elements.move":Ra,"elements.delete":Jr,"elements.distribute":Sa,"elements.align":wa,"element.updateAttachment":Va}},Oe.prototype.registerHandlers=function(e){(0,R.forEach)(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},Oe.prototype.moveShape=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=null);var i={shape:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("shape.move",i)},Oe.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},Oe.prototype.moveElements=function(e,t,o,a){a=a||{};var r=a.attach,i=o,l;r===!0?(l=o,i=o.parent):r===!1&&(l=null);var s={shapes:e,delta:t,newParent:i,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},Oe.prototype.moveConnection=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=void 0);var i={connection:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("connection.move",i)},Oe.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},Oe.prototype.createConnection=function(e,t,o,a,r,i){typeof o=="object"&&(i=r,r=a,a=o,o=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:r,parentIndex:o,connection:a,hints:i};return this._commandStack.execute("connection.create",l),l.connection},Oe.prototype.createShape=function(e,t,o,a,r){typeof a!="number"&&(r=a,a=void 0),r=r||{};var i=r.attach,l,s;e=this._create("shape",e),i?(l=o.parent,s=o):l=o;var d={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:r};return this._commandStack.execute("shape.create",d),d.shape},Oe.prototype.createElements=function(e,t,o,a,r){(0,R.isArray)(e)||(e=[e]),typeof a!="number"&&(r=a,a=void 0),r=r||{};var i={position:t,elements:e,parent:o,parentIndex:a,hints:r};return this._commandStack.execute("elements.create",i),i.elements},Oe.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var r={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",r),r.shape},Oe.prototype.appendShape=function(e,t,o,a,r){r=r||{},t=this._create("shape",t);var i={source:e,position:o,target:a,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",i),i.shape},Oe.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Oe.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},Oe.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},Oe.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},Oe.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},Oe.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},Oe.prototype.resizeShape=function(e,t,o,a){var r={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",r)},Oe.prototype.createSpace=function(e,t,o,a,r){var i={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",i)},Oe.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},Oe.prototype.reconnect=function(e,t,o,a,r){var i={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:r||{}};this._commandStack.execute("connection.reconnect",i)},Oe.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,(0,R.assign)(a,{docking:"source"}))},Oe.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,(0,R.assign)(a,{docking:"target"}))},Oe.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},Oe.prototype._create=function(e,t){return Ov(t)?t:this._elementFactory.create(e,t)},Oe.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function td(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ei(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function qv(e,t){Array.isArray(e)&&e.forEach(t)}function Ma(e){const t=e.businessObject;if(t)return t.name||""}function Xv(e,t){const o=e.businessObject;return o.name=t,e}var Zv={width:90,height:20},bx=15;function ti(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function nd(e){return Io(e.label)}function Qv(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],r=eb(e),i=Math.atan((a.y-o.y)/(a.x-o.x));let{x:l,y:s}=r;return Math.abs(i)<Math.PI/2?s-=15:l+=15,{x:l,y:s}}function eb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function od(e){return e.waypoints?Qv(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Zv.height/2}}function Io(e){return e&&!!e.labelTarget}var tb={width:0,height:0};function ad(e,t){function o(s,d){const c=s.label||s,f=s.labelTarget||s;return Xv(c,d,f!==c),[c,f]}function a(s){const{element:d,newLabel:c}=s,{businessObject:f}=d;if(!Io(d)&&ti(d)&&!nd(d)&&!rd(c)){let u=od(d);u={x:u.x,y:u.y+7},e.createLabel(d,u,{id:f.id+"_label",businessObject:f})}}function r(s){return s.oldLabel=Ma(s.element),o(s.element,s.newLabel)}function i(s){return o(s.element,s.oldLabel)}function l(s){const{element:d,newLabel:c}=s,f=d.label||d,p=s.hints||{};let{newBounds:u}=s;if(!Io(f))return;if(Io(f)&&rd(c)){p.removeShape!==!1&&e.removeShape(f,{unsetLabel:!1});return}const h=Ma(f);typeof u>"u"&&(u=t.getExternalLabelBounds(f,h)),u&&e.resizeShape(f,u,tb)}this.preExecute=a,this.execute=r,this.revert=i,this.postExecute=l}ad.$inject=["modeling","textRenderer"];function rd(e){return!e||!e.trim()}function Do(e,t,o){Oe.call(this,e,t,o)}(0,on.default)(Do,Oe),Do.$inject=["eventBus","elementFactory","commandStack"],Do.prototype.getHandlers=function(){const e=Oe.prototype.getHandlers.call(this);return e["element.updateLabel"]=ad,e},Do.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function ni(e,t){vt.call(this,e);function o(a){const{context:r}=a,i=r.hints||{};let l;!r.cropped&&i.createElementsBehavior!==!1&&(l=r.connection,l.waypoints=t.getCroppedWaypoints(l),r.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}(0,on.default)(ni,vt),ni.$inject=["eventBus","connectionDocking"];function id(){}id.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||tt(t.source||e.source),t.connectionEnd||tt(t.target||e.target)]};var Aa=20,nb=5,Na=Math.round,ld=20,ob={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ab(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function rb(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function sd(e,t,o){var a=vn(t,e,nb),r=o.split(":")[0],i=Na((t.x-e.x)/2+e.x),l=Na((t.y-e.y)/2+e.y),s,d,c=rb(r,a),f=/h|r|l/.test(r),p=!1,u=!1;return c?(s=f?{x:i,y:e.y}:{x:e.x,y:l},d=f?"h:h":"v:v"):(p=ab(a,r),d=f?"h:v":"v:h",p?f?(u=l===e.y,s={x:e.x+Aa*(/l/.test(r)?-1:1),y:u?l+Aa:l}):(u=i===e.x,s={x:u?i+Aa:i,y:e.y+Aa*(/t/.test(r)?-1:1)}):s={x:i,y:l}),{waypoints:oi(e,s,d).concat(s),directions:d,turnNextDirections:u}}function ib(e,t,o){return sd(e,t,o)}function lb(e,t,o){var a=sd(t,e,cd(o));return{waypoints:a.waypoints.slice().reverse(),directions:cd(a.directions),turnNextDirections:a.turnNextDirections}}function sb(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var r=o+":"+a;return{waypoints:oi(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}function cd(e){return e.split(":").reverse().join(":")}function cb(e,t,o){var a=Na((t.x-e.x)/2+e.x),r=Na((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function oi(e,t,o){if(o=o||"h:h",!vb(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ud(o)){var a=ib(e,t,o),r=lb(e,t,o),i=sb(a,r);return[].concat(a.waypoints,i.waypoints,r.waypoints)}return cb(e,t,o)}function db(e,t,o){var a=oi(e,t,o);return a.unshift(e),a.push(t),pd(a)}function ub(e,t,o,a,r){var i=(0,R.without)(r&&r.preferredLayouts||[],"straight")[0]||"h:h",l=vn(e,t,ob[i]||0),s=yb(l,i);o=o||tt(e),a=a||tt(t);var d=s.split(":");return db(fd(o,e,d[0],bb(l)),fd(a,t,d[1],l),s)}function fb(e,t,o,a,r,i){(0,R.isArray)(o)&&(r=o,i=a,o=tt(e),a=tt(t)),i=(0,R.assign)({preferredLayouts:[]},i),r=r||[];var l=i.preferredLayouts.indexOf("straight")!==-1&&hb(e,t,o,a,i);return l||(l=i.connectionEnd&&mb(t,e,a,r),l)||(l=i.connectionStart&&gb(e,t,o,r),l)?l:!i.connectionStart&&!i.connectionEnd&&r&&r.length?r:ub(e,t,o,a,i)}function pb(e,t,o){return e>=t&&e<=o}function dd(e,t,o){return pb(t[e],o[e],o[e]+o[{x:"width",y:"height"}[e]])}function hb(e,t,o,a,r){var i={},l,s=vn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),r.preserveDocking==="target"?dd(l,a,e)?(i[l]=a[l],[{x:i.x!==void 0?i.x:o.x,y:i.y!==void 0?i.y:o.y,original:{x:i.x!==void 0?i.x:o.x,y:i.y!==void 0?i.y:o.y}},{x:a.x,y:a.y}]):null:dd(l,o,t)?(i[l]=o[l],[{x:o.x,y:o.y},{x:i.x!==void 0?i.x:a.x,y:i.y!==void 0?i.y:a.y,original:{x:i.x!==void 0?i.x:a.x,y:i.y!==void 0?i.y:a.y}}]):null):null}function gb(e,t,o,a){return ai(e,t,o,a)}function mb(e,t,o,a){var r=a.slice().reverse();return r=ai(e,t,o,r),r?r.reverse():null}function ai(e,t,o,a){function r(f){return f.length<3?!0:f.length>4?!1:!!(0,R.find)(f,function(p,u){var h=f[u-1];return h&&Vo(p,h)<3})}function i(f,p,u){switch(hn(p,f)){case"v":return{x:u.x,y:f.y};case"h":return{x:f.x,y:u.y}}return{x:f.x,y:f.y}}function l(f,p,u){var h;for(h=f.length-2;h!==0;h--)if(lc(f[h],p,ld)||lc(f[h],u,ld))return f.slice(h);return f}if(r(a))return null;var s=a[0],d=a.slice(),c;return d[0]=o,d[1]=i(d[1],s,o),c=l(d,e,t),c!==d&&(d=ai(e,t,o,c)),d&&hn(d)?null:d}function yb(e,t){if(ud(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function vb(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ud(e){return e&&/t|r|b|l/.test(e)}function bb(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function fd(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function pd(e){return e.reduce(function(t,o,a){var r=t[t.length-1],i=e[a+1];return Nr(r,i,o,0)||t.push(o),t},[])}function ri(){}(0,on.default)(ri,id);var Dn=(e,t)=>e.type===t;ri.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,r=t.waypoints||e.waypoints;let{connectionStart:i,connectionEnd:l}=t,s,d;return l===void 0&&(i=ja(r&&r[0],o),l=ja(r&&r[r.length-1],a)),i||(i=ja(r&&r[0],o)),l||(l=ja(r&&r[r.length-1],a)),Dn(e,"myline")&&(o===a?s={preferredLayouts:wb(o,e)}:Dn(o,"gatewayAnd")||Dn(o,"gatewayXor")||Dn(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Dn(a,"gatewayAnd")||Dn(a,"gatewayXor")||Dn(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Ke(s,t),d=pd(fb(o,a,i,l,r,s))),d||[i,l]};function ja(e,t){return e?e.original||e:tt(t)}function wb(e,t){const{waypoints:o}=t,a=o&&o.length&&vn(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function hd(e){return(0,R.assign)({original:e.point.original||e.point},e.actual)}function Sn(e,t){this._elementRegistry=e,this._graphicsFactory=t}Sn.$inject=["elementRegistry","graphicsFactory"],Sn.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,o),i=e.waypoints.slice(a.idx+1,r.idx);return i.unshift(hd(a)),i.push(hd(r)),i},Sn.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,r=o?0:a.length-1,i=a[r];return{point:i,actual:this._getIntersection(t,e,o)||i,idx:r}},Sn.prototype._getIntersection=function(e,t,o){return zr(this._getShapePath(e),this._getConnectionPath(t),o)},Sn.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Sn.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Sn.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var gd={__depends__:[Bv,Mv,lo],__init__:["modeling","elementUpdater"],modeling:["type",Do],layouter:["type",ri],elementUpdater:["type",ni],elementFactory:["type",Ln],connectionDocking:["type",Sn]},Cb=1e3;function Fn(e,t){var o=this;t=t||Cb,e.on(["render.shape","render.connection"],t,function(a,r){var i=a.type,l=r.element,s=r.gfx,d=r.attrs;if(o.canRender(l))return i==="render.shape"?o.drawShape(s,l,d):o.drawConnection(s,l,d)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,r){if(o.canRender(r))return a.type==="render.getShapePath"?o.getShapePath(r):o.getConnectionPath(r)})}Fn.prototype.canRender=function(e){},Fn.prototype.drawShape=function(e,t){},Fn.prototype.drawConnection=function(e,t){},Fn.prototype.getShapePath=function(e){},Fn.prototype.getConnectionPath=function(e){};function xb(e){return e.businessObject}function Pa(e,t){return e.businessObject.strokeWidth||t||1}function Lt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function nt(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function kb(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2;return Ro([["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function Sb(e,t){const{x:o,y:a,width:r,height:i}=e;return Ro([["M",o+t,a],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,i-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-i],["a",t,t,0,0,1,t,-t],["z"]])}function Eb(e){const{x:t,y:o,width:a,height:r}=e,i=a/2,l=r/2;return Ro([["M",t+i,o],["l",i,l],["l",-i,l],["l",-i,-l],["z"]])}function _b(e){const{x:t,y:o,width:a,height:r}=e;return Ro([["M",t,o],["l",a,0],["l",0,r],["l",-a,0],["z"]])}var ii=10,li=.95,En=(e,t)=>e.type===t;function $n(e,t,o,a,r,i,l){Fn.call(this,e,l);const s="var(--j-color-bg-container)",d="var(--j-color-text)",c={};Object.keys(i.palette).forEach(M=>{const B=i.palette[M];c[B.type]=B.options});const{computeStyle:f}=t;function p(M){return L[M]}function u(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2})}function h(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2,fill:"white"})}function g(M,B,D,U){D=u(D);const te=_r(B,D,U);return(0,P.append)(M,te),te}function m(M,B,D){return g(M,B,D,5)}function v(M,B,D,U,te){td(U)&&(te=U,U=0),U=U||0,te=f(te,{stroke:d,strokeWidth:2,fill:s}),te.fill==="none"&&delete te.fillOpacity;const le=B/2,A=D/2,I=(0,P.create)("circle");return(0,P.attr)(I,{cx:le,cy:A,r:Math.round((B+D)/4-U)}),(0,P.attr)(I,te),(0,P.append)(M,I),I}function x(M,B,D,U,te,le){td(te)&&(le=te,te=0),te=te||0,le=f(le,{stroke:d,strokeWidth:2,fill:s});const A=(0,P.create)("rect");return(0,P.attr)(A,{x:te,y:te,width:B-te*2,height:D-te*2,rx:U,ry:U}),(0,P.attr)(A,le),(0,P.append)(M,A),A}function w(M,B,D){D=f(D,["no-fill"],{strokeWidth:2,stroke:d});const U=(0,P.create)("path");return(0,P.attr)(U,{d:B}),(0,P.attr)(U,D),(0,P.append)(M,U),U}function y(M,B,D,U){const te=B/2,le=D/2,A=[{x:te,y:0},{x:B,y:le},{x:te,y:D},{x:0,y:le}].map(W=>W.x+","+W.y).join(" ");U=f(U,{stroke:d,strokeWidth:2,fill:s});const I=(0,P.create)("polygon");return(0,P.attr)(I,{points:A}),(0,P.attr)(I,U),(0,P.append)(M,I),I}function C(M,B,D,U){return w(B,D,Ke({"data-marker":M},U))}function E(M,B,D){D=Ke({size:{width:100}},D);const U=r.createText(B||"",D);return(0,P.classes)(U).add("djs-label"),(0,P.append)(M,U),U}function b(M,B,D){return E(M,xb(B).name,{box:B,align:D,padding:5,style:{fill:nt(B,d)}})}function k(M,B){const D={width:90,height:30,x:B.width/2+B.x,y:B.height/2+B.y};return E(M,Ma(B),{box:D,fitBox:!0,style:Ke({},r.getExternalStyle(),{fill:nt(B,d)})})}function S(M,B,D){const U=D&&D.indexOf("SubProcessMarker")!==-1;let te;U?te={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:te={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},qv(D,le=>{p(le)(M,B,te)})}function _(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function T(M,B){const{ref:D={x:0,y:0},scale:U=1,element:te,parentGfx:le=a._svg}=B,A=(0,P.create)("marker",{id:M,viewBox:"0 0 20 20",refX:D.x,refY:D.y,markerWidth:20*U,markerHeight:20*U,orient:"auto"});(0,P.append)(A,te);let I=(0,G.query)(":scope > defs",le);I||(I=(0,P.create)("defs"),(0,P.append)(le,I)),(0,P.append)(I,A)}function V(M,B,D,U){const te=B+"-"+_(D)+"-"+_(U)+"-"+Ac();return j(M,te,B,D,U),"url(#"+te+")"}function j(M,B,D,U,te){D==="sequenceflow-end"&&T(B,{element:(0,P.create)("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:te,stroke:te,strokeWidth:1})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),D==="messageflow-start"&&T(B,{element:(0,P.create)("circle",{cx:6,cy:6,r:3.5,...h({fill:U,stroke:te,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6},parentGfx:M}),D==="messageflow-end"&&T(B,{element:(0,P.create)("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:U,stroke:te,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5},parentGfx:M}),D==="association-start"&&T(B,{element:(0,P.create)("path",{d:"M 11 5 L 1 10 L 11 15",...u({fill:"none",stroke:te,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5,parentGfx:M}),D==="association-end"&&T(B,{element:(0,P.create)("path",{d:"M 1 5 L 11 10 L 1 15",...u({fill:"none",stroke:te,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),D==="conditional-flow-marker"&&T(B,{element:(0,P.create)("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:U,stroke:te})}),ref:{x:-1,y:10},scale:.5,parentGfx:M}),D==="conditional-default-flow-marker"&&T(B,{element:(0,P.create)("path",{d:"M 6 4 L 10 16",...h({stroke:te,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function z(M,B,D,U){const te=c[B.type]?.icon||B.icon;te&&w(M,o.getScaledPath(te,{abspos:{x:D,y:U}}),{strokeWidth:0,fill:nt(B,c[B.type]?.iconFill||B.iconFill)})}const L={event(M,B,D){return"fillOpacity"in D||(D.fillOpacity=li),v(M,B.width,B.height,D)},startEvent(M,B){const D={fill:Lt(B,c.startEvent?.fill||B.fill),stroke:nt(B,c.startEvent?.stroke||B.stroke),strokeWidth:Pa(B,c.startEvent?.strokeWidth||B.strokeWidth)},U=p("event")(M,B,D);return z(M,B,18,18),U},endEvent(M,B){const D=p("event")(M,B,{strokeWidth:Pa(B,c.endEvent?.strokeWidth||B.strokeWidth||4),fill:Lt(B,c.endEvent?.fill||B.fill),stroke:nt(B,c.endEvent?.stroke||B.stroke)});return z(M,B,18,18),D},gateway(M,B){const D={fillOpacity:li,strokeWidth:Pa(B,c[B.type]?.strokeWidth||B.strokeWidth||4),fill:Lt(B,c[B.type]?.fill||B.fill),stroke:nt(B,c[B.type]?.stroke||B.stroke)};return y(M,B.width,B.height,D)},gatewayAnd(M,B){const D=p("gateway")(M,B);return w(M,o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:c[B.type]?.width||B.width,containerHeight:c[B.type]?.height||B.height,position:{mx:.47,my:.29}}),{strokeWidth:1,fill:nt(B,c[B.type]?.iconFill||B.iconFill),stroke:nt(B,c[B.type]?.iconFill||B.iconFill)}),D},gatewayXor(M,B){const D=p("gateway")(M,B);return w(M,o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:B.width,containerHeight:B.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:nt(B,c[B.type]?.iconFill||B.iconFill),stroke:nt(B,c[B.type]?.iconFill||B.iconFill)}),D},gatewayInclusive(M,B){const D=p("gateway")(M,B);return v(M,B.width,B.height,B.height*.24,{strokeWidth:2.5,fill:nt(B,s),stroke:nt(B,c[B.type]?.iconFill||B.iconFill)}),D},activity(M,B,D){return D=D||{},"fillOpacity"in D||(D.fillOpacity=li),x(M,B.width,B.height,ii,D)},task(M,B){const D={fill:Lt(B,s),stroke:nt(B,d)},U=p("activity")(M,B,D);return b(M,B,"center-middle"),S(M,B),U},userTask(M,B){const D=p("task")(M,B),U=15,te=12;return w(M,o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:te}}),{strokeWidth:.5,fill:Lt(B,s),stroke:nt(B,d)}),w(M,o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:te}}),{strokeWidth:.5,fill:Lt(B,s),stroke:nt(B,d)}),w(M,o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:te}}),{strokeWidth:.5,fill:nt(B,d),stroke:nt(B,d)}),D},scriptTask(M,B){const D=p("task")(M,B);return w(M,o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:nt(B,d)}),D},SubProcessMarker(M,B){Jt(x(M,14,14,0,{strokeWidth:1,fill:Lt(B,s),stroke:nt(B,d)}),B.width/2-7.5,B.height-20),C("sub-process",M,o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:B.width,containerHeight:B.height,position:{mx:(B.width/2-7.5)/B.width,my:(B.height-20)/B.height}}),{fill:Lt(B,s),stroke:nt(B,d)})},subprocess(M,B,D){D=Ke({fill:Lt(B,s),stroke:nt(B,d)},D);const U=p("activity")(M,B,D);return b(M,B,"center-middle"),S(M,B,["SubProcessMarker"]),U},label(M,B){return k(M,B)},myline(M,B){const D=Lt(B,i.lineStroke||s),U=nt(B,i.lineStroke||d);return m(M,B.waypoints,{markerEnd:V(M,"sequenceflow-end",D,U),stroke:U})},default(M,B){const D={strokeWidth:Pa(B,c[B.type]?.strokeWidth||B.strokeWidth||1),fill:Lt(B,c[B.type]?.fill||B.fill),stroke:nt(B,c[B.type]?.stroke||B.stroke)},U=x(M,B.width,B.height,B.radius||ii,D);return b(M,B,"center-middle"),S(M,B),z(M,B,B.iconX,B.iconY),U}};this.handlers=L,this._drawPath=w}(0,on.default)($n,Fn),$n.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],$n.prototype.canRender=function(){return!0},$n.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},$n.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},$n.prototype.getShapePath=function(e){return En(e,"startEvent")||En(e,"endEvent")?kb(e):En(e,"userTask")||En(e,"scriptTask")||En(e,"subprocess")?Sb(e,ii):En(e,"gatewayAnd")||En(e,"gatewayXor")||En(e,"gatewayInclusive")?Eb(e):_b(e)};var Bb=0,Rb={width:150,height:50};function Tb(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Vb(e){return(0,R.isObject)(e)?(0,R.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var si=null;function Mb(){return si||(si=document.createElement("canvas").getContext("2d")),si}function Ab(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(md(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function md(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Nb(e,t){var o=Mb();if(!o)return{width:0,height:0};o.font=Ab(t),"letterSpacing"in o&&(o.letterSpacing=md(t.letterSpacing)||"0px");var a=e==="",r=a?"dummy":e.replace(/\s+$/,""),i=o.measureText(r);return{width:a?0:i.width,height:"fontBoundingBoxAscent"in i?i.fontBoundingBoxAscent+i.fontBoundingBoxDescent:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent}}function jb(e,t,o){for(var a=e.shift(),r=a,i;;){if(i=Nb(r,o),i.width=r?i.width:0,r===" "||r===""||i.width<Math.round(t)||r.length<2)return Pb(e,r,a,i);r=zb(r,i.width,t)}}function Pb(e,t,o,a){if(t.length<o.length){var r=o.slice(t.length).trim();e.unshift(r)}return{width:a.width,height:a.height,text:t}}var yd="";function Hb(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,r=[],i=0;if(o.length>1)for(;a=o.shift();)if(a.length+i<t)r.push(a),i+=a.length;else{(a==="-"||a===yd)&&r.pop();break}var l=r[r.length-1];return l&&l===yd&&(r[r.length-1]="-"),r.join("")}function zb(e,t,o){var a=Math.max(e.length*(o/t),1),r=Hb(e,a);return r||(r=e.slice(0,Math.max(Math.round(a-1),1))),r}function Ha(e){this._config=(0,R.assign)({},{size:Rb,padding:Bb,style:{},align:"center-top"},e||{})}Ha.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ha.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ha.prototype.layoutText=function(e,t){for(var o=(0,R.assign)({},this._config.size,t.box),a=(0,R.assign)({},this._config.style,t.style),r=Tb(t.align||this._config.align),i=Vb(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Ob(a),d=e.split(/\u00AD?\r?\n/),c=[],f=o.width-i.left-i.right;d.length;)c.push(jb(d,f,a));r.vertical==="middle"&&(i.top=i.bottom=0);var p=(0,R.reduce)(c,function(m,v,x){return m+(s||v.height)},0)+i.top+i.bottom,u=(0,R.reduce)(c,function(m,v,x){return v.width>m?v.width:m},0),h=i.top;r.vertical==="middle"&&(h+=(o.height-p)/2),h-=(s||c[0].height)/4;var g=(0,P.create)("text");return(0,P.attr)(g,a),(0,R.forEach)(c,function(m){var v;switch(h+=s||m.height,r.horizontal){case"left":v=i.left;break;case"right":v=(l?u:f)-i.right-m.width;break;default:v=Math.max(((l?u:f)-m.width)/2+i.left,0)}var x=(0,P.create)("tspan");(0,P.attr)(x,{x:v,y:h}),x.textContent=m.text,(0,P.append)(g,x)}),{dimensions:{width:u,height:p},element:g}};function Ob(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Lb=12,Ib=1.2,Db=30;function vd(e){const t=Ke({fontFamily:"Arial, sans-serif",fontSize:Lb,fontWeight:"normal",lineHeight:Ib},e&&e.defaultStyle||{}),o=Ke({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Ha({style:t});this.getExternalLabelBounds=function(r,i){const l=a.getDimensions(i,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:o});return{x:Math.round(r.x+r.width/2-l.width/2),y:Math.round(r.y),width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(r,i){const l=a.getDimensions(i,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(Db,Math.round(l.height))}},this.createText=function(r,i){return a.createText(r,i||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return o}}vd.$inject=["config.textRenderer"];function Fb(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,r;o.abspos?(a=o.abspos.x,r=o.abspos.y):(a=o.containerWidth*o.position.mx,r=o.containerHeight*o.position.my);let i={};typeof t=="object"?(i=t,i.d.indexOf("{mx},{my}")===-1&&(i.d="m {mx},{my}"+i.d),i.width&&(a-=i.width/2),i.height&&(r-=i.height/2)):i=this.pathMap[t];const l={};if(o.position){const s=o.containerHeight/i.height*o.yScaleFactor,d=o.containerWidth/i.width*o.xScaleFactor;for(let c=0;c<i.heightElements.length;c++)l["y"+c]=i.heightElements[c]*s;for(let c=0;c<i.widthElements.length;c++)l["x"+c]=i.widthElements[c]*d}return Jb(i.d,{mx:a,my:r,e:l})}}var $b=/\{([^}]+)\}/g,Wb=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Ub(e,t,o){let a=o;return t.replace(Wb,(r,i,l,s,d)=>{i=i||s,a&&(i in a&&(a=a[i]),typeof a=="function"&&d&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function Jb(e,t){return String(e).replace($b,(o,a)=>Ub(o,a,t))}var bd={__init__:["myRenderer"],myRenderer:["type",$n],textRenderer:["type",vd],pathMap:["type",Fb]};function wd(e,t){return Ke({id:e.id,type:e.type,businessObject:e},t)}function Yb(e,t,o){const a=e.waypoint;return!a||a.length<2?[tt(t),tt(o)]:a.map(r=>({x:r.x,y:r.y}))}function _n(e,t,o,a,r,i){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=r,this._translate=Nc,this._textRenderer=i,this._modeling=t}_n.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],_n.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),r=this._getTarget(e);t=this._elementFactory.createConnection(wd(e,{source:a,target:r,waypoints:Yb(e,a,r)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(wd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},_n.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},_n.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Ke(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:r}=t;if(r&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const i={x:t.x+12,y:t.y+42,width:10,height:10,name:r,id:e},l=this._textRenderer.getExternalLabelBounds(i,t.name);this._modeling.resizeShape(i,l,{width:0,height:0}),o&&this.addLabel(i,o)}}},_n.prototype._getSource=function(e){return this._getElement(e.from)},_n.prototype._getTarget=function(e){return this._getElement(e.to)},_n.prototype._getElement=function(e){return this._elementRegistry.get(e)};var Cd={myImporter:["type",_n]},xd=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(r=>({x:r.x,y:r.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const r=t.find(i=>i.id===a.id);r&&(r.name=a.name||"",r.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},kd=(e,t)=>{const o=t.get("myImporter"),a=e.filter(i=>i.type!=="myline"),r=e.filter(i=>i.type==="myline");a.forEach(i=>{o.add(i)}),r.forEach(i=>{o.add(i)})},Gb=(0,n.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const b=s.get("eventBus");b.on("element.dblclick",k=>{r("elementDblclick",k.element.businessObject)}),b.on("element.click",k=>{r("elementClick",k.element.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},u=()=>{let b={__init__:["myOptions"],myOptions:["type",p]};s=new na.default({canvas:{container:i.value},modules:[Lr,ic,gd,_c,Tc,b,bd,Cd]});const k=s.get("canvas"),S=s.get("elementFactory");c();const _=S.createRoot();k.setRootElement(_),f()};(0,n.onMounted)(()=>{u()});const h=b=>{const k=b==null?1:d+b;s.get("canvas").zoom(k),d=k},g=()=>(s.get("canvas").zoom(1),xd(s.get("elementRegistry").getAll())),m=b=>{s.clear(),c(),kd(b,s)},v=b=>{s.get("myImporter").update(b.id,b)};return t({reset:()=>{c()},zoom:b=>{h(b)},getData:()=>g(),setData:b=>{m(b)},updateElemet:b=>{v(b)}}),(b,k)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:i,class:"j-work-flow"},null,512))}}),Kb=Gb;function ci(e){return e&&e[e.length-1]}function Sd(e){return e.y}function Ed(e){return e.x}var qb={left:Ed,center:Ed,right:function(e){return e.x+e.width},top:Sd,middle:Sd,bottom:function(e){return e.y+e.height}};function go(e,t){this._modeling=e,this._rules=t}go.$inject=["modeling","rules"],go.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},go.prototype._isType=function(e,t){return t.indexOf(e)!==-1},go.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,r=o.dimension,i={},l={},s=!1,d,c,f;function p(u,h){return Math.round((u[a]+h[a]+h[r])/2)}if(this._isType(e,["left","top"]))i[e]=t[0][a];else if(this._isType(e,["right","bottom"]))f=ci(t),i[e]=f[a]+f[r];else if(this._isType(e,["center","middle"])){if((0,R.forEach)(t,function(u){var h=u[a]+Math.round(u[r]/2);l[h]?l[h].elements.push(u):l[h]={elements:[u],center:h}}),d=(0,R.sortBy)(l,function(u){return u.elements.length>1&&(s=!0),u.elements.length}),s)return i[e]=ci(d).center,i;c=t[0],t=(0,R.sortBy)(t,function(u){return u[a]+u[r]}),f=ci(t),i[e]=p(c,f)}return i},go.prototype.trigger=function(e,t){var o=this._modeling,a,r=(0,R.filter)(e,function(d){return!(d.waypoints||d.host||d.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:r}),(0,R.isArray)(a)&&(r=a),!(r.length<2||!a)){var i=qb[t],l=(0,R.sortBy)(r,i),s=this._alignmentPosition(t,l);o.alignElements(l,s)}};var Xb={__init__:["alignElements"],alignElements:["type",go]},za=Math.round,Zb=Math.max;function Qb(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function ew(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var _d=10;function tw(e,t){var o,a;for(o=0;a=e[o];o++)if(Vo(a,t)<=_d)return{point:e[o],bendpoint:!0,index:o};return null}function nw(e,t){var o=gc(Qb(t,_d),ew(e)),a=o[0],r=o[o.length-1],i;return a?a!==r?a.segment2!==r.segment2?(i=Zb(a.segment2,r.segment2)-1,{point:e[i],bendpoint:!0,index:i}):{point:{x:za(a.x+r.x)/2,y:za(a.y+r.y)/2},index:a.segment2}:{point:{x:za(a.x),y:za(a.y)},index:a.segment2}:null}function ow(e,t){return tw(e,t)||nw(e,t)}function aw(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function rw(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],r=a[0].n*t[0]+a[1].n*t[1],i=a[0].lambda*t[0]+a[1].lambda*t[1];return-r/i}function Bd(e,t){var o=t[0],a=t[1],r={x:a.x-o.x,y:a.y-o.y},i=rw([o.x,o.y],[r.x,r.y],[e.x,e.y]);return{x:o.x+i*r.x,y:o.y+i*r.y}}function iw(e,t){var o=Bd(e,t);return aw({x:o.x-e.x,y:o.y-e.y})}var Rd="djs-bendpoint",Td="djs-segment-dragger";function lw(e,t){var o=ro(t),a=e._container.getBoundingClientRect(),r={x:a.left,y:a.top},i=e.viewbox();return{x:i.x+(o.x-r.x)/i.scale,y:i.y+(o.y-r.y)/i.scale}}function di(e,t,o){return ow(t,lw(e,o))}function ui(e,t){var o=(0,P.create)("g");(0,P.classes)(o).add(Rd),(0,P.append)(e,o);var a=(0,P.create)("circle");(0,P.attr)(a,{cx:0,cy:0,r:4}),(0,P.classes)(a).add("djs-visual"),(0,P.append)(o,a);var r=(0,P.create)("circle");return(0,P.attr)(r,{cx:0,cy:0,r:10}),(0,P.classes)(r).add("djs-hit"),(0,P.append)(o,r),t&&(0,P.classes)(o).add(t),o}function sw(e,t,o,a){var r=(0,P.create)("g");(0,P.append)(e,r);var i=18,l=6,s=11,d=dw(t,o,a),c=l+s,f=(0,P.create)("rect");(0,P.attr)(f,{x:-i/2,y:-l/2,width:i,height:l}),(0,P.classes)(f).add("djs-visual"),(0,P.append)(r,f);var p=(0,P.create)("rect");return(0,P.attr)(p,{x:-d/2,y:-c/2,width:d,height:c}),(0,P.classes)(p).add("djs-hit"),(0,P.append)(r,p),Yy(r,a==="v"?90:0,0,0),r}function Vd(e,t,o){var a=(0,P.create)("g"),r=jr(t,o),i=hn(t,o);return(0,P.append)(e,a),sw(a,t,o,i),(0,P.classes)(a).add(Td),(0,P.classes)(a).add(i==="h"?"horizontal":"vertical"),Jt(a,r.x,r.y),a}function fi(e){return Math.abs(Math.round(e*2/3))}function cw(e,t){return Bd(e,uw(e,t))}function dw(e,t,o){var a=t.x-e.x,r=t.y-e.y;return fi(o==="h"?a:r)}function uw(e,t){for(var o=t.waypoints,a=1/0,r,i=0;i<o.length-1;i++){var l=o[i],s=o[i+1],d=iw(e,[l,s]);d<a&&(a=d,r=i)}return[o[r],o[r+1]]}function pi(e){return CSS.escape(e)}function Md(e,t,o,a,r){function i(y,C,E){var b=y.index,k=y.point,S,_,T,V,j,z;return b<=0||y.bendpoint?!1:(S=C[b-1],_=C[b],T=jr(S,_),V=hn(S,_),j=Math.abs(k.x-T.x),z=Math.abs(k.y-T.y),V&&j<=E&&z<=E)}function l(y,C){var E=y.waypoints,b,k,S,_;return C.index<=0||C.bendpoint||(b={start:E[C.index-1],end:E[C.index]},k=hn(b.start,b.end),!k)?null:(k==="h"?S=b.end.x-b.start.x:S=b.end.y-b.start.y,_=fi(S)/2,_)}function s(y,C){var E=C.waypoints,b=di(t,E,y),k;if(b)return k=l(C,b),i(b,E,k)?r.start(y,C,b.index):a.start(y,C,b.index,!b.bendpoint),!0}function d(y,C,E){G.event.bind(y,C,function(b){o.triggerMouseEvent(C,b,E),b.stopPropagation()})}function c(y,C){var E=t.getLayer("overlays"),b=(0,G.query)('.djs-bendpoints[data-element-id="'+pi(y.id)+'"]',E);return!b&&C&&(b=(0,P.create)("g"),(0,P.attr)(b,{"data-element-id":y.id}),(0,P.classes)(b).add("djs-bendpoints"),(0,P.append)(E,b),d(b,"mousedown",y),d(b,"click",y),d(b,"dblclick",y)),b}function f(y,C){return(0,G.query)('.djs-segment-dragger[data-segment-idx="'+y+'"]',C)}function p(y,C){C.waypoints.forEach(function(E,b){var k=ui(y);(0,P.append)(y,k),Jt(k,E.x,E.y)}),ui(y,"floating")}function u(y,C){for(var E=C.waypoints,b,k,S,_=1;_<E.length;_++)b=E[_-1],k=E[_],hn(b,k)&&(S=Vd(y,b,k),(0,P.attr)(S,{"data-segment-idx":_}),d(S,"mousemove",C))}function h(y){(0,R.forEach)((0,G.queryAll)("."+Rd,y),function(C){(0,P.remove)(C)})}function g(y){(0,R.forEach)((0,G.queryAll)("."+Td,y),function(C){(0,P.remove)(C)})}function m(y){var C=c(y);return C||(C=c(y,!0),p(C,y),u(C,y)),C}function v(y){var C=c(y);C&&(g(C),h(C),u(C,y),p(C,y))}function x(y,C){var E=(0,G.query)(".floating",y),b=C.point;E&&Jt(E,b.x,b.y)}function w(y,C,E){var b=f(C.index,y),k=E[C.index-1],S=E[C.index],_=C.point,T=jr(k,S),V=hn(k,S),j,z;b&&(j=fw(b),z={x:_.x-T.x,y:_.y-T.y},V==="v"&&(z={x:z.y,y:z.x}),Jt(j,z.x,z.y))}e.on("connection.changed",function(y){v(y.element)}),e.on("connection.remove",function(y){var C=c(y.element);C&&(0,P.remove)(C)}),e.on("element.marker.update",function(y){var C=y.element,E;C.waypoints&&(E=m(C),y.add?(0,P.classes)(E).add(y.marker):(0,P.classes)(E).remove(y.marker))}),e.on("element.mousemove",function(y){var C=y.element,E=C.waypoints,b,k;if(E){if(b=c(C,!0),k=di(t,E,y.originalEvent),!k)return;x(b,k),k.bendpoint||w(b,k,E)}}),e.on("element.mousedown",function(y){if(fn(y)){var C=y.originalEvent,E=y.element;if(E.waypoints)return s(C,E)}}),e.on("selection.changed",function(y){var C=y.newSelection[0];C&&C.waypoints&&m(C)}),e.on("element.hover",function(y){var C=y.element;C.waypoints&&(m(C),o.registerEvent(y.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(y){o.unregisterEvent(y.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(y){var C=y.element,E=y.newId;if(C.waypoints){var b=c(C);b&&(0,P.attr)(b,{"data-element-id":E})}}),this.addHandles=m,this.updateHandles=v,this.getBendpointsContainer=c,this.getSegmentDragger=f}Md.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function fw(e){return(0,G.query)(".djs-visual",e)}var Ad=Math.round,Wn="reconnectStart",Un="reconnectEnd",Fo="updateWaypoints";function hi(e,t,o,a,r,i){this._injector=e,this.start=function(l,s,d,c){var f=o.getGraphics(s),p=s.source,u=s.target,h=s.waypoints,g;!c&&d===0?g=Wn:!c&&d===h.length-1?g=Un:g=Fo;var m=g===Fo?"connection.updateWaypoints":"connection.reconnect",v=r.allowed(m,{connection:s,source:p,target:u});v===!1&&(v=r.allowed(m,{connection:s,source:u,target:p})),v!==!1&&a.init(l,"bendpoint.move",{data:{connection:s,connectionGfx:f,context:{allowed:v,bendpointIndex:d,connection:s,source:p,target:u,insert:c,type:g}}})},t.on("bendpoint.move.hover",function(l){var s=l.context,d=s.connection,c=d.source,f=d.target,p=l.hover,u=s.type;s.hover=p;var h;if(p){var g=u===Fo?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=r.allowed(g,{connection:d,source:u===Wn?p:c,target:u===Un?p:f}),h){s.source=u===Wn?p:c,s.target=u===Un?p:f;return}h===!1&&(h=s.allowed=r.allowed(g,{connection:d,source:u===Un?p:f,target:u===Wn?p:c})),h&&(s.source=u===Un?p:f,s.target=u===Wn?p:c)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,d=s.type;s.hover=null,s.source=null,s.target=null,d!==Fo&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.context,d=s.allowed,c=s.bendpointIndex,f=s.connection,p=s.insert,u=f.waypoints.slice(),h=s.source,g=s.target,m=s.type,v=s.hints||{},x={x:Ad(l.x),y:Ad(l.y)};if(!d)return!1;m===Fo?(p?u.splice(c,0,x):u[c]=x,v.bendpointMove={insert:p,bendpointIndex:c},u=this.cropWaypoints(f,u),i.updateWaypoints(f,yv(u),v)):(m===Wn?(v.docking="source",Oa(s)&&(v.docking="target",v.newWaypoints=u.reverse())):m===Un&&(v.docking="target",Oa(s)&&(v.docking="source",v.newWaypoints=u.reverse())),i.reconnect(f,h,g,x,v))},this)}hi.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],hi.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Oa(e){var t=e.hover,o=e.source,a=e.target,r=e.type;if(r===Wn)return t&&a&&t===a&&o!==a;if(r===Un)return t&&o&&t===o&&o!==a}var pw="reconnectStart",hw="reconnectEnd",Nd="updateWaypoints",$o="connect-ok",La="connect-not-ok",jd="connect-hover",Pd="djs-updating",Hd="djs-dragging",zd=1100;function Od(e,t,o,a){this._injector=t;var r=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(i){var l=i.context,s=l.bendpointIndex,d=l.connection,c=l.insert,f=d.waypoints,p=f.slice();l.waypoints=f,c&&p.splice(s,0,{x:i.x,y:i.y}),d.waypoints=p,(0,P.classes)(l.draggerGfx=ui(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(d,Hd),a.addMarker(d,Pd)}),o.on("bendpoint.move.hover",function(i){var l=i.context,s=l.allowed,d=l.hover,c=l.type;if(d){if(a.addMarker(d,jd),c===Nd)return;s?(a.removeMarker(d,La),a.addMarker(d,$o)):s===!1&&(a.removeMarker(d,$o),a.addMarker(d,La))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],zd,function(i){var l=i.context,s=l.hover,d=l.target;s&&(a.removeMarker(s,jd),a.removeMarker(s,d?$o:La))}),o.on("bendpoint.move.move",function(i){var l=i.context,s=l.allowed,d=l.bendpointIndex,c=l.draggerGfx,f=l.hover,p=l.type,u=l.connection,h=u.source,g=u.target,m=u.waypoints.slice(),v={x:i.x,y:i.y},x=l.hints||{},w={};r&&(x.connectionStart&&(w.connectionStart=x.connectionStart),x.connectionEnd&&(w.connectionEnd=x.connectionEnd),p===pw?Oa(l)?(w.connectionEnd=w.connectionEnd||v,w.source=g,w.target=f||h,m=m.reverse()):(w.connectionStart=w.connectionStart||v,w.source=f||h,w.target=g):p===hw?Oa(l)?(w.connectionStart=w.connectionStart||v,w.source=f||g,w.target=h,m=m.reverse()):(w.connectionEnd=w.connectionEnd||v,w.source=h,w.target=f||g):(w.noCropping=!0,w.noLayout=!0,m[d]=v),p===Nd&&(m=e.cropWaypoints(u,m)),w.waypoints=m,r.drawPreview(l,s,w)),Jt(c,i.x,i.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],zd,function(i){var l=i.context,s=l.connection,d=l.draggerGfx,c=l.hover,f=l.target;s.waypoints=l.waypoints,(0,P.remove)(d),a.removeMarker(s,Pd),a.removeMarker(s,Hd),c&&(a.removeMarker(c,$o),a.removeMarker(c,f?$o:La)),r&&r.cleanUp(l)})}Od.$inject=["bendpointMove","injector","eventBus","canvas"];var Ld="connect-hover",Id="djs-updating";function Dd(e,t,o){return gi(e,t,e[t]+o)}function gi(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function gw(e,t,o,a){var r=Math.max(t[a],o[a]),i=Math.min(t[a],o[a]),l=20;return gi(t,a,Math.min(Math.max(i+l,e[a]),r-l))}function Fd(e){return e==="x"?"y":"x"}function $d(e,t,o){var a,r;return e.original?e.original:(a=tt(t),r=Fd(o),gi(e,r,a[r]))}function Wd(e,t,o,a,r,i){var l=e.get("connectionDocking",!1);this.start=function(p,u,h){var g,m=o.getGraphics(u),v=h-1,x=h,w=u.waypoints,y=w[v],C=w[x],E=di(o,w,p),b=hn(y,C),k,S;b&&(k=b==="v"?"x":"y",v===0&&(y=$d(y,u.source,k)),x===w.length-1&&(C=$d(C,u.target,k)),E?S=E.point:S={x:(y.x+C.x)/2,y:(y.y+C.y)/2},g={connection:u,segmentStartIndex:v,segmentEndIndex:x,segmentStart:y,segmentEnd:C,axis:k,dragPosition:S},a.init(p,S,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:u,connectionGfx:m,context:g}}))};function s(p,u){if(!l)return u;var h=p.waypoints,g;return p.waypoints=u,g=l.getCroppedWaypoints(p),p.waypoints=h,g}function d(p){r.update("connection",p.connection,p.connectionGfx)}function c(p,u,h){var g=p.newWaypoints,m=g[p.segmentStartIndex+u],v=g[p.segmentEndIndex+u],x=gw(h,m,v,Fd(p.axis));Jt(p.draggerGfx,x.x,x.y)}function f(p,u){var h=0;return{waypoints:p.filter(function(g,m){return Nr(p[m-1],p[m+1],g)?(h=m<=u?h-1:h,!1):!0}),segmentOffset:h}}t.on("connectionSegment.move.start",function(p){var u=p.context,h=p.connection,g=o.getLayer("overlays");u.originalWaypoints=h.waypoints.slice(),u.draggerGfx=Vd(g,u.segmentStart,u.segmentEnd),(0,P.classes)(u.draggerGfx).add("djs-dragging"),o.addMarker(h,Id)}),t.on("connectionSegment.move.move",function(p){var u=p.context,h=u.connection,g=u.segmentStartIndex,m=u.segmentEndIndex,v=u.segmentStart,x=u.segmentEnd,w=u.axis,y=u.originalWaypoints.slice(),C=Dd(v,w,p["d"+w]),E=Dd(x,w,p["d"+w]),b=y.length,k=0;y[g]=C,y[m]=E;var S,_;g<2&&(S=vn(h.source,C),g===1?S==="intersect"&&(y.shift(),y[0]=C,k--):S!=="intersect"&&(y.unshift(v),k++)),m>b-3&&(_=vn(h.target,E),m===b-2?_==="intersect"&&(y.pop(),y[y.length-1]=E):_!=="intersect"&&y.push(x)),u.newWaypoints=h.waypoints=s(h,y),c(u,k,p),u.newSegmentStartIndex=g+k,d(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,o.addMarker(p.hover,Ld)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var u=p.context.hover;u&&o.removeMarker(u,Ld)}),t.on("connectionSegment.move.cleanup",function(p){var u=p.context,h=u.connection;u.draggerGfx&&(0,P.remove)(u.draggerGfx),o.removeMarker(h,Id)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var u=p.context,h=u.connection;h.waypoints=u.originalWaypoints,d(p)}),t.on("connectionSegment.move.end",function(p){var u=p.context,h=u.connection,g=u.newWaypoints,m=u.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var v=f(g,m),x=v.waypoints,w=s(h,x),y=v.segmentOffset,C={segmentMove:{segmentStartIndex:u.segmentStartIndex,newSegmentStartIndex:m+y}};i.updateWaypoints(h,w,C)})}Wd.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var mw=Math.abs,Ud=Math.round;function yw(e,t,o){o=o===void 0?10:o;var a,r;for(a=0;a<t.length;a++)if(r=t[a],mw(r-e)<=o)return r}function vw(e){return{x:e.x,y:e.y}}function bw(e){return{x:e.x+e.width,y:e.y+e.height}}function mo(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Ud(e.x+e.width/2),y:Ud(e.y+e.height/2)}}function Ia(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function sn(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,r=e[t],i=e.snapped=e.snapped||{};return o===!1?i[t]=!1:(i[t]=!0,a=o-r,e[t]+=a,e["d"+t]+=a),r}function Jd(e){return e.children||[]}var ww=Math.abs,Yd=Math.round,mi=10;function Gd(e){function t(i,l){if((0,R.isArray)(i)){for(var s=i.length;s--;)if(ww(i[s]-l)<=mi)return i[s]}else{i=+i;var d=l%i;if(d<mi)return l-d;if(d>i-mi)return l-d+i}return l}function o(i,l){if(i.waypoints)return cw(l,i);if(i.width)return{x:Yd(i.width/2+i.x),y:Yd(i.height/2+i.y)}}function a(i){var l=i.context,s=l.snapPoints,d=l.connection,c=d.waypoints,f=l.segmentStart,p=l.segmentStartIndex,u=l.segmentEnd,h=l.segmentEndIndex,g=l.axis;if(s)return s;var m=[c[p-1],f,u,c[h+1]];return p<2&&m.unshift(o(d.source,i)),h>c.length-3&&m.unshift(o(d.target,i)),l.snapPoints=s={horizontal:[],vertical:[]},(0,R.forEach)(m,function(v){v&&(v=v.original||v,g==="y"&&s.horizontal.push(v.y),g==="x"&&s.vertical.push(v.x))}),s}e.on("connectionSegment.move.move",1500,function(i){var l=a(i),s=i.x,d=i.y,c,f;if(l){c=t(l.vertical,s),f=t(l.horizontal,d);var p=s-c,u=d-f;(0,R.assign)(i,{dx:i.dx-p,dy:i.dy-u,x:c,y:f}),(p||l.vertical.indexOf(s)!==-1)&&sn(i,"x",c),(u||l.horizontal.indexOf(d)!==-1)&&sn(i,"y",f)}});function r(i){var l=i.snapPoints,s=i.connection.waypoints,d=i.bendpointIndex;if(l)return l;var c=[s[d-1],s[d+1]];return i.snapPoints=l={horizontal:[],vertical:[]},(0,R.forEach)(c,function(f){f&&(f=f.original||f,l.horizontal.push(f.y),l.vertical.push(f.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(i){var l=i.context.hover,s=l&&o(l,i);!St(l)||!s||!s.x||!s.y||(sn(i,"x",s.x),sn(i,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(i){var l=i.context,s=r(l),d=l.hover,c=d&&o(d,i),f=i.x,p=i.y,u,h;if(s){u=t(c?s.vertical.concat([c.x]):s.vertical,f),h=t(c?s.horizontal.concat([c.y]):s.horizontal,p);var g=f-u,m=p-h;(0,R.assign)(i,{dx:i.dx-g,dy:i.dy-m,x:i.x-g,y:i.y-m}),(g||s.vertical.indexOf(f)!==-1)&&sn(i,"x",u),(m||s.horizontal.indexOf(p)!==-1)&&sn(i,"y",h)}})}Gd.$inject=["eventBus"];var Cw={__depends__:[zn,uo],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Md],bendpointMove:["type",hi],bendpointMovePreview:["type",Od],connectionSegmentMove:["type",Wd],bendpointSnapping:["type",Gd]},xw="djs-dragger";function cn(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}cn.$inject=["injector","canvas","graphicsFactory","elementFactory"],cn.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,r=e.getConnection,i=o.source,l=o.target,s=o.waypoints,d=o.connectionStart,c=o.connectionEnd,f=o.noLayout,p=o.noCropping,u=o.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,P.clear)(a),r||(r=e.getConnection=kw(function(m,v,x){return g.getConnection(m,v,x)})),t&&(h=r(t,i,l)),!h){!u&&this.drawNoopPreview(a,o);return}h.waypoints=s||[],this._layouter&&!f&&(h.waypoints=this._layouter.layoutConnection(h,{source:i,target:l,connectionStart:d,connectionEnd:c,waypoints:o.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[i?tt(i):d,l?tt(l):c]),this._connectionDocking&&(i||l)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,i,l)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},cn.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,r=t.connectionStart||tt(o),i=t.connectionEnd||tt(a),l=this.cropWaypoints(r,i,o,a);(0,P.append)(e,this.createNoopConnection(l[0],l[1]))},cn.prototype.cropWaypoints=function(e,t,o,a){var r=this._graphicsFactory,i=o&&r.getShapePath(o),l=a&&r.getShapePath(a),s=r.getConnectionPath({waypoints:[e,t]});return e=o&&zr(i,s,!0)||e,t=a&&zr(l,s,!1)||t,[e,t]},cn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,P.remove)(e.connectionPreviewGfx)},cn.prototype.getConnection=function(e){var t=Sw(e);return this._elementFactory.createConnection(t)},cn.prototype.createConnectionPreviewGfx=function(){var e=(0,P.create)("g");return(0,P.attr)(e,{pointerEvents:"none"}),(0,P.classes)(e).add(xw),(0,P.append)(this._canvas.getActiveLayer(),e),e},cn.prototype.createNoopConnection=function(e,t){return _r([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function kw(e){var t={};return function(o){var a=JSON.stringify(o),r=t[a];return r||(r=t[a]=e.apply(null,arguments)),r}}function Sw(e){return(0,R.isObject)(e)?e:{}}var Ew={__init__:["connectionPreview"],connectionPreview:["type",cn]},_w=new ma("ov"),Bw=500;function gt(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=_w,this._overlayDefaults=(0,R.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Rw(o.getContainer()),this._init()}gt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],gt.prototype.get=function(e){if((0,R.isString)(e)&&(e={id:e}),(0,R.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,R.filter)(t.overlays,(0,R.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,R.filter)(this._overlays,(0,R.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},gt.prototype.add=function(e,t,o){if((0,R.isObject)(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=(0,R.assign)({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},gt.prototype.remove=function(e){var t=this.get(e)||[];(0,R.isArray)(t)||(t=[t]);var o=this;(0,R.forEach)(t,function(a){var r=o._getOverlayContainer(a.element,!0);if(a&&((0,G.remove)(a.html),(0,G.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),r){var i=r.overlays.indexOf(a);i!==-1&&r.overlays.splice(i,1)}})},gt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},gt.prototype.show=function(){Da(this._overlayRoot)},gt.prototype.hide=function(){Da(this._overlayRoot,!1)},gt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,G.clear)(this._overlayRoot)},gt.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,r=t.y;if(t.waypoints){var i=Ut(t);a=i.x,r=i.y}Kd(o,a,r),(0,G.attr)(e.html,"data-container-id",t.id)},gt.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,r=t.left,i=t.top;if(t.right!==void 0){var l;a.waypoints?l=Ut(a).width:l=a.width,r=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=Ut(a).height:s=a.height,i=t.bottom*-1+s}Kd(o,r||0,i||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},gt.prototype._createOverlayContainer=function(e){var t=(0,G.domify)('<div class="djs-overlays" />');(0,G.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},gt.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";qd(this._overlayRoot,o)},gt.prototype._getOverlayContainer=function(e,t){var o=(0,R.find)(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},gt.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,r,i;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,R.isString)(a)&&(a=(0,G.domify)(a)),i=this._getOverlayContainer(o),r=(0,G.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,G.assignStyle)(r,{position:"absolute"}),r.appendChild(a),e.type&&(0,G.classes)(r).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(o),s=this._canvas.getRootElement();Da(r,l===s),e.htmlContainer=r,i.overlays.push(e),i.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},gt.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),r=o&&o.minZoom,i=o&&o.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),d=!0;(a!==s||o&&((0,R.isDefined)(r)&&r>t.scale||(0,R.isDefined)(i)&&i<t.scale))&&(d=!1),Da(l,d),this._updateOverlayScale(e,t)},gt.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,r,i=e.htmlContainer,l,s="";o!==!0&&(o===!1?(a=1,r=1):(a=o.min,r=o.max),(0,R.isDefined)(a)&&t.scale<a&&(l=(1/t.scale||1)*a),(0,R.isDefined)(r)&&t.scale>r&&(l=(1/t.scale||1)*r)),(0,R.isDefined)(l)&&(s="scale("+l+","+l+")"),qd(i,s)},gt.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,R.forEach)(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},gt.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var r=a.element;(0,R.forEach)(t.get({element:r}),function(s){t.remove(s.id)});var i=t._getOverlayContainer(r);if(i){(0,G.remove)(i.html);var l=t._overlayContainers.indexOf(i);l!==-1&&t._overlayContainers.splice(l,1)}}),e.on("element.changed",Bw,function(a){var r=a.element,i=t._getOverlayContainer(r,!0);i&&((0,R.forEach)(i.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(a){var r=t._getOverlayContainer(a.element,!0);r&&(0,G.classes)(r.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function Rw(e){var t=(0,G.domify)('<div class="djs-overlay-container" />');return(0,G.assignStyle)(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Kd(e,t,o){(0,G.assignStyle)(e,{left:t+"px",top:o+"px"})}function Da(e,t){e.style.display=t===!1?"none":""}function qd(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}var Tw={__init__:["overlays"],overlays:["type",gt]},Vw=new ma;function yo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}yo.$inject=["eventBus"],yo.prototype.schedule=function(e,t=Vw.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},yo.prototype._schedule=function(e,t){const o=Mw();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(a){o.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:o.promise}},yo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},yo.prototype._cancel=function(e){clearTimeout(e.executionId)};function Mw(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}var Aw={scheduler:["type",yo]},Nw="djs-element-hidden",Fa=".entry",jw=1e3,Xd=8,Pw=300;function rt(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}rt.$inject=["canvas","elementRegistry","eventBus","scheduler"],rt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var r=a.target,i=(0,R.isArray)(r)?r:[r];if(i.filter(function(s){return o.includes(s)}).length){e.close();var l=i.filter(function(s){return e._elementRegistry.get(s.id)});l.length&&e._updateAndOpen(l.length>1?l:l[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current;((0,R.isArray)(a.target)?a.target:[a.target]).includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},rt.prototype._createContainer=function(){var e=(0,G.domify)('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},rt.prototype.registerProvider=function(e,t){t||(t=e,e=jw),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},rt.prototype.getEntries=function(e){var t=this._getProviders(),o=(0,R.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,R.forEach)(t,function(r){if((0,R.isFunction)(r[o])){var i=r[o](e);(0,R.isFunction)(i)?a=i(a):(0,R.forEach)(i,function(l,s){a[s]=l})}}),a},rt.prototype.trigger=function(e,t,o){var a=this,r,i,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(r=(0,G.attr)(l,"data-action"),i=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(r,"hover",i,o)},Pw);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,i,o)},rt.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var r=this._current.target,i=this._current.entries[e];if(i){var l=i.action;if(this._eventBus.fire("contextPad.trigger",{entry:i,event:o})!==!1){if((0,R.isFunction)(l)){if(t==="click")return l(o,r,a)}else if(l[t])return l[t](o,r,a);o.preventDefault()}}}},rt.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},rt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},rt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;(0,R.forEach)(t,function(r,i){var l=r.group||"default",s=(0,G.domify)(r.html||'<div class="entry" draggable="true"></div>'),d;(0,G.attr)(s,"data-action",i),d=(0,G.query)("[data-group="+pi(l)+"]",o),d||(d=(0,G.domify)('<div class="group"></div>'),(0,G.attr)(d,"data-group",l),o.appendChild(d)),d.appendChild(s),r.className&&Hw(s,r.className),r.title&&(0,G.attr)(s,"title",r.title),r.imageUrl&&(a=(0,G.domify)("<img>"),(0,G.attr)(a,"src",r.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,G.classes)(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},rt.prototype._createHtml=function(e){var t=this,o=(0,G.domify)('<div class="djs-context-pad"></div>');return G.delegate.bind(o,Fa,"click",function(a){t.trigger("click",a)}),G.delegate.bind(o,Fa,"dragstart",function(a){t.trigger("dragstart",a)}),G.delegate.bind(o,Fa,"mouseover",function(a){t.trigger("mouseover",a)}),G.delegate.bind(o,Fa,"mouseout",function(a){t.trigger("mouseout",a)}),G.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},rt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&Ow(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},rt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},rt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return(0,R.isArray)(e)!==(0,R.isArray)(o)?!1:(0,R.isArray)(e)?e.length===o.length&&(0,R.every)(e,function(a){return o.includes(a)}):o===e},rt.prototype.isShown=function(){return this.isOpen()&&(0,G.classes)(this._current.html).has("open")},rt.prototype.show=function(){this.isOpen()&&((0,G.classes)(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},rt.prototype.hide=function(){this.isOpen()&&((0,G.classes)(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},rt.prototype._getPosition=function(e){if(!(0,R.isArray)(e)&&St(e)){var t=this._canvas.viewbox(),o=zw(e),a=o.x*t.scale-t.x*t.scale,r=o.y*t.scale-t.y*t.scale;return{left:a+Xd*this._canvas.zoom(),top:r}}var i=this._canvas.getContainer().getBoundingClientRect(),l=this._getTargetBounds(e);return{left:l.right-i.left+Xd*this._canvas.zoom(),top:l.top-i.top}},rt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},rt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target;((0,R.isArray)(o)?o:[o]).some(function(a){return t._canvas.hasMarker(a,Nw)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},rt.prototype._getTargetBounds=function(e){var t=this;return((0,R.isArray)(e)?e:[e]).map(function(o){return t._canvas.getGraphics(o)}).reduce(function(o,a){const r=a.getBoundingClientRect();return o.top=Math.min(o.top,r.top),o.right=Math.max(o.right,r.right),o.bottom=Math.max(o.bottom,r.bottom),o.left=Math.min(o.left,r.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Hw(e,t){var o=(0,G.classes)(e);t=(0,R.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function zw(e){return e.waypoints[e.waypoints.length-1]}function Ow(e,t){return e=(0,R.isArray)(e)?e:[e],t=(0,R.isArray)(t)?t:[t],e.length===t.length&&(0,R.every)(e,function(o){return t.includes(o)})}var Lw={__depends__:[Br,Aw,Tw],contextPad:["type",rt]},Iw=250;function Jn(e){this._eventBus=e,this._tools=[],this._active=null}Jn.$inject=["eventBus"],Jn.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},Jn.prototype.isActive=function(e){return e&&this._active===e},Jn.prototype.length=function(e){return this._tools.length},Jn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Jn.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(r){if(!r.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,R.forEach)(t,function(r){a.push(r+".ended"),a.push(r+".canceled")}),o.on(a,Iw,function(r){this._active&&(Dw(r)||this.setActive(null))},this)};function Dw(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,G.closest)(t,'.group[data-group="tools"]')}var yi={__depends__:[zn],__init__:["toolManager"],toolManager:["type",Jn]};function vi(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}vi.$inject=["eventBus"],vi.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Fw(0,0)};function Fw(e,t){var o=document.createEvent("MouseEvent"),a=e,r=t,i=e,l=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,r,i,l,!1,!1,!1,!1,0,null),o}var bi={__init__:["mouse"],mouse:["type",vi]},wi=1500,Zd="grab";function vo(e,t,o,a,r,i){this._dragging=o,this._mouse=i;var l=this,s=a.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",wi,function(d){if(js(d))return l.activateMove(d.originalEvent,!0),!1}),s&&s.addListener(wi,function(d){if(!(!Qd(d.keyEvent)||l.isActive())){var c=l._mouse.getLastMoveEvent();l.activateMove(c,!!c)}},"keyboard.keydown"),s&&s.addListener(wi,function(d){!Qd(d.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(d){var c=d.originalEvent.target;if(!d.hover&&!(c instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(d.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(d){var c=t.viewbox().scale;t.scroll({dx:d.dx*c,dy:d.dy*c})}),e.on("hand.move.end",function(d){var c=d.context.reactivate;return!js(d)&&c&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}vo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],vo.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Zd,data:{context:o||{}}})},vo.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Zd,data:{context:{reactivate:o}}})},vo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},vo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Qd(e){return Js("Space",e)}var $w={__depends__:[yi,bi],__init__:["handTool"],handTool:["type",vo]},eu="crosshair",tu="selected",Ww="djs-dragging-active-lasso";function Bn(e,t,o,a,r,i,l){this._selection=r,this._dragging=o,this._mouse=l;var s=this,d={create:function(p){var u=t.getActiveLayer(),h=p.frame=(0,P.create)("rect");(0,P.attr)(h,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,P.append)(u,h),c(!0),this.update(p)},update:function(p){var u=p.frame,h=p.bbox;u&&h&&(0,P.attr)(u,{x:h.x,y:h.y,width:h.width,height:h.height});var g=p.marked,m=p.lastMarked;if(g&&m){for(const v of m)g.has(v)||t.removeMarker(v,tu);for(const v of g)m.has(v)||t.addMarker(v,tu)}},remove:function(p){this.update(p),p.frame&&(0,P.remove)(p.frame),c(!1)}};function c(p){(0,P.classes)(t.getContainer()).toggle(Ww,p)}function f(p){var u=a.getAll();return new Set((0,R.values)(Xs(u,p)))}i.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var u=p.originalEvent.target;!p.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var u=p.context;s._select(Array.from(u.marked))}),e.on("lasso.start",function(p){var u=p.context;u.bbox=nu(p),u.add=kr(p),u.lastMarked=new Set(r.get()),u.add?u.marked=u.lastMarked:u.marked=new Set,u.initialMarked=u.marked,d.create(u)}),e.on("lasso.move",function(p){var u=p.context,h=f(u.bbox=nu(p)),g=u.initialMarked.union(h);u.lastMarked=u.marked,u.marked=g,d.update(u)}),e.on("lasso.cleanup",function(p){var u=p.context;u.lastMarked=u.marked,u.marked=new Set(r.get()),d.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(kr(p))return s.activateLasso(p.originalEvent),!0})}Bn.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Bn.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:eu,data:{context:{}},keepSelection:!0})},Bn.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:eu,data:{context:{}},keepSelection:!0})},Bn.prototype._select=function(e){this._selection.select(e)},Bn.prototype.select=function(e,t,o=[]){var a=(0,R.values)(Xs(e,t));this._select([...o,...a])},Bn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Bn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function nu(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}var Uw={__depends__:[yi,bi],__init__:["lassoTool"],lassoTool:["type",Bn]},ou="connect-ok",au="connect-not-ok";function bo(e,t,o,a,r,i,l){var s=this;this._dragging=t,this._rules=i,this._mouse=l,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(d){var c=d.context,f=d.hover,p=c.canStartConnect=s.canStartConnect(f);p!==null&&(c.startTarget=f,a.addMarker(f,p?ou:au))}),e.on(["global-connect.out","global-connect.cleanup"],function(d){var c=d.context.startTarget,f=d.context.canStartConnect;c&&a.removeMarker(c,f?ou:au)}),e.on(["global-connect.ended"],function(d){var c=d.context.startTarget,f={x:d.x,y:d.y};if(s.canStartConnect(c))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,c,f)}),!1})}bo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],bo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},bo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},bo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Jw={__depends__:[Lr,uo,zn,yi,bi],globalConnect:["type",bo]},Yw=500,Gw=1e3;function Yn(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function r(i){var l=(0,P.create)("rect");return(0,P.attr)(l,(0,R.assign)({x:0,y:0,rx:4,width:100,height:100},o)),l}e.on(["shape.added","shape.changed"],Yw,function(i){var l=i.element,s=i.gfx,d=(0,G.query)(".djs-outline",s);d||(d=a.getOutline(l)||r(s),(0,P.append)(s,d)),a.updateShapeOutline(d,l)}),e.on(["connection.added","connection.changed"],function(i){var l=i.element,s=i.gfx,d=(0,G.query)(".djs-outline",s);d||(d=r(s),(0,P.append)(s,d)),a.updateConnectionOutline(d,l)})}Yn.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&(0,R.forEach)(a,function(r){o=o||r.updateOutline(t,e)}),o||(0,P.attr)(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},Yn.prototype.updateConnectionOutline=function(e,t){var o=Ut(t);(0,P.attr)(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},Yn.prototype.registerProvider=function(e,t){t||(t=e,e=Gw),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},Yn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Yn.prototype.getOutline=function(e){var t;return(0,R.forEach)(this._getProviders(),function(o){(0,R.isFunction)(o.getOutline)&&(t=t||o.getOutline(e))}),t},Yn.$inject=["eventBus","styles","elementRegistry"];var $a=6;function Ci(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(r){o.isSelected(r.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(r){var i=r.newSelection;a._updateMultiSelectionOutline(i)})}Ci.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,P.clear)(t);var o=e.length>1;if((0,P.classes)(this._canvas.getContainer())[o?"add":"remove"]("djs-multi-select"),!!o){var a=Kw(Ut(e)),r=(0,P.create)("rect");(0,P.attr)(r,(0,R.assign)({rx:3},a)),(0,P.classes)(r).add("djs-selection-outline"),(0,P.append)(t,r)}},Ci.$inject=["eventBus","canvas","selection"];function Kw(e){return{x:e.x-$a,y:e.y-$a,width:e.width+$a*2,height:e.height+$a*2}}var ru={__depends__:[lo],__init__:["outline","multiSelectionOutline"],outline:["type",Yn],multiSelectionOutline:["type",Ci]},qw=500,Xw=1250,Zw=1500,Wa=Math.round;function Qw(e){return{x:e.x+Wa(e.width/2),y:e.y+Wa(e.height/2)}}function iu(e,t,o,a,r){function i(s,d,c,f){return r.allowed("elements.move",{shapes:s,delta:d,position:c,target:f})}e.on("shape.move.start",Zw,function(s){var d=s.context,c=s.shape,f=a.get().slice();f.indexOf(c)===-1&&(f=[c]),f=eC(f),(0,R.assign)(d,{shapes:f,validatedShapes:f,shape:c})}),e.on("shape.move.start",Xw,function(s){var d=s.context,c=d.validatedShapes;if(!(d.canExecute=i(c)))return!1}),e.on("shape.move.move",qw,function(s){var d=s.context,c=d.validatedShapes,f=s.hover,p={x:s.dx,y:s.dy},u=i(c,p,{x:s.x,y:s.y},f);if(d.delta=p,d.canExecute=u,u===null){d.target=null;return}d.target=f}),e.on("shape.move.end",function(s){var d=s.context,c=d.delta,f=d.canExecute,p=f==="attach",u=d.shapes;if(f===!1)return!1;c.x=Wa(c.x),c.y=Wa(c.y),!(c.x===0&&c.y===0)&&o.moveElements(u,c,d.target,{primaryShape:d.shape,attach:p})}),e.on("element.mousedown",function(s){if(fn(s)){var d=ao(s);if(!d)throw new Error("must supply DOM mousedown event");return l(d,s.element)}});function l(s,d,c,f){if((0,R.isObject)(c)&&(f=c,c=!1),!(d.waypoints||!d.parent)&&!(0,P.classes)(s.target).has("djs-hit-no-move")){var p=Qw(d);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:c,data:{shape:d,context:f||{}}}),!0}}this.start=l}iu.$inject=["eventBus","dragging","modeling","selection","rules"];function eC(e){var t=(0,R.groupBy)(e,"id");return(0,R.filter)(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var lu=499,xi="djs-dragging",su="drop-ok",cu="drop-not-ok",du="new-parent",uu="attach-ok";function fu(e,t,o,a){function r(d){return tC(i(d))}function i(d){var c=Iy(d,!0),f=c.flatMap(u=>(u.incoming||[]).concat(u.outgoing||[])),p=c.concat(f);return[...new Set(p)]}function l(d,c){[uu,su,cu,du].forEach(function(f){f===c?t.addMarker(d,f):t.removeMarker(d,f)})}function s(d,c,f){a.addDragger(c,d.dragGroup),f&&t.addMarker(c,xi),d.allDraggedElements?d.allDraggedElements.push(c):d.allDraggedElements=[c]}e.on("shape.move.start",lu,function(d){var c=d.context,f=c.shapes,p=c.allDraggedElements,u=r(f);if(!c.dragGroup){var h=(0,P.create)("g");(0,P.attr)(h,o.cls("djs-drag-group",["no-events"])),(0,P.append)(t.getActiveLayer(),h),c.dragGroup=h}u.forEach(function(g){a.addDragger(g,c.dragGroup)}),p?p=(0,R.flatten)([p,i(f)]):p=i(f),(0,R.forEach)(p,function(g){t.addMarker(g,xi)}),c.allDraggedElements=p,c.differentParents=nC(f)}),e.on("shape.move.move",lu,function(d){var c=d.context,f=c.dragGroup,p=c.target,u=c.shape.parent,h=c.canExecute;p&&(h==="attach"?l(p,uu):c.canExecute&&u&&p.id!==u.id?l(p,du):l(p,c.canExecute?su:cu)),Jt(f,d.dx,d.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(d){var c=d.context.target;c&&l(c,null)}),e.on("shape.move.cleanup",function(d){var c=d.context,f=c.allDraggedElements,p=c.dragGroup;(0,R.forEach)(f,function(u){t.removeMarker(u,xi)}),p&&(0,P.remove)(p)}),this.makeDraggable=s}fu.$inject=["eventBus","canvas","styles","previewSupport"];function tC(e){return(0,R.filter)(e,function(t){return St(t)?(0,R.find)(e,(0,R.matchPattern)({id:t.source.id}))&&(0,R.find)(e,(0,R.matchPattern)({id:t.target.id})):!0})}function nC(e){return(0,R.size)((0,R.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var oC={__depends__:[Br,lo,ru,uo,zn,Vr],__init__:["move","movePreview"],move:["type",iu],movePreview:["type",fu]},pu=".djs-palette-toggle",hu=".entry",aC=pu+", "+hu,ki="djs-palette-",rC="shown",Si="open",gu="two-column",iC=1e3;function it(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var r=a.tool;o.updateToolHighlight(r)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}it.$inject=["eventBus","canvas"],it.prototype.registerProvider=function(e,t){t||(t=e,e=iC),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},it.prototype.getEntries=function(){return this._getProviders().reduce(sC,{})},it.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},it.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=(0,G.domify)(it.HTML_MARKUP);o.appendChild(a),(0,G.classes)(o).add(ki+rC),G.delegate.bind(a,aC,"click",function(r){var i=r.delegateTarget;if((0,G.matches)(i,pu))return e.toggle();e.trigger("click",r)}),G.event.bind(a,"mousedown",function(r){r.stopPropagation()}),G.delegate.bind(a,hu,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},it.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},it.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,r,i=(0,G.classes)(o),l=(0,G.classes)(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),i.toggle(gu,r),l.toggle(ki+gu,r),"open"in e&&(i.toggle(Si,e.open),l.toggle(ki+Si,e.open)),a.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},it.prototype._update=function(){var e=(0,G.query)(".djs-palette-entries",this._container),t=this._entries=this.getEntries();(0,G.clear)(e),(0,R.forEach)(t,function(o,a){var r=o.group||"default",i=(0,G.query)("[data-group="+pi(r)+"]",e);i||(i=(0,G.domify)('<div class="group"></div>'),(0,G.attr)(i,"data-group",r),e.appendChild(i));var l=(0,G.domify)(o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(i.appendChild(l),!o.separator&&((0,G.attr)(l,"data-action",a),o.title&&(0,G.attr)(l,"title",o.title),o.className&&lC(l,o.className),o.imageUrl)){var s=(0,G.domify)("<img>");(0,G.attr)(s,"src",o.imageUrl),l.appendChild(s)}}),this.open()},it.prototype.trigger=function(e,t,o){var a,r,i=t.delegateTarget||t.target;return i?(a=(0,G.attr)(i,"data-action"),r=t.originalEvent||t,this.triggerEntry(a,e,r,o)):t.preventDefault()},it.prototype.triggerEntry=function(e,t,o,a){var r=this._entries[e],i;if(r&&(i=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if((0,R.isFunction)(i)){if(t==="click")return i(o,a)}else if(i[t])return i[t](o,a);o.preventDefault()}},it.prototype._layoutChanged=function(){this._toggleState({})},it.prototype._needsCollapse=function(e,t){return e<Object.keys(t).length*46+50},it.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},it.prototype.open=function(){this._toggleState({open:!0})},it.prototype.toggle=function(){this.isOpen()?this.close():this.open()},it.prototype.isActiveTool=function(e){return e&&this._activeTool===e},it.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=(0,G.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,G.query)("[data-group=tools]",t)),o=this._toolsContainer,(0,R.forEach)(o.children,function(a){var r=a.getAttribute("data-action");if(r){var i=(0,G.classes)(a);r=r.replace("-tool",""),i.contains("entry")&&r===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}})},it.prototype.isOpen=function(){return(0,G.classes)(this._container).has(Si)},it.prototype._getParentContainer=function(){return this._canvas.getContainer()},it.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function lC(e,t){var o=(0,G.classes)(e);((0,R.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){o.add(a)})}function sC(e,t){var o=t.getPaletteEntries();return(0,R.isFunction)(o)?o(e):((0,R.forEach)(o,function(a,r){e[r]=a}),e)}var cC={__init__:["palette"],palette:["type",it]};function mu(e,t,o,a){e.on("element.changed",function(r){var i=r.element;(i.parent||i===t.getRootElement())&&(r.gfx=o.getGraphics(i)),r.gfx&&e.fire(Fy(i)+".changed",r)}),e.on("elements.changed",function(r){var i=r.elements;i.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(i)}),e.on("shape.changed",function(r){a.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){a.update("connection",r.element,r.gfx)})}mu.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var dC={__init__:["changeSupport"],changeSupport:["type",mu]},Ua=Math.max,Ja=Math.min,uC=20;function fC(e,t,o){var a=o.x,r=o.y,i={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(i.y=e.y+r,i.height=e.height-r):t.indexOf("s")!==-1&&(i.height=e.height+r),t.indexOf("e")!==-1?i.width=e.width+a:t.indexOf("w")!==-1&&(i.x=e.x+a,i.width=e.width-a),i}function Ya(e,t,o){var a=t[e],r=o.min&&o.min[e],i=o.max&&o.max[e];return(0,R.isNumber)(r)&&(a=(/top|left/.test(e)?Ja:Ua)(a,r)),(0,R.isNumber)(i)&&(a=(/top|left/.test(e)?Ua:Ja)(a,i)),a}function pC(e,t){if(!t)return e;var o=Ie(e);return wc({top:Ya("top",o,t),right:Ya("right",o,t),bottom:Ya("bottom",o,t),left:Ya("left",o,t)})}function hC(e,t,o,a){var r=Ie(t),i={top:/n/.test(e)?r.bottom-o.height:r.top,left:/w/.test(e)?r.right-o.width:r.left,bottom:/s/.test(e)?r.top+o.height:r.bottom,right:/e/.test(e)?r.left+o.width:r.right},l=a?Ie(a):i;return wc({top:Ja(i.top,l.top),left:Ja(i.left,l.left),bottom:Ua(i.bottom,l.bottom),right:Ua(i.right,l.right)})}function Wo(e,t){return typeof e<"u"?e:uC}function gC(e,t){var o,a,r,i;return typeof t=="object"?(o=Wo(t.left),a=Wo(t.right),r=Wo(t.top),i=Wo(t.bottom)):o=a=r=i=Wo(t),{x:e.x-o,y:e.y-r,width:e.width+o+a,height:e.height+r+i}}function mC(e){return!(e.waypoints||e.type==="label")}function yC(e,t){var o;if(e.length===void 0?o=(0,R.filter)(e.children,mC):o=e,o.length)return gC(Ut(o),t)}var yu=10;function Uo(e,t,o,a){this._dragging=a,this._rules=t;var r=this;function i(d,c){var f=d.shape,p=d.direction,u=d.resizeConstraints,h;d.delta=c,h=fC(f,p,c),d.newBounds=pC(h,u),d.canExecute=r.canResize(d)}function l(d){var c=d.resizeConstraints,f=d.minBounds;c===void 0&&(f===void 0&&(f=r.computeMinResizeBox(d)),d.resizeConstraints={min:Ie(f)})}function s(d){var c=d.shape,f=d.canExecute,p=d.newBounds;if(f){if(p=pv(p),!vC(c,p))return;o.resizeShape(c,p)}}e.on("resize.start",function(d){l(d.context)}),e.on("resize.move",function(d){var c={x:d.dx,y:d.dy};i(d.context,c)}),e.on("resize.end",function(d){s(d.context)})}Uo.prototype.canResize=function(e){var t=this._rules,o=(0,R.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},Uo.prototype.activate=function(e,t,o){var a=this._dragging,r,i;if(typeof o=="string"&&(o={direction:o}),r=(0,R.assign)({shape:t},o),i=r.direction,!i)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,vu(t,i),"resize",{autoActivate:!0,cursor:bC(i),data:{shape:t,context:r}})},Uo.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction;return hC(o,t,e.minDimensions||{width:yu,height:yu},yC(t,e.childrenBoxPadding))},Uo.$inject=["eventBus","rules","modeling","dragging"];function vC(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function vu(e,t){var o=tt(e),a=Ie(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function bC(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var bu="djs-resizing",wu="resize-not-ok",wC=500;function Cu(e,t,o){function a(i){var l=i.shape,s=i.newBounds,d=i.frame;d||(d=i.frame=o.addFrame(l,t.getActiveLayer()),t.addMarker(l,bu)),s.width>5&&(0,P.attr)(d,{x:s.x,width:s.width}),s.height>5&&(0,P.attr)(d,{y:s.y,height:s.height}),i.canExecute?(0,P.classes)(d).remove(wu):(0,P.classes)(d).add(wu)}function r(i){var l=i.shape;i.frame&&(0,P.remove)(i.frame),t.removeMarker(l,bu)}e.on("resize.move",wC,function(i){a(i.context)}),e.on("resize.cleanup",function(i){r(i.context)})}Cu.$inject=["eventBus","canvas","previewSupport"];var Ga=-6,Ka=8,qa=20,Jo="djs-resizer",CC=["n","w","s","e","nw","ne","se","sw"];function Rn(e,t,o,a){this._resize=a,this._canvas=t;var r=this;e.on("selection.changed",function(i){var l=i.newSelection;r.removeResizers(),l.length===1&&(0,R.forEach)(l,(0,R.bind)(r.addResizer,r))}),e.on("shape.changed",function(i){var l=i.element;o.isSelected(l)&&(r.removeResizers(),r.addResizer(l))})}Rn.prototype.makeDraggable=function(e,t,o){var a=this._resize;function r(i){fn(i)&&a.activate(i,e,o)}G.event.bind(t,"mousedown",r),G.event.bind(t,"touchstart",r)},Rn.prototype._createResizer=function(e,t,o,a){var r=this._getResizersParent(),i=xC(a),l=(0,P.create)("g");(0,P.classes)(l).add(Jo),(0,P.classes)(l).add(Jo+"-"+e.id),(0,P.classes)(l).add(Jo+"-"+a),(0,P.append)(r,l);var s=(0,P.create)("rect");(0,P.attr)(s,{x:-Ka/2+i.x,y:-Ka/2+i.y,width:Ka,height:Ka}),(0,P.classes)(s).add(Jo+"-visual"),(0,P.append)(l,s);var d=(0,P.create)("rect");return(0,P.attr)(d,{x:-qa/2+i.x,y:-qa/2+i.y,width:qa,height:qa}),(0,P.classes)(d).add(Jo+"-hit"),(0,P.append)(l,d),Jy(l,t,o),l},Rn.prototype.createResizer=function(e,t){var o=vu(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},Rn.prototype.addResizer=function(e){var t=this;St(e)||!this._resize.canResize({shape:e})||(0,R.forEach)(CC,function(o){t.createResizer(e,o)})},Rn.prototype.removeResizers=function(){(0,P.clear)(this._getResizersParent())},Rn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Rn.$inject=["eventBus","canvas","selection","resize"];function xC(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ga:e.indexOf("w")!==-1&&(t.x=Ga),e.indexOf("s")!==-1?t.y=-Ga:e.indexOf("n")!==-1&&(t.y=Ga),t}var kC={__depends__:[uo,zn,Vr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Uo],resizePreview:["type",Cu],resizeHandles:["type",Rn]};function Yo(e,t,o,a,r,i){this._canvas=t,this._modeling=a,this._textRenderer=i,o.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{r.removeResizers()}),e.on("create.end",500,s=>{const{context:d,isTouch:c}=s,f=d.shape,{canExecute:p}=s.context;c||p&&(d.hints&&d.hints.createElementsBehavior===!1||l(f))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,d){(d||ei(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}Yo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Yo.prototype.activate=function(e){const t=Ma(e);if(t===void 0)return;const o={text:t};Ke(o,this.getEditingBBox(e));const a={};return(ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Ke(a,{centerVertically:!0}),ti(e)&&Ke(a,{autoResize:!0}),Ke(o,{options:a}),o},Yo.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),r={x:a.x+a.width/2,y:a.y+a.height/2},i={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),d=this._textRenderer.getExternalStyle(),c=d.fontSize*l,f=d.lineHeight,p=s.fontSize*l,u=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Ke(i,{width:a.width,height:a.height}),Ke(h,{fontSize:p+"px",lineHeight:u,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const g=90*l,m=7*l,v=4*l;if(o.labelTarget&&(Ke(i,{width:g,height:a.height+m+v,x:r.x-g/2,y:a.y-m}),Ke(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:v+"px"})),ti(o)&&!nd(o)&&!Io(o)){const x=od(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),y=c+m+v;Ke(i,{width:g,height:y,x:w.x-g/2,y:w.y-y/2}),Ke(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:v+"px"})}return{bounds:i,style:h}},Yo.prototype.update=function(e,t){let o;SC(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function SC(e){return!e||!e.trim()}var EC={__depends__:[dC,kC,dr.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",Yo]};function Tn(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Tn.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Tn.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Tn.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},Tn.prototype.getSnapLocations=function(){return this._snapLocations},Tn.prototype.setSnapLocations=function(e){this._snapLocations=e},Tn.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new Xa,o.initDefaults(this._defaultSnaps)),o};function Xa(){this._snapValues={}}Xa.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},Xa.prototype.snap=function(e,t,o,a){var r=this._snapValues[t];return r&&yw(e[o],r[o],a)},Xa.prototype.initDefaults=function(e){var t=this;(0,R.forEach)(e||{},function(o,a){(0,R.forEach)(o,function(r){t.add(a,r)})})};var _C=1250;function qt(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){a.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],_C,function(r){var i=r.context,l=i.shape,s=i.snapContext,d=i.target;if(!(r.originalEvent&&Us(r.originalEvent))&&!(Ia(r)||!d)){var c=s.pointsForTarget(d);c.initialized||(c=a.addSnapTargetPoints(c,l,d),c.initialized=!0),o.snap(r,c)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}qt.$inject=["elementRegistry","eventBus","snapping"],qt.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,r=o.snapContext;r||(r=o.snapContext=new Tn);var i;t.get(a.id)?i=mo(a,e):i={x:e.x+mo(a).x,y:e.y+mo(a).y};var l={x:i.x-a.width/2,y:i.y-a.height/2},s={x:i.x+a.width/2,y:i.y+a.height/2};return r.setSnapOrigin("mid",{x:i.x-e.x,y:i.y-e.y}),fo(a)||(r.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},qt.prototype.addSnapTargetPoints=function(e,t,o){return(0,R.forEach)(this.getSnapTargets(t,o),function(a){if(fo(a)){fo(t)&&e.add("mid",mo(a));return}if(St(a)){if(a.waypoints.length<3)return;(0,R.forEach)(a.waypoints.slice(1,-1),function(r){e.add("mid",r)});return}e.add("mid",mo(a))}),!(0,R.isNumber)(t.x)||!(0,R.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",mo(t)),e},qt.prototype.getSnapTargets=function(e,t){return Jd(t).filter(function(o){return!BC(o)})};function BC(e){return!!e.hidden}function wo(e){e.invoke(qt,this)}(0,on.default)(wo,qt),wo.$inject=["injector"],wo.prototype.initSnap=function(e){return qt.prototype.initSnap.call(this,e)},wo.prototype.addSnapTargetPoints=function(e,t,o){return qt.prototype.addSnapTargetPoints.call(this,e,t,o)},wo.prototype.getSnapTargets=function(e,t){return qt.prototype.getSnapTargets.call(this,e,t)};var RC=1250;function Go(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],RC,function(a){var r=a.context,i=r.shape,l=i.parent,s=r.direction,d=r.snapContext;if(!(a.originalEvent&&Us(a.originalEvent))&&!Ia(a)){var c=d.pointsForTarget(l);c.initialized||(c=o.addSnapTargetPoints(c,i,l,s),c.initialized=!0),MC(s)&&sn(a,"x",a.x),AC(s)&&sn(a,"y",a.y),t.snap(a,c)}}),e.on(["resize.cleanup"],function(){t.hide()})}Go.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,r=t.snapContext;r||(r=t.snapContext=new Tn);var i=xu(o,a);return r.setSnapOrigin("corner",{x:i.x-e.x,y:i.y-e.y}),r},Go.prototype.addSnapTargetPoints=function(e,t,o,a){return(0,R.forEach)(this.getSnapTargets(t,o),function(r){e.add("corner",bw(r)),e.add("corner",vw(r))}),e.add("corner",xu(t,a)),e},Go.$inject=["eventBus","snapping"],Go.prototype.getSnapTargets=function(e,t){return Jd(t).filter(function(o){return!TC(o,e)&&!St(o)&&!VC(o)&&!fo(o)})};function xu(e,t){var o=tt(e),a=Ie(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function TC(e,t){return e.host===t}function VC(e){return!!e.hidden}function MC(e){return e==="n"||e==="s"}function AC(e){return e==="e"||e==="w"}var NC=7,jC=1e3;function Vn(e){this._canvas=e,this._asyncHide=(0,R.debounce)((0,R.bind)(this.hide,this),jC)}Vn.$inject=["canvas"],Vn.prototype.snap=function(e,t){var o=e.context.snapContext,a=o.getSnapLocations(),r={x:Ia(e,"x"),y:Ia(e,"y")};(0,R.forEach)(a,function(i){var l=o.getSnapOrigin(i),s={x:e.x+l.x,y:e.y+l.y};if((0,R.forEach)(["x","y"],function(d){var c;r[d]||(c=t.snap(s,i,d,NC),c!==void 0&&(r[d]={value:c,originValue:c-l[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),(0,R.forEach)(["x","y"],function(i){var l=r[i];(0,R.isObject)(l)&&sn(e,i,l.originValue)})},Vn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=(0,P.create)("path");return(0,P.attr)(o,{d:"M0,0 L0,0"}),(0,P.classes)(o).add("djs-snap-line"),(0,P.append)(t,o),{update:function(a){(0,R.isNumber)(a)?e==="horizontal"?(0,P.attr)(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,P.attr)(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,P.attr)(o,{display:"none"})}}},Vn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Vn.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Vn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Vn.prototype.hide=function(){(0,R.forEach)(this._snapLines,function(e){e.update()})};var PC={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",qt],resizeSnapping:["type",Go],snapping:["type",Vn]},HC={__depends__:[PC],__init__:["createMoveSnapping"],createMoveSnapping:["type",wo]};function Co(e){vt.call(this,e),this.init()}Co.$inject=["eventBus"],On(Co,vt),Co.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){a.canExecute(r,t,function(i,l,s){return o(i)},!0)})},Co.prototype.init=function(){};function Ko(e){Co.call(this,e)}Ko.$inject=["eventBus"],(0,on.default)(Ko,Co),Ko.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},r=a.targetParent;if(a.targetAttach)return!1;r&&(o.parent=r);try{return Ei(t,o)}finally{r&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,o=e.source,a=e.target;return Ei(o,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return $y(t)})},Ko.prototype.canConnect=Ei;function Ei(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var zC={__init__:["myRuleProvider"],myRuleProvider:["type",Ko]};function _i(e,t,o,a,r,i,l){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=r,this._palette=i,this._myOptions=l,i.registerProvider(this)}_i.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],_i.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,r=this._globalConnect,i=this._myOptions;function l(d,c,f,p,u){function h(g){const m=t.createShape(Ke({type:d},u));e.start(g,m)}return{group:c,className:f,title:p,action:{dragstart:h,click:h}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(d){o.activateHand(d)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(d){a.activateSelection(d)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(d){r.toggle(d)}}},"tool-separator":{group:"tools",separator:!0}};for(const d in i.palette){const c=i.palette[d];s[d]=l(c.type,c.group,c.className,c.title,c.options)}return s};var OC={__init__:["paletteProvider"],paletteProvider:["type",_i]},wx=50,LC=250;function IC(e,t){t||(t={});function o(u){return u.source===e?1:-1}var a=t.defaultDistance||50,r=t.direction||"e",i=t.filter,l=t.getWeight||o,s=t.maxDistance||LC,d=t.reference||"start";i||(i=DC);function c(u,h){return r==="n"?d==="start"?Ie(u).top-Ie(h).bottom:d==="center"?Ie(u).top-tt(h).y:Ie(u).top-Ie(h).top:r==="w"?d==="start"?Ie(u).left-Ie(h).right:d==="center"?Ie(u).left-tt(h).x:Ie(u).left-Ie(h).left:r==="s"?d==="start"?Ie(h).top-Ie(u).bottom:d==="center"?tt(h).y-Ie(u).bottom:Ie(h).bottom-Ie(u).bottom:d==="start"?Ie(h).left-Ie(u).right:d==="center"?tt(h).x-Ie(u).right:Ie(h).right-Ie(u).right}var f=e.incoming.filter(i).map(function(u){var h=l(u),g=h<0?c(u.source,e):c(e,u.source);return{id:u.source.id,distance:g,weight:h}}),p=e.outgoing.filter(i).map(function(u){var h=l(u),g=h>0?c(e,u.target):c(u.target,e);return{id:u.target.id,distance:g,weight:h}});return(0,R.reduce)(f.concat(p).reduce(function(u,h){return u[h.id+"__weight_"+h.weight]=h,u},{}),function(u,h){var g=h.distance,m=h.weight;return g<0||g>s||(u[String(g)]||(u[String(g)]=0),u[String(g)]+=1*m,(!u.distance||u[u.distance]<u[String(g)])&&(u.distance=g)),u},{}).distance||a}function DC(){return!0}var FC=100;function ku(e,t,o){e.on("autoPlace",FC,function(a){var r=a.shape,i=a.source;return $C(i,r)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,r,i){e.fire("autoPlace.start",{source:a,shape:r});var l=e.fire("autoPlace",{source:a,shape:r}),s=t.appendShape(a,r,l,a.parent,i);return e.fire("autoPlace.end",{source:a,shape:s}),s}}ku.$inject=["eventBus","modeling","canvas"];function $C(e,t,o){o||(o={});var a=o.defaultDistance||50,r=tt(e);return{x:Ie(e).right+a+t.width/2,y:r.y}}function Su(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}Su.$inject=["eventBus","selection"];var WC={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ku],autoPlaceSelectionBehavior:["type",Su]},UC=10,JC=(e,t)=>e.type===t;function YC(e){return e.incoming.map(t=>t.source)}function GC(e){return e.outgoing.map(t=>t.target)}function Bi(e){return GC(e).concat(YC(e))}function KC(e){let t=Bi(e);return e.host&&(t=t.concat(Bi(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(Bi(a)),[]))),t.filter(o=>o.type!=="myline")}function qC(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height};return(0,R.find)(KC(e),r=>r===o?!1:vn(r,a,UC)==="intersect")}function XC(e,t,o,a){let r;for(;r=qC(e,o,t);)o=a(t,o,r);return o}function ZC(e){return function(t,o,a){const r={x:o.x,y:o.y};return["x","y"].forEach(i=>{const l=e[i];if(!l)return;const s=i==="x"?"width":"height",{margin:d,minDistance:c}=l;d<0?r[i]=Math.min(a[i]+d-t[s]/2,o[i]-c+d):r[i]=Math.max(a[i]+a[s]+d+t[s]/2,o[i]+c+d)}),r}}function QC(e,t){return ex(e,t)}function ex(e,t){const o=Ie(e),a=tt(e),r=IC(e,{filter:s=>JC(s,"myline")}),i=30,l=80;return XC(e,t,{x:o.right+r+t.width/2,y:a.y+tx("left",l)},ZC({y:{margin:i,minDistance:l}}))}function tx(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Eu(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return QC(a,o)})}Eu.$inject=["eventBus"];var nx={__depends__:[WC],__init__:["myAutoPlace"],myAutoPlace:["type",Eu]};function Ri(e,t,o,a,r,i,l){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=r,this._create=i,this._myOptions=l,t.registerProvider(this)}Ri.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Ri.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,r=this._autoPlace,i=this._create,l=this._myOptions;function s(){o.removeElements([e])}function d(p,u,h){t.start(p,u,h)}function c(p,u,h,g){typeof h!="string"&&(g=h);function m(x,w){const y=a.createShape(Ke({type:p},g));i.start(x,y,{source:w})}function v(x,w){const y=a.createShape(Ke({type:p},g));r.append(w,y)}return{group:"model",className:u,title:h,action:{dragstart:m,click:v}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const f={};for(const p in l.palette)if(p!=="create.start-event"){const u=l.palette[p];f[p]=c(u.type,u.className,u.title,u.options)}return f.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:d,dragstart:d}},f.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},f};var ox={__init__:["ContextPadProvider"],ContextPadProvider:["type",Ri]},ax=(0,n.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,r=o,i=(0,n.ref)(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const T=s.get("eventBus");T.on("element.dblclick",V=>{r("elementDblclick",V.element.businessObject)}),T.on("element.click",V=>{r("elementClick",V.element.businessObject)}),T.on("create.end",V=>{r("elementCreate",V.elements[0].businessObject)}),T.on("autoPlace.end",V=>{r("elementCreate",V.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},u=()=>{let T={__init__:["myOptions"],myOptions:["type",p]};s=new na.default({canvas:{container:i.value},modules:[Cw,Lr,Ew,Lw,ic,Xb,$w,Uw,Jw,gd,_c,oC,ru,cC,Tc,T,nx,bd,EC,ox,OC,zC,HC,Cd]});const V=s.get("canvas"),j=s.get("elementFactory");c();const z=j.createRoot();V.setRootElement(z),f()};(0,n.onMounted)(()=>{u()});const h=T=>{const V=T==null?1:d+T;s.get("canvas").zoom(V),d=V},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},v=()=>(s.get("canvas").zoom(1),xd(s.get("elementRegistry").getAll())),x=T=>{s.clear(),c(),kd(T,s)},w=T=>{s.get("myImporter").update(T.id,T)};return t({reset:()=>{c()},zoom:T=>{h(T)},redo:()=>{g()},undo:()=>{m()},getData:()=>v(),setData:T=>{x(T)},updateElemet:T=>{w(T)}}),(T,V)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:i,class:"j-work-flow"},null,512))}}),rx=ax,_u=de(Kb),Bu=de(rx),ix=(0,n.defineComponent)({name:"JInputCards",__name:"input-cards",props:{id:{type:String,default:""},modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},gutter:{type:Number,default:16},span:Number,labelWidth:[String,Number],required:{type:Boolean,default:!1}},emits:["update:modelValue","change","rowChange"],setup(e,{expose:t,emit:o}){const a=e,r=o,{t:i}=Ge(),{formData:l}=un(),s=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),d=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),f=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,n.computed)(()=>a.editConfig.readonly),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)([]),g=b=>{r("rowChange",b)},m=()=>{const b={_i:an()};a.columns.forEach(k=>{const S=k.config?.valueRowKey||k.id||"";S&&(b[S]=Vt(k.config?.defaultValue))}),h.value.push(b),r("change",{id:a.id,value:b,data:b,formData:l,tableData:h.value,type:"add"})},v=b=>{const k=h.value[b];h.value.splice(b,1),r("change",{id:a.id,value:k,data:k,formData:l,tableData:h.value,type:"delete"})},x=()=>{const b={isOk:!0,info:""};if(a.required&&h.value.length===0)return b.isOk=!1,b.info="请添加表格数据",b;const k=h.value.length,S=a.columns,_=S.length;for(let T=0;T<k;T++){const V=h.value[T];for(let j=0;j<_;j++){const z=S[j];if(y(z.config,T).display!==!1&&z.rule&&z.rule.length>0){const L=z.rule.length;for(let M=0;M<L;M++){const B=z.rule[M];if(B.pattern=B.pattern?B.pattern+"":"",B.pattern&&!wt(V[z.prop||""])&&!new RegExp(B.pattern.substring(1,B.pattern.length-1)).test(V[z.prop||""]))return b.info=`${i("第")}${T+1}${i("行")},${i("第")}${j+1}${i("列")},${i(z.label)}:${i(B.message)}`,b.isOk=!1,b;if(B.required&&wt(V[z.prop||""]))return b.isOk=!1,b.info=`${i("第")}${T+1}${i("行")},${i("第")}${j+1}${i("列")},${i(z.label)}:${i("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(b=>{b._i||(b._i=an())})):(h.value=[],r("update:modelValue",h.value));const y=(b,k)=>{const S={...b};if(S.getUpConfig){const _=b.getUpConfig({formData:l,index:k,row:h.value[k],tableData:h.value,config:S});_&&Object.keys(_).forEach(T=>{S[T]=_[T]})}return S},C=b=>{const k=b||a.labelWidth;return typeof k=="string"?k:typeof k=="number"?k+"px":k};return t({validate:()=>x()}),_o({getTableData:()=>h.value,rowChange:g}),(b,k)=>{const S=(0,n.resolveComponent)("j-comp"),_=(0,n.resolveComponent)("el-form-item"),T=(0,n.resolveComponent)("el-col"),V=(0,n.resolveComponent)("j-button"),j=(0,n.resolveComponent)("el-row");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createElementVNode)("div",(0,n.mergeProps)({class:"j-input-cards"},b.$attrs),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.value,(z,L)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-input-cards-item",key:z.i,style:{"margin-bottom":"8px"}},[(0,n.createVNode)(j,{gutter:e.gutter},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,M=>((0,n.openBlock)(),(0,n.createBlock)(T,{key:M.prop,span:M.config?.span||e.span||24,style:(0,n.normalizeStyle)({"margin-bottom":(M.getInputType?M.getInputType(z):M.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,n.withCtx)(()=>[(0,n.withDirectives)((0,n.createVNode)(_,{"label-width":C(M.config?.labelWidth),label:(0,n.unref)(i)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(S,(0,n.mergeProps)({ref_for:!0},M,{row:z}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[n.vShow,y(M.config,L).display!==!1]])]),_:2},1032,["span","style"]))),128)),f.value&&(u.value||h.value.length>1)&&!p.value?((0,n.openBlock)(),(0,n.createBlock)(V,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>v(L)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":c.value})},[s.value?((0,n.openBlock)(),(0,n.createBlock)(V,{key:0,type:"link",style:{"margin-right":"8px"},label:d.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)],64)}}}),lx=ix,Ru=de(lx),sx=[aa,ml,yl,vl,bl,wl,Cl,xl,kl,Sl,El,_l,Bl,Rl,Hl,zl,Ol,Ll,wr,gl,Il,Dl,Fl,Wl,Jl,Yl,ls,Gl,Kl,ql,Xl,Zl,Ql,es,ts,ns,os,as,rs,is,us,fs,ps,hs,gs,ms,ys,vs,bs,ss,cs,Cr,ws,Cs,xs,ks,Ss,Es,_s,Bs,Rs,_u,Bu,Ru],cx=e=>{sx.forEach(t=>{e.component(t.name,t)})},dx={install:cx};H.EncryptionFactory=nl,H.EventBus=gr,H.HashingFactory=Tf,H.INJECT_KEYS=ht,H.JAutoComplete=Bl,H.JBarcode=Yl,H.JButton=aa,H.JButtonSelect=us,H.JButtons=ml,H.JCascaderSelect=Sl,H.JCheckbox=El,H.JCodeMirror=ls,H.JCollapse=Es,H.JComp=hs,H.JCount=Gl,H.JCountUp=ql,H.JDataPanel=Xl,H.JDate=vl,H.JDecoratedTitle=rs,H.JDialog=zl,H.JDialogFull=Ol,H.JDivider=Zl,H.JDrawer=Ll,H.JDynamicLayer=gl,H.JEcharts=Jl,H.JEditor=_s,H.JForm=gs,H.JFormItem=ms,H.JGuid=vs,H.JHpanel=Ql,H.JIcon=Cl,H.JInput=yl,H.JInputButton=ts,H.JInputCards=Ru,H.JInputCode=ns,H.JInputColor=os,H.JInputCount=Kl,H.JInputDecoratedTitle=is,H.JInputLayer=Cs,H.JInputMap=Rs,H.JInputRows=ws,H.JInputTag=Il,H.JLayer=wr,H.JLayerForm=xs,H.JLayout=Rl,H.JMap=Bs,H.JMenu=cs,H.JNowTime=wl,H.JNumber=_l,H.JPage=ys,H.JPanel=bs,H.JRadio=xl,H.JRate=Dl,H.JSelect=kl,H.JSlider=Fl,H.JSliderCaptcha=ss,H.JSwitch=ks,H.JTable=Hl,H.JTablePanel=Cr,H.JTabs=Ss,H.JTime=bl,H.JTitle=as,H.JTree=fs,H.JTreeSelect=ps,H.JUpload=Wl,H.JVpanel=es,H.JWorkflow=Bu,H.JWorkflowViewer=_u,H.assign=Ke,H.buildShortUUID=ra,H.buildUUID=an,H.clearJson=eo,H.clone=ko,H.deepClone=Vt,H.default=dx,H.eventBus=Mf,H.formatToDate=Eo,H.formatToDateTime=sa,H.fullScreenLoading=Pn,H.getCompConfig=zt,H.getCompType=la,H.getFunction=fr,H.getIsInputComp=ia,H.getIsTableInputComp=Wi,H.getLabel=Ui,H.getObjType=Ni,H.getTextWidth=Mt,H.is=Ai,H.isArray=oa,H.isNullOrEmpty=wt,H.isObject=Gu,H.loadBMap=al,H.lowerFirst=of,H.myAesDecrypt=Vf,H.numberToChinese=ji,H.numberToThousandSeparator=Pi,H.pagination=ef,H.paginationEx=tf,H.set=pr,H.setGroupMap=zi,H.toArray=Ii,H.toDecimal=So,H.toLeafArray=$i,H.toSimpleTree=af,H.toTree=Oi,H.uniqueArray=nf,H.upFirst=Hi,H.useAppInject=Ge,H.useAppProvide=Af,H.useAuthPageInject=cl,H.useAuthPageProvide=dl,H.useCompInject=rl,H.useCompProvide=vr,H.useFormInject=un,H.useFormProvide=mr,H.useHMenuInject=ll,H.useHMenuProvide=sl,H.useInject=$t,H.useLayer=no,H.useLayerInject=Nf,H.useLayerProvide=ul,H.useMenuInject=to,H.useMenuProvide=il,H.usePageInject=fl,H.usePageProvide=pl,H.useProvide=Wt,H.useSortable=ol,H.useTableInject=yr,H.useTableProvide=_o});
|