@a2simcode/ui 0.0.81 → 0.0.83
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 +5 -2
- package/dist/simcode-ui.umd.js +1 -1
- package/dist/stats.html +1 -1
- package/docs/components/meta/buttons.ts +1 -1
- package/docs/components/meta/comp.ts +12 -0
- package/docs/components/meta/page.ts +2 -23
- package/docs/components/meta/tabs.ts +10 -0
- package/docs/components/page.md +15 -0
- package/docs/examples/page/dept-user-management.vue +211 -0
- 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 ${_} }`;let E;const T=Ia(_);if(T.res)try{E=T.fn(a,i,r,l,s,c,d,u,f,h,g,p,m,y,C)}catch(P){console.log(P,"计算组件公式运行错误")}else return console.log(T.msg),"";return Number.isNaN(E)?"":(n.decimal!==void 0&&(E=E.toFixed(n.decimal)),E)}),S=o.computed(()=>{let b=x.value;return n.thousandSeparator&&(b=ur(b)),n.isChinese&&(b=dr(b)),b});return o.watch(x,b=>{v("update:modelValue",b),v("change",{value:b,data:S.value})}),(b,_)=>{const E=o.resolveComponent("el-input");return o.openBlock(),o.createBlock(E,{modelValue:S.value,"onUpdate:modelValue":_[0]||(_[0]=T=>S.value=T),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),Kf={key:0},ml=ne(o.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 n=e,a=o.computed(()=>({...n})),i=o.ref(),r=o.ref(null),l=o.computed(()=>n.options);o.onMounted(()=>{n.animation&&s()}),o.watch(()=>n.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=n.decimals,r.value.reset(),r.value.update(n.endValue))},{deep:!0}),o.watch(()=>n.endValue,h=>{r.value&&r.value.update&&r.value.update(h)});const s=()=>{r.value||(l.value.startVal=n.startValue,l.value.decimalPlaces=n.decimals,l.value.duration=n.duration,r.value=new eu.CountUp(i.value,Number(n.endValue),l.value),r.value.start(()=>{n.callback?.(r.value)}))};return o.onUnmounted(()=>{r.value=null}),o.onBeforeUnmount(()=>{r.value=null}),t({myProps:a,el:i,init:s,start:h=>{r.value&&r.value.start&&r.value.start(()=>{h?.(r.value)})},pauseResume:()=>{r.value&&r.value.pauseResume&&r.value.pauseResume()},reset:()=>{r.value&&r.value.reset&&r.value.reset()},update:h=>{r.value&&r.value.update&&r.value.update(h)}}),(h,g)=>(o.openBlock(),o.createElementBlock("span",{ref_key:"el",ref:i},[e.animation?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",Kf,o.toDisplayString(e.endValue),1))],512))}})),qf={class:"j-block j-data-panel"},Xf={key:0,class:"j-data-panel-header"},Zf={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Qf={class:"j-data-panel-header-right"},eh={class:"j-data-panel-body"},yl=ne(o.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,n)=>(o.openBlock(),o.createElementBlock("div",qf,[e.title?(o.openBlock(),o.createElementBlock("div",Xf,[o.createElementVNode("div",Zf,o.toDisplayString(e.title),1),o.createElementVNode("div",Qf,[o.renderSlot(t.$slots,"titleRight")])])):o.createCommentVNode("",!0),o.createElementVNode("div",eh,[o.renderSlot(t.$slots,"default")])]))}})),th={class:"j-divider-content"},bl=ne(o.defineComponent({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,n=o.computed(()=>{const i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=o.computed(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(`j-divider-container j-divider-${e.contentPosition}`),style:o.normalizeStyle(n.value)},[o.createElementVNode("div",{class:"j-divider-line j-divider-line-left",style:o.normalizeStyle(a.value)},null,4),o.createElementVNode("div",th,[o.createElementVNode("span",null,o.toDisplayString(e.content||""),1)]),o.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:o.normalizeStyle(a.value)},null,4)],6))}})),nh={class:"j-hpanel"},oh={class:"j-hpanel-main"},vl=ne(o.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,n)=>(o.openBlock(),o.createElementBlock("div",nh,[o.renderSlot(t.$slots,"left"),o.createElementVNode("div",oh,[o.renderSlot(t.$slots,"default")]),o.renderSlot(t.$slots,"right")]))}})),wl=ne(o.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 n=e,a=t,i=o.ref(),r=o.ref(),l=async(u,f)=>{n.ok&&(u("保存数据中..."),r.value=await n.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),f(),i.value.close())},s=()=>n.beforeClose?n.beforeClose(r.value):!0,c=()=>{n.closed?.()},d=()=>{i.value.open(n.title||n.btnText,n.layerType),setTimeout(()=>{n.open?.(r.value)},200)};return o.watch(()=>n.modelValue,u=>{r.value=u},{immediate:!0}),(u,f)=>{const h=o.resolveComponent("j-button"),g=o.resolveComponent("j-layer");return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(h,o.mergeProps({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),o.createVNode(g,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:c},{default:o.withCtx(()=>[o.renderSlot(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Cl=ne(o.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 n=e,a=t,i=o.computed({get:()=>n.modelValue,set:f=>{a("update:modelValue",f)}}),r=o.ref(""),l=f=>{r.value=f},s=()=>r.value,c=f=>n.beforeClose?n.beforeClose(f):!0,d=f=>{a("change",f)},u=o.computed(()=>n.modelValue&&n.modelValue.trim()?`${n.btnText}(已设置)`:n.btnText);return(f,h)=>{const g=o.resolveComponent("j-code-mirror"),p=o.resolveComponent("j-layout"),m=o.resolveComponent("j-input-button");return o.openBlock(),o.createBlock(m,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=y=>i.value=y),type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":c,ok:s,open:l,onChange:d},{default:o.withCtx(()=>[o.createVNode(p,{"right-move":!1,right:560},o.createSlots({default:o.withCtx(()=>[o.createVNode(g,{value:r.value,"onUpdate:value":h[0]||(h[0]=y=>r.value=y),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["value","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:o.withCtx(()=>[o.createVNode(g,{value:e.example,mode:e.mode,"read-only":""},null,8,["value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}})),xl=ne(o.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:n}){const a=e,i=n,r=o.ref(),l=o.ref(),s=o.computed({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(m){l.value=m,i("update:modelValue",m),i("input",m)}}),c=m=>{i("input",m)},d=m=>{i("focus",m)},u=m=>{i("blur",m)},f=()=>{i("clear"),i("update:modelValue","")},h=m=>{i("change",m)},g=m=>{i("color-change",m)},p=m=>{i("active-change",m)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(m,y)=>{const v=o.resolveComponent("el-color-picker"),w=o.resolveComponent("el-input");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[o.createVNode(w,o.mergeProps({ref_key:"inputRef",ref:r,modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=C=>s.value=C),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:c,onFocus:d,onBlur:u,onClear:f,onChange:h}),{[e.inputType]:o.withCtx(()=>[o.createVNode(v,{modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=C=>s.value=C),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:g,onActiveChange:p},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)}}})),kl=ne(o.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"}},setup(e){const t=e,n=o.computed(()=>t.class||""),a=o.computed(()=>{const i={...t.style};return t.color&&(i.color=t.color),t.size&&(typeof t.size=="number"?i.fontSize=`${t.size}px`:i.fontSize=t.size),t.weight&&(i.fontWeight=t.weight),i});return(i,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-title",n.value]),style:o.normalizeStyle(a.value)},o.toDisplayString(e.title),7))}})),El=ne(o.defineComponent({name:"JCodeMirror",__name:"code-mirror",props:{value:{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:value","change"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=o.ref(),l=o.ref("");let s=null;const c=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return Tn.javascript();case"css":case"text/css":return ou.css();case"html":case"text/html":return au.html();case"json":case"application/json":return iu.json();case"sql":case"text/x-sql":return ru.sql();case"xml":case"text/xml":return lu.xml();case"python":case"text/x-python":return su.python();case"markdown":case"text/markdown":return cu.markdown();case"java":case"text/x-java":return du.java();case"vue":case"text/x-vue":return Tn.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return Tn.javascript({jsx:!1,typescript:!0});case"jsx":return Tn.javascript({jsx:!0,typescript:!1});case"tsx":return Tn.javascript({jsx:!0,typescript:!0});default:return Tn.javascript()}},d=()=>{const m=[nu.basicSetup,xt.lineNumbers(),xt.highlightActiveLineGutter(),xt.highlightSpecialChars(),Aa.history(),xt.drawSelection(),xt.dropCursor(),Mn.indentOnInput(),Mn.bracketMatching(),ja.closeBrackets(),xt.rectangularSelection(),Mn.foldGutter(),xt.keymap.of([...ja.closeBracketsKeymap,...Aa.defaultKeymap,...Aa.historyKeymap,...Mn.foldKeymap]),Mn.syntaxHighlighting(Mn.defaultHighlightStyle)];return m.push(c(a.mode)),a.readonly&&m.push(Pa.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push(ja.autocompletion({override:[y=>{const v=y.matchBefore(/\w*/);if(!v||v.from===v.to)return null;const w=a.handleHint(v.text);return w.length===0?null:{from:v.from,options:w.map(C=>({label:typeof C=="string"?C:C.label||C.name||"",detail:typeof C=="string"?"":C.detail||"",type:typeof C=="string"?"variable":C.type||"variable",apply:typeof C=="string"?C:C.apply||C.name||C.label||""}))}}]})),m.push(xt.EditorView.updateListener.of(y=>{if(y.docChanged){const v=y.state.doc.toString();l.value=v,i("update:value",v),i("change",{value:v})}})),m},u=async()=>{if(!r.value)return;const m=Pa.EditorState.create({doc:a.value,extensions:d()});s=new xt.EditorView({state:m,parent:r.value}),l.value=a.value},f=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const y=Pa.EditorState.create({doc:m,extensions:d()});r.value&&(s=new xt.EditorView({state:y,parent:r.value}));const v=s.state.doc.toString();v!==a.value&&s.dispatch({changes:{from:0,to:v.length,insert:a.value}})},h=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const y=s.state.doc.length;s.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},g=()=>{let m=tu.format(a.value);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,"@"),i("update:value",m),i("change",{value:m})};let p=null;return o.watch(()=>a.value,m=>{m!==l.value&&(l.value=m,s&&f(),setTimeout(()=>{s&&a.isScrollToBottom&&h()}))}),o.watch(()=>a.mode,()=>{s&&f()}),o.onMounted(async()=>{await o.nextTick(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(p=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),p.observe(r.value))}),o.onUnmounted(()=>{p&&r.value&&(p.unobserve(r.value),p.disconnect(),p=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:g}),(m,y)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:o.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),ah=o.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=o.useTemplateRef("actionRef"),i=o.ref("0"),r=o.computed(()=>{const{actionStyle:s,toLeft:c}=n;return{...s,left:c?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=o.computed(()=>Number.parseInt(i.value)>10&&!n.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{i.value=s}}),(s,c)=>{const d=o.resolveComponent("j-icon");return o.openBlock(),o.createElementBlock("div",{ref_key:"actionRef",ref:a,style:o.normalizeStyle(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(o.openBlock(),o.createBlock(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(o.openBlock(),o.createBlock(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),ih=o.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=o.useTemplateRef("barRef"),i=o.ref("0"),r=o.computed(()=>{const{barStyle:l,toLeft:s}=n;return{...l,width:s?"0":i.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=>{i.value=l}}),(l,s)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"barRef",ref:a,style:o.normalizeStyle(r.value)},null,4))}}),rh=o.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 n=e,a=o.useTemplateRef("contentRef"),i=o.computed(()=>{const{contentStyle:l}=n;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=o.computed(()=>({animation:`shine ${n.animationDuration}s linear ${n.animationIterationCount}`}));return(l,s)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentRef",ref:a,class:o.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:o.normalizeStyle(i.value)},[o.createElementVNode("div",{style:o.normalizeStyle(r.value),class:"j-spine-text"},o.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Sl=ne(o.defineComponent({name:"JSliderCaptcha",__name:"slider-captcha",props:o.mergeModels({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:o.mergeModels(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const n=e,a=t,i=o.useModel(e,"modelValue"),r=o.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=o.useTemplateRef("wrapperRef"),s=o.useTemplateRef("barRef"),c=o.useTemplateRef("contentRef"),d=o.useTemplateRef("actionRef");o.watch(()=>r.isPassing,v=>{if(v){const{endTime:w,startTime:C}=r,x=(w-C)/1e3;a("success",{isPassing:v,time:x.toFixed(1)}),i.value=v}}),o.watchEffect(()=>{r.isPassing=!!i.value});function u(v){return"pageX"in v?v.pageX:"touches"in v&&v.touches[0]?v.touches[0].pageX:0}function f(v){r.isPassing||d.value&&(a("start",v),r.moveDistance=u(v)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function h(v){const w=l.value?.offsetWidth??220,C=v?.offsetWidth??40,x=w-C-6;return{actionWidth:C,offset:x,wrapperWidth:w}}function g(v){const{isMoving:w,moveDistance:C}=r;if(w){const x=o.unref(d),S=o.unref(s);if(!x||!S)return;const{actionWidth:b,offset:_,wrapperWidth:E}=h(x.getEl()),T=u(v)-C;a("move",{event:v,moveDistance:C,moveX:T}),T>0&&T<=_?(x.setLeft(`${T}px`),S.setWidth(`${T+b/2}px`)):T>_&&(x.setLeft(`${E-b}px`),S.setWidth(`${E-b/2}px`),m())}}function p(v){const{isMoving:w,isPassing:C,moveDistance:x}=r;if(w&&!C){a("end",v);const S=d.value,b=o.unref(s);if(!S||!b)return;const _=u(v)-x,{actionWidth:E,offset:T,wrapperWidth:P}=h(S.getEl());_<T?y():(S.setLeft(`${P-E}px`),b.setWidth(`${P-E/2}px`),m()),r.isMoving=!1}}function m(){r.endTime=Date.now(),r.isPassing=!0,r.isMoving=!1}function y(){r.isMoving=!1,r.isPassing=!1,r.moveDistance=0,r.toLeft=!1,r.startTime=0,r.endTime=0;const v=o.unref(d),w=o.unref(s),C=o.unref(c);!v||!w||!C||(C.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,v.setLeft("0"),w.setWidth("0")},300))}return(v,w)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"wrapperRef",ref:l,class:o.normalizeClass(["j-slider-captcha slider-border",n.class]),style:o.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:p,onMousemove:g,onMouseup:p,onTouchend:p,onTouchmove:g},[o.createVNode(ih,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),o.createVNode(rh,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),o.createVNode(ah,{ref_key:"actionRef",ref:d,"action-style":e.actionStyle,"is-passing":r.isPassing,"to-left":r.toLeft,onMousedown:f,onTouchstart:f},null,8,["action-style","is-passing","to-left"])],38))}})),lh=o.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:s}=Hn(),{getHMoreMenus:c}=Pr(),d=o.ref([]);n.pId==="moreId"?d.value=c.value:d.value=r(i()[n.pId||""]||[],[]);const u=p=>{const m=d.value.find(y=>y.active);m?.value!==p.value&&(m&&(m.active=!1),a("click",p))},{list:f,containerProps:h,wrapperProps:g}=Va.useVirtualList(d,{itemHeight:44});return(p,m)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({class:["j-sub-menu-content",{"j-menu-dark":o.unref(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},o.unref(h)),[o.createElementVNode("div",o.normalizeProps(o.guardReactiveProps(o.unref(g))),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(f),y=>(o.openBlock(),o.createBlock($o,{key:y.data.value,"parent-actives":o.unref(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),sh={class:"j-menu-item-label"},ch={class:"j-menu-item-label"},dh={key:1,class:o.normalizeClass(["j-menu-item-arrow","sub"])},uh={class:"j-menu-item-label"},$o=o.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:n}=Qe(),{activeMenuId:a}=Hn(),i=t,r=l=>{i("click",l)};return(l,s)=>{const c=o.resolveComponent("j-icon"),d=o.resolveComponent("el-tooltip"),u=o.resolveComponent("el-popover");return e.collapsed&&!e.item.hasChildren?(o.openBlock(),o.createBlock(d,{key:0,placement:"right"},{content:o.withCtx(()=>[o.createElementVNode("span",null,o.toDisplayString(o.unref(n)(e.item.label)),1)]),default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=o.withModifiers(f=>r(e.item),["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item-content",{active:e.item.value===o.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:o.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(o.openBlock(),o.createBlock(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):o.createCommentVNode("",!0),o.createElementVNode("div",sh,o.toDisplayString(o.unref(n)(e.item.label)),1),e.item.hasChildren?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):o.createCommentVNode("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?(o.openBlock(),o.createBlock(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item",{collapsed:e.collapsed}])},[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item-content",{active:e.item.value===o.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:o.normalizeStyle({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?(o.openBlock(),o.createBlock(c,{key:0,icon:e.item.icon,style:o.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"])):o.createCommentVNode("",!0),o.createElementVNode("div",ch,o.toDisplayString(o.unref(n)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(o.openBlock(),o.createElementBlock("div",dh)):o.createCommentVNode("",!0)],6)],2)]),default:o.withCtx(()=>[o.createVNode(lh,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):(o.openBlock(),o.createElementBlock("div",{key:2,class:o.normalizeClass(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=o.withModifiers(f=>r(e.item),["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item-content",{active:e.item.value===o.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:o.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(o.openBlock(),o.createBlock(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:o.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"])):o.createCommentVNode("",!0),o.createElementVNode("div",uh,o.toDisplayString(o.unref(n)(e.item.label)),1),e.item.hasChildren?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):o.createCommentVNode("",!0)],6)],2))}}}),fh=o.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Hn(),l=f=>{a("click",f)},s=o.computed(()=>n.menuList),{list:c,containerProps:d,wrapperProps:u}=Va.useVirtualList(s,{itemHeight:44});return(f,h)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":o.unref(r)==="dark"}]},o.unref(d)),[o.createElementVNode("div",o.normalizeProps(o.guardReactiveProps(o.unref(u))),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(c),g=>(o.openBlock(),o.createBlock($o,{key:g.data.value,"parent-actives":o.unref(i)?.pid?.split(".")||[],item:g.data,collapsed:e.collapsed,class:o.normalizeClass({"menu-item-entering":g.data.entering,"menu-item-leaving":g.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),hh=o.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Hn(),l=o.ref(),s=o.ref(0);let c=null;o.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(c=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),c.observe(l.value))});const d=o.computed(()=>{const g=[];let p=0,m=0;const y=n.menuList.length;return n.menuList.forEach(v=>{m++;const w=(vt(v.label)||0)+32+16+4+8;p+=w,(m===y&&p<=s.value||m<y&&p+56<=s.value)&&g.push(v)}),g.length<n.menuList.length&&g.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),g}),u=o.computed(()=>{const g=[];let p=0;const m=d.value.length;return n.menuList.forEach(y=>{p++,p>=m&&g.push(y)}),g}),f=o.computed(()=>{const g=i.value?.pid?.split(".")||[];return(g.length>1&&u.value.findIndex(p=>p.value===g[1])>-1||u.value.findIndex(p=>p.value===i.value?.value)>-1)&&g.push("moreId"),g}),h=g=>{a("click",g)};return jr({getHMoreMenus:u}),o.onUnmounted(()=>{c&&l.value&&(c.unobserve(l.value),c.disconnect(),c=null)}),(g,p)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"menuRef",ref:l,class:o.normalizeClass(["j-menu-horizontal",{"j-menu-dark":o.unref(r)==="dark"}])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.value,m=>(o.openBlock(),o.createBlock($o,{key:m.value,"parent-actives":f.value,item:m,"is-horizontal":"",onClick:h},null,8,["parent-actives","item"]))),128))],2))}}),ph=o.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Hn(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=o.computed(()=>(n.menuList.forEach((g,p)=>{g.color=l[p%l.length]}),n.menuList)),c=o.computed(()=>i.value?.pid?.split(".")||[]),d=g=>{a("click",g)},{list:u,containerProps:f,wrapperProps:h}=Va.useVirtualList(s,{itemHeight:96});return(g,p)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({class:["j-menu-vertical",{"j-menu-dark":o.unref(r)==="dark"}]},o.unref(f)),[o.createElementVNode("div",o.normalizeProps(o.guardReactiveProps(o.unref(h))),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(u),m=>(o.openBlock(),o.createBlock($o,{key:m.data.value,"parent-actives":c.value,item:m.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),_l=ne(o.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 n=e,a=t;let i={};const r=o.ref("");r.value=n.activeId||"";const l=(m,y,v,w,C)=>{v=v||[];for(let x=0,S=v.length;x<S;x++){const b=v[x],_={};_.pid=y,_.indent=w,r.value===b.value&&(_.active=!0),Object.keys(b).forEach(T=>{T!=="children"&&(_[T]=b[T])}),C&&C.includes(b.value)&&(_.open=!0),m.push(_);const E=b.children||[];E.length>0&&(_.hasChildren=!0,C||(i[_.value]=E),(!C||_.open&&!n.collapsed)&&l(m,`${y}.${_.value}`,E,w+1,C))}},s=(m,y)=>{const v=[];return l(v,"0",m,0,y),v},c=o.ref([]);let d=[];const u=()=>{i={},d=s(n.menus);const m=[];if(r.value&&n.mode==="inline"){const y=d.find(v=>v.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(n.menus,m)};o.watch(()=>n.menus,()=>{u()},{immediate:!0}),o.watch(()=>n.mode,()=>{u()});const f=()=>{if(c.value.find(y=>y.active)?.value!==r.value){const y=d.find(v=>v.value===r.value);if(y){const v=[];n.mode==="inline"&&v.push(...y.pid.split(".")),c.value=s(n.menus,v)}}},h=o.computed(()=>d.find(m=>m.value===r.value));o.watch(()=>n.activeId,()=>{r.value=n.activeId||"",f()}),o.watch(()=>n.collapsed,()=>{if(n.collapsed)c.value=s(n.menus,[]);else{const m=[];if(r.value){const y=d.find(v=>v.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(n.menus,m)}});const g=o.computed(()=>n.theme),p=m=>{if(console.log(m),m.hasChildren){if(n.collapsed)return;const y=[];y.push(...m.pid.split(".")),m.open||y.push(m.value);const v=s(n.menus,y),w=new Set(c.value.map(x=>x.value)),C=new Set(v.map(x=>x.value));v.forEach(x=>{w.has(x.value)||(x.entering=!0)}),c.value.forEach(x=>{C.has(x.value)||(x.leaving=!0)}),c.value=v,setTimeout(()=>{c.value.forEach(x=>{x.entering=!1,x.leaving=!1})},300)}else{if(r.value===m.value)return;r.value=m.value,a("click",m)}};return Mr({getMenuMap:()=>i,toArray:s,activeMenu:h,activeMenuId:r,theme:g}),(m,y)=>e.mode==="inline"?(o.openBlock(),o.createBlock(fh,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:p},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(o.openBlock(),o.createBlock(hh,{key:1,"menu-list":c.value,onClick:p},null,8,["menu-list"])):(o.openBlock(),o.createBlock(ph,{key:2,"menu-list":c.value,onClick:p},null,8,["menu-list"]))}})),gh={class:"j-keyword-panel"},mh={key:0},yh={key:1,class:"columns-wrapper"},bh=o.defineComponent({name:"JKeywordPanel",__name:"keyword-panel",props:o.mergeModels({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:n}=Qe(),a=e,i=o.useModel(e,"checkAll"),r=o.useModel(e,"checkFields"),l=o.ref(!1),s=o.ref(""),c=o.computed(()=>a.columns.filter(h=>h.config?.filter?.isSearchKeyword?s.value?h.config?.label?.indexOf(s.value)!=-1:!0:!1).map(h=>({label:h.config?.label,value:h.id}))),d=()=>{i.value||(i.value=!0,l.value=!1,r.value=[])},u=h=>{h.length>0?i.value=!1:i.value=!0};return t({init:()=>{i.value?l.value=!1:l.value=!0}}),(h,g)=>{const p=o.resolveComponent("j-icon"),m=o.resolveComponent("el-input"),y=o.resolveComponent("j-checkbox");return o.openBlock(),o.createElementBlock("div",gh,[o.createElementVNode("div",{class:o.normalizeClass(["range-item",{active:i.value}]),onClick:d},[o.createElementVNode("div",null,o.toDisplayString(o.unref(n)("搜索全部")),1),i.value?(o.openBlock(),o.createBlock(p,{key:0,icon:"mdi:check"})):o.createCommentVNode("",!0)],2),o.createElementVNode("div",{class:"range-item",onClick:g[0]||(g[0]=v=>l.value=!l.value)},[o.createElementVNode("div",null,o.toDisplayString(o.unref(n)("搜索特定字段")),1),o.createVNode(p,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?(o.openBlock(),o.createElementBlock("div",mh,[o.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":g[1]||(g[1]=v=>s.value=v),modelModifiers:{trim:!0},class:"no-border background",placeholder:o.unref(n)("搜索"),clearable:""},{prefix:o.withCtx(()=>[o.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):o.createCommentVNode("",!0),l.value?(o.openBlock(),o.createElementBlock("div",yh,[o.createVNode(y,{modelValue:r.value,"onUpdate:modelValue":g[2]||(g[2]=v=>r.value=v),options:c.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):o.createCommentVNode("",!0)])}}}),vh={key:0,class:"title"},wh={class:"content"},Ch={class:"relation"},xh={style:{width:"72px"}},kh={class:"btn-wrapper"},Eh={class:"field-wrapper"},Sh={class:"buttons"},Rl=o.defineComponent({name:"JFilterPanel",__name:"filter-panel",props:o.mergeModels({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:o.mergeModels(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:n}){const{t:a}=Qe(),i=e,r=o.useModel(e,"relation"),l=o.useModel(e,"isPin"),s=o.ref([]),c=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:f.value.join(","),options:u.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:C})=>{const S=i.columns.find(E=>E.id===w)?.config||{};let b="eq",_="text";["options"].includes(S.dataType||"")?b="in":["dateTime"].includes(S.type||"")?(b="range",_="dateTime"):["number"].includes(S.type||"")&&(_="number"),C.method=b,C.type=S.valueType||_,C.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:w})=>{const x=i.columns.find(S=>S.id===w.field)?.config||{};return["options","switch","dataItem","dataView"].includes(x.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(x.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(x.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 x=i.columns.find(S=>S.id===w.field)?.config||{};if(["options","dataItem","switch"].includes(x.dataType||"")){if(["in","nin"].includes(w.method)||["eq","ne"].includes(w.method))return"j-select"}else{if(["dateTime"].includes(x.type||""))return["formula"].includes(w.method)?"j-select":"j-date";if(["number"].includes(x.type||""))return"j-number"}return"j-input"},getCompConfig:({row:w})=>{if(["empty","not_empty"].includes(w.method||""))return{display:!1};const x=i.columns.find(b=>b.id===w.field)?.config||{},S={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(w.method||"")&&(S.multiple=!0,S.collapseTags=!0,S.collapseTagsTooltip=!0),["options","dataItem"].includes(x.dataType||"")?(S.collapseTags=!0,S.collapseTagsTooltip=!0,S.dataType=x.dataType,S.dataCode=x.dataCode,S.options=x.options):["switch"].includes(x.dataType||"")?(S.options=[],S.dataType="options",x.activeValue==null?S.options.push({label:"是",value:"1"}):S.options.push({label:"是",value:x.activeValue}),x.inactiveValue==null?S.options.push({label:"否",value:"0"}):S.options.push({label:"否",value:x.inactiveValue})):["dateTime"].includes(x.type||"")&&(["formula"].includes(w.method)?(S.placeholder="",S.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"}],S.dataType="options"):(S.selectType="datetime",["range"].includes(w.method)?(S.selectType="datetimerange",S.startPlaceholder="开始时间",S.endPlaceholder="结束时间",S.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):S.placeholder="")),S},config:{style:{width:l.value?"246px":"296px",flex:l.value?"auto":"1"},appendTo:l.value?void 0:".j-filter-panel"}}];o.onMounted(()=>{s.value=i.searchFieldList});const u=o.computed(()=>i.columns.filter(w=>!w.children?.length).map(w=>({label:w.config?.label,value:w.id,dataType:w.config?.dataType,options:w.config?.options}))),f=o.computed(()=>s.value.map(w=>w.field)),h=({data:w})=>{if(f.value.includes(w.value))return;const x=i.columns.find(_=>_.id===w.value)?.config||{};let S="eq",b="text";["options","dataItem"].includes(x.dataType||"")?S="in":["dateTime"].includes(x.type||"")&&(S="range",b="dateTime"),s.value.push({field:w.value,method:S,type:x.valueType||b})},g=n,p=()=>{s.value.length=0},m=()=>{l.value?g("filter"):g("close",!0)},y=()=>{s.value.forEach(w=>{w.value=void 0}),g("filter")};return t({getSearchFields:()=>s.value}),(w,C)=>{const x=o.resolveComponent("j-icon"),S=o.resolveComponent("j-select"),b=o.resolveComponent("j-button-select"),_=o.resolveComponent("j-button"),E=o.resolveComponent("j-input-rows"),T=o.resolveComponent("el-tooltip");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-filter-panel",{"is-pin":l.value}])},[l.value?(o.openBlock(),o.createElementBlock("div",vh,[o.createVNode(x,{icon:"mdi:filter-outline"}),o.createElementVNode("div",null,o.toDisplayString(o.unref(a)("筛选")),1)])):o.createCommentVNode("",!0),o.createElementVNode("div",wh,[o.createElementVNode("div",Ch,[o.createElementVNode("div",null,o.toDisplayString(o.unref(a)("筛选出符合以下")),1),o.createElementVNode("div",xh,[o.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":C[0]||(C[0]=P=>r.value=P),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),o.createElementVNode("div",null,o.toDisplayString(o.unref(a)("条件的数据")),1)]),o.createElementVNode("div",kh,[o.createVNode(b,{label:"添加过滤条件",options:u.value,"model-value":f.value.join(","),onChange:h},null,8,["options","model-value"]),s.value.length>0?(o.openBlock(),o.createBlock(_,{key:0,type:"text",danger:"",label:"删除全部",onClick:p})):o.createCommentVNode("",!0)]),o.createElementVNode("div",Eh,[o.createVNode(E,{modelValue:s.value,"onUpdate:modelValue":C[1]||(C[1]=P=>s.value=P),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),o.createVNode(T,{placement:"bottom",content:l.value?o.unref(a)("取消固定"):o.unref(a)("固定显示")},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"pin-btn",onClick:c},[o.createVNode(x,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),o.createElementVNode("div",Sh,[o.createVNode(_,{label:o.unref(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),o.createVNode(_,{label:o.unref(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),_h={class:"j-order-panel"},Rh={class:"content"},Bh={class:"btn-wrapper"},Th={class:"field-wrapper"},Mh={class:"buttons"},Ph=o.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:n}){const{t:a}=Qe(),i=e,r=n,l=o.computed(()=>i.columns.filter(p=>!p.children?.length&&p.config?.sorter?.isNot!==!0).map(p=>({label:p.config?.label,value:p.id}))),s=o.ref([]),c=o.computed(()=>s.value.map(p=>p.value)),d=[{id:"label",type:"j-title",getCompConfig:({row:p})=>({title:p.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],u=({data:p})=>{c.value.includes(p.value)||s.value.push({label:p.label,value:p.value,sord:"ASC"})},f=p=>{s.value=JSON.parse(JSON.stringify(p))},h=()=>{r("save",JSON.parse(JSON.stringify(s.value)))},g=()=>{s.value=[],r("clear")};return t({init:f}),(p,m)=>{const y=o.resolveComponent("j-button-select"),v=o.resolveComponent("j-input-rows"),w=o.resolveComponent("j-button");return o.openBlock(),o.createElementBlock("div",_h,[o.createElementVNode("div",Rh,[o.createElementVNode("div",Bh,[o.createVNode(y,{label:"添加排序规则",options:l.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),o.createElementVNode("div",Th,[o.createVNode(v,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=C=>s.value=C),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),o.createElementVNode("div",Mh,[o.createVNode(w,{label:o.unref(a)("排序"),type:"primary",onClick:h},null,8,["label"]),s.value.length>0?(o.openBlock(),o.createBlock(w,{key:0,label:o.unref(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:g},null,8,["label"])):o.createCommentVNode("",!0)])])}}}),jh={class:"j-column-panel"},Ah={class:"content"},Vh={class:"search-wrapper"},Nh={class:"tree-wrapper"},Ih={class:"buttons"},Hh=o.defineComponent({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:n}){const{t:a}=Qe(),i=e,r=n,l=o.ref(),s=o.ref(""),c={},d=o.ref([]),u=o.ref([]),f=(b,_)=>{const E=[],T=new Map;b.forEach(B=>{T.set(B.id||"",B),c[B.id||""]=B});const P=new Set;return _&&_.length>0&&_.forEach(B=>{const H=T.get(B.id);if(H){P.add(H.id||"");const I={id:H.id||"",label:H.config?.label||H.id||"",type:H.type,display:H.config?.display!==!1};H.children&&H.children.length>0&&(I.children=f(H.children,B.children)),E.push(I)}}),b.forEach(B=>{if(!P.has(B.id||"")){const H={id:B.id||"",label:B.config?.label||B.id||"",type:B.type,display:B.config?.display!==!1};B.children&&B.children.length>0&&(H.children=f(B.children)),E.push(H)}}),E},h=(b,_)=>_.length===0?b:b.map(E=>{const T=_.some(B=>E.label.toLowerCase().includes(B.toLowerCase())),P=E.children?h(E.children,_):[];return T||P.length>0?{...E,children:P.length>0?P:E.children}:null}).filter(Boolean),g=o.computed(()=>{if(!s.value)return u.value;const b=s.value.split(/\s+/).filter(Boolean);return h(u.value,b)}),p=o.ref([]),m=o.computed(()=>{const b=new Map;if(i.columnConfig&&i.columnConfig.length>0){const _=E=>{E.forEach(T=>{b.set(T.id,T),T.children&&_(T.children)})};_(i.columnConfig)}return b}),y=()=>{const b=_=>{const E=[];return _.forEach(T=>{let P=!0;if(m.value.size>0){const B=m.value.get(T.id||"");B?P=B.display:P=T.config?.display!==!1}else P=T.config?.display!==!1;P&&(E.push(T.id||""),T.children&&E.push(...b(T.children)))}),E};p.value=b(i.columns)},v=(b,{node:_})=>{b.includes(_.id)?p.value.push(_.id):p.value=p.value.filter(T=>T!==_.id)},w=(b,_,E)=>E==="inner"?!1:b.parent===_.parent,C=()=>{const b=_=>_.map(E=>{const T={...E,display:p.value.includes(E.id)};return E.children&&(T.children=b(E.children)),T});r("save",b(u.value))},x=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",l.value){const b=l.value;b.setCheck&&b.setCheck(p.value);const _=b.$refs?.treeRef||b;_?.setCheckedKeys&&_.setCheckedKeys(p.value)}r("save",void 0)};return t({init:()=>{y(),d.value=f(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(b,_)=>{const E=o.resolveComponent("j-icon"),T=o.resolveComponent("el-input"),P=o.resolveComponent("j-tree"),B=o.resolveComponent("j-button");return o.openBlock(),o.createElementBlock("div",jh,[o.createElementVNode("div",Ah,[o.createElementVNode("div",Vh,[o.createVNode(T,{modelValue:s.value,"onUpdate:modelValue":_[0]||(_[0]=H=>s.value=H),modelModifiers:{trim:!0},placeholder:o.unref(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:o.withCtx(()=>[o.createVNode(E,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),o.createElementVNode("div",Nh,[o.createVNode(P,{ref_key:"treeRef",ref:l,list:g.value,"is-tree-data":!0,"default-checked-keys":p.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":w,check:v},null,8,["list","default-checked-keys","draggable"])])]),o.createElementVNode("div",Ih,[o.createVNode(B,{label:o.unref(a)("确定"),type:"primary",onClick:C},null,8,["label"]),o.createVNode(B,{label:o.unref(a)("重置"),icon:"mdi:restore",type:"text",onClick:x},null,8,["label"])])])}}}),Oh={class:"j-table-panel-left"},Lh={class:"j-table-panel-top"},zh={class:"j-table-panel-top-left"},$h={class:"j-table-panel-top-right"},Fh={key:0,style:{width:"200px"}},Wh={class:"j-table-panel-main"},Uh={class:"j-table-panel-loading"},Dh={class:"j-table-panel-loading-content"},Yh={class:"j-table-panel-loading-text"},Jh={key:0,class:"j-table-panel-filter-panel"},Da=ne(o.defineComponent({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},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:"操作"},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"}},emits:["select","ready"],setup(e,{expose:t,emit:n}){const{t:a}=Qe(),{openLayer:i}=On(),r=e,l=n;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=o.ref();let c=[];const d=o.ref(0),u=o.ref(1);let f=r.pageSize||100,h="";const g=o.ref(0),p=o.computed(()=>g.value>0),m=o.ref([]),y=o.ref(!1),v=o.computed(()=>r.batchButtons&&r.batchButtons.length>0),w=o.computed(()=>m.value.length>0),C=o.computed(()=>v.value&&w.value&&r.isMultiple||y.value),x=o.computed(()=>r.isPage&&!C.value);v.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const S=de=>r.rowKey?r.rowKey.split(",").map(et=>de[et.trim()]).join("::"):"",b=(de,ie)=>{if(!ie||ie.length===0)return de.filter(te=>te.config?.display!==!1).map(te=>te.children&&te.children.length>0?{...te,children:b(te.children)}:te);const et=new Map(de.map(te=>[te.id,te])),rt=[];return ie.forEach(te=>{const Le=et.get(te.id);if(Le){if(te.display){let Rn=Le;Le.children&&Le.children.length>0&&(Rn={...Le,children:b(Le.children,te.children)}),rt.push(Rn)}et.delete(te.id)}}),de.forEach(te=>{if(et.has(te.id)&&te.config?.display!==!1){let Le=te;te.children&&te.children.length>0&&(Le={...te,children:b(te.children)}),rt.push(Le)}}),rt},_=o.computed(()=>b(r.columns,Y.value)),E=o.computed(()=>br(r.columns,de=>de.config.label)),T=o.ref(""),P=o.computed(()=>E.value.some(de=>de.config?.filter?.isSearchKeyword)),B=o.ref(),H=o.ref(!0),I=o.ref([]),O=o.computed(()=>H.value?"搜索全部":`搜索范围:${E.value.filter(de=>I.value.includes(de.id)).map(de=>de.config?.label).join("、")}`),M=()=>{B.value.init()},R=o.ref(),V=o.ref(!1),L=o.ref(!1),Q=o.ref(!1),oe=o.ref([]),le=o.ref("and"),Ce=o.ref(),Ue=o.ref(!1),G=o.ref([]),Ee=()=>{Ce.value.init(G.value)},Me=de=>{G.value=de,Ue.value=!1,z()},ue=()=>{G.value=[],z()},Ve=o.ref(),De=o.ref(!1),Y=o.ref(),ae=o.computed(()=>Y.value!=null),pe=()=>{Ve.value?.init()},Ne=de=>{Y.value=de,De.value=!1},Ke=o.ref(!1),ft=()=>{Ke.value=!Ke.value},Re=()=>{m.value=[],s.value&&(s.value.setSelection?.([]),y.value&&(y.value=!1,s.value.setRecords(c)))},Lt=()=>{y.value=!y.value,y.value?s.value?.setRecords(m.value):s.value?.setRecords(c),s.value?.setSelection?.(m.value)},rn=o.computed(()=>{if(m.value.length>0&&r.isMultiple){const de=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:y.value?"全部":"仅选中",config:{type:"text"},click:Lt},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:Re}],ie=r.batchButtons.map(et=>({...et,click:()=>{et.click&&et.click({data:m.value,openLayer:i})}}));return[...de,...ie]}return r.buttons}),Ct=async()=>{g.value++;const de={};try{const ie={};ie.rel=le.value;const et=R.value?.getSearchFields?.()||oe.value;ie.cond=et.filter(te=>te.value!==void 0&&te.value!==null&&te.value!==""||["empty","not_empty"].includes(te.method)).map(te=>({field:te.field,method:te.method,value:te.value,type:te.type})),ie.cond.length>0?Q.value=!0:Q.value=!1,de.filter=ie;const rt=G.value.map(te=>te.value+" "+te.sord).join(",");if(T.value&&(de.keyword={value:T.value,fields:H.value?E.value.filter(te=>te.config?.filter?.isSearchKeyword).map(te=>te.id):o.unref(I)}),r.loadData){if(r.isPage){de.pagination={rows:f,page:u.value,sort:rt||h||r.sort||r.rowKey};const te=await r.loadData(de)||{};c=te.rows||[],d.value=te.records||0}else de.sort=rt,c=await r.loadData(de)||[],d.value=c.length;s.value.setRecords(c),v.value?(m.value=[],y.value=!1):r.rowKey&&m.value.length>0&&s.value?.setSelection?.(m.value)}}finally{g.value=Math.max(0,g.value-1)}},z=async()=>{u.value=1,await Ct()},Z=({rows:de,page:ie})=>{f=de,u.value=ie,Ct()},D=async()=>{m.value=[],y.value=!1,u.value=1,await Ct()},K=async()=>{m.value=[],y.value=!1,await Ct()},X=async()=>{await D()},se=de=>{l("ready",de)},ge=de=>{let ie=[];if(!r.isMultiple){m.value=de,l("select",de);return}if(v.value)ie=de;else if(!r.rowKey)ie=de;else{const et=new Map(de.map(te=>[S(te),te])),rt=new Map(m.value.map(te=>[S(te),te]));c.forEach(te=>{const Le=S(te);et.has(Le)?rt.set(Le,et.get(Le)):rt.delete(Le)}),ie=Array.from(rt.values())}m.value=ie,l("select",ie),y.value&&ie.length===0?(y.value=!1,s.value&&s.value.setRecords(c)):y.value&&ie.length>0&&s.value&&(s.value.setRecords(ie),s.value.setSelection?.(ie))},Be=()=>m.value||[],at=de=>{m.value=de,s.value?.setSelection?.(de)},He=()=>s.value?.getInstance?.();return o.onMounted(async()=>{r.immediate&&await K()}),t({refreshData:K,resetData:D,getSelection:Be,setSelection:at,clearSelection:()=>{Re()},getInstance:He}),(de,ie)=>{const et=o.resolveComponent("j-buttons"),rt=o.resolveComponent("j-icon"),te=o.resolveComponent("el-popover"),Le=o.resolveComponent("el-tooltip"),Rn=o.resolveComponent("el-input"),sn=o.resolveComponent("j-button"),Qi=o.resolveComponent("j-table");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-table-panel-wrapper",{fullscreen:Ke.value,"no-padding":e.noPadding||Ke.value}])},[o.createElementVNode("div",{class:o.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":Ke.value}])},[o.createElementVNode("div",Oh,[o.createElementVNode("div",Lh,[o.createElementVNode("div",zh,[o.createVNode(et,{list:rn.value},null,8,["list"])]),o.createElementVNode("div",$h,[P.value&&!C.value?(o.openBlock(),o.createElementBlock("div",Fh,[o.createVNode(Rn,{modelValue:T.value,"onUpdate:modelValue":ie[2]||(ie[2]=je=>T.value=je),modelModifiers:{trim:!0},placeholder:o.unref(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:o.withKeys(z,["enter"]),onClear:z},{prefix:o.withCtx(()=>[o.createVNode(rt,{icon:"mdi:search"})]),suffix:o.withCtx(()=>[o.createVNode(Le,{placement:"bottom",content:O.value},{default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createVNode(te,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:M,onHide:z},{reference:o.withCtx(()=>[o.createVNode(rt,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:o.withCtx(()=>[o.createVNode(bh,{ref_key:"keywordPanelRef",ref:B,"check-all":H.value,"onUpdate:checkAll":ie[0]||(ie[0]=je=>H.value=je),"check-fields":I.value,"onUpdate:checkFields":ie[1]||(ie[1]=je=>I.value=je),columns:E.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):o.createCommentVNode("",!0),!V.value&&!C.value?(o.openBlock(),o.createBlock(te,{key:1,visible:L.value,"onUpdate:visible":ie[6]||(ie[6]=je=>L.value=je),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:z},{reference:o.withCtx(()=>[o.createVNode(sn,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:o.normalizeClass({active:Q.value})},null,8,["class"])]),default:o.withCtx(()=>[o.createVNode(Rl,{ref_key:"filterPanelRef",ref:R,"is-pin":V.value,"onUpdate:isPin":ie[3]||(ie[3]=je=>V.value=je),relation:le.value,"onUpdate:relation":ie[4]||(ie[4]=je=>le.value=je),"search-field-list":oe.value,columns:E.value,onFilter:z,onClose:ie[5]||(ie[5]=je=>L.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):o.createCommentVNode("",!0),C.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Le,{key:2,placement:"bottom",content:o.unref(a)("排序")},{default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createVNode(te,{visible:Ue.value,"onUpdate:visible":ie[7]||(ie[7]=je=>Ue.value=je),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Ee},{reference:o.withCtx(()=>[o.createVNode(sn,{class:o.normalizeClass({active:G.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:o.withCtx(()=>[o.createVNode(Ph,{ref_key:"orderPanelRef",ref:Ce,columns:E.value,onSave:Me,onClear:ue},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),C.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Le,{key:3,placement:"bottom",content:o.unref(a)("显示字段")},{default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createVNode(te,{visible:De.value,"onUpdate:visible":ie[8]||(ie[8]=je=>De.value=je),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:pe},{reference:o.withCtx(()=>[o.createVNode(sn,{class:o.normalizeClass({active:ae.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:o.withCtx(()=>[o.createVNode(Hh,{ref_key:"columnPanelRef",ref:Ve,columns:e.columns,"column-config":Y.value,onSave:Ne},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),C.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Le,{key:4,placement:"bottom",content:o.unref(a)("刷新")},{default:o.withCtx(()=>[o.createVNode(sn,{type:"text",icon:"mdi:refresh",onClick:X})]),_:1},8,["content"])),o.createVNode(Le,{placement:"bottom",content:Ke.value?o.unref(a)("退出全屏"):o.unref(a)("全屏")},{default:o.withCtx(()=>[o.createVNode(sn,{type:"text",icon:Ke.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:ft},null,8,["icon"])]),_:1},8,["content"])])]),o.createElementVNode("div",Wh,[o.withDirectives(o.createElementVNode("div",Uh,[o.createElementVNode("div",Dh,[o.createVNode(rt,{icon:"mdi:loading",class:"loading-spin",size:24}),o.createElementVNode("div",Yh,o.toDisplayString(o.unref(a)("加载中")),1)])],512),[[o.vShow,p.value]]),o.createVNode(Qi,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":ie[9]||(ie[9]=je=>u.value=je),columns:_.value,"sub-columns":e.subColumns,records:o.unref(c),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":x.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,onLoadPageData:Z,onReady:se,onSelectionChanged:ge},null,8,["table-page","columns","sub-columns","records","is-tree","is-show-number","is-sub-show-number","is-multiple","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","highlight-mode","load-children"])])]),V.value&&!C.value?(o.openBlock(),o.createElementBlock("div",Jh,[o.createVNode(Rl,{ref_key:"filterPanelRef",ref:R,"is-pin":V.value,"onUpdate:isPin":ie[10]||(ie[10]=je=>V.value=je),relation:le.value,"onUpdate:relation":ie[11]||(ie[11]=je=>le.value=je),"search-field-list":oe.value,columns:E.value,onFilter:z},null,8,["is-pin","relation","search-field-list","columns"])])):o.createCommentVNode("",!0)],2)],2)}}})),Gh={class:"j-button-select"},Kh={class:"search-wraper"},qh={class:"options-wraper"},Xh=["onClick"],Bl=ne(o.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 n=e,a=t,{t:i}=Qe(),r=o.ref(""),l=o.computed(()=>r.value===""?n.options:n.options.filter(d=>(d.label||"").includes(r.value))),s=o.computed(()=>n.modelValue?(n.modelValue+"").split(",").filter(Boolean):[]),c=d=>{if(d.disabled||s.value.includes(d.value))return;const f=[...s.value,d.value].join(",");a("update:modelValue",f),a("change",{value:f,data:d})};return(d,u)=>{const f=o.resolveComponent("j-button"),h=o.resolveComponent("j-icon"),g=o.resolveComponent("el-input"),p=o.resolveComponent("el-popover");return o.openBlock(),o.createBlock(p,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:o.withCtx(()=>[o.createVNode(f,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:o.withCtx(()=>[o.createElementVNode("div",Gh,[o.createElementVNode("div",Kh,[o.createVNode(g,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=m=>r.value=m),modelModifiers:{trim:!0},placeholder:o.unref(i)("搜索"),class:"no-border",clearable:""},{prefix:o.withCtx(()=>[o.createVNode(h,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),o.createElementVNode("div",qh,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,m=>(o.openBlock(),o.createElementBlock("div",{key:m.value,class:o.normalizeClass(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:o.withModifiers(y=>c(m),["stop"])},[m.icon?(o.openBlock(),o.createBlock(h,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):o.createCommentVNode("",!0),o.createElementVNode("div",null,o.toDisplayString(o.unref(i)(m.label)),1)],10,Xh))),128))])])]),_:1},8,["width"])}}})),Zh={class:"j-tree-item-text"},Qh={key:2,class:"j-tree-item-button-group"},ep={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Tl=ne(o.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},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},pidKey:{type:String,default:"pid"},idKey:{type:String},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:n}){const a=e,i=n,{useData:r,t:l}=Qe(),{getTreeData:s,loadData:c}=r(),d=o.ref(),u=o.ref(!1),f=o.ref(""),h=o.ref([]),g={children:"children",label:"label",disabled:"disabled"},p=o.computed(()=>s?s({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),m=o.computed(()=>a.dataCode||a.dataType?p.value:a.list?o.unref(a.list):h.value),y=async()=>{u.value=!0,a.loadData&&(h.value=await a.loadData()||[]),c&&await c(a.dataType,a.dataCode),u.value=!1,o.nextTick(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},v=(O,M=!0)=>{d.value?.setCurrentKey(O,M)},w=()=>d.value?.getCurrentKey(),C=(O,M=!1)=>{d.value?.setCheckedKeys(O,M)},x=(O=!1)=>d.value?.getCheckedKeys(O),S=async(O,M,R,V)=>{if(f.value=O.value,a.nodeClickFlow&&a.runFlow){const L=JSON.parse(a.nodeClickFlow);await a.runFlow(L,{value:O.value})}a.click&&a.click(O.value,O,V)},b=(O,{checkedKeys:M,checkedNodes:R,halfCheckedKeys:V,halfCheckedNodes:L})=>{a.check&&a.check(M,{node:O,checkedNodes:R,halfCheckedKeys:V,halfCheckedNodes:L})},_=(O,M,R,V)=>{i("node-drop",O,M,R,V)},E=O=>{const M=kt(a.treeButtons);return O&&a.filterButton?a.filterButton({buttons:M,node:O}):M},{openLayer:T}=On(),P=(O,M)=>{O.config?.disabled||O.click&&O.click({data:M,openLayer:T})},B=o.ref(""),H=(O,M)=>{B.value=O?M.value:"",console.log(B.value,"row")},I=(O,M,R)=>a.allowDrop?a.allowDrop(O,M,R):!(R=="inner"&&!M.data.canInner);return o.onMounted(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),o.watch(()=>a.list,()=>{u.value=!0,o.nextTick(()=>{u.value=!1})}),o.watch(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:v,getValue:w,setCheck:C,getCheck:x}),(O,M)=>{const R=o.resolveComponent("j-icon"),V=o.resolveComponent("j-button"),L=o.resolveComponent("el-dropdown-item"),Q=o.resolveComponent("el-dropdown-menu"),oe=o.resolveComponent("el-dropdown"),le=o.resolveComponent("el-tree"),Ce=o.resolveComponent("el-empty"),Ue=o.resolveDirective("loading");return o.withDirectives((o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&m.value.length>0?(o.openBlock(),o.createBlock(le,{key:0,ref_key:"treeRef",ref:d,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":f.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:g,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":I,"expand-on-click-node":e.expandOnClickNode,onNodeClick:S,onCheck:b,onNodeDrop:_},{default:o.withCtx(({node:G})=>[o.createElementVNode("div",{class:o.normalizeClass(["j-tree-item-wraper",{"is-focus":B.value===G.data.value}])},[G.data.openIcon?(o.openBlock(),o.createBlock(R,{key:0,class:"j-tree-item-open-icon",size:18,icon:G.data.openIcon,color:G.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):o.createCommentVNode("",!0),G.data[e.iconKey]||e.defaultIcon?(o.openBlock(),o.createBlock(R,{key:1,class:"j-tree-item-default-icon",size:18,icon:G.data[e.iconKey]||e.defaultIcon||"",color:G.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):o.createCommentVNode("",!0),o.createElementVNode("div",Zh,o.toDisplayString(G.label),1),E(G.data).length?(o.openBlock(),o.createElementBlock("div",Qh,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(E(G.data),(Ee,Me)=>(o.openBlock(),o.createBlock(oe,{key:Me,trigger:"click",onVisibleChange:ue=>H(ue,G.data)},{dropdown:o.withCtx(()=>[o.createVNode(Q,null,{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Ee.children,(ue,Ve)=>(o.openBlock(),o.createBlock(L,{key:Ve,disabled:ue.disabled,divided:ue.divided,onClick:o.withModifiers(De=>P(ue,G.data),["stop"])},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"j-flex-item",style:o.normalizeStyle({color:ue.danger?"var(--j-color-danger)":ue.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ue.icon||e.buttonDefaultIcon?(o.openBlock(),o.createBlock(R,{key:0,icon:ue.icon||e.buttonDefaultIcon},null,8,["icon"])):o.createCommentVNode("",!0),o.createElementVNode("div",null,o.toDisplayString(o.unref(l)(ue.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:o.withCtx(()=>[o.createVNode(V,{icon:Ee.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):o.createCommentVNode("",!0)],2)]),_:1},8,["node-key","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"])):(o.openBlock(),o.createElementBlock("div",ep,[o.createVNode(Ce,{description:o.unref(l)(e.emptyDes)},null,8,["description"])]))],2)),[[Ue,u.value]])}}})),Ml=ne(o.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:"label"},valueKey:{default:"value"},pidKey:{default:"pid"},idKey:{default:"id"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=e,{useData:a}=Qe(),{getTreeData:i}=a(),r=o.computed(()=>(console.log(a(),i),i?i({dataType:n.dataType,dataCode:n.dataCode,labelKey:n.labelKey,valueKey:n.valueKey,pidKey:n.pidKey,idKey:n.idKey,notLoad:!1})||[]:[])),l=o.computed(()=>n.dataCode||n.dataType?r.value:n.options||[]),s=t,c=o.computed({get(){return n.modelValue},set(u){s("update:modelValue",u)}}),d=u=>{s("change",u)};return(u,f)=>{const h=o.resolveComponent("el-tree-select");return o.openBlock(),o.createBlock(h,{modelValue:c.value,"onUpdate:modelValue":f[0]||(f[0]=g=>c.value=g),data:l.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:n,style:{width:"100%"},size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:d},null,8,["modelValue","data","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}})),Pl=ne(tl),tp=uu;async function np(e,t,n){const a={...n};delete a.ruleIndex,delete a.trigger;const i=new tp({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function op(e,t,n){const a=n.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:s})=>!!i==!!l?r-s:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await np(e,t,r);if(l!=="")return{name:e,errors:l}}}function ap(e,t){const n=(r,l,s,c,d)=>{Object.keys(l).forEach(u=>{let f=u;s&&(f=`${s}.${u}`);const h=l[u],{rules:g,myGridtableId:p}=t(f,s?l:void 0,()=>c,d);if(g.length){const m=a(f,h,g);r.push(m)}p&&h.forEach(m=>{n(r,m,p,h,s?l:void 0)})})},a=(r,l,s)=>op(r,l,s);return{validateForm:async()=>{const r=o.unref(e),l=[];n(l,r,"");const s=await Promise.all(l),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}const jl=ne(o.defineComponent({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["change"],setup(e,{expose:t,emit:n}){const a=e,i=n,{useData:r,existField:l,httpGet:s,httpPost:c,success:d,warning:u,error:f,info:h,t:g}=Qe();let p;r&&(p=r());const m=z=>{f&&f(z)},y=o.ref(!1),v=o.computed(()=>a.config?.gutter||16),w=o.computed(()=>a.config?.span||24),C=o.computed(()=>a.config?.labelWidth),x=o.computed(()=>a.config?.labelPosition||"right"),S=o.computed(()=>E.length===1&&(E[0].type==="j-tabs"||E[0].type==="j-layout"||E[0].config?.isAutoWindow)),b=o.reactive({}),_=o.ref({}),E=[],T={},P=o.ref({});let B={},H={},I=[],O={};const M=z=>{y.value&&L&&(z.getTableData?z.parentData||No(L,z.id,z.getTableData):No(L,z.id,z.formData[z.id])),i("change",z)},R=z=>Io(T[z]?.type||"")&&!T[z]?.config?.notInput||T[z]?.config?.isInput,V=z=>["j-table","j-input-rows","j-input-cards"].includes(T[z]?.type||"");let L;const Q=(z,Z)=>{Object.keys(z).forEach(D=>{const K=z[D];Z&&(D=Z+"."+D),K!=null&&typeof K=="object"&&!Po(K)&&Q(K,D),b[D]=K})},oe=(z,Z)=>{let D=z.id;return D||(z.config?.table&&z.config?.field?D=`${z.config.table}.${z.config.field}`:z.config?.table?D=z.config?.table:z.config?.field&&(D=z.config?.field),Z&&V(Z)&&(D=`${Z}.${D}`)),D||Vo("j")},le=(z,Z,D,K="")=>{z.forEach(X=>{X.id=oe(X,K);const se={id:X.id,slot:X.slot,type:X.type||"",getCompType:X.getCompType,getCompConfig:X.getCompConfig,config:{},children:[]};Z.push(se);const{children:ge}=X;Ao(se,X,["children","config"]),Ao(se.config,X.config||{},[]),T[X.id]&&console.warn("有重复的组件id:"+X.id),T[X.id]=se,a.readonly===!0&&(se.config.readonly=!0);let Be=!1,at;K!==""&&V(K)&&(Be=!0,se.config=X.config||{},se.config.parentTableId=K,at=T[K]?.config?.table);const He=se.config||{};if(R(X.id))!D&&Be===!1&&(He?.defaultValue===0?b[X.id]=He?.defaultValue:b[X.id]=He?.defaultValue||void 0),He.table&&He.field?B[`${He.table}_${He.field}`.toLowerCase()]=X.id:He.field&&(Be?B[`${at}_${He.field}`.toLowerCase()]=X.id:B[`${He.field}`.toLowerCase()]=X.id);else if(Be&&He.field)B[`${at}_${He.field}`.toLowerCase()]=X.id;else if(V(X.id))!D&&!He.isSubTable&&(b[X.id]=[]),He.table&&(B[He.table.toLowerCase()||""]=X.id),He.isSubTable||I.push(se);else if(He?.defaultValue)b[X.id]=He?.defaultValue;else if(X.type==="collapse"&&He?.isExpand){const ln=[];(He?.groups||[]).forEach(de=>{ln.push(de.i)}),b[X.id]=ln}ge&&ge.length>0&&le(ge,se.children,D,se.id)})},Ce=async(z,Z)=>{y.value=!1;const D=!!Z;E.splice(0,E.length),B={},H={},I=[],L=Z,Pn(b),Pn(T),P.value={},D&&Q(Z,""),le(z,E,D),O=kt(b),o.nextTick(()=>{y.value=!0,o.nextTick(()=>{rn(a.config?.codeInit,{})})})},Ue=(z,Z,D)=>{const K=[];return Z.forEach(X=>{const se={};Object.keys(X).forEach(ge=>{if(!D||D(ge,X[ge],z)){const Be=pe(ge);if(Be?.type==="j-table")se[Be?.id||""]=Ue(ge,X[ge],D);else{let at=B[`${z}_${ge}`.toLowerCase()]||ge;at=at.indexOf(".")!==-1?at.split(".")[1]:at,se[at]=X[ge]}}}),K.push(se)}),K},G=(z,Z)=>{Object.keys(z||{}).forEach(D=>{let K=z[D];const X=pe(D);if(X===void 0)K&&(Po(K)&&(K=K[0]||{}),typeof K=="object"?Object.keys(K).forEach(se=>{if(!Z||Z(D,K[se],D)){let ge=se;D!=="main"&&(ge=`${D}_${se}`),H[ge]=D,b[B[ge.toLowerCase()]||se]=K[se]}}):b[D]=K);else if(V(X.id||"")){if(!Array.isArray(K)){console.warn("表格数据不是数组:"+D);return}K?.length>0?b[B[D.toLowerCase()]||D]=Ue(D,K,Z):b[B[D.toLowerCase()]||D]=[]}else(!Z||Z(D,K,D))&&(b[B[D.toLowerCase()]||D]=K)}),L&&Object.keys(b).forEach(D=>{const K=pe(D);(K===void 0||!["tabs","collapse"].includes(K.type||""))&&No(L,D,b[D])})},Ee=(z,Z=!1)=>{const D={};return Object.keys(z).forEach(K=>{if(K==="parentRow")return;const X=T[K];if(X){const se=X.config?.table,ge=X.config?.field;if(Z)ge?D[ge]=z[K]:D[K]=z[K];else if(V(K)){const Be=[];z[K].forEach(at=>{Be.push(Ee(at,!0))}),D[se||K]=Be}else se&&ge?(D[se]=D[se]||{},D[se][ge]=z[K]):ge&&(D[ge]=z[K])}else Z?K!=="_X_ROW_KEY"&&K!=="_isHover"&&(D[K]=z[K]):H[K]?(D[H[K]]=D[H[K]]||{},D[H[K]][K.replace(`${H[K]}_`,"")]=z[K]):D[K]=z[K]}),D},Me=(z=!0)=>z?Ee(b):b,ue=(z,Z,D,K)=>{let X=T[z];if(X==null){const ge=z.split(".");X=T[ge[ge.length-1]]||{}}if(!X)return{};const se=hn({config:{...X.config||{},...P.value[X.id||""]||{}},getCompConfig:X.getCompConfig,formData:b,getTableData:D,row:Z,pRowData:K});return se._componentId=X?.id,se},Ve=(z,Z,D,K)=>{const X=ue(z,Z,D,K);if(X.isNotRule!==!0&&X.display!==!1){const se=X.rule||[],ge=se.find(Be=>Be.type==="only");return ge&&(ge.validator=async(Be,at)=>{if(at){const He={table:Be.table,key:Be.key,keyName:Be.keyName,field:Be.field,keyValue:Be.getKeyValue?Be.getKeyValue():"",value:at,paramNames:Be.paramNames,getParams:Be.getParams,withProjectId:Be.withProjectId,getValue:Be.getValue,formData:b};if(!await l(He))throw g(Be.message)||g("数据值重复")}}),{rules:se,myGridtableId:V(X._componentId)?X._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:De}=ap(b,Ve),Y=async()=>{_.value={};const z=await De();return Object.keys(z).length>0?(_.value=z,m(`${g(T[Object.keys(z)[0]]?.config?.label)}:${g(z[Object.keys(z)[0]].msg)}`),!1):!0},ae=()=>{_.value={},Pn(b),Object.keys(O||{}).forEach(z=>{b[z]=O[z]})},pe=z=>{let Z=T[z];return Z===void 0&&B[z.toLowerCase()]&&(Z=T[B[z.toLowerCase()]]),Z},Ne=({id:z,i:Z,value:D,type:K})=>{if(K==="add")b[z].push(D);else if(K==="delete")b[z].splice(Z,1);else{const X=pe(z);X&&(X.config.parentTableId?b[X.config.parentTableId][Z][z]=D:b[z]=D)}},Ke=({id:z,i:Z})=>{const D=pe(z);if(D){if(D.config.parentTableId){const K=b[D.config.parentTableId],X=D.id?D.id.replace(`${D.config.parentTableId}.`,""):"";if(Z!=null)return(K[Z]||{})[X||""];const se=[];return K&&K.forEach(ge=>{se.push(ge[X||""])}),se}if(V(D.id||"")){const K=[];return b[D.id||""].forEach(X=>{K.push(Ee(X,!0))}),K}return b[D.id||""]}if(b[z])return b[z]},ft=async({id:z,i:Z})=>{const D=Ke({id:z,i:Z}),K=pe(z);if(K&&p?.getLabel)if(Z!==void 0){const X=D[Z],se=b[K.config.parentTableId||""][Z],ge=hn({config:K.config,getCompConfig:K.getCompConfig,formData:b,tableData:b[K.config.parentTableId||""],row:se});return await p?.getLabel({value:X,config:ge,formData:b,tableData:b[K.config.parentTableId||""],row:se})}else{const X=hn({config:K.config,getCompConfig:K.getCompConfig,formData:b});return await p?.getLabel({value:D,config:X,formData:b})}return D},Re=async(z,Z)=>p?.loadViewDataList?await p?.loadViewDataList(z,Z,!1):[],Lt=z=>(z.set=Ne,z.get=Ke,z.setFormData=G,z.getFormData=Me,z.getLabel=ft,z.getViewData=Re,z.getDateNow=Z=>La(new Date,Z||"YYYY-MM-DD HH:mm:ss"),z.httpGet=s||(()=>{console.log("当前状态不支持")}),z.httpPost=c||(()=>{console.log("当前状态不支持")}),z.loading=Z=>{jn(Z)},z.showMsg=({text:Z,type:D})=>{switch(D){case"success":d&&d(Z);break;case"warning":u&&u(Z);break;case"error":f&&f(Z);break;case"info":h&&h(Z);break;default:h&&h(Z);break}console.log("showMsg",Z,D)},z),rn=async(z,Z)=>{if(z&&z.trim()){z=`async (jcode) => {${z}}`;const{res:D,fn:K}=Ia(z);D&&await K(Lt(Z))}},Ct=(z,Z)=>{P.value[z]={...P.value[z]||{},...Z}};return a.schema&&Ce(a.schema),$a({formData:b,compsConfig:P,errorFields:_,isAutoWindow:S,gutter:v,span:w,labelWidth:C,labelPosition:x,getValue:Ke,formChange:M}),Fa({contextType:"form"}),t({init:Ce,reset:ae,validate:Y,setValue:Ne,getValue:Ke,getLabel:ft,setFormData:G,getFormData:Me,setCompConfig:Ct}),(z,Z)=>{const D=o.resolveComponent("j-form-item"),K=o.resolveComponent("el-row"),X=o.resolveComponent("el-form");return y.value?(o.openBlock(),o.createBlock(X,{key:0,class:o.normalizeClass([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":x.value,"label-width":C.value,size:e.config?.size,onSubmit:Z[0]||(Z[0]=o.withModifiers(()=>{},["prevent"]))},{default:o.withCtx(()=>[S.value?(o.openBlock(),o.createBlock(D,o.mergeProps({key:0},E[0],{"is-not-col":""}),null,16)):(o.openBlock(),o.createBlock(K,{key:1,gutter:v.value},{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(E,se=>o.createVNode(D,o.mergeProps({key:se.id,ref_for:!0},se),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):o.createCommentVNode("",!0)}}})),Al=ne(el),ip={class:"j-page"},Vl=ne(o.defineComponent({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const n=e,a=o.ref(!1),i=o.reactive([]),r={},l=o.reactive({}),s=(p,m)=>{p.forEach(y=>{y.id=y.id||Vo("c");const v={id:y.id,slot:y.slot,type:y.type||""},{children:w}=y;r[y.id]=v,v.config=[],Ao(v.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l[y.id]=y.config.defaultValue),m.push(v),w&&w.length>0&&(v.children=[],s(w,v.children))})},c=p=>{a.value=!1,i.splice(0,i.length),Pn(r),Pn(l),s(p,i),o.nextTick(()=>{a.value=!0})};n.schema&&c(n.schema);const d=new za,u=new Map,f=(p,m,y,...v)=>{if(y?.immediate){const w=u.get(p)||new Map;w.set(m,v),u.set(p,w)}return d.emit(p,m,...v)},h=(p,m)=>{d.on(p,m);const y=u.get(p);y&&(u.delete(p),y.forEach((v,w)=>{m(w,...v||[])}))},g=(p,m)=>{d.off(p,m)};return Hr({registerMethod:(p,m)=>(h(p,m),()=>{g(p,m)})}),Fa({contextType:"page"}),t({init:c,call:f,on:h,off:g}),(p,m)=>{const y=o.resolveComponent("j-comp");return o.openBlock(),o.createElementBlock("div",ip,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i,v=>(o.openBlock(),o.createBlock(y,{key:v.id,id:v.id,type:v.type,config:v.config,children:v.children},null,8,["id","type","config","children"]))),128))])}}})),Nl=ne(o.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,i=o.ref("");return o.watch(()=>n.modelValue,r=>{r?i.value=r:(i.value=Vt(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const s=o.resolveComponent("el-input");return o.openBlock(),o.createBlock(s,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=c=>i.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),rp={key:0,class:"j-panel-top"},lp=["title"],sp={style:{margin:"0","font-size":"14px"}},cp={key:1},dp={key:1,class:"j-panel-bottom"},Il=ne(o.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}=On(),n=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,i)=>{const r=o.resolveComponent("j-button"),l=o.resolveComponent("el-tooltip"),s=o.resolveComponent("j-buttons");return o.openBlock(),o.createElementBlock("div",{class:"j-block",style:o.normalizeStyle({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[o.createElementVNode("div",{class:"j-panel",style:o.normalizeStyle({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?(o.openBlock(),o.createElementBlock("div",rp,[e.notTitle?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",{key:0,class:"j-panel-top-left",title:e.title||""},[o.renderSlot(a.$slots,"title",{},()=>[o.createElementVNode("span",sp,o.toDisplayString(e.title||""),1)])],8,lp)),e.toolBtns&&e.toolBtns.length>0?(o.openBlock(),o.createElementBlock("span",cp,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.toolBtns,c=>(o.openBlock(),o.createBlock(l,{key:c.id,placement:"top",content:c.label||""},{default:o.withCtx(()=>[o.createVNode(r,o.mergeProps({ref_for:!0},c.config,{onClick:d=>n(c),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"j-panel-body",style:o.normalizeStyle(e.bodyStyle)},[o.renderSlot(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?(o.openBlock(),o.createElementBlock("div",dp,[o.createVNode(s,{list:e.bootmBtns},null,8,["list"]),o.createVNode(s,{list:e.bootmRightBtns},null,8,["list"])])):o.createCommentVNode("",!0)],4)],4)}}})),up={class:"j-input-rows"},fp={key:0,class:"j-input-rows-num"},hp={key:1,class:"j-input-rows-char"},Hl=ne(o.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:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const n=x=>x==null,a=e,i=t,{formData:r}=zt(),l=o.computed(()=>a.editConfig.isAddBtn!==!1),s=o.computed(()=>a.editConfig.addBtnText||"添加"),c=o.computed(()=>a.editConfig.buttonsAlign||"left"),d=o.computed(()=>a.editConfig.isRemoveBtn!==!1),u=o.computed(()=>a.editConfig.readonly),f=o.computed(()=>a.editConfig.drag),h=o.computed(()=>a.editConfig.isNullValue!==!1),g=o.ref(),p=["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=o.ref([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(x=>{x._i||(x._i=Vt())})):(m.value=[],i("update:modelValue",m.value)),o.watch(()=>a.modelValue,x=>{m.value=a.modelValue||[],m.value=x||[],m.value.forEach(S=>{S._i||(S._i=Vt())})},{deep:!0});const v=()=>{const x={_i:Vt()};a.columns.forEach(S=>{const b=S.config?.valueRowKey||S.id||"";b&&(x[b]=kt(S.config?.defaultValue))}),m.value.push(x),i("change",{id:a.id,value:x,data:x,formData:r,tableData:m.value,type:"add"})},w=x=>{const S=m.value[x];m.value.splice(x,1),i("change",{id:a.id,value:S,data:S,formData:r,tableData:m.value,type:"delete"})},C=x=>{i("rowChange",x)};return o.onMounted(()=>{if(!f.value||!g.value)return;const x=g.value,{initSortable:S}=_r(x,{handle:".j-input-rows-drag",onEnd:b=>{const{oldIndex:_,newIndex:E}=b;if(n(_)||n(E)||_===E||_<0||E<0)return;const T=m.value.splice(_,1)[0];m.value.splice(E,0,T),i("change",{id:a.id,value:T,data:T,formData:r,tableData:m.value,type:"sort"})}});S()}),ro({getTableData:()=>m.value,rowChange:C}),(x,S)=>{const b=o.resolveComponent("j-comp"),_=o.resolveComponent("j-icon"),E=o.resolveComponent("j-button");return o.openBlock(),o.createElementBlock("div",up,[o.createElementVNode("div",{ref_key:"inputRowsRef",ref:g,class:"j-input-rows-container"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value,(T,P)=>(o.openBlock(),o.createElementBlock("div",{key:T._i+P,class:o.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(o.openBlock(),o.createElementBlock("div",fp,o.toDisplayString(P+1),1)):o.createCommentVNode("",!0),e.showChar?(o.openBlock(),o.createElementBlock("div",hp,o.toDisplayString(p[P%26]),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.columns,B=>(o.openBlock(),o.createBlock(b,o.mergeProps({key:B.id,ref_for:!0},B,{row:T}),null,16,["row"]))),128)),f.value?(o.openBlock(),o.createBlock(_,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):o.createCommentVNode("",!0),d.value&&(h.value||m.value.length>1)&&!u.value?(o.openBlock(),o.createBlock(_,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:B=>w(P)},null,8,["onClick"])):o.createCommentVNode("",!0)],2))),128))],512),!u.value&&l.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({"text-align":c.value}),class:"j-input-rows-actions"},[l.value?(o.openBlock(),o.createBlock(E,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:v},null,8,["label"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)])}}})),pp={class:"j-input-layer"},Ol=ne(o.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:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=p=>!!(p==null||typeof p=="string"&&p.trim()===""||Array.isArray(p)&&p.length===0),a=e,i=t,r=o.ref(),l=o.ref(),s=o.ref(""),c=o.computed({get(){return a.modelValue},set(p){i("update:modelValue",p)}}),d=o.computed({get(){return n(c.value)?"":n(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(p){p||f()}});o.watch(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},f=()=>{s.value="",c.value="",i("change",{value:"",data:void 0})},h=async()=>{if(!l.value)return;const p=l.value.getSelection();if(a.isMultiSelect){const m=[],y=[];p.forEach(v=>{const w=v[a.labelKey],C=v[a.valueKey];m.push(w!=null?String(w):""),C===0||C?y.push(String(C)):y.push("")}),s.value=m.join(","),c.value=y.join(","),i("change",{value:y.join(","),data:p})}else if(p.length>0){const m=p[0],y=m[a.labelKey],v=m[a.valueKey];s.value=y!=null?String(y):"";const w=v!=null?String(v):"";c.value=w,i("change",{value:w,data:m})}else s.value="",c.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},g=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(p,m)=>{const y=o.resolveComponent("el-input");return o.openBlock(),o.createElementBlock("div",pp,[e.onlyButton?(o.openBlock(),o.createBlock(o.unref(jo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):(o.openBlock(),o.createBlock(y,{key:0,modelValue:d.value,"onUpdate:modelValue":m[0]||(m[0]=v=>d.value=v),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:f},o.createSlots({_:2},[e.readonly?void 0:{name:"append",fn:o.withCtx(()=>[o.createVNode(o.unref(jo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),o.createVNode(o.unref(Ua),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:h,onClosed:g},{default:o.withCtx(()=>[o.createVNode(o.unref(Da),{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"])])}}})),Ll=ne(o.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,n=zt(),{t:a}=Qe(),i=o.computed(()=>t.formConfig?.gutter||16),r=o.computed(()=>t.formConfig?.span||24),l=o.computed(()=>t.formConfig?.labelWidth||n.labelWidth?.value),s=o.computed(()=>t.formConfig?.labelPosition||n.labelPosition?.value||"right"),c=o.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=o.ref(!1),u=()=>{d.value=!0};return $a({...n,isAutoWindow:c,gutter:i,span:r,labelWidth:l}),(f,h)=>{const g=o.resolveComponent("j-button"),p=o.resolveComponent("j-form-item"),m=o.resolveComponent("el-row"),y=o.resolveComponent("el-form"),v=o.resolveComponent("j-dialog");return o.openBlock(),o.createElementBlock("div",null,[o.createVNode(g,o.mergeProps(f.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),o.createVNode(v,{visible:d.value,"onUpdate:visible":h[1]||(h[1]=w=>d.value=w),title:o.unref(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:o.withCtx(()=>[o.createVNode(y,{class:o.normalizeClass(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:h[0]||(h[0]=o.withModifiers(()=>{},["prevent"]))},{default:o.withCtx(()=>[c.value?(o.openBlock(),o.createBlock(p,o.normalizeProps(o.mergeProps({key:0},e.schema[0])),null,16)):(o.openBlock(),o.createBlock(m,{key:1,gutter:i.value},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.schema,w=>(o.openBlock(),o.createBlock(p,o.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"])])}}})),zl=ne(o.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 n=e,a=t,i=o.computed({get(){return n.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return o.onMounted(()=>{n.autoFocus&&!n.readonly&&setTimeout(()=>{const l=i.value===n.activeValue?n.inactiveValue:n.activeValue;i.value=l,r(l)},100)}),(l,s)=>{const c=o.resolveComponent("el-switch");return o.openBlock(),o.createBlock(c,o.mergeProps(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=d=>i.value=d),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:r}),o.createSlots({_:2},[l.$slots["active-action"]?{name:"active-action",fn:o.withCtx(()=>[o.renderSlot(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:o.withCtx(()=>[o.renderSlot(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:o.withCtx(()=>[o.renderSlot(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:o.withCtx(()=>[o.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"])}}})),$l=ne(o.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 n=t,a=d=>{n("update:modelValue",d)},i=(d,u)=>{n("tab-click",d,u)},r=d=>{n("tab-change",d)},l=d=>{n("tab-remove",d)},s=()=>{n("tab-add")},c=(d,u)=>{n("edit",d,u)};return(d,u)=>{const f=o.resolveComponent("el-tabs");return o.openBlock(),o.createBlock(f,o.mergeProps(d.$attrs,{"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:i,onTabChange:r,onTabRemove:l,onTabAdd:s,onEdit:c}),{default:o.withCtx(()=>[o.renderSlot(d.$slots,"default")]),_:3},16,["model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),Fl=ne(o.defineComponent({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=t,a=r=>{n("update:modelValue",r)},i=r=>{n("change",r)};return(r,l)=>{const s=o.resolveComponent("el-collapse");return o.openBlock(),o.createBlock(s,o.mergeProps(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),gp={class:"j-editor"},Wl=ne(fl(o.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 n=e,a=t,i=o.ref(),r=o.ref(),l=o.shallowRef(),s=o.computed(()=>({height:typeof n.height=="number"?`${n.height}px`:n.height,overflowY:"hidden"}));let c=!1;const d=f=>{if(!f)return"";let h=f;return n.apiUrl&&n.token&&(h=h.replace(/{learun_img_api}/g,`${n.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${n.token}`)),h},u=f=>{if(!f)return"";let h=f;if(n.apiUrl){const g=`${n.apiUrl}/system/annexesfile/`;h=h.split(g).join("{learun_img_api}"),n.token&&(h=h.split(`token=${n.token}`).join("{learun_img_token}"))}return h};return o.onMounted(()=>{const f={placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,MENU_CONF:{},...n.options};f.onChange=g=>{if(c)return;const p=g.getHtml(),m=u(p);a("update:value",m),a("change",{value:m})};const h=ir.createEditor({selector:i.value,html:d(n.value),config:f,mode:"default"});l.value=h,ir.createToolbar({editor:h,selector:r.value,mode:"default"})}),o.watch(()=>n.value,f=>{const h=l.value;if(h){const g=h.getHtml(),p=d(f);u(g)!==f&&(c=!0,h.setHtml(p),c=!1)}}),o.watch(()=>n.readonly,f=>{const h=l.value;h&&(f?h.disable():h.enable())}),o.onBeforeUnmount(()=>{const f=l.value;f?.destroy()}),(f,h)=>(o.openBlock(),o.createElementBlock("div",gp,[o.createElementVNode("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),o.createElementVNode("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:o.normalizeStyle(s.value)},null,4)]))}}),[["__scopeId","data-v-179ac616"]])),mp={key:0,class:"j-map-loading"},yp=ne(o.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:n}){const a=e,i=n,r=o.ref(!0),l=o.ref();let s=null,c=null,d=null,u=null;const f=async()=>{r.value=!0;try{s=await Rr(a.mapKey)}catch(v){console.error("Failed to load Baidu Map:",v),r.value=!1;return}if(c!=null){g(a.lng,a.lat),r.value=!1;return}if(!l.value)return;c=new s.Map(l.value,{enableMapClick:!1});const y=new s.Point(121.480248,31.236276);c.centerAndZoom(y,17),d=new s.Marker(y,{enableDragging:!0}),c.addOverlay(d),d.addEventListener("dragend",v=>{h(v.point)}),c.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",v=>{h(v.point)}),u.addEventListener("locationError",v=>{alert(v.message)}),c.addControl(u),c.addEventListener("click",v=>{h(v.point)}),c.enableScrollWheelZoom(!0),g(a.lng,a.lat),r.value=!1},h=y=>{new s.Geocoder().getLocation(y,w=>{d.setPosition(y),c.panTo(y),i("update:address",w.address),i("update:lng",y.lng),i("update:lat",y.lat),i("change",{value:{address:w.address,lng:y.lng,lat:y.lat}})})},g=(y,v)=>{if(y&&v&&s){const w=new s.Point(y,v);d&&d.setPosition(w),c&&c.panTo(w)}};let p=null;return t({setPoint:g,querySearchAsync:(y,v)=>{!c||!s||(p||(p=new s.LocalSearch(c,{onSearchComplete:w=>{const C=[];if(w){const x=w.getCurrentNumPois();for(let S=0;S<x;S++)C.push(w.getPoi(S))}v(C)}})),p.search(y))}}),o.onMounted(()=>{f()}),(y,v)=>(o.openBlock(),o.createElementBlock("div",{class:"j-map",style:o.normalizeStyle({height:e.height})},[r.value?(o.openBlock(),o.createElementBlock("div",mp,[o.createVNode(fn,{icon:"mdi:loading",class:"is-loading",size:30})])):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}));function Ul(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function zn(e){return e.originalEvent||e.srcEvent}function Ya(e){Ul(e),Ul(zn(e))}function $n(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 Dl=1500;function Yl(e,t,n){var a=this,i=n.get("dragging",!1);function r(l){if(!l.hover){var s=l.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(l.stopPropagation(),i.hover({element:d,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(l){t.once("drag.move",Dl,function(s){r(s)})}),(function(){var l,s;t.on("element.hover",function(c){l=c.gfx,s=c.element}),t.on("element.hover",Dl,function(c){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,c;if(l instanceof MouseEvent)return s=$n(l),c=document.elementFromPoint(s.x,s.y),bp(c)}}Yl.$inject=["elementRegistry","eventBus","injector"];function bp(e){return F.closest(e,"svg, .djs-element",!0)}const vp={__init__:["hoverFix"],hoverFix:["type",Yl]};function Jl(){return/mac/i.test(navigator.platform)}function Gl(e,t){return(zn(e)||e).button===t}function $t(e){return Gl(e,0)}function wp(e){return Gl(e,1)}function Kl(e){var t=zn(e)||e;return $t(e)?Jl()?t.metaKey:t.ctrlKey:!1}function Ja(e){var t=zn(e)||e;return $t(e)&&t.shiftKey}function so(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Cp(e){return["M",e.x,e.y]}function Ga(e){return["L",e.x,e.y]}function xp(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function kp(e,t){const n=e.length,a=[Cp(e[0])];for(let i=1;i<n;i++){const r=e[i-1],l=e[i],s=e[i+1];if(!s||!t){a.push(Ga(l));continue}const c=Math.min(t,Ka(l.x-r.x,l.y-r.y),Ka(s.x-l.x,s.y-l.y));if(!c){a.push(Ga(l));continue}const d=Fo(l,r,c),u=Fo(l,r,c*.5),f=Fo(l,s,c),h=Fo(l,s,c*.5);a.push(Ga(d)),a.push(xp(u,h,f))}return a}function Fo(e,t,n){const a=t.x-e.x,i=t.y-e.y,r=Ka(a,i),l=n/r;return{x:e.x+a*l,y:e.y+i*l}}function Ka(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function qa(e,t,n){k.isNumber(t)&&(n=t,t=null),t||(t={});const a=j.create("path",t);return k.isNumber(n)&&(a.dataset.cornerRadius=String(n)),ql(a,e)}function ql(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return j.attr(e,{d:so(kp(t,n))}),e}function Ep(e){return!0}function Wo(e){return $t(e)||wp(e)}var Xl=500;function Zl(e,t,n){var a=this;function i(E,T,P){if(!s(E,T)){var B,H,I;P?H=t.getGraphics(P):(B=T.delegateTarget||T.target,B&&(H=B,P=t.get(H))),!(!H||!P)&&(I=e.fire(E,{element:P,gfx:H,originalEvent:T}),I===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function l(E){return r[E]}function s(E,T){var P=d[E]||$t;return!P(T)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},d={"element.contextmenu":Ep,"element.mousedown":Wo,"element.mouseup":Wo,"element.click":Wo,"element.dblclick":Wo};function u(E,T,P){var B=c[E];if(!B)throw new Error("unmapped DOM event name <"+E+">");return i(B,T,P)}var f="svg, .djs-element";function h(E,T,P,B){var H=r[P]=function(I){i(P,I)};B&&(d[P]=B),H.$delegate=F.delegate.bind(E,f,T,H)}function g(E,T,P){var B=l(P);B&&F.delegate.unbind(E,T,B.$delegate)}function p(E){k.forEach(c,function(T,P){h(E,P,T)})}function m(E){k.forEach(c,function(T,P){g(E,P,T)})}e.on("canvas.destroy",function(E){m(E.svg)}),e.on("canvas.init",function(E){p(E.svg)}),e.on(["shape.added","connection.added"],function(E){var T=E.element,P=E.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:P})}),e.on(["shape.changed","connection.changed"],Xl,function(E){var T=E.element,P=E.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:P})}),e.on("interactionEvents.createHit",Xl,function(E){var T=E.element,P=E.gfx;a.createDefaultHit(T,P)}),e.on("interactionEvents.updateHit",function(E){var T=E.element,P=E.gfx;a.updateDefaultHit(T,P)});var y=S("djs-hit djs-hit-stroke"),v=S("djs-hit djs-hit-click-stroke"),w=S("djs-hit djs-hit-all"),C=S("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":v,stroke:y,"no-move":C};function S(E,T){return T=k.assign({stroke:"white",strokeWidth:15},T||{}),n.cls(E,["no-fill","no-border"],T)}function b(E,T){var P=x[T];if(!P)throw new Error("invalid hit type <"+T+">");return j.attr(E,P),E}function _(E,T){j.append(E,T)}this.removeHits=function(E){var T=F.queryAll(".djs-hit",E);k.forEach(T,j.remove)},this.createDefaultHit=function(E,T){var P=E.waypoints,B=E.isFrame,H;return P?this.createWaypointsHit(T,P):(H=B?"stroke":"all",this.createBoxHit(T,H,{width:E.width,height:E.height}))},this.createWaypointsHit=function(E,T){var P=qa(T);return b(P,"stroke"),_(E,P),P},this.createBoxHit=function(E,T,P){P=k.assign({x:0,y:0},P);var B=j.create("rect");return b(B,T),j.attr(B,P),_(E,B),B},this.updateDefaultHit=function(E,T){var P=F.query(".djs-hit",T);if(P)return E.waypoints?ql(P,E.waypoints):j.attr(P,{width:E.width,height:E.height}),P},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=h,this.unregisterEvent=g}Zl.$inject=["eventBus","elementRegistry","styles"];const Xa={__init__:["interactionEvents"],interactionEvents:["type",Zl]};function Fn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;n.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){n.select(null)})}Fn.$inject=["eventBus","canvas"],Fn.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(n!==-1){var a=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Fn.prototype.get=function(){return this._selectedElements},Fn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Fn.prototype.select=function(e,t){var n=this._selectedElements,a=n.slice();k.isArray(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){var s=i.findRoot(l);return r===s}),t?k.forEach(e,function(l){n.indexOf(l)===-1&&n.push(l)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:n})};var Ql="hover",es="selected";function ts(e,t){this._canvas=e;function n(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){n(i.element,Ql)}),t.on("element.out",function(i){a(i.element,Ql)}),t.on("selection.changed",function(i){function r(d){a(d,es)}function l(d){n(d,es)}var s=i.oldSelection,c=i.newSelection;k.forEach(s,function(d){c.indexOf(d)===-1&&r(d)}),k.forEach(c,function(d){s.indexOf(d)===-1&&l(d)})})}ts.$inject=["canvas","eventBus"];function ns(e,t,n,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,s=r.elements,c=r.hints||{},d=c.autoSelect;if(l){if(d===!1)return;k.isArray(d)?t.select(d):t.select(s.filter(Sp))}}),e.on("connect.end",500,function(i){var r=i.context,l=r.connection;l&&t.select(l)}),e.on("shape.move.end",500,function(i){var r=i.previousSelection||[],l=a.get(i.context.shape.id),s=k.find(r,function(c){return l.id===c.id});s||t.select(l)}),e.on("element.click",function(i){if($t(i)){var r=i.element;r===n.getRootElement()&&(r=null);var l=t.isSelected(r),s=t.get().length>1,c=Ja(i);if(l&&s)return c?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,c)}})}ns.$inject=["eventBus","selection","canvas","elementRegistry"];function Sp(e){return!e.hidden}const Wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Xa],selection:["type",Fn],selectionVisuals:["type",ts],selectionBehavior:["type",ns]};var _p=/^djs-cursor-.*$/;function Za(e){var t=F.classes(document.body);t.removeMatching(_p),e&&t.add("djs-cursor-"+e)}function os(){Za(null)}var Rp=5e3;function as(e,t){t=t||"element.click";function n(){return!1}return e.once(t,Rp,n),function(){e.off(t,n)}}function is(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Un(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rs(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function ls(e,t){return e=k.isArray(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Dn=Math.round,ss="djs-drag-active";function pn(e){e.preventDefault()}function Bp(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Tp(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function cs(e,t,n,a){var i={threshold:5,trapClick:!0},r;function l(C){var x=t.viewbox(),S=t._container.getBoundingClientRect();return{x:x.x+(C.x-S.left)/x.scale,y:x.y+(C.y-S.top)/x.scale}}function s(C,x){x=x||r;var S=e.createEvent(k.assign({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+C,S)===!1?!1:e.fire(x.prefix+"."+C,S)}function c(C){var x=C.filter(function(S){return a.get(S.id)});x.length&&n.select(x)}function d(C,x){var S=r.payload,b=r.displacement,_=r.globalStart,E=$n(C),T=Un(E,_),P=r.localStart,B=l(E),H=Un(B,P);if(!r.active&&(x||Tp(T)>r.threshold)){if(k.assign(S,{x:Dn(P.x+b.x),y:Dn(P.y+b.y),dx:0,dy:0},{originalEvent:C}),s("start")===!1)return y();r.active=!0,r.keepSelection||(S.previousSelection=n.get(),n.select(null)),r.cursor&&Za(r.cursor),t.addMarker(t.getRootElement(),ss)}Ya(C),r.active&&(k.assign(S,{x:Dn(B.x+b.x),y:Dn(B.y+b.y),dx:Dn(H.x),dy:Dn(H.y)},{originalEvent:C}),s("move"))}function u(C){var x,S=!0;r.active&&(C&&(r.payload.originalEvent=C,Ya(C)),S=s("end")),S===!1&&s("rejected"),x=v(S!==!0),s("ended",x)}function f(C){ls("Escape",C)&&(pn(C),y())}function h(C){var x;r.active&&(x=as(e),setTimeout(x,400),pn(C)),u(C)}function g(C){d(C)}function p(C){var x=r.payload;x.hoverGfx=C.gfx,x.hover=C.element,s("hover")}function m(C){s("out");var x=r.payload;x.hoverGfx=null,x.hover=null}function y(C){var x;if(r){var S=r.active;S&&s("cancel"),x=v(C),S&&s("canceled",x)}}function v(C){var x,S;s("cleanup"),os(),r.trapClick?S=h:S=u,F.event.unbind(document,"mousemove",d),F.event.unbind(document,"dragstart",pn),F.event.unbind(document,"selectstart",pn),F.event.unbind(document,"mousedown",S,!0),F.event.unbind(document,"mouseup",S,!0),F.event.unbind(document,"keyup",f),F.event.unbind(document,"touchstart",g,!0),F.event.unbind(document,"touchcancel",y,!0),F.event.unbind(document,"touchmove",d,!0),F.event.unbind(document,"touchend",u,!0),e.off("element.hover",p),e.off("element.out",m),t.removeMarker(t.getRootElement(),ss);var b=r.payload.previousSelection;return C!==!1&&b&&!n.get().length&&c(b),x=r,r=null,x}function w(C,x,S,b){r&&y(!1),typeof x=="string"&&(b=S,S=x,x=null),b=k.assign({},i,b||{});var _=b.data||{},E,T,P,B,H;b.trapClick?B=h:B=u,C?(E=zn(C)||C,T=$n(C),Ya(C),E.type==="dragstart"&&pn(E)):(E=null,T={x:0,y:0}),P=l(T),x||(x=P),H=Bp(E),r=k.assign({prefix:S,data:_,payload:{},globalStart:T,displacement:Un(x,P),localStart:P,isTouch:H},b),b.manual||(H?(F.event.bind(document,"touchstart",g,!0),F.event.bind(document,"touchcancel",y,!0),F.event.bind(document,"touchmove",d,!0),F.event.bind(document,"touchend",u,!0)):(F.event.bind(document,"mousemove",d),F.event.bind(document,"dragstart",pn),F.event.bind(document,"selectstart",pn),F.event.bind(document,"mousedown",B,!0),F.event.bind(document,"mouseup",B,!0)),F.event.bind(document,"keyup",f),e.on("element.hover",p),e.on("element.out",m)),s("init"),b.autoActivate&&d(C,!0)}e.on("diagram.destroy",y),this.init=w,this.move=d,this.hover=p,this.out=m,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(C){k.assign(i,C)}}cs.$inject=["eventBus","canvas","selection","elementRegistry"];const gn={__depends__:[vp,Wn],dragging:["type",cs]};function Qa(e){return e.childNodes[0]}function Uo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Uo.prototype.next=function(){return this._prefix+ ++this._counter};const Mp=new Uo("ps");var Pp=["marker-start","marker-mid","marker-end"],jp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Ft(e,t,n,a){this._elementRegistry=e,this._canvas=n,this._styles=a}Ft.$inject=["elementRegistry","eventBus","canvas","styles"],Ft.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")},Ft.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Ft.prototype.addDragger=function(e,t,n,a="djs-dragger"){n=n||this.getGfx(e);var i=j.clone(n),r=n.getBoundingClientRect();return this._cloneMarkers(Qa(i),a),j.attr(i,this._styles.cls(a,[],{x:r.top,y:r.left})),j.append(t,i),j.attr(i,"data-preview-support-element-id",e.id),i},Ft.prototype.addFrame=function(e,t){var n=j.create("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return j.append(t,n),j.attr(n,"data-preview-support-element-id",e.id),n},Ft.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,n)}),Ip(e)&&Pp.forEach(function(i){if(j.attr(e,i)){var r=Ap(e,i,a._canvas.getContainer());r&&a._cloneMarker(n,e,r,i,t)}})},Ft.prototype._cloneMarker=function(e,t,n,a,i="djs-dragger"){var r=[n.id,i,Mp.next()].join("-"),l=F.query("marker#"+n.id,e);e=e||this._canvas._svg;var s=l||j.clone(n);s.id=r,j.classes(s).add(i);var c=F.query(":scope > defs",e);c||(c=j.create("defs"),j.append(e,c)),j.append(c,s);var d=Np(s.id);j.attr(t,a,d)};function Ap(e,t,n){var a=Vp(j.attr(e,t));return F.query("marker#"+a,n||document)}function Vp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Np(e){return"url(#"+e+")"}function Ip(e){return jp.indexOf(e.nodeName)!==-1}const ei={__init__:["previewSupport"],previewSupport:["type",Ft]};function ti(e){this._commandStack=e.get("commandStack",!1)}ti.$inject=["injector"],ti.prototype.allowed=function(e,t){var n=!0,a=this._commandStack;return a&&(n=a.canExecute(e,t)),n===void 0?!0:n};const Yn={__init__:["rules"],rules:["type",ti]};function Hp(e){return k.filter(e,function(t){return!k.find(e,function(n){return n!==t&&ds(t,n)})})}function ds(e,t){if(t){if(e===t)return t;if(e.parent)return ds(e.parent,t)}}function us(e,t,n){var a=!0;return e.push(t),a}function ni(e,t,n){n=n||0,k.isArray(e)||(e=[e]),k.forEach(e,function(a,i){var r=t(a,i,n);k.isArray(r)&&r.length&&ni(r,t,n+1)})}function Op(e,t,n){var a=[],i=[];return ni(e,function(r,l,s){us(a,r);var c=r.children;if(c&&us(i,c))return c}),a}function Lp(e,t){return Op(e)}function zp(e,t,n){k.isUndefined(t)&&(t=!0),k.isObject(t)&&(n=t,t=!0),n=n||{};var a=co(n.allShapes),i=co(n.allConnections),r=co(n.enclosedElements),l=co(n.enclosedConnections),s=co(n.topLevel,t&&k.groupBy(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),a[u.source.id]&&a[u.target.id]&&(l[u.id]=r[u.id]=u),i[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)l[u.id]=i[u.id]=u;else return a[u.id]=u,k.forEach(u.incoming,c),k.forEach(u.outgoing,c),u.children}return ni(e,d),{allShapes:a,allConnections:i,topLevel:s,enclosedConnections:l,enclosedElements:r}}function _t(e,t){t=!!t,k.isArray(e)||(e=[e]);var n,a,i,r;return k.forEach(e,function(l){var s=l;l.waypoints&&!t&&(s=_t(l.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(d<a||a===void 0)&&(a=d),(c+f>i||i===void 0)&&(i=c+f),(d+u>r||r===void 0)&&(r=d+u)}),{x:n,y:a,height:r-a,width:i-n}}function $p(e,t){var n={};return k.forEach(e,function(a){var i=a;i.waypoints&&(i=_t(i)),!k.isNumber(t.y)&&i.x>t.x&&(n[a.id]=a),!k.isNumber(t.x)&&i.y>t.y&&(n[a.id]=a),i.x>t.x&&i.y>t.y&&(k.isNumber(t.width)&&k.isNumber(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y||!k.isNumber(t.width)||!k.isNumber(t.height))&&(n[a.id]=a)}),n}function Fp(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Wp(e){return!!(e&&e.isFrame)}function co(e,t){return k.assign({},e||{},t||{})}function ut(e){return k.isObject(e)&&k.has(e,"waypoints")}function Jn(e){return k.isObject(e)&&k.has(e,"labelTarget")}var Up="drop-ok",fs="drop-not-ok",hs="attach-ok",ps="new-parent",gs="create",Dp=2e3;function ms(e,t,n,a,i){function r(c,d,u,f,h){if(!d)return!1;c=k.filter(c,function(w){var C=w.labelTarget;return!w.parent&&!(Jn(w)&&c.indexOf(C)!==-1)});var g=k.find(c,function(w){return!ut(w)}),p=!1,m=!1,y=!1;bs(c)&&(p=i.allowed("shape.attach",{position:u,shape:g,target:d})),p||(bs(c)?y=i.allowed("shape.create",{position:u,shape:g,source:f,target:d}):y=i.allowed("elements.create",{elements:c,position:u,target:d}));var v=h.connectionTarget;return y||p?(g&&f&&(m=i.allowed("connection.create",{source:v===f?g:f,target:v===f?f:g,hints:{targetParent:d,targetAttach:p}})),{attach:p,connect:m}):y===null||p===null?null:!1}function l(c,d){[hs,Up,fs,ps].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var d=c.context,u=d.elements,f=c.hover,h=d.source,g=d.hints||{};if(!f){d.canExecute=!1,d.target=null;return}ys(c);var p={x:c.x,y:c.y},m=d.canExecute=f&&r(u,f,p,h,g);f&&m!==null&&(d.target=f,m&&m.attach?l(f,hs):l(f,m?ps:fs))}),n.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&l(d,null)}),n.on("create.end",function(c){var d=c.context,u=d.source,f=d.shape,h=d.elements,g=d.target,p=d.canExecute,m=p&&p.attach,y=p&&p.connect,v=d.hints||{};if(p===!1||!g)return!1;ys(c);var w={x:c.x,y:c.y};y?f=a.appendShape(u,f,w,g,{attach:m,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(h=a.createElements(h,w,g,k.assign({},v,{attach:m})),f=k.find(h,function(C){return!ut(C)})),k.assign(d,{elements:h,shape:f}),k.assign(c,{elements:h,shape:f})});function s(){var c=t.context();c&&c.prefix===gs&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],Dp,function(){n.off("elements.changed",s)})}),this.start=function(c,d,u){k.isArray(d)||(d=[d]);var f=k.find(d,function(p){return!ut(p)});if(f){u=k.assign({elements:d,hints:{},shape:f},u||{}),k.forEach(d,function(p){k.isNumber(p.x)||(p.x=0),k.isNumber(p.y)||(p.y=0)});var h=k.filter(d,function(p){return!p.hidden}),g=_t(h);k.forEach(d,function(p){ut(p)&&(p.waypoints=k.map(p.waypoints,function(m){return{x:m.x-g.x-g.width/2,y:m.y-g.y-g.height/2}})),k.assign(p,{x:p.x-g.x-g.width/2,y:p.y-g.y-g.height/2})}),t.init(c,gs,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:d,context:u}})}}}ms.$inject=["canvas","dragging","eventBus","modeling","rules"];function ys(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function bs(e){return e&&e.length===1&&!ut(e[0])}function Yp(e,t,n,a,i){var r=j.createTransform();r.setTranslate(t,n);var l=j.createTransform();l.setRotate(0,0,0);var s=j.createTransform();s.setScale(1,1),j.transform(e,[r,l,s])}function Rt(e,t,n){var a=j.createTransform();a.setTranslate(t,n),j.transform(e,a)}function Jp(e,t){var n=j.createTransform();n.setRotate(t,0,0),j.transform(e,n)}var Gp=750;function vs(e,t,n,a,i){function r(l){var s=j.create("g");j.attr(s,i.cls("djs-drag-group",["no-events"]));var c=j.create("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Qa(u),d)):(u=n._createContainer("shape",c),n.drawShape(Qa(u),d),Rt(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",Gp,function(l){var s=l.hover,c=l.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var f;s?(u.parentNode||(f=e.getActiveLayer(),j.append(f,u)),Rt(u,l.x,l.y)):j.remove(u)}),t.on("create.cleanup",function(l){var s=l.context,c=s.dragGroup;c&&j.remove(c)})}vs.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ws={__depends__:[gn,ei,Yn,Wn],__init__:["create","createPreview"],create:["type",ms],createPreview:["type",vs]};function uo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function oi(e,t,n,a){if(typeof a>"u"&&(a=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=uo(e,t);return Math.abs(i/r)<=a}var Kp=2;function Wt(e,t){var n=Array.from(arguments).flat();const a={x:"v",y:"h"};for(const[i,r]of Object.entries(a))if(qp(i,n))return r;return!1}function qp(e,t){const n=t[0];return k.every(t,function(a){return Math.abs(n[e]-a[e])<=Kp})}function Cs(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function ai(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Xp=/,?([a-z]),?/gi,xs=parseFloat,qe=Math,Ut=qe.PI,Bt=qe.min,Tt=qe.max,ks=qe.pow,Dt=qe.abs,Zp=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Qp=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Es=Array.isArray||function(e){return e instanceof Array};function eg(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tg(e,t){for(var n=0,a=e.length;n<a;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function ng(e){function t(){var n=Array.prototype.slice.call(arguments,0),a=n.join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return eg(i,a)?(tg(r,a),i[a]):(r.length>=1e3&&delete i[r.shift()],r.push(a),i[a]=e(...arguments),i[a])}return t}function og(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},n=[];return String(e).replace(Zp,function(a,i,r){var l=[],s=i.toLowerCase();for(r.replace(Qp,function(c,d){d&&l.push(+d)}),s=="m"&&l.length>2&&(n.push([i,...l.splice(0,2)]),s="l",i=i=="m"?"l":"L");l.length>=t[s]&&(n.push([i,...l.splice(0,t[s])]),!!t[s]););}),n.toString=ri,n}function ag(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function ig(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function ii(e,t,n,a){return arguments.length===1&&(t=e.y,n=e.width,a=e.height,e=e.x),{x:e,y:t,width:n,height:a,x2:e+n,y2:t+a}}function ri(){return this.join(",").replace(Xp,"$1")}function rg(e){for(var t=new Array(e.length),n=0,a=e.length;n<a;n++)for(var i=e[n],r=t[n]=new Array(i.length),l=0,s=i.length;l<s;l++)r[l]=i[l];return t.toString=ri,t}function Ss(e,t,n,a,i,r,l,s,c){var d=1-c,u=ks(d,3),f=ks(d,2),h=c*c,g=h*c,p=u*e+f*3*c*n+d*3*c*c*i+g*l,m=u*t+f*3*c*a+d*3*c*c*r+g*s;return{x:Do(p),y:Do(m)}}function _s(e){var t=fg(...e);return ii(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Yt(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function lg(e,t){return e=ii(e),t=ii(t),Yt(t,e.x,e.y)||Yt(t,e.x2,e.y)||Yt(t,e.x,e.y2)||Yt(t,e.x2,e.y2)||Yt(e,t.x,t.y)||Yt(e,t.x2,t.y)||Yt(e,t.x,t.y2)||Yt(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 Rs(e,t,n,a,i){var r=-3*t+9*n-9*a+3*i,l=e*r+6*t-12*n+6*a;return e*l-3*t+3*n}function Bs(e,t,n,a,i,r,l,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var d=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],g=0,p=0;p<u;p++){var m=d*f[p]+d,y=Rs(m,e,n,i,l),v=Rs(m,t,a,r,s),w=y*y+v*v;g+=h[p]*qe.sqrt(w)}return d*g}function sg(e,t,n,a,i,r,l,s){if(!(Tt(e,n)<Bt(i,l)||Bt(e,n)>Tt(i,l)||Tt(t,a)<Bt(r,s)||Bt(t,a)>Tt(r,s))){var c=(e*a-t*n)*(i-l)-(e-n)*(i*s-r*l),d=(e*a-t*n)*(r-s)-(t-a)*(i*s-r*l),u=(e-n)*(r-s)-(t-a)*(i-l);if(u){var f=Do(c/u),h=Do(d/u),g=+f.toFixed(2),p=+h.toFixed(2);if(!(g<+Bt(e,n).toFixed(2)||g>+Tt(e,n).toFixed(2)||g<+Bt(i,l).toFixed(2)||g>+Tt(i,l).toFixed(2)||p<+Bt(t,a).toFixed(2)||p>+Tt(t,a).toFixed(2)||p<+Bt(r,s).toFixed(2)||p>+Tt(r,s).toFixed(2)))return{x:f,y:h}}}}function Do(e){return Math.round(e*1e11)/1e11}function cg(e,t,n){var a=_s(e),i=_s(t);if(!lg(a,i))return[];var r=Bs(...e),l=Bs(...t),s=Ms(e)?1:~~(r/5)||1,c=Ms(t)?1:~~(l/5)||1,d=new Array(s+1),u=new Array(c+1),f={},h=[],g,p;for(g=0;g<s+1;g++){var m=Ss(...e,g/s);d[g]={x:m.x,y:m.y,t:g/s}}for(g=0;g<c+1;g++)m=Ss(...t,g/c),u[g]={x:m.x,y:m.y,t:g/c};for(g=0;g<s;g++)for(p=0;p<c;p++){var y=d[g],v=d[g+1],w=u[p],C=u[p+1],x=Dt(v.x-y.x)<.01?"y":"x",S=Dt(C.x-w.x)<.01?"y":"x",b=sg(y.x,y.y,v.x,v.y,w.x,w.y,C.x,C.y),_;if(b){if(_=b.x.toFixed(9)+"#"+b.y.toFixed(9),f[_])continue;f[_]=!0;var E=y.t+Dt((b[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),T=w.t+Dt((b[S]-w[S])/(C[S]-w[S]))*(C.t-w.t);E>=0&&E<=1&&T>=0&&T<=1&&h.push({x:b.x,y:b.y,t1:E,t2:T})}}return h}function Ts(e,t,n){e=As(e),t=As(t);for(var a,i,r,l,s,c,d,u,f,h,g=n?0:[],p=0,m=e.length;p<m;p++){var y=e[p];if(y[0]=="M")a=s=y[1],i=c=y[2];else{y[0]=="C"?(f=[a,i,...y.slice(1)],a=f[6],i=f[7]):(f=[a,i,a,i,s,c,s,c],a=s,i=c);for(var v=0,w=t.length;v<w;v++){var C=t[v];if(C[0]=="M")r=d=C[1],l=u=C[2];else{C[0]=="C"?(h=[r,l,...C.slice(1)],r=h[6],l=h[7]):(h=[r,l,r,l,d,u,d,u],r=d,l=u);var x=cg(f,h);{for(var S=0,b=x.length;S<b;S++)x[S].segment1=p,x[S].segment2=v,x[S].bez1=f,x[S].bez2=h;g=g.concat(x)}}}}}return g}function dg(e){return Es(e)&&Es(e[0])}function ug(e){if(ag(e))return e;var t=new Array(e.length),n=0,a=0,i=0,r=0,l=0,s;e[0][0]=="M"&&(n=+e[0][1],a=+e[0][2],i=n,r=a,l++,t[0]=["M",n,a]);for(var c,d,u=l,f=e.length;u<f;u++){if(d=e[u],s=d[0],t[u]=c=new Array(d.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=+d[6]+n,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+n;break;case"M":i=+d[1]+n,r=+d[2]+a;default:for(var h=1,g=d.length;h<g;h++)c[h]=+d[h]+(h%2?n:a)}else for(var p=0,m=d.length;p<m;p++)c[p]=d[p];switch(s=s.toUpperCase(),c[0]){case"Z":n=+i,a=+r;break;case"H":n=c[1];break;case"V":a=c[1];break;case"M":i=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],a=c[c.length-1]}}return t.toString=ri,t}function Ms(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Yo(e,t,n,a){return[e,t,n,a,n,a]}function Ps(e,t,n,a,i,r){var l=.3333333333333333,s=2/3;return[l*e+s*n,l*t+s*a,l*i+s*n,l*r+s*a,i,r]}function js(e,t,n,a,i,r,l,s,c,d){var u=Ut*120/180,f=Ut/180*(+i||0),h=[],g,p=ng(function(ue,Ve,De){var Y=ue*qe.cos(De)-Ve*qe.sin(De),ae=ue*qe.sin(De)+Ve*qe.cos(De);return{x:Y,y:ae}});if(d)_=d[0],E=d[1],S=d[2],b=d[3];else{g=p(e,t,-f),e=g.x,t=g.y,g=p(s,c,-f),s=g.x,c=g.y;var m=(e-s)/2,y=(t-c)/2,v=m*m/(n*n)+y*y/(a*a);v>1&&(v=qe.sqrt(v),n=v*n,a=v*a);var w=n*n,C=a*a,x=(r==l?-1:1)*qe.sqrt(Dt((w*C-w*y*y-C*m*m)/(w*y*y+C*m*m))),S=x*n*y/a+(e+s)/2,b=x*-a*m/n+(t+c)/2,_=qe.asin(((t-b)/a).toFixed(9)),E=qe.asin(((c-b)/a).toFixed(9));_=e<S?Ut-_:_,E=s<S?Ut-E:E,_<0&&(_=Ut*2+_),E<0&&(E=Ut*2+E),l&&_>E&&(_=_-Ut*2),!l&&E>_&&(E=E-Ut*2)}var T=E-_;if(Dt(T)>u){var P=E,B=s,H=c;E=_+u*(l&&E>_?1:-1),s=S+n*qe.cos(E),c=b+a*qe.sin(E),h=js(s,c,n,a,i,0,l,B,H,[E,P,S,b])}T=E-_;var I=qe.cos(_),O=qe.sin(_),M=qe.cos(E),R=qe.sin(E),V=qe.tan(T/4),L=4/3*n*V,Q=4/3*a*V,oe=[e,t],le=[e+L*O,t-Q*I],Ce=[s+L*R,c-Q*M],Ue=[s,c];if(le[0]=2*oe[0]-le[0],le[1]=2*oe[1]-le[1],d)return[le,Ce,Ue].concat(h);h=[le,Ce,Ue].concat(h).join().split(",");for(var G=[],Ee=0,Me=h.length;Ee<Me;Ee++)G[Ee]=Ee%2?p(h[Ee-1],h[Ee],f).y:p(h[Ee],h[Ee+1],f).x;return G}function fg(e,t,n,a,i,r,l,s){for(var c=[],d=[[],[]],u,f,h,g,p,m,y,v,w=0;w<2;++w){if(w==0?(f=6*e-12*n+6*i,u=-3*e+9*n-9*i+3*l,h=3*n-3*e):(f=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,h=3*a-3*t),Dt(u)<1e-12){if(Dt(f)<1e-12)continue;g=-h/f,0<g&&g<1&&c.push(g);continue}y=f*f-4*h*u,v=qe.sqrt(y),!(y<0)&&(p=(-f+v)/(2*u),0<p&&p<1&&c.push(p),m=(-f-v)/(2*u),0<m&&m<1&&c.push(m))}for(var C=c.length,x=C,S;C--;)g=c[C],S=1-g,d[0][C]=S*S*S*e+3*S*S*g*n+3*S*g*g*i+g*g*g*l,d[1][C]=S*S*S*t+3*S*S*g*a+3*S*g*g*r+g*g*g*s;return d[0][x]=e,d[1][x]=t,d[0][x+1]=l,d[1][x+1]=s,d[0].length=d[1].length=x+2,{x0:Bt(...d[0]),y0:Bt(...d[1]),x1:Tt(...d[0]),y1:Tt(...d[1])}}function As(e){if(dg(e)||(e=og(e)),ig(e))return e;for(var t=rg(ug(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(h,g,p){var m,y;if(!h)return["C",g.x,g.y,g.x,g.y,g.x,g.y];switch(!(h[0]in{T:1,Q:1})&&(g.qx=g.qy=null),h[0]){case"M":g.X=h[1],g.Y=h[2];break;case"A":h=["C",...js(g.x,g.y,...h.slice(1))];break;case"S":p=="C"||p=="S"?(m=g.x*2-g.bx,y=g.y*2-g.by):(m=g.x,y=g.y),h=["C",m,y,...h.slice(1)];break;case"T":p=="Q"||p=="T"?(g.qx=g.x*2-g.qx,g.qy=g.y*2-g.qy):(g.qx=g.x,g.qy=g.y),h=["C",...Ps(g.x,g.y,g.qx,g.qy,h[1],h[2])];break;case"Q":g.qx=h[1],g.qy=h[2],h=["C",...Ps(g.x,g.y,h[1],h[2],h[3],h[4])];break;case"L":h=["C",...Yo(g.x,g.y,h[1],h[2])];break;case"H":h=["C",...Yo(g.x,g.y,h[1],g.y)];break;case"V":h=["C",...Yo(g.x,g.y,g.x,h[1])];break;case"Z":h=["C",...Yo(g.x,g.y,g.X,g.Y)];break}return h},i=function(h,g){if(h[g].length>7){h[g].shift();for(var p=h[g];p.length;)r[g]="A",h.splice(g++,0,["C",...p.splice(0,6)]);h.splice(g,1),d=t.length}},r=[],l="",s="",c=0,d=t.length;c<d;c++){t[c]&&(l=t[c][0]),l!="C"&&(r[c]=l,c&&(s=r[c-1])),t[c]=a(t[c],n,s),r[c]!="A"&&l=="C"&&(r[c]="C"),i(t,c);var u=t[c],f=u.length;n.x=u[f-2],n.y=u[f-1],n.bx=xs(u[f-4])||n.x,n.by=xs(u[f-3])||n.y}return t}function hg(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function fo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Te(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Vs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function pg(e){return fo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function gg(e){for(var t=e.waypoints,n=t.reduce(function(d,u,f){var h=t[f-1];if(h){var g=d[d.length-1],p=g&&g.endLength||0,m=bg(h,u);d.push({start:h,end:u,startLength:p,endLength:p+m,length:m})}return d},[]),a=n.reduce(function(d,u){return d+u.length},0),i=a/2,r=0,l=n[r];l.endLength<i;)l=n[++r];var s=(i-l.startLength)/l.length,c={x:l.start.x+(l.end.x-l.start.x)*s,y:l.start.y+(l.end.y-l.start.y)*s};return c}function Je(e){return ut(e)?gg(e):pg(e)}function Jt(e,t,n){n=n||0,k.isObject(n)||(n={x:n,y:n});var a=Te(e),i=Te(t),r=a.bottom+n.y<=i.top,l=a.left-n.x>=i.right,s=a.top-n.y>=i.bottom,c=a.right+n.x<=i.left,d=r?"top":s?"bottom":null,u=c?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function li(e,t,n){var a=mg(e,t);return a.length===1||a.length===2&&uo(a[0],a[1])<1?fo(a[0]):a.length>1?(a=k.sortBy(a,function(i){var r=Math.floor(i.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,i.segment2+"#"+r}),fo(a[n?0:a.length-1])):null}function mg(e,t){return Ts(e,t)}function yg(e){e=e.slice();for(var t=0,n,a,i;e[t];)n=e[t],a=e[t-1],i=e[t+1],uo(n,i)===0||oi(a,i,n)?e.splice(t,1):t++;return e}function bg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ns(e,t,n,a){function i(l,s){return a.allowed("connection.create",{source:l,target:s})}function r(l,s){return i(s,l)}e.on("connect.hover",function(l){var s=l.context,c=s.start,d=l.hover,u;if(s.hover=d,u=s.canExecute=i(c,d),!k.isNil(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!k.isNil(u)&&u!==!1&&(s.source=d,s.target=c)}}),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,c=s.canExecute,d=s.connectionStart,u={x:l.x,y:l.y},f=s.source,h=s.target;if(!c)return!1;var g=null,p={connectionStart:si(s)?u:d,connectionEnd:si(s)?d:u};k.isObject(c)&&(g=c),s.connection=n.connect(f,h,g,p)}),this.start=function(l,s,c,d){k.isObject(c)||(d=c,c=Je(s)),t.init(l,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}Ns.$inject=["eventBus","dragging","modeling","rules"];function si(e){var t=e.hover,n=e.source,a=e.target;return t&&n&&t===n&&n!==a}var vg=1100,wg=900,Is="connect-ok",Hs="connect-not-ok";function Os(e,t,n){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=r.canExecute,s=r.hover,c=r.source,d=r.start,u=r.startPosition,f=r.target,h=r.connectionStart||u,g=r.connectionEnd||{x:i.x,y:i.y},p=h,m=g;si(r)&&(p=g,m=h),a.drawPreview(r,l,{source:c||d,target:f||s,connectionStart:p,connectionEnd:m})}),t.on("connect.hover",wg,function(i){var r=i.context,l=i.hover,s=r.canExecute;s!==null&&n.addMarker(l,s?Is:Hs)}),t.on(["connect.out","connect.cleanup"],vg,function(i){var r=i.hover;r&&(n.removeMarker(r,Is),n.removeMarker(r,Hs))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}Os.$inject=["injector","eventBus","canvas"];const ci={__depends__:[Wn,Yn,gn],__init__:["connectPreview"],connect:["type",Ns],connectPreview:["type",Os]};var Cg=15;function Ls(e,t){var n;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 i(s){var c=n.start,d=n.button,u=$n(s),f=Un(u,c);if(!n.dragging&&xg(f)>Cg&&(n.dragging=!0,d===0&&as(e),Za("grab")),n.dragging){var h=n.last||n.start;f=Un(u,h),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function r(s){F.event.unbind(document,"mousemove",i),F.event.unbind(document,"mouseup",r),n=null,os()}function l(s){if(!F.closest(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$n(s)},F.event.bind(document,"mousemove",i),F.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}Ls.$inject=["eventBus","canvas"];function xg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const zs={__init__:["moveCanvas"],moveCanvas:["type",Ls]};function di(e){return Math.log(e)/Math.log(10)}function $s(e,t){var n=di(e.min),a=di(e.max),i=Math.abs(n)+Math.abs(a);return i/t}function kg(e,t){return Math.max(e.min,Math.min(e.max,t))}var Eg=Math.sign||function(e){return e>=0?1:-1},ui={min:.2,max:4},Fs=10,Sg=.1,_g=.75;function Mt(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=k.bind(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||_g;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Mt.$inject=["config.zoomScroll","eventBus","canvas"],Mt.prototype.scroll=function(t){this._canvas.scroll(t)},Mt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Mt.prototype.zoom=function(t,n){var a=$s(ui,Fs*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Sg&&(this._zoom(t,n,a),this._totalDelta=0)},Mt.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var a=t.ctrlKey||Jl()&&t.metaKey,i=t.shiftKey,r=-1*this._scale,l;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Eg(t.deltaY)*r,this.zoom(l,c)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},Mt.prototype.stepZoom=function(t,n){var a=$s(ui,Fs);this._zoom(t,n,a)},Mt.prototype._zoom=function(e,t,n){var a=this._canvas,i=e>0?1:-1,r=di(a.zoom()),l=Math.round(r/n)*n;l+=n*i;var s=Math.pow(10,l);a.zoom(kg(ui,s),t)},Mt.prototype.toggle=function(t){var n=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&F.event[t?"bind":"unbind"](n,"wheel",a,!1),this._enabled=t,t},Mt.prototype._init=function(e){this.toggle(e)};const Ws={__init__:["zoomScroll"],zoomScroll:["type",Mt]};function We(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)}We.$inject=["eventBus","injector"],We.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},We.prototype.canExecute=function(e,t){const n={command:e,context:t},a=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},We.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},We.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()}},We.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()}},We.prototype.register=function(e,t){this._setHandler(e,t)},We.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},We.prototype.canUndo=function(){return!!this._getUndoAction()},We.prototype.canRedo=function(){return!!this._getRedoAction()},We.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},We.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},We.prototype._internalUndo=function(e){const t=e.command,n=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},We.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const a=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return i},We.prototype._createId=function(){return this._uid++},We.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},We.prototype._internalExecute=function(e,t){const n=e.command,a=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(n,"postExecuted",e)),this._popAction()},We.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,a=n[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()),n.push(e)},We.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,a=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:k.uniqueBy("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},We.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=k.isArray(e)?e:[e],t.dirty=t.dirty.concat(e))},We.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},We.prototype._revertedAction=function(e){this._stackIdx--},We.prototype._getHandler=function(e){return this._handlerMap[e]},We.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};const Rg={commandStack:["type",We]};function mn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function Jo(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Gt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var a=e.indexOf(t);if(a!==-1){if(a===n)return;if(n!==-1)e.splice(a,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function fi(e,t){return!e||!t?-1:e.indexOf(t)}function Gn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var Bg=1e3;function it(e){this._eventBus=e}it.$inject=["eventBus"];function Tg(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}it.prototype.on=function(e,t,n,a,i,r){if((k.isFunction(t)||k.isNumber(t))&&(r=i,i=a,a=n,n=t,t=null),k.isFunction(n)&&(r=i,i=a,a=n,n=Bg),k.isObject(i)&&(r=i,i=!1),!k.isFunction(a))throw new Error("handlerFn must be a function");k.isArray(e)||(e=[e]);var l=this._eventBus;k.forEach(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");l.on(c,n,i?Tg(a,r):a,r)})},it.prototype.canExecute=Nt("canExecute"),it.prototype.preExecute=Nt("preExecute"),it.prototype.preExecuted=Nt("preExecuted"),it.prototype.execute=Nt("execute"),it.prototype.executed=Nt("executed"),it.prototype.postExecute=Nt("postExecute"),it.prototype.postExecuted=Nt("postExecuted"),it.prototype.revert=Nt("revert"),it.prototype.reverted=Nt("reverted");function Nt(e){return function(n,a,i,r,l){(k.isFunction(n)||k.isNumber(n))&&(l=r,r=i,i=a,a=n,n=null),this.on(n,e,a,i,r,l)}}var Mg=250,Us=1400;function hi(e,t,n){it.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Us,function(i){var r=i.context,l=r.shapes,s=r.validatedShapes;r.shapes=Ds(l),r.validatedShapes=Ds(s)}),a&&t.on("shape.move.start",Mg,function(i){var r=i.context,l=r.shapes,s=[];k.forEach(l,function(c){k.forEach(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),k.forEach(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",Us,function(i){var r=i.context,l=r.closure,s=l.enclosedElements,c=[];k.forEach(s,function(d){k.forEach(d.labels,function(u){s[u.id]||c.push(u)})}),l.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context,l=r.connection||r.shape;Gn(l.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,s=l.labelTarget;s&&(r.labelTargetIndex=fi(s.labels,l),r.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(Gt(s.labels,l,c),l.labelTarget=s)})}mn(hi,it),hi.$inject=["injector","eventBus","modeling"];function Ds(e){return k.filter(e,function(t){return e.indexOf(t.labelTarget)===-1})}const Pg={__init__:["labelSupport"],labelSupport:["type",hi]};function Ys(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function Js(e,t){if(t){let n=e;return Object.keys(t).forEach(a=>{n=n.replace(new RegExp(`{${a}}`,"g"),t[a])}),n}return e}function jg(e,t,n,a){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var l=this.indexOf(r);return l!==-1&&(this.splice(l,1),t.unset(r,i,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,l){var s=this.indexOf(r);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,r),s===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Ag(e){return e.__refs_collection===!0}function Vg(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Gs(e,t,n){var a=jg(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,n)})}function Ng(e,t,n){var a=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(r){if(r!==i){var l=i;i=null,l&&e.unset(l,a,n),i=r,e.set(i,a,n)}}})}function mt(e,t){if(!(this instanceof mt))return new mt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}mt.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?Gs(this,t,e):Ng(this,t,e)},mt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Ag(n)||Gs(this,t,e),n},mt.prototype.ensureBound=function(e,t){Vg(e,t)||this.bind(e,t)},mt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},mt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var pi=new mt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ks=new mt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),qs=new mt({name:"attachers",collection:!0},{name:"host"}),Xs=new mt({name:"outgoing",collection:!0},{name:"source"}),Zs=new mt({name:"incoming",collection:!0},{name:"target"});function Kn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),pi.bind(this,"parent"),Ks.bind(this,"labels"),Xs.bind(this,"outgoing"),Zs.bind(this,"incoming")}function ho(){Kn.call(this),pi.bind(this,"children"),qs.bind(this,"host"),qs.bind(this,"attachers")}mn(ho,Kn);function Qs(){Kn.call(this),pi.bind(this,"children")}mn(Qs,ho);function ec(){ho.call(this),Ks.bind(this,"labelTarget")}mn(ec,ho);function tc(){Kn.call(this),Xs.bind(this,"source"),Zs.bind(this,"target")}mn(tc,Kn);var Ig={connection:tc,shape:ho,label:ec,root:Qs};function Hg(e,t){var n=Ig[e];if(!n)throw new Error("unknown type: <"+e+">");return k.assign(new n,t)}function Og(e){return e instanceof Kn}function Kt(){this._uid=12}Kt.prototype.createRoot=function(e){return this.create("root",e)},Kt.prototype.createLabel=function(e){return this.create("label",e)},Kt.prototype.createShape=function(e){return this.create("shape",e)},Kt.prototype.createConnection=function(e){return this.create("connection",e)},Kt.prototype.create=function(e,t){return t=k.assign({},t||{}),t.id||(t.id=e+"_"+this._uid++),Hg(e,t)};const Lg={width:90,height:20};function yn(){Kt.call(this),this._translate=Js}un(yn,Kt),yn.$inject=[],yn.prototype.baseCreate=Kt.prototype.create,yn.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Fe({type:"label"},Lg,t)):this.createFlowElement(e,t)},yn.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Ys()},e==="connection"&&(t.type="myline");const{businessObject:n}=t;n.type=t.type;const a=this._getDefaultSize(n.type);return t=Fe({businessObject:n,id:n.id},a,t),this.baseCreate(e,t)},yn.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 Go(e,t){this._modeling=e,this._canvas=t}Go.$inject=["modeling","canvas"],Go.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,a=e.alignment;k.forEach(n,function(i){var r={x:0,y:0};k.isDefined(a.left)?r.x=a.left-i.x:k.isDefined(a.right)?r.x=a.right-i.width-i.x:k.isDefined(a.center)?r.x=a.center-Math.round(i.width/2)-i.x:k.isDefined(a.top)?r.y=a.top-i.y:k.isDefined(a.bottom)?r.y=a.bottom-i.height-i.y:k.isDefined(a.middle)&&(r.y=a.middle-Math.round(i.height/2)-i.y),t.moveElements([i],r,i.parent)})},Go.prototype.postExecute=function(e){};function Ko(e){this._modeling=e}Ko.$inject=["modeling"],Ko.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,n,{attach:i.attach}),e.shape=a},Ko.prototype.postExecute=function(e){var t=e.hints||{};zg(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 zg(e,t){return k.some(e.outgoing,function(n){return n.target===t})}function qo(e,t){this._canvas=e,this._layouter=t}qo.$inject=["canvas","layouter"],qo.prototype.execute=function(e){var t=e.connection,n=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!n||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},qo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Xo=Math.round;function gi(e){this._modeling=e}gi.$inject=["modeling"],gi.prototype.preExecute=function(e){var t=e.elements,n=e.parent,a=e.parentIndex,i=e.position,r=e.hints,l=this._modeling;k.forEach(t,function(f){k.isNumber(f.x)||(f.x=0),k.isNumber(f.y)||(f.y=0)});var s=k.filter(t,function(f){return!f.hidden}),c=_t(s);k.forEach(t,function(f){ut(f)&&(f.waypoints=k.map(f.waypoints,function(h){return{x:Xo(h.x-c.x-c.width/2+i.x),y:Xo(h.y-c.y-c.height/2+i.y)}})),k.assign(f,{x:Xo(f.x-c.x-c.width/2+i.x),y:Xo(f.y-c.y-c.height/2+i.y)})});var d=Hp(t),u={};k.forEach(t,function(f){if(ut(f)){u[f.id]=k.isNumber(a)?l.createConnection(u[f.source.id],u[f.target.id],a,f,f.parent||n,r):l.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,r);return}var h=k.assign({},r);d.indexOf(f)===-1&&(h.autoResize=!1),Jn(f)&&(h=k.omit(h,["attach"])),u[f.id]=k.isNumber(a)?l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||n,a,h):l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||n,h)}),e.elements=k.values(u)};var nc=Math.round;function qt(e){this._canvas=e}qt.$inject=["canvas"],qt.prototype.execute=function(e){var t=e.shape,n=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?k.assign(t,n):k.assign(t,{x:n.x-nc(t.width/2),y:n.y-nc(t.height/2)}),this._canvas.addShape(t,a,i),t},qt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function po(e){qt.call(this,e)}mn(po,qt),po.$inject=["canvas"];var $g=qt.prototype.execute;po.prototype.execute=function(e){var t=e.shape;return Wg(t),t.labelTarget=e.labelTarget,$g.call(this,e)};var Fg=qt.prototype.revert;po.prototype.revert=function(e){return e.shape.labelTarget=null,Fg.call(this,e)};function Wg(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function go(e,t){this._canvas=e,this._modeling=t}go.$inject=["canvas","modeling"],go.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Gn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Gn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})})},go.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=fi(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},go.prototype.revert=function(e){var t=e.connection,n=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,Gt(n.children,t,a),this._canvas.addConnection(t,n),t};function mi(e,t){this._modeling=e,this._elementRegistry=t}mi.$inject=["modeling","elementRegistry"],mi.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,a=e.elements;k.forEach(a,function(i){n.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function mo(e,t){this._canvas=e,this._modeling=t}mo.$inject=["canvas","modeling"],mo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Gn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Gn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})}),Gn(n.children,function(a){ut(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},mo.prototype.execute=function(e){var t=this._canvas,n=e.shape,a=n.parent;return e.oldParent=a,e.oldParentIndex=fi(a.children,n),t.removeShape(n),n},mo.prototype.revert=function(e){var t=this._canvas,n=e.shape,a=e.oldParent,i=e.oldParentIndex;return Gt(a.children,n,i),t.addShape(n,a),n};function Zo(e){this._modeling=e}Zo.$inject=["modeling"];var oc={x:"y",y:"x"};Zo.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,a=e.axis,i=e.dimension;function r(y,v){y.range.min=Math.min(v[a],y.range.min),y.range.max=Math.max(v[a]+v[i],y.range.max)}function l(y){return y[a]+y[i]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function d(y,v){var w={y:0};w[a]=y-l(v),w[a]&&(w[oc[a]]=0,t.moveElements([v],w,v.parent))}var u=n[0],f=s(n),h=n[f],g,p,m=0;k.forEach(n,function(y,v){var w,C,x;if(y.elements.length<2){v&&v!==n.length-1&&(r(y,y.elements[0]),m+=c(y.range));return}w=k.sortBy(y.elements,a),C=w[0],v===f&&(C=w[s(w)]),x=l(C),y.range=null,k.forEach(w,function(S){if(d(x,S),y.range===null){y.range={min:S[a],max:S[a]+S[i]};return}r(y,S)}),v&&v!==n.length-1&&(m+=c(y.range))}),p=Math.abs(h.range.min-u.range.max),g=Math.round((p-m)/(n.length-1)),!(g<n.length-1)&&k.forEach(n,function(y,v){var w={},C;y===u||y===h||(C=n[v-1],y.range.max=0,k.forEach(y.elements,function(x,S){w[oc[a]]=0,w[a]=C.range.max-x[a]+g,y.range.min!==x[a]&&(w[a]+=x[a]-y.range.min),w[a]&&t.moveElements([x],w,x.parent),y.range.max=Math.max(x[a]+x[i],S?y.range.max:0)}))})},Zo.prototype.postExecute=function(e){};function Qo(e,t){this._layouter=e,this._canvas=t}Qo.$inject=["layouter","canvas"],Qo.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return k.assign(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Qo.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function yi(){}yi.prototype.execute=function(e){var t=e.connection,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Jo(r.children,t),Gt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x+=n.x,l.y+=n.y,l.original&&(l.original.x+=n.x,l.original.y+=n.y)}),t},yi.prototype.revert=function(e){var t=e.connection,n=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return Jo(n.children,t),Gt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x-=r.x,l.y-=r.y,l.original&&(l.original.x-=r.x,l.original.y-=r.y)}),t};function ea(e,t,n){var a=is(t),i=is(n),r=Un(e,a),l={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return fo({x:i.x+l.x,y:i.y+l.y})}function bi(e,t,n){var a=ta(e),i=ic(a,t),r=a[0];return i.length?i[i.length-1]:ea(r.original||r,n,t)}function vi(e,t,n){var a=ta(e),i=ic(a,t),r=a[a.length-1];return i.length?i[0]:ea(r.original||r,n,t)}function wi(e,t,n){var a=ta(e),i=ac(t,n),r=a[0];return ea(r.original||r,i,t)}function Ci(e,t,n){var a=ta(e),i=ac(t,n),r=a[a.length-1];return ea(r.original||r,i,t)}function ac(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ta(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ic(e,t){var n=k.map(e,Dg);return k.filter(n,function(a){return Ug(a,t)})}function Ug(e,t){return Jt(t,e,1)==="intersect"}function Dg(e){return e.original||e}function xi(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}xi.prototype.add=function(e,t){return this.addAll([e],t)},xi.prototype.addAll=function(e,t){var n=zp(e,!!t,this);return k.assign(this,n),this};function yo(e){this._modeling=e}yo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},yo.prototype.moveClosure=function(e,t,n,a,i){var r=this._modeling,l=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===n&&(u=!0),k.forEach(l,function(f){r.moveShape(f,t,d[f.id]&&!u&&n,{recurse:!1,layout:!1})}),k.forEach(s,function(f){var h=!!l[f.source.id],g=!!l[f.target.id];c[f.id]&&h&&g?r.moveConnection(f,t,d[f.id]&&!u&&n):r.layoutConnection(f,{connectionStart:h&&wi(f,f.source,t),connectionEnd:g&&Ci(f,f.target,t)})})},yo.prototype.getClosure=function(e){return new xi().addAll(e,!0)};function na(e){this._helper=new yo(e)}na.$inject=["modeling"],na.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},na.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function bn(e){this._modeling=e,this._helper=new yo(e)}bn.$inject=["modeling"],bn.prototype.execute=function(e){var t=e.shape,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldBounds=k.pick(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Jo(r.children,t),Gt(a.children,t,i),k.assign(t,{parent:a,x:t.x+n.x,y:t.y+n.y}),t},bn.prototype.postExecute=function(e){var t=e.shape,n=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&(k.forEach(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:Ci(r,t,n)})}),k.forEach(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:wi(r,t,n)})})),a.recurse!==!1&&this.moveChildren(e)},bn.prototype.revert=function(e){var t=e.shape,n=e.oldParent,a=e.oldParentIndex,i=e.delta;return Gt(n.children,t,a),k.assign(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},bn.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},bn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function bo(e){this._modeling=e}bo.$inject=["modeling"],bo.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return k.isArray(i)&&(e.oldWaypoints=a.waypoints,a.waypoints=i),t&&(e.oldSource=a.source,a.source=t),n&&(e.oldTarget=a.target,a.target=n),a},bo.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,a=e.newTarget,i=e.dockingOrPoints,r=e.hints||{},l={};r.connectionStart&&(l.connectionStart=r.connectionStart),r.connectionEnd&&(l.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||rc(k.isArray(i)?i[0]:i)),a&&(!n||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||rc(k.isArray(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},bo.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),a&&(i.waypoints=a),i};function rc(e){return e.original||e}function It(e,t){this._modeling=e,this._rules=t}It.$inject=["modeling","rules"],It.prototype.preExecute=function(e){var t=this,n=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=e.hints||{},s;function c(p,m,y){return a.allowed("connection.reconnect",{connection:y,source:p,target:m})}var d={x:r.x,y:r.y},u={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&n.updateAttachment(s,i.host);var f;l.moveChildren!==!1&&(f=i.children.slice(),n.moveElements(f,{x:0,y:0},s,l));var h=i.incoming.slice(),g=i.outgoing.slice();k.forEach(h,function(p){var m=p.source,y=c(m,s,p);y&&t.reconnectEnd(p,s,vi(p,s,u),l)}),k.forEach(g,function(p){var m=p.target,y=c(s,m,p);y&&t.reconnectStart(p,s,bi(p,s,u),l)})},It.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},It.prototype.execute=function(e){},It.prototype.revert=function(e){},It.prototype.createShape=function(e,t,n,a){return this._modeling.createShape(e,t,n,a)},It.prototype.reconnectStart=function(e,t,n,a){this._modeling.reconnectStart(e,t,n,a)},It.prototype.reconnectEnd=function(e,t,n,a){this._modeling.reconnectEnd(e,t,n,a)};function vo(e){this._modeling=e}vo.$inject=["modeling"],vo.prototype.execute=function(e){var t=e.shape,n=e.newBounds,a=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(n.width<a.width||n.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&n.width<10||n.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},k.assign(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},vo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,a=e.oldBounds,i=e.hints||{};i.layout!==!1&&(k.forEach(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:vi(r,n,a)})}),k.forEach(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:bi(r,n,a)})}))},vo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return k.assign(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Yg(e,t){var n=[];return k.forEach(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;k.forEach(i.concat(r),function(l){var s=l.source,c=l.target;(wo(e,s)||wo(e,c)||wo(t,s)||wo(t,c))&&(wo(n,l)||n.push(l))})}),n}function wo(e,t){return e.indexOf(t)!==-1}function Jg(e,t,n){var a=e.x,i=e.y,r=e.width,l=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:a,y:i+c,width:r,height:l-c};case"s":return{x:a,y:i,width:r,height:l+c};case"w":return{x:a+s,y:i,width:r-s,height:l};case"e":return{x:a,y:i,width:r+s,height:l};default:throw new Error("unknown direction: "+t)}}function Xt(e){this._modeling=e}Xt.$inject=["modeling"],Xt.prototype.preExecute=function(e){var t=e.delta,n=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),k.forEach(i,function(s){l[s.id]=Kg(s)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(Yg(a,i),t,n,r,a,i,l)},Xt.prototype.execute=function(){},Xt.prototype.revert=function(){},Xt.prototype.moveShapes=function(e,t){var n=this;k.forEach(e,function(a){n._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Xt.prototype.resizeShapes=function(e,t,n){var a=this;k.forEach(e,function(i){var r=Jg(i,n,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Xt.prototype.updateConnectionWaypoints=function(e,t,n,a,i,r,l){var s=this,c=i.concat(r);k.forEach(e,function(d){var u=d.source,f=d.target,h=Gg(d),g=sc(n),p={};Zt(c,u)&&Zt(c,f)?(h=k.map(h,function(m){return cc(m,a,n)&&(m[g]=m[g]+t[g]),m.original&&cc(m.original,a,n)&&(m.original[g]=m.original[g]+t[g]),m}),s._modeling.updateWaypoints(d,h,{labelBehavior:!1})):(Zt(c,u)||Zt(c,f))&&(Zt(i,u)?p.connectionStart=wi(d,u,t):Zt(i,f)?p.connectionEnd=Ci(d,f,t):Zt(r,u)?p.connectionStart=bi(d,u,l[u.id]):Zt(r,f)&&(p.connectionEnd=vi(d,f,l[f.id])),s._modeling.layoutConnection(d,p))})};function lc(e){return k.assign({},e)}function Gg(e){return k.map(e.waypoints,function(t){return t=lc(t),t.original&&(t.original=lc(t.original)),t})}function sc(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function cc(e,t,n){var a=sc(n);if(/e|s/.test(n))return e[a]>t;if(/n|w/.test(n))return e[a]<t}function Zt(e,t){return e.indexOf(t)!==-1}function Kg(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function oa(e){this._modeling=e}oa.$inject=["modeling"],oa.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=dc(n),t.collapsed=!t.collapsed;var a=uc(n,t.collapsed);return[t].concat(a)},oa.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,a=t.children,i=fc(a,n);return t.collapsed=!t.collapsed,[t].concat(i)};function dc(e){var t={};return k.forEach(e,function(n){t[n.id]=n.hidden,n.children&&(t=k.assign({},t,dc(n.children)))}),t}function uc(e,t){var n=[];return k.forEach(e,function(a){a.hidden=t,n=n.concat(a),a.children&&(n=n.concat(uc(a.children,a.collapsed||t)))}),n}function fc(e,t){var n=[];return k.forEach(e,function(a){a.hidden=t[a.id],n=n.concat(a),a.children&&(n=n.concat(fc(a.children,t)))}),n}function aa(e){this._modeling=e}aa.$inject=["modeling"],aa.prototype.execute=function(e){var t=e.shape,n=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=hc(a,t),pc(n,t),t.host=n,t},aa.prototype.revert=function(e){var t=e.shape,n=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,hc(n,t),pc(a,t,i),t};function hc(e,t){return Jo(e&&e.attachers,t)}function pc(e,t,n){if(e){var a=e.attachers;a||(e.attachers=a=[]),Gt(a,t,n)}}function ki(){}ki.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ki.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function _e(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var a=this;e.on("diagram.init",function(){a.registerHandlers(n)})}_e.$inject=["eventBus","elementFactory","commandStack"],_e.prototype.getHandlers=function(){return{"shape.append":Ko,"shape.create":qt,"shape.delete":mo,"shape.move":bn,"shape.resize":vo,"shape.replace":It,"shape.toggleCollapse":oa,spaceTool:Xt,"label.create":po,"connection.create":qo,"connection.delete":go,"connection.move":yi,"connection.layout":Qo,"connection.updateWaypoints":ki,"connection.reconnect":bo,"elements.create":gi,"elements.move":na,"elements.delete":mi,"elements.distribute":Zo,"elements.align":Go,"element.updateAttachment":aa}},_e.prototype.registerHandlers=function(e){k.forEach(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},_e.prototype.moveShape=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},_e.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},_e.prototype.moveElements=function(e,t,n,a){a=a||{};var i=a.attach,r=n,l;i===!0?(l=n,r=n.parent):i===!1&&(l=null);var s={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},_e.prototype.moveConnection=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},_e.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},_e.prototype.createConnection=function(e,t,n,a,i,r){typeof n=="object"&&(r=i,i=a,a=n,n=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:n,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},_e.prototype.createShape=function(e,t,n,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,s;e=this._create("shape",e),r?(l=n.parent,s=n):l=n;var c={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape},_e.prototype.createElements=function(e,t,n,a,i){k.isArray(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:n,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},_e.prototype.createLabel=function(e,t,n,a){n=this._create("label",n);var i={labelTarget:e,position:t,parent:a||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},_e.prototype.appendShape=function(e,t,n,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:n,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},_e.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},_e.prototype.distributeElements=function(e,t,n){var a={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",a)},_e.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},_e.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},_e.prototype.replaceShape=function(e,t,n){var a={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",a),a.newShape},_e.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},_e.prototype.resizeShape=function(e,t,n,a){var i={shape:e,newBounds:t,minBounds:n,hints:a};this._commandStack.execute("shape.resize",i)},_e.prototype.createSpace=function(e,t,n,a,i){var r={delta:n,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},_e.prototype.updateWaypoints=function(e,t,n){var a={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",a)},_e.prototype.reconnect=function(e,t,n,a,i){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},_e.prototype.reconnectStart=function(e,t,n,a){a||(a={}),this.reconnect(e,t,e.target,n,k.assign(a,{docking:"source"}))},_e.prototype.reconnectEnd=function(e,t,n,a){a||(a={}),this.reconnect(e,e.source,t,n,k.assign(a,{docking:"target"}))},_e.prototype.connect=function(e,t,n,a){return this.createConnection(e,t,n||{},e.parent,a)},_e.prototype._create=function(e,t){return Og(t)?t:this._elementFactory.create(e,t)},_e.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function gc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ei(e,t){if(!e||!t||!Array.isArray(t))return!1;const n=e.type||e.businessObject&&e.businessObject.type;return t.includes(n)}function qg(e,t){Array.isArray(e)&&e.forEach(t)}function ia(e){const t=e.businessObject;if(t)return t.name||""}function Xg(e,t){const n=e.businessObject;return n.name=t,e}const Zg={height:20},mc=15;function Si(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function yc(e){return Co(e.label)}function Qg(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=em(e),r=Math.atan((a.y-n.y)/(a.x-n.x));let{x:l,y:s}=i;return Math.abs(r)<Math.PI/2?s-=mc:l+=mc,{x:l,y:s}}function em(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:n.x+(a.x-n.x)/2,y:n.y+(a.y-n.y)/2}}function bc(e){return e.waypoints?Qg(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Zg.height/2}}function Co(e){return e&&!!e.labelTarget}const tm={width:0,height:0};function vc(e,t){function n(s,c){const d=s.label||s,u=s.labelTarget||s;return Xg(d,c),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!Co(c)&&Si(c)&&!yc(c)&&!wc(d)){let h=bc(c);h={x:h.x,y:h.y+7},e.createLabel(c,h,{id:u.id+"_label",businessObject:u})}}function i(s){return s.oldLabel=ia(s.element),n(s.element,s.newLabel)}function r(s){return n(s.element,s.oldLabel)}function l(s){const{element:c,newLabel:d}=s,u=c.label||c,f=s.hints||{};let{newBounds:h}=s;if(!Co(u))return;if(Co(u)&&wc(d)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const g=ia(u);typeof h>"u"&&(h=t.getExternalLabelBounds(u,g)),h&&e.resizeShape(u,h,tm)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}vc.$inject=["modeling","textRenderer"];function wc(e){return!e||!e.trim()}function xo(e,t,n){_e.call(this,e,t,n)}un(xo,_e),xo.$inject=["eventBus","elementFactory","commandStack"],xo.prototype.getHandlers=function(){const e=_e.prototype.getHandlers.call(this);return e["element.updateLabel"]=vc,e},xo.prototype.updateLabel=function(e,t,n,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:a||{}})};function _i(e,t){it.call(this,e);function n(a){const{context:i}=a,r=i.hints||{};let l;!i.cropped&&r.createElementsBehavior!==!1&&(l=i.connection,l.waypoints=t.getCroppedWaypoints(l),i.cropped=!0)}this.executed(["connection.layout","connection.create"],n)}un(_i,it),_i.$inject=["eventBus","connectionDocking"];function Cc(){}Cc.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Je(t.source||e.source),t.connectionEnd||Je(t.target||e.target)]};var ra=20,nm=5,la=Math.round,xc=20,om={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function am(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function im(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function kc(e,t,n){var a=Jt(t,e,nm),i=n.split(":")[0],r=la((t.x-e.x)/2+e.x),l=la((t.y-e.y)/2+e.y),s,c,d=im(i,a),u=/h|r|l/.test(i),f=!1,h=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:l},c=u?"h:h":"v:v"):(f=am(a,i),c=u?"h:v":"v:h",f?u?(h=l===e.y,s={x:e.x+ra*(/l/.test(i)?-1:1),y:h?l+ra:l}):(h=r===e.x,s={x:h?r+ra:r,y:e.y+ra*(/t/.test(i)?-1:1)}):s={x:r,y:l}),{waypoints:Ri(e,s,c).concat(s),directions:c,turnNextDirections:h}}function rm(e,t,n){return kc(e,t,n)}function lm(e,t,n){var a=kc(t,e,Ec(n));return{waypoints:a.waypoints.slice().reverse(),directions:Ec(a.directions),turnNextDirections:a.turnNextDirections}}function sm(e,t){var n=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=n+":"+a,r=Ri(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:r,directions:i}}function Ec(e){return e.split(":").reverse().join(":")}function cm(e,t,n){var a=la((t.x-e.x)/2+e.x),i=la((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(n==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Ri(e,t,n){if(n=n||"h:h",!bm(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(_c(n)){var a=rm(e,t,n),i=lm(e,t,n),r=sm(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return cm(e,t,n)}function dm(e,t,n){var a=Ri(e,t,n);return a.unshift(e),a.push(t),Bc(a)}function um(e,t,n,a,i){var r=i&&i.preferredLayouts||[],l=k.without(r,"straight")[0]||"h:h",s=om[l]||0,c=Jt(e,t,s),d=ym(c,l);n=n||Je(e),a=a||Je(t);var u=d.split(":"),f=Rc(n,e,u[0],vm(c)),h=Rc(a,t,u[1],c);return dm(f,h,d)}function fm(e,t,n,a,i,r){k.isArray(n)&&(i=n,r=a,n=Je(e),a=Je(t)),r=k.assign({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts,s=l.indexOf("straight")!==-1,c;return c=s&&pm(e,t,n,a,r),c||(c=r.connectionEnd&&mm(t,e,a,i),c)||(c=r.connectionStart&&gm(e,t,n,i),c)?c:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:um(e,t,n,a,r)}function hm(e,t,n){return e>=t&&e<=n}function Sc(e,t,n){var a={x:"width",y:"height"};return hm(t[e],n[e],n[e]+n[a[e]])}function pm(e,t,n,a,i){var r={},l,s;return s=Jt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),i.preserveDocking==="target"?Sc(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:a.x,y:a.y}]):null:Sc(l,n,t)?(r[l]=n[l],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y,original:{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y}}]):null):null}function gm(e,t,n,a){return Bi(e,t,n,a)}function mm(e,t,n,a){var i=a.slice().reverse();return i=Bi(e,t,n,i),i?i.reverse():null}function Bi(e,t,n,a){function i(u){return u.length<3?!0:u.length>4?!1:!!k.find(u,function(f,h){var g=u[h-1];return g&&uo(f,g)<3})}function r(u,f,h){var g=Wt(f,u);switch(g){case"v":return{x:h.x,y:u.y};case"h":return{x:u.x,y:h.y}}return{x:u.x,y:u.y}}function l(u,f,h){var g;for(g=u.length-2;g!==0;g--)if(Cs(u[g],f,xc)||Cs(u[g],h,xc))return u.slice(g);return u}if(i(a))return null;var s=a[0],c=a.slice(),d;return c[0]=n,c[1]=r(c[1],s,n),d=l(c,e,t),d!==c&&(c=Bi(e,t,n,d)),c&&Wt(c)?null:c}function ym(e,t){if(_c(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 bm(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function _c(e){return e&&/t|r|b|l/.test(e)}function vm(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 Rc(e,t,n,a){if(n==="h"&&(n=/left/.test(a)?"l":"r"),n==="v"&&(n=/top/.test(a)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Bc(e){return e.reduce(function(t,n,a){var i=t[t.length-1],r=e[a+1];return oi(i,r,n,0)||t.push(n),t},[])}function Ti(){}un(Ti,Cc);const vn=(e,t)=>e.type===t;Ti.prototype.layoutConnection=function(e,t){t||(t={});const n=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,s,c;return l===void 0&&(r=sa(i&&i[0],n),l=sa(i&&i[i.length-1],a)),r||(r=sa(i&&i[0],n)),l||(l=sa(i&&i[i.length-1],a)),vn(e,"myline")&&(n===a?s={preferredLayouts:wm(n,e)}:vn(n,"gatewayAnd")||vn(n,"gatewayXor")||vn(n,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:vn(a,"gatewayAnd")||vn(a,"gatewayXor")||vn(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Fe(s,t),c=Bc(fm(n,a,r,l,i,s))),c||[r,l]};function sa(e,t){return e?e.original||e:Je(t)}function wm(e,t){const{waypoints:n}=t,a=n&&n.length&&Jt(n[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Tc(e){return k.assign({original:e.point.original||e.point},e.actual)}function Qt(e,t){this._elementRegistry=e,this._graphicsFactory=t}Qt.$inject=["elementRegistry","graphicsFactory"],Qt.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(Tc(a)),r.push(Tc(i)),r},Qt.prototype.getDockingPoint=function(e,t,n){var a=e.waypoints,i,r,l;return i=n?0:a.length-1,r=a[i],l=this._getIntersection(t,e,n),{point:r,actual:l||r,idx:i}},Qt.prototype._getIntersection=function(e,t,n){var a=this._getShapePath(e),i=this._getConnectionPath(t);return li(a,i,n)},Qt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Qt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Qt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Mc={__depends__:[Rg,Pg,Wn],__init__:["modeling","elementUpdater"],modeling:["type",xo],layouter:["type",Ti],elementUpdater:["type",_i],elementFactory:["type",yn],connectionDocking:["type",Qt]};var Cm=1e3;function wn(e,t){var n=this;t=t||Cm,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,s=i.gfx,c=i.attrs;if(n.canRender(l))return r==="render.shape"?n.drawShape(s,l,c):n.drawConnection(s,l,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(n.canRender(i))return a.type==="render.getShapePath"?n.getShapePath(i):n.getConnectionPath(i)})}wn.prototype.canRender=function(e){},wn.prototype.drawShape=function(e,t){},wn.prototype.drawConnection=function(e,t){},wn.prototype.getShapePath=function(e){},wn.prototype.getConnectionPath=function(e){};function xm(e){return e.businessObject}function ca(e,t){return e.businessObject.strokeWidth||t||1}function wt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ge(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function km(e){const t=e.x+e.width/2,n=e.y+e.height/2,a=e.width/2,i=[["M",t,n],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]];return so(i)}function Em(e,t){const{x:n,y:a,width:i,height:r}=e,l=[["M",n+t,a],["l",i-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-i,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return so(l)}function Sm(e){const{x:t,y:n,width:a,height:i}=e,r=a/2,l=i/2,s=[["M",t+r,n],["l",r,l],["l",-r,l],["l",-r,-l],["z"]];return so(s)}function _m(e){const{x:t,y:n,width:a,height:i}=e,r=[["M",t,n],["l",a,0],["l",0,i],["l",-a,0],["z"]];return so(r)}const Mi=10,Pi=.95,en=(e,t)=>e.type===t;function Cn(e,t,n,a,i,r,l){wn.call(this,e,l);const s="var(--j-color-bg-container)",c="var(--j-color-text)",d={};Object.keys(r.palette).forEach(M=>{const R=r.palette[M];d[R.type]=R.options});const{computeStyle:u}=t;function f(M){return O[M]}function h(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2})}function g(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2,fill:"white"})}function p(M,R,V,L){V=h(V);const Q=qa(R,V,L);return j.append(M,Q),Q}function m(M,R,V){return p(M,R,V,5)}function y(M,R,V,L,Q){gc(L)&&(Q=L,L=0),L=L||0,Q=u(Q,{stroke:c,strokeWidth:2,fill:s}),Q.fill==="none"&&delete Q.fillOpacity;const oe=R/2,le=V/2,Ce=j.create("circle");return j.attr(Ce,{cx:oe,cy:le,r:Math.round((R+V)/4-L)}),j.attr(Ce,Q),j.append(M,Ce),Ce}function v(M,R,V,L,Q,oe){gc(Q)&&(oe=Q,Q=0),Q=Q||0,oe=u(oe,{stroke:c,strokeWidth:2,fill:s});const le=j.create("rect");return j.attr(le,{x:Q,y:Q,width:R-Q*2,height:V-Q*2,rx:L,ry:L}),j.attr(le,oe),j.append(M,le),le}function w(M,R,V){V=u(V,["no-fill"],{strokeWidth:2,stroke:c});const L=j.create("path");return j.attr(L,{d:R}),j.attr(L,V),j.append(M,L),L}function C(M,R,V,L){const Q=R/2,oe=V/2,Ce=[{x:Q,y:0},{x:R,y:oe},{x:Q,y:V},{x:0,y:oe}].map(G=>G.x+","+G.y).join(" ");L=u(L,{stroke:c,strokeWidth:2,fill:s});const Ue=j.create("polygon");return j.attr(Ue,{points:Ce}),j.attr(Ue,L),j.append(M,Ue),Ue}function x(M,R,V,L){return w(R,V,Fe({"data-marker":M},L))}function S(M,R,V){V=Fe({size:{width:100}},V);const L=i.createText(R||"",V);return j.classes(L).add("djs-label"),j.append(M,L),L}function b(M,R,V){const L=xm(R);return S(M,L.name,{box:R,align:V,padding:5,style:{fill:Ge(R,c)}})}function _(M,R){const V={width:90,height:30,x:R.width/2+R.x,y:R.height/2+R.y};return S(M,ia(R),{box:V,fitBox:!0,style:Fe({},i.getExternalStyle(),{fill:Ge(R,c)})})}function E(M,R,V){const L=V&&V.indexOf("SubProcessMarker")!==-1;let Q;L?Q={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:Q={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},qg(V,oe=>{f(oe)(M,R,Q)})}function T(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function P(M,R){const{ref:V={x:0,y:0},scale:L=1,element:Q,parentGfx:oe=a._svg}=R,le=j.create("marker",{id:M,viewBox:"0 0 20 20",refX:V.x,refY:V.y,markerWidth:20*L,markerHeight:20*L,orient:"auto"});j.append(le,Q);let Ce=F.query(":scope > defs",oe);Ce||(Ce=j.create("defs"),j.append(oe,Ce)),j.append(Ce,le)}function B(M,R,V,L){const Q=R+"-"+T(V)+"-"+T(L)+"-"+Ys();return H(M,Q,R,V,L),"url(#"+Q+")"}function H(M,R,V,L,Q){{const oe=j.create("path",{d:"M 1 5 L 11 10 L 1 15 Z",...g({fill:Q,stroke:Q,strokeWidth:1})});P(R,{element:oe,ref:{x:11,y:10},scale:.5,parentGfx:M})}}function I(M,R,V,L){const Q=d[R.type]?.icon||R.icon;if(Q){const oe=n.getScaledPath(Q,{abspos:{x:V,y:L}});w(M,oe,{strokeWidth:0,fill:Ge(R,d[R.type]?.iconFill||R.iconFill)})}}const O={event(M,R,V){return"fillOpacity"in V||(V.fillOpacity=Pi),y(M,R.width,R.height,V)},startEvent(M,R){const V={fill:wt(R,d.startEvent?.fill||R.fill),stroke:Ge(R,d.startEvent?.stroke||R.stroke),strokeWidth:ca(R,d.startEvent?.strokeWidth||R.strokeWidth)},L=f("event")(M,R,V);return I(M,R,18,18),L},endEvent(M,R){const V=f("event")(M,R,{strokeWidth:ca(R,d.endEvent?.strokeWidth||R.strokeWidth||4),fill:wt(R,d.endEvent?.fill||R.fill),stroke:Ge(R,d.endEvent?.stroke||R.stroke)});return I(M,R,18,18),V},gateway(M,R){const V={fillOpacity:Pi,strokeWidth:ca(R,d[R.type]?.strokeWidth||R.strokeWidth||4),fill:wt(R,d[R.type]?.fill||R.fill),stroke:Ge(R,d[R.type]?.stroke||R.stroke)};return C(M,R.width,R.height,V)},gatewayAnd(M,R){const V=f("gateway")(M,R),L=n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[R.type]?.width||R.width,containerHeight:d[R.type]?.height||R.height,position:{mx:.47,my:.29}});return w(M,L,{strokeWidth:1,fill:Ge(R,d[R.type]?.iconFill||R.iconFill),stroke:Ge(R,d[R.type]?.iconFill||R.iconFill)}),V},gatewayXor(M,R){const V=f("gateway")(M,R),L=n.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}});return w(M,L,{strokeWidth:1,fill:Ge(R,d[R.type]?.iconFill||R.iconFill),stroke:Ge(R,d[R.type]?.iconFill||R.iconFill)}),V},gatewayInclusive(M,R){const V=f("gateway")(M,R);return y(M,R.width,R.height,R.height*.24,{strokeWidth:2.5,fill:Ge(R,s),stroke:Ge(R,d[R.type]?.iconFill||R.iconFill)}),V},activity(M,R,V){return V=V||{},"fillOpacity"in V||(V.fillOpacity=Pi),v(M,R.width,R.height,Mi,V)},task(M,R){const V={fill:wt(R,s),stroke:Ge(R,c)},L=f("activity")(M,R,V);return b(M,R,"center-middle"),E(M,R),L},userTask(M,R){const V=f("task")(M,R),L=15,Q=12,oe=n.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:L,y:Q}});w(M,oe,{strokeWidth:.5,fill:wt(R,s),stroke:Ge(R,c)});const le=n.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:L,y:Q}});w(M,le,{strokeWidth:.5,fill:wt(R,s),stroke:Ge(R,c)});const Ce=n.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:L,y:Q}});return w(M,Ce,{strokeWidth:.5,fill:Ge(R,c),stroke:Ge(R,c)}),V},scriptTask(M,R){const V=f("task")(M,R),L=n.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return w(M,L,{strokeWidth:1,stroke:Ge(R,c)}),V},SubProcessMarker(M,R){const V=v(M,14,14,0,{strokeWidth:1,fill:wt(R,s),stroke:Ge(R,c)});Rt(V,R.width/2-7.5,R.height-20);const L=n.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2-7.5)/R.width,my:(R.height-20)/R.height}});x("sub-process",M,L,{fill:wt(R,s),stroke:Ge(R,c)})},subprocess(M,R,V){V=Fe({fill:wt(R,s),stroke:Ge(R,c)},V);const L=f("activity")(M,R,V);return b(M,R,"center-middle"),E(M,R,["SubProcessMarker"]),L},label(M,R){return _(M,R)},myline(M,R){const V=wt(R,r.lineStroke||s),L=Ge(R,r.lineStroke||c);return m(M,R.waypoints,{markerEnd:B(M,"sequenceflow-end",V,L),stroke:L})},default(M,R){const V={strokeWidth:ca(R,d[R.type]?.strokeWidth||R.strokeWidth||1),fill:wt(R,d[R.type]?.fill||R.fill),stroke:Ge(R,d[R.type]?.stroke||R.stroke)},L=v(M,R.width,R.height,R.radius||Mi,V);return b(M,R,"center-middle"),E(M,R),I(M,R,R.iconX,R.iconY),L}};this.handlers=O,this._drawPath=w}un(Cn,wn),Cn.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Cn.prototype.canRender=function(){return!0},Cn.prototype.drawShape=function(e,t){const{type:n}=t;return(this.handlers[n]||this.handlers.default)(e,t)},Cn.prototype.drawConnection=function(e,t){const{type:n}=t,a=this.handlers[n];return a(e,t)},Cn.prototype.getShapePath=function(e){return en(e,"startEvent")||en(e,"endEvent")?km(e):en(e,"userTask")||en(e,"scriptTask")||en(e,"subprocess")?Em(e,Mi):en(e,"gatewayAnd")||en(e,"gatewayXor")||en(e,"gatewayInclusive")?Sm(e):_m(e)};var Rm=0,Bm={width:150,height:50};function Tm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Mm(e){return k.isObject(e)?k.assign({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function Pm(e,t){t.textContent=e;var n;try{var a,i=e==="";return t.textContent=i?"dummy":e,n=t.getBBox(),a={width:n.width+n.x*2,height:n.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function jm(e,t,n){for(var a=e.shift(),i=a,r;;){if(r=Pm(i,n),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return Am(e,i,a,r);i=Nm(i,r.width,t)}}function Am(e,t,n,a){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var Pc="";function Vm(e,t){var n=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(n.length>1)for(;a=n.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===Pc)&&i.pop();break}var l=i[i.length-1];return l&&l===Pc&&(i[i.length-1]="-"),i.join("")}function Nm(e,t,n){var a=Math.max(e.length*(n/t),1),i=Vm(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Im(){var e=document.getElementById("helper-svg");return e||(e=j.create("svg"),j.attr(e,{id:"helper-svg"}),F.assignStyle(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function da(e){this._config=k.assign({},{size:Bm,padding:Rm,style:{},align:"center-top"},e||{})}da.prototype.createText=function(e,t){return this.layoutText(e,t).element},da.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},da.prototype.layoutText=function(e,t){var n=k.assign({},this._config.size,t.box),a=k.assign({},this._config.style,t.style),i=Tm(t.align||this._config.align),r=Mm(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Hm(a),c=e.split(/\u00AD?\r?\n/),d=[],u=n.width-r.left-r.right,f=j.create("text");j.attr(f,{x:0,y:0}),j.attr(f,a);var h=Im();for(j.append(h,f);c.length;)d.push(jm(c,u,f));i.vertical==="middle"&&(r.top=r.bottom=0);var g=k.reduce(d,function(w,C,x){return w+(s||C.height)},0)+r.top+r.bottom,p=k.reduce(d,function(w,C,x){return C.width>w?C.width:w},0),m=r.top;i.vertical==="middle"&&(m+=(n.height-g)/2),m-=(s||d[0].height)/4;var y=j.create("text");j.attr(y,a),k.forEach(d,function(w){var C;switch(m+=s||w.height,i.horizontal){case"left":C=r.left;break;case"right":C=(l?p:u)-r.right-w.width;break;default:C=Math.max(((l?p:u)-w.width)/2+r.left,0)}var x=j.create("tspan");j.attr(x,{x:C,y:m}),x.textContent=w.text,j.append(y,x)}),j.remove(f);var v={width:p,height:g};return{dimensions:v,element:y}};function Hm(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const Om=12,Lm=1.2,zm=30;function jc(e){const t=Fe({fontFamily:"Arial, sans-serif",fontSize:Om,fontWeight:"normal",lineHeight:Lm},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,a=Fe({},t,{fontSize:n},e&&e.externalStyle||{}),i=new da({style:t});this.getExternalLabelBounds=function(r,l){const s=i.getDimensions(l,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:a});return{x:Math.round(r.x+r.width/2-s.width/2),y:Math.round(r.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(r,l){const s=i.getDimensions(l,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(zm,Math.round(s.height))}},this.createText=function(r,l){return i.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return a}}jc.$inject=["config.textRenderer"];function $m(){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,n){let a,i;n.abspos?(a=n.abspos.x,i=n.abspos.y):(a=n.containerWidth*n.position.mx,i=n.containerHeight*n.position.my);let r={};typeof t=="object"?(r=t,r.d.indexOf("{mx},{my}")===-1&&(r.d="m {mx},{my}"+r.d),r.width&&(a-=r.width/2),r.height&&(i-=r.height/2)):r=this.pathMap[t];const l={};if(n.position){const c=n.containerHeight/r.height*n.yScaleFactor,d=n.containerWidth/r.width*n.xScaleFactor;for(let u=0;u<r.heightElements.length;u++)l["y"+u]=r.heightElements[u]*c;for(let u=0;u<r.widthElements.length;u++)l["x"+u]=r.widthElements[u]*d}return Dm(r.d,{mx:a,my:i,e:l})}}const Fm=/\{([^}]+)\}/g,Wm=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Um(e,t,n){let a=n;return t.replace(Wm,(i,r,l,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===n?e:a)+"",a}function Dm(e,t){return String(e).replace(Fm,(n,a)=>Um(n,a,t))}const Ac={__init__:["myRenderer"],myRenderer:["type",Cn],textRenderer:["type",jc],pathMap:["type",$m]};function Vc(e,t){return Fe({id:e.id,type:e.type,businessObject:e},t)}function Ym(e,t,n){const a=e.waypoint;return!a||a.length<2?[Je(t),Je(n)]:a.map(i=>({x:i.x,y:i.y}))}function tn(e,t,n,a,i,r){this._eventBus=e,this._canvas=n,this._elementFactory=a,this._elementRegistry=i,this._translate=Js,this._textRenderer=r,this._modeling=t}tn.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],tn.prototype.add=function(e){let t;const{label:n}=e;if(n&&(n.id=e.id,n.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(Vc(e,{source:a,target:i,waypoints:Ym(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(Vc(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return n&&t&&this.addLabel(n,t),t},tn.prototype.addLabel=function(e,t){const n=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(n,t.parent)},tn.prototype.update=function(e,t){const n=this._elementRegistry.get(e);n.businessObject=Fe(n.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(n),this._canvas.addConnection(n,n.parent)):(this._canvas.removeShape(n),this._canvas.addShape(n,n.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=n.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,n.parent);else{const{name:i}=t;if(i&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const r={x:t.x+12,y:t.y+42,width:10,height:10,name:i,id:e},l=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,l,{width:0,height:0}),n&&this.addLabel(r,n)}}},tn.prototype._getSource=function(e){return this._getElement(e.from)},tn.prototype._getTarget=function(e){return this._getElement(e.to)},tn.prototype._getElement=function(e){return this._elementRegistry.get(e)};const Nc={myImporter:["type",tn]},Ic=e=>{const t=[];return e.forEach(n=>{if(n.type!==void 0){const a=n.businessObject;if(n.type==="myline")n.source&&n.target&&(a.from=n.source.id,a.to=n.target.id,a.waypoint=n.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(n.type!=="label")a.x=n.x,a.y=n.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:n.x,y:n.y,height:n.height,width:n.width})}}}),t},Hc=(e,t)=>{const n=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{n.add(r)}),i.forEach(r=>{n.add(r)})},Jm=o.defineComponent({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=o.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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const b=s.get("eventBus");b.on("element.dblclick",_=>{i("elementDblclick",_.element.businessObject)}),b.on("element.click",_=>{i("elementClick",_.element.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let b={__init__:["myOptions"],myOptions:["type",f]};s=new rr({canvas:{container:r.value},modules:[ci,ws,Mc,zs,Ws,b,Ac,Nc]});const _=s.get("canvas"),E=s.get("elementFactory");d();const T=E.createRoot();_.setRootElement(T),u()};o.onMounted(()=>{h()});const g=b=>{const _=b==null?1:c+b;s.get("canvas").zoom(_),c=_},p=()=>{s.get("canvas").zoom(1);const b=s.get("elementRegistry").getAll();var _=Ic(b);return _},m=b=>{s.clear(),d(),Hc(b,s)},y=b=>{s.get("myImporter").update(b.id,b)};return t({reset:()=>{d()},zoom:b=>{g(b)},getData:()=>p(),setData:b=>{m(b)},updateElemet:b=>{y(b)}}),(b,_)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}});function ji(e){return e&&e[e.length-1]}function Oc(e){return e.y}function Lc(e){return e.x}var Gm={left:Lc,center:Lc,right:function(e){return e.x+e.width},top:Oc,middle:Oc,bottom:function(e){return e.y+e.height}};function qn(e,t){this._modeling=e,this._rules=t}qn.$inject=["modeling","rules"],qn.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",a="width";return t.indexOf(e)!==-1&&(n="y",a="height"),{axis:n,dimension:a}},qn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},qn.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),a=n.axis,i=n.dimension,r={},l={},s=!1,c,d,u;function f(h,g){return Math.round((h[a]+g[a]+g[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ji(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if(k.forEach(t,function(h){var g=h[a]+Math.round(h[i]/2);l[g]?l[g].elements.push(h):l[g]={elements:[h],center:g}}),c=k.sortBy(l,function(h){return h.elements.length>1&&(s=!0),h.elements.length}),s)return r[e]=ji(c).center,r;d=t[0],t=k.sortBy(t,function(h){return h[a]+h[i]}),u=ji(t),r[e]=f(d,u)}return r},qn.prototype.trigger=function(e,t){var n=this._modeling,a,i=k.filter(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),k.isArray(a)&&(i=a),!(i.length<2||!a)){var r=Gm[t],l=k.sortBy(i,r),s=this._alignmentPosition(t,l);n.alignElements(l,s)}};const Km={__init__:["alignElements"],alignElements:["type",qn]};var ua=Math.round,qm=Math.max;function Xm(e,t){var n=e.x,a=e.y;return[["M",n,a],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function Zm(e){var t=[];return e.forEach(function(n,a){t.push([a===0?"M":"L",n.x,n.y])}),t}var zc=10;function Qm(e,t){var n,a;for(n=0;a=e[n];n++)if(uo(a,t)<=zc)return{point:e[n],bendpoint:!0,index:n};return null}function ey(e,t){var n=Ts(Xm(t,zc),Zm(e)),a=n[0],i=n[n.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=qm(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:ua(a.x+i.x)/2,y:ua(a.y+i.y)/2},index:a.segment2}:{point:{x:ua(a.x),y:ua(a.y)},index:a.segment2}:null}function ty(e,t){return Qm(e,t)||ey(e,t)}function ny(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function oy(e,t,n){var a=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-i/r}function $c(e,t){var n=t[0],a=t[1],i={x:a.x-n.x,y:a.y-n.y},r=oy([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+r*i.x,y:n.y+r*i.y}}function ay(e,t){var n=$c(e,t),a={x:n.x-e.x,y:n.y-e.y};return ny(a)}var Fc="djs-bendpoint",Wc="djs-segment-dragger";function iy(e,t){var n=$n(t),a=e._container.getBoundingClientRect(),i;i={x:a.left,y:a.top};var r=e.viewbox();return{x:r.x+(n.x-i.x)/r.scale,y:r.y+(n.y-i.y)/r.scale}}function Ai(e,t,n){var a=iy(e,n),i=ty(t,a);return i}function Vi(e,t){var n=j.create("g");j.classes(n).add(Fc),j.append(e,n);var a=j.create("circle");j.attr(a,{cx:0,cy:0,r:4}),j.classes(a).add("djs-visual"),j.append(n,a);var i=j.create("circle");return j.attr(i,{cx:0,cy:0,r:10}),j.classes(i).add("djs-hit"),j.append(n,i),t&&j.classes(n).add(t),n}function ry(e,t,n,a){var i=j.create("g");j.append(e,i);var r=18,l=6,s=11,c=sy(t,n,a),d=l+s,u=j.create("rect");j.attr(u,{x:-r/2,y:-l/2,width:r,height:l}),j.classes(u).add("djs-visual"),j.append(i,u);var f=j.create("rect");return j.attr(f,{x:-c/2,y:-d/2,width:c,height:d}),j.classes(f).add("djs-hit"),j.append(i,f),Jp(i,a==="v"?90:0),i}function Uc(e,t,n){var a=j.create("g"),i=ai(t,n),r=Wt(t,n);return j.append(e,a),ry(a,t,n,r),j.classes(a).add(Wc),j.classes(a).add(r==="h"?"horizontal":"vertical"),Rt(a,i.x,i.y),a}function Ni(e){return Math.abs(Math.round(e*2/3))}function ly(e,t){var n=cy(e,t);return $c(e,n)}function sy(e,t,n){var a=t.x-e.x,i=t.y-e.y;return Ni(n==="h"?a:i)}function cy(e,t){for(var n=t.waypoints,a=1/0,i,r=0;r<n.length-1;r++){var l=n[r],s=n[r+1],c=ay(e,[l,s]);c<a&&(a=c,i=r)}return[n[i],n[i+1]]}function Ii(e){return CSS.escape(e)}function Dc(e,t,n,a,i){function r(C,x,S){var b=C.index,_=C.point,E,T,P,B,H,I;return b<=0||C.bendpoint?!1:(E=x[b-1],T=x[b],P=ai(E,T),B=Wt(E,T),H=Math.abs(_.x-P.x),I=Math.abs(_.y-P.y),B&&H<=S&&I<=S)}function l(C,x){var S=C.waypoints,b,_,E,T;return x.index<=0||x.bendpoint||(b={start:S[x.index-1],end:S[x.index]},_=Wt(b.start,b.end),!_)?null:(_==="h"?E=b.end.x-b.start.x:E=b.end.y-b.start.y,T=Ni(E)/2,T)}function s(C,x){var S=x.waypoints,b=Ai(t,S,C),_;if(b)return _=l(x,b),r(b,S,_)?i.start(C,x,b.index):a.start(C,x,b.index,!b.bendpoint),!0}function c(C,x,S){F.event.bind(C,x,function(b){n.triggerMouseEvent(x,b,S),b.stopPropagation()})}function d(C,x){var S=t.getLayer("overlays"),b=F.query('.djs-bendpoints[data-element-id="'+Ii(C.id)+'"]',S);return!b&&x&&(b=j.create("g"),j.attr(b,{"data-element-id":C.id}),j.classes(b).add("djs-bendpoints"),j.append(S,b),c(b,"mousedown",C),c(b,"click",C),c(b,"dblclick",C)),b}function u(C,x){return F.query('.djs-segment-dragger[data-segment-idx="'+C+'"]',x)}function f(C,x){x.waypoints.forEach(function(S,b){var _=Vi(C);j.append(C,_),Rt(_,S.x,S.y)}),Vi(C,"floating")}function h(C,x){for(var S=x.waypoints,b,_,E,T=1;T<S.length;T++)b=S[T-1],_=S[T],Wt(b,_)&&(E=Uc(C,b,_),j.attr(E,{"data-segment-idx":T}),c(E,"mousemove",x))}function g(C){k.forEach(F.queryAll("."+Fc,C),function(x){j.remove(x)})}function p(C){k.forEach(F.queryAll("."+Wc,C),function(x){j.remove(x)})}function m(C){var x=d(C);return x||(x=d(C,!0),f(x,C),h(x,C)),x}function y(C){var x=d(C);x&&(p(x),g(x),h(x,C),f(x,C))}function v(C,x){var S=F.query(".floating",C),b=x.point;S&&Rt(S,b.x,b.y)}function w(C,x,S){var b=u(x.index,C),_=S[x.index-1],E=S[x.index],T=x.point,P=ai(_,E),B=Wt(_,E),H,I;b&&(H=dy(b),I={x:T.x-P.x,y:T.y-P.y},B==="v"&&(I={x:I.y,y:I.x}),Rt(H,I.x,I.y))}e.on("connection.changed",function(C){y(C.element)}),e.on("connection.remove",function(C){var x=d(C.element);x&&j.remove(x)}),e.on("element.marker.update",function(C){var x=C.element,S;x.waypoints&&(S=m(x),C.add?j.classes(S).add(C.marker):j.classes(S).remove(C.marker))}),e.on("element.mousemove",function(C){var x=C.element,S=x.waypoints,b,_;if(S){if(b=d(x,!0),_=Ai(t,S,C.originalEvent),!_)return;v(b,_),_.bendpoint||w(b,_,S)}}),e.on("element.mousedown",function(C){if($t(C)){var x=C.originalEvent,S=C.element;if(S.waypoints)return s(x,S)}}),e.on("selection.changed",function(C){var x=C.newSelection,S=x[0];S&&S.waypoints&&m(S)}),e.on("element.hover",function(C){var x=C.element;x.waypoints&&(m(x),n.registerEvent(C.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(C){n.unregisterEvent(C.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(C){var x=C.element,S=C.newId;if(x.waypoints){var b=d(x);b&&j.attr(b,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}Dc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function dy(e){return F.query(".djs-visual",e)}var Yc=Math.round,xn="reconnectStart",kn="reconnectEnd",ko="updateWaypoints";function Hi(e,t,n,a,i,r){this._injector=e,this.start=function(l,s,c,d){var u=n.getGraphics(s),f=s.source,h=s.target,g=s.waypoints,p;!d&&c===0?p=xn:!d&&c===g.length-1?p=kn:p=ko;var m=p===ko?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(m,{connection:s,source:f,target:h});y===!1&&(y=i.allowed(m,{connection:s,source:h,target:f})),y!==!1&&a.init(l,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:h,insert:d,type:p}}})},t.on("bendpoint.move.hover",function(l){var s=l.context,c=s.connection,d=c.source,u=c.target,f=l.hover,h=s.type;s.hover=f;var g;if(f){var p=h===ko?"connection.updateWaypoints":"connection.reconnect";if(g=s.allowed=i.allowed(p,{connection:c,source:h===xn?f:d,target:h===kn?f:u}),g){s.source=h===xn?f:d,s.target=h===kn?f:u;return}g===!1&&(g=s.allowed=i.allowed(p,{connection:c,source:h===kn?f:u,target:h===xn?f:d})),g&&(s.source=h===kn?f:u,s.target=h===xn?f:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==ko&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.context,c=s.allowed,d=s.bendpointIndex,u=s.connection,f=s.insert,h=u.waypoints.slice(),g=s.source,p=s.target,m=s.type,y=s.hints||{},v={x:Yc(l.x),y:Yc(l.y)};if(!c)return!1;m===ko?(f?h.splice(d,0,v):h[d]=v,y.bendpointMove={insert:f,bendpointIndex:d},h=this.cropWaypoints(u,h),r.updateWaypoints(u,yg(h),y)):(m===xn?(y.docking="source",fa(s)&&(y.docking="target",y.newWaypoints=h.reverse())):m===kn&&(y.docking="target",fa(s)&&(y.docking="source",y.newWaypoints=h.reverse())),r.reconnect(u,g,p,v,y))},this)}Hi.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Hi.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function fa(e){var t=e.hover,n=e.source,a=e.target,i=e.type;if(i===xn)return t&&a&&t===a&&n!==a;if(i===kn)return t&&n&&t===n&&n!==a}var uy="reconnectStart",fy="reconnectEnd",Jc="updateWaypoints",Eo="connect-ok",ha="connect-not-ok",Gc="connect-hover",Kc="djs-updating",qc="djs-dragging",Xc=1100;function Zc(e,t,n,a){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var l=r.context,s=l.bendpointIndex,c=l.connection,d=l.insert,u=c.waypoints,f=u.slice();l.waypoints=u,d&&f.splice(s,0,{x:r.x,y:r.y}),c.waypoints=f;var h=l.draggerGfx=Vi(a.getLayer("overlays"));j.classes(h).add("djs-dragging"),a.addMarker(c,qc),a.addMarker(c,Kc)}),n.on("bendpoint.move.hover",function(r){var l=r.context,s=l.allowed,c=l.hover,d=l.type;if(c){if(a.addMarker(c,Gc),d===Jc)return;s?(a.removeMarker(c,ha),a.addMarker(c,Eo)):s===!1&&(a.removeMarker(c,Eo),a.addMarker(c,ha))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Xc,function(r){var l=r.context,s=l.hover,c=l.target;s&&(a.removeMarker(s,Gc),a.removeMarker(s,c?Eo:ha))}),n.on("bendpoint.move.move",function(r){var l=r.context,s=l.allowed,c=l.bendpointIndex,d=l.draggerGfx,u=l.hover,f=l.type,h=l.connection,g=h.source,p=h.target,m=h.waypoints.slice(),y={x:r.x,y:r.y},v=l.hints||{},w={};i&&(v.connectionStart&&(w.connectionStart=v.connectionStart),v.connectionEnd&&(w.connectionEnd=v.connectionEnd),f===uy?fa(l)?(w.connectionEnd=w.connectionEnd||y,w.source=p,w.target=u||g,m=m.reverse()):(w.connectionStart=w.connectionStart||y,w.source=u||g,w.target=p):f===fy?fa(l)?(w.connectionStart=w.connectionStart||y,w.source=u||p,w.target=g,m=m.reverse()):(w.connectionEnd=w.connectionEnd||y,w.source=g,w.target=u||p):(w.noCropping=!0,w.noLayout=!0,m[c]=y),f===Jc&&(m=e.cropWaypoints(h,m)),w.waypoints=m,i.drawPreview(l,s,w)),Rt(d,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Xc,function(r){var l=r.context,s=l.connection,c=l.draggerGfx,d=l.hover,u=l.target,f=l.waypoints;s.waypoints=f,j.remove(c),a.removeMarker(s,Kc),a.removeMarker(s,qc),d&&(a.removeMarker(d,Eo),a.removeMarker(d,u?Eo:ha)),i&&i.cleanUp(l)})}Zc.$inject=["bendpointMove","injector","eventBus","canvas"];var Qc="connect-hover",ed="djs-updating";function td(e,t,n){return Oi(e,t,e[t]+n)}function Oi(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function hy(e,t,n,a){var i=Math.max(t[a],n[a]),r=Math.min(t[a],n[a]),l=20,s=Math.min(Math.max(r+l,e[a]),i-l);return Oi(t,a,s)}function nd(e){return e==="x"?"y":"x"}function od(e,t,n){var a,i;return e.original?e.original:(a=Je(t),i=nd(n),Oi(e,i,a[i]))}function ad(e,t,n,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(f,h,g){var p,m=n.getGraphics(h),y=g-1,v=g,w=h.waypoints,C=w[y],x=w[v],S=Ai(n,w,f),b,_,E;b=Wt(C,x),b&&(_=b==="v"?"x":"y",y===0&&(C=od(C,h.source,_)),v===w.length-1&&(x=od(x,h.target,_)),S?E=S.point:E={x:(C.x+x.x)/2,y:(C.y+x.y)/2},p={connection:h,segmentStartIndex:y,segmentEndIndex:v,segmentStart:C,segmentEnd:x,axis:_,dragPosition:E},a.init(f,E,"connectionSegment.move",{cursor:_==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:m,context:p}}))};function s(f,h){if(!l)return h;var g=f.waypoints,p;return f.waypoints=h,p=l.getCroppedWaypoints(f),f.waypoints=g,p}function c(f){i.update("connection",f.connection,f.connectionGfx)}function d(f,h,g){var p=f.newWaypoints,m=f.segmentStartIndex+h,y=p[m],v=f.segmentEndIndex+h,w=p[v],C=nd(f.axis),x=hy(g,y,w,C);Rt(f.draggerGfx,x.x,x.y)}function u(f,h){var g=0,p=f.filter(function(m,y){return oi(f[y-1],f[y+1],m)?(g=y<=h?g-1:g,!1):!0});return{waypoints:p,segmentOffset:g}}t.on("connectionSegment.move.start",function(f){var h=f.context,g=f.connection,p=n.getLayer("overlays");h.originalWaypoints=g.waypoints.slice(),h.draggerGfx=Uc(p,h.segmentStart,h.segmentEnd),j.classes(h.draggerGfx).add("djs-dragging"),n.addMarker(g,ed)}),t.on("connectionSegment.move.move",function(f){var h=f.context,g=h.connection,p=h.segmentStartIndex,m=h.segmentEndIndex,y=h.segmentStart,v=h.segmentEnd,w=h.axis,C=h.originalWaypoints.slice(),x=td(y,w,f["d"+w]),S=td(v,w,f["d"+w]),b=C.length,_=0;C[p]=x,C[m]=S;var E,T;p<2&&(E=Jt(g.source,x),p===1?E==="intersect"&&(C.shift(),C[0]=x,_--):E!=="intersect"&&(C.unshift(y),_++)),m>b-3&&(T=Jt(g.target,S),m===b-2?T==="intersect"&&(C.pop(),C[C.length-1]=S):T!=="intersect"&&C.push(v)),h.newWaypoints=g.waypoints=s(g,C),d(h,_,f),h.newSegmentStartIndex=p+_,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,Qc)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var h=f.context.hover;h&&n.removeMarker(h,Qc)}),t.on("connectionSegment.move.cleanup",function(f){var h=f.context,g=h.connection;h.draggerGfx&&j.remove(h.draggerGfx),n.removeMarker(g,ed)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var h=f.context,g=h.connection;g.waypoints=h.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var h=f.context,g=h.connection,p=h.newWaypoints,m=h.newSegmentStartIndex;p=p.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var y=u(p,m),v=y.waypoints,w=s(g,v),C=y.segmentOffset,x={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:m+C}};r.updateWaypoints(g,w,x)})}ad.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var py=Math.abs,id=Math.round;function gy(e,t,n){n=n===void 0?10:n;var a,i;for(a=0;a<t.length;a++)if(i=t[a],py(i-e)<=n)return i}function my(e){return{x:e.x,y:e.y}}function yy(e){return{x:e.x+e.width,y:e.y+e.height}}function Xn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:id(e.x+e.width/2),y:id(e.y+e.height/2)}}function pa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Ht(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,a=n-i,e[t]+=a,e["d"+t]+=a),i}function rd(e){return e.children||[]}var by=Math.abs,ld=Math.round,Li=10;function sd(e){function t(r,l){if(k.isArray(r)){for(var s=r.length;s--;)if(by(r[s]-l)<=Li)return r[s]}else{r=+r;var c=l%r;if(c<Li)return l-c;if(c>r-Li)return l-c+r}return l}function n(r,l){if(r.waypoints)return ly(l,r);if(r.width)return{x:ld(r.width/2+r.x),y:ld(r.height/2+r.y)}}function a(r){var l=r.context,s=l.snapPoints,c=l.connection,d=c.waypoints,u=l.segmentStart,f=l.segmentStartIndex,h=l.segmentEnd,g=l.segmentEndIndex,p=l.axis;if(s)return s;var m=[d[f-1],u,h,d[g+1]];return f<2&&m.unshift(n(c.source,r)),g>d.length-3&&m.unshift(n(c.target,r)),l.snapPoints=s={horizontal:[],vertical:[]},k.forEach(m,function(y){y&&(y=y.original||y,p==="y"&&s.horizontal.push(y.y),p==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var l=a(r),s=r.x,c=r.y,d,u;if(l){d=t(l.vertical,s),u=t(l.horizontal,c);var f=s-d,h=c-u;k.assign(r,{dx:r.dx-f,dy:r.dy-h,x:d,y:u}),(f||l.vertical.indexOf(s)!==-1)&&Ht(r,"x",d),(h||l.horizontal.indexOf(c)!==-1)&&Ht(r,"y",u)}});function i(r){var l=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(l)return l;var d=[s[c-1],s[c+1]];return r.snapPoints=l={horizontal:[],vertical:[]},k.forEach(d,function(u){u&&(u=u.original||u,l.horizontal.push(u.y),l.vertical.push(u.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var l=r.context,s=l.hover,c=s&&n(s,r);!ut(s)||!c||!c.x||!c.y||(Ht(r,"x",c.x),Ht(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,s=i(l),c=l.hover,d=c&&n(c,r),u=r.x,f=r.y,h,g;if(s){h=t(d?s.vertical.concat([d.x]):s.vertical,u),g=t(d?s.horizontal.concat([d.y]):s.horizontal,f);var p=u-h,m=f-g;k.assign(r,{dx:r.dx-p,dy:r.dy-m,x:r.x-p,y:r.y-m}),(p||s.vertical.indexOf(u)!==-1)&&Ht(r,"x",h),(m||s.horizontal.indexOf(f)!==-1)&&Ht(r,"y",g)}})}sd.$inject=["eventBus"];const vy={__depends__:[gn,Yn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Dc],bendpointMove:["type",Hi],bendpointMovePreview:["type",Zc],connectionSegmentMove:["type",ad],bendpointSnapping:["type",sd]};var wy="djs-dragger";function Ot(e,t,n,a){this._canvas=t,this._graphicsFactory=n,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Ot.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ot.prototype.drawPreview=function(e,t,n){n=n||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=n.source,l=n.target,s=n.waypoints,c=n.connectionStart,d=n.connectionEnd,u=n.noLayout,f=n.noCropping,h=n.noNoop,g,p=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),j.clear(a),i||(i=e.getConnection=Cy(function(m,y,v){return p.getConnection(m,y,v)})),t&&(g=i(t,r,l)),!g){!h&&this.drawNoopPreview(a,n);return}g.waypoints=s||[],this._layouter&&!u&&(g.waypoints=this._layouter.layoutConnection(g,{source:r,target:l,connectionStart:c,connectionEnd:d,waypoints:n.waypoints||g.waypoints})),(!g.waypoints||!g.waypoints.length)&&(g.waypoints=[r?Je(r):c,l?Je(l):d]),this._connectionDocking&&(r||l)&&!f&&(g.waypoints=this._connectionDocking.getCroppedWaypoints(g,r,l)),this._graphicsFactory.drawConnection(a,g,{stroke:"var(--element-dragger-color)"})},Ot.prototype.drawNoopPreview=function(e,t){var n=t.source,a=t.target,i=t.connectionStart||Je(n),r=t.connectionEnd||Je(a),l=this.cropWaypoints(i,r,n,a),s=this.createNoopConnection(l[0],l[1]);j.append(e,s)},Ot.prototype.cropWaypoints=function(e,t,n,a){var i=this._graphicsFactory,r=n&&i.getShapePath(n),l=a&&i.getShapePath(a),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&li(r,s,!0)||e,t=a&&li(l,s,!1)||t,[e,t]},Ot.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&j.remove(e.connectionPreviewGfx)},Ot.prototype.getConnection=function(e){var t=xy(e);return this._elementFactory.createConnection(t)},Ot.prototype.createConnectionPreviewGfx=function(){var e=j.create("g");return j.attr(e,{pointerEvents:"none"}),j.classes(e).add(wy),j.append(this._canvas.getActiveLayer(),e),e},Ot.prototype.createNoopConnection=function(e,t){return qa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Cy(e){var t={};return function(n){var a=JSON.stringify(n),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function xy(e){return k.isObject(e)?e:{}}const ky={__init__:["connectionPreview"],connectionPreview:["type",Ot]};var Ey=new Uo("ov"),Sy=500;function nt(e,t,n,a){this._eventBus=t,this._canvas=n,this._elementRegistry=a,this._ids=Ey,this._overlayDefaults=k.assign({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=_y(n.getContainer()),this._init()}nt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],nt.prototype.get=function(e){if(k.isString(e)&&(e={id:e}),k.isString(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?k.filter(t.overlays,k.matchPattern({type:e.type})):t.overlays.slice():[]}else return e.type?k.filter(this._overlays,k.matchPattern({type:e.type})):e.id?this._overlays[e.id]:null},nt.prototype.add=function(e,t,n){if(k.isObject(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return n=k.assign({},this._overlayDefaults,n,{id:a,type:t,element:e,html:n.html}),this._addOverlay(n),a},nt.prototype.remove=function(e){var t=this.get(e)||[];k.isArray(t)||(t=[t]);var n=this;k.forEach(t,function(a){var i=n._getOverlayContainer(a.element,!0);if(a&&(F.remove(a.html),F.remove(a.htmlContainer),delete a.htmlContainer,delete a.element,delete n._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},nt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},nt.prototype.show=function(){ga(this._overlayRoot)},nt.prototype.hide=function(){ga(this._overlayRoot,!1)},nt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],F.clear(this._overlayRoot)},nt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,a=t.x,i=t.y;if(t.waypoints){var r=_t(t);a=r.x,i=r.y}cd(n,a,i),F.attr(e.html,"data-container-id",t.id)},nt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=_t(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=_t(a).height:s=a.height,r=t.bottom*-1+s}cd(n,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},nt.prototype._createOverlayContainer=function(e){var t=F.domify('<div class="djs-overlays" />');F.assignStyle(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},nt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";dd(this._overlayRoot,n)},nt.prototype._getOverlayContainer=function(e,t){var n=k.find(this._overlayContainers,function(a){return a.element===e});return!n&&!t?this._createOverlayContainer(e):n},nt.prototype._addOverlay=function(e){var t=e.id,n=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),k.isString(a)&&(a=F.domify(a)),r=this._getOverlayContainer(n),i=F.domify('<div class="djs-overlay" data-overlay-id="'+t+'">'),F.assignStyle(i,{position:"absolute"}),i.appendChild(a),e.type&&F.classes(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(n),s=this._canvas.getRootElement();ga(i,l===s),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},nt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,a=this._canvas.findRoot(e.element),i=n&&n.minZoom,r=n&&n.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||n&&(k.isDefined(i)&&i>t.scale||k.isDefined(r)&&r<t.scale))&&(c=!1),ga(l,c),this._updateOverlayScale(e,t)},nt.prototype._updateOverlayScale=function(e,t){var n=e.scale,a,i,r=e.htmlContainer,l,s="";n!==!0&&(n===!1?(a=1,i=1):(a=n.min,i=n.max),k.isDefined(a)&&t.scale<a&&(l=(1/t.scale||1)*a),k.isDefined(i)&&t.scale>i&&(l=(1/t.scale||1)*i)),k.isDefined(l)&&(s="scale("+l+","+l+")"),dd(r,s)},nt.prototype._updateOverlaysVisibilty=function(e){var t=this;k.forEach(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},nt.prototype._init=function(){var e=this._eventBus,t=this;function n(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){n(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element,r=t.get({element:i});k.forEach(r,function(c){t.remove(c.id)});var l=t._getOverlayContainer(i);if(l){F.remove(l.html);var s=t._overlayContainers.indexOf(l);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Sy,function(a){var i=a.element,r=t._getOverlayContainer(i,!0);r&&(k.forEach(r.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var i=t._getOverlayContainer(a.element,!0);i&&F.classes(i.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 _y(e){var t=F.domify('<div class="djs-overlay-container" />');return F.assignStyle(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function cd(e,t,n){F.assignStyle(e,{left:t+"px",top:n+"px"})}function ga(e,t){e.style.display=t===!1?"none":""}function dd(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Ry={__init__:["overlays"],overlays:["type",nt]},By=new Uo;function Zn(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Zn.$inject=["eventBus"],Zn.prototype.schedule=function(e,t=By.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Zn.prototype._schedule=function(e,t){const n=Ty();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(i){n.reject(i)}}catch(i){console.error("Scheduler#_schedule execution failed",i)}}),promise:n.promise}},Zn.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Zn.prototype._cancel=function(e){clearTimeout(e.executionId)};function Ty(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const My={scheduler:["type",Zn]};var Py="djs-element-hidden",ma=".entry",jy=1e3,ud=8,Ay=300;function Xe(e,t,n,a){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=a,this._current=null,this._init()}Xe.$inject=["canvas","elementRegistry","eventBus","scheduler"],Xe.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,a=n.length?n.length===1?n[0]:n:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,a=e._current;if(a){var i=a.target,r=k.isArray(i)?i:[i],l=r.filter(function(c){return n.includes(c)});if(l.length){e.close();var s=r.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,a=e._current,i=k.isArray(a.target)?a.target:[a.target];i.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Xe.prototype._createContainer=function(){var e=F.domify('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Xe.prototype.registerProvider=function(e,t){t||(t=e,e=jy),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Xe.prototype.getEntries=function(e){var t=this._getProviders(),n=k.isArray(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return k.forEach(t,function(i){if(k.isFunction(i[n])){var r=i[n](e);k.isFunction(r)?a=r(a):k.forEach(r,function(l,s){a[s]=l})}}),a},Xe.prototype.trigger=function(e,t,n){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=F.attr(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,n)},Ay);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,n)},Xe.prototype.triggerEntry=function(e,t,n,a){if(this.isShown()){var i=this._current.target,r=this._current.entries,l=r[e];if(l){var s=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:n})!==!1){if(k.isFunction(s)){if(t==="click")return s(n,i,a)}else if(s[t])return s[t](n,i,a);n.preventDefault()}}}},Xe.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Xe.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Xe.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),a;k.forEach(t,function(i,r){var l=i.group||"default",s=F.domify(i.html||'<div class="entry" draggable="true"></div>'),c;F.attr(s,"data-action",r),c=F.query("[data-group="+Ii(l)+"]",n),c||(c=F.domify('<div class="group"></div>'),F.attr(c,"data-group",l),n.appendChild(c)),c.appendChild(s),i.className&&Vy(s,i.className),i.title&&F.attr(s,"title",i.title),i.imageUrl&&(a=F.domify("<img>"),F.attr(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),F.classes(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Xe.prototype._createHtml=function(e){var t=this,n=F.domify('<div class="djs-context-pad"></div>');return F.delegate.bind(n,ma,"click",function(a){t.trigger("click",a)}),F.delegate.bind(n,ma,"dragstart",function(a){t.trigger("dragstart",a)}),F.delegate.bind(n,ma,"mouseover",function(a){t.trigger("mouseover",a)}),F.delegate.bind(n,ma,"mouseout",function(a){t.trigger("mouseout",a)}),F.event.bind(n,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Xe.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()&&Iy(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Xe.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Xe.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return k.isArray(e)!==k.isArray(n)?!1:k.isArray(e)?e.length===n.length&&k.every(e,function(a){return n.includes(a)}):n===e},Xe.prototype.isShown=function(){return this.isOpen()&&F.classes(this._current.html).has("open")},Xe.prototype.show=function(){this.isOpen()&&(F.classes(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Xe.prototype.hide=function(){this.isOpen()&&(F.classes(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Xe.prototype._getPosition=function(e){if(!k.isArray(e)&&ut(e)){var t=this._canvas.viewbox(),n=Ny(e),a=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale;return{left:a+ud*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer(),l=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-l.left+ud*this._canvas.zoom(),top:s.top-l.top}},Xe.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(a){a in n&&(t.style[a]=n[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Xe.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,a=k.isArray(n)?n:[n],i=a.some(function(r){return t._canvas.hasMarker(r,Py)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Xe.prototype._getTargetBounds=function(e){var t=this,n=k.isArray(e)?e:[e],a=n.map(function(i){return t._canvas.getGraphics(i)});return a.reduce(function(i,r){const l=r.getBoundingClientRect();return i.top=Math.min(i.top,l.top),i.right=Math.max(i.right,l.right),i.bottom=Math.max(i.bottom,l.bottom),i.left=Math.min(i.left,l.left),i.x=i.left,i.y=i.top,i.width=i.right-i.left,i.height=i.bottom-i.top,i},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Vy(e,t){var n=F.classes(e);t=k.isArray(t)?t:t.split(/\s+/g),t.forEach(function(a){n.add(a)})}function Ny(e){return e.waypoints[e.waypoints.length-1]}function Iy(e,t){return e=k.isArray(e)?e:[e],t=k.isArray(t)?t:[t],e.length===t.length&&k.every(e,function(n){return t.includes(n)})}const Hy={__depends__:[Xa,My,Ry],contextPad:["type",Xe]};var Oy=250;function En(e){this._eventBus=e,this._tools=[],this._active=null}En.$inject=["eventBus"],En.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},En.prototype.isActive=function(e){return e&&this._active===e},En.prototype.length=function(e){return this._tools.length},En.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},En.prototype.bindEvents=function(e,t){var n=this._eventBus,a=[];n.on(t.tool+".init",function(i){var r=i.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k.forEach(t,function(i){a.push(i+".ended"),a.push(i+".canceled")}),n.on(a,Oy,function(i){this._active&&(Ly(i)||this.setActive(null))},this)};function Ly(e){var t=e.originalEvent&&e.originalEvent.target;return t&&F.closest(t,'.group[data-group="tools"]')}const zi={__depends__:[gn],__init__:["toolManager"],toolManager:["type",En]};function $i(e){var t=this;this._lastMoveEvent=null;function n(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){var i=t._svg=a.svg;i.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}$i.$inject=["eventBus"],$i.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||zy(0,0)};function zy(e,t){var n=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),n}const Fi={__init__:["mouse"],mouse:["type",$i]};var Wi=1500,fd="grab";function Qn(e,t,n,a,i,r){this._dragging=n,this._mouse=r;var l=this,s=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Wi,function(c){if(Kl(c))return l.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Wi,function(c){if(!(!hd(c.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(Wi,function(c){!hd(c.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var d=c.originalEvent.target;if(!c.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var d=t.viewbox().scale;t.scroll({dx:c.dx*d,dy:c.dy*d})}),e.on("hand.move.end",function(c){var d=c.context,u=d.reactivate;return!Kl(c)&&u&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}Qn.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Qn.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:fd,data:{context:n||{}}})},Qn.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:fd,data:{context:{reactivate:n}}})},Qn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Qn.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function hd(e){return ls("Space",e)}const $y={__depends__:[zi,Fi],__init__:["handTool"],handTool:["type",Qn]};var pd="crosshair";function Sn(e,t,n,a,i,r,l){this._selection=i,this._dragging=n,this._mouse=l;var s=this,c={create:function(d){var u=t.getActiveLayer(),f;f=d.frame=j.create("rect"),j.attr(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),j.append(u,f)},update:function(d){var u=d.frame,f=d.bbox;j.attr(u,{x:f.x,y:f.y,width:f.width,height:f.height})},remove:function(d){d.frame&&j.remove(d.frame)}};r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(d){var u=d.originalEvent.target;!d.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,f=Ui(d),h=a.filter(function(p){return p}),g=Ja(d);s.select(h,f,g?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=Ui(d),c.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=Ui(d),c.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;c.remove(u)}),e.on("element.mousedown",1500,function(d){if(Ja(d))return s.activateLasso(d.originalEvent),!0})}Sn.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Sn.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:pd,data:{context:{}}})},Sn.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:pd,data:{context:{}},keepSelection:!0})},Sn.prototype.select=function(e,t,n=[]){var a=$p(e,t);this._selection.select([...n,...k.values(a)])},Sn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Sn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Ui(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},a;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?a={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?a={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?a={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?a={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:a={x:n.x,y:n.y,width:0,height:0},a}const Fy={__depends__:[zi,Fi],__init__:["lassoTool"],lassoTool:["type",Sn]};var gd="connect-ok",md="connect-not-ok";function eo(e,t,n,a,i,r,l){var s=this;this._dragging=t,this._rules=r,this._mouse=l,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var d=c.context,u=c.hover,f=d.canStartConnect=s.canStartConnect(u);f!==null&&(d.startTarget=u,a.addMarker(u,f?gd:md))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?gd:md)}),e.on(["global-connect.ended"],function(c){var d=c.context,u=d.startTarget,f={x:c.x,y:c.y},h=s.canStartConnect(u);if(h)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,f)}),!1})}eo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],eo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},eo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},eo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},eo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Wy={__depends__:[ci,Yn,gn,zi,Fi],globalConnect:["type",eo]};var Uy=500,Dy=1e3;function _n(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=j.create("rect");return j.attr(l,k.assign({x:0,y:0,rx:4,width:100,height:100},n)),l}e.on(["shape.added","shape.changed"],Uy,function(r){var l=r.element,s=r.gfx,c=F.query(".djs-outline",s);c||(c=a.getOutline(l)||i(),j.append(s,c)),a.updateShapeOutline(c,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,s=r.gfx,c=F.query(".djs-outline",s);c||(c=i(),j.append(s,c)),a.updateConnectionOutline(c,l)})}_n.prototype.updateShapeOutline=function(e,t){var n=!1,a=this._getProviders();a.length&&k.forEach(a,function(i){n=n||i.updateOutline(t,e)}),n||j.attr(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},_n.prototype.updateConnectionOutline=function(e,t){var n=_t(t);j.attr(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})},_n.prototype.registerProvider=function(e,t){t||(t=e,e=Dy),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_n.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_n.prototype.getOutline=function(e){var t,n=this._getProviders();return k.forEach(n,function(a){k.isFunction(a.getOutline)&&(t=t||a.getOutline(e))}),t},_n.$inject=["eventBus","styles","elementRegistry"];var ya=6;function Di(e,t,n){this._canvas=t;var a=this;e.on("element.changed",function(i){n.isSelected(i.element)&&a._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}Di.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");j.clear(t);var n=e.length>1,a=this._canvas.getContainer();if(j.classes(a)[n?"add":"remove"]("djs-multi-select"),!!n){var i=Yy(_t(e)),r=j.create("rect");j.attr(r,k.assign({rx:3},i)),j.classes(r).add("djs-selection-outline"),j.append(t,r)}},Di.$inject=["eventBus","canvas","selection"];function Yy(e){return{x:e.x-ya,y:e.y-ya,width:e.width+ya*2,height:e.height+ya*2}}const yd={__depends__:[Wn],__init__:["outline","multiSelectionOutline"],outline:["type",_n],multiSelectionOutline:["type",Di]};var Jy=500,Gy=1250,Ky=1500,ba=Math.round;function qy(e){return{x:e.x+ba(e.width/2),y:e.y+ba(e.height/2)}}function bd(e,t,n,a,i){function r(s,c,d,u){return i.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",Ky,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=Xy(u),k.assign(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",Gy,function(s){var c=s.context,d=c.validatedShapes,u;if(u=c.canExecute=r(d),!u)return!1}),e.on("shape.move.move",Jy,function(s){var c=s.context,d=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},h={x:s.x,y:s.y},g;if(g=r(d,f,h,u),c.delta=f,c.canExecute=g,g===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,d=c.delta,u=c.canExecute,f=u==="attach",h=c.shapes;if(u===!1)return!1;d.x=ba(d.x),d.y=ba(d.y),!(d.x===0&&d.y===0)&&n.moveElements(h,d,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if($t(s)){var c=zn(s);if(!c)throw new Error("must supply DOM mousedown event");return l(c,s.element)}});function l(s,c,d,u){if(k.isObject(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!j.classes(s.target).has("djs-hit-no-move")){var f=qy(c);return t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=l}bd.$inject=["eventBus","dragging","modeling","selection","rules"];function Xy(e){var t=k.groupBy(e,"id");return k.filter(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var vd=499,Yi="djs-dragging",wd="drop-ok",Cd="drop-not-ok",xd="new-parent",kd="attach-ok";function Ed(e,t,n,a){function i(c){var d=r(c),u=Zy(d);return u}function r(c){var d=Lp(c),u=d.flatMap(g=>(g.incoming||[]).concat(g.outgoing||[])),f=d.concat(u),h=[...new Set(f)];return h}function l(c,d){[kd,wd,Cd,xd].forEach(function(u){u===d?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,d,u){a.addDragger(d,c.dragGroup),u&&t.addMarker(d,Yi),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",vd,function(c){var d=c.context,u=d.shapes,f=d.allDraggedElements,h=i(u);if(!d.dragGroup){var g=j.create("g");j.attr(g,n.cls("djs-drag-group",["no-events"]));var p=t.getActiveLayer();j.append(p,g),d.dragGroup=g}h.forEach(function(m){a.addDragger(m,d.dragGroup)}),f?f=k.flatten([f,r(u)]):f=r(u),k.forEach(f,function(m){t.addMarker(m,Yi)}),d.allDraggedElements=f,d.differentParents=Qy(u)}),e.on("shape.move.move",vd,function(c){var d=c.context,u=d.dragGroup,f=d.target,h=d.shape.parent,g=d.canExecute;f&&(g==="attach"?l(f,kd):d.canExecute&&h&&f.id!==h.id?l(f,xd):l(f,d.canExecute?wd:Cd)),Rt(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context,u=d.target;u&&l(u,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,f=d.dragGroup;k.forEach(u,function(h){t.removeMarker(h,Yi)}),f&&j.remove(f)}),this.makeDraggable=s}Ed.$inject=["eventBus","canvas","styles","previewSupport"];function Zy(e){var t=k.filter(e,function(n){return ut(n)?k.find(e,k.matchPattern({id:n.source.id}))&&k.find(e,k.matchPattern({id:n.target.id})):!0});return t}function Qy(e){return k.size(k.groupBy(e,function(t){return t.parent&&t.parent.id}))!==1}const eb={__depends__:[Xa,Wn,yd,Yn,gn,ei],__init__:["move","movePreview"],move:["type",bd],movePreview:["type",Ed]};var Sd=".djs-palette-toggle",_d=".entry",tb=Sd+", "+_d,Ji="djs-palette-",nb="shown",Gi="open",Rd="two-column",ob=1e3;function Ze(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(a){var i=a.tool;n.updateToolHighlight(i)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ze.$inject=["eventBus","canvas"],Ze.prototype.registerProvider=function(e,t){t||(t=e,e=ob),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ze.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(ib,{})},Ze.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ze.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),a=this._container=F.domify(Ze.HTML_MARKUP);n.appendChild(a),F.classes(n).add(Ji+nb),F.delegate.bind(a,tb,"click",function(i){var r=i.delegateTarget;if(F.matches(r,Sd))return e.toggle();e.trigger("click",i)}),F.event.bind(a,"mousedown",function(i){i.stopPropagation()}),F.delegate.bind(a,_d,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},Ze.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ze.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,a=this._eventBus,i,r=F.classes(n),l=F.classes(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Rd,i),l.toggle(Ji+Rd,i),"open"in e&&(r.toggle(Gi,e.open),l.toggle(Ji+Gi,e.open)),a.fire("palette.changed",{twoColumn:i,open:this.isOpen()})},Ze.prototype._update=function(){var e=F.query(".djs-palette-entries",this._container),t=this._entries=this.getEntries();F.clear(e),k.forEach(t,function(n,a){var i=n.group||"default",r=F.query("[data-group="+Ii(i)+"]",e);r||(r=F.domify('<div class="group"></div>'),F.attr(r,"data-group",i),e.appendChild(r));var l=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=F.domify(l);if(r.appendChild(s),!n.separator&&(F.attr(s,"data-action",a),n.title&&F.attr(s,"title",n.title),n.className&&ab(s,n.className),n.imageUrl)){var c=F.domify("<img>");F.attr(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ze.prototype.trigger=function(e,t,n){var a,i,r=t.delegateTarget||t.target;return r?(a=F.attr(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,n)):t.preventDefault()},Ze.prototype.triggerEntry=function(e,t,n,a){var i=this._entries,r,l;if(r=i[e],!!r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(k.isFunction(l)){if(t==="click")return l(n,a)}else if(l[t])return l[t](n,a);n.preventDefault()}},Ze.prototype._layoutChanged=function(){this._toggleState({})},Ze.prototype._needsCollapse=function(e,t){var n=50,a=Object.keys(t).length*46;return e<a+n},Ze.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ze.prototype.open=function(){this._toggleState({open:!0})},Ze.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ze.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ze.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=F.query(".djs-palette-entries",this._container),this._toolsContainer=F.query("[data-group=tools]",t)),n=this._toolsContainer,k.forEach(n.children,function(a){var i=a.getAttribute("data-action");if(i){var r=F.classes(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},Ze.prototype.isOpen=function(){return F.classes(this._container).has(Gi)},Ze.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ze.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function ab(e,t){var n=F.classes(e),a=k.isArray(t)?t:t.split(/\s+/g);a.forEach(function(i){n.add(i)})}function ib(e,t){var n=t.getPaletteEntries();return k.isFunction(n)?n(e):(k.forEach(n,function(a,i){e[i]=a}),e)}const rb={__init__:["palette"],palette:["type",Ze]};function Bd(e,t,n,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Fp(r)+".changed",i)}),e.on("elements.changed",function(i){var r=i.elements;r.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(r)}),e.on("shape.changed",function(i){a.update("shape",i.element,i.gfx)}),e.on("connection.changed",function(i){a.update("connection",i.element,i.gfx)})}Bd.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const lb={__init__:["changeSupport"],changeSupport:["type",Bd]};var va=Math.max,wa=Math.min,sb=20;function cb(e,t,n){var a=n.x,i=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+i,r.height=e.height-i):t.indexOf("s")!==-1&&(r.height=e.height+i),t.indexOf("e")!==-1?r.width=e.width+a:t.indexOf("w")!==-1&&(r.x=e.x+a,r.width=e.width-a),r}function Ca(e,t,n){var a=t[e],i=n.min&&n.min[e],r=n.max&&n.max[e];return k.isNumber(i)&&(a=(/top|left/.test(e)?wa:va)(a,i)),k.isNumber(r)&&(a=(/top|left/.test(e)?va:wa)(a,r)),a}function db(e,t){if(!t)return e;var n=Te(e);return Vs({top:Ca("top",n,t),right:Ca("right",n,t),bottom:Ca("bottom",n,t),left:Ca("left",n,t)})}function ub(e,t,n,a){var i=Te(t),r={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},l=a?Te(a):r,s={top:wa(r.top,l.top),left:wa(r.left,l.left),bottom:va(r.bottom,l.bottom),right:va(r.right,l.right)};return Vs(s)}function So(e,t){return typeof e<"u"?e:sb}function fb(e,t){var n,a,i,r;return typeof t=="object"?(n=So(t.left),a=So(t.right),i=So(t.top),r=So(t.bottom)):n=a=i=r=So(t),{x:e.x-n,y:e.y-i,width:e.width+n+a,height:e.height+i+r}}function hb(e){return!(e.waypoints||e.type==="label")}function pb(e,t){var n;if(e.length===void 0?n=k.filter(e.children,hb):n=e,n.length)return fb(_t(n),t)}var Td=10;function _o(e,t,n,a){this._dragging=a,this._rules=t;var i=this;function r(c,d){var u=c.shape,f=c.direction,h=c.resizeConstraints,g;c.delta=d,g=cb(u,f,d),c.newBounds=db(g,h),c.canExecute=i.canResize(c)}function l(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(c)),c.resizeConstraints={min:Te(u)})}function s(c){var d=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=hg(f),!gb(d,f))return;n.resizeShape(d,f)}}e.on("resize.start",function(c){l(c.context)}),e.on("resize.move",function(c){var d={x:c.dx,y:c.dy};r(c.context,d)}),e.on("resize.end",function(c){s(c.context)})}_o.prototype.canResize=function(e){var t=this._rules,n=k.pick(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},_o.prototype.activate=function(e,t,n){var a=this._dragging,i,r;if(typeof n=="string"&&(n={direction:n}),i=k.assign({shape:t},n),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Md(t,r),"resize",{autoActivate:!0,cursor:mb(r),data:{shape:t,context:i}})},_o.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,a,i;return a=e.minDimensions||{width:Td,height:Td},i=pb(t,e.childrenBoxPadding),ub(n,t,a,i)},_o.$inject=["eventBus","rules","modeling","dragging"];function gb(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Md(e,t){var n=Je(e),a=Te(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function mb(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 Pd="djs-resizing",jd="resize-not-ok",yb=500;function Ad(e,t,n){function a(r){var l=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(l,t.getActiveLayer()),t.addMarker(l,Pd)),s.width>5&&j.attr(c,{x:s.x,width:s.width}),s.height>5&&j.attr(c,{y:s.y,height:s.height}),r.canExecute?j.classes(c).remove(jd):j.classes(c).add(jd)}function i(r){var l=r.shape,s=r.frame;s&&j.remove(r.frame),t.removeMarker(l,Pd)}e.on("resize.move",yb,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}Ad.$inject=["eventBus","canvas","previewSupport"];var xa=-6,ka=8,Ea=20,Ro="djs-resizer",bb=["n","w","s","e","nw","ne","se","sw"];function nn(e,t,n,a){this._resize=a,this._canvas=t;var i=this;e.on("selection.changed",function(r){var l=r.newSelection;i.removeResizers(),l.length===1&&k.forEach(l,k.bind(i.addResizer,i))}),e.on("shape.changed",function(r){var l=r.element;n.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}nn.prototype.makeDraggable=function(e,t,n){var a=this._resize;function i(r){$t(r)&&a.activate(r,e,n)}F.event.bind(t,"mousedown",i),F.event.bind(t,"touchstart",i)},nn.prototype._createResizer=function(e,t,n,a){var i=this._getResizersParent(),r=vb(a),l=j.create("g");j.classes(l).add(Ro),j.classes(l).add(Ro+"-"+e.id),j.classes(l).add(Ro+"-"+a),j.append(i,l);var s=j.create("rect");j.attr(s,{x:-ka/2+r.x,y:-ka/2+r.y,width:ka,height:ka}),j.classes(s).add(Ro+"-visual"),j.append(l,s);var c=j.create("rect");return j.attr(c,{x:-Ea/2+r.x,y:-Ea/2+r.y,width:Ea,height:Ea}),j.classes(c).add(Ro+"-hit"),j.append(l,c),Yp(l,t,n),l},nn.prototype.createResizer=function(e,t){var n=Md(e,t),a=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,a,t)},nn.prototype.addResizer=function(e){var t=this;ut(e)||!this._resize.canResize({shape:e})||k.forEach(bb,function(n){t.createResizer(e,n)})},nn.prototype.removeResizers=function(){var e=this._getResizersParent();j.clear(e)},nn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},nn.$inject=["eventBus","canvas","selection","resize"];function vb(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-xa:e.indexOf("w")!==-1&&(t.x=xa),e.indexOf("s")!==-1?t.y=-xa:e.indexOf("n")!==-1&&(t.y=xa),t}const wb={__depends__:[Yn,gn,ei],__init__:["resize","resizePreview","resizeHandles"],resize:["type",_o],resizePreview:["type",Ad],resizeHandles:["type",nn]};function Bo(e,t,n,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,n.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{n.isActive()&&n.complete()}),e.on(["commandStack.changed"],()=>{n.isActive()&&n.cancel()}),e.on("directEditing.activate",()=>{i.removeResizers()}),e.on("create.end",500,s=>{const{context:c,isTouch:d}=s,u=c.shape,{canExecute:f}=s.context;d||f&&(c.hints&&c.hints.createElementsBehavior===!1||l(u))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,c){(c||Ei(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&n.activate(s)}}Bo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Bo.prototype.activate=function(e){const t=ia(e);if(t===void 0)return;const n={text:t},a=this.getEditingBBox(e);Fe(n,a);const i={};return(Ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Fe(i,{centerVertically:!0}),Si(e)&&Fe(i,{autoResize:!0}),Fe(n,{options:i}),n},Bo.prototype.getEditingBBox=function(e){const t=this._canvas,n=e.label||e,a=t.getAbsoluteBBox(n),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*l,u=c.lineHeight,f=s.fontSize*l,h=s.lineHeight,g={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Fe(r,{width:a.width,height:a.height}),Fe(g,{fontSize:f+"px",lineHeight:h,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const p=90*l,m=7*l,y=4*l;if(n.labelTarget&&(Fe(r,{width:p,height:a.height+m+y,x:i.x-p/2,y:a.y-m}),Fe(g,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})),Si(n)&&!yc(n)&&!Co(n)){const v=bc(e),w=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),C=d+m+y;Fe(r,{width:p,height:C,x:w.x-p/2,y:w.y-C/2}),Fe(g,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})}return{bounds:r,style:g}},Bo.prototype.update=function(e,t){let n;Cb(t)&&(t=null),this._modeling.updateLabel(e,t,n)};function Cb(e){return!e||!e.trim()}const xb={__depends__:[lb,wb,fu],__init__:["labelEditingProvider"],labelEditingProvider:["type",Bo]};function on(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}on.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},on.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},on.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},on.prototype.getSnapLocations=function(){return this._snapLocations},on.prototype.setSnapLocations=function(e){this._snapLocations=e},on.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Sa,n.initDefaults(this._defaultSnaps)),n};function Sa(){this._snapValues={}}Sa.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Sa.prototype.snap=function(e,t,n,a){var i=this._snapValues[t];return i&&gy(e[n],i[n],a)},Sa.prototype.initDefaults=function(e){var t=this;k.forEach(e||{},function(n,a){k.forEach(n,function(i){t.add(a,i)})})};var kb=1250;function Pt(e,t,n){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(i){a.initSnap(i)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],kb,function(i){var r=i.context,l=r.shape,s=r.snapContext,c=r.target;if(!(i.originalEvent&&rs(i.originalEvent))&&!(pa(i)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,l,c),d.initialized=!0),n.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Pt.$inject=["elementRegistry","eventBus","snapping"],Pt.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,a=n.shape,i=n.snapContext;i||(i=n.snapContext=new on);var r;t.get(a.id)?r=Xn(a,e):r={x:e.x+Xn(a).x,y:e.y+Xn(a).y};var l={x:r.x-a.width/2,y:r.y-a.height/2},s={x:r.x+a.width/2,y:r.y+a.height/2};return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Jn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),i},Pt.prototype.addSnapTargetPoints=function(e,t,n){var a=this.getSnapTargets(t,n);return k.forEach(a,function(i){if(Jn(i)){Jn(t)&&e.add("mid",Xn(i));return}if(ut(i)){if(i.waypoints.length<3)return;var r=i.waypoints.slice(1,-1);k.forEach(r,function(l){e.add("mid",l)});return}e.add("mid",Xn(i))}),!k.isNumber(t.x)||!k.isNumber(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Xn(t)),e},Pt.prototype.getSnapTargets=function(e,t){return rd(t).filter(function(n){return!Eb(n)})};function Eb(e){return!!e.hidden}function to(e){e.invoke(Pt,this)}un(to,Pt),to.$inject=["injector"],to.prototype.initSnap=function(e){return Pt.prototype.initSnap.call(this,e)},to.prototype.addSnapTargetPoints=function(e,t,n){return Pt.prototype.addSnapTargetPoints.call(this,e,t,n)},to.prototype.getSnapTargets=function(e,t){return Pt.prototype.getSnapTargets.call(this,e,t)};var Sb=1250;function To(e,t){var n=this;e.on(["resize.start"],function(a){n.initSnap(a)}),e.on(["resize.move","resize.end"],Sb,function(a){var i=a.context,r=i.shape,l=r.parent,s=i.direction,c=i.snapContext;if(!(a.originalEvent&&rs(a.originalEvent))&&!pa(a)){var d=c.pointsForTarget(l);d.initialized||(d=n.addSnapTargetPoints(d,r,l,s),d.initialized=!0),Bb(s)&&Ht(a,"x",a.x),Tb(s)&&Ht(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}To.prototype.initSnap=function(e){var t=e.context,n=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new on);var r=Vd(n,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},To.prototype.addSnapTargetPoints=function(e,t,n,a){var i=this.getSnapTargets(t,n);return k.forEach(i,function(r){e.add("corner",yy(r)),e.add("corner",my(r))}),e.add("corner",Vd(t,a)),e},To.$inject=["eventBus","snapping"],To.prototype.getSnapTargets=function(e,t){return rd(t).filter(function(n){return!_b(n,e)&&!ut(n)&&!Rb(n)&&!Jn(n)})};function Vd(e,t){var n=Je(e),a=Te(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function _b(e,t){return e.host===t}function Rb(e){return!!e.hidden}function Bb(e){return e==="n"||e==="s"}function Tb(e){return e==="e"||e==="w"}var Mb=7,Pb=1e3;function an(e){this._canvas=e,this._asyncHide=k.debounce(k.bind(this.hide,this),Pb)}an.$inject=["canvas"],an.prototype.snap=function(e,t){var n=e.context,a=n.snapContext,i=a.getSnapLocations(),r={x:pa(e,"x"),y:pa(e,"y")};k.forEach(i,function(l){var s=a.getSnapOrigin(l),c={x:e.x+s.x,y:e.y+s.y};if(k.forEach(["x","y"],function(d){var u;r[d]||(u=t.snap(c,l,d,Mb),u!==void 0&&(r[d]={value:u,originValue:u-s[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),k.forEach(["x","y"],function(l){var s=r[l];k.isObject(s)&&Ht(e,l,s.originValue)})},an.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=j.create("path");return j.attr(n,{d:"M0,0 L0,0"}),j.classes(n).add("djs-snap-line"),j.append(t,n),{update:function(a){k.isNumber(a)?e==="horizontal"?j.attr(n,{d:"M-100000,"+a+" L+100000,"+a,display:""}):j.attr(n,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):j.attr(n,{display:"none"})}}},an.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},an.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},an.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},an.prototype.hide=function(){k.forEach(this._snapLines,function(e){e.update()})};const jb={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Pt],resizeSnapping:["type",To],snapping:["type",an]}],__init__:["createMoveSnapping"],createMoveSnapping:["type",to]};function no(e){it.call(this,e),this.init()}no.$inject=["eventBus"],mn(no,it),no.prototype.addRule=function(e,t,n){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,s){return n(r)},!0)})},no.prototype.init=function(){};function Mo(e){no.call(this,e)}Mo.$inject=["eventBus"],un(Mo,no),Mo.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,n=e.target,a=e.hints||{},i=a.targetParent,r=a.targetAttach;if(r)return!1;i&&(n.parent=i);try{return Ki(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){e.connection;var t=e.source,n=e.target;return Ki(t,n)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,n=e.shape;return t.parent&&(t=parent),!(n.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==n.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return Wp(t)})},Mo.prototype.canConnect=Ki;function Ki(e,t,n){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}const Ab={__init__:["myRuleProvider"],myRuleProvider:["type",Mo]};function qi(e,t,n,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=n,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}qi.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],qi.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,n=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(c,d,u,f,h){function g(p){const m=t.createShape(Fe({type:c},h));e.start(p,m)}return{group:d,className:u,title:f,action:{dragstart:g,click:g}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(c){n.activateHand(c)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(c){a.activateSelection(c)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(c){i.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=l(d.type,d.group,d.className,d.title,d.options)}return s};const Vb={__init__:["paletteProvider"],paletteProvider:["type",qi]};var Nd=50,Nb=250;function Ib(e,t){t||(t={});function n(p){return p.source===e?1:-1}var a=t.defaultDistance||Nd,i=t.direction||"e",r=t.filter,l=t.getWeight||n,s=t.maxDistance||Nb,c=t.reference||"start";r||(r=Hb);function d(p,m){return i==="n"?c==="start"?Te(p).top-Te(m).bottom:c==="center"?Te(p).top-Je(m).y:Te(p).top-Te(m).top:i==="w"?c==="start"?Te(p).left-Te(m).right:c==="center"?Te(p).left-Je(m).x:Te(p).left-Te(m).left:i==="s"?c==="start"?Te(m).top-Te(p).bottom:c==="center"?Je(m).y-Te(p).bottom:Te(m).bottom-Te(p).bottom:c==="start"?Te(m).left-Te(p).right:c==="center"?Je(m).x-Te(p).right:Te(m).right-Te(p).right}var u=e.incoming.filter(r).map(function(p){var m=l(p),y=m<0?d(p.source,e):d(e,p.source);return{id:p.source.id,distance:y,weight:m}}),f=e.outgoing.filter(r).map(function(p){var m=l(p),y=m>0?d(e,p.target):d(p.target,e);return{id:p.target.id,distance:y,weight:m}}),h=u.concat(f).reduce(function(p,m){return p[m.id+"__weight_"+m.weight]=m,p},{}),g=k.reduce(h,function(p,m){var y=m.distance,v=m.weight;return y<0||y>s||(p[String(y)]||(p[String(y)]=0),p[String(y)]+=1*v,(!p.distance||p[p.distance]<p[String(y)])&&(p.distance=y)),p},{});return g.distance||a}function Hb(){return!0}var Ob=100;function Id(e,t,n){e.on("autoPlace",Ob,function(a){var i=a.shape,r=a.source;return Lb(r,i)}),e.on("autoPlace.end",function(a){n.scrollToElement(a.shape)}),this.append=function(a,i,r){e.fire("autoPlace.start",{source:a,shape:i});var l=e.fire("autoPlace",{source:a,shape:i}),s=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}Id.$inject=["eventBus","modeling","canvas"];function Lb(e,t,n){n||(n={});var a=n.defaultDistance||Nd,i=Je(e),r=Te(e);return{x:r.right+a+t.width/2,y:i.y}}function Hd(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Hd.$inject=["eventBus","selection"];const zb={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Id],autoPlaceSelectionBehavior:["type",Hd]},$b=10,Fb=(e,t)=>e.type===t;function Wb(e){return e.incoming.map(t=>t.source)}function Ub(e){return e.outgoing.map(t=>t.target)}function Xi(e){return Ub(e).concat(Wb(e))}function Db(e){let t=Xi(e);return e.host&&(t=t.concat(Xi(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((n,a)=>n.concat(Xi(a)),[]))),t.filter(n=>n.type!=="myline")}function Yb(e,t,n){const a={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=Db(e);return k.find(i,r=>r===n?!1:Jt(r,a,$b)==="intersect")}function Jb(e,t,n,a){let i;for(;i=Yb(e,n,t);)n=a(t,n,i);return n}function Gb(e){return function(t,n,a){const i={x:n.x,y:n.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=l;c<0?i[r]=Math.min(a[r]+c-t[s]/2,n[r]-d+c):i[r]=Math.max(a[r]+a[s]+c+t[s]/2,n[r]+d+c)}),i}}function Kb(e,t){return qb(e,t)}function qb(e,t){const n=Te(e),a=Je(e),i=Ib(e,{filter:u=>Fb(u,"myline")}),r=30,l=80,c={x:n.right+i+t.width/2,y:a.y+Xb("left",l)};return Jb(e,t,c,Gb({y:{margin:r,minDistance:l}}))}function Xb(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Od(e){e.on("autoPlace",t=>{const{shape:n,source:a}=t;return Kb(a,n)})}Od.$inject=["eventBus"];const Zb={__depends__:[zb],__init__:["myAutoPlace"],myAutoPlace:["type",Od]};function Zi(e,t,n,a,i,r,l){this._connect=e,this._modeling=n,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}Zi.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Zi.prototype.getContextPadEntries=function(e){const t=this._connect,n=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function s(){n.removeElements([e])}function c(f,h,g){t.start(f,h,g)}function d(f,h,g,p){typeof g!="string"&&(p=g);function m(v,w){const C=a.createShape(Fe({type:f},p));r.start(v,C,{source:w})}function y(v,w){const C=a.createShape(Fe({type:f},p));i.append(w,C)}return{group:"model",className:h,title:g,action:{dragstart:m,click:y}}}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 u={};for(const f in l.palette)if(f!=="create.start-event"){const h=l.palette[f];u[f]=d(h.type,h.className,h.title,h.options)}return u.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:c,dragstart:c}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},u};const Qb={__init__:["ContextPadProvider"],ContextPadProvider:["type",Zi]},ev=o.defineComponent({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=o.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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const P=s.get("eventBus");P.on("element.dblclick",B=>{i("elementDblclick",B.element.businessObject)}),P.on("element.click",B=>{i("elementClick",B.element.businessObject)}),P.on("create.end",B=>{i("elementCreate",B.elements[0].businessObject)}),P.on("autoPlace.end",B=>{i("elementCreate",B.shape.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let P={__init__:["myOptions"],myOptions:["type",f]};s=new rr({canvas:{container:r.value},modules:[vy,ci,ky,Hy,ws,Km,$y,Fy,Wy,Mc,zs,eb,yd,rb,Ws,P,Zb,Ac,xb,Qb,Vb,Ab,jb,Nc]});const B=s.get("canvas"),H=s.get("elementFactory");d();const I=H.createRoot();B.setRootElement(I),u()};o.onMounted(()=>{h()});const g=P=>{const B=P==null?1:c+P;s.get("canvas").zoom(B),c=B},p=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},y=()=>{s.get("canvas").zoom(1);const P=s.get("elementRegistry").getAll();var B=Ic(P);return B},v=P=>{s.clear(),d(),Hc(P,s)},w=P=>{s.get("myImporter").update(P.id,P)};return t({reset:()=>{d()},zoom:P=>{g(P)},redo:()=>{p()},undo:()=>{m()},getData:()=>y(),setData:P=>{v(P)},updateElemet:P=>{w(P)}}),(P,B)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Ld=ne(Jm),zd=ne(ev),$d=ne(o.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:n}){const a=e,i=n,{t:r}=Qe(),{formData:l}=zt(),s=o.computed(()=>a.editConfig.isAddBtn!==!1),c=o.computed(()=>a.editConfig.addBtnText||"添加"),d=o.computed(()=>a.editConfig.buttonsAlign||"left"),u=o.computed(()=>a.editConfig.isRemoveBtn!==!1),f=o.computed(()=>a.editConfig.readonly),h=o.computed(()=>a.editConfig.isNullValue!==!1),g=o.ref([]),p=b=>{i("rowChange",b)},m=()=>{const b={_i:Vt()};a.columns.forEach(_=>{const E=_.config?.valueRowKey||_.id||"";E&&(b[E]=kt(_.config?.defaultValue))}),g.value.push(b),i("change",{id:a.id,value:b,data:b,formData:l,tableData:g.value,type:"add"})},y=b=>{const _=g.value[b];g.value.splice(b,1),i("change",{id:a.id,value:_,data:_,formData:l,tableData:g.value,type:"delete"})},v=()=>{const b={isOk:!0,info:""};if(a.required&&g.value.length===0)return b.isOk=!1,b.info="请添加表格数据",b;const _=g.value.length,E=a.columns,T=E.length;for(let P=0;P<_;P++){const B=g.value[P];for(let H=0;H<T;H++){const I=E[H];if(C(I.config,P).display!==!1&&I.rule&&I.rule.length>0){const O=I.rule.length;for(let M=0;M<O;M++){const R=I.rule[M];if(R.pattern=R.pattern?R.pattern+"":"",R.pattern&&!bt(B[I.prop||""])&&!new RegExp(R.pattern.substring(1,R.pattern.length-1)).test(B[I.prop||""]))return b.info=`${r("第")}${P+1}${r("行")},${r("第")}${H+1}${r("列")},${r(I.label)}:${r(R.message)}`,b.isOk=!1,b;if(R.required&&bt(B[I.prop||""]))return b.isOk=!1,b.info=`${r("第")}${P+1}${r("行")},${r("第")}${H+1}${r("列")},${r(I.label)}:${r("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(g.value=a.modelValue||[],g.value.forEach(b=>{b._i||(b._i=Vt())})):(g.value=[],i("update:modelValue",g.value));const C=(b,_)=>{const E={...b};if(E.getUpConfig){const T=b.getUpConfig({formData:l,index:_,row:g.value[_],tableData:g.value,config:E});T&&Object.keys(T).forEach(P=>{E[P]=T[P]})}return E},x=b=>{const _=b||a.labelWidth;return typeof _=="string"?_:typeof _=="number"?_+"px":_};return t({validate:()=>v()}),ro({getTableData:()=>g.value,rowChange:p}),(b,_)=>{const E=o.resolveComponent("j-comp"),T=o.resolveComponent("el-form-item"),P=o.resolveComponent("el-col"),B=o.resolveComponent("j-button"),H=o.resolveComponent("el-row");return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",o.mergeProps({class:"j-input-cards"},b.$attrs),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(g.value,(I,O)=>(o.openBlock(),o.createElementBlock("div",{class:"j-input-cards-item",key:I.i,style:{"margin-bottom":"8px"}},[o.createVNode(H,{gutter:e.gutter},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.columns,M=>(o.openBlock(),o.createBlock(P,{key:M.prop,span:M.config?.span||e.span||24,style:o.normalizeStyle({"margin-bottom":(M.getInputType?M.getInputType(I):M.inputType)=="j-input-rows"?"8px":void 0})},{default:o.withCtx(()=>[o.withDirectives(o.createVNode(T,{"label-width":x(M.config?.labelWidth),label:o.unref(r)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:o.withCtx(()=>[o.createVNode(E,o.mergeProps({ref_for:!0},M,{row:I}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[o.vShow,C(M.config,O).display!==!1]])]),_:2},1032,["span","style"]))),128)),u.value&&(h.value||g.value.length>1)&&!f.value?(o.openBlock(),o.createBlock(B,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>y(O)},null,8,["onClick"])):o.createCommentVNode("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!f.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({"text-align":d.value})},[s.value?(o.openBlock(),o.createBlock(B,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:m},null,8,["label"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)],64)}}})),tv=[jo,zr,$r,Fr,Wr,Ur,Dr,Yr,Jr,Gr,Kr,qr,ol,al,il,rl,Ua,Lr,ll,sl,cl,ul,hl,pl,El,gl,ml,yl,bl,vl,wl,Cl,xl,kl,Bl,Tl,Ml,Pl,jl,Al,Vl,Nl,Il,Sl,_l,Da,Hl,Ol,Ll,zl,$l,Fl,Wl,yp,Ld,zd,$d],nv={install:e=>{tv.forEach(t=>{e.component(t.name,t)})}};A.EncryptionFactory=Sr,A.EventBus=za,A.HashingFactory=Bu,A.INJECT_KEYS=tt,A.JAutoComplete=Kr,A.JBarcode=pl,A.JButton=jo,A.JButtonSelect=Bl,A.JButtons=zr,A.JCascaderSelect=Yr,A.JCheckbox=Jr,A.JCodeMirror=El,A.JCollapse=Fl,A.JComp=Pl,A.JCount=gl,A.JCountUp=ml,A.JDataPanel=yl,A.JDate=Fr,A.JDialog=al,A.JDialogFull=il,A.JDivider=bl,A.JDrawer=rl,A.JDynamicLayer=Lr,A.JEcharts=hl,A.JEditor=Wl,A.JForm=jl,A.JFormItem=Al,A.JGuid=Nl,A.JHpanel=vl,A.JIcon=Wr,A.JInput=$r,A.JInputButton=wl,A.JInputCards=$d,A.JInputCode=Cl,A.JInputColor=xl,A.JInputLayer=Ol,A.JInputRows=Hl,A.JInputTag=ll,A.JLayer=Ua,A.JLayerForm=Ll,A.JLayout=qr,A.JMenu=_l,A.JNumber=Gr,A.JPage=Vl,A.JPanel=Il,A.JRadio=Ur,A.JRate=sl,A.JSelect=Dr,A.JSlider=cl,A.JSliderCaptcha=Sl,A.JSwitch=zl,A.JTable=ol,A.JTablePanel=Da,A.JTabs=$l,A.JTitle=kl,A.JTree=Tl,A.JTreeSelect=Ml,A.JUpload=ul,A.JWorkflow=zd,A.JWorkflowViewer=Ld,A.assign=Fe,A.buildShortUUID=Vo,A.buildUUID=Vt,A.clearJson=Pn,A.clone=Ao,A.deepClone=kt,A.default=nv,A.eventBus=Mu,A.formatToDate=io,A.formatToDateTime=La,A.fullScreenLoading=jn,A.getCompConfig=hn,A.getCompType=Oa,A.getFunction=Ia,A.getIsInputComp=Io,A.getIsTableInputComp=vr,A.getLabel=wr,A.getObjType=cr,A.getTextWidth=vt,A.is=sr,A.isArray=Po,A.isNullOrEmpty=bt,A.isObject=pu,A.loadBMap=Rr,A.lowerFirst=wu,A.myAesDecrypt=Tu,A.numberToChinese=dr,A.numberToThousandSeparator=ur,A.pagination=yu,A.paginationEx=bu,A.set=No,A.setGroupMap=hr,A.toArray=gr,A.toDecimal=ao,A.toLeafArray=br,A.toSimpleTree=xu,A.toTree=Cu,A.uniqueArray=vu,A.upFirst=fr,A.useAppInject=Qe,A.useAppProvide=Pu,A.useAuthPageInject=Ar,A.useAuthPageProvide=Vr,A.useCompInject=Tr,A.useCompProvide=Fa,A.useFormInject=zt,A.useFormProvide=$a,A.useHMenuInject=Pr,A.useHMenuProvide=jr,A.useInject=Et,A.useLayer=On,A.useLayerInject=ju,A.useLayerProvide=Nr,A.useMenuInject=Hn,A.useMenuProvide=Mr,A.usePageInject=Ir,A.usePageProvide=Hr,A.useProvide=St,A.useSortable=_r,A.useTableInject=Br,A.useTableProvide=ro,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
16
|
+
getCompValue)=>{ return ${_} }`;let E;const T=Ia(_);if(T.res)try{E=T.fn(a,i,r,l,s,c,d,u,f,h,g,p,m,y,C)}catch(P){console.log(P,"计算组件公式运行错误")}else return console.log(T.msg),"";return Number.isNaN(E)?"":(n.decimal!==void 0&&(E=E.toFixed(n.decimal)),E)}),S=o.computed(()=>{let b=x.value;return n.thousandSeparator&&(b=ur(b)),n.isChinese&&(b=dr(b)),b});return o.watch(x,b=>{v("update:modelValue",b),v("change",{value:b,data:S.value})}),(b,_)=>{const E=o.resolveComponent("el-input");return o.openBlock(),o.createBlock(E,{modelValue:S.value,"onUpdate:modelValue":_[0]||(_[0]=T=>S.value=T),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),Kf={key:0},ml=ne(o.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 n=e,a=o.computed(()=>({...n})),i=o.ref(),r=o.ref(null),l=o.computed(()=>n.options);o.onMounted(()=>{n.animation&&s()}),o.watch(()=>n.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=n.decimals,r.value.reset(),r.value.update(n.endValue))},{deep:!0}),o.watch(()=>n.endValue,h=>{r.value&&r.value.update&&r.value.update(h)});const s=()=>{r.value||(l.value.startVal=n.startValue,l.value.decimalPlaces=n.decimals,l.value.duration=n.duration,r.value=new eu.CountUp(i.value,Number(n.endValue),l.value),r.value.start(()=>{n.callback?.(r.value)}))};return o.onUnmounted(()=>{r.value=null}),o.onBeforeUnmount(()=>{r.value=null}),t({myProps:a,el:i,init:s,start:h=>{r.value&&r.value.start&&r.value.start(()=>{h?.(r.value)})},pauseResume:()=>{r.value&&r.value.pauseResume&&r.value.pauseResume()},reset:()=>{r.value&&r.value.reset&&r.value.reset()},update:h=>{r.value&&r.value.update&&r.value.update(h)}}),(h,g)=>(o.openBlock(),o.createElementBlock("span",{ref_key:"el",ref:i},[e.animation?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",Kf,o.toDisplayString(e.endValue),1))],512))}})),qf={class:"j-block j-data-panel"},Xf={key:0,class:"j-data-panel-header"},Zf={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Qf={class:"j-data-panel-header-right"},eh={class:"j-data-panel-body"},yl=ne(o.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,n)=>(o.openBlock(),o.createElementBlock("div",qf,[e.title?(o.openBlock(),o.createElementBlock("div",Xf,[o.createElementVNode("div",Zf,o.toDisplayString(e.title),1),o.createElementVNode("div",Qf,[o.renderSlot(t.$slots,"titleRight")])])):o.createCommentVNode("",!0),o.createElementVNode("div",eh,[o.renderSlot(t.$slots,"default")])]))}})),th={class:"j-divider-content"},bl=ne(o.defineComponent({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,n=o.computed(()=>{const i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=o.computed(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(`j-divider-container j-divider-${e.contentPosition}`),style:o.normalizeStyle(n.value)},[o.createElementVNode("div",{class:"j-divider-line j-divider-line-left",style:o.normalizeStyle(a.value)},null,4),o.createElementVNode("div",th,[o.createElementVNode("span",null,o.toDisplayString(e.content||""),1)]),o.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:o.normalizeStyle(a.value)},null,4)],6))}})),nh={class:"j-hpanel"},oh={class:"j-hpanel-main"},vl=ne(o.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,n)=>(o.openBlock(),o.createElementBlock("div",nh,[o.renderSlot(t.$slots,"left"),o.createElementVNode("div",oh,[o.renderSlot(t.$slots,"default")]),o.renderSlot(t.$slots,"right")]))}})),wl=ne(o.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 n=e,a=t,i=o.ref(),r=o.ref(),l=async(u,f)=>{n.ok&&(u("保存数据中..."),r.value=await n.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),f(),i.value.close())},s=()=>n.beforeClose?n.beforeClose(r.value):!0,c=()=>{n.closed?.()},d=()=>{i.value.open(n.title||n.btnText,n.layerType),setTimeout(()=>{n.open?.(r.value)},200)};return o.watch(()=>n.modelValue,u=>{r.value=u},{immediate:!0}),(u,f)=>{const h=o.resolveComponent("j-button"),g=o.resolveComponent("j-layer");return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(h,o.mergeProps({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),o.createVNode(g,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:c},{default:o.withCtx(()=>[o.renderSlot(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Cl=ne(o.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 n=e,a=t,i=o.computed({get:()=>n.modelValue,set:f=>{a("update:modelValue",f)}}),r=o.ref(""),l=f=>{r.value=f},s=()=>r.value,c=f=>n.beforeClose?n.beforeClose(f):!0,d=f=>{a("change",f)},u=o.computed(()=>n.modelValue&&n.modelValue.trim()?`${n.btnText}(已设置)`:n.btnText);return(f,h)=>{const g=o.resolveComponent("j-code-mirror"),p=o.resolveComponent("j-layout"),m=o.resolveComponent("j-input-button");return o.openBlock(),o.createBlock(m,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=y=>i.value=y),type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":c,ok:s,open:l,onChange:d},{default:o.withCtx(()=>[o.createVNode(p,{"right-move":!1,right:560},o.createSlots({default:o.withCtx(()=>[o.createVNode(g,{value:r.value,"onUpdate:value":h[0]||(h[0]=y=>r.value=y),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["value","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:o.withCtx(()=>[o.createVNode(g,{value:e.example,mode:e.mode,"read-only":""},null,8,["value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}})),xl=ne(o.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:n}){const a=e,i=n,r=o.ref(),l=o.ref(),s=o.computed({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(m){l.value=m,i("update:modelValue",m),i("input",m)}}),c=m=>{i("input",m)},d=m=>{i("focus",m)},u=m=>{i("blur",m)},f=()=>{i("clear"),i("update:modelValue","")},h=m=>{i("change",m)},g=m=>{i("color-change",m)},p=m=>{i("active-change",m)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(m,y)=>{const v=o.resolveComponent("el-color-picker"),w=o.resolveComponent("el-input");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[o.createVNode(w,o.mergeProps({ref_key:"inputRef",ref:r,modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=C=>s.value=C),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:c,onFocus:d,onBlur:u,onClear:f,onChange:h}),{[e.inputType]:o.withCtx(()=>[o.createVNode(v,{modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=C=>s.value=C),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:g,onActiveChange:p},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)}}})),kl=ne(o.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"}},setup(e){const t=e,n=o.computed(()=>t.class||""),a=o.computed(()=>{const i={...t.style};return t.color&&(i.color=t.color),t.size&&(typeof t.size=="number"?i.fontSize=`${t.size}px`:i.fontSize=t.size),t.weight&&(i.fontWeight=t.weight),i});return(i,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-title",n.value]),style:o.normalizeStyle(a.value)},o.toDisplayString(e.title),7))}})),El=ne(o.defineComponent({name:"JCodeMirror",__name:"code-mirror",props:{value:{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:value","change"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=o.ref(),l=o.ref("");let s=null;const c=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return Tn.javascript();case"css":case"text/css":return ou.css();case"html":case"text/html":return au.html();case"json":case"application/json":return iu.json();case"sql":case"text/x-sql":return ru.sql();case"xml":case"text/xml":return lu.xml();case"python":case"text/x-python":return su.python();case"markdown":case"text/markdown":return cu.markdown();case"java":case"text/x-java":return du.java();case"vue":case"text/x-vue":return Tn.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return Tn.javascript({jsx:!1,typescript:!0});case"jsx":return Tn.javascript({jsx:!0,typescript:!1});case"tsx":return Tn.javascript({jsx:!0,typescript:!0});default:return Tn.javascript()}},d=()=>{const m=[nu.basicSetup,xt.lineNumbers(),xt.highlightActiveLineGutter(),xt.highlightSpecialChars(),Aa.history(),xt.drawSelection(),xt.dropCursor(),Mn.indentOnInput(),Mn.bracketMatching(),ja.closeBrackets(),xt.rectangularSelection(),Mn.foldGutter(),xt.keymap.of([...ja.closeBracketsKeymap,...Aa.defaultKeymap,...Aa.historyKeymap,...Mn.foldKeymap]),Mn.syntaxHighlighting(Mn.defaultHighlightStyle)];return m.push(c(a.mode)),a.readonly&&m.push(Pa.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push(ja.autocompletion({override:[y=>{const v=y.matchBefore(/\w*/);if(!v||v.from===v.to)return null;const w=a.handleHint(v.text);return w.length===0?null:{from:v.from,options:w.map(C=>({label:typeof C=="string"?C:C.label||C.name||"",detail:typeof C=="string"?"":C.detail||"",type:typeof C=="string"?"variable":C.type||"variable",apply:typeof C=="string"?C:C.apply||C.name||C.label||""}))}}]})),m.push(xt.EditorView.updateListener.of(y=>{if(y.docChanged){const v=y.state.doc.toString();l.value=v,i("update:value",v),i("change",{value:v})}})),m},u=async()=>{if(!r.value)return;const m=Pa.EditorState.create({doc:a.value,extensions:d()});s=new xt.EditorView({state:m,parent:r.value}),l.value=a.value},f=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const y=Pa.EditorState.create({doc:m,extensions:d()});r.value&&(s=new xt.EditorView({state:y,parent:r.value}));const v=s.state.doc.toString();v!==a.value&&s.dispatch({changes:{from:0,to:v.length,insert:a.value}})},h=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const y=s.state.doc.length;s.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},g=()=>{let m=tu.format(a.value);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,"@"),i("update:value",m),i("change",{value:m})};let p=null;return o.watch(()=>a.value,m=>{m!==l.value&&(l.value=m,s&&f(),setTimeout(()=>{s&&a.isScrollToBottom&&h()}))}),o.watch(()=>a.mode,()=>{s&&f()}),o.onMounted(async()=>{await o.nextTick(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(p=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),p.observe(r.value))}),o.onUnmounted(()=>{p&&r.value&&(p.unobserve(r.value),p.disconnect(),p=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:g}),(m,y)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:o.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),ah=o.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=o.useTemplateRef("actionRef"),i=o.ref("0"),r=o.computed(()=>{const{actionStyle:s,toLeft:c}=n;return{...s,left:c?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=o.computed(()=>Number.parseInt(i.value)>10&&!n.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{i.value=s}}),(s,c)=>{const d=o.resolveComponent("j-icon");return o.openBlock(),o.createElementBlock("div",{ref_key:"actionRef",ref:a,style:o.normalizeStyle(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(o.openBlock(),o.createBlock(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(o.openBlock(),o.createBlock(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),ih=o.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=o.useTemplateRef("barRef"),i=o.ref("0"),r=o.computed(()=>{const{barStyle:l,toLeft:s}=n;return{...l,width:s?"0":i.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=>{i.value=l}}),(l,s)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"barRef",ref:a,style:o.normalizeStyle(r.value)},null,4))}}),rh=o.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 n=e,a=o.useTemplateRef("contentRef"),i=o.computed(()=>{const{contentStyle:l}=n;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=o.computed(()=>({animation:`shine ${n.animationDuration}s linear ${n.animationIterationCount}`}));return(l,s)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentRef",ref:a,class:o.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:o.normalizeStyle(i.value)},[o.createElementVNode("div",{style:o.normalizeStyle(r.value),class:"j-spine-text"},o.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Sl=ne(o.defineComponent({name:"JSliderCaptcha",__name:"slider-captcha",props:o.mergeModels({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:o.mergeModels(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const n=e,a=t,i=o.useModel(e,"modelValue"),r=o.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=o.useTemplateRef("wrapperRef"),s=o.useTemplateRef("barRef"),c=o.useTemplateRef("contentRef"),d=o.useTemplateRef("actionRef");o.watch(()=>r.isPassing,v=>{if(v){const{endTime:w,startTime:C}=r,x=(w-C)/1e3;a("success",{isPassing:v,time:x.toFixed(1)}),i.value=v}}),o.watchEffect(()=>{r.isPassing=!!i.value});function u(v){return"pageX"in v?v.pageX:"touches"in v&&v.touches[0]?v.touches[0].pageX:0}function f(v){r.isPassing||d.value&&(a("start",v),r.moveDistance=u(v)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function h(v){const w=l.value?.offsetWidth??220,C=v?.offsetWidth??40,x=w-C-6;return{actionWidth:C,offset:x,wrapperWidth:w}}function g(v){const{isMoving:w,moveDistance:C}=r;if(w){const x=o.unref(d),S=o.unref(s);if(!x||!S)return;const{actionWidth:b,offset:_,wrapperWidth:E}=h(x.getEl()),T=u(v)-C;a("move",{event:v,moveDistance:C,moveX:T}),T>0&&T<=_?(x.setLeft(`${T}px`),S.setWidth(`${T+b/2}px`)):T>_&&(x.setLeft(`${E-b}px`),S.setWidth(`${E-b/2}px`),m())}}function p(v){const{isMoving:w,isPassing:C,moveDistance:x}=r;if(w&&!C){a("end",v);const S=d.value,b=o.unref(s);if(!S||!b)return;const _=u(v)-x,{actionWidth:E,offset:T,wrapperWidth:P}=h(S.getEl());_<T?y():(S.setLeft(`${P-E}px`),b.setWidth(`${P-E/2}px`),m()),r.isMoving=!1}}function m(){r.endTime=Date.now(),r.isPassing=!0,r.isMoving=!1}function y(){r.isMoving=!1,r.isPassing=!1,r.moveDistance=0,r.toLeft=!1,r.startTime=0,r.endTime=0;const v=o.unref(d),w=o.unref(s),C=o.unref(c);!v||!w||!C||(C.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,v.setLeft("0"),w.setWidth("0")},300))}return(v,w)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"wrapperRef",ref:l,class:o.normalizeClass(["j-slider-captcha slider-border",n.class]),style:o.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:p,onMousemove:g,onMouseup:p,onTouchend:p,onTouchmove:g},[o.createVNode(ih,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),o.createVNode(rh,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),o.createVNode(ah,{ref_key:"actionRef",ref:d,"action-style":e.actionStyle,"is-passing":r.isPassing,"to-left":r.toLeft,onMousedown:f,onTouchstart:f},null,8,["action-style","is-passing","to-left"])],38))}})),lh=o.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:s}=Hn(),{getHMoreMenus:c}=Pr(),d=o.ref([]);n.pId==="moreId"?d.value=c.value:d.value=r(i()[n.pId||""]||[],[]);const u=p=>{const m=d.value.find(y=>y.active);m?.value!==p.value&&(m&&(m.active=!1),a("click",p))},{list:f,containerProps:h,wrapperProps:g}=Va.useVirtualList(d,{itemHeight:44});return(p,m)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({class:["j-sub-menu-content",{"j-menu-dark":o.unref(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},o.unref(h)),[o.createElementVNode("div",o.normalizeProps(o.guardReactiveProps(o.unref(g))),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(f),y=>(o.openBlock(),o.createBlock($o,{key:y.data.value,"parent-actives":o.unref(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),sh={class:"j-menu-item-label"},ch={class:"j-menu-item-label"},dh={key:1,class:o.normalizeClass(["j-menu-item-arrow","sub"])},uh={class:"j-menu-item-label"},$o=o.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:n}=Qe(),{activeMenuId:a}=Hn(),i=t,r=l=>{i("click",l)};return(l,s)=>{const c=o.resolveComponent("j-icon"),d=o.resolveComponent("el-tooltip"),u=o.resolveComponent("el-popover");return e.collapsed&&!e.item.hasChildren?(o.openBlock(),o.createBlock(d,{key:0,placement:"right"},{content:o.withCtx(()=>[o.createElementVNode("span",null,o.toDisplayString(o.unref(n)(e.item.label)),1)]),default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=o.withModifiers(f=>r(e.item),["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item-content",{active:e.item.value===o.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:o.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(o.openBlock(),o.createBlock(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):o.createCommentVNode("",!0),o.createElementVNode("div",sh,o.toDisplayString(o.unref(n)(e.item.label)),1),e.item.hasChildren?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):o.createCommentVNode("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?(o.openBlock(),o.createBlock(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item",{collapsed:e.collapsed}])},[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item-content",{active:e.item.value===o.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:o.normalizeStyle({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?(o.openBlock(),o.createBlock(c,{key:0,icon:e.item.icon,style:o.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"])):o.createCommentVNode("",!0),o.createElementVNode("div",ch,o.toDisplayString(o.unref(n)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(o.openBlock(),o.createElementBlock("div",dh)):o.createCommentVNode("",!0)],6)],2)]),default:o.withCtx(()=>[o.createVNode(lh,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):(o.openBlock(),o.createElementBlock("div",{key:2,class:o.normalizeClass(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=o.withModifiers(f=>r(e.item),["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["j-menu-item-content",{active:e.item.value===o.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:o.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(o.openBlock(),o.createBlock(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:o.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"])):o.createCommentVNode("",!0),o.createElementVNode("div",uh,o.toDisplayString(o.unref(n)(e.item.label)),1),e.item.hasChildren?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):o.createCommentVNode("",!0)],6)],2))}}}),fh=o.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Hn(),l=f=>{a("click",f)},s=o.computed(()=>n.menuList),{list:c,containerProps:d,wrapperProps:u}=Va.useVirtualList(s,{itemHeight:44});return(f,h)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":o.unref(r)==="dark"}]},o.unref(d)),[o.createElementVNode("div",o.normalizeProps(o.guardReactiveProps(o.unref(u))),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(c),g=>(o.openBlock(),o.createBlock($o,{key:g.data.value,"parent-actives":o.unref(i)?.pid?.split(".")||[],item:g.data,collapsed:e.collapsed,class:o.normalizeClass({"menu-item-entering":g.data.entering,"menu-item-leaving":g.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),hh=o.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Hn(),l=o.ref(),s=o.ref(0);let c=null;o.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(c=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),c.observe(l.value))});const d=o.computed(()=>{const g=[];let p=0,m=0;const y=n.menuList.length;return n.menuList.forEach(v=>{m++;const w=(vt(v.label)||0)+32+16+4+8;p+=w,(m===y&&p<=s.value||m<y&&p+56<=s.value)&&g.push(v)}),g.length<n.menuList.length&&g.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),g}),u=o.computed(()=>{const g=[];let p=0;const m=d.value.length;return n.menuList.forEach(y=>{p++,p>=m&&g.push(y)}),g}),f=o.computed(()=>{const g=i.value?.pid?.split(".")||[];return(g.length>1&&u.value.findIndex(p=>p.value===g[1])>-1||u.value.findIndex(p=>p.value===i.value?.value)>-1)&&g.push("moreId"),g}),h=g=>{a("click",g)};return jr({getHMoreMenus:u}),o.onUnmounted(()=>{c&&l.value&&(c.unobserve(l.value),c.disconnect(),c=null)}),(g,p)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"menuRef",ref:l,class:o.normalizeClass(["j-menu-horizontal",{"j-menu-dark":o.unref(r)==="dark"}])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.value,m=>(o.openBlock(),o.createBlock($o,{key:m.value,"parent-actives":f.value,item:m,"is-horizontal":"",onClick:h},null,8,["parent-actives","item"]))),128))],2))}}),ph=o.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Hn(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=o.computed(()=>(n.menuList.forEach((g,p)=>{g.color=l[p%l.length]}),n.menuList)),c=o.computed(()=>i.value?.pid?.split(".")||[]),d=g=>{a("click",g)},{list:u,containerProps:f,wrapperProps:h}=Va.useVirtualList(s,{itemHeight:96});return(g,p)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({class:["j-menu-vertical",{"j-menu-dark":o.unref(r)==="dark"}]},o.unref(f)),[o.createElementVNode("div",o.normalizeProps(o.guardReactiveProps(o.unref(h))),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(u),m=>(o.openBlock(),o.createBlock($o,{key:m.data.value,"parent-actives":c.value,item:m.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),_l=ne(o.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 n=e,a=t;let i={};const r=o.ref("");r.value=n.activeId||"";const l=(m,y,v,w,C)=>{v=v||[];for(let x=0,S=v.length;x<S;x++){const b=v[x],_={};_.pid=y,_.indent=w,r.value===b.value&&(_.active=!0),Object.keys(b).forEach(T=>{T!=="children"&&(_[T]=b[T])}),C&&C.includes(b.value)&&(_.open=!0),m.push(_);const E=b.children||[];E.length>0&&(_.hasChildren=!0,C||(i[_.value]=E),(!C||_.open&&!n.collapsed)&&l(m,`${y}.${_.value}`,E,w+1,C))}},s=(m,y)=>{const v=[];return l(v,"0",m,0,y),v},c=o.ref([]);let d=[];const u=()=>{i={},d=s(n.menus);const m=[];if(r.value&&n.mode==="inline"){const y=d.find(v=>v.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(n.menus,m)};o.watch(()=>n.menus,()=>{u()},{immediate:!0}),o.watch(()=>n.mode,()=>{u()});const f=()=>{if(c.value.find(y=>y.active)?.value!==r.value){const y=d.find(v=>v.value===r.value);if(y){const v=[];n.mode==="inline"&&v.push(...y.pid.split(".")),c.value=s(n.menus,v)}}},h=o.computed(()=>d.find(m=>m.value===r.value));o.watch(()=>n.activeId,()=>{r.value=n.activeId||"",f()}),o.watch(()=>n.collapsed,()=>{if(n.collapsed)c.value=s(n.menus,[]);else{const m=[];if(r.value){const y=d.find(v=>v.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(n.menus,m)}});const g=o.computed(()=>n.theme),p=m=>{if(console.log(m),m.hasChildren){if(n.collapsed)return;const y=[];y.push(...m.pid.split(".")),m.open||y.push(m.value);const v=s(n.menus,y),w=new Set(c.value.map(x=>x.value)),C=new Set(v.map(x=>x.value));v.forEach(x=>{w.has(x.value)||(x.entering=!0)}),c.value.forEach(x=>{C.has(x.value)||(x.leaving=!0)}),c.value=v,setTimeout(()=>{c.value.forEach(x=>{x.entering=!1,x.leaving=!1})},300)}else{if(r.value===m.value)return;r.value=m.value,a("click",m)}};return Mr({getMenuMap:()=>i,toArray:s,activeMenu:h,activeMenuId:r,theme:g}),(m,y)=>e.mode==="inline"?(o.openBlock(),o.createBlock(fh,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:p},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(o.openBlock(),o.createBlock(hh,{key:1,"menu-list":c.value,onClick:p},null,8,["menu-list"])):(o.openBlock(),o.createBlock(ph,{key:2,"menu-list":c.value,onClick:p},null,8,["menu-list"]))}})),gh={class:"j-keyword-panel"},mh={key:0},yh={key:1,class:"columns-wrapper"},bh=o.defineComponent({name:"JKeywordPanel",__name:"keyword-panel",props:o.mergeModels({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:n}=Qe(),a=e,i=o.useModel(e,"checkAll"),r=o.useModel(e,"checkFields"),l=o.ref(!1),s=o.ref(""),c=o.computed(()=>a.columns.filter(h=>h.config?.filter?.isSearchKeyword?s.value?h.config?.label?.indexOf(s.value)!=-1:!0:!1).map(h=>({label:h.config?.label,value:h.id}))),d=()=>{i.value||(i.value=!0,l.value=!1,r.value=[])},u=h=>{h.length>0?i.value=!1:i.value=!0};return t({init:()=>{i.value?l.value=!1:l.value=!0}}),(h,g)=>{const p=o.resolveComponent("j-icon"),m=o.resolveComponent("el-input"),y=o.resolveComponent("j-checkbox");return o.openBlock(),o.createElementBlock("div",gh,[o.createElementVNode("div",{class:o.normalizeClass(["range-item",{active:i.value}]),onClick:d},[o.createElementVNode("div",null,o.toDisplayString(o.unref(n)("搜索全部")),1),i.value?(o.openBlock(),o.createBlock(p,{key:0,icon:"mdi:check"})):o.createCommentVNode("",!0)],2),o.createElementVNode("div",{class:"range-item",onClick:g[0]||(g[0]=v=>l.value=!l.value)},[o.createElementVNode("div",null,o.toDisplayString(o.unref(n)("搜索特定字段")),1),o.createVNode(p,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?(o.openBlock(),o.createElementBlock("div",mh,[o.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":g[1]||(g[1]=v=>s.value=v),modelModifiers:{trim:!0},class:"no-border background",placeholder:o.unref(n)("搜索"),clearable:""},{prefix:o.withCtx(()=>[o.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):o.createCommentVNode("",!0),l.value?(o.openBlock(),o.createElementBlock("div",yh,[o.createVNode(y,{modelValue:r.value,"onUpdate:modelValue":g[2]||(g[2]=v=>r.value=v),options:c.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):o.createCommentVNode("",!0)])}}}),vh={key:0,class:"title"},wh={class:"content"},Ch={class:"relation"},xh={style:{width:"72px"}},kh={class:"btn-wrapper"},Eh={class:"field-wrapper"},Sh={class:"buttons"},Rl=o.defineComponent({name:"JFilterPanel",__name:"filter-panel",props:o.mergeModels({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:o.mergeModels(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:n}){const{t:a}=Qe(),i=e,r=o.useModel(e,"relation"),l=o.useModel(e,"isPin"),s=o.ref([]),c=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:f.value.join(","),options:u.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:C})=>{const S=i.columns.find(E=>E.id===w)?.config||{};let b="eq",_="text";["options"].includes(S.dataType||"")?b="in":["dateTime"].includes(S.type||"")?(b="range",_="dateTime"):["number"].includes(S.type||"")&&(_="number"),C.method=b,C.type=S.valueType||_,C.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:w})=>{const x=i.columns.find(S=>S.id===w.field)?.config||{};return["options","switch","dataItem","dataView"].includes(x.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(x.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(x.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 x=i.columns.find(S=>S.id===w.field)?.config||{};if(["options","dataItem","switch"].includes(x.dataType||"")){if(["in","nin"].includes(w.method)||["eq","ne"].includes(w.method))return"j-select"}else{if(["dateTime"].includes(x.type||""))return["formula"].includes(w.method)?"j-select":"j-date";if(["number"].includes(x.type||""))return"j-number"}return"j-input"},getCompConfig:({row:w})=>{if(["empty","not_empty"].includes(w.method||""))return{display:!1};const x=i.columns.find(b=>b.id===w.field)?.config||{},S={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(w.method||"")&&(S.multiple=!0,S.collapseTags=!0,S.collapseTagsTooltip=!0),["options","dataItem"].includes(x.dataType||"")?(S.collapseTags=!0,S.collapseTagsTooltip=!0,S.dataType=x.dataType,S.dataCode=x.dataCode,S.options=x.options):["switch"].includes(x.dataType||"")?(S.options=[],S.dataType="options",x.activeValue==null?S.options.push({label:"是",value:"1"}):S.options.push({label:"是",value:x.activeValue}),x.inactiveValue==null?S.options.push({label:"否",value:"0"}):S.options.push({label:"否",value:x.inactiveValue})):["dateTime"].includes(x.type||"")&&(["formula"].includes(w.method)?(S.placeholder="",S.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"}],S.dataType="options"):(S.selectType="datetime",["range"].includes(w.method)?(S.selectType="datetimerange",S.startPlaceholder="开始时间",S.endPlaceholder="结束时间",S.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):S.placeholder="")),S},config:{style:{width:l.value?"246px":"296px",flex:l.value?"auto":"1"},appendTo:l.value?void 0:".j-filter-panel"}}];o.onMounted(()=>{s.value=i.searchFieldList});const u=o.computed(()=>i.columns.filter(w=>!w.children?.length).map(w=>({label:w.config?.label,value:w.id,dataType:w.config?.dataType,options:w.config?.options}))),f=o.computed(()=>s.value.map(w=>w.field)),h=({data:w})=>{if(f.value.includes(w.value))return;const x=i.columns.find(_=>_.id===w.value)?.config||{};let S="eq",b="text";["options","dataItem"].includes(x.dataType||"")?S="in":["dateTime"].includes(x.type||"")&&(S="range",b="dateTime"),s.value.push({field:w.value,method:S,type:x.valueType||b})},g=n,p=()=>{s.value.length=0},m=()=>{l.value?g("filter"):g("close",!0)},y=()=>{s.value.forEach(w=>{w.value=void 0}),g("filter")};return t({getSearchFields:()=>s.value}),(w,C)=>{const x=o.resolveComponent("j-icon"),S=o.resolveComponent("j-select"),b=o.resolveComponent("j-button-select"),_=o.resolveComponent("j-button"),E=o.resolveComponent("j-input-rows"),T=o.resolveComponent("el-tooltip");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-filter-panel",{"is-pin":l.value}])},[l.value?(o.openBlock(),o.createElementBlock("div",vh,[o.createVNode(x,{icon:"mdi:filter-outline"}),o.createElementVNode("div",null,o.toDisplayString(o.unref(a)("筛选")),1)])):o.createCommentVNode("",!0),o.createElementVNode("div",wh,[o.createElementVNode("div",Ch,[o.createElementVNode("div",null,o.toDisplayString(o.unref(a)("筛选出符合以下")),1),o.createElementVNode("div",xh,[o.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":C[0]||(C[0]=P=>r.value=P),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),o.createElementVNode("div",null,o.toDisplayString(o.unref(a)("条件的数据")),1)]),o.createElementVNode("div",kh,[o.createVNode(b,{label:"添加过滤条件",options:u.value,"model-value":f.value.join(","),onChange:h},null,8,["options","model-value"]),s.value.length>0?(o.openBlock(),o.createBlock(_,{key:0,type:"text",danger:"",label:"删除全部",onClick:p})):o.createCommentVNode("",!0)]),o.createElementVNode("div",Eh,[o.createVNode(E,{modelValue:s.value,"onUpdate:modelValue":C[1]||(C[1]=P=>s.value=P),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),o.createVNode(T,{placement:"bottom",content:l.value?o.unref(a)("取消固定"):o.unref(a)("固定显示")},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"pin-btn",onClick:c},[o.createVNode(x,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),o.createElementVNode("div",Sh,[o.createVNode(_,{label:o.unref(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),o.createVNode(_,{label:o.unref(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),_h={class:"j-order-panel"},Rh={class:"content"},Bh={class:"btn-wrapper"},Th={class:"field-wrapper"},Mh={class:"buttons"},Ph=o.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:n}){const{t:a}=Qe(),i=e,r=n,l=o.computed(()=>i.columns.filter(p=>!p.children?.length&&p.config?.sorter?.isNot!==!0).map(p=>({label:p.config?.label,value:p.id}))),s=o.ref([]),c=o.computed(()=>s.value.map(p=>p.value)),d=[{id:"label",type:"j-title",getCompConfig:({row:p})=>({title:p.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],u=({data:p})=>{c.value.includes(p.value)||s.value.push({label:p.label,value:p.value,sord:"ASC"})},f=p=>{s.value=JSON.parse(JSON.stringify(p))},h=()=>{r("save",JSON.parse(JSON.stringify(s.value)))},g=()=>{s.value=[],r("clear")};return t({init:f}),(p,m)=>{const y=o.resolveComponent("j-button-select"),v=o.resolveComponent("j-input-rows"),w=o.resolveComponent("j-button");return o.openBlock(),o.createElementBlock("div",_h,[o.createElementVNode("div",Rh,[o.createElementVNode("div",Bh,[o.createVNode(y,{label:"添加排序规则",options:l.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),o.createElementVNode("div",Th,[o.createVNode(v,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=C=>s.value=C),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),o.createElementVNode("div",Mh,[o.createVNode(w,{label:o.unref(a)("排序"),type:"primary",onClick:h},null,8,["label"]),s.value.length>0?(o.openBlock(),o.createBlock(w,{key:0,label:o.unref(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:g},null,8,["label"])):o.createCommentVNode("",!0)])])}}}),jh={class:"j-column-panel"},Ah={class:"content"},Vh={class:"search-wrapper"},Nh={class:"tree-wrapper"},Ih={class:"buttons"},Hh=o.defineComponent({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:n}){const{t:a}=Qe(),i=e,r=n,l=o.ref(),s=o.ref(""),c={},d=o.ref([]),u=o.ref([]),f=(b,_)=>{const E=[],T=new Map;b.forEach(B=>{T.set(B.id||"",B),c[B.id||""]=B});const P=new Set;return _&&_.length>0&&_.forEach(B=>{const H=T.get(B.id);if(H){P.add(H.id||"");const I={id:H.id||"",label:H.config?.label||H.id||"",type:H.type,display:H.config?.display!==!1};H.children&&H.children.length>0&&(I.children=f(H.children,B.children)),E.push(I)}}),b.forEach(B=>{if(!P.has(B.id||"")){const H={id:B.id||"",label:B.config?.label||B.id||"",type:B.type,display:B.config?.display!==!1};B.children&&B.children.length>0&&(H.children=f(B.children)),E.push(H)}}),E},h=(b,_)=>_.length===0?b:b.map(E=>{const T=_.some(B=>E.label.toLowerCase().includes(B.toLowerCase())),P=E.children?h(E.children,_):[];return T||P.length>0?{...E,children:P.length>0?P:E.children}:null}).filter(Boolean),g=o.computed(()=>{if(!s.value)return u.value;const b=s.value.split(/\s+/).filter(Boolean);return h(u.value,b)}),p=o.ref([]),m=o.computed(()=>{const b=new Map;if(i.columnConfig&&i.columnConfig.length>0){const _=E=>{E.forEach(T=>{b.set(T.id,T),T.children&&_(T.children)})};_(i.columnConfig)}return b}),y=()=>{const b=_=>{const E=[];return _.forEach(T=>{let P=!0;if(m.value.size>0){const B=m.value.get(T.id||"");B?P=B.display:P=T.config?.display!==!1}else P=T.config?.display!==!1;P&&(E.push(T.id||""),T.children&&E.push(...b(T.children)))}),E};p.value=b(i.columns)},v=(b,{node:_})=>{b.includes(_.id)?p.value.push(_.id):p.value=p.value.filter(T=>T!==_.id)},w=(b,_,E)=>E==="inner"?!1:b.parent===_.parent,C=()=>{const b=_=>_.map(E=>{const T={...E,display:p.value.includes(E.id)};return E.children&&(T.children=b(E.children)),T});r("save",b(u.value))},x=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",l.value){const b=l.value;b.setCheck&&b.setCheck(p.value);const _=b.$refs?.treeRef||b;_?.setCheckedKeys&&_.setCheckedKeys(p.value)}r("save",void 0)};return t({init:()=>{y(),d.value=f(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(b,_)=>{const E=o.resolveComponent("j-icon"),T=o.resolveComponent("el-input"),P=o.resolveComponent("j-tree"),B=o.resolveComponent("j-button");return o.openBlock(),o.createElementBlock("div",jh,[o.createElementVNode("div",Ah,[o.createElementVNode("div",Vh,[o.createVNode(T,{modelValue:s.value,"onUpdate:modelValue":_[0]||(_[0]=H=>s.value=H),modelModifiers:{trim:!0},placeholder:o.unref(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:o.withCtx(()=>[o.createVNode(E,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),o.createElementVNode("div",Nh,[o.createVNode(P,{ref_key:"treeRef",ref:l,list:g.value,"is-tree-data":!0,"default-checked-keys":p.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":w,check:v},null,8,["list","default-checked-keys","draggable"])])]),o.createElementVNode("div",Ih,[o.createVNode(B,{label:o.unref(a)("确定"),type:"primary",onClick:C},null,8,["label"]),o.createVNode(B,{label:o.unref(a)("重置"),icon:"mdi:restore",type:"text",onClick:x},null,8,["label"])])])}}}),Oh={class:"j-table-panel-left"},Lh={class:"j-table-panel-top"},zh={class:"j-table-panel-top-left"},$h={class:"j-table-panel-top-right"},Fh={key:0,style:{width:"200px"}},Wh={class:"j-table-panel-main"},Uh={class:"j-table-panel-loading"},Dh={class:"j-table-panel-loading-content"},Yh={class:"j-table-panel-loading-text"},Jh={key:0,class:"j-table-panel-filter-panel"},Da=ne(o.defineComponent({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},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:"操作"},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"}},emits:["select","ready"],setup(e,{expose:t,emit:n}){const{t:a}=Qe(),{openLayer:i}=On(),r=e,l=n;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=o.ref();let c=[];const d=o.ref(0),u=o.ref(1);let f=r.pageSize||100,h="";const g=o.ref(0),p=o.computed(()=>g.value>0),m=o.ref([]),y=o.ref(!1),v=o.computed(()=>r.batchButtons&&r.batchButtons.length>0),w=o.computed(()=>m.value.length>0),C=o.computed(()=>v.value&&w.value&&r.isMultiple||y.value),x=o.computed(()=>r.isPage&&!C.value);v.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const S=de=>r.rowKey?r.rowKey.split(",").map(et=>de[et.trim()]).join("::"):"",b=(de,ie)=>{if(!ie||ie.length===0)return de.filter(te=>te.config?.display!==!1).map(te=>te.children&&te.children.length>0?{...te,children:b(te.children)}:te);const et=new Map(de.map(te=>[te.id,te])),rt=[];return ie.forEach(te=>{const Le=et.get(te.id);if(Le){if(te.display){let Rn=Le;Le.children&&Le.children.length>0&&(Rn={...Le,children:b(Le.children,te.children)}),rt.push(Rn)}et.delete(te.id)}}),de.forEach(te=>{if(et.has(te.id)&&te.config?.display!==!1){let Le=te;te.children&&te.children.length>0&&(Le={...te,children:b(te.children)}),rt.push(Le)}}),rt},_=o.computed(()=>b(r.columns,Y.value)),E=o.computed(()=>br(r.columns,de=>de.config.label)),T=o.ref(""),P=o.computed(()=>E.value.some(de=>de.config?.filter?.isSearchKeyword)),B=o.ref(),H=o.ref(!0),I=o.ref([]),O=o.computed(()=>H.value?"搜索全部":`搜索范围:${E.value.filter(de=>I.value.includes(de.id)).map(de=>de.config?.label).join("、")}`),M=()=>{B.value.init()},R=o.ref(),V=o.ref(!1),L=o.ref(!1),Q=o.ref(!1),oe=o.ref([]),le=o.ref("and"),Ce=o.ref(),Ue=o.ref(!1),G=o.ref([]),Ee=()=>{Ce.value.init(G.value)},Me=de=>{G.value=de,Ue.value=!1,z()},ue=()=>{G.value=[],z()},Ve=o.ref(),De=o.ref(!1),Y=o.ref(),ae=o.computed(()=>Y.value!=null),pe=()=>{Ve.value?.init()},Ne=de=>{Y.value=de,De.value=!1},Ke=o.ref(!1),ft=()=>{Ke.value=!Ke.value},Re=()=>{m.value=[],s.value&&(s.value.setSelection?.([]),y.value&&(y.value=!1,s.value.setRecords(c)))},Lt=()=>{y.value=!y.value,y.value?s.value?.setRecords(m.value):s.value?.setRecords(c),s.value?.setSelection?.(m.value)},rn=o.computed(()=>{if(m.value.length>0&&r.isMultiple){const de=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:y.value?"全部":"仅选中",config:{type:"text"},click:Lt},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:Re}],ie=r.batchButtons.map(et=>({...et,click:()=>{et.click&&et.click({data:m.value,openLayer:i})}}));return[...de,...ie]}return r.buttons}),Ct=async()=>{g.value++;const de={};try{const ie={};ie.rel=le.value;const et=R.value?.getSearchFields?.()||oe.value;ie.cond=et.filter(te=>te.value!==void 0&&te.value!==null&&te.value!==""||["empty","not_empty"].includes(te.method)).map(te=>({field:te.field,method:te.method,value:te.value,type:te.type})),ie.cond.length>0?Q.value=!0:Q.value=!1,de.filter=ie;const rt=G.value.map(te=>te.value+" "+te.sord).join(",");if(T.value&&(de.keyword={value:T.value,fields:H.value?E.value.filter(te=>te.config?.filter?.isSearchKeyword).map(te=>te.id):o.unref(I)}),r.loadData){if(r.isPage){de.pagination={rows:f,page:u.value,sort:rt||h||r.sort||r.rowKey};const te=await r.loadData(de)||{};c=te.rows||[],d.value=te.records||0}else de.sort=rt,c=await r.loadData(de)||[],d.value=c.length;s.value.setRecords(c),v.value?(m.value=[],y.value=!1):r.rowKey&&m.value.length>0&&s.value?.setSelection?.(m.value)}}finally{g.value=Math.max(0,g.value-1)}},z=async()=>{u.value=1,await Ct()},Z=({rows:de,page:ie})=>{f=de,u.value=ie,Ct()},D=async()=>{m.value=[],y.value=!1,u.value=1,await Ct()},K=async()=>{m.value=[],y.value=!1,await Ct()},X=async()=>{await D()},se=de=>{l("ready",de)},ge=de=>{let ie=[];if(!r.isMultiple){m.value=de,l("select",de);return}if(v.value)ie=de;else if(!r.rowKey)ie=de;else{const et=new Map(de.map(te=>[S(te),te])),rt=new Map(m.value.map(te=>[S(te),te]));c.forEach(te=>{const Le=S(te);et.has(Le)?rt.set(Le,et.get(Le)):rt.delete(Le)}),ie=Array.from(rt.values())}m.value=ie,l("select",ie),y.value&&ie.length===0?(y.value=!1,s.value&&s.value.setRecords(c)):y.value&&ie.length>0&&s.value&&(s.value.setRecords(ie),s.value.setSelection?.(ie))},Be=()=>m.value||[],at=de=>{m.value=de,s.value?.setSelection?.(de)},He=()=>s.value?.getInstance?.();return o.onMounted(async()=>{r.immediate&&await K()}),t({refreshData:K,resetData:D,getSelection:Be,setSelection:at,clearSelection:()=>{Re()},getInstance:He}),(de,ie)=>{const et=o.resolveComponent("j-buttons"),rt=o.resolveComponent("j-icon"),te=o.resolveComponent("el-popover"),Le=o.resolveComponent("el-tooltip"),Rn=o.resolveComponent("el-input"),sn=o.resolveComponent("j-button"),Qi=o.resolveComponent("j-table");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-table-panel-wrapper",{fullscreen:Ke.value,"no-padding":e.noPadding||Ke.value}])},[o.createElementVNode("div",{class:o.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":Ke.value}])},[o.createElementVNode("div",Oh,[o.createElementVNode("div",Lh,[o.createElementVNode("div",zh,[o.createVNode(et,{list:rn.value},null,8,["list"])]),o.createElementVNode("div",$h,[P.value&&!C.value?(o.openBlock(),o.createElementBlock("div",Fh,[o.createVNode(Rn,{modelValue:T.value,"onUpdate:modelValue":ie[2]||(ie[2]=je=>T.value=je),modelModifiers:{trim:!0},placeholder:o.unref(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:o.withKeys(z,["enter"]),onClear:z},{prefix:o.withCtx(()=>[o.createVNode(rt,{icon:"mdi:search"})]),suffix:o.withCtx(()=>[o.createVNode(Le,{placement:"bottom",content:O.value},{default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createVNode(te,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:M,onHide:z},{reference:o.withCtx(()=>[o.createVNode(rt,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:o.withCtx(()=>[o.createVNode(bh,{ref_key:"keywordPanelRef",ref:B,"check-all":H.value,"onUpdate:checkAll":ie[0]||(ie[0]=je=>H.value=je),"check-fields":I.value,"onUpdate:checkFields":ie[1]||(ie[1]=je=>I.value=je),columns:E.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):o.createCommentVNode("",!0),!V.value&&!C.value?(o.openBlock(),o.createBlock(te,{key:1,visible:L.value,"onUpdate:visible":ie[6]||(ie[6]=je=>L.value=je),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:z},{reference:o.withCtx(()=>[o.createVNode(sn,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:o.normalizeClass({active:Q.value})},null,8,["class"])]),default:o.withCtx(()=>[o.createVNode(Rl,{ref_key:"filterPanelRef",ref:R,"is-pin":V.value,"onUpdate:isPin":ie[3]||(ie[3]=je=>V.value=je),relation:le.value,"onUpdate:relation":ie[4]||(ie[4]=je=>le.value=je),"search-field-list":oe.value,columns:E.value,onFilter:z,onClose:ie[5]||(ie[5]=je=>L.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):o.createCommentVNode("",!0),C.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Le,{key:2,placement:"bottom",content:o.unref(a)("排序")},{default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createVNode(te,{visible:Ue.value,"onUpdate:visible":ie[7]||(ie[7]=je=>Ue.value=je),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Ee},{reference:o.withCtx(()=>[o.createVNode(sn,{class:o.normalizeClass({active:G.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:o.withCtx(()=>[o.createVNode(Ph,{ref_key:"orderPanelRef",ref:Ce,columns:E.value,onSave:Me,onClear:ue},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),C.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Le,{key:3,placement:"bottom",content:o.unref(a)("显示字段")},{default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createVNode(te,{visible:De.value,"onUpdate:visible":ie[8]||(ie[8]=je=>De.value=je),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:pe},{reference:o.withCtx(()=>[o.createVNode(sn,{class:o.normalizeClass({active:ae.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:o.withCtx(()=>[o.createVNode(Hh,{ref_key:"columnPanelRef",ref:Ve,columns:e.columns,"column-config":Y.value,onSave:Ne},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),C.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Le,{key:4,placement:"bottom",content:o.unref(a)("刷新")},{default:o.withCtx(()=>[o.createVNode(sn,{type:"text",icon:"mdi:refresh",onClick:X})]),_:1},8,["content"])),o.createVNode(Le,{placement:"bottom",content:Ke.value?o.unref(a)("退出全屏"):o.unref(a)("全屏")},{default:o.withCtx(()=>[o.createVNode(sn,{type:"text",icon:Ke.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:ft},null,8,["icon"])]),_:1},8,["content"])])]),o.createElementVNode("div",Wh,[o.withDirectives(o.createElementVNode("div",Uh,[o.createElementVNode("div",Dh,[o.createVNode(rt,{icon:"mdi:loading",class:"loading-spin",size:24}),o.createElementVNode("div",Yh,o.toDisplayString(o.unref(a)("加载中")),1)])],512),[[o.vShow,p.value]]),o.createVNode(Qi,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":ie[9]||(ie[9]=je=>u.value=je),columns:_.value,"sub-columns":e.subColumns,records:o.unref(c),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":x.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,onLoadPageData:Z,onReady:se,onSelectionChanged:ge},null,8,["table-page","columns","sub-columns","records","is-tree","is-show-number","is-sub-show-number","is-multiple","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","highlight-mode","load-children"])])]),V.value&&!C.value?(o.openBlock(),o.createElementBlock("div",Jh,[o.createVNode(Rl,{ref_key:"filterPanelRef",ref:R,"is-pin":V.value,"onUpdate:isPin":ie[10]||(ie[10]=je=>V.value=je),relation:le.value,"onUpdate:relation":ie[11]||(ie[11]=je=>le.value=je),"search-field-list":oe.value,columns:E.value,onFilter:z},null,8,["is-pin","relation","search-field-list","columns"])])):o.createCommentVNode("",!0)],2)],2)}}})),Gh={class:"j-button-select"},Kh={class:"search-wraper"},qh={class:"options-wraper"},Xh=["onClick"],Bl=ne(o.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 n=e,a=t,{t:i}=Qe(),r=o.ref(""),l=o.computed(()=>r.value===""?n.options:n.options.filter(d=>(d.label||"").includes(r.value))),s=o.computed(()=>n.modelValue?(n.modelValue+"").split(",").filter(Boolean):[]),c=d=>{if(d.disabled||s.value.includes(d.value))return;const f=[...s.value,d.value].join(",");a("update:modelValue",f),a("change",{value:f,data:d})};return(d,u)=>{const f=o.resolveComponent("j-button"),h=o.resolveComponent("j-icon"),g=o.resolveComponent("el-input"),p=o.resolveComponent("el-popover");return o.openBlock(),o.createBlock(p,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:o.withCtx(()=>[o.createVNode(f,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:o.withCtx(()=>[o.createElementVNode("div",Gh,[o.createElementVNode("div",Kh,[o.createVNode(g,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=m=>r.value=m),modelModifiers:{trim:!0},placeholder:o.unref(i)("搜索"),class:"no-border",clearable:""},{prefix:o.withCtx(()=>[o.createVNode(h,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),o.createElementVNode("div",qh,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,m=>(o.openBlock(),o.createElementBlock("div",{key:m.value,class:o.normalizeClass(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:o.withModifiers(y=>c(m),["stop"])},[m.icon?(o.openBlock(),o.createBlock(h,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):o.createCommentVNode("",!0),o.createElementVNode("div",null,o.toDisplayString(o.unref(i)(m.label)),1)],10,Xh))),128))])])]),_:1},8,["width"])}}})),Zh={class:"j-tree-item-text"},Qh={key:2,class:"j-tree-item-button-group"},ep={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Tl=ne(o.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},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},pidKey:{type:String,default:"pid"},idKey:{type:String},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:n}){const a=e,i=n,{useData:r,t:l}=Qe(),{getTreeData:s,loadData:c}=r(),d=o.ref(),u=o.ref(!1),f=o.ref(""),h=o.ref([]),g={children:"children",label:"label",disabled:"disabled"},p=o.computed(()=>s?s({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),m=o.computed(()=>a.dataCode||a.dataType?p.value:a.list?o.unref(a.list):h.value),y=async()=>{u.value=!0,a.loadData&&(h.value=await a.loadData()||[]),c&&await c(a.dataType,a.dataCode),u.value=!1,o.nextTick(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},v=(O,M=!0)=>{d.value?.setCurrentKey(O,M)},w=()=>d.value?.getCurrentKey(),C=(O,M=!1)=>{d.value?.setCheckedKeys(O,M)},x=(O=!1)=>d.value?.getCheckedKeys(O),S=async(O,M,R,V)=>{if(f.value=O.value,a.nodeClickFlow&&a.runFlow){const L=JSON.parse(a.nodeClickFlow);await a.runFlow(L,{value:O.value})}a.click&&a.click(O.value,O,V)},b=(O,{checkedKeys:M,checkedNodes:R,halfCheckedKeys:V,halfCheckedNodes:L})=>{a.check&&a.check(M,{node:O,checkedNodes:R,halfCheckedKeys:V,halfCheckedNodes:L})},_=(O,M,R,V)=>{i("node-drop",O,M,R,V)},E=O=>{const M=kt(a.treeButtons);return O&&a.filterButton?a.filterButton({buttons:M,node:O}):M},{openLayer:T}=On(),P=(O,M)=>{O.config?.disabled||O.click&&O.click({data:M,openLayer:T})},B=o.ref(""),H=(O,M)=>{B.value=O?M.value:"",console.log(B.value,"row")},I=(O,M,R)=>a.allowDrop?a.allowDrop(O,M,R):!(R=="inner"&&!M.data.canInner);return o.onMounted(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),o.watch(()=>a.list,()=>{u.value=!0,o.nextTick(()=>{u.value=!1})}),o.watch(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:v,getValue:w,setCheck:C,getCheck:x}),(O,M)=>{const R=o.resolveComponent("j-icon"),V=o.resolveComponent("j-button"),L=o.resolveComponent("el-dropdown-item"),Q=o.resolveComponent("el-dropdown-menu"),oe=o.resolveComponent("el-dropdown"),le=o.resolveComponent("el-tree"),Ce=o.resolveComponent("el-empty"),Ue=o.resolveDirective("loading");return o.withDirectives((o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&m.value.length>0?(o.openBlock(),o.createBlock(le,{key:0,ref_key:"treeRef",ref:d,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":f.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:g,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":I,"expand-on-click-node":e.expandOnClickNode,onNodeClick:S,onCheck:b,onNodeDrop:_},{default:o.withCtx(({node:G})=>[o.createElementVNode("div",{class:o.normalizeClass(["j-tree-item-wraper",{"is-focus":B.value===G.data.value}])},[G.data.openIcon?(o.openBlock(),o.createBlock(R,{key:0,class:"j-tree-item-open-icon",size:18,icon:G.data.openIcon,color:G.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):o.createCommentVNode("",!0),G.data[e.iconKey]||e.defaultIcon?(o.openBlock(),o.createBlock(R,{key:1,class:"j-tree-item-default-icon",size:18,icon:G.data[e.iconKey]||e.defaultIcon||"",color:G.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):o.createCommentVNode("",!0),o.createElementVNode("div",Zh,o.toDisplayString(G.label),1),E(G.data).length?(o.openBlock(),o.createElementBlock("div",Qh,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(E(G.data),(Ee,Me)=>(o.openBlock(),o.createBlock(oe,{key:Me,trigger:"click",onVisibleChange:ue=>H(ue,G.data)},{dropdown:o.withCtx(()=>[o.createVNode(Q,null,{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Ee.children,(ue,Ve)=>(o.openBlock(),o.createBlock(L,{key:Ve,disabled:ue.disabled,divided:ue.divided,onClick:o.withModifiers(De=>P(ue,G.data),["stop"])},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"j-flex-item",style:o.normalizeStyle({color:ue.danger?"var(--j-color-danger)":ue.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ue.icon||e.buttonDefaultIcon?(o.openBlock(),o.createBlock(R,{key:0,icon:ue.icon||e.buttonDefaultIcon},null,8,["icon"])):o.createCommentVNode("",!0),o.createElementVNode("div",null,o.toDisplayString(o.unref(l)(ue.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:o.withCtx(()=>[o.createVNode(V,{icon:Ee.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):o.createCommentVNode("",!0)],2)]),_:1},8,["node-key","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"])):(o.openBlock(),o.createElementBlock("div",ep,[o.createVNode(Ce,{description:o.unref(l)(e.emptyDes)},null,8,["description"])]))],2)),[[Ue,u.value]])}}})),Ml=ne(o.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:"label"},valueKey:{default:"value"},pidKey:{default:"pid"},idKey:{default:"id"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=e,{useData:a}=Qe(),{getTreeData:i}=a(),r=o.computed(()=>(console.log(a(),i),i?i({dataType:n.dataType,dataCode:n.dataCode,labelKey:n.labelKey,valueKey:n.valueKey,pidKey:n.pidKey,idKey:n.idKey,notLoad:!1})||[]:[])),l=o.computed(()=>n.dataCode||n.dataType?r.value:n.options||[]),s=t,c=o.computed({get(){return n.modelValue},set(u){s("update:modelValue",u)}}),d=u=>{s("change",u)};return(u,f)=>{const h=o.resolveComponent("el-tree-select");return o.openBlock(),o.createBlock(h,{modelValue:c.value,"onUpdate:modelValue":f[0]||(f[0]=g=>c.value=g),data:l.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:n,style:{width:"100%"},size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:d},null,8,["modelValue","data","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}})),Pl=ne(tl),tp=uu;async function np(e,t,n){const a={...n};delete a.ruleIndex,delete a.trigger;const i=new tp({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function op(e,t,n){const a=n.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:s})=>!!i==!!l?r-s:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await np(e,t,r);if(l!=="")return{name:e,errors:l}}}function ap(e,t){const n=(r,l,s,c,d)=>{Object.keys(l).forEach(u=>{let f=u;s&&(f=`${s}.${u}`);const h=l[u],{rules:g,myGridtableId:p}=t(f,s?l:void 0,()=>c,d);if(g.length){const m=a(f,h,g);r.push(m)}p&&h.forEach(m=>{n(r,m,p,h,s?l:void 0)})})},a=(r,l,s)=>op(r,l,s);return{validateForm:async()=>{const r=o.unref(e),l=[];n(l,r,"");const s=await Promise.all(l),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}const jl=ne(o.defineComponent({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["change"],setup(e,{expose:t,emit:n}){const a=e,i=n,{useData:r,existField:l,httpGet:s,httpPost:c,success:d,warning:u,error:f,info:h,t:g}=Qe();let p;r&&(p=r());const m=z=>{f&&f(z)},y=o.ref(!1),v=o.computed(()=>a.config?.gutter||16),w=o.computed(()=>a.config?.span||24),C=o.computed(()=>a.config?.labelWidth),x=o.computed(()=>a.config?.labelPosition||"right"),S=o.computed(()=>E.length===1&&(E[0].type==="j-tabs"||E[0].type==="j-layout"||E[0].config?.isAutoWindow)),b=o.reactive({}),_=o.ref({}),E=[],T={},P=o.ref({});let B={},H={},I=[],O={};const M=z=>{y.value&&L&&(z.getTableData?z.parentData||No(L,z.id,z.getTableData):No(L,z.id,z.formData[z.id])),i("change",z)},R=z=>Io(T[z]?.type||"")&&!T[z]?.config?.notInput||T[z]?.config?.isInput,V=z=>["j-table","j-input-rows","j-input-cards"].includes(T[z]?.type||"");let L;const Q=(z,Z)=>{Object.keys(z).forEach(D=>{const K=z[D];Z&&(D=Z+"."+D),K!=null&&typeof K=="object"&&!Po(K)&&Q(K,D),b[D]=K})},oe=(z,Z)=>{let D=z.id;return D||(z.config?.table&&z.config?.field?D=`${z.config.table}.${z.config.field}`:z.config?.table?D=z.config?.table:z.config?.field&&(D=z.config?.field),Z&&V(Z)&&(D=`${Z}.${D}`)),D||Vo("j")},le=(z,Z,D,K="")=>{z.forEach(X=>{X.id=oe(X,K);const se={id:X.id,slot:X.slot,type:X.type||"",getCompType:X.getCompType,getCompConfig:X.getCompConfig,config:{},children:[]};Z.push(se);const{children:ge}=X;Ao(se,X,["children","config"]),Ao(se.config,X.config||{},[]),T[X.id]&&console.warn("有重复的组件id:"+X.id),T[X.id]=se,a.readonly===!0&&(se.config.readonly=!0);let Be=!1,at;K!==""&&V(K)&&(Be=!0,se.config=X.config||{},se.config.parentTableId=K,at=T[K]?.config?.table);const He=se.config||{};if(R(X.id))!D&&Be===!1&&(He?.defaultValue===0?b[X.id]=He?.defaultValue:b[X.id]=He?.defaultValue||void 0),He.table&&He.field?B[`${He.table}_${He.field}`.toLowerCase()]=X.id:He.field&&(Be?B[`${at}_${He.field}`.toLowerCase()]=X.id:B[`${He.field}`.toLowerCase()]=X.id);else if(Be&&He.field)B[`${at}_${He.field}`.toLowerCase()]=X.id;else if(V(X.id))!D&&!He.isSubTable&&(b[X.id]=[]),He.table&&(B[He.table.toLowerCase()||""]=X.id),He.isSubTable||I.push(se);else if(He?.defaultValue)b[X.id]=He?.defaultValue;else if(X.type==="collapse"&&He?.isExpand){const ln=[];(He?.groups||[]).forEach(de=>{ln.push(de.i)}),b[X.id]=ln}ge&&ge.length>0&&le(ge,se.children,D,se.id)})},Ce=async(z,Z)=>{y.value=!1;const D=!!Z;E.splice(0,E.length),B={},H={},I=[],L=Z,Pn(b),Pn(T),P.value={},D&&Q(Z,""),le(z,E,D),O=kt(b),o.nextTick(()=>{y.value=!0,o.nextTick(()=>{rn(a.config?.codeInit,{})})})},Ue=(z,Z,D)=>{const K=[];return Z.forEach(X=>{const se={};Object.keys(X).forEach(ge=>{if(!D||D(ge,X[ge],z)){const Be=pe(ge);if(Be?.type==="j-table")se[Be?.id||""]=Ue(ge,X[ge],D);else{let at=B[`${z}_${ge}`.toLowerCase()]||ge;at=at.indexOf(".")!==-1?at.split(".")[1]:at,se[at]=X[ge]}}}),K.push(se)}),K},G=(z,Z)=>{Object.keys(z||{}).forEach(D=>{let K=z[D];const X=pe(D);if(X===void 0)K&&(Po(K)&&(K=K[0]||{}),typeof K=="object"?Object.keys(K).forEach(se=>{if(!Z||Z(D,K[se],D)){let ge=se;D!=="main"&&(ge=`${D}_${se}`),H[ge]=D,b[B[ge.toLowerCase()]||se]=K[se]}}):b[D]=K);else if(V(X.id||"")){if(!Array.isArray(K)){console.warn("表格数据不是数组:"+D);return}K?.length>0?b[B[D.toLowerCase()]||D]=Ue(D,K,Z):b[B[D.toLowerCase()]||D]=[]}else(!Z||Z(D,K,D))&&(b[B[D.toLowerCase()]||D]=K)}),L&&Object.keys(b).forEach(D=>{const K=pe(D);(K===void 0||!["tabs","collapse"].includes(K.type||""))&&No(L,D,b[D])})},Ee=(z,Z=!1)=>{const D={};return Object.keys(z).forEach(K=>{if(K==="parentRow")return;const X=T[K];if(X){const se=X.config?.table,ge=X.config?.field;if(Z)ge?D[ge]=z[K]:D[K]=z[K];else if(V(K)){const Be=[];z[K].forEach(at=>{Be.push(Ee(at,!0))}),D[se||K]=Be}else se&&ge?(D[se]=D[se]||{},D[se][ge]=z[K]):ge&&(D[ge]=z[K])}else Z?K!=="_X_ROW_KEY"&&K!=="_isHover"&&(D[K]=z[K]):H[K]?(D[H[K]]=D[H[K]]||{},D[H[K]][K.replace(`${H[K]}_`,"")]=z[K]):D[K]=z[K]}),D},Me=(z=!0)=>z?Ee(b):b,ue=(z,Z,D,K)=>{let X=T[z];if(X==null){const ge=z.split(".");X=T[ge[ge.length-1]]||{}}if(!X)return{};const se=hn({config:{...X.config||{},...P.value[X.id||""]||{}},getCompConfig:X.getCompConfig,formData:b,getTableData:D,row:Z,pRowData:K});return se._componentId=X?.id,se},Ve=(z,Z,D,K)=>{const X=ue(z,Z,D,K);if(X.isNotRule!==!0&&X.display!==!1){const se=X.rule||[],ge=se.find(Be=>Be.type==="only");return ge&&(ge.validator=async(Be,at)=>{if(at){const He={table:Be.table,key:Be.key,keyName:Be.keyName,field:Be.field,keyValue:Be.getKeyValue?Be.getKeyValue():"",value:at,paramNames:Be.paramNames,getParams:Be.getParams,withProjectId:Be.withProjectId,getValue:Be.getValue,formData:b};if(!await l(He))throw g(Be.message)||g("数据值重复")}}),{rules:se,myGridtableId:V(X._componentId)?X._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:De}=ap(b,Ve),Y=async()=>{_.value={};const z=await De();return Object.keys(z).length>0?(_.value=z,m(`${g(T[Object.keys(z)[0]]?.config?.label)}:${g(z[Object.keys(z)[0]].msg)}`),!1):!0},ae=()=>{_.value={},Pn(b),Object.keys(O||{}).forEach(z=>{b[z]=O[z]})},pe=z=>{let Z=T[z];return Z===void 0&&B[z.toLowerCase()]&&(Z=T[B[z.toLowerCase()]]),Z},Ne=({id:z,i:Z,value:D,type:K})=>{if(K==="add")b[z].push(D);else if(K==="delete")b[z].splice(Z,1);else{const X=pe(z);X&&(X.config.parentTableId?b[X.config.parentTableId][Z][z]=D:b[z]=D)}},Ke=({id:z,i:Z})=>{const D=pe(z);if(D){if(D.config.parentTableId){const K=b[D.config.parentTableId],X=D.id?D.id.replace(`${D.config.parentTableId}.`,""):"";if(Z!=null)return(K[Z]||{})[X||""];const se=[];return K&&K.forEach(ge=>{se.push(ge[X||""])}),se}if(V(D.id||"")){const K=[];return b[D.id||""].forEach(X=>{K.push(Ee(X,!0))}),K}return b[D.id||""]}if(b[z])return b[z]},ft=async({id:z,i:Z})=>{const D=Ke({id:z,i:Z}),K=pe(z);if(K&&p?.getLabel)if(Z!==void 0){const X=D[Z],se=b[K.config.parentTableId||""][Z],ge=hn({config:K.config,getCompConfig:K.getCompConfig,formData:b,tableData:b[K.config.parentTableId||""],row:se});return await p?.getLabel({value:X,config:ge,formData:b,tableData:b[K.config.parentTableId||""],row:se})}else{const X=hn({config:K.config,getCompConfig:K.getCompConfig,formData:b});return await p?.getLabel({value:D,config:X,formData:b})}return D},Re=async(z,Z)=>p?.loadViewDataList?await p?.loadViewDataList(z,Z,!1):[],Lt=z=>(z.set=Ne,z.get=Ke,z.setFormData=G,z.getFormData=Me,z.getLabel=ft,z.getViewData=Re,z.getDateNow=Z=>La(new Date,Z||"YYYY-MM-DD HH:mm:ss"),z.httpGet=s||(()=>{console.log("当前状态不支持")}),z.httpPost=c||(()=>{console.log("当前状态不支持")}),z.loading=Z=>{jn(Z)},z.showMsg=({text:Z,type:D})=>{switch(D){case"success":d&&d(Z);break;case"warning":u&&u(Z);break;case"error":f&&f(Z);break;case"info":h&&h(Z);break;default:h&&h(Z);break}console.log("showMsg",Z,D)},z),rn=async(z,Z)=>{if(z&&z.trim()){z=`async (jcode) => {${z}}`;const{res:D,fn:K}=Ia(z);D&&await K(Lt(Z))}},Ct=(z,Z)=>{P.value[z]={...P.value[z]||{},...Z}};return a.schema&&Ce(a.schema),$a({formData:b,compsConfig:P,errorFields:_,isAutoWindow:S,gutter:v,span:w,labelWidth:C,labelPosition:x,getValue:Ke,formChange:M}),Fa({contextType:"form"}),t({init:Ce,reset:ae,validate:Y,setValue:Ne,getValue:Ke,getLabel:ft,setFormData:G,getFormData:Me,setCompConfig:Ct}),(z,Z)=>{const D=o.resolveComponent("j-form-item"),K=o.resolveComponent("el-row"),X=o.resolveComponent("el-form");return y.value?(o.openBlock(),o.createBlock(X,{key:0,class:o.normalizeClass([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":x.value,"label-width":C.value,size:e.config?.size,onSubmit:Z[0]||(Z[0]=o.withModifiers(()=>{},["prevent"]))},{default:o.withCtx(()=>[S.value?(o.openBlock(),o.createBlock(D,o.mergeProps({key:0},E[0],{"is-not-col":""}),null,16)):(o.openBlock(),o.createBlock(K,{key:1,gutter:v.value},{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(E,se=>o.createVNode(D,o.mergeProps({key:se.id,ref_for:!0},se),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):o.createCommentVNode("",!0)}}})),Al=ne(el),ip={class:"j-page"},Vl=ne(o.defineComponent({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const n=e,a=o.ref(!1),i=o.reactive([]),r={},l=o.reactive({}),s=(p,m)=>{p.forEach(y=>{y.id=y.id||Vo("c");const v={id:y.id,slot:y.slot,type:y.type||"",getCompConfig:y.getCompConfig,getCompType:y.getCompType},{children:w}=y;r[y.id]=v,v.config=[],Ao(v.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l[y.id]=y.config.defaultValue),m.push(v),w&&w.length>0&&(v.children=[],s(w,v.children))})},c=p=>{a.value=!1,i.splice(0,i.length),Pn(r),Pn(l),s(p,i),o.nextTick(()=>{a.value=!0})};n.schema&&c(n.schema);const d=new za,u=new Map,f=(p,m,y,...v)=>{if(y?.immediate){const w=u.get(p)||new Map;w.set(m,v),u.set(p,w)}return d.emit(p,m,...v)},h=(p,m)=>{d.on(p,m);const y=u.get(p);y&&(u.delete(p),y.forEach((v,w)=>{m(w,...v||[])}))},g=(p,m)=>{d.off(p,m)};return Hr({registerMethod:(p,m)=>(h(p,m),()=>{g(p,m)})}),Fa({contextType:"page"}),t({init:c,call:f,on:h,off:g}),(p,m)=>{const y=o.resolveComponent("j-comp");return o.openBlock(),o.createElementBlock("div",ip,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i,v=>(o.openBlock(),o.createBlock(y,{key:v.id,id:v.id,type:v.type,config:v.config,children:v.children},null,8,["id","type","config","children"]))),128))])}}})),Nl=ne(o.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,i=o.ref("");return o.watch(()=>n.modelValue,r=>{r?i.value=r:(i.value=Vt(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const s=o.resolveComponent("el-input");return o.openBlock(),o.createBlock(s,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=c=>i.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),rp={key:0,class:"j-panel-top"},lp=["title"],sp={style:{margin:"0","font-size":"14px"}},cp={key:1},dp={key:1,class:"j-panel-bottom"},Il=ne(o.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}=On(),n=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,i)=>{const r=o.resolveComponent("j-button"),l=o.resolveComponent("el-tooltip"),s=o.resolveComponent("j-buttons");return o.openBlock(),o.createElementBlock("div",{class:"j-block",style:o.normalizeStyle({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[o.createElementVNode("div",{class:"j-panel",style:o.normalizeStyle({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?(o.openBlock(),o.createElementBlock("div",rp,[e.notTitle?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",{key:0,class:"j-panel-top-left",title:e.title||""},[o.renderSlot(a.$slots,"title",{},()=>[o.createElementVNode("span",sp,o.toDisplayString(e.title||""),1)])],8,lp)),e.toolBtns&&e.toolBtns.length>0?(o.openBlock(),o.createElementBlock("span",cp,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.toolBtns,c=>(o.openBlock(),o.createBlock(l,{key:c.id,placement:"top",content:c.label||""},{default:o.withCtx(()=>[o.createVNode(r,o.mergeProps({ref_for:!0},c.config,{onClick:d=>n(c),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"j-panel-body",style:o.normalizeStyle(e.bodyStyle)},[o.renderSlot(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?(o.openBlock(),o.createElementBlock("div",dp,[o.createVNode(s,{list:e.bootmBtns},null,8,["list"]),o.createVNode(s,{list:e.bootmRightBtns},null,8,["list"])])):o.createCommentVNode("",!0)],4)],4)}}})),up={class:"j-input-rows"},fp={key:0,class:"j-input-rows-num"},hp={key:1,class:"j-input-rows-char"},Hl=ne(o.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:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const n=x=>x==null,a=e,i=t,{formData:r}=zt(),l=o.computed(()=>a.editConfig.isAddBtn!==!1),s=o.computed(()=>a.editConfig.addBtnText||"添加"),c=o.computed(()=>a.editConfig.buttonsAlign||"left"),d=o.computed(()=>a.editConfig.isRemoveBtn!==!1),u=o.computed(()=>a.editConfig.readonly),f=o.computed(()=>a.editConfig.drag),h=o.computed(()=>a.editConfig.isNullValue!==!1),g=o.ref(),p=["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=o.ref([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(x=>{x._i||(x._i=Vt())})):(m.value=[],i("update:modelValue",m.value)),o.watch(()=>a.modelValue,x=>{m.value=a.modelValue||[],m.value=x||[],m.value.forEach(S=>{S._i||(S._i=Vt())})},{deep:!0});const v=()=>{const x={_i:Vt()};a.columns.forEach(S=>{const b=S.config?.valueRowKey||S.id||"";b&&(x[b]=kt(S.config?.defaultValue))}),m.value.push(x),i("change",{id:a.id,value:x,data:x,formData:r,tableData:m.value,type:"add"})},w=x=>{const S=m.value[x];m.value.splice(x,1),i("change",{id:a.id,value:S,data:S,formData:r,tableData:m.value,type:"delete"})},C=x=>{i("rowChange",x)};return o.onMounted(()=>{if(!f.value||!g.value)return;const x=g.value,{initSortable:S}=_r(x,{handle:".j-input-rows-drag",onEnd:b=>{const{oldIndex:_,newIndex:E}=b;if(n(_)||n(E)||_===E||_<0||E<0)return;const T=m.value.splice(_,1)[0];m.value.splice(E,0,T),i("change",{id:a.id,value:T,data:T,formData:r,tableData:m.value,type:"sort"})}});S()}),ro({getTableData:()=>m.value,rowChange:C}),(x,S)=>{const b=o.resolveComponent("j-comp"),_=o.resolveComponent("j-icon"),E=o.resolveComponent("j-button");return o.openBlock(),o.createElementBlock("div",up,[o.createElementVNode("div",{ref_key:"inputRowsRef",ref:g,class:"j-input-rows-container"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value,(T,P)=>(o.openBlock(),o.createElementBlock("div",{key:T._i+P,class:o.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(o.openBlock(),o.createElementBlock("div",fp,o.toDisplayString(P+1),1)):o.createCommentVNode("",!0),e.showChar?(o.openBlock(),o.createElementBlock("div",hp,o.toDisplayString(p[P%26]),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.columns,B=>(o.openBlock(),o.createBlock(b,o.mergeProps({key:B.id,ref_for:!0},B,{row:T}),null,16,["row"]))),128)),f.value?(o.openBlock(),o.createBlock(_,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):o.createCommentVNode("",!0),d.value&&(h.value||m.value.length>1)&&!u.value?(o.openBlock(),o.createBlock(_,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:B=>w(P)},null,8,["onClick"])):o.createCommentVNode("",!0)],2))),128))],512),!u.value&&l.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({"text-align":c.value}),class:"j-input-rows-actions"},[l.value?(o.openBlock(),o.createBlock(E,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:v},null,8,["label"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)])}}})),pp={class:"j-input-layer"},Ol=ne(o.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:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=p=>!!(p==null||typeof p=="string"&&p.trim()===""||Array.isArray(p)&&p.length===0),a=e,i=t,r=o.ref(),l=o.ref(),s=o.ref(""),c=o.computed({get(){return a.modelValue},set(p){i("update:modelValue",p)}}),d=o.computed({get(){return n(c.value)?"":n(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(p){p||f()}});o.watch(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},f=()=>{s.value="",c.value="",i("change",{value:"",data:void 0})},h=async()=>{if(!l.value)return;const p=l.value.getSelection();if(a.isMultiSelect){const m=[],y=[];p.forEach(v=>{const w=v[a.labelKey],C=v[a.valueKey];m.push(w!=null?String(w):""),C===0||C?y.push(String(C)):y.push("")}),s.value=m.join(","),c.value=y.join(","),i("change",{value:y.join(","),data:p})}else if(p.length>0){const m=p[0],y=m[a.labelKey],v=m[a.valueKey];s.value=y!=null?String(y):"";const w=v!=null?String(v):"";c.value=w,i("change",{value:w,data:m})}else s.value="",c.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},g=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(p,m)=>{const y=o.resolveComponent("el-input");return o.openBlock(),o.createElementBlock("div",pp,[e.onlyButton?(o.openBlock(),o.createBlock(o.unref(jo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):(o.openBlock(),o.createBlock(y,{key:0,modelValue:d.value,"onUpdate:modelValue":m[0]||(m[0]=v=>d.value=v),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:f},o.createSlots({_:2},[e.readonly?void 0:{name:"append",fn:o.withCtx(()=>[o.createVNode(o.unref(jo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),o.createVNode(o.unref(Ua),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:h,onClosed:g},{default:o.withCtx(()=>[o.createVNode(o.unref(Da),{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"])])}}})),Ll=ne(o.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,n=zt(),{t:a}=Qe(),i=o.computed(()=>t.formConfig?.gutter||16),r=o.computed(()=>t.formConfig?.span||24),l=o.computed(()=>t.formConfig?.labelWidth||n.labelWidth?.value),s=o.computed(()=>t.formConfig?.labelPosition||n.labelPosition?.value||"right"),c=o.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=o.ref(!1),u=()=>{d.value=!0};return $a({...n,isAutoWindow:c,gutter:i,span:r,labelWidth:l}),(f,h)=>{const g=o.resolveComponent("j-button"),p=o.resolveComponent("j-form-item"),m=o.resolveComponent("el-row"),y=o.resolveComponent("el-form"),v=o.resolveComponent("j-dialog");return o.openBlock(),o.createElementBlock("div",null,[o.createVNode(g,o.mergeProps(f.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),o.createVNode(v,{visible:d.value,"onUpdate:visible":h[1]||(h[1]=w=>d.value=w),title:o.unref(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:o.withCtx(()=>[o.createVNode(y,{class:o.normalizeClass(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:h[0]||(h[0]=o.withModifiers(()=>{},["prevent"]))},{default:o.withCtx(()=>[c.value?(o.openBlock(),o.createBlock(p,o.normalizeProps(o.mergeProps({key:0},e.schema[0])),null,16)):(o.openBlock(),o.createBlock(m,{key:1,gutter:i.value},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.schema,w=>(o.openBlock(),o.createBlock(p,o.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"])])}}})),zl=ne(o.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 n=e,a=t,i=o.computed({get(){return n.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return o.onMounted(()=>{n.autoFocus&&!n.readonly&&setTimeout(()=>{const l=i.value===n.activeValue?n.inactiveValue:n.activeValue;i.value=l,r(l)},100)}),(l,s)=>{const c=o.resolveComponent("el-switch");return o.openBlock(),o.createBlock(c,o.mergeProps(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=d=>i.value=d),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:r}),o.createSlots({_:2},[l.$slots["active-action"]?{name:"active-action",fn:o.withCtx(()=>[o.renderSlot(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:o.withCtx(()=>[o.renderSlot(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:o.withCtx(()=>[o.renderSlot(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:o.withCtx(()=>[o.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"])}}})),$l=ne(o.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 n=t,a=d=>{n("update:modelValue",d)},i=(d,u)=>{n("tab-click",d,u)},r=d=>{n("tab-change",d)},l=d=>{n("tab-remove",d)},s=()=>{n("tab-add")},c=(d,u)=>{n("edit",d,u)};return(d,u)=>{const f=o.resolveComponent("el-tabs");return o.openBlock(),o.createBlock(f,o.mergeProps(d.$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:i,onTabChange:r,onTabRemove:l,onTabAdd:s,onEdit:c}),{default:o.withCtx(()=>[o.renderSlot(d.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),Fl=ne(o.defineComponent({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=t,a=r=>{n("update:modelValue",r)},i=r=>{n("change",r)};return(r,l)=>{const s=o.resolveComponent("el-collapse");return o.openBlock(),o.createBlock(s,o.mergeProps(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),gp={class:"j-editor"},Wl=ne(fl(o.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 n=e,a=t,i=o.ref(),r=o.ref(),l=o.shallowRef(),s=o.computed(()=>({height:typeof n.height=="number"?`${n.height}px`:n.height,overflowY:"hidden"}));let c=!1;const d=f=>{if(!f)return"";let h=f;return n.apiUrl&&n.token&&(h=h.replace(/{learun_img_api}/g,`${n.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${n.token}`)),h},u=f=>{if(!f)return"";let h=f;if(n.apiUrl){const g=`${n.apiUrl}/system/annexesfile/`;h=h.split(g).join("{learun_img_api}"),n.token&&(h=h.split(`token=${n.token}`).join("{learun_img_token}"))}return h};return o.onMounted(()=>{const f={placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,MENU_CONF:{},...n.options};f.onChange=g=>{if(c)return;const p=g.getHtml(),m=u(p);a("update:value",m),a("change",{value:m})};const h=ir.createEditor({selector:i.value,html:d(n.value),config:f,mode:"default"});l.value=h,ir.createToolbar({editor:h,selector:r.value,mode:"default"})}),o.watch(()=>n.value,f=>{const h=l.value;if(h){const g=h.getHtml(),p=d(f);u(g)!==f&&(c=!0,h.setHtml(p),c=!1)}}),o.watch(()=>n.readonly,f=>{const h=l.value;h&&(f?h.disable():h.enable())}),o.onBeforeUnmount(()=>{const f=l.value;f?.destroy()}),(f,h)=>(o.openBlock(),o.createElementBlock("div",gp,[o.createElementVNode("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),o.createElementVNode("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:o.normalizeStyle(s.value)},null,4)]))}}),[["__scopeId","data-v-179ac616"]])),mp={key:0,class:"j-map-loading"},yp=ne(o.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:n}){const a=e,i=n,r=o.ref(!0),l=o.ref();let s=null,c=null,d=null,u=null;const f=async()=>{r.value=!0;try{s=await Rr(a.mapKey)}catch(v){console.error("Failed to load Baidu Map:",v),r.value=!1;return}if(c!=null){g(a.lng,a.lat),r.value=!1;return}if(!l.value)return;c=new s.Map(l.value,{enableMapClick:!1});const y=new s.Point(121.480248,31.236276);c.centerAndZoom(y,17),d=new s.Marker(y,{enableDragging:!0}),c.addOverlay(d),d.addEventListener("dragend",v=>{h(v.point)}),c.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",v=>{h(v.point)}),u.addEventListener("locationError",v=>{alert(v.message)}),c.addControl(u),c.addEventListener("click",v=>{h(v.point)}),c.enableScrollWheelZoom(!0),g(a.lng,a.lat),r.value=!1},h=y=>{new s.Geocoder().getLocation(y,w=>{d.setPosition(y),c.panTo(y),i("update:address",w.address),i("update:lng",y.lng),i("update:lat",y.lat),i("change",{value:{address:w.address,lng:y.lng,lat:y.lat}})})},g=(y,v)=>{if(y&&v&&s){const w=new s.Point(y,v);d&&d.setPosition(w),c&&c.panTo(w)}};let p=null;return t({setPoint:g,querySearchAsync:(y,v)=>{!c||!s||(p||(p=new s.LocalSearch(c,{onSearchComplete:w=>{const C=[];if(w){const x=w.getCurrentNumPois();for(let S=0;S<x;S++)C.push(w.getPoi(S))}v(C)}})),p.search(y))}}),o.onMounted(()=>{f()}),(y,v)=>(o.openBlock(),o.createElementBlock("div",{class:"j-map",style:o.normalizeStyle({height:e.height})},[r.value?(o.openBlock(),o.createElementBlock("div",mp,[o.createVNode(fn,{icon:"mdi:loading",class:"is-loading",size:30})])):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}));function Ul(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function zn(e){return e.originalEvent||e.srcEvent}function Ya(e){Ul(e),Ul(zn(e))}function $n(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 Dl=1500;function Yl(e,t,n){var a=this,i=n.get("dragging",!1);function r(l){if(!l.hover){var s=l.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(l.stopPropagation(),i.hover({element:d,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(l){t.once("drag.move",Dl,function(s){r(s)})}),(function(){var l,s;t.on("element.hover",function(c){l=c.gfx,s=c.element}),t.on("element.hover",Dl,function(c){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,c;if(l instanceof MouseEvent)return s=$n(l),c=document.elementFromPoint(s.x,s.y),bp(c)}}Yl.$inject=["elementRegistry","eventBus","injector"];function bp(e){return F.closest(e,"svg, .djs-element",!0)}const vp={__init__:["hoverFix"],hoverFix:["type",Yl]};function Jl(){return/mac/i.test(navigator.platform)}function Gl(e,t){return(zn(e)||e).button===t}function $t(e){return Gl(e,0)}function wp(e){return Gl(e,1)}function Kl(e){var t=zn(e)||e;return $t(e)?Jl()?t.metaKey:t.ctrlKey:!1}function Ja(e){var t=zn(e)||e;return $t(e)&&t.shiftKey}function so(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Cp(e){return["M",e.x,e.y]}function Ga(e){return["L",e.x,e.y]}function xp(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function kp(e,t){const n=e.length,a=[Cp(e[0])];for(let i=1;i<n;i++){const r=e[i-1],l=e[i],s=e[i+1];if(!s||!t){a.push(Ga(l));continue}const c=Math.min(t,Ka(l.x-r.x,l.y-r.y),Ka(s.x-l.x,s.y-l.y));if(!c){a.push(Ga(l));continue}const d=Fo(l,r,c),u=Fo(l,r,c*.5),f=Fo(l,s,c),h=Fo(l,s,c*.5);a.push(Ga(d)),a.push(xp(u,h,f))}return a}function Fo(e,t,n){const a=t.x-e.x,i=t.y-e.y,r=Ka(a,i),l=n/r;return{x:e.x+a*l,y:e.y+i*l}}function Ka(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function qa(e,t,n){k.isNumber(t)&&(n=t,t=null),t||(t={});const a=j.create("path",t);return k.isNumber(n)&&(a.dataset.cornerRadius=String(n)),ql(a,e)}function ql(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return j.attr(e,{d:so(kp(t,n))}),e}function Ep(e){return!0}function Wo(e){return $t(e)||wp(e)}var Xl=500;function Zl(e,t,n){var a=this;function i(E,T,P){if(!s(E,T)){var B,H,I;P?H=t.getGraphics(P):(B=T.delegateTarget||T.target,B&&(H=B,P=t.get(H))),!(!H||!P)&&(I=e.fire(E,{element:P,gfx:H,originalEvent:T}),I===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function l(E){return r[E]}function s(E,T){var P=d[E]||$t;return!P(T)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},d={"element.contextmenu":Ep,"element.mousedown":Wo,"element.mouseup":Wo,"element.click":Wo,"element.dblclick":Wo};function u(E,T,P){var B=c[E];if(!B)throw new Error("unmapped DOM event name <"+E+">");return i(B,T,P)}var f="svg, .djs-element";function h(E,T,P,B){var H=r[P]=function(I){i(P,I)};B&&(d[P]=B),H.$delegate=F.delegate.bind(E,f,T,H)}function g(E,T,P){var B=l(P);B&&F.delegate.unbind(E,T,B.$delegate)}function p(E){k.forEach(c,function(T,P){h(E,P,T)})}function m(E){k.forEach(c,function(T,P){g(E,P,T)})}e.on("canvas.destroy",function(E){m(E.svg)}),e.on("canvas.init",function(E){p(E.svg)}),e.on(["shape.added","connection.added"],function(E){var T=E.element,P=E.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:P})}),e.on(["shape.changed","connection.changed"],Xl,function(E){var T=E.element,P=E.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:P})}),e.on("interactionEvents.createHit",Xl,function(E){var T=E.element,P=E.gfx;a.createDefaultHit(T,P)}),e.on("interactionEvents.updateHit",function(E){var T=E.element,P=E.gfx;a.updateDefaultHit(T,P)});var y=S("djs-hit djs-hit-stroke"),v=S("djs-hit djs-hit-click-stroke"),w=S("djs-hit djs-hit-all"),C=S("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":v,stroke:y,"no-move":C};function S(E,T){return T=k.assign({stroke:"white",strokeWidth:15},T||{}),n.cls(E,["no-fill","no-border"],T)}function b(E,T){var P=x[T];if(!P)throw new Error("invalid hit type <"+T+">");return j.attr(E,P),E}function _(E,T){j.append(E,T)}this.removeHits=function(E){var T=F.queryAll(".djs-hit",E);k.forEach(T,j.remove)},this.createDefaultHit=function(E,T){var P=E.waypoints,B=E.isFrame,H;return P?this.createWaypointsHit(T,P):(H=B?"stroke":"all",this.createBoxHit(T,H,{width:E.width,height:E.height}))},this.createWaypointsHit=function(E,T){var P=qa(T);return b(P,"stroke"),_(E,P),P},this.createBoxHit=function(E,T,P){P=k.assign({x:0,y:0},P);var B=j.create("rect");return b(B,T),j.attr(B,P),_(E,B),B},this.updateDefaultHit=function(E,T){var P=F.query(".djs-hit",T);if(P)return E.waypoints?ql(P,E.waypoints):j.attr(P,{width:E.width,height:E.height}),P},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=h,this.unregisterEvent=g}Zl.$inject=["eventBus","elementRegistry","styles"];const Xa={__init__:["interactionEvents"],interactionEvents:["type",Zl]};function Fn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;n.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){n.select(null)})}Fn.$inject=["eventBus","canvas"],Fn.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(n!==-1){var a=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Fn.prototype.get=function(){return this._selectedElements},Fn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Fn.prototype.select=function(e,t){var n=this._selectedElements,a=n.slice();k.isArray(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){var s=i.findRoot(l);return r===s}),t?k.forEach(e,function(l){n.indexOf(l)===-1&&n.push(l)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:n})};var Ql="hover",es="selected";function ts(e,t){this._canvas=e;function n(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){n(i.element,Ql)}),t.on("element.out",function(i){a(i.element,Ql)}),t.on("selection.changed",function(i){function r(d){a(d,es)}function l(d){n(d,es)}var s=i.oldSelection,c=i.newSelection;k.forEach(s,function(d){c.indexOf(d)===-1&&r(d)}),k.forEach(c,function(d){s.indexOf(d)===-1&&l(d)})})}ts.$inject=["canvas","eventBus"];function ns(e,t,n,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,s=r.elements,c=r.hints||{},d=c.autoSelect;if(l){if(d===!1)return;k.isArray(d)?t.select(d):t.select(s.filter(Sp))}}),e.on("connect.end",500,function(i){var r=i.context,l=r.connection;l&&t.select(l)}),e.on("shape.move.end",500,function(i){var r=i.previousSelection||[],l=a.get(i.context.shape.id),s=k.find(r,function(c){return l.id===c.id});s||t.select(l)}),e.on("element.click",function(i){if($t(i)){var r=i.element;r===n.getRootElement()&&(r=null);var l=t.isSelected(r),s=t.get().length>1,c=Ja(i);if(l&&s)return c?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,c)}})}ns.$inject=["eventBus","selection","canvas","elementRegistry"];function Sp(e){return!e.hidden}const Wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Xa],selection:["type",Fn],selectionVisuals:["type",ts],selectionBehavior:["type",ns]};var _p=/^djs-cursor-.*$/;function Za(e){var t=F.classes(document.body);t.removeMatching(_p),e&&t.add("djs-cursor-"+e)}function os(){Za(null)}var Rp=5e3;function as(e,t){t=t||"element.click";function n(){return!1}return e.once(t,Rp,n),function(){e.off(t,n)}}function is(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Un(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rs(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function ls(e,t){return e=k.isArray(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Dn=Math.round,ss="djs-drag-active";function pn(e){e.preventDefault()}function Bp(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Tp(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function cs(e,t,n,a){var i={threshold:5,trapClick:!0},r;function l(C){var x=t.viewbox(),S=t._container.getBoundingClientRect();return{x:x.x+(C.x-S.left)/x.scale,y:x.y+(C.y-S.top)/x.scale}}function s(C,x){x=x||r;var S=e.createEvent(k.assign({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+C,S)===!1?!1:e.fire(x.prefix+"."+C,S)}function c(C){var x=C.filter(function(S){return a.get(S.id)});x.length&&n.select(x)}function d(C,x){var S=r.payload,b=r.displacement,_=r.globalStart,E=$n(C),T=Un(E,_),P=r.localStart,B=l(E),H=Un(B,P);if(!r.active&&(x||Tp(T)>r.threshold)){if(k.assign(S,{x:Dn(P.x+b.x),y:Dn(P.y+b.y),dx:0,dy:0},{originalEvent:C}),s("start")===!1)return y();r.active=!0,r.keepSelection||(S.previousSelection=n.get(),n.select(null)),r.cursor&&Za(r.cursor),t.addMarker(t.getRootElement(),ss)}Ya(C),r.active&&(k.assign(S,{x:Dn(B.x+b.x),y:Dn(B.y+b.y),dx:Dn(H.x),dy:Dn(H.y)},{originalEvent:C}),s("move"))}function u(C){var x,S=!0;r.active&&(C&&(r.payload.originalEvent=C,Ya(C)),S=s("end")),S===!1&&s("rejected"),x=v(S!==!0),s("ended",x)}function f(C){ls("Escape",C)&&(pn(C),y())}function h(C){var x;r.active&&(x=as(e),setTimeout(x,400),pn(C)),u(C)}function g(C){d(C)}function p(C){var x=r.payload;x.hoverGfx=C.gfx,x.hover=C.element,s("hover")}function m(C){s("out");var x=r.payload;x.hoverGfx=null,x.hover=null}function y(C){var x;if(r){var S=r.active;S&&s("cancel"),x=v(C),S&&s("canceled",x)}}function v(C){var x,S;s("cleanup"),os(),r.trapClick?S=h:S=u,F.event.unbind(document,"mousemove",d),F.event.unbind(document,"dragstart",pn),F.event.unbind(document,"selectstart",pn),F.event.unbind(document,"mousedown",S,!0),F.event.unbind(document,"mouseup",S,!0),F.event.unbind(document,"keyup",f),F.event.unbind(document,"touchstart",g,!0),F.event.unbind(document,"touchcancel",y,!0),F.event.unbind(document,"touchmove",d,!0),F.event.unbind(document,"touchend",u,!0),e.off("element.hover",p),e.off("element.out",m),t.removeMarker(t.getRootElement(),ss);var b=r.payload.previousSelection;return C!==!1&&b&&!n.get().length&&c(b),x=r,r=null,x}function w(C,x,S,b){r&&y(!1),typeof x=="string"&&(b=S,S=x,x=null),b=k.assign({},i,b||{});var _=b.data||{},E,T,P,B,H;b.trapClick?B=h:B=u,C?(E=zn(C)||C,T=$n(C),Ya(C),E.type==="dragstart"&&pn(E)):(E=null,T={x:0,y:0}),P=l(T),x||(x=P),H=Bp(E),r=k.assign({prefix:S,data:_,payload:{},globalStart:T,displacement:Un(x,P),localStart:P,isTouch:H},b),b.manual||(H?(F.event.bind(document,"touchstart",g,!0),F.event.bind(document,"touchcancel",y,!0),F.event.bind(document,"touchmove",d,!0),F.event.bind(document,"touchend",u,!0)):(F.event.bind(document,"mousemove",d),F.event.bind(document,"dragstart",pn),F.event.bind(document,"selectstart",pn),F.event.bind(document,"mousedown",B,!0),F.event.bind(document,"mouseup",B,!0)),F.event.bind(document,"keyup",f),e.on("element.hover",p),e.on("element.out",m)),s("init"),b.autoActivate&&d(C,!0)}e.on("diagram.destroy",y),this.init=w,this.move=d,this.hover=p,this.out=m,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(C){k.assign(i,C)}}cs.$inject=["eventBus","canvas","selection","elementRegistry"];const gn={__depends__:[vp,Wn],dragging:["type",cs]};function Qa(e){return e.childNodes[0]}function Uo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Uo.prototype.next=function(){return this._prefix+ ++this._counter};const Mp=new Uo("ps");var Pp=["marker-start","marker-mid","marker-end"],jp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Ft(e,t,n,a){this._elementRegistry=e,this._canvas=n,this._styles=a}Ft.$inject=["elementRegistry","eventBus","canvas","styles"],Ft.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")},Ft.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Ft.prototype.addDragger=function(e,t,n,a="djs-dragger"){n=n||this.getGfx(e);var i=j.clone(n),r=n.getBoundingClientRect();return this._cloneMarkers(Qa(i),a),j.attr(i,this._styles.cls(a,[],{x:r.top,y:r.left})),j.append(t,i),j.attr(i,"data-preview-support-element-id",e.id),i},Ft.prototype.addFrame=function(e,t){var n=j.create("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return j.append(t,n),j.attr(n,"data-preview-support-element-id",e.id),n},Ft.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,n)}),Ip(e)&&Pp.forEach(function(i){if(j.attr(e,i)){var r=Ap(e,i,a._canvas.getContainer());r&&a._cloneMarker(n,e,r,i,t)}})},Ft.prototype._cloneMarker=function(e,t,n,a,i="djs-dragger"){var r=[n.id,i,Mp.next()].join("-"),l=F.query("marker#"+n.id,e);e=e||this._canvas._svg;var s=l||j.clone(n);s.id=r,j.classes(s).add(i);var c=F.query(":scope > defs",e);c||(c=j.create("defs"),j.append(e,c)),j.append(c,s);var d=Np(s.id);j.attr(t,a,d)};function Ap(e,t,n){var a=Vp(j.attr(e,t));return F.query("marker#"+a,n||document)}function Vp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Np(e){return"url(#"+e+")"}function Ip(e){return jp.indexOf(e.nodeName)!==-1}const ei={__init__:["previewSupport"],previewSupport:["type",Ft]};function ti(e){this._commandStack=e.get("commandStack",!1)}ti.$inject=["injector"],ti.prototype.allowed=function(e,t){var n=!0,a=this._commandStack;return a&&(n=a.canExecute(e,t)),n===void 0?!0:n};const Yn={__init__:["rules"],rules:["type",ti]};function Hp(e){return k.filter(e,function(t){return!k.find(e,function(n){return n!==t&&ds(t,n)})})}function ds(e,t){if(t){if(e===t)return t;if(e.parent)return ds(e.parent,t)}}function us(e,t,n){var a=!0;return e.push(t),a}function ni(e,t,n){n=n||0,k.isArray(e)||(e=[e]),k.forEach(e,function(a,i){var r=t(a,i,n);k.isArray(r)&&r.length&&ni(r,t,n+1)})}function Op(e,t,n){var a=[],i=[];return ni(e,function(r,l,s){us(a,r);var c=r.children;if(c&&us(i,c))return c}),a}function Lp(e,t){return Op(e)}function zp(e,t,n){k.isUndefined(t)&&(t=!0),k.isObject(t)&&(n=t,t=!0),n=n||{};var a=co(n.allShapes),i=co(n.allConnections),r=co(n.enclosedElements),l=co(n.enclosedConnections),s=co(n.topLevel,t&&k.groupBy(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),a[u.source.id]&&a[u.target.id]&&(l[u.id]=r[u.id]=u),i[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)l[u.id]=i[u.id]=u;else return a[u.id]=u,k.forEach(u.incoming,c),k.forEach(u.outgoing,c),u.children}return ni(e,d),{allShapes:a,allConnections:i,topLevel:s,enclosedConnections:l,enclosedElements:r}}function _t(e,t){t=!!t,k.isArray(e)||(e=[e]);var n,a,i,r;return k.forEach(e,function(l){var s=l;l.waypoints&&!t&&(s=_t(l.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(d<a||a===void 0)&&(a=d),(c+f>i||i===void 0)&&(i=c+f),(d+u>r||r===void 0)&&(r=d+u)}),{x:n,y:a,height:r-a,width:i-n}}function $p(e,t){var n={};return k.forEach(e,function(a){var i=a;i.waypoints&&(i=_t(i)),!k.isNumber(t.y)&&i.x>t.x&&(n[a.id]=a),!k.isNumber(t.x)&&i.y>t.y&&(n[a.id]=a),i.x>t.x&&i.y>t.y&&(k.isNumber(t.width)&&k.isNumber(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y||!k.isNumber(t.width)||!k.isNumber(t.height))&&(n[a.id]=a)}),n}function Fp(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Wp(e){return!!(e&&e.isFrame)}function co(e,t){return k.assign({},e||{},t||{})}function ut(e){return k.isObject(e)&&k.has(e,"waypoints")}function Jn(e){return k.isObject(e)&&k.has(e,"labelTarget")}var Up="drop-ok",fs="drop-not-ok",hs="attach-ok",ps="new-parent",gs="create",Dp=2e3;function ms(e,t,n,a,i){function r(c,d,u,f,h){if(!d)return!1;c=k.filter(c,function(w){var C=w.labelTarget;return!w.parent&&!(Jn(w)&&c.indexOf(C)!==-1)});var g=k.find(c,function(w){return!ut(w)}),p=!1,m=!1,y=!1;bs(c)&&(p=i.allowed("shape.attach",{position:u,shape:g,target:d})),p||(bs(c)?y=i.allowed("shape.create",{position:u,shape:g,source:f,target:d}):y=i.allowed("elements.create",{elements:c,position:u,target:d}));var v=h.connectionTarget;return y||p?(g&&f&&(m=i.allowed("connection.create",{source:v===f?g:f,target:v===f?f:g,hints:{targetParent:d,targetAttach:p}})),{attach:p,connect:m}):y===null||p===null?null:!1}function l(c,d){[hs,Up,fs,ps].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var d=c.context,u=d.elements,f=c.hover,h=d.source,g=d.hints||{};if(!f){d.canExecute=!1,d.target=null;return}ys(c);var p={x:c.x,y:c.y},m=d.canExecute=f&&r(u,f,p,h,g);f&&m!==null&&(d.target=f,m&&m.attach?l(f,hs):l(f,m?ps:fs))}),n.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&l(d,null)}),n.on("create.end",function(c){var d=c.context,u=d.source,f=d.shape,h=d.elements,g=d.target,p=d.canExecute,m=p&&p.attach,y=p&&p.connect,v=d.hints||{};if(p===!1||!g)return!1;ys(c);var w={x:c.x,y:c.y};y?f=a.appendShape(u,f,w,g,{attach:m,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(h=a.createElements(h,w,g,k.assign({},v,{attach:m})),f=k.find(h,function(C){return!ut(C)})),k.assign(d,{elements:h,shape:f}),k.assign(c,{elements:h,shape:f})});function s(){var c=t.context();c&&c.prefix===gs&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],Dp,function(){n.off("elements.changed",s)})}),this.start=function(c,d,u){k.isArray(d)||(d=[d]);var f=k.find(d,function(p){return!ut(p)});if(f){u=k.assign({elements:d,hints:{},shape:f},u||{}),k.forEach(d,function(p){k.isNumber(p.x)||(p.x=0),k.isNumber(p.y)||(p.y=0)});var h=k.filter(d,function(p){return!p.hidden}),g=_t(h);k.forEach(d,function(p){ut(p)&&(p.waypoints=k.map(p.waypoints,function(m){return{x:m.x-g.x-g.width/2,y:m.y-g.y-g.height/2}})),k.assign(p,{x:p.x-g.x-g.width/2,y:p.y-g.y-g.height/2})}),t.init(c,gs,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:d,context:u}})}}}ms.$inject=["canvas","dragging","eventBus","modeling","rules"];function ys(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function bs(e){return e&&e.length===1&&!ut(e[0])}function Yp(e,t,n,a,i){var r=j.createTransform();r.setTranslate(t,n);var l=j.createTransform();l.setRotate(0,0,0);var s=j.createTransform();s.setScale(1,1),j.transform(e,[r,l,s])}function Rt(e,t,n){var a=j.createTransform();a.setTranslate(t,n),j.transform(e,a)}function Jp(e,t){var n=j.createTransform();n.setRotate(t,0,0),j.transform(e,n)}var Gp=750;function vs(e,t,n,a,i){function r(l){var s=j.create("g");j.attr(s,i.cls("djs-drag-group",["no-events"]));var c=j.create("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Qa(u),d)):(u=n._createContainer("shape",c),n.drawShape(Qa(u),d),Rt(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",Gp,function(l){var s=l.hover,c=l.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var f;s?(u.parentNode||(f=e.getActiveLayer(),j.append(f,u)),Rt(u,l.x,l.y)):j.remove(u)}),t.on("create.cleanup",function(l){var s=l.context,c=s.dragGroup;c&&j.remove(c)})}vs.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ws={__depends__:[gn,ei,Yn,Wn],__init__:["create","createPreview"],create:["type",ms],createPreview:["type",vs]};function uo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function oi(e,t,n,a){if(typeof a>"u"&&(a=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=uo(e,t);return Math.abs(i/r)<=a}var Kp=2;function Wt(e,t){var n=Array.from(arguments).flat();const a={x:"v",y:"h"};for(const[i,r]of Object.entries(a))if(qp(i,n))return r;return!1}function qp(e,t){const n=t[0];return k.every(t,function(a){return Math.abs(n[e]-a[e])<=Kp})}function Cs(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function ai(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Xp=/,?([a-z]),?/gi,xs=parseFloat,qe=Math,Ut=qe.PI,Bt=qe.min,Tt=qe.max,ks=qe.pow,Dt=qe.abs,Zp=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Qp=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Es=Array.isArray||function(e){return e instanceof Array};function eg(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tg(e,t){for(var n=0,a=e.length;n<a;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function ng(e){function t(){var n=Array.prototype.slice.call(arguments,0),a=n.join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return eg(i,a)?(tg(r,a),i[a]):(r.length>=1e3&&delete i[r.shift()],r.push(a),i[a]=e(...arguments),i[a])}return t}function og(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},n=[];return String(e).replace(Zp,function(a,i,r){var l=[],s=i.toLowerCase();for(r.replace(Qp,function(c,d){d&&l.push(+d)}),s=="m"&&l.length>2&&(n.push([i,...l.splice(0,2)]),s="l",i=i=="m"?"l":"L");l.length>=t[s]&&(n.push([i,...l.splice(0,t[s])]),!!t[s]););}),n.toString=ri,n}function ag(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function ig(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function ii(e,t,n,a){return arguments.length===1&&(t=e.y,n=e.width,a=e.height,e=e.x),{x:e,y:t,width:n,height:a,x2:e+n,y2:t+a}}function ri(){return this.join(",").replace(Xp,"$1")}function rg(e){for(var t=new Array(e.length),n=0,a=e.length;n<a;n++)for(var i=e[n],r=t[n]=new Array(i.length),l=0,s=i.length;l<s;l++)r[l]=i[l];return t.toString=ri,t}function Ss(e,t,n,a,i,r,l,s,c){var d=1-c,u=ks(d,3),f=ks(d,2),h=c*c,g=h*c,p=u*e+f*3*c*n+d*3*c*c*i+g*l,m=u*t+f*3*c*a+d*3*c*c*r+g*s;return{x:Do(p),y:Do(m)}}function _s(e){var t=fg(...e);return ii(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Yt(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function lg(e,t){return e=ii(e),t=ii(t),Yt(t,e.x,e.y)||Yt(t,e.x2,e.y)||Yt(t,e.x,e.y2)||Yt(t,e.x2,e.y2)||Yt(e,t.x,t.y)||Yt(e,t.x2,t.y)||Yt(e,t.x,t.y2)||Yt(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 Rs(e,t,n,a,i){var r=-3*t+9*n-9*a+3*i,l=e*r+6*t-12*n+6*a;return e*l-3*t+3*n}function Bs(e,t,n,a,i,r,l,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var d=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],g=0,p=0;p<u;p++){var m=d*f[p]+d,y=Rs(m,e,n,i,l),v=Rs(m,t,a,r,s),w=y*y+v*v;g+=h[p]*qe.sqrt(w)}return d*g}function sg(e,t,n,a,i,r,l,s){if(!(Tt(e,n)<Bt(i,l)||Bt(e,n)>Tt(i,l)||Tt(t,a)<Bt(r,s)||Bt(t,a)>Tt(r,s))){var c=(e*a-t*n)*(i-l)-(e-n)*(i*s-r*l),d=(e*a-t*n)*(r-s)-(t-a)*(i*s-r*l),u=(e-n)*(r-s)-(t-a)*(i-l);if(u){var f=Do(c/u),h=Do(d/u),g=+f.toFixed(2),p=+h.toFixed(2);if(!(g<+Bt(e,n).toFixed(2)||g>+Tt(e,n).toFixed(2)||g<+Bt(i,l).toFixed(2)||g>+Tt(i,l).toFixed(2)||p<+Bt(t,a).toFixed(2)||p>+Tt(t,a).toFixed(2)||p<+Bt(r,s).toFixed(2)||p>+Tt(r,s).toFixed(2)))return{x:f,y:h}}}}function Do(e){return Math.round(e*1e11)/1e11}function cg(e,t,n){var a=_s(e),i=_s(t);if(!lg(a,i))return[];var r=Bs(...e),l=Bs(...t),s=Ms(e)?1:~~(r/5)||1,c=Ms(t)?1:~~(l/5)||1,d=new Array(s+1),u=new Array(c+1),f={},h=[],g,p;for(g=0;g<s+1;g++){var m=Ss(...e,g/s);d[g]={x:m.x,y:m.y,t:g/s}}for(g=0;g<c+1;g++)m=Ss(...t,g/c),u[g]={x:m.x,y:m.y,t:g/c};for(g=0;g<s;g++)for(p=0;p<c;p++){var y=d[g],v=d[g+1],w=u[p],C=u[p+1],x=Dt(v.x-y.x)<.01?"y":"x",S=Dt(C.x-w.x)<.01?"y":"x",b=sg(y.x,y.y,v.x,v.y,w.x,w.y,C.x,C.y),_;if(b){if(_=b.x.toFixed(9)+"#"+b.y.toFixed(9),f[_])continue;f[_]=!0;var E=y.t+Dt((b[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),T=w.t+Dt((b[S]-w[S])/(C[S]-w[S]))*(C.t-w.t);E>=0&&E<=1&&T>=0&&T<=1&&h.push({x:b.x,y:b.y,t1:E,t2:T})}}return h}function Ts(e,t,n){e=As(e),t=As(t);for(var a,i,r,l,s,c,d,u,f,h,g=n?0:[],p=0,m=e.length;p<m;p++){var y=e[p];if(y[0]=="M")a=s=y[1],i=c=y[2];else{y[0]=="C"?(f=[a,i,...y.slice(1)],a=f[6],i=f[7]):(f=[a,i,a,i,s,c,s,c],a=s,i=c);for(var v=0,w=t.length;v<w;v++){var C=t[v];if(C[0]=="M")r=d=C[1],l=u=C[2];else{C[0]=="C"?(h=[r,l,...C.slice(1)],r=h[6],l=h[7]):(h=[r,l,r,l,d,u,d,u],r=d,l=u);var x=cg(f,h);{for(var S=0,b=x.length;S<b;S++)x[S].segment1=p,x[S].segment2=v,x[S].bez1=f,x[S].bez2=h;g=g.concat(x)}}}}}return g}function dg(e){return Es(e)&&Es(e[0])}function ug(e){if(ag(e))return e;var t=new Array(e.length),n=0,a=0,i=0,r=0,l=0,s;e[0][0]=="M"&&(n=+e[0][1],a=+e[0][2],i=n,r=a,l++,t[0]=["M",n,a]);for(var c,d,u=l,f=e.length;u<f;u++){if(d=e[u],s=d[0],t[u]=c=new Array(d.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=+d[6]+n,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+n;break;case"M":i=+d[1]+n,r=+d[2]+a;default:for(var h=1,g=d.length;h<g;h++)c[h]=+d[h]+(h%2?n:a)}else for(var p=0,m=d.length;p<m;p++)c[p]=d[p];switch(s=s.toUpperCase(),c[0]){case"Z":n=+i,a=+r;break;case"H":n=c[1];break;case"V":a=c[1];break;case"M":i=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],a=c[c.length-1]}}return t.toString=ri,t}function Ms(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Yo(e,t,n,a){return[e,t,n,a,n,a]}function Ps(e,t,n,a,i,r){var l=.3333333333333333,s=2/3;return[l*e+s*n,l*t+s*a,l*i+s*n,l*r+s*a,i,r]}function js(e,t,n,a,i,r,l,s,c,d){var u=Ut*120/180,f=Ut/180*(+i||0),h=[],g,p=ng(function(ue,Ve,De){var Y=ue*qe.cos(De)-Ve*qe.sin(De),ae=ue*qe.sin(De)+Ve*qe.cos(De);return{x:Y,y:ae}});if(d)_=d[0],E=d[1],S=d[2],b=d[3];else{g=p(e,t,-f),e=g.x,t=g.y,g=p(s,c,-f),s=g.x,c=g.y;var m=(e-s)/2,y=(t-c)/2,v=m*m/(n*n)+y*y/(a*a);v>1&&(v=qe.sqrt(v),n=v*n,a=v*a);var w=n*n,C=a*a,x=(r==l?-1:1)*qe.sqrt(Dt((w*C-w*y*y-C*m*m)/(w*y*y+C*m*m))),S=x*n*y/a+(e+s)/2,b=x*-a*m/n+(t+c)/2,_=qe.asin(((t-b)/a).toFixed(9)),E=qe.asin(((c-b)/a).toFixed(9));_=e<S?Ut-_:_,E=s<S?Ut-E:E,_<0&&(_=Ut*2+_),E<0&&(E=Ut*2+E),l&&_>E&&(_=_-Ut*2),!l&&E>_&&(E=E-Ut*2)}var T=E-_;if(Dt(T)>u){var P=E,B=s,H=c;E=_+u*(l&&E>_?1:-1),s=S+n*qe.cos(E),c=b+a*qe.sin(E),h=js(s,c,n,a,i,0,l,B,H,[E,P,S,b])}T=E-_;var I=qe.cos(_),O=qe.sin(_),M=qe.cos(E),R=qe.sin(E),V=qe.tan(T/4),L=4/3*n*V,Q=4/3*a*V,oe=[e,t],le=[e+L*O,t-Q*I],Ce=[s+L*R,c-Q*M],Ue=[s,c];if(le[0]=2*oe[0]-le[0],le[1]=2*oe[1]-le[1],d)return[le,Ce,Ue].concat(h);h=[le,Ce,Ue].concat(h).join().split(",");for(var G=[],Ee=0,Me=h.length;Ee<Me;Ee++)G[Ee]=Ee%2?p(h[Ee-1],h[Ee],f).y:p(h[Ee],h[Ee+1],f).x;return G}function fg(e,t,n,a,i,r,l,s){for(var c=[],d=[[],[]],u,f,h,g,p,m,y,v,w=0;w<2;++w){if(w==0?(f=6*e-12*n+6*i,u=-3*e+9*n-9*i+3*l,h=3*n-3*e):(f=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,h=3*a-3*t),Dt(u)<1e-12){if(Dt(f)<1e-12)continue;g=-h/f,0<g&&g<1&&c.push(g);continue}y=f*f-4*h*u,v=qe.sqrt(y),!(y<0)&&(p=(-f+v)/(2*u),0<p&&p<1&&c.push(p),m=(-f-v)/(2*u),0<m&&m<1&&c.push(m))}for(var C=c.length,x=C,S;C--;)g=c[C],S=1-g,d[0][C]=S*S*S*e+3*S*S*g*n+3*S*g*g*i+g*g*g*l,d[1][C]=S*S*S*t+3*S*S*g*a+3*S*g*g*r+g*g*g*s;return d[0][x]=e,d[1][x]=t,d[0][x+1]=l,d[1][x+1]=s,d[0].length=d[1].length=x+2,{x0:Bt(...d[0]),y0:Bt(...d[1]),x1:Tt(...d[0]),y1:Tt(...d[1])}}function As(e){if(dg(e)||(e=og(e)),ig(e))return e;for(var t=rg(ug(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(h,g,p){var m,y;if(!h)return["C",g.x,g.y,g.x,g.y,g.x,g.y];switch(!(h[0]in{T:1,Q:1})&&(g.qx=g.qy=null),h[0]){case"M":g.X=h[1],g.Y=h[2];break;case"A":h=["C",...js(g.x,g.y,...h.slice(1))];break;case"S":p=="C"||p=="S"?(m=g.x*2-g.bx,y=g.y*2-g.by):(m=g.x,y=g.y),h=["C",m,y,...h.slice(1)];break;case"T":p=="Q"||p=="T"?(g.qx=g.x*2-g.qx,g.qy=g.y*2-g.qy):(g.qx=g.x,g.qy=g.y),h=["C",...Ps(g.x,g.y,g.qx,g.qy,h[1],h[2])];break;case"Q":g.qx=h[1],g.qy=h[2],h=["C",...Ps(g.x,g.y,h[1],h[2],h[3],h[4])];break;case"L":h=["C",...Yo(g.x,g.y,h[1],h[2])];break;case"H":h=["C",...Yo(g.x,g.y,h[1],g.y)];break;case"V":h=["C",...Yo(g.x,g.y,g.x,h[1])];break;case"Z":h=["C",...Yo(g.x,g.y,g.X,g.Y)];break}return h},i=function(h,g){if(h[g].length>7){h[g].shift();for(var p=h[g];p.length;)r[g]="A",h.splice(g++,0,["C",...p.splice(0,6)]);h.splice(g,1),d=t.length}},r=[],l="",s="",c=0,d=t.length;c<d;c++){t[c]&&(l=t[c][0]),l!="C"&&(r[c]=l,c&&(s=r[c-1])),t[c]=a(t[c],n,s),r[c]!="A"&&l=="C"&&(r[c]="C"),i(t,c);var u=t[c],f=u.length;n.x=u[f-2],n.y=u[f-1],n.bx=xs(u[f-4])||n.x,n.by=xs(u[f-3])||n.y}return t}function hg(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function fo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Te(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Vs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function pg(e){return fo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function gg(e){for(var t=e.waypoints,n=t.reduce(function(d,u,f){var h=t[f-1];if(h){var g=d[d.length-1],p=g&&g.endLength||0,m=bg(h,u);d.push({start:h,end:u,startLength:p,endLength:p+m,length:m})}return d},[]),a=n.reduce(function(d,u){return d+u.length},0),i=a/2,r=0,l=n[r];l.endLength<i;)l=n[++r];var s=(i-l.startLength)/l.length,c={x:l.start.x+(l.end.x-l.start.x)*s,y:l.start.y+(l.end.y-l.start.y)*s};return c}function Je(e){return ut(e)?gg(e):pg(e)}function Jt(e,t,n){n=n||0,k.isObject(n)||(n={x:n,y:n});var a=Te(e),i=Te(t),r=a.bottom+n.y<=i.top,l=a.left-n.x>=i.right,s=a.top-n.y>=i.bottom,c=a.right+n.x<=i.left,d=r?"top":s?"bottom":null,u=c?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function li(e,t,n){var a=mg(e,t);return a.length===1||a.length===2&&uo(a[0],a[1])<1?fo(a[0]):a.length>1?(a=k.sortBy(a,function(i){var r=Math.floor(i.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,i.segment2+"#"+r}),fo(a[n?0:a.length-1])):null}function mg(e,t){return Ts(e,t)}function yg(e){e=e.slice();for(var t=0,n,a,i;e[t];)n=e[t],a=e[t-1],i=e[t+1],uo(n,i)===0||oi(a,i,n)?e.splice(t,1):t++;return e}function bg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ns(e,t,n,a){function i(l,s){return a.allowed("connection.create",{source:l,target:s})}function r(l,s){return i(s,l)}e.on("connect.hover",function(l){var s=l.context,c=s.start,d=l.hover,u;if(s.hover=d,u=s.canExecute=i(c,d),!k.isNil(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!k.isNil(u)&&u!==!1&&(s.source=d,s.target=c)}}),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,c=s.canExecute,d=s.connectionStart,u={x:l.x,y:l.y},f=s.source,h=s.target;if(!c)return!1;var g=null,p={connectionStart:si(s)?u:d,connectionEnd:si(s)?d:u};k.isObject(c)&&(g=c),s.connection=n.connect(f,h,g,p)}),this.start=function(l,s,c,d){k.isObject(c)||(d=c,c=Je(s)),t.init(l,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}Ns.$inject=["eventBus","dragging","modeling","rules"];function si(e){var t=e.hover,n=e.source,a=e.target;return t&&n&&t===n&&n!==a}var vg=1100,wg=900,Is="connect-ok",Hs="connect-not-ok";function Os(e,t,n){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=r.canExecute,s=r.hover,c=r.source,d=r.start,u=r.startPosition,f=r.target,h=r.connectionStart||u,g=r.connectionEnd||{x:i.x,y:i.y},p=h,m=g;si(r)&&(p=g,m=h),a.drawPreview(r,l,{source:c||d,target:f||s,connectionStart:p,connectionEnd:m})}),t.on("connect.hover",wg,function(i){var r=i.context,l=i.hover,s=r.canExecute;s!==null&&n.addMarker(l,s?Is:Hs)}),t.on(["connect.out","connect.cleanup"],vg,function(i){var r=i.hover;r&&(n.removeMarker(r,Is),n.removeMarker(r,Hs))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}Os.$inject=["injector","eventBus","canvas"];const ci={__depends__:[Wn,Yn,gn],__init__:["connectPreview"],connect:["type",Ns],connectPreview:["type",Os]};var Cg=15;function Ls(e,t){var n;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 i(s){var c=n.start,d=n.button,u=$n(s),f=Un(u,c);if(!n.dragging&&xg(f)>Cg&&(n.dragging=!0,d===0&&as(e),Za("grab")),n.dragging){var h=n.last||n.start;f=Un(u,h),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function r(s){F.event.unbind(document,"mousemove",i),F.event.unbind(document,"mouseup",r),n=null,os()}function l(s){if(!F.closest(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$n(s)},F.event.bind(document,"mousemove",i),F.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}Ls.$inject=["eventBus","canvas"];function xg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const zs={__init__:["moveCanvas"],moveCanvas:["type",Ls]};function di(e){return Math.log(e)/Math.log(10)}function $s(e,t){var n=di(e.min),a=di(e.max),i=Math.abs(n)+Math.abs(a);return i/t}function kg(e,t){return Math.max(e.min,Math.min(e.max,t))}var Eg=Math.sign||function(e){return e>=0?1:-1},ui={min:.2,max:4},Fs=10,Sg=.1,_g=.75;function Mt(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=k.bind(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||_g;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Mt.$inject=["config.zoomScroll","eventBus","canvas"],Mt.prototype.scroll=function(t){this._canvas.scroll(t)},Mt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Mt.prototype.zoom=function(t,n){var a=$s(ui,Fs*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Sg&&(this._zoom(t,n,a),this._totalDelta=0)},Mt.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var a=t.ctrlKey||Jl()&&t.metaKey,i=t.shiftKey,r=-1*this._scale,l;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Eg(t.deltaY)*r,this.zoom(l,c)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},Mt.prototype.stepZoom=function(t,n){var a=$s(ui,Fs);this._zoom(t,n,a)},Mt.prototype._zoom=function(e,t,n){var a=this._canvas,i=e>0?1:-1,r=di(a.zoom()),l=Math.round(r/n)*n;l+=n*i;var s=Math.pow(10,l);a.zoom(kg(ui,s),t)},Mt.prototype.toggle=function(t){var n=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&F.event[t?"bind":"unbind"](n,"wheel",a,!1),this._enabled=t,t},Mt.prototype._init=function(e){this.toggle(e)};const Ws={__init__:["zoomScroll"],zoomScroll:["type",Mt]};function We(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)}We.$inject=["eventBus","injector"],We.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},We.prototype.canExecute=function(e,t){const n={command:e,context:t},a=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},We.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},We.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()}},We.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()}},We.prototype.register=function(e,t){this._setHandler(e,t)},We.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},We.prototype.canUndo=function(){return!!this._getUndoAction()},We.prototype.canRedo=function(){return!!this._getRedoAction()},We.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},We.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},We.prototype._internalUndo=function(e){const t=e.command,n=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},We.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const a=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return i},We.prototype._createId=function(){return this._uid++},We.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},We.prototype._internalExecute=function(e,t){const n=e.command,a=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(n,"postExecuted",e)),this._popAction()},We.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,a=n[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()),n.push(e)},We.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,a=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:k.uniqueBy("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},We.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=k.isArray(e)?e:[e],t.dirty=t.dirty.concat(e))},We.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},We.prototype._revertedAction=function(e){this._stackIdx--},We.prototype._getHandler=function(e){return this._handlerMap[e]},We.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};const Rg={commandStack:["type",We]};function mn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function Jo(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Gt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var a=e.indexOf(t);if(a!==-1){if(a===n)return;if(n!==-1)e.splice(a,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function fi(e,t){return!e||!t?-1:e.indexOf(t)}function Gn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var Bg=1e3;function it(e){this._eventBus=e}it.$inject=["eventBus"];function Tg(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}it.prototype.on=function(e,t,n,a,i,r){if((k.isFunction(t)||k.isNumber(t))&&(r=i,i=a,a=n,n=t,t=null),k.isFunction(n)&&(r=i,i=a,a=n,n=Bg),k.isObject(i)&&(r=i,i=!1),!k.isFunction(a))throw new Error("handlerFn must be a function");k.isArray(e)||(e=[e]);var l=this._eventBus;k.forEach(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");l.on(c,n,i?Tg(a,r):a,r)})},it.prototype.canExecute=Nt("canExecute"),it.prototype.preExecute=Nt("preExecute"),it.prototype.preExecuted=Nt("preExecuted"),it.prototype.execute=Nt("execute"),it.prototype.executed=Nt("executed"),it.prototype.postExecute=Nt("postExecute"),it.prototype.postExecuted=Nt("postExecuted"),it.prototype.revert=Nt("revert"),it.prototype.reverted=Nt("reverted");function Nt(e){return function(n,a,i,r,l){(k.isFunction(n)||k.isNumber(n))&&(l=r,r=i,i=a,a=n,n=null),this.on(n,e,a,i,r,l)}}var Mg=250,Us=1400;function hi(e,t,n){it.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Us,function(i){var r=i.context,l=r.shapes,s=r.validatedShapes;r.shapes=Ds(l),r.validatedShapes=Ds(s)}),a&&t.on("shape.move.start",Mg,function(i){var r=i.context,l=r.shapes,s=[];k.forEach(l,function(c){k.forEach(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),k.forEach(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",Us,function(i){var r=i.context,l=r.closure,s=l.enclosedElements,c=[];k.forEach(s,function(d){k.forEach(d.labels,function(u){s[u.id]||c.push(u)})}),l.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context,l=r.connection||r.shape;Gn(l.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,s=l.labelTarget;s&&(r.labelTargetIndex=fi(s.labels,l),r.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(Gt(s.labels,l,c),l.labelTarget=s)})}mn(hi,it),hi.$inject=["injector","eventBus","modeling"];function Ds(e){return k.filter(e,function(t){return e.indexOf(t.labelTarget)===-1})}const Pg={__init__:["labelSupport"],labelSupport:["type",hi]};function Ys(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function Js(e,t){if(t){let n=e;return Object.keys(t).forEach(a=>{n=n.replace(new RegExp(`{${a}}`,"g"),t[a])}),n}return e}function jg(e,t,n,a){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var l=this.indexOf(r);return l!==-1&&(this.splice(l,1),t.unset(r,i,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,l){var s=this.indexOf(r);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,r),s===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Ag(e){return e.__refs_collection===!0}function Vg(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Gs(e,t,n){var a=jg(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,n)})}function Ng(e,t,n){var a=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(r){if(r!==i){var l=i;i=null,l&&e.unset(l,a,n),i=r,e.set(i,a,n)}}})}function mt(e,t){if(!(this instanceof mt))return new mt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}mt.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?Gs(this,t,e):Ng(this,t,e)},mt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Ag(n)||Gs(this,t,e),n},mt.prototype.ensureBound=function(e,t){Vg(e,t)||this.bind(e,t)},mt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},mt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var pi=new mt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ks=new mt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),qs=new mt({name:"attachers",collection:!0},{name:"host"}),Xs=new mt({name:"outgoing",collection:!0},{name:"source"}),Zs=new mt({name:"incoming",collection:!0},{name:"target"});function Kn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),pi.bind(this,"parent"),Ks.bind(this,"labels"),Xs.bind(this,"outgoing"),Zs.bind(this,"incoming")}function ho(){Kn.call(this),pi.bind(this,"children"),qs.bind(this,"host"),qs.bind(this,"attachers")}mn(ho,Kn);function Qs(){Kn.call(this),pi.bind(this,"children")}mn(Qs,ho);function ec(){ho.call(this),Ks.bind(this,"labelTarget")}mn(ec,ho);function tc(){Kn.call(this),Xs.bind(this,"source"),Zs.bind(this,"target")}mn(tc,Kn);var Ig={connection:tc,shape:ho,label:ec,root:Qs};function Hg(e,t){var n=Ig[e];if(!n)throw new Error("unknown type: <"+e+">");return k.assign(new n,t)}function Og(e){return e instanceof Kn}function Kt(){this._uid=12}Kt.prototype.createRoot=function(e){return this.create("root",e)},Kt.prototype.createLabel=function(e){return this.create("label",e)},Kt.prototype.createShape=function(e){return this.create("shape",e)},Kt.prototype.createConnection=function(e){return this.create("connection",e)},Kt.prototype.create=function(e,t){return t=k.assign({},t||{}),t.id||(t.id=e+"_"+this._uid++),Hg(e,t)};const Lg={width:90,height:20};function yn(){Kt.call(this),this._translate=Js}un(yn,Kt),yn.$inject=[],yn.prototype.baseCreate=Kt.prototype.create,yn.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Fe({type:"label"},Lg,t)):this.createFlowElement(e,t)},yn.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Ys()},e==="connection"&&(t.type="myline");const{businessObject:n}=t;n.type=t.type;const a=this._getDefaultSize(n.type);return t=Fe({businessObject:n,id:n.id},a,t),this.baseCreate(e,t)},yn.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 Go(e,t){this._modeling=e,this._canvas=t}Go.$inject=["modeling","canvas"],Go.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,a=e.alignment;k.forEach(n,function(i){var r={x:0,y:0};k.isDefined(a.left)?r.x=a.left-i.x:k.isDefined(a.right)?r.x=a.right-i.width-i.x:k.isDefined(a.center)?r.x=a.center-Math.round(i.width/2)-i.x:k.isDefined(a.top)?r.y=a.top-i.y:k.isDefined(a.bottom)?r.y=a.bottom-i.height-i.y:k.isDefined(a.middle)&&(r.y=a.middle-Math.round(i.height/2)-i.y),t.moveElements([i],r,i.parent)})},Go.prototype.postExecute=function(e){};function Ko(e){this._modeling=e}Ko.$inject=["modeling"],Ko.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,n,{attach:i.attach}),e.shape=a},Ko.prototype.postExecute=function(e){var t=e.hints||{};zg(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 zg(e,t){return k.some(e.outgoing,function(n){return n.target===t})}function qo(e,t){this._canvas=e,this._layouter=t}qo.$inject=["canvas","layouter"],qo.prototype.execute=function(e){var t=e.connection,n=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!n||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},qo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Xo=Math.round;function gi(e){this._modeling=e}gi.$inject=["modeling"],gi.prototype.preExecute=function(e){var t=e.elements,n=e.parent,a=e.parentIndex,i=e.position,r=e.hints,l=this._modeling;k.forEach(t,function(f){k.isNumber(f.x)||(f.x=0),k.isNumber(f.y)||(f.y=0)});var s=k.filter(t,function(f){return!f.hidden}),c=_t(s);k.forEach(t,function(f){ut(f)&&(f.waypoints=k.map(f.waypoints,function(h){return{x:Xo(h.x-c.x-c.width/2+i.x),y:Xo(h.y-c.y-c.height/2+i.y)}})),k.assign(f,{x:Xo(f.x-c.x-c.width/2+i.x),y:Xo(f.y-c.y-c.height/2+i.y)})});var d=Hp(t),u={};k.forEach(t,function(f){if(ut(f)){u[f.id]=k.isNumber(a)?l.createConnection(u[f.source.id],u[f.target.id],a,f,f.parent||n,r):l.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,r);return}var h=k.assign({},r);d.indexOf(f)===-1&&(h.autoResize=!1),Jn(f)&&(h=k.omit(h,["attach"])),u[f.id]=k.isNumber(a)?l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||n,a,h):l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||n,h)}),e.elements=k.values(u)};var nc=Math.round;function qt(e){this._canvas=e}qt.$inject=["canvas"],qt.prototype.execute=function(e){var t=e.shape,n=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?k.assign(t,n):k.assign(t,{x:n.x-nc(t.width/2),y:n.y-nc(t.height/2)}),this._canvas.addShape(t,a,i),t},qt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function po(e){qt.call(this,e)}mn(po,qt),po.$inject=["canvas"];var $g=qt.prototype.execute;po.prototype.execute=function(e){var t=e.shape;return Wg(t),t.labelTarget=e.labelTarget,$g.call(this,e)};var Fg=qt.prototype.revert;po.prototype.revert=function(e){return e.shape.labelTarget=null,Fg.call(this,e)};function Wg(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function go(e,t){this._canvas=e,this._modeling=t}go.$inject=["canvas","modeling"],go.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Gn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Gn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})})},go.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=fi(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},go.prototype.revert=function(e){var t=e.connection,n=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,Gt(n.children,t,a),this._canvas.addConnection(t,n),t};function mi(e,t){this._modeling=e,this._elementRegistry=t}mi.$inject=["modeling","elementRegistry"],mi.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,a=e.elements;k.forEach(a,function(i){n.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function mo(e,t){this._canvas=e,this._modeling=t}mo.$inject=["canvas","modeling"],mo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Gn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Gn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})}),Gn(n.children,function(a){ut(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},mo.prototype.execute=function(e){var t=this._canvas,n=e.shape,a=n.parent;return e.oldParent=a,e.oldParentIndex=fi(a.children,n),t.removeShape(n),n},mo.prototype.revert=function(e){var t=this._canvas,n=e.shape,a=e.oldParent,i=e.oldParentIndex;return Gt(a.children,n,i),t.addShape(n,a),n};function Zo(e){this._modeling=e}Zo.$inject=["modeling"];var oc={x:"y",y:"x"};Zo.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,a=e.axis,i=e.dimension;function r(y,v){y.range.min=Math.min(v[a],y.range.min),y.range.max=Math.max(v[a]+v[i],y.range.max)}function l(y){return y[a]+y[i]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function d(y,v){var w={y:0};w[a]=y-l(v),w[a]&&(w[oc[a]]=0,t.moveElements([v],w,v.parent))}var u=n[0],f=s(n),h=n[f],g,p,m=0;k.forEach(n,function(y,v){var w,C,x;if(y.elements.length<2){v&&v!==n.length-1&&(r(y,y.elements[0]),m+=c(y.range));return}w=k.sortBy(y.elements,a),C=w[0],v===f&&(C=w[s(w)]),x=l(C),y.range=null,k.forEach(w,function(S){if(d(x,S),y.range===null){y.range={min:S[a],max:S[a]+S[i]};return}r(y,S)}),v&&v!==n.length-1&&(m+=c(y.range))}),p=Math.abs(h.range.min-u.range.max),g=Math.round((p-m)/(n.length-1)),!(g<n.length-1)&&k.forEach(n,function(y,v){var w={},C;y===u||y===h||(C=n[v-1],y.range.max=0,k.forEach(y.elements,function(x,S){w[oc[a]]=0,w[a]=C.range.max-x[a]+g,y.range.min!==x[a]&&(w[a]+=x[a]-y.range.min),w[a]&&t.moveElements([x],w,x.parent),y.range.max=Math.max(x[a]+x[i],S?y.range.max:0)}))})},Zo.prototype.postExecute=function(e){};function Qo(e,t){this._layouter=e,this._canvas=t}Qo.$inject=["layouter","canvas"],Qo.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return k.assign(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Qo.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function yi(){}yi.prototype.execute=function(e){var t=e.connection,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Jo(r.children,t),Gt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x+=n.x,l.y+=n.y,l.original&&(l.original.x+=n.x,l.original.y+=n.y)}),t},yi.prototype.revert=function(e){var t=e.connection,n=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return Jo(n.children,t),Gt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x-=r.x,l.y-=r.y,l.original&&(l.original.x-=r.x,l.original.y-=r.y)}),t};function ea(e,t,n){var a=is(t),i=is(n),r=Un(e,a),l={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return fo({x:i.x+l.x,y:i.y+l.y})}function bi(e,t,n){var a=ta(e),i=ic(a,t),r=a[0];return i.length?i[i.length-1]:ea(r.original||r,n,t)}function vi(e,t,n){var a=ta(e),i=ic(a,t),r=a[a.length-1];return i.length?i[0]:ea(r.original||r,n,t)}function wi(e,t,n){var a=ta(e),i=ac(t,n),r=a[0];return ea(r.original||r,i,t)}function Ci(e,t,n){var a=ta(e),i=ac(t,n),r=a[a.length-1];return ea(r.original||r,i,t)}function ac(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ta(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ic(e,t){var n=k.map(e,Dg);return k.filter(n,function(a){return Ug(a,t)})}function Ug(e,t){return Jt(t,e,1)==="intersect"}function Dg(e){return e.original||e}function xi(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}xi.prototype.add=function(e,t){return this.addAll([e],t)},xi.prototype.addAll=function(e,t){var n=zp(e,!!t,this);return k.assign(this,n),this};function yo(e){this._modeling=e}yo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},yo.prototype.moveClosure=function(e,t,n,a,i){var r=this._modeling,l=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===n&&(u=!0),k.forEach(l,function(f){r.moveShape(f,t,d[f.id]&&!u&&n,{recurse:!1,layout:!1})}),k.forEach(s,function(f){var h=!!l[f.source.id],g=!!l[f.target.id];c[f.id]&&h&&g?r.moveConnection(f,t,d[f.id]&&!u&&n):r.layoutConnection(f,{connectionStart:h&&wi(f,f.source,t),connectionEnd:g&&Ci(f,f.target,t)})})},yo.prototype.getClosure=function(e){return new xi().addAll(e,!0)};function na(e){this._helper=new yo(e)}na.$inject=["modeling"],na.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},na.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function bn(e){this._modeling=e,this._helper=new yo(e)}bn.$inject=["modeling"],bn.prototype.execute=function(e){var t=e.shape,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldBounds=k.pick(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Jo(r.children,t),Gt(a.children,t,i),k.assign(t,{parent:a,x:t.x+n.x,y:t.y+n.y}),t},bn.prototype.postExecute=function(e){var t=e.shape,n=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&(k.forEach(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:Ci(r,t,n)})}),k.forEach(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:wi(r,t,n)})})),a.recurse!==!1&&this.moveChildren(e)},bn.prototype.revert=function(e){var t=e.shape,n=e.oldParent,a=e.oldParentIndex,i=e.delta;return Gt(n.children,t,a),k.assign(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},bn.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},bn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function bo(e){this._modeling=e}bo.$inject=["modeling"],bo.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return k.isArray(i)&&(e.oldWaypoints=a.waypoints,a.waypoints=i),t&&(e.oldSource=a.source,a.source=t),n&&(e.oldTarget=a.target,a.target=n),a},bo.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,a=e.newTarget,i=e.dockingOrPoints,r=e.hints||{},l={};r.connectionStart&&(l.connectionStart=r.connectionStart),r.connectionEnd&&(l.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||rc(k.isArray(i)?i[0]:i)),a&&(!n||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||rc(k.isArray(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},bo.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),a&&(i.waypoints=a),i};function rc(e){return e.original||e}function It(e,t){this._modeling=e,this._rules=t}It.$inject=["modeling","rules"],It.prototype.preExecute=function(e){var t=this,n=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=e.hints||{},s;function c(p,m,y){return a.allowed("connection.reconnect",{connection:y,source:p,target:m})}var d={x:r.x,y:r.y},u={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&n.updateAttachment(s,i.host);var f;l.moveChildren!==!1&&(f=i.children.slice(),n.moveElements(f,{x:0,y:0},s,l));var h=i.incoming.slice(),g=i.outgoing.slice();k.forEach(h,function(p){var m=p.source,y=c(m,s,p);y&&t.reconnectEnd(p,s,vi(p,s,u),l)}),k.forEach(g,function(p){var m=p.target,y=c(s,m,p);y&&t.reconnectStart(p,s,bi(p,s,u),l)})},It.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},It.prototype.execute=function(e){},It.prototype.revert=function(e){},It.prototype.createShape=function(e,t,n,a){return this._modeling.createShape(e,t,n,a)},It.prototype.reconnectStart=function(e,t,n,a){this._modeling.reconnectStart(e,t,n,a)},It.prototype.reconnectEnd=function(e,t,n,a){this._modeling.reconnectEnd(e,t,n,a)};function vo(e){this._modeling=e}vo.$inject=["modeling"],vo.prototype.execute=function(e){var t=e.shape,n=e.newBounds,a=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(n.width<a.width||n.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&n.width<10||n.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},k.assign(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},vo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,a=e.oldBounds,i=e.hints||{};i.layout!==!1&&(k.forEach(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:vi(r,n,a)})}),k.forEach(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:bi(r,n,a)})}))},vo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return k.assign(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Yg(e,t){var n=[];return k.forEach(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;k.forEach(i.concat(r),function(l){var s=l.source,c=l.target;(wo(e,s)||wo(e,c)||wo(t,s)||wo(t,c))&&(wo(n,l)||n.push(l))})}),n}function wo(e,t){return e.indexOf(t)!==-1}function Jg(e,t,n){var a=e.x,i=e.y,r=e.width,l=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:a,y:i+c,width:r,height:l-c};case"s":return{x:a,y:i,width:r,height:l+c};case"w":return{x:a+s,y:i,width:r-s,height:l};case"e":return{x:a,y:i,width:r+s,height:l};default:throw new Error("unknown direction: "+t)}}function Xt(e){this._modeling=e}Xt.$inject=["modeling"],Xt.prototype.preExecute=function(e){var t=e.delta,n=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),k.forEach(i,function(s){l[s.id]=Kg(s)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(Yg(a,i),t,n,r,a,i,l)},Xt.prototype.execute=function(){},Xt.prototype.revert=function(){},Xt.prototype.moveShapes=function(e,t){var n=this;k.forEach(e,function(a){n._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Xt.prototype.resizeShapes=function(e,t,n){var a=this;k.forEach(e,function(i){var r=Jg(i,n,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Xt.prototype.updateConnectionWaypoints=function(e,t,n,a,i,r,l){var s=this,c=i.concat(r);k.forEach(e,function(d){var u=d.source,f=d.target,h=Gg(d),g=sc(n),p={};Zt(c,u)&&Zt(c,f)?(h=k.map(h,function(m){return cc(m,a,n)&&(m[g]=m[g]+t[g]),m.original&&cc(m.original,a,n)&&(m.original[g]=m.original[g]+t[g]),m}),s._modeling.updateWaypoints(d,h,{labelBehavior:!1})):(Zt(c,u)||Zt(c,f))&&(Zt(i,u)?p.connectionStart=wi(d,u,t):Zt(i,f)?p.connectionEnd=Ci(d,f,t):Zt(r,u)?p.connectionStart=bi(d,u,l[u.id]):Zt(r,f)&&(p.connectionEnd=vi(d,f,l[f.id])),s._modeling.layoutConnection(d,p))})};function lc(e){return k.assign({},e)}function Gg(e){return k.map(e.waypoints,function(t){return t=lc(t),t.original&&(t.original=lc(t.original)),t})}function sc(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function cc(e,t,n){var a=sc(n);if(/e|s/.test(n))return e[a]>t;if(/n|w/.test(n))return e[a]<t}function Zt(e,t){return e.indexOf(t)!==-1}function Kg(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function oa(e){this._modeling=e}oa.$inject=["modeling"],oa.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=dc(n),t.collapsed=!t.collapsed;var a=uc(n,t.collapsed);return[t].concat(a)},oa.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,a=t.children,i=fc(a,n);return t.collapsed=!t.collapsed,[t].concat(i)};function dc(e){var t={};return k.forEach(e,function(n){t[n.id]=n.hidden,n.children&&(t=k.assign({},t,dc(n.children)))}),t}function uc(e,t){var n=[];return k.forEach(e,function(a){a.hidden=t,n=n.concat(a),a.children&&(n=n.concat(uc(a.children,a.collapsed||t)))}),n}function fc(e,t){var n=[];return k.forEach(e,function(a){a.hidden=t[a.id],n=n.concat(a),a.children&&(n=n.concat(fc(a.children,t)))}),n}function aa(e){this._modeling=e}aa.$inject=["modeling"],aa.prototype.execute=function(e){var t=e.shape,n=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=hc(a,t),pc(n,t),t.host=n,t},aa.prototype.revert=function(e){var t=e.shape,n=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,hc(n,t),pc(a,t,i),t};function hc(e,t){return Jo(e&&e.attachers,t)}function pc(e,t,n){if(e){var a=e.attachers;a||(e.attachers=a=[]),Gt(a,t,n)}}function ki(){}ki.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ki.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function _e(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var a=this;e.on("diagram.init",function(){a.registerHandlers(n)})}_e.$inject=["eventBus","elementFactory","commandStack"],_e.prototype.getHandlers=function(){return{"shape.append":Ko,"shape.create":qt,"shape.delete":mo,"shape.move":bn,"shape.resize":vo,"shape.replace":It,"shape.toggleCollapse":oa,spaceTool:Xt,"label.create":po,"connection.create":qo,"connection.delete":go,"connection.move":yi,"connection.layout":Qo,"connection.updateWaypoints":ki,"connection.reconnect":bo,"elements.create":gi,"elements.move":na,"elements.delete":mi,"elements.distribute":Zo,"elements.align":Go,"element.updateAttachment":aa}},_e.prototype.registerHandlers=function(e){k.forEach(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},_e.prototype.moveShape=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},_e.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},_e.prototype.moveElements=function(e,t,n,a){a=a||{};var i=a.attach,r=n,l;i===!0?(l=n,r=n.parent):i===!1&&(l=null);var s={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},_e.prototype.moveConnection=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},_e.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},_e.prototype.createConnection=function(e,t,n,a,i,r){typeof n=="object"&&(r=i,i=a,a=n,n=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:n,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},_e.prototype.createShape=function(e,t,n,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,s;e=this._create("shape",e),r?(l=n.parent,s=n):l=n;var c={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape},_e.prototype.createElements=function(e,t,n,a,i){k.isArray(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:n,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},_e.prototype.createLabel=function(e,t,n,a){n=this._create("label",n);var i={labelTarget:e,position:t,parent:a||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},_e.prototype.appendShape=function(e,t,n,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:n,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},_e.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},_e.prototype.distributeElements=function(e,t,n){var a={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",a)},_e.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},_e.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},_e.prototype.replaceShape=function(e,t,n){var a={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",a),a.newShape},_e.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},_e.prototype.resizeShape=function(e,t,n,a){var i={shape:e,newBounds:t,minBounds:n,hints:a};this._commandStack.execute("shape.resize",i)},_e.prototype.createSpace=function(e,t,n,a,i){var r={delta:n,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},_e.prototype.updateWaypoints=function(e,t,n){var a={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",a)},_e.prototype.reconnect=function(e,t,n,a,i){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},_e.prototype.reconnectStart=function(e,t,n,a){a||(a={}),this.reconnect(e,t,e.target,n,k.assign(a,{docking:"source"}))},_e.prototype.reconnectEnd=function(e,t,n,a){a||(a={}),this.reconnect(e,e.source,t,n,k.assign(a,{docking:"target"}))},_e.prototype.connect=function(e,t,n,a){return this.createConnection(e,t,n||{},e.parent,a)},_e.prototype._create=function(e,t){return Og(t)?t:this._elementFactory.create(e,t)},_e.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function gc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ei(e,t){if(!e||!t||!Array.isArray(t))return!1;const n=e.type||e.businessObject&&e.businessObject.type;return t.includes(n)}function qg(e,t){Array.isArray(e)&&e.forEach(t)}function ia(e){const t=e.businessObject;if(t)return t.name||""}function Xg(e,t){const n=e.businessObject;return n.name=t,e}const Zg={height:20},mc=15;function Si(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function yc(e){return Co(e.label)}function Qg(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=em(e),r=Math.atan((a.y-n.y)/(a.x-n.x));let{x:l,y:s}=i;return Math.abs(r)<Math.PI/2?s-=mc:l+=mc,{x:l,y:s}}function em(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:n.x+(a.x-n.x)/2,y:n.y+(a.y-n.y)/2}}function bc(e){return e.waypoints?Qg(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Zg.height/2}}function Co(e){return e&&!!e.labelTarget}const tm={width:0,height:0};function vc(e,t){function n(s,c){const d=s.label||s,u=s.labelTarget||s;return Xg(d,c),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!Co(c)&&Si(c)&&!yc(c)&&!wc(d)){let h=bc(c);h={x:h.x,y:h.y+7},e.createLabel(c,h,{id:u.id+"_label",businessObject:u})}}function i(s){return s.oldLabel=ia(s.element),n(s.element,s.newLabel)}function r(s){return n(s.element,s.oldLabel)}function l(s){const{element:c,newLabel:d}=s,u=c.label||c,f=s.hints||{};let{newBounds:h}=s;if(!Co(u))return;if(Co(u)&&wc(d)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const g=ia(u);typeof h>"u"&&(h=t.getExternalLabelBounds(u,g)),h&&e.resizeShape(u,h,tm)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}vc.$inject=["modeling","textRenderer"];function wc(e){return!e||!e.trim()}function xo(e,t,n){_e.call(this,e,t,n)}un(xo,_e),xo.$inject=["eventBus","elementFactory","commandStack"],xo.prototype.getHandlers=function(){const e=_e.prototype.getHandlers.call(this);return e["element.updateLabel"]=vc,e},xo.prototype.updateLabel=function(e,t,n,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:a||{}})};function _i(e,t){it.call(this,e);function n(a){const{context:i}=a,r=i.hints||{};let l;!i.cropped&&r.createElementsBehavior!==!1&&(l=i.connection,l.waypoints=t.getCroppedWaypoints(l),i.cropped=!0)}this.executed(["connection.layout","connection.create"],n)}un(_i,it),_i.$inject=["eventBus","connectionDocking"];function Cc(){}Cc.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Je(t.source||e.source),t.connectionEnd||Je(t.target||e.target)]};var ra=20,nm=5,la=Math.round,xc=20,om={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function am(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function im(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function kc(e,t,n){var a=Jt(t,e,nm),i=n.split(":")[0],r=la((t.x-e.x)/2+e.x),l=la((t.y-e.y)/2+e.y),s,c,d=im(i,a),u=/h|r|l/.test(i),f=!1,h=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:l},c=u?"h:h":"v:v"):(f=am(a,i),c=u?"h:v":"v:h",f?u?(h=l===e.y,s={x:e.x+ra*(/l/.test(i)?-1:1),y:h?l+ra:l}):(h=r===e.x,s={x:h?r+ra:r,y:e.y+ra*(/t/.test(i)?-1:1)}):s={x:r,y:l}),{waypoints:Ri(e,s,c).concat(s),directions:c,turnNextDirections:h}}function rm(e,t,n){return kc(e,t,n)}function lm(e,t,n){var a=kc(t,e,Ec(n));return{waypoints:a.waypoints.slice().reverse(),directions:Ec(a.directions),turnNextDirections:a.turnNextDirections}}function sm(e,t){var n=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=n+":"+a,r=Ri(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:r,directions:i}}function Ec(e){return e.split(":").reverse().join(":")}function cm(e,t,n){var a=la((t.x-e.x)/2+e.x),i=la((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(n==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Ri(e,t,n){if(n=n||"h:h",!bm(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(_c(n)){var a=rm(e,t,n),i=lm(e,t,n),r=sm(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return cm(e,t,n)}function dm(e,t,n){var a=Ri(e,t,n);return a.unshift(e),a.push(t),Bc(a)}function um(e,t,n,a,i){var r=i&&i.preferredLayouts||[],l=k.without(r,"straight")[0]||"h:h",s=om[l]||0,c=Jt(e,t,s),d=ym(c,l);n=n||Je(e),a=a||Je(t);var u=d.split(":"),f=Rc(n,e,u[0],vm(c)),h=Rc(a,t,u[1],c);return dm(f,h,d)}function fm(e,t,n,a,i,r){k.isArray(n)&&(i=n,r=a,n=Je(e),a=Je(t)),r=k.assign({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts,s=l.indexOf("straight")!==-1,c;return c=s&&pm(e,t,n,a,r),c||(c=r.connectionEnd&&mm(t,e,a,i),c)||(c=r.connectionStart&&gm(e,t,n,i),c)?c:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:um(e,t,n,a,r)}function hm(e,t,n){return e>=t&&e<=n}function Sc(e,t,n){var a={x:"width",y:"height"};return hm(t[e],n[e],n[e]+n[a[e]])}function pm(e,t,n,a,i){var r={},l,s;return s=Jt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),i.preserveDocking==="target"?Sc(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:a.x,y:a.y}]):null:Sc(l,n,t)?(r[l]=n[l],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y,original:{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y}}]):null):null}function gm(e,t,n,a){return Bi(e,t,n,a)}function mm(e,t,n,a){var i=a.slice().reverse();return i=Bi(e,t,n,i),i?i.reverse():null}function Bi(e,t,n,a){function i(u){return u.length<3?!0:u.length>4?!1:!!k.find(u,function(f,h){var g=u[h-1];return g&&uo(f,g)<3})}function r(u,f,h){var g=Wt(f,u);switch(g){case"v":return{x:h.x,y:u.y};case"h":return{x:u.x,y:h.y}}return{x:u.x,y:u.y}}function l(u,f,h){var g;for(g=u.length-2;g!==0;g--)if(Cs(u[g],f,xc)||Cs(u[g],h,xc))return u.slice(g);return u}if(i(a))return null;var s=a[0],c=a.slice(),d;return c[0]=n,c[1]=r(c[1],s,n),d=l(c,e,t),d!==c&&(c=Bi(e,t,n,d)),c&&Wt(c)?null:c}function ym(e,t){if(_c(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 bm(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function _c(e){return e&&/t|r|b|l/.test(e)}function vm(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 Rc(e,t,n,a){if(n==="h"&&(n=/left/.test(a)?"l":"r"),n==="v"&&(n=/top/.test(a)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Bc(e){return e.reduce(function(t,n,a){var i=t[t.length-1],r=e[a+1];return oi(i,r,n,0)||t.push(n),t},[])}function Ti(){}un(Ti,Cc);const vn=(e,t)=>e.type===t;Ti.prototype.layoutConnection=function(e,t){t||(t={});const n=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,s,c;return l===void 0&&(r=sa(i&&i[0],n),l=sa(i&&i[i.length-1],a)),r||(r=sa(i&&i[0],n)),l||(l=sa(i&&i[i.length-1],a)),vn(e,"myline")&&(n===a?s={preferredLayouts:wm(n,e)}:vn(n,"gatewayAnd")||vn(n,"gatewayXor")||vn(n,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:vn(a,"gatewayAnd")||vn(a,"gatewayXor")||vn(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Fe(s,t),c=Bc(fm(n,a,r,l,i,s))),c||[r,l]};function sa(e,t){return e?e.original||e:Je(t)}function wm(e,t){const{waypoints:n}=t,a=n&&n.length&&Jt(n[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Tc(e){return k.assign({original:e.point.original||e.point},e.actual)}function Qt(e,t){this._elementRegistry=e,this._graphicsFactory=t}Qt.$inject=["elementRegistry","graphicsFactory"],Qt.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(Tc(a)),r.push(Tc(i)),r},Qt.prototype.getDockingPoint=function(e,t,n){var a=e.waypoints,i,r,l;return i=n?0:a.length-1,r=a[i],l=this._getIntersection(t,e,n),{point:r,actual:l||r,idx:i}},Qt.prototype._getIntersection=function(e,t,n){var a=this._getShapePath(e),i=this._getConnectionPath(t);return li(a,i,n)},Qt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Qt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Qt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Mc={__depends__:[Rg,Pg,Wn],__init__:["modeling","elementUpdater"],modeling:["type",xo],layouter:["type",Ti],elementUpdater:["type",_i],elementFactory:["type",yn],connectionDocking:["type",Qt]};var Cm=1e3;function wn(e,t){var n=this;t=t||Cm,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,s=i.gfx,c=i.attrs;if(n.canRender(l))return r==="render.shape"?n.drawShape(s,l,c):n.drawConnection(s,l,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(n.canRender(i))return a.type==="render.getShapePath"?n.getShapePath(i):n.getConnectionPath(i)})}wn.prototype.canRender=function(e){},wn.prototype.drawShape=function(e,t){},wn.prototype.drawConnection=function(e,t){},wn.prototype.getShapePath=function(e){},wn.prototype.getConnectionPath=function(e){};function xm(e){return e.businessObject}function ca(e,t){return e.businessObject.strokeWidth||t||1}function wt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ge(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function km(e){const t=e.x+e.width/2,n=e.y+e.height/2,a=e.width/2,i=[["M",t,n],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]];return so(i)}function Em(e,t){const{x:n,y:a,width:i,height:r}=e,l=[["M",n+t,a],["l",i-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-i,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return so(l)}function Sm(e){const{x:t,y:n,width:a,height:i}=e,r=a/2,l=i/2,s=[["M",t+r,n],["l",r,l],["l",-r,l],["l",-r,-l],["z"]];return so(s)}function _m(e){const{x:t,y:n,width:a,height:i}=e,r=[["M",t,n],["l",a,0],["l",0,i],["l",-a,0],["z"]];return so(r)}const Mi=10,Pi=.95,en=(e,t)=>e.type===t;function Cn(e,t,n,a,i,r,l){wn.call(this,e,l);const s="var(--j-color-bg-container)",c="var(--j-color-text)",d={};Object.keys(r.palette).forEach(M=>{const R=r.palette[M];d[R.type]=R.options});const{computeStyle:u}=t;function f(M){return O[M]}function h(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2})}function g(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2,fill:"white"})}function p(M,R,V,L){V=h(V);const Q=qa(R,V,L);return j.append(M,Q),Q}function m(M,R,V){return p(M,R,V,5)}function y(M,R,V,L,Q){gc(L)&&(Q=L,L=0),L=L||0,Q=u(Q,{stroke:c,strokeWidth:2,fill:s}),Q.fill==="none"&&delete Q.fillOpacity;const oe=R/2,le=V/2,Ce=j.create("circle");return j.attr(Ce,{cx:oe,cy:le,r:Math.round((R+V)/4-L)}),j.attr(Ce,Q),j.append(M,Ce),Ce}function v(M,R,V,L,Q,oe){gc(Q)&&(oe=Q,Q=0),Q=Q||0,oe=u(oe,{stroke:c,strokeWidth:2,fill:s});const le=j.create("rect");return j.attr(le,{x:Q,y:Q,width:R-Q*2,height:V-Q*2,rx:L,ry:L}),j.attr(le,oe),j.append(M,le),le}function w(M,R,V){V=u(V,["no-fill"],{strokeWidth:2,stroke:c});const L=j.create("path");return j.attr(L,{d:R}),j.attr(L,V),j.append(M,L),L}function C(M,R,V,L){const Q=R/2,oe=V/2,Ce=[{x:Q,y:0},{x:R,y:oe},{x:Q,y:V},{x:0,y:oe}].map(G=>G.x+","+G.y).join(" ");L=u(L,{stroke:c,strokeWidth:2,fill:s});const Ue=j.create("polygon");return j.attr(Ue,{points:Ce}),j.attr(Ue,L),j.append(M,Ue),Ue}function x(M,R,V,L){return w(R,V,Fe({"data-marker":M},L))}function S(M,R,V){V=Fe({size:{width:100}},V);const L=i.createText(R||"",V);return j.classes(L).add("djs-label"),j.append(M,L),L}function b(M,R,V){const L=xm(R);return S(M,L.name,{box:R,align:V,padding:5,style:{fill:Ge(R,c)}})}function _(M,R){const V={width:90,height:30,x:R.width/2+R.x,y:R.height/2+R.y};return S(M,ia(R),{box:V,fitBox:!0,style:Fe({},i.getExternalStyle(),{fill:Ge(R,c)})})}function E(M,R,V){const L=V&&V.indexOf("SubProcessMarker")!==-1;let Q;L?Q={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:Q={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},qg(V,oe=>{f(oe)(M,R,Q)})}function T(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function P(M,R){const{ref:V={x:0,y:0},scale:L=1,element:Q,parentGfx:oe=a._svg}=R,le=j.create("marker",{id:M,viewBox:"0 0 20 20",refX:V.x,refY:V.y,markerWidth:20*L,markerHeight:20*L,orient:"auto"});j.append(le,Q);let Ce=F.query(":scope > defs",oe);Ce||(Ce=j.create("defs"),j.append(oe,Ce)),j.append(Ce,le)}function B(M,R,V,L){const Q=R+"-"+T(V)+"-"+T(L)+"-"+Ys();return H(M,Q,R,V,L),"url(#"+Q+")"}function H(M,R,V,L,Q){{const oe=j.create("path",{d:"M 1 5 L 11 10 L 1 15 Z",...g({fill:Q,stroke:Q,strokeWidth:1})});P(R,{element:oe,ref:{x:11,y:10},scale:.5,parentGfx:M})}}function I(M,R,V,L){const Q=d[R.type]?.icon||R.icon;if(Q){const oe=n.getScaledPath(Q,{abspos:{x:V,y:L}});w(M,oe,{strokeWidth:0,fill:Ge(R,d[R.type]?.iconFill||R.iconFill)})}}const O={event(M,R,V){return"fillOpacity"in V||(V.fillOpacity=Pi),y(M,R.width,R.height,V)},startEvent(M,R){const V={fill:wt(R,d.startEvent?.fill||R.fill),stroke:Ge(R,d.startEvent?.stroke||R.stroke),strokeWidth:ca(R,d.startEvent?.strokeWidth||R.strokeWidth)},L=f("event")(M,R,V);return I(M,R,18,18),L},endEvent(M,R){const V=f("event")(M,R,{strokeWidth:ca(R,d.endEvent?.strokeWidth||R.strokeWidth||4),fill:wt(R,d.endEvent?.fill||R.fill),stroke:Ge(R,d.endEvent?.stroke||R.stroke)});return I(M,R,18,18),V},gateway(M,R){const V={fillOpacity:Pi,strokeWidth:ca(R,d[R.type]?.strokeWidth||R.strokeWidth||4),fill:wt(R,d[R.type]?.fill||R.fill),stroke:Ge(R,d[R.type]?.stroke||R.stroke)};return C(M,R.width,R.height,V)},gatewayAnd(M,R){const V=f("gateway")(M,R),L=n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[R.type]?.width||R.width,containerHeight:d[R.type]?.height||R.height,position:{mx:.47,my:.29}});return w(M,L,{strokeWidth:1,fill:Ge(R,d[R.type]?.iconFill||R.iconFill),stroke:Ge(R,d[R.type]?.iconFill||R.iconFill)}),V},gatewayXor(M,R){const V=f("gateway")(M,R),L=n.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}});return w(M,L,{strokeWidth:1,fill:Ge(R,d[R.type]?.iconFill||R.iconFill),stroke:Ge(R,d[R.type]?.iconFill||R.iconFill)}),V},gatewayInclusive(M,R){const V=f("gateway")(M,R);return y(M,R.width,R.height,R.height*.24,{strokeWidth:2.5,fill:Ge(R,s),stroke:Ge(R,d[R.type]?.iconFill||R.iconFill)}),V},activity(M,R,V){return V=V||{},"fillOpacity"in V||(V.fillOpacity=Pi),v(M,R.width,R.height,Mi,V)},task(M,R){const V={fill:wt(R,s),stroke:Ge(R,c)},L=f("activity")(M,R,V);return b(M,R,"center-middle"),E(M,R),L},userTask(M,R){const V=f("task")(M,R),L=15,Q=12,oe=n.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:L,y:Q}});w(M,oe,{strokeWidth:.5,fill:wt(R,s),stroke:Ge(R,c)});const le=n.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:L,y:Q}});w(M,le,{strokeWidth:.5,fill:wt(R,s),stroke:Ge(R,c)});const Ce=n.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:L,y:Q}});return w(M,Ce,{strokeWidth:.5,fill:Ge(R,c),stroke:Ge(R,c)}),V},scriptTask(M,R){const V=f("task")(M,R),L=n.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return w(M,L,{strokeWidth:1,stroke:Ge(R,c)}),V},SubProcessMarker(M,R){const V=v(M,14,14,0,{strokeWidth:1,fill:wt(R,s),stroke:Ge(R,c)});Rt(V,R.width/2-7.5,R.height-20);const L=n.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2-7.5)/R.width,my:(R.height-20)/R.height}});x("sub-process",M,L,{fill:wt(R,s),stroke:Ge(R,c)})},subprocess(M,R,V){V=Fe({fill:wt(R,s),stroke:Ge(R,c)},V);const L=f("activity")(M,R,V);return b(M,R,"center-middle"),E(M,R,["SubProcessMarker"]),L},label(M,R){return _(M,R)},myline(M,R){const V=wt(R,r.lineStroke||s),L=Ge(R,r.lineStroke||c);return m(M,R.waypoints,{markerEnd:B(M,"sequenceflow-end",V,L),stroke:L})},default(M,R){const V={strokeWidth:ca(R,d[R.type]?.strokeWidth||R.strokeWidth||1),fill:wt(R,d[R.type]?.fill||R.fill),stroke:Ge(R,d[R.type]?.stroke||R.stroke)},L=v(M,R.width,R.height,R.radius||Mi,V);return b(M,R,"center-middle"),E(M,R),I(M,R,R.iconX,R.iconY),L}};this.handlers=O,this._drawPath=w}un(Cn,wn),Cn.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Cn.prototype.canRender=function(){return!0},Cn.prototype.drawShape=function(e,t){const{type:n}=t;return(this.handlers[n]||this.handlers.default)(e,t)},Cn.prototype.drawConnection=function(e,t){const{type:n}=t,a=this.handlers[n];return a(e,t)},Cn.prototype.getShapePath=function(e){return en(e,"startEvent")||en(e,"endEvent")?km(e):en(e,"userTask")||en(e,"scriptTask")||en(e,"subprocess")?Em(e,Mi):en(e,"gatewayAnd")||en(e,"gatewayXor")||en(e,"gatewayInclusive")?Sm(e):_m(e)};var Rm=0,Bm={width:150,height:50};function Tm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Mm(e){return k.isObject(e)?k.assign({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function Pm(e,t){t.textContent=e;var n;try{var a,i=e==="";return t.textContent=i?"dummy":e,n=t.getBBox(),a={width:n.width+n.x*2,height:n.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function jm(e,t,n){for(var a=e.shift(),i=a,r;;){if(r=Pm(i,n),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return Am(e,i,a,r);i=Nm(i,r.width,t)}}function Am(e,t,n,a){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var Pc="";function Vm(e,t){var n=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(n.length>1)for(;a=n.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===Pc)&&i.pop();break}var l=i[i.length-1];return l&&l===Pc&&(i[i.length-1]="-"),i.join("")}function Nm(e,t,n){var a=Math.max(e.length*(n/t),1),i=Vm(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Im(){var e=document.getElementById("helper-svg");return e||(e=j.create("svg"),j.attr(e,{id:"helper-svg"}),F.assignStyle(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function da(e){this._config=k.assign({},{size:Bm,padding:Rm,style:{},align:"center-top"},e||{})}da.prototype.createText=function(e,t){return this.layoutText(e,t).element},da.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},da.prototype.layoutText=function(e,t){var n=k.assign({},this._config.size,t.box),a=k.assign({},this._config.style,t.style),i=Tm(t.align||this._config.align),r=Mm(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Hm(a),c=e.split(/\u00AD?\r?\n/),d=[],u=n.width-r.left-r.right,f=j.create("text");j.attr(f,{x:0,y:0}),j.attr(f,a);var h=Im();for(j.append(h,f);c.length;)d.push(jm(c,u,f));i.vertical==="middle"&&(r.top=r.bottom=0);var g=k.reduce(d,function(w,C,x){return w+(s||C.height)},0)+r.top+r.bottom,p=k.reduce(d,function(w,C,x){return C.width>w?C.width:w},0),m=r.top;i.vertical==="middle"&&(m+=(n.height-g)/2),m-=(s||d[0].height)/4;var y=j.create("text");j.attr(y,a),k.forEach(d,function(w){var C;switch(m+=s||w.height,i.horizontal){case"left":C=r.left;break;case"right":C=(l?p:u)-r.right-w.width;break;default:C=Math.max(((l?p:u)-w.width)/2+r.left,0)}var x=j.create("tspan");j.attr(x,{x:C,y:m}),x.textContent=w.text,j.append(y,x)}),j.remove(f);var v={width:p,height:g};return{dimensions:v,element:y}};function Hm(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const Om=12,Lm=1.2,zm=30;function jc(e){const t=Fe({fontFamily:"Arial, sans-serif",fontSize:Om,fontWeight:"normal",lineHeight:Lm},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,a=Fe({},t,{fontSize:n},e&&e.externalStyle||{}),i=new da({style:t});this.getExternalLabelBounds=function(r,l){const s=i.getDimensions(l,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:a});return{x:Math.round(r.x+r.width/2-s.width/2),y:Math.round(r.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(r,l){const s=i.getDimensions(l,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(zm,Math.round(s.height))}},this.createText=function(r,l){return i.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return a}}jc.$inject=["config.textRenderer"];function $m(){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,n){let a,i;n.abspos?(a=n.abspos.x,i=n.abspos.y):(a=n.containerWidth*n.position.mx,i=n.containerHeight*n.position.my);let r={};typeof t=="object"?(r=t,r.d.indexOf("{mx},{my}")===-1&&(r.d="m {mx},{my}"+r.d),r.width&&(a-=r.width/2),r.height&&(i-=r.height/2)):r=this.pathMap[t];const l={};if(n.position){const c=n.containerHeight/r.height*n.yScaleFactor,d=n.containerWidth/r.width*n.xScaleFactor;for(let u=0;u<r.heightElements.length;u++)l["y"+u]=r.heightElements[u]*c;for(let u=0;u<r.widthElements.length;u++)l["x"+u]=r.widthElements[u]*d}return Dm(r.d,{mx:a,my:i,e:l})}}const Fm=/\{([^}]+)\}/g,Wm=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Um(e,t,n){let a=n;return t.replace(Wm,(i,r,l,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===n?e:a)+"",a}function Dm(e,t){return String(e).replace(Fm,(n,a)=>Um(n,a,t))}const Ac={__init__:["myRenderer"],myRenderer:["type",Cn],textRenderer:["type",jc],pathMap:["type",$m]};function Vc(e,t){return Fe({id:e.id,type:e.type,businessObject:e},t)}function Ym(e,t,n){const a=e.waypoint;return!a||a.length<2?[Je(t),Je(n)]:a.map(i=>({x:i.x,y:i.y}))}function tn(e,t,n,a,i,r){this._eventBus=e,this._canvas=n,this._elementFactory=a,this._elementRegistry=i,this._translate=Js,this._textRenderer=r,this._modeling=t}tn.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],tn.prototype.add=function(e){let t;const{label:n}=e;if(n&&(n.id=e.id,n.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(Vc(e,{source:a,target:i,waypoints:Ym(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(Vc(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return n&&t&&this.addLabel(n,t),t},tn.prototype.addLabel=function(e,t){const n=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(n,t.parent)},tn.prototype.update=function(e,t){const n=this._elementRegistry.get(e);n.businessObject=Fe(n.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(n),this._canvas.addConnection(n,n.parent)):(this._canvas.removeShape(n),this._canvas.addShape(n,n.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=n.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,n.parent);else{const{name:i}=t;if(i&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const r={x:t.x+12,y:t.y+42,width:10,height:10,name:i,id:e},l=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,l,{width:0,height:0}),n&&this.addLabel(r,n)}}},tn.prototype._getSource=function(e){return this._getElement(e.from)},tn.prototype._getTarget=function(e){return this._getElement(e.to)},tn.prototype._getElement=function(e){return this._elementRegistry.get(e)};const Nc={myImporter:["type",tn]},Ic=e=>{const t=[];return e.forEach(n=>{if(n.type!==void 0){const a=n.businessObject;if(n.type==="myline")n.source&&n.target&&(a.from=n.source.id,a.to=n.target.id,a.waypoint=n.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(n.type!=="label")a.x=n.x,a.y=n.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:n.x,y:n.y,height:n.height,width:n.width})}}}),t},Hc=(e,t)=>{const n=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{n.add(r)}),i.forEach(r=>{n.add(r)})},Jm=o.defineComponent({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=o.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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const b=s.get("eventBus");b.on("element.dblclick",_=>{i("elementDblclick",_.element.businessObject)}),b.on("element.click",_=>{i("elementClick",_.element.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let b={__init__:["myOptions"],myOptions:["type",f]};s=new rr({canvas:{container:r.value},modules:[ci,ws,Mc,zs,Ws,b,Ac,Nc]});const _=s.get("canvas"),E=s.get("elementFactory");d();const T=E.createRoot();_.setRootElement(T),u()};o.onMounted(()=>{h()});const g=b=>{const _=b==null?1:c+b;s.get("canvas").zoom(_),c=_},p=()=>{s.get("canvas").zoom(1);const b=s.get("elementRegistry").getAll();var _=Ic(b);return _},m=b=>{s.clear(),d(),Hc(b,s)},y=b=>{s.get("myImporter").update(b.id,b)};return t({reset:()=>{d()},zoom:b=>{g(b)},getData:()=>p(),setData:b=>{m(b)},updateElemet:b=>{y(b)}}),(b,_)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}});function ji(e){return e&&e[e.length-1]}function Oc(e){return e.y}function Lc(e){return e.x}var Gm={left:Lc,center:Lc,right:function(e){return e.x+e.width},top:Oc,middle:Oc,bottom:function(e){return e.y+e.height}};function qn(e,t){this._modeling=e,this._rules=t}qn.$inject=["modeling","rules"],qn.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",a="width";return t.indexOf(e)!==-1&&(n="y",a="height"),{axis:n,dimension:a}},qn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},qn.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),a=n.axis,i=n.dimension,r={},l={},s=!1,c,d,u;function f(h,g){return Math.round((h[a]+g[a]+g[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ji(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if(k.forEach(t,function(h){var g=h[a]+Math.round(h[i]/2);l[g]?l[g].elements.push(h):l[g]={elements:[h],center:g}}),c=k.sortBy(l,function(h){return h.elements.length>1&&(s=!0),h.elements.length}),s)return r[e]=ji(c).center,r;d=t[0],t=k.sortBy(t,function(h){return h[a]+h[i]}),u=ji(t),r[e]=f(d,u)}return r},qn.prototype.trigger=function(e,t){var n=this._modeling,a,i=k.filter(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),k.isArray(a)&&(i=a),!(i.length<2||!a)){var r=Gm[t],l=k.sortBy(i,r),s=this._alignmentPosition(t,l);n.alignElements(l,s)}};const Km={__init__:["alignElements"],alignElements:["type",qn]};var ua=Math.round,qm=Math.max;function Xm(e,t){var n=e.x,a=e.y;return[["M",n,a],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function Zm(e){var t=[];return e.forEach(function(n,a){t.push([a===0?"M":"L",n.x,n.y])}),t}var zc=10;function Qm(e,t){var n,a;for(n=0;a=e[n];n++)if(uo(a,t)<=zc)return{point:e[n],bendpoint:!0,index:n};return null}function ey(e,t){var n=Ts(Xm(t,zc),Zm(e)),a=n[0],i=n[n.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=qm(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:ua(a.x+i.x)/2,y:ua(a.y+i.y)/2},index:a.segment2}:{point:{x:ua(a.x),y:ua(a.y)},index:a.segment2}:null}function ty(e,t){return Qm(e,t)||ey(e,t)}function ny(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function oy(e,t,n){var a=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-i/r}function $c(e,t){var n=t[0],a=t[1],i={x:a.x-n.x,y:a.y-n.y},r=oy([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+r*i.x,y:n.y+r*i.y}}function ay(e,t){var n=$c(e,t),a={x:n.x-e.x,y:n.y-e.y};return ny(a)}var Fc="djs-bendpoint",Wc="djs-segment-dragger";function iy(e,t){var n=$n(t),a=e._container.getBoundingClientRect(),i;i={x:a.left,y:a.top};var r=e.viewbox();return{x:r.x+(n.x-i.x)/r.scale,y:r.y+(n.y-i.y)/r.scale}}function Ai(e,t,n){var a=iy(e,n),i=ty(t,a);return i}function Vi(e,t){var n=j.create("g");j.classes(n).add(Fc),j.append(e,n);var a=j.create("circle");j.attr(a,{cx:0,cy:0,r:4}),j.classes(a).add("djs-visual"),j.append(n,a);var i=j.create("circle");return j.attr(i,{cx:0,cy:0,r:10}),j.classes(i).add("djs-hit"),j.append(n,i),t&&j.classes(n).add(t),n}function ry(e,t,n,a){var i=j.create("g");j.append(e,i);var r=18,l=6,s=11,c=sy(t,n,a),d=l+s,u=j.create("rect");j.attr(u,{x:-r/2,y:-l/2,width:r,height:l}),j.classes(u).add("djs-visual"),j.append(i,u);var f=j.create("rect");return j.attr(f,{x:-c/2,y:-d/2,width:c,height:d}),j.classes(f).add("djs-hit"),j.append(i,f),Jp(i,a==="v"?90:0),i}function Uc(e,t,n){var a=j.create("g"),i=ai(t,n),r=Wt(t,n);return j.append(e,a),ry(a,t,n,r),j.classes(a).add(Wc),j.classes(a).add(r==="h"?"horizontal":"vertical"),Rt(a,i.x,i.y),a}function Ni(e){return Math.abs(Math.round(e*2/3))}function ly(e,t){var n=cy(e,t);return $c(e,n)}function sy(e,t,n){var a=t.x-e.x,i=t.y-e.y;return Ni(n==="h"?a:i)}function cy(e,t){for(var n=t.waypoints,a=1/0,i,r=0;r<n.length-1;r++){var l=n[r],s=n[r+1],c=ay(e,[l,s]);c<a&&(a=c,i=r)}return[n[i],n[i+1]]}function Ii(e){return CSS.escape(e)}function Dc(e,t,n,a,i){function r(C,x,S){var b=C.index,_=C.point,E,T,P,B,H,I;return b<=0||C.bendpoint?!1:(E=x[b-1],T=x[b],P=ai(E,T),B=Wt(E,T),H=Math.abs(_.x-P.x),I=Math.abs(_.y-P.y),B&&H<=S&&I<=S)}function l(C,x){var S=C.waypoints,b,_,E,T;return x.index<=0||x.bendpoint||(b={start:S[x.index-1],end:S[x.index]},_=Wt(b.start,b.end),!_)?null:(_==="h"?E=b.end.x-b.start.x:E=b.end.y-b.start.y,T=Ni(E)/2,T)}function s(C,x){var S=x.waypoints,b=Ai(t,S,C),_;if(b)return _=l(x,b),r(b,S,_)?i.start(C,x,b.index):a.start(C,x,b.index,!b.bendpoint),!0}function c(C,x,S){F.event.bind(C,x,function(b){n.triggerMouseEvent(x,b,S),b.stopPropagation()})}function d(C,x){var S=t.getLayer("overlays"),b=F.query('.djs-bendpoints[data-element-id="'+Ii(C.id)+'"]',S);return!b&&x&&(b=j.create("g"),j.attr(b,{"data-element-id":C.id}),j.classes(b).add("djs-bendpoints"),j.append(S,b),c(b,"mousedown",C),c(b,"click",C),c(b,"dblclick",C)),b}function u(C,x){return F.query('.djs-segment-dragger[data-segment-idx="'+C+'"]',x)}function f(C,x){x.waypoints.forEach(function(S,b){var _=Vi(C);j.append(C,_),Rt(_,S.x,S.y)}),Vi(C,"floating")}function h(C,x){for(var S=x.waypoints,b,_,E,T=1;T<S.length;T++)b=S[T-1],_=S[T],Wt(b,_)&&(E=Uc(C,b,_),j.attr(E,{"data-segment-idx":T}),c(E,"mousemove",x))}function g(C){k.forEach(F.queryAll("."+Fc,C),function(x){j.remove(x)})}function p(C){k.forEach(F.queryAll("."+Wc,C),function(x){j.remove(x)})}function m(C){var x=d(C);return x||(x=d(C,!0),f(x,C),h(x,C)),x}function y(C){var x=d(C);x&&(p(x),g(x),h(x,C),f(x,C))}function v(C,x){var S=F.query(".floating",C),b=x.point;S&&Rt(S,b.x,b.y)}function w(C,x,S){var b=u(x.index,C),_=S[x.index-1],E=S[x.index],T=x.point,P=ai(_,E),B=Wt(_,E),H,I;b&&(H=dy(b),I={x:T.x-P.x,y:T.y-P.y},B==="v"&&(I={x:I.y,y:I.x}),Rt(H,I.x,I.y))}e.on("connection.changed",function(C){y(C.element)}),e.on("connection.remove",function(C){var x=d(C.element);x&&j.remove(x)}),e.on("element.marker.update",function(C){var x=C.element,S;x.waypoints&&(S=m(x),C.add?j.classes(S).add(C.marker):j.classes(S).remove(C.marker))}),e.on("element.mousemove",function(C){var x=C.element,S=x.waypoints,b,_;if(S){if(b=d(x,!0),_=Ai(t,S,C.originalEvent),!_)return;v(b,_),_.bendpoint||w(b,_,S)}}),e.on("element.mousedown",function(C){if($t(C)){var x=C.originalEvent,S=C.element;if(S.waypoints)return s(x,S)}}),e.on("selection.changed",function(C){var x=C.newSelection,S=x[0];S&&S.waypoints&&m(S)}),e.on("element.hover",function(C){var x=C.element;x.waypoints&&(m(x),n.registerEvent(C.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(C){n.unregisterEvent(C.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(C){var x=C.element,S=C.newId;if(x.waypoints){var b=d(x);b&&j.attr(b,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}Dc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function dy(e){return F.query(".djs-visual",e)}var Yc=Math.round,xn="reconnectStart",kn="reconnectEnd",ko="updateWaypoints";function Hi(e,t,n,a,i,r){this._injector=e,this.start=function(l,s,c,d){var u=n.getGraphics(s),f=s.source,h=s.target,g=s.waypoints,p;!d&&c===0?p=xn:!d&&c===g.length-1?p=kn:p=ko;var m=p===ko?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(m,{connection:s,source:f,target:h});y===!1&&(y=i.allowed(m,{connection:s,source:h,target:f})),y!==!1&&a.init(l,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:h,insert:d,type:p}}})},t.on("bendpoint.move.hover",function(l){var s=l.context,c=s.connection,d=c.source,u=c.target,f=l.hover,h=s.type;s.hover=f;var g;if(f){var p=h===ko?"connection.updateWaypoints":"connection.reconnect";if(g=s.allowed=i.allowed(p,{connection:c,source:h===xn?f:d,target:h===kn?f:u}),g){s.source=h===xn?f:d,s.target=h===kn?f:u;return}g===!1&&(g=s.allowed=i.allowed(p,{connection:c,source:h===kn?f:u,target:h===xn?f:d})),g&&(s.source=h===kn?f:u,s.target=h===xn?f:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==ko&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.context,c=s.allowed,d=s.bendpointIndex,u=s.connection,f=s.insert,h=u.waypoints.slice(),g=s.source,p=s.target,m=s.type,y=s.hints||{},v={x:Yc(l.x),y:Yc(l.y)};if(!c)return!1;m===ko?(f?h.splice(d,0,v):h[d]=v,y.bendpointMove={insert:f,bendpointIndex:d},h=this.cropWaypoints(u,h),r.updateWaypoints(u,yg(h),y)):(m===xn?(y.docking="source",fa(s)&&(y.docking="target",y.newWaypoints=h.reverse())):m===kn&&(y.docking="target",fa(s)&&(y.docking="source",y.newWaypoints=h.reverse())),r.reconnect(u,g,p,v,y))},this)}Hi.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Hi.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function fa(e){var t=e.hover,n=e.source,a=e.target,i=e.type;if(i===xn)return t&&a&&t===a&&n!==a;if(i===kn)return t&&n&&t===n&&n!==a}var uy="reconnectStart",fy="reconnectEnd",Jc="updateWaypoints",Eo="connect-ok",ha="connect-not-ok",Gc="connect-hover",Kc="djs-updating",qc="djs-dragging",Xc=1100;function Zc(e,t,n,a){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var l=r.context,s=l.bendpointIndex,c=l.connection,d=l.insert,u=c.waypoints,f=u.slice();l.waypoints=u,d&&f.splice(s,0,{x:r.x,y:r.y}),c.waypoints=f;var h=l.draggerGfx=Vi(a.getLayer("overlays"));j.classes(h).add("djs-dragging"),a.addMarker(c,qc),a.addMarker(c,Kc)}),n.on("bendpoint.move.hover",function(r){var l=r.context,s=l.allowed,c=l.hover,d=l.type;if(c){if(a.addMarker(c,Gc),d===Jc)return;s?(a.removeMarker(c,ha),a.addMarker(c,Eo)):s===!1&&(a.removeMarker(c,Eo),a.addMarker(c,ha))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Xc,function(r){var l=r.context,s=l.hover,c=l.target;s&&(a.removeMarker(s,Gc),a.removeMarker(s,c?Eo:ha))}),n.on("bendpoint.move.move",function(r){var l=r.context,s=l.allowed,c=l.bendpointIndex,d=l.draggerGfx,u=l.hover,f=l.type,h=l.connection,g=h.source,p=h.target,m=h.waypoints.slice(),y={x:r.x,y:r.y},v=l.hints||{},w={};i&&(v.connectionStart&&(w.connectionStart=v.connectionStart),v.connectionEnd&&(w.connectionEnd=v.connectionEnd),f===uy?fa(l)?(w.connectionEnd=w.connectionEnd||y,w.source=p,w.target=u||g,m=m.reverse()):(w.connectionStart=w.connectionStart||y,w.source=u||g,w.target=p):f===fy?fa(l)?(w.connectionStart=w.connectionStart||y,w.source=u||p,w.target=g,m=m.reverse()):(w.connectionEnd=w.connectionEnd||y,w.source=g,w.target=u||p):(w.noCropping=!0,w.noLayout=!0,m[c]=y),f===Jc&&(m=e.cropWaypoints(h,m)),w.waypoints=m,i.drawPreview(l,s,w)),Rt(d,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Xc,function(r){var l=r.context,s=l.connection,c=l.draggerGfx,d=l.hover,u=l.target,f=l.waypoints;s.waypoints=f,j.remove(c),a.removeMarker(s,Kc),a.removeMarker(s,qc),d&&(a.removeMarker(d,Eo),a.removeMarker(d,u?Eo:ha)),i&&i.cleanUp(l)})}Zc.$inject=["bendpointMove","injector","eventBus","canvas"];var Qc="connect-hover",ed="djs-updating";function td(e,t,n){return Oi(e,t,e[t]+n)}function Oi(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function hy(e,t,n,a){var i=Math.max(t[a],n[a]),r=Math.min(t[a],n[a]),l=20,s=Math.min(Math.max(r+l,e[a]),i-l);return Oi(t,a,s)}function nd(e){return e==="x"?"y":"x"}function od(e,t,n){var a,i;return e.original?e.original:(a=Je(t),i=nd(n),Oi(e,i,a[i]))}function ad(e,t,n,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(f,h,g){var p,m=n.getGraphics(h),y=g-1,v=g,w=h.waypoints,C=w[y],x=w[v],S=Ai(n,w,f),b,_,E;b=Wt(C,x),b&&(_=b==="v"?"x":"y",y===0&&(C=od(C,h.source,_)),v===w.length-1&&(x=od(x,h.target,_)),S?E=S.point:E={x:(C.x+x.x)/2,y:(C.y+x.y)/2},p={connection:h,segmentStartIndex:y,segmentEndIndex:v,segmentStart:C,segmentEnd:x,axis:_,dragPosition:E},a.init(f,E,"connectionSegment.move",{cursor:_==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:m,context:p}}))};function s(f,h){if(!l)return h;var g=f.waypoints,p;return f.waypoints=h,p=l.getCroppedWaypoints(f),f.waypoints=g,p}function c(f){i.update("connection",f.connection,f.connectionGfx)}function d(f,h,g){var p=f.newWaypoints,m=f.segmentStartIndex+h,y=p[m],v=f.segmentEndIndex+h,w=p[v],C=nd(f.axis),x=hy(g,y,w,C);Rt(f.draggerGfx,x.x,x.y)}function u(f,h){var g=0,p=f.filter(function(m,y){return oi(f[y-1],f[y+1],m)?(g=y<=h?g-1:g,!1):!0});return{waypoints:p,segmentOffset:g}}t.on("connectionSegment.move.start",function(f){var h=f.context,g=f.connection,p=n.getLayer("overlays");h.originalWaypoints=g.waypoints.slice(),h.draggerGfx=Uc(p,h.segmentStart,h.segmentEnd),j.classes(h.draggerGfx).add("djs-dragging"),n.addMarker(g,ed)}),t.on("connectionSegment.move.move",function(f){var h=f.context,g=h.connection,p=h.segmentStartIndex,m=h.segmentEndIndex,y=h.segmentStart,v=h.segmentEnd,w=h.axis,C=h.originalWaypoints.slice(),x=td(y,w,f["d"+w]),S=td(v,w,f["d"+w]),b=C.length,_=0;C[p]=x,C[m]=S;var E,T;p<2&&(E=Jt(g.source,x),p===1?E==="intersect"&&(C.shift(),C[0]=x,_--):E!=="intersect"&&(C.unshift(y),_++)),m>b-3&&(T=Jt(g.target,S),m===b-2?T==="intersect"&&(C.pop(),C[C.length-1]=S):T!=="intersect"&&C.push(v)),h.newWaypoints=g.waypoints=s(g,C),d(h,_,f),h.newSegmentStartIndex=p+_,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,Qc)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var h=f.context.hover;h&&n.removeMarker(h,Qc)}),t.on("connectionSegment.move.cleanup",function(f){var h=f.context,g=h.connection;h.draggerGfx&&j.remove(h.draggerGfx),n.removeMarker(g,ed)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var h=f.context,g=h.connection;g.waypoints=h.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var h=f.context,g=h.connection,p=h.newWaypoints,m=h.newSegmentStartIndex;p=p.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var y=u(p,m),v=y.waypoints,w=s(g,v),C=y.segmentOffset,x={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:m+C}};r.updateWaypoints(g,w,x)})}ad.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var py=Math.abs,id=Math.round;function gy(e,t,n){n=n===void 0?10:n;var a,i;for(a=0;a<t.length;a++)if(i=t[a],py(i-e)<=n)return i}function my(e){return{x:e.x,y:e.y}}function yy(e){return{x:e.x+e.width,y:e.y+e.height}}function Xn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:id(e.x+e.width/2),y:id(e.y+e.height/2)}}function pa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Ht(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,a=n-i,e[t]+=a,e["d"+t]+=a),i}function rd(e){return e.children||[]}var by=Math.abs,ld=Math.round,Li=10;function sd(e){function t(r,l){if(k.isArray(r)){for(var s=r.length;s--;)if(by(r[s]-l)<=Li)return r[s]}else{r=+r;var c=l%r;if(c<Li)return l-c;if(c>r-Li)return l-c+r}return l}function n(r,l){if(r.waypoints)return ly(l,r);if(r.width)return{x:ld(r.width/2+r.x),y:ld(r.height/2+r.y)}}function a(r){var l=r.context,s=l.snapPoints,c=l.connection,d=c.waypoints,u=l.segmentStart,f=l.segmentStartIndex,h=l.segmentEnd,g=l.segmentEndIndex,p=l.axis;if(s)return s;var m=[d[f-1],u,h,d[g+1]];return f<2&&m.unshift(n(c.source,r)),g>d.length-3&&m.unshift(n(c.target,r)),l.snapPoints=s={horizontal:[],vertical:[]},k.forEach(m,function(y){y&&(y=y.original||y,p==="y"&&s.horizontal.push(y.y),p==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var l=a(r),s=r.x,c=r.y,d,u;if(l){d=t(l.vertical,s),u=t(l.horizontal,c);var f=s-d,h=c-u;k.assign(r,{dx:r.dx-f,dy:r.dy-h,x:d,y:u}),(f||l.vertical.indexOf(s)!==-1)&&Ht(r,"x",d),(h||l.horizontal.indexOf(c)!==-1)&&Ht(r,"y",u)}});function i(r){var l=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(l)return l;var d=[s[c-1],s[c+1]];return r.snapPoints=l={horizontal:[],vertical:[]},k.forEach(d,function(u){u&&(u=u.original||u,l.horizontal.push(u.y),l.vertical.push(u.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var l=r.context,s=l.hover,c=s&&n(s,r);!ut(s)||!c||!c.x||!c.y||(Ht(r,"x",c.x),Ht(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,s=i(l),c=l.hover,d=c&&n(c,r),u=r.x,f=r.y,h,g;if(s){h=t(d?s.vertical.concat([d.x]):s.vertical,u),g=t(d?s.horizontal.concat([d.y]):s.horizontal,f);var p=u-h,m=f-g;k.assign(r,{dx:r.dx-p,dy:r.dy-m,x:r.x-p,y:r.y-m}),(p||s.vertical.indexOf(u)!==-1)&&Ht(r,"x",h),(m||s.horizontal.indexOf(f)!==-1)&&Ht(r,"y",g)}})}sd.$inject=["eventBus"];const vy={__depends__:[gn,Yn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Dc],bendpointMove:["type",Hi],bendpointMovePreview:["type",Zc],connectionSegmentMove:["type",ad],bendpointSnapping:["type",sd]};var wy="djs-dragger";function Ot(e,t,n,a){this._canvas=t,this._graphicsFactory=n,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Ot.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ot.prototype.drawPreview=function(e,t,n){n=n||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=n.source,l=n.target,s=n.waypoints,c=n.connectionStart,d=n.connectionEnd,u=n.noLayout,f=n.noCropping,h=n.noNoop,g,p=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),j.clear(a),i||(i=e.getConnection=Cy(function(m,y,v){return p.getConnection(m,y,v)})),t&&(g=i(t,r,l)),!g){!h&&this.drawNoopPreview(a,n);return}g.waypoints=s||[],this._layouter&&!u&&(g.waypoints=this._layouter.layoutConnection(g,{source:r,target:l,connectionStart:c,connectionEnd:d,waypoints:n.waypoints||g.waypoints})),(!g.waypoints||!g.waypoints.length)&&(g.waypoints=[r?Je(r):c,l?Je(l):d]),this._connectionDocking&&(r||l)&&!f&&(g.waypoints=this._connectionDocking.getCroppedWaypoints(g,r,l)),this._graphicsFactory.drawConnection(a,g,{stroke:"var(--element-dragger-color)"})},Ot.prototype.drawNoopPreview=function(e,t){var n=t.source,a=t.target,i=t.connectionStart||Je(n),r=t.connectionEnd||Je(a),l=this.cropWaypoints(i,r,n,a),s=this.createNoopConnection(l[0],l[1]);j.append(e,s)},Ot.prototype.cropWaypoints=function(e,t,n,a){var i=this._graphicsFactory,r=n&&i.getShapePath(n),l=a&&i.getShapePath(a),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&li(r,s,!0)||e,t=a&&li(l,s,!1)||t,[e,t]},Ot.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&j.remove(e.connectionPreviewGfx)},Ot.prototype.getConnection=function(e){var t=xy(e);return this._elementFactory.createConnection(t)},Ot.prototype.createConnectionPreviewGfx=function(){var e=j.create("g");return j.attr(e,{pointerEvents:"none"}),j.classes(e).add(wy),j.append(this._canvas.getActiveLayer(),e),e},Ot.prototype.createNoopConnection=function(e,t){return qa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Cy(e){var t={};return function(n){var a=JSON.stringify(n),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function xy(e){return k.isObject(e)?e:{}}const ky={__init__:["connectionPreview"],connectionPreview:["type",Ot]};var Ey=new Uo("ov"),Sy=500;function nt(e,t,n,a){this._eventBus=t,this._canvas=n,this._elementRegistry=a,this._ids=Ey,this._overlayDefaults=k.assign({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=_y(n.getContainer()),this._init()}nt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],nt.prototype.get=function(e){if(k.isString(e)&&(e={id:e}),k.isString(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?k.filter(t.overlays,k.matchPattern({type:e.type})):t.overlays.slice():[]}else return e.type?k.filter(this._overlays,k.matchPattern({type:e.type})):e.id?this._overlays[e.id]:null},nt.prototype.add=function(e,t,n){if(k.isObject(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return n=k.assign({},this._overlayDefaults,n,{id:a,type:t,element:e,html:n.html}),this._addOverlay(n),a},nt.prototype.remove=function(e){var t=this.get(e)||[];k.isArray(t)||(t=[t]);var n=this;k.forEach(t,function(a){var i=n._getOverlayContainer(a.element,!0);if(a&&(F.remove(a.html),F.remove(a.htmlContainer),delete a.htmlContainer,delete a.element,delete n._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},nt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},nt.prototype.show=function(){ga(this._overlayRoot)},nt.prototype.hide=function(){ga(this._overlayRoot,!1)},nt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],F.clear(this._overlayRoot)},nt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,a=t.x,i=t.y;if(t.waypoints){var r=_t(t);a=r.x,i=r.y}cd(n,a,i),F.attr(e.html,"data-container-id",t.id)},nt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=_t(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=_t(a).height:s=a.height,r=t.bottom*-1+s}cd(n,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},nt.prototype._createOverlayContainer=function(e){var t=F.domify('<div class="djs-overlays" />');F.assignStyle(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},nt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";dd(this._overlayRoot,n)},nt.prototype._getOverlayContainer=function(e,t){var n=k.find(this._overlayContainers,function(a){return a.element===e});return!n&&!t?this._createOverlayContainer(e):n},nt.prototype._addOverlay=function(e){var t=e.id,n=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),k.isString(a)&&(a=F.domify(a)),r=this._getOverlayContainer(n),i=F.domify('<div class="djs-overlay" data-overlay-id="'+t+'">'),F.assignStyle(i,{position:"absolute"}),i.appendChild(a),e.type&&F.classes(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(n),s=this._canvas.getRootElement();ga(i,l===s),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},nt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,a=this._canvas.findRoot(e.element),i=n&&n.minZoom,r=n&&n.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||n&&(k.isDefined(i)&&i>t.scale||k.isDefined(r)&&r<t.scale))&&(c=!1),ga(l,c),this._updateOverlayScale(e,t)},nt.prototype._updateOverlayScale=function(e,t){var n=e.scale,a,i,r=e.htmlContainer,l,s="";n!==!0&&(n===!1?(a=1,i=1):(a=n.min,i=n.max),k.isDefined(a)&&t.scale<a&&(l=(1/t.scale||1)*a),k.isDefined(i)&&t.scale>i&&(l=(1/t.scale||1)*i)),k.isDefined(l)&&(s="scale("+l+","+l+")"),dd(r,s)},nt.prototype._updateOverlaysVisibilty=function(e){var t=this;k.forEach(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},nt.prototype._init=function(){var e=this._eventBus,t=this;function n(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){n(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element,r=t.get({element:i});k.forEach(r,function(c){t.remove(c.id)});var l=t._getOverlayContainer(i);if(l){F.remove(l.html);var s=t._overlayContainers.indexOf(l);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Sy,function(a){var i=a.element,r=t._getOverlayContainer(i,!0);r&&(k.forEach(r.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var i=t._getOverlayContainer(a.element,!0);i&&F.classes(i.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 _y(e){var t=F.domify('<div class="djs-overlay-container" />');return F.assignStyle(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function cd(e,t,n){F.assignStyle(e,{left:t+"px",top:n+"px"})}function ga(e,t){e.style.display=t===!1?"none":""}function dd(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Ry={__init__:["overlays"],overlays:["type",nt]},By=new Uo;function Zn(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Zn.$inject=["eventBus"],Zn.prototype.schedule=function(e,t=By.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Zn.prototype._schedule=function(e,t){const n=Ty();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(i){n.reject(i)}}catch(i){console.error("Scheduler#_schedule execution failed",i)}}),promise:n.promise}},Zn.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Zn.prototype._cancel=function(e){clearTimeout(e.executionId)};function Ty(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const My={scheduler:["type",Zn]};var Py="djs-element-hidden",ma=".entry",jy=1e3,ud=8,Ay=300;function Xe(e,t,n,a){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=a,this._current=null,this._init()}Xe.$inject=["canvas","elementRegistry","eventBus","scheduler"],Xe.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,a=n.length?n.length===1?n[0]:n:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,a=e._current;if(a){var i=a.target,r=k.isArray(i)?i:[i],l=r.filter(function(c){return n.includes(c)});if(l.length){e.close();var s=r.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,a=e._current,i=k.isArray(a.target)?a.target:[a.target];i.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Xe.prototype._createContainer=function(){var e=F.domify('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Xe.prototype.registerProvider=function(e,t){t||(t=e,e=jy),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Xe.prototype.getEntries=function(e){var t=this._getProviders(),n=k.isArray(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return k.forEach(t,function(i){if(k.isFunction(i[n])){var r=i[n](e);k.isFunction(r)?a=r(a):k.forEach(r,function(l,s){a[s]=l})}}),a},Xe.prototype.trigger=function(e,t,n){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=F.attr(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,n)},Ay);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,n)},Xe.prototype.triggerEntry=function(e,t,n,a){if(this.isShown()){var i=this._current.target,r=this._current.entries,l=r[e];if(l){var s=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:n})!==!1){if(k.isFunction(s)){if(t==="click")return s(n,i,a)}else if(s[t])return s[t](n,i,a);n.preventDefault()}}}},Xe.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Xe.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Xe.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),a;k.forEach(t,function(i,r){var l=i.group||"default",s=F.domify(i.html||'<div class="entry" draggable="true"></div>'),c;F.attr(s,"data-action",r),c=F.query("[data-group="+Ii(l)+"]",n),c||(c=F.domify('<div class="group"></div>'),F.attr(c,"data-group",l),n.appendChild(c)),c.appendChild(s),i.className&&Vy(s,i.className),i.title&&F.attr(s,"title",i.title),i.imageUrl&&(a=F.domify("<img>"),F.attr(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),F.classes(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Xe.prototype._createHtml=function(e){var t=this,n=F.domify('<div class="djs-context-pad"></div>');return F.delegate.bind(n,ma,"click",function(a){t.trigger("click",a)}),F.delegate.bind(n,ma,"dragstart",function(a){t.trigger("dragstart",a)}),F.delegate.bind(n,ma,"mouseover",function(a){t.trigger("mouseover",a)}),F.delegate.bind(n,ma,"mouseout",function(a){t.trigger("mouseout",a)}),F.event.bind(n,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Xe.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()&&Iy(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Xe.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Xe.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return k.isArray(e)!==k.isArray(n)?!1:k.isArray(e)?e.length===n.length&&k.every(e,function(a){return n.includes(a)}):n===e},Xe.prototype.isShown=function(){return this.isOpen()&&F.classes(this._current.html).has("open")},Xe.prototype.show=function(){this.isOpen()&&(F.classes(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Xe.prototype.hide=function(){this.isOpen()&&(F.classes(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Xe.prototype._getPosition=function(e){if(!k.isArray(e)&&ut(e)){var t=this._canvas.viewbox(),n=Ny(e),a=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale;return{left:a+ud*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer(),l=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-l.left+ud*this._canvas.zoom(),top:s.top-l.top}},Xe.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(a){a in n&&(t.style[a]=n[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Xe.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,a=k.isArray(n)?n:[n],i=a.some(function(r){return t._canvas.hasMarker(r,Py)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Xe.prototype._getTargetBounds=function(e){var t=this,n=k.isArray(e)?e:[e],a=n.map(function(i){return t._canvas.getGraphics(i)});return a.reduce(function(i,r){const l=r.getBoundingClientRect();return i.top=Math.min(i.top,l.top),i.right=Math.max(i.right,l.right),i.bottom=Math.max(i.bottom,l.bottom),i.left=Math.min(i.left,l.left),i.x=i.left,i.y=i.top,i.width=i.right-i.left,i.height=i.bottom-i.top,i},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Vy(e,t){var n=F.classes(e);t=k.isArray(t)?t:t.split(/\s+/g),t.forEach(function(a){n.add(a)})}function Ny(e){return e.waypoints[e.waypoints.length-1]}function Iy(e,t){return e=k.isArray(e)?e:[e],t=k.isArray(t)?t:[t],e.length===t.length&&k.every(e,function(n){return t.includes(n)})}const Hy={__depends__:[Xa,My,Ry],contextPad:["type",Xe]};var Oy=250;function En(e){this._eventBus=e,this._tools=[],this._active=null}En.$inject=["eventBus"],En.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},En.prototype.isActive=function(e){return e&&this._active===e},En.prototype.length=function(e){return this._tools.length},En.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},En.prototype.bindEvents=function(e,t){var n=this._eventBus,a=[];n.on(t.tool+".init",function(i){var r=i.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k.forEach(t,function(i){a.push(i+".ended"),a.push(i+".canceled")}),n.on(a,Oy,function(i){this._active&&(Ly(i)||this.setActive(null))},this)};function Ly(e){var t=e.originalEvent&&e.originalEvent.target;return t&&F.closest(t,'.group[data-group="tools"]')}const zi={__depends__:[gn],__init__:["toolManager"],toolManager:["type",En]};function $i(e){var t=this;this._lastMoveEvent=null;function n(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){var i=t._svg=a.svg;i.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}$i.$inject=["eventBus"],$i.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||zy(0,0)};function zy(e,t){var n=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),n}const Fi={__init__:["mouse"],mouse:["type",$i]};var Wi=1500,fd="grab";function Qn(e,t,n,a,i,r){this._dragging=n,this._mouse=r;var l=this,s=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Wi,function(c){if(Kl(c))return l.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Wi,function(c){if(!(!hd(c.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(Wi,function(c){!hd(c.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var d=c.originalEvent.target;if(!c.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var d=t.viewbox().scale;t.scroll({dx:c.dx*d,dy:c.dy*d})}),e.on("hand.move.end",function(c){var d=c.context,u=d.reactivate;return!Kl(c)&&u&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}Qn.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Qn.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:fd,data:{context:n||{}}})},Qn.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:fd,data:{context:{reactivate:n}}})},Qn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Qn.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function hd(e){return ls("Space",e)}const $y={__depends__:[zi,Fi],__init__:["handTool"],handTool:["type",Qn]};var pd="crosshair";function Sn(e,t,n,a,i,r,l){this._selection=i,this._dragging=n,this._mouse=l;var s=this,c={create:function(d){var u=t.getActiveLayer(),f;f=d.frame=j.create("rect"),j.attr(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),j.append(u,f)},update:function(d){var u=d.frame,f=d.bbox;j.attr(u,{x:f.x,y:f.y,width:f.width,height:f.height})},remove:function(d){d.frame&&j.remove(d.frame)}};r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(d){var u=d.originalEvent.target;!d.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,f=Ui(d),h=a.filter(function(p){return p}),g=Ja(d);s.select(h,f,g?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=Ui(d),c.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=Ui(d),c.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;c.remove(u)}),e.on("element.mousedown",1500,function(d){if(Ja(d))return s.activateLasso(d.originalEvent),!0})}Sn.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Sn.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:pd,data:{context:{}}})},Sn.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:pd,data:{context:{}},keepSelection:!0})},Sn.prototype.select=function(e,t,n=[]){var a=$p(e,t);this._selection.select([...n,...k.values(a)])},Sn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Sn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Ui(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},a;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?a={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?a={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?a={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?a={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:a={x:n.x,y:n.y,width:0,height:0},a}const Fy={__depends__:[zi,Fi],__init__:["lassoTool"],lassoTool:["type",Sn]};var gd="connect-ok",md="connect-not-ok";function eo(e,t,n,a,i,r,l){var s=this;this._dragging=t,this._rules=r,this._mouse=l,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var d=c.context,u=c.hover,f=d.canStartConnect=s.canStartConnect(u);f!==null&&(d.startTarget=u,a.addMarker(u,f?gd:md))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?gd:md)}),e.on(["global-connect.ended"],function(c){var d=c.context,u=d.startTarget,f={x:c.x,y:c.y},h=s.canStartConnect(u);if(h)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,f)}),!1})}eo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],eo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},eo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},eo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},eo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Wy={__depends__:[ci,Yn,gn,zi,Fi],globalConnect:["type",eo]};var Uy=500,Dy=1e3;function _n(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=j.create("rect");return j.attr(l,k.assign({x:0,y:0,rx:4,width:100,height:100},n)),l}e.on(["shape.added","shape.changed"],Uy,function(r){var l=r.element,s=r.gfx,c=F.query(".djs-outline",s);c||(c=a.getOutline(l)||i(),j.append(s,c)),a.updateShapeOutline(c,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,s=r.gfx,c=F.query(".djs-outline",s);c||(c=i(),j.append(s,c)),a.updateConnectionOutline(c,l)})}_n.prototype.updateShapeOutline=function(e,t){var n=!1,a=this._getProviders();a.length&&k.forEach(a,function(i){n=n||i.updateOutline(t,e)}),n||j.attr(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},_n.prototype.updateConnectionOutline=function(e,t){var n=_t(t);j.attr(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})},_n.prototype.registerProvider=function(e,t){t||(t=e,e=Dy),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_n.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_n.prototype.getOutline=function(e){var t,n=this._getProviders();return k.forEach(n,function(a){k.isFunction(a.getOutline)&&(t=t||a.getOutline(e))}),t},_n.$inject=["eventBus","styles","elementRegistry"];var ya=6;function Di(e,t,n){this._canvas=t;var a=this;e.on("element.changed",function(i){n.isSelected(i.element)&&a._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}Di.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");j.clear(t);var n=e.length>1,a=this._canvas.getContainer();if(j.classes(a)[n?"add":"remove"]("djs-multi-select"),!!n){var i=Yy(_t(e)),r=j.create("rect");j.attr(r,k.assign({rx:3},i)),j.classes(r).add("djs-selection-outline"),j.append(t,r)}},Di.$inject=["eventBus","canvas","selection"];function Yy(e){return{x:e.x-ya,y:e.y-ya,width:e.width+ya*2,height:e.height+ya*2}}const yd={__depends__:[Wn],__init__:["outline","multiSelectionOutline"],outline:["type",_n],multiSelectionOutline:["type",Di]};var Jy=500,Gy=1250,Ky=1500,ba=Math.round;function qy(e){return{x:e.x+ba(e.width/2),y:e.y+ba(e.height/2)}}function bd(e,t,n,a,i){function r(s,c,d,u){return i.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",Ky,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=Xy(u),k.assign(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",Gy,function(s){var c=s.context,d=c.validatedShapes,u;if(u=c.canExecute=r(d),!u)return!1}),e.on("shape.move.move",Jy,function(s){var c=s.context,d=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},h={x:s.x,y:s.y},g;if(g=r(d,f,h,u),c.delta=f,c.canExecute=g,g===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,d=c.delta,u=c.canExecute,f=u==="attach",h=c.shapes;if(u===!1)return!1;d.x=ba(d.x),d.y=ba(d.y),!(d.x===0&&d.y===0)&&n.moveElements(h,d,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if($t(s)){var c=zn(s);if(!c)throw new Error("must supply DOM mousedown event");return l(c,s.element)}});function l(s,c,d,u){if(k.isObject(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!j.classes(s.target).has("djs-hit-no-move")){var f=qy(c);return t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=l}bd.$inject=["eventBus","dragging","modeling","selection","rules"];function Xy(e){var t=k.groupBy(e,"id");return k.filter(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var vd=499,Yi="djs-dragging",wd="drop-ok",Cd="drop-not-ok",xd="new-parent",kd="attach-ok";function Ed(e,t,n,a){function i(c){var d=r(c),u=Zy(d);return u}function r(c){var d=Lp(c),u=d.flatMap(g=>(g.incoming||[]).concat(g.outgoing||[])),f=d.concat(u),h=[...new Set(f)];return h}function l(c,d){[kd,wd,Cd,xd].forEach(function(u){u===d?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,d,u){a.addDragger(d,c.dragGroup),u&&t.addMarker(d,Yi),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",vd,function(c){var d=c.context,u=d.shapes,f=d.allDraggedElements,h=i(u);if(!d.dragGroup){var g=j.create("g");j.attr(g,n.cls("djs-drag-group",["no-events"]));var p=t.getActiveLayer();j.append(p,g),d.dragGroup=g}h.forEach(function(m){a.addDragger(m,d.dragGroup)}),f?f=k.flatten([f,r(u)]):f=r(u),k.forEach(f,function(m){t.addMarker(m,Yi)}),d.allDraggedElements=f,d.differentParents=Qy(u)}),e.on("shape.move.move",vd,function(c){var d=c.context,u=d.dragGroup,f=d.target,h=d.shape.parent,g=d.canExecute;f&&(g==="attach"?l(f,kd):d.canExecute&&h&&f.id!==h.id?l(f,xd):l(f,d.canExecute?wd:Cd)),Rt(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context,u=d.target;u&&l(u,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,f=d.dragGroup;k.forEach(u,function(h){t.removeMarker(h,Yi)}),f&&j.remove(f)}),this.makeDraggable=s}Ed.$inject=["eventBus","canvas","styles","previewSupport"];function Zy(e){var t=k.filter(e,function(n){return ut(n)?k.find(e,k.matchPattern({id:n.source.id}))&&k.find(e,k.matchPattern({id:n.target.id})):!0});return t}function Qy(e){return k.size(k.groupBy(e,function(t){return t.parent&&t.parent.id}))!==1}const eb={__depends__:[Xa,Wn,yd,Yn,gn,ei],__init__:["move","movePreview"],move:["type",bd],movePreview:["type",Ed]};var Sd=".djs-palette-toggle",_d=".entry",tb=Sd+", "+_d,Ji="djs-palette-",nb="shown",Gi="open",Rd="two-column",ob=1e3;function Ze(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(a){var i=a.tool;n.updateToolHighlight(i)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ze.$inject=["eventBus","canvas"],Ze.prototype.registerProvider=function(e,t){t||(t=e,e=ob),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ze.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(ib,{})},Ze.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ze.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),a=this._container=F.domify(Ze.HTML_MARKUP);n.appendChild(a),F.classes(n).add(Ji+nb),F.delegate.bind(a,tb,"click",function(i){var r=i.delegateTarget;if(F.matches(r,Sd))return e.toggle();e.trigger("click",i)}),F.event.bind(a,"mousedown",function(i){i.stopPropagation()}),F.delegate.bind(a,_d,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},Ze.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ze.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,a=this._eventBus,i,r=F.classes(n),l=F.classes(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Rd,i),l.toggle(Ji+Rd,i),"open"in e&&(r.toggle(Gi,e.open),l.toggle(Ji+Gi,e.open)),a.fire("palette.changed",{twoColumn:i,open:this.isOpen()})},Ze.prototype._update=function(){var e=F.query(".djs-palette-entries",this._container),t=this._entries=this.getEntries();F.clear(e),k.forEach(t,function(n,a){var i=n.group||"default",r=F.query("[data-group="+Ii(i)+"]",e);r||(r=F.domify('<div class="group"></div>'),F.attr(r,"data-group",i),e.appendChild(r));var l=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=F.domify(l);if(r.appendChild(s),!n.separator&&(F.attr(s,"data-action",a),n.title&&F.attr(s,"title",n.title),n.className&&ab(s,n.className),n.imageUrl)){var c=F.domify("<img>");F.attr(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ze.prototype.trigger=function(e,t,n){var a,i,r=t.delegateTarget||t.target;return r?(a=F.attr(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,n)):t.preventDefault()},Ze.prototype.triggerEntry=function(e,t,n,a){var i=this._entries,r,l;if(r=i[e],!!r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(k.isFunction(l)){if(t==="click")return l(n,a)}else if(l[t])return l[t](n,a);n.preventDefault()}},Ze.prototype._layoutChanged=function(){this._toggleState({})},Ze.prototype._needsCollapse=function(e,t){var n=50,a=Object.keys(t).length*46;return e<a+n},Ze.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ze.prototype.open=function(){this._toggleState({open:!0})},Ze.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ze.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ze.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=F.query(".djs-palette-entries",this._container),this._toolsContainer=F.query("[data-group=tools]",t)),n=this._toolsContainer,k.forEach(n.children,function(a){var i=a.getAttribute("data-action");if(i){var r=F.classes(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},Ze.prototype.isOpen=function(){return F.classes(this._container).has(Gi)},Ze.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ze.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function ab(e,t){var n=F.classes(e),a=k.isArray(t)?t:t.split(/\s+/g);a.forEach(function(i){n.add(i)})}function ib(e,t){var n=t.getPaletteEntries();return k.isFunction(n)?n(e):(k.forEach(n,function(a,i){e[i]=a}),e)}const rb={__init__:["palette"],palette:["type",Ze]};function Bd(e,t,n,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Fp(r)+".changed",i)}),e.on("elements.changed",function(i){var r=i.elements;r.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(r)}),e.on("shape.changed",function(i){a.update("shape",i.element,i.gfx)}),e.on("connection.changed",function(i){a.update("connection",i.element,i.gfx)})}Bd.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const lb={__init__:["changeSupport"],changeSupport:["type",Bd]};var va=Math.max,wa=Math.min,sb=20;function cb(e,t,n){var a=n.x,i=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+i,r.height=e.height-i):t.indexOf("s")!==-1&&(r.height=e.height+i),t.indexOf("e")!==-1?r.width=e.width+a:t.indexOf("w")!==-1&&(r.x=e.x+a,r.width=e.width-a),r}function Ca(e,t,n){var a=t[e],i=n.min&&n.min[e],r=n.max&&n.max[e];return k.isNumber(i)&&(a=(/top|left/.test(e)?wa:va)(a,i)),k.isNumber(r)&&(a=(/top|left/.test(e)?va:wa)(a,r)),a}function db(e,t){if(!t)return e;var n=Te(e);return Vs({top:Ca("top",n,t),right:Ca("right",n,t),bottom:Ca("bottom",n,t),left:Ca("left",n,t)})}function ub(e,t,n,a){var i=Te(t),r={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},l=a?Te(a):r,s={top:wa(r.top,l.top),left:wa(r.left,l.left),bottom:va(r.bottom,l.bottom),right:va(r.right,l.right)};return Vs(s)}function So(e,t){return typeof e<"u"?e:sb}function fb(e,t){var n,a,i,r;return typeof t=="object"?(n=So(t.left),a=So(t.right),i=So(t.top),r=So(t.bottom)):n=a=i=r=So(t),{x:e.x-n,y:e.y-i,width:e.width+n+a,height:e.height+i+r}}function hb(e){return!(e.waypoints||e.type==="label")}function pb(e,t){var n;if(e.length===void 0?n=k.filter(e.children,hb):n=e,n.length)return fb(_t(n),t)}var Td=10;function _o(e,t,n,a){this._dragging=a,this._rules=t;var i=this;function r(c,d){var u=c.shape,f=c.direction,h=c.resizeConstraints,g;c.delta=d,g=cb(u,f,d),c.newBounds=db(g,h),c.canExecute=i.canResize(c)}function l(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(c)),c.resizeConstraints={min:Te(u)})}function s(c){var d=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=hg(f),!gb(d,f))return;n.resizeShape(d,f)}}e.on("resize.start",function(c){l(c.context)}),e.on("resize.move",function(c){var d={x:c.dx,y:c.dy};r(c.context,d)}),e.on("resize.end",function(c){s(c.context)})}_o.prototype.canResize=function(e){var t=this._rules,n=k.pick(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},_o.prototype.activate=function(e,t,n){var a=this._dragging,i,r;if(typeof n=="string"&&(n={direction:n}),i=k.assign({shape:t},n),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Md(t,r),"resize",{autoActivate:!0,cursor:mb(r),data:{shape:t,context:i}})},_o.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,a,i;return a=e.minDimensions||{width:Td,height:Td},i=pb(t,e.childrenBoxPadding),ub(n,t,a,i)},_o.$inject=["eventBus","rules","modeling","dragging"];function gb(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Md(e,t){var n=Je(e),a=Te(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function mb(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 Pd="djs-resizing",jd="resize-not-ok",yb=500;function Ad(e,t,n){function a(r){var l=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(l,t.getActiveLayer()),t.addMarker(l,Pd)),s.width>5&&j.attr(c,{x:s.x,width:s.width}),s.height>5&&j.attr(c,{y:s.y,height:s.height}),r.canExecute?j.classes(c).remove(jd):j.classes(c).add(jd)}function i(r){var l=r.shape,s=r.frame;s&&j.remove(r.frame),t.removeMarker(l,Pd)}e.on("resize.move",yb,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}Ad.$inject=["eventBus","canvas","previewSupport"];var xa=-6,ka=8,Ea=20,Ro="djs-resizer",bb=["n","w","s","e","nw","ne","se","sw"];function nn(e,t,n,a){this._resize=a,this._canvas=t;var i=this;e.on("selection.changed",function(r){var l=r.newSelection;i.removeResizers(),l.length===1&&k.forEach(l,k.bind(i.addResizer,i))}),e.on("shape.changed",function(r){var l=r.element;n.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}nn.prototype.makeDraggable=function(e,t,n){var a=this._resize;function i(r){$t(r)&&a.activate(r,e,n)}F.event.bind(t,"mousedown",i),F.event.bind(t,"touchstart",i)},nn.prototype._createResizer=function(e,t,n,a){var i=this._getResizersParent(),r=vb(a),l=j.create("g");j.classes(l).add(Ro),j.classes(l).add(Ro+"-"+e.id),j.classes(l).add(Ro+"-"+a),j.append(i,l);var s=j.create("rect");j.attr(s,{x:-ka/2+r.x,y:-ka/2+r.y,width:ka,height:ka}),j.classes(s).add(Ro+"-visual"),j.append(l,s);var c=j.create("rect");return j.attr(c,{x:-Ea/2+r.x,y:-Ea/2+r.y,width:Ea,height:Ea}),j.classes(c).add(Ro+"-hit"),j.append(l,c),Yp(l,t,n),l},nn.prototype.createResizer=function(e,t){var n=Md(e,t),a=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,a,t)},nn.prototype.addResizer=function(e){var t=this;ut(e)||!this._resize.canResize({shape:e})||k.forEach(bb,function(n){t.createResizer(e,n)})},nn.prototype.removeResizers=function(){var e=this._getResizersParent();j.clear(e)},nn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},nn.$inject=["eventBus","canvas","selection","resize"];function vb(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-xa:e.indexOf("w")!==-1&&(t.x=xa),e.indexOf("s")!==-1?t.y=-xa:e.indexOf("n")!==-1&&(t.y=xa),t}const wb={__depends__:[Yn,gn,ei],__init__:["resize","resizePreview","resizeHandles"],resize:["type",_o],resizePreview:["type",Ad],resizeHandles:["type",nn]};function Bo(e,t,n,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,n.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{n.isActive()&&n.complete()}),e.on(["commandStack.changed"],()=>{n.isActive()&&n.cancel()}),e.on("directEditing.activate",()=>{i.removeResizers()}),e.on("create.end",500,s=>{const{context:c,isTouch:d}=s,u=c.shape,{canExecute:f}=s.context;d||f&&(c.hints&&c.hints.createElementsBehavior===!1||l(u))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,c){(c||Ei(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&n.activate(s)}}Bo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Bo.prototype.activate=function(e){const t=ia(e);if(t===void 0)return;const n={text:t},a=this.getEditingBBox(e);Fe(n,a);const i={};return(Ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Fe(i,{centerVertically:!0}),Si(e)&&Fe(i,{autoResize:!0}),Fe(n,{options:i}),n},Bo.prototype.getEditingBBox=function(e){const t=this._canvas,n=e.label||e,a=t.getAbsoluteBBox(n),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*l,u=c.lineHeight,f=s.fontSize*l,h=s.lineHeight,g={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Ei(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Fe(r,{width:a.width,height:a.height}),Fe(g,{fontSize:f+"px",lineHeight:h,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const p=90*l,m=7*l,y=4*l;if(n.labelTarget&&(Fe(r,{width:p,height:a.height+m+y,x:i.x-p/2,y:a.y-m}),Fe(g,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})),Si(n)&&!yc(n)&&!Co(n)){const v=bc(e),w=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),C=d+m+y;Fe(r,{width:p,height:C,x:w.x-p/2,y:w.y-C/2}),Fe(g,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})}return{bounds:r,style:g}},Bo.prototype.update=function(e,t){let n;Cb(t)&&(t=null),this._modeling.updateLabel(e,t,n)};function Cb(e){return!e||!e.trim()}const xb={__depends__:[lb,wb,fu],__init__:["labelEditingProvider"],labelEditingProvider:["type",Bo]};function on(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}on.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},on.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},on.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},on.prototype.getSnapLocations=function(){return this._snapLocations},on.prototype.setSnapLocations=function(e){this._snapLocations=e},on.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Sa,n.initDefaults(this._defaultSnaps)),n};function Sa(){this._snapValues={}}Sa.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Sa.prototype.snap=function(e,t,n,a){var i=this._snapValues[t];return i&&gy(e[n],i[n],a)},Sa.prototype.initDefaults=function(e){var t=this;k.forEach(e||{},function(n,a){k.forEach(n,function(i){t.add(a,i)})})};var kb=1250;function Pt(e,t,n){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(i){a.initSnap(i)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],kb,function(i){var r=i.context,l=r.shape,s=r.snapContext,c=r.target;if(!(i.originalEvent&&rs(i.originalEvent))&&!(pa(i)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,l,c),d.initialized=!0),n.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Pt.$inject=["elementRegistry","eventBus","snapping"],Pt.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,a=n.shape,i=n.snapContext;i||(i=n.snapContext=new on);var r;t.get(a.id)?r=Xn(a,e):r={x:e.x+Xn(a).x,y:e.y+Xn(a).y};var l={x:r.x-a.width/2,y:r.y-a.height/2},s={x:r.x+a.width/2,y:r.y+a.height/2};return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Jn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),i},Pt.prototype.addSnapTargetPoints=function(e,t,n){var a=this.getSnapTargets(t,n);return k.forEach(a,function(i){if(Jn(i)){Jn(t)&&e.add("mid",Xn(i));return}if(ut(i)){if(i.waypoints.length<3)return;var r=i.waypoints.slice(1,-1);k.forEach(r,function(l){e.add("mid",l)});return}e.add("mid",Xn(i))}),!k.isNumber(t.x)||!k.isNumber(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Xn(t)),e},Pt.prototype.getSnapTargets=function(e,t){return rd(t).filter(function(n){return!Eb(n)})};function Eb(e){return!!e.hidden}function to(e){e.invoke(Pt,this)}un(to,Pt),to.$inject=["injector"],to.prototype.initSnap=function(e){return Pt.prototype.initSnap.call(this,e)},to.prototype.addSnapTargetPoints=function(e,t,n){return Pt.prototype.addSnapTargetPoints.call(this,e,t,n)},to.prototype.getSnapTargets=function(e,t){return Pt.prototype.getSnapTargets.call(this,e,t)};var Sb=1250;function To(e,t){var n=this;e.on(["resize.start"],function(a){n.initSnap(a)}),e.on(["resize.move","resize.end"],Sb,function(a){var i=a.context,r=i.shape,l=r.parent,s=i.direction,c=i.snapContext;if(!(a.originalEvent&&rs(a.originalEvent))&&!pa(a)){var d=c.pointsForTarget(l);d.initialized||(d=n.addSnapTargetPoints(d,r,l,s),d.initialized=!0),Bb(s)&&Ht(a,"x",a.x),Tb(s)&&Ht(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}To.prototype.initSnap=function(e){var t=e.context,n=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new on);var r=Vd(n,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},To.prototype.addSnapTargetPoints=function(e,t,n,a){var i=this.getSnapTargets(t,n);return k.forEach(i,function(r){e.add("corner",yy(r)),e.add("corner",my(r))}),e.add("corner",Vd(t,a)),e},To.$inject=["eventBus","snapping"],To.prototype.getSnapTargets=function(e,t){return rd(t).filter(function(n){return!_b(n,e)&&!ut(n)&&!Rb(n)&&!Jn(n)})};function Vd(e,t){var n=Je(e),a=Te(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function _b(e,t){return e.host===t}function Rb(e){return!!e.hidden}function Bb(e){return e==="n"||e==="s"}function Tb(e){return e==="e"||e==="w"}var Mb=7,Pb=1e3;function an(e){this._canvas=e,this._asyncHide=k.debounce(k.bind(this.hide,this),Pb)}an.$inject=["canvas"],an.prototype.snap=function(e,t){var n=e.context,a=n.snapContext,i=a.getSnapLocations(),r={x:pa(e,"x"),y:pa(e,"y")};k.forEach(i,function(l){var s=a.getSnapOrigin(l),c={x:e.x+s.x,y:e.y+s.y};if(k.forEach(["x","y"],function(d){var u;r[d]||(u=t.snap(c,l,d,Mb),u!==void 0&&(r[d]={value:u,originValue:u-s[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),k.forEach(["x","y"],function(l){var s=r[l];k.isObject(s)&&Ht(e,l,s.originValue)})},an.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=j.create("path");return j.attr(n,{d:"M0,0 L0,0"}),j.classes(n).add("djs-snap-line"),j.append(t,n),{update:function(a){k.isNumber(a)?e==="horizontal"?j.attr(n,{d:"M-100000,"+a+" L+100000,"+a,display:""}):j.attr(n,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):j.attr(n,{display:"none"})}}},an.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},an.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},an.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},an.prototype.hide=function(){k.forEach(this._snapLines,function(e){e.update()})};const jb={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Pt],resizeSnapping:["type",To],snapping:["type",an]}],__init__:["createMoveSnapping"],createMoveSnapping:["type",to]};function no(e){it.call(this,e),this.init()}no.$inject=["eventBus"],mn(no,it),no.prototype.addRule=function(e,t,n){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,s){return n(r)},!0)})},no.prototype.init=function(){};function Mo(e){no.call(this,e)}Mo.$inject=["eventBus"],un(Mo,no),Mo.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,n=e.target,a=e.hints||{},i=a.targetParent,r=a.targetAttach;if(r)return!1;i&&(n.parent=i);try{return Ki(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){e.connection;var t=e.source,n=e.target;return Ki(t,n)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,n=e.shape;return t.parent&&(t=parent),!(n.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==n.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return Wp(t)})},Mo.prototype.canConnect=Ki;function Ki(e,t,n){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}const Ab={__init__:["myRuleProvider"],myRuleProvider:["type",Mo]};function qi(e,t,n,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=n,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}qi.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],qi.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,n=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(c,d,u,f,h){function g(p){const m=t.createShape(Fe({type:c},h));e.start(p,m)}return{group:d,className:u,title:f,action:{dragstart:g,click:g}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(c){n.activateHand(c)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(c){a.activateSelection(c)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(c){i.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=l(d.type,d.group,d.className,d.title,d.options)}return s};const Vb={__init__:["paletteProvider"],paletteProvider:["type",qi]};var Nd=50,Nb=250;function Ib(e,t){t||(t={});function n(p){return p.source===e?1:-1}var a=t.defaultDistance||Nd,i=t.direction||"e",r=t.filter,l=t.getWeight||n,s=t.maxDistance||Nb,c=t.reference||"start";r||(r=Hb);function d(p,m){return i==="n"?c==="start"?Te(p).top-Te(m).bottom:c==="center"?Te(p).top-Je(m).y:Te(p).top-Te(m).top:i==="w"?c==="start"?Te(p).left-Te(m).right:c==="center"?Te(p).left-Je(m).x:Te(p).left-Te(m).left:i==="s"?c==="start"?Te(m).top-Te(p).bottom:c==="center"?Je(m).y-Te(p).bottom:Te(m).bottom-Te(p).bottom:c==="start"?Te(m).left-Te(p).right:c==="center"?Je(m).x-Te(p).right:Te(m).right-Te(p).right}var u=e.incoming.filter(r).map(function(p){var m=l(p),y=m<0?d(p.source,e):d(e,p.source);return{id:p.source.id,distance:y,weight:m}}),f=e.outgoing.filter(r).map(function(p){var m=l(p),y=m>0?d(e,p.target):d(p.target,e);return{id:p.target.id,distance:y,weight:m}}),h=u.concat(f).reduce(function(p,m){return p[m.id+"__weight_"+m.weight]=m,p},{}),g=k.reduce(h,function(p,m){var y=m.distance,v=m.weight;return y<0||y>s||(p[String(y)]||(p[String(y)]=0),p[String(y)]+=1*v,(!p.distance||p[p.distance]<p[String(y)])&&(p.distance=y)),p},{});return g.distance||a}function Hb(){return!0}var Ob=100;function Id(e,t,n){e.on("autoPlace",Ob,function(a){var i=a.shape,r=a.source;return Lb(r,i)}),e.on("autoPlace.end",function(a){n.scrollToElement(a.shape)}),this.append=function(a,i,r){e.fire("autoPlace.start",{source:a,shape:i});var l=e.fire("autoPlace",{source:a,shape:i}),s=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}Id.$inject=["eventBus","modeling","canvas"];function Lb(e,t,n){n||(n={});var a=n.defaultDistance||Nd,i=Je(e),r=Te(e);return{x:r.right+a+t.width/2,y:i.y}}function Hd(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Hd.$inject=["eventBus","selection"];const zb={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Id],autoPlaceSelectionBehavior:["type",Hd]},$b=10,Fb=(e,t)=>e.type===t;function Wb(e){return e.incoming.map(t=>t.source)}function Ub(e){return e.outgoing.map(t=>t.target)}function Xi(e){return Ub(e).concat(Wb(e))}function Db(e){let t=Xi(e);return e.host&&(t=t.concat(Xi(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((n,a)=>n.concat(Xi(a)),[]))),t.filter(n=>n.type!=="myline")}function Yb(e,t,n){const a={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=Db(e);return k.find(i,r=>r===n?!1:Jt(r,a,$b)==="intersect")}function Jb(e,t,n,a){let i;for(;i=Yb(e,n,t);)n=a(t,n,i);return n}function Gb(e){return function(t,n,a){const i={x:n.x,y:n.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=l;c<0?i[r]=Math.min(a[r]+c-t[s]/2,n[r]-d+c):i[r]=Math.max(a[r]+a[s]+c+t[s]/2,n[r]+d+c)}),i}}function Kb(e,t){return qb(e,t)}function qb(e,t){const n=Te(e),a=Je(e),i=Ib(e,{filter:u=>Fb(u,"myline")}),r=30,l=80,c={x:n.right+i+t.width/2,y:a.y+Xb("left",l)};return Jb(e,t,c,Gb({y:{margin:r,minDistance:l}}))}function Xb(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Od(e){e.on("autoPlace",t=>{const{shape:n,source:a}=t;return Kb(a,n)})}Od.$inject=["eventBus"];const Zb={__depends__:[zb],__init__:["myAutoPlace"],myAutoPlace:["type",Od]};function Zi(e,t,n,a,i,r,l){this._connect=e,this._modeling=n,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}Zi.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Zi.prototype.getContextPadEntries=function(e){const t=this._connect,n=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function s(){n.removeElements([e])}function c(f,h,g){t.start(f,h,g)}function d(f,h,g,p){typeof g!="string"&&(p=g);function m(v,w){const C=a.createShape(Fe({type:f},p));r.start(v,C,{source:w})}function y(v,w){const C=a.createShape(Fe({type:f},p));i.append(w,C)}return{group:"model",className:h,title:g,action:{dragstart:m,click:y}}}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 u={};for(const f in l.palette)if(f!=="create.start-event"){const h=l.palette[f];u[f]=d(h.type,h.className,h.title,h.options)}return u.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:c,dragstart:c}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},u};const Qb={__init__:["ContextPadProvider"],ContextPadProvider:["type",Zi]},ev=o.defineComponent({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=o.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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const P=s.get("eventBus");P.on("element.dblclick",B=>{i("elementDblclick",B.element.businessObject)}),P.on("element.click",B=>{i("elementClick",B.element.businessObject)}),P.on("create.end",B=>{i("elementCreate",B.elements[0].businessObject)}),P.on("autoPlace.end",B=>{i("elementCreate",B.shape.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let P={__init__:["myOptions"],myOptions:["type",f]};s=new rr({canvas:{container:r.value},modules:[vy,ci,ky,Hy,ws,Km,$y,Fy,Wy,Mc,zs,eb,yd,rb,Ws,P,Zb,Ac,xb,Qb,Vb,Ab,jb,Nc]});const B=s.get("canvas"),H=s.get("elementFactory");d();const I=H.createRoot();B.setRootElement(I),u()};o.onMounted(()=>{h()});const g=P=>{const B=P==null?1:c+P;s.get("canvas").zoom(B),c=B},p=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},y=()=>{s.get("canvas").zoom(1);const P=s.get("elementRegistry").getAll();var B=Ic(P);return B},v=P=>{s.clear(),d(),Hc(P,s)},w=P=>{s.get("myImporter").update(P.id,P)};return t({reset:()=>{d()},zoom:P=>{g(P)},redo:()=>{p()},undo:()=>{m()},getData:()=>y(),setData:P=>{v(P)},updateElemet:P=>{w(P)}}),(P,B)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Ld=ne(Jm),zd=ne(ev),$d=ne(o.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:n}){const a=e,i=n,{t:r}=Qe(),{formData:l}=zt(),s=o.computed(()=>a.editConfig.isAddBtn!==!1),c=o.computed(()=>a.editConfig.addBtnText||"添加"),d=o.computed(()=>a.editConfig.buttonsAlign||"left"),u=o.computed(()=>a.editConfig.isRemoveBtn!==!1),f=o.computed(()=>a.editConfig.readonly),h=o.computed(()=>a.editConfig.isNullValue!==!1),g=o.ref([]),p=b=>{i("rowChange",b)},m=()=>{const b={_i:Vt()};a.columns.forEach(_=>{const E=_.config?.valueRowKey||_.id||"";E&&(b[E]=kt(_.config?.defaultValue))}),g.value.push(b),i("change",{id:a.id,value:b,data:b,formData:l,tableData:g.value,type:"add"})},y=b=>{const _=g.value[b];g.value.splice(b,1),i("change",{id:a.id,value:_,data:_,formData:l,tableData:g.value,type:"delete"})},v=()=>{const b={isOk:!0,info:""};if(a.required&&g.value.length===0)return b.isOk=!1,b.info="请添加表格数据",b;const _=g.value.length,E=a.columns,T=E.length;for(let P=0;P<_;P++){const B=g.value[P];for(let H=0;H<T;H++){const I=E[H];if(C(I.config,P).display!==!1&&I.rule&&I.rule.length>0){const O=I.rule.length;for(let M=0;M<O;M++){const R=I.rule[M];if(R.pattern=R.pattern?R.pattern+"":"",R.pattern&&!bt(B[I.prop||""])&&!new RegExp(R.pattern.substring(1,R.pattern.length-1)).test(B[I.prop||""]))return b.info=`${r("第")}${P+1}${r("行")},${r("第")}${H+1}${r("列")},${r(I.label)}:${r(R.message)}`,b.isOk=!1,b;if(R.required&&bt(B[I.prop||""]))return b.isOk=!1,b.info=`${r("第")}${P+1}${r("行")},${r("第")}${H+1}${r("列")},${r(I.label)}:${r("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(g.value=a.modelValue||[],g.value.forEach(b=>{b._i||(b._i=Vt())})):(g.value=[],i("update:modelValue",g.value));const C=(b,_)=>{const E={...b};if(E.getUpConfig){const T=b.getUpConfig({formData:l,index:_,row:g.value[_],tableData:g.value,config:E});T&&Object.keys(T).forEach(P=>{E[P]=T[P]})}return E},x=b=>{const _=b||a.labelWidth;return typeof _=="string"?_:typeof _=="number"?_+"px":_};return t({validate:()=>v()}),ro({getTableData:()=>g.value,rowChange:p}),(b,_)=>{const E=o.resolveComponent("j-comp"),T=o.resolveComponent("el-form-item"),P=o.resolveComponent("el-col"),B=o.resolveComponent("j-button"),H=o.resolveComponent("el-row");return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",o.mergeProps({class:"j-input-cards"},b.$attrs),[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(g.value,(I,O)=>(o.openBlock(),o.createElementBlock("div",{class:"j-input-cards-item",key:I.i,style:{"margin-bottom":"8px"}},[o.createVNode(H,{gutter:e.gutter},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.columns,M=>(o.openBlock(),o.createBlock(P,{key:M.prop,span:M.config?.span||e.span||24,style:o.normalizeStyle({"margin-bottom":(M.getInputType?M.getInputType(I):M.inputType)=="j-input-rows"?"8px":void 0})},{default:o.withCtx(()=>[o.withDirectives(o.createVNode(T,{"label-width":x(M.config?.labelWidth),label:o.unref(r)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:o.withCtx(()=>[o.createVNode(E,o.mergeProps({ref_for:!0},M,{row:I}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[o.vShow,C(M.config,O).display!==!1]])]),_:2},1032,["span","style"]))),128)),u.value&&(h.value||g.value.length>1)&&!f.value?(o.openBlock(),o.createBlock(B,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>y(O)},null,8,["onClick"])):o.createCommentVNode("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!f.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({"text-align":d.value})},[s.value?(o.openBlock(),o.createBlock(B,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:m},null,8,["label"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)],64)}}})),tv=[jo,zr,$r,Fr,Wr,Ur,Dr,Yr,Jr,Gr,Kr,qr,ol,al,il,rl,Ua,Lr,ll,sl,cl,ul,hl,pl,El,gl,ml,yl,bl,vl,wl,Cl,xl,kl,Bl,Tl,Ml,Pl,jl,Al,Vl,Nl,Il,Sl,_l,Da,Hl,Ol,Ll,zl,$l,Fl,Wl,yp,Ld,zd,$d],nv={install:e=>{tv.forEach(t=>{e.component(t.name,t)})}};A.EncryptionFactory=Sr,A.EventBus=za,A.HashingFactory=Bu,A.INJECT_KEYS=tt,A.JAutoComplete=Kr,A.JBarcode=pl,A.JButton=jo,A.JButtonSelect=Bl,A.JButtons=zr,A.JCascaderSelect=Yr,A.JCheckbox=Jr,A.JCodeMirror=El,A.JCollapse=Fl,A.JComp=Pl,A.JCount=gl,A.JCountUp=ml,A.JDataPanel=yl,A.JDate=Fr,A.JDialog=al,A.JDialogFull=il,A.JDivider=bl,A.JDrawer=rl,A.JDynamicLayer=Lr,A.JEcharts=hl,A.JEditor=Wl,A.JForm=jl,A.JFormItem=Al,A.JGuid=Nl,A.JHpanel=vl,A.JIcon=Wr,A.JInput=$r,A.JInputButton=wl,A.JInputCards=$d,A.JInputCode=Cl,A.JInputColor=xl,A.JInputLayer=Ol,A.JInputRows=Hl,A.JInputTag=ll,A.JLayer=Ua,A.JLayerForm=Ll,A.JLayout=qr,A.JMenu=_l,A.JNumber=Gr,A.JPage=Vl,A.JPanel=Il,A.JRadio=Ur,A.JRate=sl,A.JSelect=Dr,A.JSlider=cl,A.JSliderCaptcha=Sl,A.JSwitch=zl,A.JTable=ol,A.JTablePanel=Da,A.JTabs=$l,A.JTitle=kl,A.JTree=Tl,A.JTreeSelect=Ml,A.JUpload=ul,A.JWorkflow=zd,A.JWorkflowViewer=Ld,A.assign=Fe,A.buildShortUUID=Vo,A.buildUUID=Vt,A.clearJson=Pn,A.clone=Ao,A.deepClone=kt,A.default=nv,A.eventBus=Mu,A.formatToDate=io,A.formatToDateTime=La,A.fullScreenLoading=jn,A.getCompConfig=hn,A.getCompType=Oa,A.getFunction=Ia,A.getIsInputComp=Io,A.getIsTableInputComp=vr,A.getLabel=wr,A.getObjType=cr,A.getTextWidth=vt,A.is=sr,A.isArray=Po,A.isNullOrEmpty=bt,A.isObject=pu,A.loadBMap=Rr,A.lowerFirst=wu,A.myAesDecrypt=Tu,A.numberToChinese=dr,A.numberToThousandSeparator=ur,A.pagination=yu,A.paginationEx=bu,A.set=No,A.setGroupMap=hr,A.toArray=gr,A.toDecimal=ao,A.toLeafArray=br,A.toSimpleTree=xu,A.toTree=Cu,A.uniqueArray=vu,A.upFirst=fr,A.useAppInject=Qe,A.useAppProvide=Pu,A.useAuthPageInject=Ar,A.useAuthPageProvide=Vr,A.useCompInject=Tr,A.useCompProvide=Fa,A.useFormInject=zt,A.useFormProvide=$a,A.useHMenuInject=Pr,A.useHMenuProvide=jr,A.useInject=Et,A.useLayer=On,A.useLayerInject=ju,A.useLayerProvide=Nr,A.useMenuInject=Hn,A.useMenuProvide=Mr,A.usePageInject=Ir,A.usePageProvide=Hr,A.useProvide=St,A.useSortable=_r,A.useTableInject=Br,A.useTableProvide=ro,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|