@a2simcode/ui 0.0.53 → 0.0.54

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.
@@ -13,4 +13,4 @@
13
13
  roundFun,
14
14
  sumFun,
15
15
  sumproductFun,
16
- getCompValue)=>{ return ${j} }`;let _;const B=ua(j);if(B.res)try{_=B.fn(a,i,r,l,c,s,d,u,f,h,m,p,g,y,w)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(B.msg),"";return Number.isNaN(_)?"":(o.decimal!==void 0&&(_=_.toFixed(o.decimal)),_)}),S=n.computed(()=>{let v=C.value;return o.thousandSeparator&&(v=zi(v)),o.isChinese&&(v=Ii(v)),v});return n.watch(C,v=>{x("update:modelValue",v),x("change",{value:v,data:S.value})}),(v,j)=>{const _=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(_,{modelValue:S.value,"onUpdate:modelValue":j[0]||(j[0]=B=>S.value=B),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),sf={key:0},Hr=te(n.defineComponent({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=n.computed(()=>({...o})),i=n.ref(),r=n.ref(null),l=n.computed(()=>o.options);n.onMounted(()=>{o.animation&&c()}),n.watch(()=>o.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=o.decimals,r.value.reset(),r.value.update(o.endValue))},{deep:!0}),n.watch(()=>o.endValue,h=>{r.value&&r.value.update&&r.value.update(h)});const c=()=>{r.value||(l.value.startVal=o.startValue,l.value.decimalPlaces=o.decimals,l.value.duration=o.duration,r.value=new Sd.CountUp(i.value,Number(o.endValue),l.value),r.value.start(()=>{o.callback?.(r.value)}))};return n.onUnmounted(()=>{r.value=null}),n.onBeforeUnmount(()=>{r.value=null}),t({myProps:a,el:i,init:c,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,m)=>(n.openBlock(),n.createElementBlock("span",{ref_key:"el",ref:i},[e.animation?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("span",sf,n.toDisplayString(e.endValue),1))],512))}})),df={class:"j-block j-data-panel"},uf={key:0,class:"j-data-panel-header"},ff={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},pf={class:"j-data-panel-header-right"},hf={class:"j-data-panel-body"},Wr=te(n.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",df,[e.title?(n.openBlock(),n.createElementBlock("div",uf,[n.createElementVNode("div",ff,n.toDisplayString(e.title),1),n.createElementVNode("div",pf,[n.renderSlot(t.$slots,"titleRight")])])):n.createCommentVNode("",!0),n.createElementVNode("div",hf,[n.renderSlot(t.$slots,"default")])]))}})),mf={class:"j-divider-content"},Ur=te(n.defineComponent({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=n.computed(()=>{const i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=n.computed(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(`j-divider-container j-divider-${e.contentPosition}`),style:n.normalizeStyle(o.value)},[n.createElementVNode("div",{class:"j-divider-line j-divider-line-left",style:n.normalizeStyle(a.value)},null,4),n.createElementVNode("div",mf,[n.createElementVNode("span",null,n.toDisplayString(e.content||""),1)]),n.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:n.normalizeStyle(a.value)},null,4)],6))}})),gf={class:"j-hpanel"},yf={class:"j-hpanel-main"},Dr=te(n.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",gf,[n.renderSlot(t.$slots,"left"),n.createElementVNode("div",yf,[n.renderSlot(t.$slots,"default")]),n.renderSlot(t.$slots,"right")]))}})),Jr=te(n.defineComponent({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.ref(),r=n.ref(),l=async(u,f)=>{o.ok&&(u("保存数据中..."),r.value=await o.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),f(),i.value.close())},c=()=>o.beforeClose?o.beforeClose(r.value):!0,s=()=>{o.closed?.()},d=()=>{i.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(r.value)},200)};return n.watch(()=>o.modelValue,u=>{r.value=u},{immediate:!0}),(u,f)=>{const h=n.resolveComponent("j-button"),m=n.resolveComponent("j-layer");return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(h,n.mergeProps({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),n.createVNode(m,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":c,onOk:l,onClosed:s},{default:n.withCtx(()=>[n.renderSlot(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Kr=te(n.defineComponent({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.computed({get:()=>o.modelValue,set:f=>{a("update:modelValue",f)}}),r=n.ref(""),l=f=>{r.value=f},c=()=>r.value,s=f=>o.beforeClose?o.beforeClose(f):!0,d=f=>{a("change",f)},u=n.computed(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(f,h)=>{const m=n.resolveComponent("j-code-mirror"),p=n.resolveComponent("j-layout"),g=n.resolveComponent("j-input-button");return n.openBlock(),n.createBlock(g,{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":s,ok:c,open:l,onChange:d},{default:n.withCtx(()=>[n.createVNode(p,{"right-move":!1,right:560},n.createSlots({default:n.withCtx(()=>[n.createVNode(m,{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:n.withCtx(()=>[n.createVNode(m,{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"])}}})),qr=te(n.defineComponent({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l=n.ref(),c=n.computed({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(g){l.value=g,i("update:modelValue",g),i("input",g)}}),s=g=>{i("input",g)},d=g=>{i("focus",g)},u=g=>{i("blur",g)},f=()=>{i("clear"),i("update:modelValue","")},h=g=>{i("change",g)},m=g=>{i("color-change",g)},p=g=>{i("active-change",g)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(g,y)=>{const x=n.resolveComponent("el-color-picker"),b=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[n.createVNode(b,n.mergeProps({ref_key:"inputRef",ref:r,modelValue:c.value,"onUpdate:modelValue":y[1]||(y[1]=w=>c.value=w),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},g.$attrs,{onInput:s,onFocus:d,onBlur:u,onClear:f,onChange:h}),{[e.inputType]:n.withCtx(()=>[n.createVNode(x,{modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=w=>c.value=w),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:m,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)}}})),Yr=te(n.defineComponent({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"}},setup(e){const t=e,o=n.computed(()=>t.class||""),a=n.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)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-title",o.value]),style:n.normalizeStyle(a.value)},n.toDisplayString(e.title),7))}})),Gr=te(n.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:o}){const a=e,i=o,r=n.ref(),l=n.ref("");let c=null;const s=g=>{switch(g){case"application/javascript":case"javascript":case"text/javascript":return cn.javascript();case"css":case"text/css":return jd.css();case"html":case"text/html":return Td.html();case"json":case"application/json":return Vd.json();case"sql":case"text/x-sql":return Pd.sql();case"xml":case"text/xml":return Md.xml();case"python":case"text/x-python":return Nd.python();case"markdown":case"text/markdown":return $d.markdown();case"java":case"text/x-java":return Od.java();case"vue":case"text/x-vue":return cn.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return cn.javascript({jsx:!1,typescript:!0});case"jsx":return cn.javascript({jsx:!0,typescript:!1});case"tsx":return cn.javascript({jsx:!0,typescript:!0});default:return cn.javascript()}},d=()=>{const g=[Bd.basicSetup,lt.lineNumbers(),lt.highlightActiveLineGutter(),lt.highlightSpecialChars(),la.history(),lt.drawSelection(),lt.dropCursor(),sn.indentOnInput(),sn.bracketMatching(),ra.closeBrackets(),lt.rectangularSelection(),sn.foldGutter(),lt.keymap.of([...ra.closeBracketsKeymap,...la.defaultKeymap,...la.historyKeymap,...sn.foldKeymap]),sn.syntaxHighlighting(sn.defaultHighlightStyle)];return g.push(s(a.mode)),a.readonly&&g.push(ia.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&g.push(ra.autocompletion({override:[y=>{const x=y.matchBefore(/\w*/);if(!x||x.from===x.to)return null;const b=a.handleHint(x.text);return b.length===0?null:{from:x.from,options:b.map(w=>({label:typeof w=="string"?w:w.label||w.name||"",detail:typeof w=="string"?"":w.detail||"",type:typeof w=="string"?"variable":w.type||"variable",apply:typeof w=="string"?w:w.apply||w.name||w.label||""}))}}]})),g.push(lt.EditorView.updateListener.of(y=>{if(y.docChanged){const x=y.state.doc.toString();l.value=x,i("update:value",x),i("change",{value:x})}})),g},u=async()=>{if(!r.value)return;const g=ia.EditorState.create({doc:a.value,extensions:d()});c=new lt.EditorView({state:g,parent:r.value}),l.value=a.value},f=()=>{if(!c)return;const g=c.state.doc.toString();c&&c.destroy();const y=ia.EditorState.create({doc:g,extensions:d()});r.value&&(c=new lt.EditorView({state:y,parent:r.value}));const x=c.state.doc.toString();x!==a.value&&c.dispatch({changes:{from:0,to:x.length,insert:a.value}})},h=()=>{if(!c)return;const g=c.state.doc.length;c.dispatch({selection:{anchor:g,head:g},scrollIntoView:!0}),setTimeout(()=>{if(c){const y=c.state.doc.length;c.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},m=()=>{let g=_d.format(a.value);g=g.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",g),i("change",{value:g})};let p=null;return n.watch(()=>a.value,g=>{g!==l.value&&(l.value=g,c&&f(),setTimeout(()=>{c&&a.isScrollToBottom&&h()}))}),n.watch(()=>a.mode,()=>{c&&f()}),n.onMounted(async()=>{await n.nextTick(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(p=new ResizeObserver(()=>{c&&c.dispatch({scrollIntoView:!0})}),p.observe(r.value))}),n.onUnmounted(()=>{p&&r.value&&(p.unobserve(r.value),p.disconnect(),p=null),c&&(c.destroy(),c=null)}),t({sqlFormatter:m}),(g,y)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:n.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),vf=n.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("actionRef"),i=n.ref("0"),r=n.computed(()=>{const{actionStyle:c,toLeft:s}=o;return{...c,left:s?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:s?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=n.computed(()=>Number.parseInt(i.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:c=>{i.value=c}}),(c,s)=>{const d=n.resolveComponent("j-icon");return n.openBlock(),n.createElementBlock("div",{ref_key:"actionRef",ref:a,style:n.normalizeStyle(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(n.openBlock(),n.createBlock(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(n.openBlock(),n.createBlock(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),bf=n.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("barRef"),i=n.ref("0"),r=n.computed(()=>{const{barStyle:l,toLeft:c}=o;return{...l,width:c?"0":i.value,transition:c?"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,c)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"barRef",ref:a,style:n.normalizeStyle(r.value)},null,4))}}),xf=n.defineComponent({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("contentRef"),i=n.computed(()=>{const{contentStyle:l}=o;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=n.computed(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(l,c)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"contentRef",ref:a,class:n.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:n.normalizeStyle(i.value)},[n.createElementVNode("div",{style:n.normalizeStyle(r.value),class:"j-spine-text"},n.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Xr=te(n.defineComponent({name:"JSliderCaptcha",__name:"slider-captcha",props:n.mergeModels({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:n.mergeModels(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,i=n.useModel(e,"modelValue"),r=n.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=n.useTemplateRef("wrapperRef"),c=n.useTemplateRef("barRef"),s=n.useTemplateRef("contentRef"),d=n.useTemplateRef("actionRef");n.watch(()=>r.isPassing,x=>{if(x){const{endTime:b,startTime:w}=r,C=(b-w)/1e3;a("success",{isPassing:x,time:C.toFixed(1)}),i.value=x}}),n.watchEffect(()=>{r.isPassing=!!i.value});function u(x){return"pageX"in x?x.pageX:"touches"in x&&x.touches[0]?x.touches[0].pageX:0}function f(x){r.isPassing||d.value&&(a("start",x),r.moveDistance=u(x)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function h(x){const b=l.value?.offsetWidth??220,w=x?.offsetWidth??40,C=b-w-6;return{actionWidth:w,offset:C,wrapperWidth:b}}function m(x){const{isMoving:b,moveDistance:w}=r;if(b){const C=n.unref(d),S=n.unref(c);if(!C||!S)return;const{actionWidth:v,offset:j,wrapperWidth:_}=h(C.getEl()),B=u(x)-w;a("move",{event:x,moveDistance:w,moveX:B}),B>0&&B<=j?(C.setLeft(`${B}px`),S.setWidth(`${B+v/2}px`)):B>j&&(C.setLeft(`${_-v}px`),S.setWidth(`${_-v/2}px`),g())}}function p(x){const{isMoving:b,isPassing:w,moveDistance:C}=r;if(b&&!w){a("end",x);const S=d.value,v=n.unref(c);if(!S||!v)return;const j=u(x)-C,{actionWidth:_,offset:B,wrapperWidth:V}=h(S.getEl());j<B?y():(S.setLeft(`${V-_}px`),v.setWidth(`${V-_/2}px`),g()),r.isMoving=!1}}function g(){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 x=n.unref(d),b=n.unref(c),w=n.unref(s);!x||!b||!w||(w.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,x.setLeft("0"),b.setWidth("0")},300))}return(x,b)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"wrapperRef",ref:l,class:n.normalizeClass(["j-slider-captcha slider-border",o.class]),style:n.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:p,onMousemove:m,onMouseup:p,onTouchend:p,onTouchmove:m},[n.createVNode(bf,{ref_key:"barRef",ref:c,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),n.createVNode(xf,{ref_key:"contentRef",ref:s,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),n.createVNode(vf,{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))}})),wf=n.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:c}=gn(),{getHMoreMenus:s}=lr(),d=n.ref([]);o.pId==="moreId"?d.value=s.value:d.value=r(i()[o.pId||""]||[],[]);const u=p=>{const g=d.value.find(y=>y.active);g?.value!==p.value&&(g&&(g.active=!1),a("click",p))},{list:f,containerProps:h,wrapperProps:m}=ca.useVirtualList(d,{itemHeight:44});return(p,g)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-sub-menu-content",{"j-menu-dark":n.unref(c)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},n.unref(h)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(m))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(f),y=>(n.openBlock(),n.createBlock(vo,{key:y.data.value,"parent-actives":n.unref(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),Cf={class:"j-menu-item-label"},kf={class:"j-menu-item-label"},Ef={key:1,class:n.normalizeClass(["j-menu-item-arrow","sub"])},Sf={class:"j-menu-item-label"},vo=n.defineComponent({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=ze(),{activeMenuId:a}=gn(),i=t,r=l=>{i("click",l)};return(l,c)=>{const s=n.resolveComponent("j-icon"),d=n.resolveComponent("el-tooltip"),u=n.resolveComponent("el-popover");return e.collapsed&&!e.item.hasChildren?(n.openBlock(),n.createBlock(d,{key:0,placement:"right"},{content:n.withCtx(()=>[n.createElementVNode("span",null,n.toDisplayString(n.unref(o)(e.item.label)),1)]),default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}]),onClick:c[0]||(c[0]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",Cf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?(n.openBlock(),n.createBlock(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,"popper-class":"j-sub-menu"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,style:n.normalizeStyle({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):n.createCommentVNode("",!0),n.createElementVNode("div",kf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(n.openBlock(),n.createElementBlock("div",Ef)):n.createCommentVNode("",!0)],6)],2)]),default:n.withCtx(()=>[n.createVNode(wf,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:c[1]||(c[1]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:n.normalizeStyle({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):n.createCommentVNode("",!0),n.createElementVNode("div",Sf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2))}}}),_f=n.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=gn(),l=f=>{a("click",f)},c=n.computed(()=>o.menuList),{list:s,containerProps:d,wrapperProps:u}=ca.useVirtualList(c,{itemHeight:44});return(f,h)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":n.unref(r)==="dark"}]},n.unref(d)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(u))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(s),m=>(n.openBlock(),n.createBlock(vo,{key:m.data.value,"parent-actives":n.unref(i)?.pid?.split(".")||[],item:m.data,collapsed:e.collapsed,class:n.normalizeClass({"menu-item-entering":m.data.entering,"menu-item-leaving":m.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),Bf=n.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=gn(),l=n.ref(),c=n.ref(0);let s=null;n.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(s=new ResizeObserver(()=>{l.value&&(c.value=l.value.offsetWidth)}),s.observe(l.value))});const d=n.computed(()=>{const m=[];let p=0,g=0;const y=o.menuList.length;return o.menuList.forEach(x=>{g++;const b=(dn(x.label)||0)+32+16+4+8;p+=b,(g===y&&p<=c.value||g<y&&p+56<=c.value)&&m.push(x)}),m.length<o.menuList.length&&m.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),m}),u=n.computed(()=>{const m=[];let p=0;const g=d.value.length;return o.menuList.forEach(y=>{p++,p>=g&&m.push(y)}),m}),f=n.computed(()=>{const m=i.value?.pid?.split(".")||[];return(m.length>1&&u.value.findIndex(p=>p.value===m[1])>-1||u.value.findIndex(p=>p.value===i.value?.value)>-1)&&m.push("moreId"),m}),h=m=>{a("click",m)};return cr({getHMoreMenus:u}),n.onUnmounted(()=>{s&&l.value&&(s.unobserve(l.value),s.disconnect(),s=null)}),(m,p)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"menuRef",ref:l,class:n.normalizeClass(["j-menu-horizontal",{"j-menu-dark":n.unref(r)==="dark"}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,g=>(n.openBlock(),n.createBlock(vo,{key:g.value,"parent-actives":f.value,item:g,"is-horizontal":"",onClick:h},null,8,["parent-actives","item"]))),128))],2))}}),jf=n.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=gn(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],c=n.computed(()=>(o.menuList.forEach((m,p)=>{m.color=l[p%l.length]}),o.menuList)),s=n.computed(()=>i.value?.pid?.split(".")||[]),d=m=>{a("click",m)},{list:u,containerProps:f,wrapperProps:h}=ca.useVirtualList(c,{itemHeight:96});return(m,p)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu-vertical",{"j-menu-dark":n.unref(r)==="dark"}]},n.unref(f)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(h))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(u),g=>(n.openBlock(),n.createBlock(vo,{key:g.data.value,"parent-actives":s.value,item:g.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),Zr=te(n.defineComponent({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let i={};const r=n.ref("");r.value=o.activeId||"";const l=(g,y,x,b,w)=>{x=x||[];for(let C=0,S=x.length;C<S;C++){const v=x[C],j={};j.pid=y,j.indent=b,r.value===v.value&&(j.active=!0),Object.keys(v).forEach(B=>{B!=="children"&&(j[B]=v[B])}),w&&w.includes(v.value)&&(j.open=!0),g.push(j);const _=v.children||[];_.length>0&&(j.hasChildren=!0,w||(i[j.value]=_),(!w||j.open&&!o.collapsed)&&l(g,`${y}.${j.value}`,_,b+1,w))}},c=(g,y)=>{const x=[];return l(x,"0",g,0,y),x},s=n.ref([]);let d=[];const u=()=>{i={},d=c(o.menus);const g=[];if(r.value&&o.mode==="inline"){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}s.value=c(o.menus,g)};n.watch(()=>o.menus,()=>{u()},{immediate:!0}),n.watch(()=>o.mode,()=>{u()});const f=()=>{if(s.value.find(y=>y.active)?.value!==r.value){const y=d.find(x=>x.value===r.value);if(y){const x=[];o.mode==="inline"&&x.push(...y.pid.split(".")),s.value=c(o.menus,x)}}},h=n.computed(()=>d.find(g=>g.value===r.value));n.watch(()=>o.activeId,()=>{r.value=o.activeId||"",f()}),n.watch(()=>o.collapsed,()=>{if(o.collapsed)s.value=c(o.menus,[]);else{const g=[];if(r.value){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}s.value=c(o.menus,g)}});const m=n.computed(()=>o.theme),p=g=>{if(console.log(g),g.hasChildren){if(o.collapsed)return;const y=[];y.push(...g.pid.split(".")),g.open||y.push(g.value);const x=c(o.menus,y),b=new Set(s.value.map(C=>C.value)),w=new Set(x.map(C=>C.value));x.forEach(C=>{b.has(C.value)||(C.entering=!0)}),s.value.forEach(C=>{w.has(C.value)||(C.leaving=!0)}),s.value=x,setTimeout(()=>{s.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(r.value===g.value)return;r.value=g.value,a("click",g)}};return rr({getMenuMap:()=>i,toArray:c,activeMenu:h,activeMenuId:r,theme:m}),(g,y)=>e.mode==="inline"?(n.openBlock(),n.createBlock(_f,{key:0,"menu-list":s.value,collapsed:e.collapsed,onClick:p},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(n.openBlock(),n.createBlock(Bf,{key:1,"menu-list":s.value,onClick:p},null,8,["menu-list"])):(n.openBlock(),n.createBlock(jf,{key:2,"menu-list":s.value,onClick:p},null,8,["menu-list"]))}})),Tf={class:"j-keyword-panel"},Vf={key:0},Pf={key:1,class:"columns-wrapper"},Mf=n.defineComponent({name:"JKeywordPanel",__name:"keyword-panel",props:n.mergeModels({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=ze(),a=e,i=n.useModel(e,"checkAll"),r=n.useModel(e,"checkFields"),l=n.ref(!1),c=n.ref(""),s=n.computed(()=>a.columns.filter(h=>h.config?.filter?.isSearchKeyword?c.value?h.config?.label?.indexOf(c.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,m)=>{const p=n.resolveComponent("j-icon"),g=n.resolveComponent("el-input"),y=n.resolveComponent("j-checkbox");return n.openBlock(),n.createElementBlock("div",Tf,[n.createElementVNode("div",{class:n.normalizeClass(["range-item",{active:i.value}]),onClick:d},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索全部")),1),i.value?(n.openBlock(),n.createBlock(p,{key:0,icon:"mdi:check"})):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:"range-item",onClick:m[0]||(m[0]=x=>l.value=!l.value)},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索特定字段")),1),n.createVNode(p,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?(n.openBlock(),n.createElementBlock("div",Vf,[n.createVNode(g,{modelValue:c.value,"onUpdate:modelValue":m[1]||(m[1]=x=>c.value=x),modelModifiers:{trim:!0},class:"no-border background",placeholder:n.unref(o)("搜索"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createElementBlock("div",Pf,[n.createVNode(y,{modelValue:r.value,"onUpdate:modelValue":m[2]||(m[2]=x=>r.value=x),options:s.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):n.createCommentVNode("",!0)])}}}),Nf={key:0,class:"title"},$f={class:"content"},Of={class:"relation"},Rf={style:{width:"72px"}},Af={class:"btn-wrapper"},Lf={class:"field-wrapper"},If={class:"buttons"},Qr=n.defineComponent({name:"JFilterPanel",__name:"filter-panel",props:n.mergeModels({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:n.mergeModels(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=ze(),i=e,r=n.useModel(e,"relation"),l=n.useModel(e,"isPin"),c=n.ref([]),s=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:f.value.join(","),options:u.value}),config:{appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,width:l.value?132:160,change:({value:b,row:w})=>{const S=i.columns.find(_=>_.id===b)?.config||{};let v="eq",j="text";["options"].includes(S.dataType||"")?v="in":["dateTime"].includes(S.dataType||"")&&(v="range",j="dateTime"),w.method=v,w.type=S.valueType||j}}},{id:"method",type:"j-select",getCompConfig:({row:b})=>{const C=i.columns.find(S=>S.id===b.field)?.config||{};return["options","switch"].includes(C.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(C.dataType||"")?{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:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{width:l.value?120:144,appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:b})=>{b.value=void 0}}},{id:"value",type:"input",getCompType:({row:b})=>{const C=i.columns.find(S=>S.id===b.field)?.config||{};if(["options","dataItem","switch"].includes(C.dataType||"")){if(["in","nin"].includes(b.method)||["eq","ne"].includes(b.method))return"j-select"}else if(["dateTime"].includes(C.dataType||""))return["range"].includes(b.method)?"j-date-range":["formula"].includes(b.method)?"j-select":"j-date";return"j-input"},getCompConfig:({row:b})=>{if(["empty","not_empty"].includes(b.method||""))return{display:!1};const C=i.columns.find(v=>v.id===b.field)?.config||{},S={display:!0,placeholder:"",clearable:!0,filterable:!0};return["options","dataItem"].includes(C.dataType||"")?(S.collapseTags=!0,S.collapseTagsTooltip=!0,S.dataType=C.dataType,S.dataCode=C.dataCode,S.options=C.options):["switch"].includes(C.dataType||"")?(S.options=[],S.dataType="options",C.activeValue==null?S.options.push({label:"是",value:"1"}):S.options.push({label:"是",value:C.activeValue}),C.inactiveValue==null?S.options.push({label:"否",value:"0"}):S.options.push({label:"否",value:C.inactiveValue})):["dateTime"].includes(C.dataType||"")&&(["formula"].includes(b.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.type="datetime",["range"].includes(b.method)?(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:{width:l.value?234:296,appendTo:l.value?void 0:".j-filter-panel"}}];n.onMounted(()=>{c.value=i.searchFieldList});const u=n.computed(()=>i.columns.filter(b=>!b.children?.length).map(b=>({label:b.config?.label,value:b.id,dataType:b.config?.dataType,options:b.config?.options}))),f=n.computed(()=>c.value.map(b=>b.field)),h=({data:b})=>{if(f.value.includes(b.value))return;const C=i.columns.find(j=>j.id===b.value)?.config||{};let S="eq",v="text";["options","dataItem"].includes(C.dataType||"")?S="in":["dateTime"].includes(C.dataType||"")&&(S="range",v="dateTime"),c.value.push({field:b.value,method:S,type:C.valueType||v})},m=o,p=()=>{c.value.length=0},g=()=>{l.value?m("filter"):m("close",!0)},y=()=>{c.value.forEach(b=>{b.value=void 0}),m("filter")};return t({getSearchFields:()=>c.value}),(b,w)=>{const C=n.resolveComponent("j-icon"),S=n.resolveComponent("j-select"),v=n.resolveComponent("j-button-select"),j=n.resolveComponent("j-button"),_=n.resolveComponent("j-input-rows"),B=n.resolveComponent("el-tooltip");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-filter-panel",{"is-pin":l.value}])},[l.value?(n.openBlock(),n.createElementBlock("div",Nf,[n.createVNode(C,{icon:"mdi:filter-outline"}),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选")),1)])):n.createCommentVNode("",!0),n.createElementVNode("div",$f,[n.createElementVNode("div",Of,[n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选出符合以下")),1),n.createElementVNode("div",Rf,[n.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=V=>r.value=V),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("条件的数据")),1)]),n.createElementVNode("div",Af,[n.createVNode(v,{label:"添加过滤条件",options:u.value,"model-value":f.value.join(","),onChange:h},null,8,["options","model-value"]),c.value.length>0?(n.openBlock(),n.createBlock(j,{key:0,type:"text",danger:"",label:"删除全部",onClick:p})):n.createCommentVNode("",!0)]),n.createElementVNode("div",Lf,[n.createVNode(_,{modelValue:c.value,"onUpdate:modelValue":w[1]||(w[1]=V=>c.value=V),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),n.createVNode(B,{placement:"bottom",content:l.value?n.unref(a)("取消固定"):n.unref(a)("固定显示")},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"pin-btn",onClick:s},[n.createVNode(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),n.createElementVNode("div",If,[n.createVNode(j,{label:n.unref(a)("筛选"),type:"primary",onClick:g},null,8,["label"]),n.createVNode(j,{label:n.unref(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),zf={class:"j-order-panel"},Ff={class:"content"},Hf={class:"btn-wrapper"},Wf={class:"field-wrapper"},Uf={class:"buttons"},Df=n.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=ze(),i=e,r=o,l=n.computed(()=>i.columns.filter(p=>!p.children?.length&&p.config?.sorter?.isNot!==!0).map(p=>({label:p.config?.label,value:p.id}))),c=n.ref([]),s=n.computed(()=>c.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})=>{s.value.includes(p.value)||c.value.push({label:p.label,value:p.value,sord:"ASC"})},f=p=>{c.value=JSON.parse(JSON.stringify(p))},h=()=>{r("save",JSON.parse(JSON.stringify(c.value)))},m=()=>{c.value=[],r("clear")};return t({init:f}),(p,g)=>{const y=n.resolveComponent("j-button-select"),x=n.resolveComponent("j-input-rows"),b=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",zf,[n.createElementVNode("div",Ff,[n.createElementVNode("div",Hf,[n.createVNode(y,{label:"添加排序规则",options:l.value,"model-value":s.value.join(","),onChange:u},null,8,["options","model-value"])]),n.createElementVNode("div",Wf,[n.createVNode(x,{modelValue:c.value,"onUpdate:modelValue":g[0]||(g[0]=w=>c.value=w),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),n.createElementVNode("div",Uf,[n.createVNode(b,{label:n.unref(a)("排序"),type:"primary",onClick:h},null,8,["label"]),c.value.length>0?(n.openBlock(),n.createBlock(b,{key:0,label:n.unref(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:m},null,8,["label"])):n.createCommentVNode("",!0)])])}}}),Jf={class:"j-column-panel"},Kf={class:"content"},qf={class:"search-wrapper"},Yf={class:"tree-wrapper"},Gf={class:"buttons"},Xf=n.defineComponent({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=ze(),i=e,r=o,l=n.ref(),c=n.ref(""),s={},d=n.ref([]),u=n.ref([]),f=(v,j)=>{const _=[],B=new Map;v.forEach(T=>{B.set(T.id,T),s[T.id]=T});const V=new Set;return j&&j.length>0&&j.forEach(T=>{const L=B.get(T.id);if(L){V.add(L.id);const F={id:L.id,label:L.config?.label||L.id,type:L.type,display:L.config?.display!==!1};L.children&&L.children.length>0&&(F.children=f(L.children,T.children)),_.push(F)}}),v.forEach(T=>{if(!V.has(T.id)){const L={id:T.id,label:T.config?.label||T.id,type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(L.children=f(T.children)),_.push(L)}}),_},h=(v,j)=>j.length===0?v:v.map(_=>{const B=j.some(T=>_.label.toLowerCase().includes(T.toLowerCase())),V=_.children?h(_.children,j):[];return B||V.length>0?{..._,children:V.length>0?V:_.children}:null}).filter(Boolean),m=n.computed(()=>{if(!c.value)return u.value;const v=c.value.split(/\s+/).filter(Boolean);return h(u.value,v)}),p=n.ref([]),g=n.computed(()=>{const v=new Map;if(i.columnConfig&&i.columnConfig.length>0){const j=_=>{_.forEach(B=>{v.set(B.id,B),B.children&&j(B.children)})};j(i.columnConfig)}return v}),y=()=>{const v=j=>{const _=[];return j.forEach(B=>{let V=!0;if(g.value.size>0){const T=g.value.get(B.id);T?V=T.display:V=B.config?.display!==!1}else V=B.config?.display!==!1;V&&(_.push(B.id),B.children&&_.push(...v(B.children)))}),_};p.value=v(i.columns)},x=(v,{node:j})=>{v.includes(j.id)?p.value.push(j.id):p.value=p.value.filter(B=>B!==j.id)},b=(v,j,_)=>_==="inner"?!1:v.parent===j.parent,w=()=>{const v=j=>j.map(_=>{const B={..._,display:p.value.includes(_.id)};return _.children&&(B.children=v(_.children)),B});r("save",v(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),c.value="",l.value){const v=l.value;v.setCheck&&v.setCheck(p.value);const j=v.$refs?.treeRef||v;j?.setCheckedKeys&&j.setCheckedKeys(p.value)}};return t({init:()=>{y(),d.value=f(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(v,j)=>{const _=n.resolveComponent("j-icon"),B=n.resolveComponent("el-input"),V=n.resolveComponent("j-tree"),T=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Jf,[n.createElementVNode("div",Kf,[n.createElementVNode("div",qf,[n.createVNode(B,{modelValue:c.value,"onUpdate:modelValue":j[0]||(j[0]=L=>c.value=L),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(_,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",Yf,[n.createVNode(V,{ref_key:"treeRef",ref:l,list:m.value,"is-tree-data":!0,"default-checked-keys":p.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!c.value,"allow-drop":b,check:x},null,8,["list","default-checked-keys","draggable"])])]),n.createElementVNode("div",Gf,[n.createVNode(T,{label:n.unref(a)("确定"),type:"primary",onClick:w},null,8,["label"]),n.createVNode(T,{label:n.unref(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),Zf={class:"j-table-panel-left"},Qf={class:"j-table-panel-top"},ep={class:"j-table-panel-top-left"},tp={class:"j-table-panel-top-right"},np={key:0,style:{width:"200px"}},op={class:"j-table-panel-main"},ap={key:0,class:"j-table-panel-filter-panel"},ba=te(n.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},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:o}){const{t:a}=ze(),{openLayer:i}=yn(),r=e,l=o;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const c=n.ref();let s=[];const d=n.ref(0),u=n.ref(1);let f=r.pageSize||100,h="";const m=n.ref([]),p=n.ref(!1),g=n.computed(()=>r.batchButtons&&r.batchButtons.length>0),y=n.computed(()=>m.value.length>0),x=n.computed(()=>g.value&&y.value&&r.isMultiple||p.value),b=n.computed(()=>r.isPage&&!x.value);g.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const w=G=>r.rowKey?r.rowKey.split(",").map(Ae=>G[Ae.trim()]).join("::"):"",C=(G,Q)=>{if(!Q||Q.length===0)return G.filter(Z=>Z.config?.display!==!1).map(Z=>Z.children&&Z.children.length>0?{...Z,children:C(Z.children)}:Z);const Ae=new Map(G.map(Z=>[Z.id,Z])),Oe=[];return Q.forEach(Z=>{const Re=Ae.get(Z.id);if(Re){if(Z.display){let On=Re;Re.children&&Re.children.length>0&&(On={...Re,children:C(Re.children,Z.children)}),Oe.push(On)}Ae.delete(Z.id)}}),G.forEach(Z=>{if(Ae.has(Z.id)&&Z.config?.display!==!1){let Re=Z;Z.children&&Z.children.length>0&&(Re={...Z,children:C(Z.children)}),Oe.push(Re)}}),Oe},S=n.computed(()=>C(r.columns,ye.value)),v=n.computed(()=>Ki(r.columns,G=>G.config.label)),j=n.ref(""),_=n.computed(()=>v.value.some(G=>G.config?.filter?.isSearchKeyword)),B=n.ref(),V=n.ref(!0),T=n.ref([]),L=n.computed(()=>V.value?"搜索全部":`搜索范围:${v.value.filter(G=>T.value.includes(G.id)).map(G=>G.config?.label).join("、")}`),F=()=>{B.value.init()},z=n.ref(),P=n.ref(!1),E=n.ref(!1),$=n.ref(!1),R=n.ref([]),q=n.ref("and"),ee=n.ref(),ce=n.ref(!1),de=n.ref([]),Pe=()=>{ee.value.init(de.value)},J=G=>{de.value=G,ce.value=!1,Ye()},fe=()=>{de.value=[],Ye()},ge=n.ref(),re=n.ref(!1),ye=n.ref(),je=n.computed(()=>ye.value!=null),U=()=>{ge.value?.init()},ne=G=>{console.log("handleColumnSave:",G),ye.value=G,re.value=!1},se=n.ref(!1),Ce=()=>{se.value=!se.value},Ue=()=>{m.value=[],c.value&&(c.value.setSelection?.([]),p.value&&(p.value=!1,c.value.setRecords(s)))},Qe=()=>{p.value=!p.value,p.value?c.value?.setRecords(m.value):c.value?.setRecords(s),c.value?.setSelection?.(m.value)},ve=n.computed(()=>{if(m.value.length>0&&r.isMultiple){const G=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:p.value?"全部":"仅选中",config:{type:"text"},click:Qe},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:Ue}],Q=r.batchButtons.map(Ae=>({...Ae,click:()=>{Ae.click&&Ae.click({data:m.value,openLayer:i})}}));return[...G,...Q]}return r.buttons}),it=async()=>{const G={},Q={};Q.rel=q.value;const Ae=z.value?.getSearchFields?.()||R.value;Q.cond=Ae.filter(Z=>Z.value!==void 0&&Z.value!==null&&Z.value!=="").map(Z=>({field:Z.field,method:Z.method,value:Z.value,type:Z.type})),Q.cond.length>0?$.value=!0:$.value=!1,G.filter=Q;const Oe=de.value.map(Z=>Z.value+" "+Z.sord).join(",");if(j.value&&(G.keyword={value:j.value,fields:V.value?v.value.filter(Z=>Z.config?.filter?.isSearchKeyword).map(Z=>Z.id):n.unref(T)}),r.loadData){if(r.isPage){G.pagination={rows:f,page:u.value,sort:Oe||h||r.sort||r.rowKey};const Z=await r.loadData(G)||{};s=Z.rows||[],d.value=Z.records||0}else G.sort=Oe,s=await r.loadData(G)||[],d.value=s.length;c.value.setRecords(s),g.value?(m.value=[],p.value=!1):r.rowKey&&m.value.length>0&&c.value?.setSelection?.(m.value)}},Ye=async()=>{u.value=1,await it()},gt=({rows:G,page:Q})=>{f=G,u.value=Q,it()},I=async()=>{m.value=[],p.value=!1,u.value=1,await it()},Y=async()=>{m.value=[],p.value=!1,await it()},H=async()=>{await I()},W=G=>{l("ready",G)},K=G=>{let Q=[];if(!r.isMultiple){m.value=G,l("select",G);return}if(g.value)Q=G;else if(!r.rowKey)Q=G;else{const Ae=new Map(G.map(Z=>[w(Z),Z])),Oe=new Map(m.value.map(Z=>[w(Z),Z]));s.forEach(Z=>{const Re=w(Z);Ae.has(Re)?Oe.set(Re,Ae.get(Re)):Oe.delete(Re)}),Q=Array.from(Oe.values())}m.value=Q,l("select",Q),p.value&&Q.length===0?(p.value=!1,c.value&&c.value.setRecords(s)):p.value&&Q.length>0&&c.value&&(c.value.setRecords(Q),c.value.setSelection?.(Q))},ie=()=>m.value||[],ue=G=>{m.value=G,c.value?.setSelection?.(G)},he=()=>c.value?.getInstance?.();return n.onMounted(async()=>{r.immediate&&await Y()}),t({refreshData:Y,resetData:I,getSelection:ie,setSelection:ue,clearSelection:()=>{Ue()},getInstance:he}),(G,Q)=>{const Ae=n.resolveComponent("j-buttons"),Oe=n.resolveComponent("j-icon"),Z=n.resolveComponent("el-popover"),Re=n.resolveComponent("el-tooltip"),On=n.resolveComponent("el-input"),ln=n.resolveComponent("j-button"),Bi=n.resolveComponent("j-table");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-table-panel-wrapper",{fullscreen:se.value,"no-padding":e.noPadding||se.value}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":se.value}])},[n.createElementVNode("div",Zf,[n.createElementVNode("div",Qf,[n.createElementVNode("div",ep,[n.createVNode(Ae,{list:ve.value},null,8,["list"])]),n.createElementVNode("div",tp,[_.value&&!x.value?(n.openBlock(),n.createElementBlock("div",np,[n.createVNode(On,{modelValue:j.value,"onUpdate:modelValue":Q[2]||(Q[2]=O=>j.value=O),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:n.withKeys(Ye,["enter"]),onClear:Ye},{prefix:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:search"})]),suffix:n.withCtx(()=>[n.createVNode(Re,{placement:"bottom",content:L.value},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:F,onHide:Ye},{reference:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:n.withCtx(()=>[n.createVNode(Mf,{ref_key:"keywordPanelRef",ref:B,"check-all":V.value,"onUpdate:checkAll":Q[0]||(Q[0]=O=>V.value=O),"check-fields":T.value,"onUpdate:checkFields":Q[1]||(Q[1]=O=>T.value=O),columns:v.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),!P.value&&!x.value?(n.openBlock(),n.createBlock(Z,{key:1,visible:E.value,"onUpdate:visible":Q[6]||(Q[6]=O=>E.value=O),placement:"bottom","popper-style":"padding: 0",width:644,trigger:"click",persistent:!1,onHide:Ye},{reference:n.withCtx(()=>[n.createVNode(ln,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:n.normalizeClass({active:$.value})},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Qr,{ref_key:"filterPanelRef",ref:z,"is-pin":P.value,"onUpdate:isPin":Q[3]||(Q[3]=O=>P.value=O),relation:q.value,"onUpdate:relation":Q[4]||(Q[4]=O=>q.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ye,onClose:Q[5]||(Q[5]=O=>E.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):n.createCommentVNode("",!0),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:2,placement:"bottom",content:n.unref(a)("排序")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:ce.value,"onUpdate:visible":Q[7]||(Q[7]=O=>ce.value=O),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Pe},{reference:n.withCtx(()=>[n.createVNode(ln,{class:n.normalizeClass({active:de.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Df,{ref_key:"orderPanelRef",ref:ee,columns:v.value,onSave:J,onClear:fe},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:3,placement:"bottom",content:n.unref(a)("显示字段")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:re.value,"onUpdate:visible":Q[8]||(Q[8]=O=>re.value=O),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:U},{reference:n.withCtx(()=>[n.createVNode(ln,{class:n.normalizeClass({active:je.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Xf,{ref_key:"columnPanelRef",ref:ge,columns:e.columns,"column-config":ye.value,onSave:ne},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:4,placement:"bottom",content:n.unref(a)("刷新")},{default:n.withCtx(()=>[n.createVNode(ln,{type:"text",icon:"mdi:refresh",onClick:H})]),_:1},8,["content"])),n.createVNode(Re,{placement:"bottom",content:se.value?n.unref(a)("退出全屏"):n.unref(a)("全屏")},{default:n.withCtx(()=>[n.createVNode(ln,{type:"text",icon:se.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:Ce},null,8,["icon"])]),_:1},8,["content"])])]),n.createElementVNode("div",op,[n.createVNode(Bi,{ref_key:"tableRef",ref:c,"table-page":u.value,"onUpdate:tablePage":Q[9]||(Q[9]=O=>u.value=O),columns:S.value,records:n.unref(s),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":b.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"highlight-mode":e.highlightMode,onLoadPageData:gt,onReady:W,onSelectionChanged:K},null,8,["table-page","columns","records","is-tree","is-show-number","is-multiple","is-page","page-sizes","page-size","page-total","row-key","actions","actions-max-count","actions-label","highlight-mode"])])]),P.value&&!x.value?(n.openBlock(),n.createElementBlock("div",ap,[n.createVNode(Qr,{ref_key:"filterPanelRef",ref:z,"is-pin":P.value,"onUpdate:isPin":Q[10]||(Q[10]=O=>P.value=O),relation:q.value,"onUpdate:relation":Q[11]||(Q[11]=O=>q.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ye},null,8,["is-pin","relation","search-field-list","columns"])])):n.createCommentVNode("",!0)],2)],2)}}})),ip={class:"j-button-select"},rp={class:"search-wraper"},lp={class:"options-wraper"},cp=["onClick"],el=te(n.defineComponent({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:i}=ze(),r=n.ref(""),l=n.computed(()=>r.value===""?o.options:o.options.filter(d=>(d.label||"").includes(r.value))),c=n.computed(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),s=d=>{if(d.disabled||c.value.includes(d.value))return;const f=[...c.value,d.value].join(",");a("update:modelValue",f),a("change",{value:f,data:d})};return(d,u)=>{const f=n.resolveComponent("j-button"),h=n.resolveComponent("j-icon"),m=n.resolveComponent("el-input"),p=n.resolveComponent("el-popover");return n.openBlock(),n.createBlock(p,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:n.withCtx(()=>[n.createVNode(f,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:n.withCtx(()=>[n.createElementVNode("div",ip,[n.createElementVNode("div",rp,[n.createVNode(m,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=g=>r.value=g),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索"),class:"no-border",clearable:""},{prefix:n.withCtx(()=>[n.createVNode(h,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",lp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,g=>(n.openBlock(),n.createElementBlock("div",{key:g.value,class:n.normalizeClass(["option-item",{active:c.value.includes(g.value)||g.disabled}]),onClick:n.withModifiers(y=>s(g),["stop"])},[g.icon?(n.openBlock(),n.createBlock(h,{key:0,class:"j-button-select-icon",icon:g.icon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)(g.label)),1)],10,cp))),128))])])]),_:1},8,["width"])}}})),sp={class:"j-tree-item-text"},dp={key:2,class:"j-tree-item-button-group"},up={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},tl=te(n.defineComponent({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},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:o}){const a=e,i=o,{useData:r,t:l}=ze(),{getTreeData:c,loadData:s}=r(),d=n.ref(),u=n.ref(!1),f=n.ref(""),h=n.ref([]),m={children:"children",label:"label",disabled:"disabled"},p=n.computed(()=>c?c({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),g=n.computed(()=>a.dataCode||a.dataType?p.value:a.list?n.unref(a.list):h.value),y=async()=>{u.value=!0,a.loadData&&(h.value=await a.loadData()||[]),s&&await s(a.dataType,a.dataCode),u.value=!1,n.nextTick(()=>{a.afterLoadData&&a.afterLoadData(g.value||[])})},x=(z,P=!0)=>{d.value?.setCurrentKey(z,P)},b=()=>d.value?.getCurrentKey(),w=(z,P=!1)=>{d.value?.setCheckedKeys(z,P)},C=(z=!1)=>d.value?.getCheckedKeys(z),S=async(z,P,E,$)=>{if(f.value=z.value,a.nodeClickFlow&&a.runFlow){const R=JSON.parse(a.nodeClickFlow);await a.runFlow(R,{value:z.value})}a.click&&a.click(z.value,z,$)},v=(z,{checkedKeys:P,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})=>{a.check&&a.check(P,{node:z,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})},j=(z,P,E,$)=>{i("node-drop",z,P,E,$)},_=z=>{const P=vt(a.treeButtons);return z&&a.filterButton?a.filterButton({buttons:P,node:z}):P},{openLayer:B}=yn(),V=(z,P)=>{z.config?.disabled||z.click&&z.click({data:P,openLayer:B})},T=n.ref(""),L=(z,P)=>{T.value=z?P.value:"",console.log(T.value,"row")},F=(z,P,E)=>a.allowDrop?a.allowDrop(z,P,E):!(E=="inner"&&!P.data.canInner);return n.onMounted(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),n.watch(()=>a.list,()=>{u.value=!0,n.nextTick(()=>{u.value=!1})}),n.watch(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:x,getValue:b,setCheck:w,getCheck:C}),(z,P)=>{const E=n.resolveComponent("j-icon"),$=n.resolveComponent("j-button"),R=n.resolveComponent("el-dropdown-item"),q=n.resolveComponent("el-dropdown-menu"),ee=n.resolveComponent("el-dropdown"),ce=n.resolveComponent("el-tree"),de=n.resolveComponent("el-empty"),Pe=n.resolveDirective("loading");return n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&g.value.length>0?(n.openBlock(),n.createBlock(ce,{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:g.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:m,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":F,"expand-on-click-node":e.expandOnClickNode,onNodeClick:S,onCheck:v,onNodeDrop:j},{default:n.withCtx(({node:J})=>[n.createElementVNode("div",{class:n.normalizeClass(["j-tree-item-wraper",{"is-focus":T.value===J.data.value}])},[J.data.openIcon?(n.openBlock(),n.createBlock(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:J.data.openIcon,color:J.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),J.data[e.iconKey]||e.defaultIcon?(n.openBlock(),n.createBlock(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:J.data[e.iconKey]||e.defaultIcon||"",color:J.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),n.createElementVNode("div",sp,n.toDisplayString(J.label),1),_(J.data).length?(n.openBlock(),n.createElementBlock("div",dp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_(J.data),(fe,ge)=>(n.openBlock(),n.createBlock(ee,{key:ge,trigger:"click",onVisibleChange:re=>L(re,J.data)},{dropdown:n.withCtx(()=>[n.createVNode(q,null,{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(fe.children,(re,ye)=>(n.openBlock(),n.createBlock(R,{key:ye,disabled:re.disabled,divided:re.divided,onClick:n.withModifiers(je=>V(re,J.data),["stop"])},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"j-flex-item",style:n.normalizeStyle({color:re.danger?"var(--j-color-danger)":re.color||e.buttonIconColor||"var(--j-color-text-2)"})},[re.icon||e.buttonDefaultIcon?(n.openBlock(),n.createBlock(E,{key:0,icon:re.icon||e.buttonDefaultIcon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(l)(re.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:n.withCtx(()=>[n.createVNode($,{icon:fe.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):n.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"])):(n.openBlock(),n.createElementBlock("div",up,[n.createVNode(de,{description:n.unref(l)(e.emptyDes)},null,8,["description"])]))],2)),[[Pe,u.value]])}}})),nl=te(n.defineComponent({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:"label"},valueKey:{default:"value"},pidKey:{default:"pid"},idKey:{default:"id"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,{useData:a}=ze(),{getTreeData:i}=a(),r=n.computed(()=>i?i({dataType:o.dataType,dataCode:o.dataCode,labelKey:o.labelKey,valueKey:o.valueKey,pidKey:o.pidKey,idKey:o.idKey,notLoad:!1})||[]:[]),l=n.computed(()=>o.dataCode||o.dataType?r.value:o.options||[]),c=t,s=n.computed({get(){return o.modelValue},set(u){c("update:modelValue",u)}}),d=u=>{c("change",u)};return(u,f)=>{const h=n.resolveComponent("el-tree-select");return n.openBlock(),n.createBlock(h,{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=m=>s.value=m),data:l.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,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"])}}})),ol=te(Br),fp=Rd;async function pp(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const i=new fp({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:c})=>c):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function hp(e,t,o){const a=o.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:c})=>!!i==!!l?r-c:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await pp(e,t,r);if(l!=="")return{name:e,errors:l}}}function mp(e,t){const o=(r,l,c,s,d)=>{Object.keys(l).forEach(u=>{let f=u;c&&(f=`${c}.${u}`);const h=l[u],{rules:m,myGridtableId:p}=t(f,c?l:void 0,()=>s,d);if(m.length){const g=a(f,h,m);r.push(g)}p&&h.forEach(g=>{o(r,g,p,h,c?l:void 0)})})},a=(r,l,c)=>hp(r,l,c);return{validateForm:async()=>{const r=n.unref(e),l=[];o(l,r,"");const c=await Promise.all(l),s={};return c.forEach(d=>{d&&(s[d.name]={msg:d.errors})}),s},validateField:a}}const al=te(n.defineComponent({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,i=o,{useData:r,existField:l,httpGet:c,httpPost:s,success:d,warning:u,error:f,info:h,t:m}=ze();let p;r&&(p=r());const g=I=>{f&&f(I)},y=n.ref(!1),x=n.computed(()=>a.config?.gutter||16),b=n.computed(()=>a.config?.span||24),w=n.computed(()=>a.config?.labelWidth),C=n.computed(()=>a.config?.labelPosition||"right"),S=n.computed(()=>_.length===1&&(_[0].type==="j-tabs"||_[0].type==="j-layout"||_[0].config?.isAutoWindow)),v=n.reactive({}),j=n.ref({}),_=[],B={},V=n.ref({});let T={},L={},F=[],z={};const P=I=>{i("change",I)},E=I=>ho(B[I]?.type||"")&&!B[I]?.config?.notInput||B[I]?.config?.isInput,$=I=>["j-table","j-input-rows","j-input-cards"].includes(B[I]?.type||"");let R;const q=(I,Y)=>{Object.keys(I).forEach(H=>{const W=I[H];Y&&(H=Y+"."+H),W!=null&&typeof W=="object"&&!so(W)&&q(W,H),v[H]=W})},ee=(I,Y)=>{let H=I.id;return H||(I.config?.table&&I.config?.field?H=`${I.config.table}.${I.config.field}`:I.config?.table?H=I.config?.table:I.config?.field&&(H=I.config?.field),Y&&$(Y)&&(H=`${Y}.${H}`)),H||po("j")},ce=(I,Y,H,W="")=>{I.forEach(K=>{K.id=ee(K,W);const ie={id:K.id,slot:K.slot,type:K.type||"",getCompType:K.getCompType,getCompConfig:K.getCompConfig,config:{},children:[]};Y.push(ie);const{children:ue}=K;fo(ie,K,["children","config"]),fo(ie.config,K.config||{},[]),B[K.id]&&console.warn("有重复的组件id:"+K.id),B[K.id]=ie,a.readonly===!0&&(ie.config.readonly=!0);let he=!1,De;W!==""&&$(W)&&(he=!0,ie.config=K.config||{},ie.config.parentTableId=W,De=B[W]?.config?.table);const G=ie.config||{};if(E(K.id))!H&&he===!1&&(G?.defaultValue===0?v[K.id]=G?.defaultValue:v[K.id]=G?.defaultValue||void 0),G.table&&G.field?T[`${G.table}_${G.field}`.toLowerCase()]=K.id:G.field&&(he?T[`${De}_${G.field}`.toLowerCase()]=K.id:T[`${G.field}`.toLowerCase()]=K.id);else if(he&&G.field)T[`${De}_${G.field}`.toLowerCase()]=K.id;else if($(K.id))!H&&!G.isSubTable&&(v[K.id]=[]),G.table&&(T[G.table.toLowerCase()||""]=K.id),G.isSubTable||F.push(ie);else if(G?.defaultValue)v[K.id]=G?.defaultValue;else if(K.type==="collapse"&&G?.isExpand){const Q=[];(G?.groups||[]).forEach(Ae=>{Q.push(Ae.i)}),v[K.id]=Q}ue&&ue.length>0&&ce(ue,ie.children,H,ie.id)})},de=async(I,Y)=>{y.value=!1;const H=!!Y;_.splice(0,_.length),T={},L={},F=[],R=Y,An(v),V.value={},H&&q(Y,""),ce(I,_,H),z=vt(v),n.nextTick(()=>{y.value=!0,n.nextTick(()=>{Ye(a.config?.codeInit,{})})})},Pe=(I,Y,H)=>{const W=[];return Y.forEach(K=>{const ie={};Object.keys(K).forEach(ue=>{if(!H||H(ue,K[ue],I)){const he=se(ue);if(he?.type==="j-table")ie[he?.id||""]=Pe(ue,K[ue],H);else{let De=T[`${I}_${ue}`.toLowerCase()]||ue;De=De.indexOf(".")!==-1?De.split(".")[1]:De,ie[De]=K[ue]}}}),W.push(ie)}),W},J=(I,Y)=>{Object.keys(I||{}).forEach(H=>{let W=I[H];const K=se(H);if(K===void 0)W&&(so(W)&&(W=W[0]||{}),typeof W=="object"?Object.keys(W).forEach(ie=>{if(!Y||Y(H,W[ie],H)){let ue=ie;H!=="main"&&(ue=`${H}_${ie}`),L[ue]=H,v[T[ue.toLowerCase()]||ie]=W[ie]}}):v[H]=W);else if($(K.id||"")){if(!Array.isArray(W)){console.warn("表格数据不是数组:"+H);return}W?.length>0?v[T[H.toLowerCase()]||H]=Pe(H,W,Y):v[T[H.toLowerCase()]||H]=[]}else(!Y||Y(H,W,H))&&(v[T[H.toLowerCase()]||H]=W)}),R&&Object.keys(v).forEach(H=>{const W=se(H);(W===void 0||!["tabs","collapse"].includes(W.type||""))&&Li(R,H,v[H])})},fe=(I,Y=!1)=>{const H={};return Object.keys(I).forEach(W=>{if(W==="parentRow")return;const K=B[W];if(K){const ie=K.config?.table,ue=K.config?.field;if(Y)ue?H[ue]=I[W]:H[W]=I[W];else if($(W)){const he=[];I[W].forEach(De=>{he.push(fe(De,!0))}),H[ie||W]=he}else ie&&ue?(H[ie]=H[ie]||{},H[ie][ue]=I[W]):ue&&(H[ue]=I[W])}else Y?W!=="_X_ROW_KEY"&&W!=="_isHover"&&(H[W]=I[W]):L[W]?(H[L[W]]=H[L[W]]||{},H[L[W]][W.replace(`${L[W]}_`,"")]=I[W]):H[W]=I[W]}),H},ge=(I=!0)=>I?fe(v):v,re=(I,Y,H,W)=>{let K=B[I];if(K==null){const ue=I.split(".");K=B[ue[ue.length-1]]||{}}if(!K)return{};const ie=Dt({config:{...K.config||{},...V.value[K.id]||{}},getCompConfig:K.getCompConfig,formData:v,getTableData:H,row:Y,pRowData:W});return ie._componentId=K?.id,ie},ye=(I,Y,H,W)=>{const K=re(I,Y,H,W);if(K.isNotRule!==!0&&K.display!==!1){const ie=K.rule||[],ue=ie.find(he=>he.type==="only");return ue&&(ue.validator=async(he,De)=>{if(De){const G={table:he.table,key:he.key,keyName:he.keyName,field:he.field,keyValue:he.getKeyValue?he.getKeyValue():"",value:De,paramNames:he.paramNames,getParams:he.getParams,withProjectId:he.withProjectId,getValue:he.getValue,formData:v};if(!await l(G))throw m(he.message)||m("数据值重复")}}),{rules:ie,myGridtableId:$(K._componentId)?K._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:je}=mp(v,ye),U=async()=>{j.value={};const I=await je();return Object.keys(I).length>0?(j.value=I,g(`${m(B[Object.keys(I)[0]]?.config?.label)}:${m(I[Object.keys(I)[0]].msg)}`),!1):!0},ne=()=>{j.value={},An(v),Object.keys(z||{}).forEach(I=>{v[I]=z[I]})},se=I=>{let Y=B[I];return Y===void 0&&T[I.toLowerCase()]&&(Y=B[T[I.toLowerCase()]]),Y},Ce=({id:I,i:Y,value:H,type:W})=>{if(W==="add")v[I].push(H);else if(W==="delete")v[I].splice(Y,1);else{const K=se(I);K&&(K.config.parentTableId?v[K.config.parentTableId][Y][I]=H:v[I]=H)}},Ue=({id:I,i:Y})=>{const H=se(I);if(H){if(H.config.parentTableId){const W=v[H.config.parentTableId],K=H.id?H.id.replace(`${H.config.parentTableId}.`,""):"";if(Y!=null)return(W[Y]||{})[K||""];const ie=[];return W&&W.forEach(ue=>{ie.push(ue[K||""])}),ie}if($(H.id||"")){const W=[];return v[H.id||""].forEach(K=>{W.push(fe(K,!0))}),W}return v[H.id||""]}if(v[I])return v[I]},Qe=async({id:I,i:Y})=>{const H=Ue({id:I,i:Y}),W=se(I);if(W&&p?.getLabel)if(Y!==void 0){const K=H[Y],ie=v[W.config.parentTableId||""][Y],ue=Dt({config:W.config,getCompConfig:W.getCompConfig,formData:v,tableData:v[W.config.parentTableId||""],row:ie});return await p?.getLabel({value:K,config:ue,formData:v,tableData:v[W.config.parentTableId||""],row:ie})}else{const K=Dt({config:W.config,getCompConfig:W.getCompConfig,formData:v});return await p?.getLabel({value:H,config:K,formData:v})}return H},ve=async(I,Y)=>p?.loadViewDataList?await p?.loadViewDataList(I,Y,!1):[],it=I=>(I.set=Ce,I.get=Ue,I.setFormData=J,I.getFormData=ge,I.getLabel=Qe,I.getViewData=ve,I.getDateNow=Y=>Gi(new Date,Y||"YYYY-MM-DD HH:mm:ss"),I.httpGet=c||(()=>{console.log("当前状态不支持")}),I.httpPost=s||(()=>{console.log("当前状态不支持")}),I.loading=Y=>{un(Y)},I.showMsg=({text:Y,type:H})=>{switch(H){case"success":d&&d(Y);break;case"warning":u&&u(Y);break;case"error":f&&f(Y);break;case"info":h&&h(Y);break;default:h&&h(Y);break}console.log("showMsg",Y,H)},I),Ye=async(I,Y)=>{if(I&&I.trim()){I=`async (jcode) => {${I}}`;const{res:H,fn:W}=ua(I);H&&await W(it(Y))}},gt=(I,Y)=>{V.value[I]={...V.value[I]||{},...Y}};return a.schema&&de(a.schema),ma({formData:v,compsConfig:V,errorFields:j,isAutoWindow:S,gutter:x,span:b,labelWidth:w,labelPosition:C,getValue:Ue,formChange:P}),ga({contextType:"form"}),t({init:de,reset:ne,validate:U,setValue:Ce,getValue:Ue,getLabel:Qe,setFormData:J,getFormData:ge,setCompConfig:gt}),(I,Y)=>{const H=n.resolveComponent("j-form-item"),W=n.resolveComponent("el-row"),K=n.resolveComponent("el-form");return y.value?(n.openBlock(),n.createBlock(K,{key:0,class:n.normalizeClass([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":w.value,size:e.config?.size,onSubmit:Y[0]||(Y[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[S.value?(n.openBlock(),n.createBlock(H,n.mergeProps({key:0},_[0],{"is-not-col":""}),null,16)):(n.openBlock(),n.createBlock(W,{key:1,gutter:x.value},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,ie=>n.createVNode(H,n.mergeProps({key:ie.id,ref_for:!0},ie),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):n.createCommentVNode("",!0)}}})),il=te(_r),gp={class:"j-page"},rl=te(n.defineComponent({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=n.ref(!1),i=n.reactive([]),r={},l=n.reactive({}),c=new ha,s=new Map,d=(p,g,y,...x)=>{const b=`${p}:${g}`;return y?.immediate&&s.set(b,x),c.emit(b,...x)},u=(p,g,y)=>{const x=`${p}:${g}`;c.on(x,y);const b=s.get(x);b&&(s.delete(x),y(...b))},f=(p,g,y)=>{const x=`${p}:${g}`;s.delete(x),c.off(x,y)},h=(p,g)=>{p.forEach(y=>{y.id=y.id||po("c");const x={id:y.id,slot:y.slot,type:y.type,config:{},children:[]},{children:b}=y;r[y.id]=x,fo(x.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l.value[y.id]=y.config.defaultValue),g.push(x),b&&b.length>0&&h(b,x.children)})},m=p=>{a.value=!1,i.splice(0,i.length),An(r),An(l),h(p,i),n.nextTick(()=>{a.value=!0})};return o.schema&&m(o.schema),pr({registerMethod:(p,g,y)=>(u(p,g,y),()=>{f(p,g,y)})}),ga({contextType:"page"}),t({init:m,call:d,on:u,off:f}),(p,g)=>{const y=n.resolveComponent("j-comp");return n.openBlock(),n.createElementBlock("div",gp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i,x=>(n.openBlock(),n.createBlock(y,{key:x.id,id:x.id,type:x.type,config:x.config,children:x.children},null,8,["id","type","config","children"]))),128))])}}})),ll=te(n.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,i=n.ref("");return n.watch(()=>o.modelValue,r=>{r?i.value=r:(i.value=Ut(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const c=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(c,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=s=>i.value=s),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),yp={key:0,class:"j-panel-top"},vp=["title"],bp={style:{margin:"0","font-size":"14px"}},xp={key:1},wp={key:1,class:"j-panel-bottom"},cl=te(n.defineComponent({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=yn(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,i)=>{const r=n.resolveComponent("j-button"),l=n.resolveComponent("el-tooltip"),c=n.resolveComponent("j-buttons");return n.openBlock(),n.createElementBlock("div",{class:"j-block",style:n.normalizeStyle({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[n.createElementVNode("div",{class:"j-panel",style:n.normalizeStyle({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?(n.openBlock(),n.createElementBlock("div",yp,[e.notTitle?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:"j-panel-top-left",title:e.title||""},[n.renderSlot(a.$slots,"title",{},()=>[n.createElementVNode("span",bp,n.toDisplayString(e.title||""),1)])],8,vp)),e.toolBtns&&e.toolBtns.length>0?(n.openBlock(),n.createElementBlock("span",xp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.toolBtns,s=>(n.openBlock(),n.createBlock(l,{key:s.id,placement:"top",content:s.label||""},{default:n.withCtx(()=>[n.createVNode(r,n.mergeProps({ref_for:!0},s.config,{onClick:d=>o(s),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"j-panel-body",style:n.normalizeStyle(e.bodyStyle)},[n.renderSlot(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?(n.openBlock(),n.createElementBlock("div",wp,[n.createVNode(c,{list:e.bootmBtns},null,8,["list"]),n.createVNode(c,{list:e.bootmRightBtns},null,8,["list"])])):n.createCommentVNode("",!0)],4)],4)}}})),Cp={class:"j-input-rows"},kp={key:0,class:"j-input-rows-num"},Ep={key:1,class:"j-input-rows-char"},sl=te(n.defineComponent({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=C=>C==null,a=e,i=t,{formData:r}=Jt(),l=n.computed(()=>a.editConfig.isAddBtn!==!1),c=n.computed(()=>a.editConfig.addBtnText||"添加"),s=n.computed(()=>a.editConfig.buttonsAlign||"left"),d=n.computed(()=>a.editConfig.isRemoveBtn!==!1),u=n.computed(()=>a.editConfig.readonly),f=n.computed(()=>a.editConfig.drag),h=n.computed(()=>a.editConfig.isNullValue!==!1),m=n.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"],g=n.ref([]);a.modelValue&&a.modelValue.length>0?(g.value=a.modelValue||[],g.value.forEach(C=>{C._i||(C._i=Ut())})):(g.value=[],i("update:modelValue",g.value)),n.watch(()=>a.modelValue,C=>{g.value=a.modelValue||[],g.value=C||[],g.value.forEach(S=>{S._i||(S._i=Ut())})},{deep:!0});const x=()=>{const C={_i:Ut()};a.columns.forEach(S=>{const v=S.config?.valueRowKey||S.id||"";v&&(C[v]=vt(S.config?.defaultValue))}),g.value.push(C),i("change",{id:a.id,value:C,data:C,formData:r,tableData:g.value,type:"add"})},b=C=>{const S=g.value[C];g.value.splice(C,1),i("change",{id:a.id,value:S,data:S,formData:r,tableData:g.value,type:"delete"})},w=C=>{i("rowChange",C)};return n.onMounted(()=>{if(!f.value||!m.value)return;const C=m.value,{initSortable:S}=nr(C,{handle:".j-input-rows-drag",onEnd:v=>{const{oldIndex:j,newIndex:_}=v;if(o(j)||o(_)||j===_||j<0||_<0)return;const B=g.value.splice(j,1)[0];g.value.splice(_,0,B),i("change",{id:a.id,value:B,data:B,formData:r,tableData:g.value,type:"sort"})}});S()}),go({getTableData:()=>g.value,rowChange:w}),(C,S)=>{const v=n.resolveComponent("j-comp"),j=n.resolveComponent("j-icon"),_=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Cp,[n.createElementVNode("div",{ref_key:"inputRowsRef",ref:m,class:"j-input-rows-container"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value,(B,V)=>(n.openBlock(),n.createElementBlock("div",{key:B._i+V,class:n.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(n.openBlock(),n.createElementBlock("div",kp,n.toDisplayString(V+1),1)):n.createCommentVNode("",!0),e.showChar?(n.openBlock(),n.createElementBlock("div",Ep,n.toDisplayString(p[V%26]),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.columns,T=>(n.openBlock(),n.createBlock(v,n.mergeProps({key:T.id,ref_for:!0},T,{row:B}),null,16,["row"]))),128)),f.value?(n.openBlock(),n.createBlock(j,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):n.createCommentVNode("",!0),d.value&&(h.value||g.value.length>1)&&!u.value?(n.openBlock(),n.createBlock(j,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:T=>b(V)},null,8,["onClick"])):n.createCommentVNode("",!0)],2))),128))],512),!u.value&&l.value?(n.openBlock(),n.createElementBlock("div",{key:0,style:n.normalizeStyle({"text-align":s.value}),class:"j-input-rows-actions"},[l.value?(n.openBlock(),n.createBlock(_,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:x},null,8,["label"])):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0)])}}})),Sp={class:"j-input-layer"},dl=te(n.defineComponent({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=p=>!!(p==null||typeof p=="string"&&p.trim()===""||Array.isArray(p)&&p.length===0),a=e,i=t,r=n.ref(),l=n.ref(),c=n.ref(""),s=n.computed({get(){return a.modelValue},set(p){i("update:modelValue",p)}}),d=n.computed({get(){return o(s.value)?"":o(c.value)?a.getText?a.getText(s.value):s.value:c.value},set(p){p||f()}});n.watch(()=>a.modelValue,()=>{c.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},f=()=>{c.value="",s.value="",i("change",{value:"",data:void 0})},h=async()=>{if(!l.value)return;const p=l.value.getSelection();if(a.isMultiSelect){const g=[],y=[];p.forEach(x=>{const b=x[a.labelKey],w=x[a.valueKey];g.push(b!=null?String(b):""),w===0||w?y.push(String(w)):y.push("")}),c.value=g.join(","),s.value=y.join(","),i("change",{value:y.join(","),data:p})}else if(p.length>0){const g=p[0],y=g[a.labelKey],x=g[a.valueKey];c.value=y!=null?String(y):"";const b=x!=null?String(x):"";s.value=b,i("change",{value:b,data:g})}else c.value="",s.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},m=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(p,g)=>{const y=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",Sp,[e.onlyButton?(n.openBlock(),n.createBlock(n.unref(uo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):(n.openBlock(),n.createBlock(y,{key:0,modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=x=>d.value=x),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:f},n.createSlots({_:2},[e.readonly?void 0:{name:"append",fn:n.withCtx(()=>[n.createVNode(n.unref(uo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),n.createVNode(n.unref(va),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:h,onClosed:m},{default:n.withCtx(()=>[n.createVNode(n.unref(ba),{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"])])}}})),ul=te(n.defineComponent({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]}},setup(e){const t=e,o=Jt(),{t:a}=ze(),i=n.computed(()=>t.formConfig?.gutter||16),r=n.computed(()=>t.formConfig?.span||24),l=n.computed(()=>t.formConfig?.labelWidth||o.labelWidth?.value),c=n.computed(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),s=n.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=n.ref(!1),u=()=>{d.value=!0};return ma({...o,isAutoWindow:s,gutter:i,span:r,labelWidth:l}),(f,h)=>{const m=n.resolveComponent("j-button"),p=n.resolveComponent("j-form-item"),g=n.resolveComponent("el-row"),y=n.resolveComponent("el-form"),x=n.resolveComponent("j-dialog");return n.openBlock(),n.createElementBlock("div",null,[n.createVNode(m,n.mergeProps(f.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),n.createVNode(x,{visible:d.value,"onUpdate:visible":h[1]||(h[1]=b=>d.value=b),title:n.unref(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:n.withCtx(()=>[n.createVNode(y,{class:n.normalizeClass(["j-block","j-layer-form"]),"label-position":c.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createBlock(p,n.normalizeProps(n.mergeProps({key:0},e.schema[0])),null,16)):(n.openBlock(),n.createBlock(g,{key:1,gutter:i.value},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.schema,b=>(n.openBlock(),n.createBlock(p,n.mergeProps({key:b.id,ref_for:!0},b),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}})),fl=te(n.defineComponent({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.computed({get(){return o.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return n.onMounted(()=>{o.autoFocus&&setTimeout(()=>{const l=i.value===o.activeValue?o.inactiveValue:o.activeValue;i.value=l,r(l)},100)}),(l,c)=>{const s=n.resolveComponent("el-switch");return n.openBlock(),n.createBlock(s,n.mergeProps(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":c[0]||(c[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}),n.createSlots({_:2},[l.$slots["active-action"]?{name:"active-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}})),pl=te(n.defineComponent({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=d=>{o("update:modelValue",d)},i=(d,u)=>{o("tab-click",d,u)},r=d=>{o("tab-change",d)},l=d=>{o("tab-remove",d)},c=()=>{o("tab-add")},s=(d,u)=>{o("edit",d,u)};return(d,u)=>{const f=n.resolveComponent("el-tabs");return n.openBlock(),n.createBlock(f,n.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:c,onEdit:s}),{default:n.withCtx(()=>[n.renderSlot(d.$slots,"default")]),_:3},16,["model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),hl=te(n.defineComponent({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=r=>{o("update:modelValue",r)},i=r=>{o("change",r)};return(r,l)=>{const c=n.resolveComponent("el-collapse");return n.openBlock(),n.createBlock(c,n.mergeProps(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:n.withCtx(()=>[n.renderSlot(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),_p={class:"j-editor"},ml=te(Lr(n.defineComponent({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,i=n.ref(),r=n.ref(),l=n.shallowRef(),c=n.computed(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let s=!1;const d=f=>{if(!f)return"";let h=f;return o.apiUrl&&o.token&&(h=h.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),h},u=f=>{if(!f)return"";let h=f;if(o.apiUrl){const m=`${o.apiUrl}/system/annexesfile/`;h=h.split(m).join("{learun_img_api}"),o.token&&(h=h.split(`token=${o.token}`).join("{learun_img_token}"))}return h};return n.onMounted(()=>{const f={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};f.onChange=m=>{if(s)return;const p=m.getHtml(),g=u(p);a("update:value",g),a("change",{value:g})};const h=Ni.createEditor({selector:i.value,html:d(o.value),config:f,mode:"default"});l.value=h,Ni.createToolbar({editor:h,selector:r.value,mode:"default"})}),n.watch(()=>o.value,f=>{const h=l.value;if(h){const m=h.getHtml(),p=d(f);u(m)!==f&&(s=!0,h.setHtml(p),s=!1)}}),n.watch(()=>o.readonly,f=>{const h=l.value;h&&(f?h.disable():h.enable())}),n.onBeforeUnmount(()=>{const f=l.value;f?.destroy()}),(f,h)=>(n.openBlock(),n.createElementBlock("div",_p,[n.createElementVNode("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),n.createElementVNode("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:n.normalizeStyle(c.value)},null,4)]))}}),[["__scopeId","data-v-60cd5d0b"]])),Bp={key:0,class:"j-map-loading"},jp=te(n.defineComponent({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(!0),l=n.ref();let c=null,s=null,d=null,u=null;const f=async()=>{r.value=!0;try{c=await or(a.mapKey)}catch(x){console.error("Failed to load Baidu Map:",x),r.value=!1;return}if(s!=null){m(a.lng,a.lat),r.value=!1;return}if(!l.value)return;s=new c.Map(l.value,{enableMapClick:!1});const y=new c.Point(121.480248,31.236276);s.centerAndZoom(y,17),d=new c.Marker(y,{enableDragging:!0}),s.addOverlay(d),d.addEventListener("dragend",x=>{h(x.point)}),s.addControl(new c.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new c.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",x=>{h(x.point)}),u.addEventListener("locationError",x=>{alert(x.message)}),s.addControl(u),s.addEventListener("click",x=>{h(x.point)}),s.enableScrollWheelZoom(!0),m(a.lng,a.lat),r.value=!1},h=y=>{new c.Geocoder().getLocation(y,b=>{d.setPosition(y),s.panTo(y),i("update:address",b.address),i("update:lng",y.lng),i("update:lat",y.lat),i("change",{value:{address:b.address,lng:y.lng,lat:y.lat}})})},m=(y,x)=>{if(y&&x&&c){const b=new c.Point(y,x);d&&d.setPosition(b),s&&s.panTo(b)}};let p=null;return t({setPoint:m,querySearchAsync:(y,x)=>{!s||!c||(p||(p=new c.LocalSearch(s,{onSearchComplete:b=>{const w=[];if(b){const C=b.getCurrentNumPois();for(let S=0;S<C;S++)w.push(b.getPoi(S))}x(w)}})),p.search(y))}}),n.onMounted(()=>{f()}),(y,x)=>(n.openBlock(),n.createElementBlock("div",{class:"j-map",style:n.normalizeStyle({height:e.height})},[r.value?(n.openBlock(),n.createElementBlock("div",Bp,[n.createVNode(Wt,{icon:"mdi:loading",class:"is-loading",size:30})])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}));function gl(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function vn(e){return e.originalEvent||e.srcEvent}function xa(e){gl(e),gl(vn(e))}function bn(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 yl=1500;function vl(e,t,o){var a=this,i=o.get("dragging",!1);function r(l){if(!l.hover){var c=l.originalEvent,s=a._findTargetGfx(c),d=s&&e.get(s);s&&d&&(l.stopPropagation(),i.hover({element:d,gfx:s}),i.move(c))}}i&&t.on("drag.start",function(l){t.once("drag.move",yl,function(c){r(c)})}),(function(){var l,c;t.on("element.hover",function(s){l=s.gfx,c=s.element}),t.on("element.hover",yl,function(s){c&&t.fire("element.out",{element:c,gfx:l})}),t.on("element.out",function(){l=null,c=null})})(),this._findTargetGfx=function(l){var c,s;if(l instanceof MouseEvent)return c=bn(l),s=document.elementFromPoint(c.x,c.y),Tp(s)}}vl.$inject=["elementRegistry","eventBus","injector"];function Tp(e){return A.closest(e,"svg, .djs-element",!0)}const Vp={__init__:["hoverFix"],hoverFix:["type",vl]};function bl(){return/mac/i.test(navigator.platform)}function xl(e,t){return(vn(e)||e).button===t}function Et(e){return xl(e,0)}function Pp(e){return xl(e,1)}function wl(e){var t=vn(e)||e;return Et(e)?bl()?t.metaKey:t.ctrlKey:!1}function wa(e){var t=vn(e)||e;return Et(e)&&t.shiftKey}function zn(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Mp(e){return["M",e.x,e.y]}function Ca(e){return["L",e.x,e.y]}function Np(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function $p(e,t){const o=e.length,a=[Mp(e[0])];for(let i=1;i<o;i++){const r=e[i-1],l=e[i],c=e[i+1];if(!c||!t){a.push(Ca(l));continue}const s=Math.min(t,ka(l.x-r.x,l.y-r.y),ka(c.x-l.x,c.y-l.y));if(!s){a.push(Ca(l));continue}const d=bo(l,r,s),u=bo(l,r,s*.5),f=bo(l,c,s),h=bo(l,c,s*.5);a.push(Ca(d)),a.push(Np(u,h,f))}return a}function bo(e,t,o){const a=t.x-e.x,i=t.y-e.y,r=ka(a,i),l=o/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 Ea(e,t,o){k.isNumber(t)&&(o=t,t=null),t||(t={});const a=M.create("path",t);return k.isNumber(o)&&(a.dataset.cornerRadius=String(o)),Cl(a,e)}function Cl(e,t){const o=parseInt(e.dataset.cornerRadius,10)||0;return M.attr(e,{d:zn($p(t,o))}),e}function Op(e){return!0}function xo(e){return Et(e)||Pp(e)}var kl=500;function El(e,t,o){var a=this;function i(_,B,V){if(!c(_,B)){var T,L,F;V?L=t.getGraphics(V):(T=B.delegateTarget||B.target,T&&(L=T,V=t.get(L))),!(!L||!V)&&(F=e.fire(_,{element:V,gfx:L,originalEvent:B}),F===!1&&(B.stopPropagation(),B.preventDefault()))}}var r={};function l(_){return r[_]}function c(_,B){var V=d[_]||Et;return!V(B)}var s={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":Op,"element.mousedown":xo,"element.mouseup":xo,"element.click":xo,"element.dblclick":xo};function u(_,B,V){var T=s[_];if(!T)throw new Error("unmapped DOM event name <"+_+">");return i(T,B,V)}var f="svg, .djs-element";function h(_,B,V,T){var L=r[V]=function(F){i(V,F)};T&&(d[V]=T),L.$delegate=A.delegate.bind(_,f,B,L)}function m(_,B,V){var T=l(V);T&&A.delegate.unbind(_,B,T.$delegate)}function p(_){k.forEach(s,function(B,V){h(_,V,B)})}function g(_){k.forEach(s,function(B,V){m(_,V,B)})}e.on("canvas.destroy",function(_){g(_.svg)}),e.on("canvas.init",function(_){p(_.svg)}),e.on(["shape.added","connection.added"],function(_){var B=_.element,V=_.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:V})}),e.on(["shape.changed","connection.changed"],kl,function(_){var B=_.element,V=_.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:V})}),e.on("interactionEvents.createHit",kl,function(_){var B=_.element,V=_.gfx;a.createDefaultHit(B,V)}),e.on("interactionEvents.updateHit",function(_){var B=_.element,V=_.gfx;a.updateDefaultHit(B,V)});var y=S("djs-hit djs-hit-stroke"),x=S("djs-hit djs-hit-click-stroke"),b=S("djs-hit djs-hit-all"),w=S("djs-hit djs-hit-no-move"),C={all:b,"click-stroke":x,stroke:y,"no-move":w};function S(_,B){return B=k.assign({stroke:"white",strokeWidth:15},B||{}),o.cls(_,["no-fill","no-border"],B)}function v(_,B){var V=C[B];if(!V)throw new Error("invalid hit type <"+B+">");return M.attr(_,V),_}function j(_,B){M.append(_,B)}this.removeHits=function(_){var B=A.queryAll(".djs-hit",_);k.forEach(B,M.remove)},this.createDefaultHit=function(_,B){var V=_.waypoints,T=_.isFrame,L;return V?this.createWaypointsHit(B,V):(L=T?"stroke":"all",this.createBoxHit(B,L,{width:_.width,height:_.height}))},this.createWaypointsHit=function(_,B){var V=Ea(B);return v(V,"stroke"),j(_,V),V},this.createBoxHit=function(_,B,V){V=k.assign({x:0,y:0},V);var T=M.create("rect");return v(T,B),M.attr(T,V),j(_,T),T},this.updateDefaultHit=function(_,B){var V=A.query(".djs-hit",B);if(V)return _.waypoints?Cl(V,_.waypoints):M.attr(V,{width:_.width,height:_.height}),V},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=h,this.unregisterEvent=m}El.$inject=["eventBus","elementRegistry","styles"];const Sa={__init__:["interactionEvents"],interactionEvents:["type",El]};function xn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;o.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}xn.$inject=["eventBus","canvas"],xn.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},xn.prototype.get=function(){return this._selectedElements},xn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},xn.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();k.isArray(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){var c=i.findRoot(l);return r===c}),t?k.forEach(e,function(l){o.indexOf(l)===-1&&o.push(l)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var Sl="hover",_l="selected";function Bl(e,t){this._canvas=e;function o(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){o(i.element,Sl)}),t.on("element.out",function(i){a(i.element,Sl)}),t.on("selection.changed",function(i){function r(d){a(d,_l)}function l(d){o(d,_l)}var c=i.oldSelection,s=i.newSelection;k.forEach(c,function(d){s.indexOf(d)===-1&&r(d)}),k.forEach(s,function(d){c.indexOf(d)===-1&&l(d)})})}Bl.$inject=["canvas","eventBus"];function jl(e,t,o,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,c=r.elements,s=r.hints||{},d=s.autoSelect;if(l){if(d===!1)return;k.isArray(d)?t.select(d):t.select(c.filter(Rp))}}),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),c=k.find(r,function(s){return l.id===s.id});c||t.select(l)}),e.on("element.click",function(i){if(Et(i)){var r=i.element;r===o.getRootElement()&&(r=null);var l=t.isSelected(r),c=t.get().length>1,s=wa(i);if(l&&c)return s?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,s)}})}jl.$inject=["eventBus","selection","canvas","elementRegistry"];function Rp(e){return!e.hidden}const wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Sa],selection:["type",xn],selectionVisuals:["type",Bl],selectionBehavior:["type",jl]};var Ap=/^djs-cursor-.*$/;function _a(e){var t=A.classes(document.body);t.removeMatching(Ap),e&&t.add("djs-cursor-"+e)}function Tl(){_a(null)}var Lp=5e3;function Vl(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Lp,o),function(){e.off(t,o)}}function Pl(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Cn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ml(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Nl(e,t){return e=k.isArray(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var kn=Math.round,$l="djs-drag-active";function Kt(e){e.preventDefault()}function Ip(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function zp(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ol(e,t,o,a){var i={threshold:5,trapClick:!0},r;function l(w){var C=t.viewbox(),S=t._container.getBoundingClientRect();return{x:C.x+(w.x-S.left)/C.scale,y:C.y+(w.y-S.top)/C.scale}}function c(w,C){C=C||r;var S=e.createEvent(k.assign({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+w,S)===!1?!1:e.fire(C.prefix+"."+w,S)}function s(w){var C=w.filter(function(S){return a.get(S.id)});C.length&&o.select(C)}function d(w,C){var S=r.payload,v=r.displacement,j=r.globalStart,_=bn(w),B=Cn(_,j),V=r.localStart,T=l(_),L=Cn(T,V);if(!r.active&&(C||zp(B)>r.threshold)){if(k.assign(S,{x:kn(V.x+v.x),y:kn(V.y+v.y),dx:0,dy:0},{originalEvent:w}),c("start")===!1)return y();r.active=!0,r.keepSelection||(S.previousSelection=o.get(),o.select(null)),r.cursor&&_a(r.cursor),t.addMarker(t.getRootElement(),$l)}xa(w),r.active&&(k.assign(S,{x:kn(T.x+v.x),y:kn(T.y+v.y),dx:kn(L.x),dy:kn(L.y)},{originalEvent:w}),c("move"))}function u(w){var C,S=!0;r.active&&(w&&(r.payload.originalEvent=w,xa(w)),S=c("end")),S===!1&&c("rejected"),C=x(S!==!0),c("ended",C)}function f(w){Nl("Escape",w)&&(Kt(w),y())}function h(w){var C;r.active&&(C=Vl(e),setTimeout(C,400),Kt(w)),u(w)}function m(w){d(w)}function p(w){var C=r.payload;C.hoverGfx=w.gfx,C.hover=w.element,c("hover")}function g(w){c("out");var C=r.payload;C.hoverGfx=null,C.hover=null}function y(w){var C;if(r){var S=r.active;S&&c("cancel"),C=x(w),S&&c("canceled",C)}}function x(w){var C,S;c("cleanup"),Tl(),r.trapClick?S=h:S=u,A.event.unbind(document,"mousemove",d),A.event.unbind(document,"dragstart",Kt),A.event.unbind(document,"selectstart",Kt),A.event.unbind(document,"mousedown",S,!0),A.event.unbind(document,"mouseup",S,!0),A.event.unbind(document,"keyup",f),A.event.unbind(document,"touchstart",m,!0),A.event.unbind(document,"touchcancel",y,!0),A.event.unbind(document,"touchmove",d,!0),A.event.unbind(document,"touchend",u,!0),e.off("element.hover",p),e.off("element.out",g),t.removeMarker(t.getRootElement(),$l);var v=r.payload.previousSelection;return w!==!1&&v&&!o.get().length&&s(v),C=r,r=null,C}function b(w,C,S,v){r&&y(!1),typeof C=="string"&&(v=S,S=C,C=null),v=k.assign({},i,v||{});var j=v.data||{},_,B,V,T,L;v.trapClick?T=h:T=u,w?(_=vn(w)||w,B=bn(w),xa(w),_.type==="dragstart"&&Kt(_)):(_=null,B={x:0,y:0}),V=l(B),C||(C=V),L=Ip(_),r=k.assign({prefix:S,data:j,payload:{},globalStart:B,displacement:Cn(C,V),localStart:V,isTouch:L},v),v.manual||(L?(A.event.bind(document,"touchstart",m,!0),A.event.bind(document,"touchcancel",y,!0),A.event.bind(document,"touchmove",d,!0),A.event.bind(document,"touchend",u,!0)):(A.event.bind(document,"mousemove",d),A.event.bind(document,"dragstart",Kt),A.event.bind(document,"selectstart",Kt),A.event.bind(document,"mousedown",T,!0),A.event.bind(document,"mouseup",T,!0)),A.event.bind(document,"keyup",f),e.on("element.hover",p),e.on("element.out",g)),c("init"),v.autoActivate&&d(w,!0)}e.on("diagram.destroy",y),this.init=b,this.move=d,this.hover=p,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(w){k.assign(i,w)}}Ol.$inject=["eventBus","canvas","selection","elementRegistry"];const qt={__depends__:[Vp,wn],dragging:["type",Ol]};function Ba(e){return e.childNodes[0]}function wo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}wo.prototype.next=function(){return this._prefix+ ++this._counter};const Fp=new wo("ps");var Hp=["marker-start","marker-mid","marker-end"],Wp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function St(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}St.$inject=["elementRegistry","eventBus","canvas","styles"],St.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")},St.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},St.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var i=M.clone(o),r=o.getBoundingClientRect();return this._cloneMarkers(Ba(i),a),M.attr(i,this._styles.cls(a,[],{x:r.top,y:r.left})),M.append(t,i),M.attr(i,"data-preview-support-element-id",e.id),i},St.prototype.addFrame=function(e,t){var o=M.create("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return M.append(t,o),M.attr(o,"data-preview-support-element-id",e.id),o},St.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,o)}),Kp(e)&&Hp.forEach(function(i){if(M.attr(e,i)){var r=Up(e,i,a._canvas.getContainer());r&&a._cloneMarker(o,e,r,i,t)}})},St.prototype._cloneMarker=function(e,t,o,a,i="djs-dragger"){var r=[o.id,i,Fp.next()].join("-"),l=A.query("marker#"+o.id,e);e=e||this._canvas._svg;var c=l||M.clone(o);c.id=r,M.classes(c).add(i);var s=A.query(":scope > defs",e);s||(s=M.create("defs"),M.append(e,s)),M.append(s,c);var d=Jp(c.id);M.attr(t,a,d)};function Up(e,t,o){var a=Dp(M.attr(e,t));return A.query("marker#"+a,o||document)}function Dp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Jp(e){return"url(#"+e+")"}function Kp(e){return Wp.indexOf(e.nodeName)!==-1}const ja={__init__:["previewSupport"],previewSupport:["type",St]};function Ta(e){this._commandStack=e.get("commandStack",!1)}Ta.$inject=["injector"],Ta.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};const En={__init__:["rules"],rules:["type",Ta]};function qp(e){return k.filter(e,function(t){return!k.find(e,function(o){return o!==t&&Rl(t,o)})})}function Rl(e,t){if(t){if(e===t)return t;if(e.parent)return Rl(e.parent,t)}}function Al(e,t,o){var a=!0;return e.push(t),a}function Va(e,t,o){o=o||0,k.isArray(e)||(e=[e]),k.forEach(e,function(a,i){var r=t(a,i,o);k.isArray(r)&&r.length&&Va(r,t,o+1)})}function Yp(e,t,o){var a=[],i=[];return Va(e,function(r,l,c){Al(a,r);var s=r.children;if(s&&Al(i,s))return s}),a}function Gp(e,t){return Yp(e)}function Xp(e,t,o){k.isUndefined(t)&&(t=!0),k.isObject(t)&&(o=t,t=!0),o=o||{};var a=Fn(o.allShapes),i=Fn(o.allConnections),r=Fn(o.enclosedElements),l=Fn(o.enclosedConnections),c=Fn(o.topLevel,t&&k.groupBy(e,function(u){return u.id}));function s(u){c[u.source.id]&&c[u.target.id]&&(c[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,s),k.forEach(u.outgoing,s),u.children}return Va(e,d),{allShapes:a,allConnections:i,topLevel:c,enclosedConnections:l,enclosedElements:r}}function dt(e,t){t=!!t,k.isArray(e)||(e=[e]);var o,a,i,r;return k.forEach(e,function(l){var c=l;l.waypoints&&!t&&(c=dt(l.waypoints,!0));var s=c.x,d=c.y,u=c.height||0,f=c.width||0;(s<o||o===void 0)&&(o=s),(d<a||a===void 0)&&(a=d),(s+f>i||i===void 0)&&(i=s+f),(d+u>r||r===void 0)&&(r=d+u)}),{x:o,y:a,height:r-a,width:i-o}}function Zp(e,t){var o={};return k.forEach(e,function(a){var i=a;i.waypoints&&(i=dt(i)),!k.isNumber(t.y)&&i.x>t.x&&(o[a.id]=a),!k.isNumber(t.x)&&i.y>t.y&&(o[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))&&(o[a.id]=a)}),o}function Qp(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function eh(e){return!!(e&&e.isFrame)}function Fn(e,t){return k.assign({},e||{},t||{})}function Ze(e){return k.isObject(e)&&k.has(e,"waypoints")}function Sn(e){return k.isObject(e)&&k.has(e,"labelTarget")}var th="drop-ok",Ll="drop-not-ok",Il="attach-ok",zl="new-parent",Fl="create",nh=2e3;function Hl(e,t,o,a,i){function r(s,d,u,f,h){if(!d)return!1;s=k.filter(s,function(b){var w=b.labelTarget;return!b.parent&&!(Sn(b)&&s.indexOf(w)!==-1)});var m=k.find(s,function(b){return!Ze(b)}),p=!1,g=!1,y=!1;Ul(s)&&(p=i.allowed("shape.attach",{position:u,shape:m,target:d})),p||(Ul(s)?y=i.allowed("shape.create",{position:u,shape:m,source:f,target:d}):y=i.allowed("elements.create",{elements:s,position:u,target:d}));var x=h.connectionTarget;return y||p?(m&&f&&(g=i.allowed("connection.create",{source:x===f?m:f,target:x===f?f:m,hints:{targetParent:d,targetAttach:p}})),{attach:p,connect:g}):y===null||p===null?null:!1}function l(s,d){[Il,th,Ll,zl].forEach(function(u){u===d?e.addMarker(s,u):e.removeMarker(s,u)})}o.on(["create.move","create.hover"],function(s){var d=s.context,u=d.elements,f=s.hover,h=d.source,m=d.hints||{};if(!f){d.canExecute=!1,d.target=null;return}Wl(s);var p={x:s.x,y:s.y},g=d.canExecute=f&&r(u,f,p,h,m);f&&g!==null&&(d.target=f,g&&g.attach?l(f,Il):l(f,g?zl:Ll))}),o.on(["create.end","create.out","create.cleanup"],function(s){var d=s.hover;d&&l(d,null)}),o.on("create.end",function(s){var d=s.context,u=d.source,f=d.shape,h=d.elements,m=d.target,p=d.canExecute,g=p&&p.attach,y=p&&p.connect,x=d.hints||{};if(p===!1||!m)return!1;Wl(s);var b={x:s.x,y:s.y};y?f=a.appendShape(u,f,b,m,{attach:g,connection:y===!0?{}:y,connectionTarget:x.connectionTarget}):(h=a.createElements(h,b,m,k.assign({},x,{attach:g})),f=k.find(h,function(w){return!Ze(w)})),k.assign(d,{elements:h,shape:f}),k.assign(s,{elements:h,shape:f})});function c(){var s=t.context();s&&s.prefix===Fl&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",c),o.once(["create.cancel","create.end"],nh,function(){o.off("elements.changed",c)})}),this.start=function(s,d,u){k.isArray(d)||(d=[d]);var f=k.find(d,function(p){return!Ze(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}),m=dt(h);k.forEach(d,function(p){Ze(p)&&(p.waypoints=k.map(p.waypoints,function(g){return{x:g.x-m.x-m.width/2,y:g.y-m.y-m.height/2}})),k.assign(p,{x:p.x-m.x-m.width/2,y:p.y-m.y-m.height/2})}),t.init(s,Fl,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:d,context:u}})}}}Hl.$inject=["canvas","dragging","eventBus","modeling","rules"];function Wl(e){var t=e.context,o=t.createConstraints;o&&(o.left&&(e.x=Math.max(e.x,o.left)),o.right&&(e.x=Math.min(e.x,o.right)),o.top&&(e.y=Math.max(e.y,o.top)),o.bottom&&(e.y=Math.min(e.y,o.bottom)))}function Ul(e){return e&&e.length===1&&!Ze(e[0])}function oh(e,t,o,a,i){var r=M.createTransform();r.setTranslate(t,o);var l=M.createTransform();l.setRotate(0,0,0);var c=M.createTransform();c.setScale(1,1),M.transform(e,[r,l,c])}function ut(e,t,o){var a=M.createTransform();a.setTranslate(t,o),M.transform(e,a)}function ah(e,t){var o=M.createTransform();o.setRotate(t,0,0),M.transform(e,o)}var ih=750;function Dl(e,t,o,a,i){function r(l){var c=M.create("g");M.attr(c,i.cls("djs-drag-group",["no-events"]));var s=M.create("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=o._createContainer("connection",s),o.drawConnection(Ba(u),d)):(u=o._createContainer("shape",s),o.drawShape(Ba(u),d),ut(u,d.x,d.y)),a.addDragger(d,c,u))}),c}t.on("create.move",ih,function(l){var c=l.hover,s=l.context,d=s.elements,u=s.dragGroup;u||(u=s.dragGroup=r(d));var f;c?(u.parentNode||(f=e.getActiveLayer(),M.append(f,u)),ut(u,l.x,l.y)):M.remove(u)}),t.on("create.cleanup",function(l){var c=l.context,s=c.dragGroup;s&&M.remove(s)})}Dl.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Jl={__depends__:[qt,ja,En,wn],__init__:["create","createPreview"],create:["type",Hl],createPreview:["type",Dl]};function Hn(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pa(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var i=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),r=Hn(e,t);return Math.abs(i/r)<=a}var rh=2;function _t(e,t){var o=Array.from(arguments).flat();const a={x:"v",y:"h"};for(const[i,r]of Object.entries(a))if(lh(i,o))return r;return!1}function lh(e,t){const o=t[0];return k.every(t,function(a){return Math.abs(o[e]-a[e])<=rh})}function Kl(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function Ma(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var ch=/,?([a-z]),?/gi,ql=parseFloat,Me=Math,Bt=Me.PI,ft=Me.min,pt=Me.max,Yl=Me.pow,jt=Me.abs,sh=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,dh=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Gl=Array.isArray||function(e){return e instanceof Array};function uh(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fh(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function ph(e){function t(){var o=Array.prototype.slice.call(arguments,0),a=o.join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return uh(i,a)?(fh(r,a),i[a]):(r.length>=1e3&&delete i[r.shift()],r.push(a),i[a]=e(...arguments),i[a])}return t}function hh(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(sh,function(a,i,r){var l=[],c=i.toLowerCase();for(r.replace(dh,function(s,d){d&&l.push(+d)}),c=="m"&&l.length>2&&(o.push([i,...l.splice(0,2)]),c="l",i=i=="m"?"l":"L");l.length>=t[c]&&(o.push([i,...l.splice(0,t[c])]),!!t[c]););}),o.toString=$a,o}function mh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function gh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Na(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function $a(){return this.join(",").replace(ch,"$1")}function yh(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var i=e[o],r=t[o]=new Array(i.length),l=0,c=i.length;l<c;l++)r[l]=i[l];return t.toString=$a,t}function Xl(e,t,o,a,i,r,l,c,s){var d=1-s,u=Yl(d,3),f=Yl(d,2),h=s*s,m=h*s,p=u*e+f*3*s*o+d*3*s*s*i+m*l,g=u*t+f*3*s*a+d*3*s*s*r+m*c;return{x:Co(p),y:Co(g)}}function Zl(e){var t=kh(...e);return Na(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Tt(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function vh(e,t){return e=Na(e),t=Na(t),Tt(t,e.x,e.y)||Tt(t,e.x2,e.y)||Tt(t,e.x,e.y2)||Tt(t,e.x2,e.y2)||Tt(e,t.x,t.y)||Tt(e,t.x2,t.y)||Tt(e,t.x,t.y2)||Tt(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 Ql(e,t,o,a,i){var r=-3*t+9*o-9*a+3*i,l=e*r+6*t-12*o+6*a;return e*l-3*t+3*o}function ec(e,t,o,a,i,r,l,c,s){s==null&&(s=1),s=s>1?1:s<0?0:s;for(var d=s/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],m=0,p=0;p<u;p++){var g=d*f[p]+d,y=Ql(g,e,o,i,l),x=Ql(g,t,a,r,c),b=y*y+x*x;m+=h[p]*Me.sqrt(b)}return d*m}function bh(e,t,o,a,i,r,l,c){if(!(pt(e,o)<ft(i,l)||ft(e,o)>pt(i,l)||pt(t,a)<ft(r,c)||ft(t,a)>pt(r,c))){var s=(e*a-t*o)*(i-l)-(e-o)*(i*c-r*l),d=(e*a-t*o)*(r-c)-(t-a)*(i*c-r*l),u=(e-o)*(r-c)-(t-a)*(i-l);if(u){var f=Co(s/u),h=Co(d/u),m=+f.toFixed(2),p=+h.toFixed(2);if(!(m<+ft(e,o).toFixed(2)||m>+pt(e,o).toFixed(2)||m<+ft(i,l).toFixed(2)||m>+pt(i,l).toFixed(2)||p<+ft(t,a).toFixed(2)||p>+pt(t,a).toFixed(2)||p<+ft(r,c).toFixed(2)||p>+pt(r,c).toFixed(2)))return{x:f,y:h}}}}function Co(e){return Math.round(e*1e11)/1e11}function xh(e,t,o){var a=Zl(e),i=Zl(t);if(!vh(a,i))return[];var r=ec(...e),l=ec(...t),c=nc(e)?1:~~(r/5)||1,s=nc(t)?1:~~(l/5)||1,d=new Array(c+1),u=new Array(s+1),f={},h=[],m,p;for(m=0;m<c+1;m++){var g=Xl(...e,m/c);d[m]={x:g.x,y:g.y,t:m/c}}for(m=0;m<s+1;m++)g=Xl(...t,m/s),u[m]={x:g.x,y:g.y,t:m/s};for(m=0;m<c;m++)for(p=0;p<s;p++){var y=d[m],x=d[m+1],b=u[p],w=u[p+1],C=jt(x.x-y.x)<.01?"y":"x",S=jt(w.x-b.x)<.01?"y":"x",v=bh(y.x,y.y,x.x,x.y,b.x,b.y,w.x,w.y),j;if(v){if(j=v.x.toFixed(9)+"#"+v.y.toFixed(9),f[j])continue;f[j]=!0;var _=y.t+jt((v[C]-y[C])/(x[C]-y[C]))*(x.t-y.t),B=b.t+jt((v[S]-b[S])/(w[S]-b[S]))*(w.t-b.t);_>=0&&_<=1&&B>=0&&B<=1&&h.push({x:v.x,y:v.y,t1:_,t2:B})}}return h}function tc(e,t,o){e=ic(e),t=ic(t);for(var a,i,r,l,c,s,d,u,f,h,m=o?0:[],p=0,g=e.length;p<g;p++){var y=e[p];if(y[0]=="M")a=c=y[1],i=s=y[2];else{y[0]=="C"?(f=[a,i,...y.slice(1)],a=f[6],i=f[7]):(f=[a,i,a,i,c,s,c,s],a=c,i=s);for(var x=0,b=t.length;x<b;x++){var w=t[x];if(w[0]=="M")r=d=w[1],l=u=w[2];else{w[0]=="C"?(h=[r,l,...w.slice(1)],r=h[6],l=h[7]):(h=[r,l,r,l,d,u,d,u],r=d,l=u);var C=xh(f,h);{for(var S=0,v=C.length;S<v;S++)C[S].segment1=p,C[S].segment2=x,C[S].bez1=f,C[S].bez2=h;m=m.concat(C)}}}}}return m}function wh(e){return Gl(e)&&Gl(e[0])}function Ch(e){if(mh(e))return e;var t=new Array(e.length),o=0,a=0,i=0,r=0,l=0,c;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],i=o,r=a,l++,t[0]=["M",o,a]);for(var s,d,u=l,f=e.length;u<f;u++){if(d=e[u],c=d[0],t[u]=s=new Array(d.length),c!=c.toUpperCase())switch(s[0]=c.toUpperCase(),s[0]){case"A":s[1]=d[1],s[2]=d[2],s[3]=d[3],s[4]=d[4],s[5]=d[5],s[6]=+d[6]+o,s[7]=+d[7]+a;break;case"V":s[1]=+d[1]+a;break;case"H":s[1]=+d[1]+o;break;case"M":i=+d[1]+o,r=+d[2]+a;default:for(var h=1,m=d.length;h<m;h++)s[h]=+d[h]+(h%2?o:a)}else for(var p=0,g=d.length;p<g;p++)s[p]=d[p];switch(c=c.toUpperCase(),s[0]){case"Z":o=+i,a=+r;break;case"H":o=s[1];break;case"V":a=s[1];break;case"M":i=s[s.length-2],r=s[s.length-1];default:o=s[s.length-2],a=s[s.length-1]}}return t.toString=$a,t}function nc(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ko(e,t,o,a){return[e,t,o,a,o,a]}function oc(e,t,o,a,i,r){var l=.3333333333333333,c=2/3;return[l*e+c*o,l*t+c*a,l*i+c*o,l*r+c*a,i,r]}function ac(e,t,o,a,i,r,l,c,s,d){var u=Bt*120/180,f=Bt/180*(+i||0),h=[],m,p=ph(function(re,ye,je){var U=re*Me.cos(je)-ye*Me.sin(je),ne=re*Me.sin(je)+ye*Me.cos(je);return{x:U,y:ne}});if(d)j=d[0],_=d[1],S=d[2],v=d[3];else{m=p(e,t,-f),e=m.x,t=m.y,m=p(c,s,-f),c=m.x,s=m.y;var g=(e-c)/2,y=(t-s)/2,x=g*g/(o*o)+y*y/(a*a);x>1&&(x=Me.sqrt(x),o=x*o,a=x*a);var b=o*o,w=a*a,C=(r==l?-1:1)*Me.sqrt(jt((b*w-b*y*y-w*g*g)/(b*y*y+w*g*g))),S=C*o*y/a+(e+c)/2,v=C*-a*g/o+(t+s)/2,j=Me.asin(((t-v)/a).toFixed(9)),_=Me.asin(((s-v)/a).toFixed(9));j=e<S?Bt-j:j,_=c<S?Bt-_:_,j<0&&(j=Bt*2+j),_<0&&(_=Bt*2+_),l&&j>_&&(j=j-Bt*2),!l&&_>j&&(_=_-Bt*2)}var B=_-j;if(jt(B)>u){var V=_,T=c,L=s;_=j+u*(l&&_>j?1:-1),c=S+o*Me.cos(_),s=v+a*Me.sin(_),h=ac(c,s,o,a,i,0,l,T,L,[_,V,S,v])}B=_-j;var F=Me.cos(j),z=Me.sin(j),P=Me.cos(_),E=Me.sin(_),$=Me.tan(B/4),R=4/3*o*$,q=4/3*a*$,ee=[e,t],ce=[e+R*z,t-q*F],de=[c+R*E,s-q*P],Pe=[c,s];if(ce[0]=2*ee[0]-ce[0],ce[1]=2*ee[1]-ce[1],d)return[ce,de,Pe].concat(h);h=[ce,de,Pe].concat(h).join().split(",");for(var J=[],fe=0,ge=h.length;fe<ge;fe++)J[fe]=fe%2?p(h[fe-1],h[fe],f).y:p(h[fe],h[fe+1],f).x;return J}function kh(e,t,o,a,i,r,l,c){for(var s=[],d=[[],[]],u,f,h,m,p,g,y,x,b=0;b<2;++b){if(b==0?(f=6*e-12*o+6*i,u=-3*e+9*o-9*i+3*l,h=3*o-3*e):(f=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*c,h=3*a-3*t),jt(u)<1e-12){if(jt(f)<1e-12)continue;m=-h/f,0<m&&m<1&&s.push(m);continue}y=f*f-4*h*u,x=Me.sqrt(y),!(y<0)&&(p=(-f+x)/(2*u),0<p&&p<1&&s.push(p),g=(-f-x)/(2*u),0<g&&g<1&&s.push(g))}for(var w=s.length,C=w,S;w--;)m=s[w],S=1-m,d[0][w]=S*S*S*e+3*S*S*m*o+3*S*m*m*i+m*m*m*l,d[1][w]=S*S*S*t+3*S*S*m*a+3*S*m*m*r+m*m*m*c;return d[0][C]=e,d[1][C]=t,d[0][C+1]=l,d[1][C+1]=c,d[0].length=d[1].length=C+2,{x0:ft(...d[0]),y0:ft(...d[1]),x1:pt(...d[0]),y1:pt(...d[1])}}function ic(e){if(wh(e)||(e=hh(e)),gh(e))return e;for(var t=yh(Ch(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(h,m,p){var g,y;if(!h)return["C",m.x,m.y,m.x,m.y,m.x,m.y];switch(!(h[0]in{T:1,Q:1})&&(m.qx=m.qy=null),h[0]){case"M":m.X=h[1],m.Y=h[2];break;case"A":h=["C",...ac(m.x,m.y,...h.slice(1))];break;case"S":p=="C"||p=="S"?(g=m.x*2-m.bx,y=m.y*2-m.by):(g=m.x,y=m.y),h=["C",g,y,...h.slice(1)];break;case"T":p=="Q"||p=="T"?(m.qx=m.x*2-m.qx,m.qy=m.y*2-m.qy):(m.qx=m.x,m.qy=m.y),h=["C",...oc(m.x,m.y,m.qx,m.qy,h[1],h[2])];break;case"Q":m.qx=h[1],m.qy=h[2],h=["C",...oc(m.x,m.y,h[1],h[2],h[3],h[4])];break;case"L":h=["C",...ko(m.x,m.y,h[1],h[2])];break;case"H":h=["C",...ko(m.x,m.y,h[1],m.y)];break;case"V":h=["C",...ko(m.x,m.y,m.x,h[1])];break;case"Z":h=["C",...ko(m.x,m.y,m.X,m.Y)];break}return h},i=function(h,m){if(h[m].length>7){h[m].shift();for(var p=h[m];p.length;)r[m]="A",h.splice(m++,0,["C",...p.splice(0,6)]);h.splice(m,1),d=t.length}},r=[],l="",c="",s=0,d=t.length;s<d;s++){t[s]&&(l=t[s][0]),l!="C"&&(r[s]=l,s&&(c=r[s-1])),t[s]=a(t[s],o,c),r[s]!="A"&&l=="C"&&(r[s]="C"),i(t,s);var u=t[s],f=u.length;o.x=u[f-2],o.y=u[f-1],o.bx=ql(u[f-4])||o.x,o.by=ql(u[f-3])||o.y}return t}function Eh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Wn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function rc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Sh(e){return Wn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function _h(e){for(var t=e.waypoints,o=t.reduce(function(d,u,f){var h=t[f-1];if(h){var m=d[d.length-1],p=m&&m.endLength||0,g=Th(h,u);d.push({start:h,end:u,startLength:p,endLength:p+g,length:g})}return d},[]),a=o.reduce(function(d,u){return d+u.length},0),i=a/2,r=0,l=o[r];l.endLength<i;)l=o[++r];var c=(i-l.startLength)/l.length,s={x:l.start.x+(l.end.x-l.start.x)*c,y:l.start.y+(l.end.y-l.start.y)*c};return s}function Te(e){return Ze(e)?_h(e):Sh(e)}function Vt(e,t,o){o=o||0,k.isObject(o)||(o={x:o,y:o});var a=be(e),i=be(t),r=a.bottom+o.y<=i.top,l=a.left-o.x>=i.right,c=a.top-o.y>=i.bottom,s=a.right+o.x<=i.left,d=r?"top":c?"bottom":null,u=s?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function Oa(e,t,o){var a=Bh(e,t);return a.length===1||a.length===2&&Hn(a[0],a[1])<1?Wn(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}),Wn(a[o?0:a.length-1])):null}function Bh(e,t){return tc(e,t)}function jh(e){e=e.slice();for(var t=0,o,a,i;e[t];)o=e[t],a=e[t-1],i=e[t+1],Hn(o,i)===0||Pa(a,i,o)?e.splice(t,1):t++;return e}function Th(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lc(e,t,o,a){function i(l,c){return a.allowed("connection.create",{source:l,target:c})}function r(l,c){return i(c,l)}e.on("connect.hover",function(l){var c=l.context,s=c.start,d=l.hover,u;if(c.hover=d,u=c.canExecute=i(s,d),!k.isNil(u)){if(u!==!1){c.source=s,c.target=d;return}u=c.canExecute=r(s,d),!k.isNil(u)&&u!==!1&&(c.source=d,c.target=s)}}),e.on(["connect.out","connect.cleanup"],function(l){var c=l.context;c.hover=null,c.source=null,c.target=null,c.canExecute=!1}),e.on("connect.end",function(l){var c=l.context,s=c.canExecute,d=c.connectionStart,u={x:l.x,y:l.y},f=c.source,h=c.target;if(!s)return!1;var m=null,p={connectionStart:Ra(c)?u:d,connectionEnd:Ra(c)?d:u};k.isObject(s)&&(m=s),c.connection=o.connect(f,h,m,p)}),this.start=function(l,c,s,d){k.isObject(s)||(d=s,s=Te(c)),t.init(l,"connect",{autoActivate:d,data:{shape:c,context:{start:c,connectionStart:s}}})}}lc.$inject=["eventBus","dragging","modeling","rules"];function Ra(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var Vh=1100,Ph=900,cc="connect-ok",sc="connect-not-ok";function dc(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=r.canExecute,c=r.hover,s=r.source,d=r.start,u=r.startPosition,f=r.target,h=r.connectionStart||u,m=r.connectionEnd||{x:i.x,y:i.y},p=h,g=m;Ra(r)&&(p=m,g=h),a.drawPreview(r,l,{source:s||d,target:f||c,connectionStart:p,connectionEnd:g})}),t.on("connect.hover",Ph,function(i){var r=i.context,l=i.hover,c=r.canExecute;c!==null&&o.addMarker(l,c?cc:sc)}),t.on(["connect.out","connect.cleanup"],Vh,function(i){var r=i.hover;r&&(o.removeMarker(r,cc),o.removeMarker(r,sc))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}dc.$inject=["injector","eventBus","canvas"];const Aa={__depends__:[wn,En,qt],__init__:["connectPreview"],connect:["type",lc],connectPreview:["type",dc]};var Mh=15;function uc(e,t){var o;function a(c){return l(c.originalEvent)}e.on("canvas.focus.changed",function(c){c.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function i(c){var s=o.start,d=o.button,u=bn(c),f=Cn(u,s);if(!o.dragging&&Nh(f)>Mh&&(o.dragging=!0,d===0&&Vl(e),_a("grab")),o.dragging){var h=o.last||o.start;f=Cn(u,h),t.scroll({dx:f.x,dy:f.y}),o.last=u}c.preventDefault()}function r(c){A.event.unbind(document,"mousemove",i),A.event.unbind(document,"mouseup",r),o=null,Tl()}function l(c){if(!A.closest(c.target,".djs-draggable")){var s=c.button;if(!(s>=2||c.ctrlKey||c.shiftKey||c.altKey))return o={button:s,start:bn(c)},A.event.bind(document,"mousemove",i),A.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!o}}uc.$inject=["eventBus","canvas"];function Nh(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const fc={__init__:["moveCanvas"],moveCanvas:["type",uc]};function La(e){return Math.log(e)/Math.log(10)}function pc(e,t){var o=La(e.min),a=La(e.max),i=Math.abs(o)+Math.abs(a);return i/t}function $h(e,t){return Math.max(e.min,Math.min(e.max,t))}var Oh=Math.sign||function(e){return e>=0?1:-1},Ia={min:.2,max:4},hc=10,Rh=.1,Ah=.75;function ht(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=k.bind(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Ah;var a=this;t.on("canvas.focus.changed",function(i){a._init(i.focused&&e.enabled!==!1)})}ht.$inject=["config.zoomScroll","eventBus","canvas"],ht.prototype.scroll=function(t){this._canvas.scroll(t)},ht.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ht.prototype.zoom=function(t,o){var a=pc(Ia,hc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Rh&&(this._zoom(t,o,a),this._totalDelta=0)},ht.prototype._handleWheel=function(t){if(this._canvas.isFocused()){var o=this._container;t.preventDefault();var a=t.ctrlKey||bl()&&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 c=o.getBoundingClientRect(),s={x:t.clientX-c.left,y:t.clientY-c.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Oh(t.deltaY)*r,this.zoom(l,s)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},ht.prototype.stepZoom=function(t,o){var a=pc(Ia,hc);this._zoom(t,o,a)},ht.prototype._zoom=function(e,t,o){var a=this._canvas,i=e>0?1:-1,r=La(a.zoom()),l=Math.round(r/o)*o;l+=o*i;var c=Math.pow(10,l);a.zoom($h(Ia,c),t)},ht.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&A.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},ht.prototype._init=function(e){this.toggle(e)};const mc={__init__:["zoomScroll"],zoomScroll:["type",ht]};function Be(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)}Be.$inject=["eventBus","injector"],Be.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},Be.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let i=this._fire(e,"canExecute",o);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},Be.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Be.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()}},Be.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()}},Be.prototype.register=function(e,t){this._setHandler(e,t)},Be.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},Be.prototype.canUndo=function(){return!!this._getUndoAction()},Be.prototype.canRedo=function(){return!!this._getRedoAction()},Be.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Be.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Be.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Be.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let i;o=this._eventBus.createEvent(o);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,o),o.cancelBubble)break;return i},Be.prototype._createId=function(){return this._uid++},Be.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Be.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,i=this._getHandler(o);if(!i)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},Be.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},Be.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:k.uniqueBy("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Be.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=k.isArray(e)?e:[e],t.dirty=t.dirty.concat(e))},Be.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},Be.prototype._revertedAction=function(e){this._stackIdx--},Be.prototype._getHandler=function(e){return this._handlerMap[e]},Be.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 Lh={commandStack:["type",Be]};function Yt(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function Eo(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function Pt(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function za(e,t){return!e||!t?-1:e.indexOf(t)}function _n(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Ih=1e3;function Ke(e){this._eventBus=e}Ke.$inject=["eventBus"];function zh(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}Ke.prototype.on=function(e,t,o,a,i,r){if((k.isFunction(t)||k.isNumber(t))&&(r=i,i=a,a=o,o=t,t=null),k.isFunction(o)&&(r=i,i=a,a=o,o=Ih),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(c){var s=["commandStack",c,t].filter(function(d){return d}).join(".");l.on(s,o,i?zh(a,r):a,r)})},Ke.prototype.canExecute=bt("canExecute"),Ke.prototype.preExecute=bt("preExecute"),Ke.prototype.preExecuted=bt("preExecuted"),Ke.prototype.execute=bt("execute"),Ke.prototype.executed=bt("executed"),Ke.prototype.postExecute=bt("postExecute"),Ke.prototype.postExecuted=bt("postExecuted"),Ke.prototype.revert=bt("revert"),Ke.prototype.reverted=bt("reverted");function bt(e){return function(o,a,i,r,l){(k.isFunction(o)||k.isNumber(o))&&(l=r,r=i,i=a,a=o,o=null),this.on(o,e,a,i,r,l)}}var Fh=250,gc=1400;function Fa(e,t,o){Ke.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",gc,function(i){var r=i.context,l=r.shapes,c=r.validatedShapes;r.shapes=yc(l),r.validatedShapes=yc(c)}),a&&t.on("shape.move.start",Fh,function(i){var r=i.context,l=r.shapes,c=[];k.forEach(l,function(s){k.forEach(s.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&c.push(d),s.labelTarget&&c.push(s)})}),k.forEach(c,function(s){a.makeDraggable(r,s,!0)})}),this.preExecuted("elements.move",gc,function(i){var r=i.context,l=r.closure,c=l.enclosedElements,s=[];k.forEach(c,function(d){k.forEach(d.labels,function(u){c[u.id]||s.push(u)})}),l.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context,l=r.connection||r.shape;_n(l.labels,function(c){o.removeShape(c,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,c=l.labelTarget;c&&(r.labelTargetIndex=za(c.labels,l),r.labelTarget=c,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,c=r.labelTarget,s=r.labelTargetIndex;c&&(Pt(c.labels,l,s),l.labelTarget=c)})}Yt(Fa,Ke),Fa.$inject=["injector","eventBus","modeling"];function yc(e){return k.filter(e,function(t){return e.indexOf(t.labelTarget)===-1})}const Hh={__init__:["labelSupport"],labelSupport:["type",Fa]};function vc(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const o=Math.random()*16|0;return(t==="x"?o:o&3|8).toString(16)})}function bc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function Wh(e,t,o,a){var i=o.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 c=this.indexOf(r);if(typeof l>"u"){if(c!==-1)return;l=this.length}c!==-1&&this.splice(c,1),this.splice(l,0,r),c===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Uh(e){return e.__refs_collection===!0}function Dh(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function xc(e,t,o){var a=Wh(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,o)})}function Jh(e,t,o){var a=t.inverse,i=o[t.name];Object.defineProperty(o,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,o),i=r,e.set(i,a,o)}}})}function at(e,t){if(!(this instanceof at))return new at(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}at.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?xc(this,t,e):Jh(this,t,e)},at.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Uh(o)||xc(this,t,e),o},at.prototype.ensureBound=function(e,t){Dh(e,t)||this.bind(e,t)},at.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},at.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var Ha=new at({name:"children",enumerable:!0,collection:!0},{name:"parent"}),wc=new at({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Cc=new at({name:"attachers",collection:!0},{name:"host"}),kc=new at({name:"outgoing",collection:!0},{name:"source"}),Ec=new at({name:"incoming",collection:!0},{name:"target"});function Bn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),Ha.bind(this,"parent"),wc.bind(this,"labels"),kc.bind(this,"outgoing"),Ec.bind(this,"incoming")}function Un(){Bn.call(this),Ha.bind(this,"children"),Cc.bind(this,"host"),Cc.bind(this,"attachers")}Yt(Un,Bn);function Sc(){Bn.call(this),Ha.bind(this,"children")}Yt(Sc,Un);function _c(){Un.call(this),wc.bind(this,"labelTarget")}Yt(_c,Un);function Bc(){Bn.call(this),kc.bind(this,"source"),Ec.bind(this,"target")}Yt(Bc,Bn);var Kh={connection:Bc,shape:Un,label:_c,root:Sc};function qh(e,t){var o=Kh[e];if(!o)throw new Error("unknown type: <"+e+">");return k.assign(new o,t)}function Yh(e){return e instanceof Bn}function Mt(){this._uid=12}Mt.prototype.createRoot=function(e){return this.create("root",e)},Mt.prototype.createLabel=function(e){return this.create("label",e)},Mt.prototype.createShape=function(e){return this.create("shape",e)},Mt.prototype.createConnection=function(e){return this.create("connection",e)},Mt.prototype.create=function(e,t){return t=k.assign({},t||{}),t.id||(t.id=e+"_"+this._uid++),qh(e,t)};const Gh={width:90,height:20};function Gt(){Mt.call(this),this._translate=bc}Ht(Gt,Mt),Gt.$inject=[],Gt.prototype.baseCreate=Mt.prototype.create,Gt.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,_e({type:"label"},Gh,t)):this.createFlowElement(e,t)},Gt.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:vc()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=_e({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Gt.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 So(e,t){this._modeling=e,this._canvas=t}So.$inject=["modeling","canvas"],So.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;k.forEach(o,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)})},So.prototype.postExecute=function(e){};function _o(e){this._modeling=e}_o.$inject=["modeling"],_o.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:i.attach}),e.shape=a},_o.prototype.postExecute=function(e){var t=e.hints||{};Xh(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 Xh(e,t){return k.some(e.outgoing,function(o){return o.target===t})}function Bo(e,t){this._canvas=e,this._layouter=t}Bo.$inject=["canvas","layouter"],Bo.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!o||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},Bo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var jo=Math.round;function Wa(e){this._modeling=e}Wa.$inject=["modeling"],Wa.prototype.preExecute=function(e){var t=e.elements,o=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 c=k.filter(t,function(f){return!f.hidden}),s=dt(c);k.forEach(t,function(f){Ze(f)&&(f.waypoints=k.map(f.waypoints,function(h){return{x:jo(h.x-s.x-s.width/2+i.x),y:jo(h.y-s.y-s.height/2+i.y)}})),k.assign(f,{x:jo(f.x-s.x-s.width/2+i.x),y:jo(f.y-s.y-s.height/2+i.y)})});var d=qp(t),u={};k.forEach(t,function(f){if(Ze(f)){u[f.id]=k.isNumber(a)?l.createConnection(u[f.source.id],u[f.target.id],a,f,f.parent||o,r):l.createConnection(u[f.source.id],u[f.target.id],f,f.parent||o,r);return}var h=k.assign({},r);d.indexOf(f)===-1&&(h.autoResize=!1),Sn(f)&&(h=k.omit(h,["attach"])),u[f.id]=k.isNumber(a)?l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,a,h):l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,h)}),e.elements=k.values(u)};var jc=Math.round;function Nt(e){this._canvas=e}Nt.$inject=["canvas"],Nt.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?k.assign(t,o):k.assign(t,{x:o.x-jc(t.width/2),y:o.y-jc(t.height/2)}),this._canvas.addShape(t,a,i),t},Nt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Dn(e){Nt.call(this,e)}Yt(Dn,Nt),Dn.$inject=["canvas"];var Zh=Nt.prototype.execute;Dn.prototype.execute=function(e){var t=e.shape;return em(t),t.labelTarget=e.labelTarget,Zh.call(this,e)};var Qh=Nt.prototype.revert;Dn.prototype.revert=function(e){return e.shape.labelTarget=null,Qh.call(this,e)};function em(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Jn(e,t){this._canvas=e,this._modeling=t}Jn.$inject=["canvas","modeling"],Jn.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;_n(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),_n(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},Jn.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=za(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Jn.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(o.children,t,a),this._canvas.addConnection(t,o),t};function Ua(e,t){this._modeling=e,this._elementRegistry=t}Ua.$inject=["modeling","elementRegistry"],Ua.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;k.forEach(a,function(i){o.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function Kn(e,t){this._canvas=e,this._modeling=t}Kn.$inject=["canvas","modeling"],Kn.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;_n(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),_n(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),_n(o.children,function(a){Ze(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},Kn.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=za(a.children,o),t.removeShape(o),o},Kn.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,i=e.oldParentIndex;return Pt(a.children,o,i),t.addShape(o,a),o};function To(e){this._modeling=e}To.$inject=["modeling"];var Tc={x:"y",y:"x"};To.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,i=e.dimension;function r(y,x){y.range.min=Math.min(x[a],y.range.min),y.range.max=Math.max(x[a]+x[i],y.range.max)}function l(y){return y[a]+y[i]/2}function c(y){return y.length-1}function s(y){return y.max-y.min}function d(y,x){var b={y:0};b[a]=y-l(x),b[a]&&(b[Tc[a]]=0,t.moveElements([x],b,x.parent))}var u=o[0],f=c(o),h=o[f],m,p,g=0;k.forEach(o,function(y,x){var b,w,C;if(y.elements.length<2){x&&x!==o.length-1&&(r(y,y.elements[0]),g+=s(y.range));return}b=k.sortBy(y.elements,a),w=b[0],x===f&&(w=b[c(b)]),C=l(w),y.range=null,k.forEach(b,function(S){if(d(C,S),y.range===null){y.range={min:S[a],max:S[a]+S[i]};return}r(y,S)}),x&&x!==o.length-1&&(g+=s(y.range))}),p=Math.abs(h.range.min-u.range.max),m=Math.round((p-g)/(o.length-1)),!(m<o.length-1)&&k.forEach(o,function(y,x){var b={},w;y===u||y===h||(w=o[x-1],y.range.max=0,k.forEach(y.elements,function(C,S){b[Tc[a]]=0,b[a]=w.range.max-C[a]+m,y.range.min!==C[a]&&(b[a]+=C[a]-y.range.min),b[a]&&t.moveElements([C],b,C.parent),y.range.max=Math.max(C[a]+C[i],S?y.range.max:0)}))})},To.prototype.postExecute=function(e){};function Vo(e,t){this._layouter=e,this._canvas=t}Vo.$inject=["layouter","canvas"],Vo.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return k.assign(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Vo.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Da(){}Da.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Eo(r.children,t),Pt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x+=o.x,l.y+=o.y,l.original&&(l.original.x+=o.x,l.original.y+=o.y)}),t},Da.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return Eo(o.children,t),Pt(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 Po(e,t,o){var a=Pl(t),i=Pl(o),r=Cn(e,a),l={x:r.x*(o.width/t.width),y:r.y*(o.height/t.height)};return Wn({x:i.x+l.x,y:i.y+l.y})}function Ja(e,t,o){var a=Mo(e),i=Pc(a,t),r=a[0];return i.length?i[i.length-1]:Po(r.original||r,o,t)}function Ka(e,t,o){var a=Mo(e),i=Pc(a,t),r=a[a.length-1];return i.length?i[0]:Po(r.original||r,o,t)}function qa(e,t,o){var a=Mo(e),i=Vc(t,o),r=a[0];return Po(r.original||r,i,t)}function Ya(e,t,o){var a=Mo(e),i=Vc(t,o),r=a[a.length-1];return Po(r.original||r,i,t)}function Vc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Mo(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Pc(e,t){var o=k.map(e,nm);return k.filter(o,function(a){return tm(a,t)})}function tm(e,t){return Vt(t,e,1)==="intersect"}function nm(e){return e.original||e}function Ga(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ga.prototype.add=function(e,t){return this.addAll([e],t)},Ga.prototype.addAll=function(e,t){var o=Xp(e,!!t,this);return k.assign(this,o),this};function qn(e){this._modeling=e}qn.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},qn.prototype.moveClosure=function(e,t,o,a,i){var r=this._modeling,l=e.allShapes,c=e.allConnections,s=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===o&&(u=!0),k.forEach(l,function(f){r.moveShape(f,t,d[f.id]&&!u&&o,{recurse:!1,layout:!1})}),k.forEach(c,function(f){var h=!!l[f.source.id],m=!!l[f.target.id];s[f.id]&&h&&m?r.moveConnection(f,t,d[f.id]&&!u&&o):r.layoutConnection(f,{connectionStart:h&&qa(f,f.source,t),connectionEnd:m&&Ya(f,f.target,t)})})},qn.prototype.getClosure=function(e){return new Ga().addAll(e,!0)};function No(e){this._helper=new qn(e)}No.$inject=["modeling"],No.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},No.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function Xt(e){this._modeling=e,this._helper=new qn(e)}Xt.$inject=["modeling"],Xt.prototype.execute=function(e){var t=e.shape,o=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=Eo(r.children,t),Pt(a.children,t,i),k.assign(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Xt.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&(k.forEach(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:Ya(r,t,o)})}),k.forEach(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:qa(r,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Xt.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,i=e.delta;return Pt(o.children,t,a),k.assign(t,{parent:o,x:t.x-i.x,y:t.y-i.y}),t},Xt.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Xt.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Yn(e){this._modeling=e}Yn.$inject=["modeling"],Yn.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!o)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),o&&(e.oldTarget=a.target,a.target=o),a},Yn.prototype.postExecute=function(e){var t=e.connection,o=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&&(o&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||Mc(k.isArray(i)?i[0]:i)),a&&(!o||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||Mc(k.isArray(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},Yn.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),o&&(i.target=o),a&&(i.waypoints=a),i};function Mc(e){return e.original||e}function xt(e,t){this._modeling=e,this._rules=t}xt.$inject=["modeling","rules"],xt.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=e.hints||{},c;function s(p,g,y){return a.allowed("connection.reconnect",{connection:y,source:p,target:g})}var d={x:r.x,y:r.y},u={x:i.x,y:i.y,width:i.width,height:i.height};c=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&o.updateAttachment(c,i.host);var f;l.moveChildren!==!1&&(f=i.children.slice(),o.moveElements(f,{x:0,y:0},c,l));var h=i.incoming.slice(),m=i.outgoing.slice();k.forEach(h,function(p){var g=p.source,y=s(g,c,p);y&&t.reconnectEnd(p,c,Ka(p,c,u),l)}),k.forEach(m,function(p){var g=p.target,y=s(c,g,p);y&&t.reconnectStart(p,c,Ja(p,c,u),l)})},xt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},xt.prototype.execute=function(e){},xt.prototype.revert=function(e){},xt.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},xt.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},xt.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Gn(e){this._modeling=e}Gn.$inject=["modeling"],Gn.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Gn.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds,i=e.hints||{};i.layout!==!1&&(k.forEach(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:Ka(r,o,a)})}),k.forEach(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ja(r,o,a)})}))},Gn.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function om(e,t){var o=[];return k.forEach(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;k.forEach(i.concat(r),function(l){var c=l.source,s=l.target;(Xn(e,c)||Xn(e,s)||Xn(t,c)||Xn(t,s))&&(Xn(o,l)||o.push(l))})}),o}function Xn(e,t){return e.indexOf(t)!==-1}function am(e,t,o){var a=e.x,i=e.y,r=e.width,l=e.height,c=o.x,s=o.y;switch(t){case"n":return{x:a,y:i+s,width:r,height:l-s};case"s":return{x:a,y:i,width:r,height:l+s};case"w":return{x:a+c,y:i,width:r-c,height:l};case"e":return{x:a,y:i,width:r+c,height:l};default:throw new Error("unknown direction: "+t)}}function $t(e){this._modeling=e}$t.$inject=["modeling"],$t.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),k.forEach(i,function(c){l[c.id]=rm(c)}),this.resizeShapes(i,t,o),this.updateConnectionWaypoints(om(a,i),t,o,r,a,i,l)},$t.prototype.execute=function(){},$t.prototype.revert=function(){},$t.prototype.moveShapes=function(e,t){var o=this;k.forEach(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},$t.prototype.resizeShapes=function(e,t,o){var a=this;k.forEach(e,function(i){var r=am(i,o,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},$t.prototype.updateConnectionWaypoints=function(e,t,o,a,i,r,l){var c=this,s=i.concat(r);k.forEach(e,function(d){var u=d.source,f=d.target,h=im(d),m=$c(o),p={};Ot(s,u)&&Ot(s,f)?(h=k.map(h,function(g){return Oc(g,a,o)&&(g[m]=g[m]+t[m]),g.original&&Oc(g.original,a,o)&&(g.original[m]=g.original[m]+t[m]),g}),c._modeling.updateWaypoints(d,h,{labelBehavior:!1})):(Ot(s,u)||Ot(s,f))&&(Ot(i,u)?p.connectionStart=qa(d,u,t):Ot(i,f)?p.connectionEnd=Ya(d,f,t):Ot(r,u)?p.connectionStart=Ja(d,u,l[u.id]):Ot(r,f)&&(p.connectionEnd=Ka(d,f,l[f.id])),c._modeling.layoutConnection(d,p))})};function Nc(e){return k.assign({},e)}function im(e){return k.map(e.waypoints,function(t){return t=Nc(t),t.original&&(t.original=Nc(t.original)),t})}function $c(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Oc(e,t,o){var a=$c(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function Ot(e,t){return e.indexOf(t)!==-1}function rm(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function $o(e){this._modeling=e}$o.$inject=["modeling"],$o.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Rc(o),t.collapsed=!t.collapsed;var a=Ac(o,t.collapsed);return[t].concat(a)},$o.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,i=Lc(a,o);return t.collapsed=!t.collapsed,[t].concat(i)};function Rc(e){var t={};return k.forEach(e,function(o){t[o.id]=o.hidden,o.children&&(t=k.assign({},t,Rc(o.children)))}),t}function Ac(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(Ac(a.children,a.collapsed||t)))}),o}function Lc(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Lc(a.children,t)))}),o}function Oo(e){this._modeling=e}Oo.$inject=["modeling"],Oo.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Ic(a,t),zc(o,t),t.host=o,t},Oo.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,Ic(o,t),zc(a,t,i),t};function Ic(e,t){return Eo(e&&e.attachers,t)}function zc(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),Pt(a,t,o)}}function Xa(){}Xa.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},Xa.prototype.revert=function(e){var t=e.connection,o=e.oldWaypoints;return t.waypoints=o,t};function me(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}me.$inject=["eventBus","elementFactory","commandStack"],me.prototype.getHandlers=function(){return{"shape.append":_o,"shape.create":Nt,"shape.delete":Kn,"shape.move":Xt,"shape.resize":Gn,"shape.replace":xt,"shape.toggleCollapse":$o,spaceTool:$t,"label.create":Dn,"connection.create":Bo,"connection.delete":Jn,"connection.move":Da,"connection.layout":Vo,"connection.updateWaypoints":Xa,"connection.reconnect":Yn,"elements.create":Wa,"elements.move":No,"elements.delete":Ua,"elements.distribute":To,"elements.align":So,"element.updateAttachment":Oo}},me.prototype.registerHandlers=function(e){k.forEach(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},me.prototype.moveShape=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},me.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},me.prototype.moveElements=function(e,t,o,a){a=a||{};var i=a.attach,r=o,l;i===!0?(l=o,r=o.parent):i===!1&&(l=null);var c={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",c)},me.prototype.moveConnection=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},me.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},me.prototype.createConnection=function(e,t,o,a,i,r){typeof o=="object"&&(r=i,i=a,a=o,o=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:o,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},me.prototype.createShape=function(e,t,o,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,c;e=this._create("shape",e),r?(l=o.parent,c=o):l=o;var s={position:t,shape:e,parent:l,parentIndex:a,host:c,hints:i};return this._commandStack.execute("shape.create",s),s.shape},me.prototype.createElements=function(e,t,o,a,i){k.isArray(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:o,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},me.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var i={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",i),i.shape},me.prototype.appendShape=function(e,t,o,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:o,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},me.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},me.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},me.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},me.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},me.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},me.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},me.prototype.resizeShape=function(e,t,o,a){var i={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",i)},me.prototype.createSpace=function(e,t,o,a,i){var r={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},me.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},me.prototype.reconnect=function(e,t,o,a,i){var r={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},me.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,k.assign(a,{docking:"source"}))},me.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,k.assign(a,{docking:"target"}))},me.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},me.prototype._create=function(e,t){return Yh(t)?t:this._elementFactory.create(e,t)},me.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function Fc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Za(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function lm(e,t){Array.isArray(e)&&e.forEach(t)}function Ro(e){const t=e.businessObject;if(t)return t.name||""}function cm(e,t){const o=e.businessObject;return o.name=t,e}const sm={height:20},Hc=15;function Qa(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Wc(e){return Zn(e.label)}function dm(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=um(e),r=Math.atan((a.y-o.y)/(a.x-o.x));let{x:l,y:c}=i;return Math.abs(r)<Math.PI/2?c-=Hc:l+=Hc,{x:l,y:c}}function um(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function Uc(e){return e.waypoints?dm(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+sm.height/2}}function Zn(e){return e&&!!e.labelTarget}const fm={width:0,height:0};function Dc(e,t){function o(c,s){const d=c.label||c,u=c.labelTarget||c;return cm(d,s),[d,u]}function a(c){const{element:s,newLabel:d}=c,{businessObject:u}=s;if(!Zn(s)&&Qa(s)&&!Wc(s)&&!Jc(d)){let h=Uc(s);h={x:h.x,y:h.y+7},e.createLabel(s,h,{id:u.id+"_label",businessObject:u})}}function i(c){return c.oldLabel=Ro(c.element),o(c.element,c.newLabel)}function r(c){return o(c.element,c.oldLabel)}function l(c){const{element:s,newLabel:d}=c,u=s.label||s,f=c.hints||{};let{newBounds:h}=c;if(!Zn(u))return;if(Zn(u)&&Jc(d)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const m=Ro(u);typeof h>"u"&&(h=t.getExternalLabelBounds(u,m)),h&&e.resizeShape(u,h,fm)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}Dc.$inject=["modeling","textRenderer"];function Jc(e){return!e||!e.trim()}function Qn(e,t,o){me.call(this,e,t,o)}Ht(Qn,me),Qn.$inject=["eventBus","elementFactory","commandStack"],Qn.prototype.getHandlers=function(){const e=me.prototype.getHandlers.call(this);return e["element.updateLabel"]=Dc,e},Qn.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function ei(e,t){Ke.call(this,e);function o(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"],o)}Ht(ei,Ke),ei.$inject=["eventBus","connectionDocking"];function Kc(){}Kc.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Te(t.source||e.source),t.connectionEnd||Te(t.target||e.target)]};var Ao=20,pm=5,Lo=Math.round,qc=20,hm={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function mm(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function gm(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Yc(e,t,o){var a=Vt(t,e,pm),i=o.split(":")[0],r=Lo((t.x-e.x)/2+e.x),l=Lo((t.y-e.y)/2+e.y),c,s,d=gm(i,a),u=/h|r|l/.test(i),f=!1,h=!1;return d?(c=u?{x:r,y:e.y}:{x:e.x,y:l},s=u?"h:h":"v:v"):(f=mm(a,i),s=u?"h:v":"v:h",f?u?(h=l===e.y,c={x:e.x+Ao*(/l/.test(i)?-1:1),y:h?l+Ao:l}):(h=r===e.x,c={x:h?r+Ao:r,y:e.y+Ao*(/t/.test(i)?-1:1)}):c={x:r,y:l}),{waypoints:ti(e,c,s).concat(c),directions:s,turnNextDirections:h}}function ym(e,t,o){return Yc(e,t,o)}function vm(e,t,o){var a=Yc(t,e,Gc(o));return{waypoints:a.waypoints.slice().reverse(),directions:Gc(a.directions),turnNextDirections:a.turnNextDirections}}function bm(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=o+":"+a,r=ti(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:r,directions:i}}function Gc(e){return e.split(":").reverse().join(":")}function xm(e,t,o){var a=Lo((t.x-e.x)/2+e.x),i=Lo((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function ti(e,t,o){if(o=o||"h:h",!Tm(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Zc(o)){var a=ym(e,t,o),i=vm(e,t,o),r=bm(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return xm(e,t,o)}function wm(e,t,o){var a=ti(e,t,o);return a.unshift(e),a.push(t),es(a)}function Cm(e,t,o,a,i){var r=i&&i.preferredLayouts||[],l=k.without(r,"straight")[0]||"h:h",c=hm[l]||0,s=Vt(e,t,c),d=jm(s,l);o=o||Te(e),a=a||Te(t);var u=d.split(":"),f=Qc(o,e,u[0],Vm(s)),h=Qc(a,t,u[1],s);return wm(f,h,d)}function km(e,t,o,a,i,r){k.isArray(o)&&(i=o,r=a,o=Te(e),a=Te(t)),r=k.assign({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts,c=l.indexOf("straight")!==-1,s;return s=c&&Sm(e,t,o,a,r),s||(s=r.connectionEnd&&Bm(t,e,a,i),s)||(s=r.connectionStart&&_m(e,t,o,i),s)?s:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:Cm(e,t,o,a,r)}function Em(e,t,o){return e>=t&&e<=o}function Xc(e,t,o){var a={x:"width",y:"height"};return Em(t[e],o[e],o[e]+o[a[e]])}function Sm(e,t,o,a,i){var r={},l,c;return c=Vt(e,t),/^(top|bottom|left|right)$/.test(c)?(/top|bottom/.test(c)&&(l="x"),/left|right/.test(c)&&(l="y"),i.preserveDocking==="target"?Xc(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y,original:{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y}},{x:a.x,y:a.y}]):null:Xc(l,o,t)?(r[l]=o[l],[{x:o.x,y:o.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 _m(e,t,o,a){return ni(e,t,o,a)}function Bm(e,t,o,a){var i=a.slice().reverse();return i=ni(e,t,o,i),i?i.reverse():null}function ni(e,t,o,a){function i(u){return u.length<3?!0:u.length>4?!1:!!k.find(u,function(f,h){var m=u[h-1];return m&&Hn(f,m)<3})}function r(u,f,h){var m=_t(f,u);switch(m){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 m;for(m=u.length-2;m!==0;m--)if(Kl(u[m],f,qc)||Kl(u[m],h,qc))return u.slice(m);return u}if(i(a))return null;var c=a[0],s=a.slice(),d;return s[0]=o,s[1]=r(s[1],c,o),d=l(s,e,t),d!==s&&(s=ni(e,t,o,d)),s&&_t(s)?null:s}function jm(e,t){if(Zc(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 Tm(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Zc(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 Qc(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function es(e){return e.reduce(function(t,o,a){var i=t[t.length-1],r=e[a+1];return Pa(i,r,o,0)||t.push(o),t},[])}function oi(){}Ht(oi,Kc);const Zt=(e,t)=>e.type===t;oi.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,c,s;return l===void 0&&(r=Io(i&&i[0],o),l=Io(i&&i[i.length-1],a)),r||(r=Io(i&&i[0],o)),l||(l=Io(i&&i[i.length-1],a)),Zt(e,"myline")&&(o===a?c={preferredLayouts:Pm(o,e)}:Zt(o,"gatewayAnd")||Zt(o,"gatewayXor")||Zt(o,"gatewayInclusive")?c={preferredLayouts:["v:h"]}:Zt(a,"gatewayAnd")||Zt(a,"gatewayXor")||Zt(a,"gatewayInclusive")?c={preferredLayouts:["h:v"]}:c={preferredLayouts:["h:h"]}),c&&(c=_e(c,t),s=es(km(o,a,r,l,i,c))),s||[r,l]};function Io(e,t){return e?e.original||e:Te(t)}function Pm(e,t){const{waypoints:o}=t,a=o&&o.length&&Vt(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function ts(e){return k.assign({original:e.point.original||e.point},e.actual)}function Rt(e,t){this._elementRegistry=e,this._graphicsFactory=t}Rt.$inject=["elementRegistry","graphicsFactory"],Rt.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,o),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(ts(a)),r.push(ts(i)),r},Rt.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,i,r,l;return i=o?0:a.length-1,r=a[i],l=this._getIntersection(t,e,o),{point:r,actual:l||r,idx:i}},Rt.prototype._getIntersection=function(e,t,o){var a=this._getShapePath(e),i=this._getConnectionPath(t);return Oa(a,i,o)},Rt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Rt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Rt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const ns={__depends__:[Lh,Hh,wn],__init__:["modeling","elementUpdater"],modeling:["type",Qn],layouter:["type",oi],elementUpdater:["type",ei],elementFactory:["type",Gt],connectionDocking:["type",Rt]};var Mm=1e3;function Qt(e,t){var o=this;t=t||Mm,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,c=i.gfx,s=i.attrs;if(o.canRender(l))return r==="render.shape"?o.drawShape(c,l,s):o.drawConnection(c,l,s)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(o.canRender(i))return a.type==="render.getShapePath"?o.getShapePath(i):o.getConnectionPath(i)})}Qt.prototype.canRender=function(e){},Qt.prototype.drawShape=function(e,t){},Qt.prototype.drawConnection=function(e,t){},Qt.prototype.getShapePath=function(e){},Qt.prototype.getConnectionPath=function(e){};function Nm(e){return e.businessObject}function zo(e,t){return e.businessObject.strokeWidth||t||1}function rt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ve(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function $m(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2,i=[["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]];return zn(i)}function Om(e,t){const{x:o,y:a,width:i,height:r}=e,l=[["M",o+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 zn(l)}function Rm(e){const{x:t,y:o,width:a,height:i}=e,r=a/2,l=i/2,c=[["M",t+r,o],["l",r,l],["l",-r,l],["l",-r,-l],["z"]];return zn(c)}function Am(e){const{x:t,y:o,width:a,height:i}=e,r=[["M",t,o],["l",a,0],["l",0,i],["l",-a,0],["z"]];return zn(r)}const ai=10,ii=.95,At=(e,t)=>e.type===t;function en(e,t,o,a,i,r,l){Qt.call(this,e,l);const c="var(--j-color-bg-container)",s="var(--j-color-text)",d={};Object.keys(r.palette).forEach(P=>{const E=r.palette[P];d[E.type]=E.options});const{computeStyle:u}=t;function f(P){return z[P]}function h(P){return t.computeStyle(P,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:s,strokeWidth:2})}function m(P){return t.computeStyle(P,{strokeLinecap:"round",strokeLinejoin:"round",stroke:s,strokeWidth:2,fill:"white"})}function p(P,E,$,R){$=h($);const q=Ea(E,$,R);return M.append(P,q),q}function g(P,E,$){return p(P,E,$,5)}function y(P,E,$,R,q){Fc(R)&&(q=R,R=0),R=R||0,q=u(q,{stroke:s,strokeWidth:2,fill:c}),q.fill==="none"&&delete q.fillOpacity;const ee=E/2,ce=$/2,de=M.create("circle");return M.attr(de,{cx:ee,cy:ce,r:Math.round((E+$)/4-R)}),M.attr(de,q),M.append(P,de),de}function x(P,E,$,R,q,ee){Fc(q)&&(ee=q,q=0),q=q||0,ee=u(ee,{stroke:s,strokeWidth:2,fill:c});const ce=M.create("rect");return M.attr(ce,{x:q,y:q,width:E-q*2,height:$-q*2,rx:R,ry:R}),M.attr(ce,ee),M.append(P,ce),ce}function b(P,E,$){$=u($,["no-fill"],{strokeWidth:2,stroke:s});const R=M.create("path");return M.attr(R,{d:E}),M.attr(R,$),M.append(P,R),R}function w(P,E,$,R){const q=E/2,ee=$/2,de=[{x:q,y:0},{x:E,y:ee},{x:q,y:$},{x:0,y:ee}].map(J=>J.x+","+J.y).join(" ");R=u(R,{stroke:s,strokeWidth:2,fill:c});const Pe=M.create("polygon");return M.attr(Pe,{points:de}),M.attr(Pe,R),M.append(P,Pe),Pe}function C(P,E,$,R){return b(E,$,_e({"data-marker":P},R))}function S(P,E,$){$=_e({size:{width:100}},$);const R=i.createText(E||"",$);return M.classes(R).add("djs-label"),M.append(P,R),R}function v(P,E,$){const R=Nm(E);return S(P,R.name,{box:E,align:$,padding:5,style:{fill:Ve(E,s)}})}function j(P,E){const $={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return S(P,Ro(E),{box:$,fitBox:!0,style:_e({},i.getExternalStyle(),{fill:Ve(E,s)})})}function _(P,E,$){const R=$&&$.indexOf("SubProcessMarker")!==-1;let q;R?q={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:q={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},lm($,ee=>{f(ee)(P,E,q)})}function B(P){return P.replace(/[^0-9a-zA-z]+/g,"_")}function V(P,E){const{ref:$={x:0,y:0},scale:R=1,element:q,parentGfx:ee=a._svg}=E,ce=M.create("marker",{id:P,viewBox:"0 0 20 20",refX:$.x,refY:$.y,markerWidth:20*R,markerHeight:20*R,orient:"auto"});M.append(ce,q);let de=A.query(":scope > defs",ee);de||(de=M.create("defs"),M.append(ee,de)),M.append(de,ce)}function T(P,E,$,R){const q=E+"-"+B($)+"-"+B(R)+"-"+vc();return L(P,q,E,$,R),"url(#"+q+")"}function L(P,E,$,R,q){{const ee=M.create("path",{d:"M 1 5 L 11 10 L 1 15 Z",...m({fill:q,stroke:q,strokeWidth:1})});V(E,{element:ee,ref:{x:11,y:10},scale:.5,parentGfx:P})}}function F(P,E,$,R){const q=d[E.type]?.icon||E.icon;if(q){const ee=o.getScaledPath(q,{abspos:{x:$,y:R}});b(P,ee,{strokeWidth:0,fill:Ve(E,d[E.type]?.iconFill||E.iconFill)})}}const z={event(P,E,$){return"fillOpacity"in $||($.fillOpacity=ii),y(P,E.width,E.height,$)},startEvent(P,E){const $={fill:rt(E,d.startEvent?.fill||E.fill),stroke:Ve(E,d.startEvent?.stroke||E.stroke),strokeWidth:zo(E,d.startEvent?.strokeWidth||E.strokeWidth)},R=f("event")(P,E,$);return F(P,E,18,18),R},endEvent(P,E){const $=f("event")(P,E,{strokeWidth:zo(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:rt(E,d.endEvent?.fill||E.fill),stroke:Ve(E,d.endEvent?.stroke||E.stroke)});return F(P,E,18,18),$},gateway(P,E){const $={fillOpacity:ii,strokeWidth:zo(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)};return w(P,E.width,E.height,$)},gatewayAnd(P,E){const $=f("gateway")(P,E),R=o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[E.type]?.width||E.width,containerHeight:d[E.type]?.height||E.height,position:{mx:.47,my:.29}});return b(P,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayXor(P,E){const $=f("gateway")(P,E),R=o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}});return b(P,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayInclusive(P,E){const $=f("gateway")(P,E);return y(P,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Ve(E,c),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},activity(P,E,$){return $=$||{},"fillOpacity"in $||($.fillOpacity=ii),x(P,E.width,E.height,ai,$)},task(P,E){const $={fill:rt(E,c),stroke:Ve(E,s)},R=f("activity")(P,E,$);return v(P,E,"center-middle"),_(P,E),R},userTask(P,E){const $=f("task")(P,E),R=15,q=12,ee=o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:R,y:q}});b(P,ee,{strokeWidth:.5,fill:rt(E,c),stroke:Ve(E,s)});const ce=o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:R,y:q}});b(P,ce,{strokeWidth:.5,fill:rt(E,c),stroke:Ve(E,s)});const de=o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:R,y:q}});return b(P,de,{strokeWidth:.5,fill:Ve(E,s),stroke:Ve(E,s)}),$},scriptTask(P,E){const $=f("task")(P,E),R=o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(P,R,{strokeWidth:1,stroke:Ve(E,s)}),$},SubProcessMarker(P,E){const $=x(P,14,14,0,{strokeWidth:1,fill:rt(E,c),stroke:Ve(E,s)});ut($,E.width/2-7.5,E.height-20);const R=o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});C("sub-process",P,R,{fill:rt(E,c),stroke:Ve(E,s)})},subprocess(P,E,$){$=_e({fill:rt(E,c),stroke:Ve(E,s)},$);const R=f("activity")(P,E,$);return v(P,E,"center-middle"),_(P,E,["SubProcessMarker"]),R},label(P,E){return j(P,E)},myline(P,E){const $=rt(E,r.lineStroke||c),R=Ve(E,r.lineStroke||s);return g(P,E.waypoints,{markerEnd:T(P,"sequenceflow-end",$,R),stroke:R})},default(P,E){const $={strokeWidth:zo(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)},R=x(P,E.width,E.height,E.radius||ai,$);return v(P,E,"center-middle"),_(P,E),F(P,E,E.iconX,E.iconY),R}};this.handlers=z,this._drawPath=b}Ht(en,Qt),en.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],en.prototype.canRender=function(){return!0},en.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},en.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},en.prototype.getShapePath=function(e){return At(e,"startEvent")||At(e,"endEvent")?$m(e):At(e,"userTask")||At(e,"scriptTask")||At(e,"subprocess")?Om(e,ai):At(e,"gatewayAnd")||At(e,"gatewayXor")||At(e,"gatewayInclusive")?Rm(e):Am(e)};var Lm=0,Im={width:150,height:50};function zm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Fm(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 Hm(e,t){t.textContent=e;var o;try{var a,i=e==="";return t.textContent=i?"dummy":e,o=t.getBBox(),a={width:o.width+o.x*2,height:o.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function Wm(e,t,o){for(var a=e.shift(),i=a,r;;){if(r=Hm(i,o),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return Um(e,i,a,r);i=Jm(i,r.width,t)}}function Um(e,t,o,a){if(t.length<o.length){var i=o.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var os="­";function Dm(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(o.length>1)for(;a=o.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===os)&&i.pop();break}var l=i[i.length-1];return l&&l===os&&(i[i.length-1]="-"),i.join("")}function Jm(e,t,o){var a=Math.max(e.length*(o/t),1),i=Dm(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Km(){var e=document.getElementById("helper-svg");return e||(e=M.create("svg"),M.attr(e,{id:"helper-svg"}),A.assignStyle(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Fo(e){this._config=k.assign({},{size:Im,padding:Lm,style:{},align:"center-top"},e||{})}Fo.prototype.createText=function(e,t){return this.layoutText(e,t).element},Fo.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Fo.prototype.layoutText=function(e,t){var o=k.assign({},this._config.size,t.box),a=k.assign({},this._config.style,t.style),i=zm(t.align||this._config.align),r=Fm(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,c=qm(a),s=e.split(/\u00AD?\r?\n/),d=[],u=o.width-r.left-r.right,f=M.create("text");M.attr(f,{x:0,y:0}),M.attr(f,a);var h=Km();for(M.append(h,f);s.length;)d.push(Wm(s,u,f));i.vertical==="middle"&&(r.top=r.bottom=0);var m=k.reduce(d,function(b,w,C){return b+(c||w.height)},0)+r.top+r.bottom,p=k.reduce(d,function(b,w,C){return w.width>b?w.width:b},0),g=r.top;i.vertical==="middle"&&(g+=(o.height-m)/2),g-=(c||d[0].height)/4;var y=M.create("text");M.attr(y,a),k.forEach(d,function(b){var w;switch(g+=c||b.height,i.horizontal){case"left":w=r.left;break;case"right":w=(l?p:u)-r.right-b.width;break;default:w=Math.max(((l?p:u)-b.width)/2+r.left,0)}var C=M.create("tspan");M.attr(C,{x:w,y:g}),C.textContent=b.text,M.append(y,C)}),M.remove(f);var x={width:p,height:m};return{dimensions:x,element:y}};function qm(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const Ym=12,Gm=1.2,Xm=30;function as(e){const t=_e({fontFamily:"Arial, sans-serif",fontSize:Ym,fontWeight:"normal",lineHeight:Gm},e&&e.defaultStyle||{}),o=parseInt(t.fontSize,10)-1,a=_e({},t,{fontSize:o},e&&e.externalStyle||{}),i=new Fo({style:t});this.getExternalLabelBounds=function(r,l){const c=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-c.width/2),y:Math.round(r.y),width:Math.ceil(c.width),height:Math.ceil(c.height)}},this.getTextAnnotationBounds=function(r,l){const c=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(Xm,Math.round(c.height))}},this.createText=function(r,l){return i.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return a}}as.$inject=["config.textRenderer"];function Zm(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,i;o.abspos?(a=o.abspos.x,i=o.abspos.y):(a=o.containerWidth*o.position.mx,i=o.containerHeight*o.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(o.position){const s=o.containerHeight/r.height*o.yScaleFactor,d=o.containerWidth/r.width*o.xScaleFactor;for(let u=0;u<r.heightElements.length;u++)l["y"+u]=r.heightElements[u]*s;for(let u=0;u<r.widthElements.length;u++)l["x"+u]=r.widthElements[u]*d}return ng(r.d,{mx:a,my:i,e:l})}}const Qm=/\{([^}]+)\}/g,eg=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function tg(e,t,o){let a=o;return t.replace(eg,(i,r,l,c,s)=>{r=r||c,a&&(r in a&&(a=a[r]),typeof a=="function"&&s&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function ng(e,t){return String(e).replace(Qm,(o,a)=>tg(o,a,t))}const is={__init__:["myRenderer"],myRenderer:["type",en],textRenderer:["type",as],pathMap:["type",Zm]};function rs(e,t){return _e({id:e.id,type:e.type,businessObject:e},t)}function og(e,t,o){const a=e.waypoint;return!a||a.length<2?[Te(t),Te(o)]:a.map(i=>({x:i.x,y:i.y}))}function Lt(e,t,o,a,i,r){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=i,this._translate=bc,this._textRenderer=r,this._modeling=t}Lt.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Lt.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(rs(e,{source:a,target:i,waypoints:og(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(rs(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Lt.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},Lt.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=_e(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name: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}),o&&this.addLabel(r,o)}}},Lt.prototype._getSource=function(e){return this._getElement(e.from)},Lt.prototype._getTarget=function(e){return this._getElement(e.to)},Lt.prototype._getElement=function(e){return this._elementRegistry.get(e)};const ls={myImporter:["type",Lt]},cs=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},ss=(e,t)=>{const o=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{o.add(r)}),i.forEach(r=>{o.add(r)})},ag=n.defineComponent({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let c,s=1;const d=()=>{s=1,c.get("canvas").zoom("fit-viewport")},u=()=>{const v=c.get("eventBus");v.on("element.dblclick",j=>{i("elementDblclick",j.element.businessObject)}),v.on("element.click",j=>{i("elementClick",j.element.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let v={__init__:["myOptions"],myOptions:["type",f]};c=new $i({canvas:{container:r.value},modules:[Aa,Jl,ns,fc,mc,v,is,ls]});const j=c.get("canvas"),_=c.get("elementFactory");d();const B=_.createRoot();j.setRootElement(B),u()};n.onMounted(()=>{h()});const m=v=>{const j=v==null?1:s+v;c.get("canvas").zoom(j),s=j},p=()=>{c.get("canvas").zoom(1);const v=c.get("elementRegistry").getAll();var j=cs(v);return j},g=v=>{c.clear(),d(),ss(v,c)},y=v=>{c.get("myImporter").update(v.id,v)};return t({reset:()=>{d()},zoom:v=>{m(v)},getData:()=>p(),setData:v=>{g(v)},updateElemet:v=>{y(v)}}),(v,j)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}});function ri(e){return e&&e[e.length-1]}function ds(e){return e.y}function us(e){return e.x}var ig={left:us,center:us,right:function(e){return e.x+e.width},top:ds,middle:ds,bottom:function(e){return e.y+e.height}};function jn(e,t){this._modeling=e,this._rules=t}jn.$inject=["modeling","rules"],jn.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},jn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},jn.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,i=o.dimension,r={},l={},c=!1,s,d,u;function f(h,m){return Math.round((h[a]+m[a]+m[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ri(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if(k.forEach(t,function(h){var m=h[a]+Math.round(h[i]/2);l[m]?l[m].elements.push(h):l[m]={elements:[h],center:m}}),s=k.sortBy(l,function(h){return h.elements.length>1&&(c=!0),h.elements.length}),c)return r[e]=ri(s).center,r;d=t[0],t=k.sortBy(t,function(h){return h[a]+h[i]}),u=ri(t),r[e]=f(d,u)}return r},jn.prototype.trigger=function(e,t){var o=this._modeling,a,i=k.filter(e,function(s){return!(s.waypoints||s.host||s.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),k.isArray(a)&&(i=a),!(i.length<2||!a)){var r=ig[t],l=k.sortBy(i,r),c=this._alignmentPosition(t,l);o.alignElements(l,c)}};const rg={__init__:["alignElements"],alignElements:["type",jn]};var Ho=Math.round,lg=Math.max;function cg(e,t){var o=e.x,a=e.y;return[["M",o,a],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function sg(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var fs=10;function dg(e,t){var o,a;for(o=0;a=e[o];o++)if(Hn(a,t)<=fs)return{point:e[o],bendpoint:!0,index:o};return null}function ug(e,t){var o=tc(cg(t,fs),sg(e)),a=o[0],i=o[o.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=lg(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Ho(a.x+i.x)/2,y:Ho(a.y+i.y)/2},index:a.segment2}:{point:{x:Ho(a.x),y:Ho(a.y)},index:a.segment2}:null}function fg(e,t){return dg(e,t)||ug(e,t)}function pg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function hg(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[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 ps(e,t){var o=t[0],a=t[1],i={x:a.x-o.x,y:a.y-o.y},r=hg([o.x,o.y],[i.x,i.y],[e.x,e.y]);return{x:o.x+r*i.x,y:o.y+r*i.y}}function mg(e,t){var o=ps(e,t),a={x:o.x-e.x,y:o.y-e.y};return pg(a)}var hs="djs-bendpoint",ms="djs-segment-dragger";function gg(e,t){var o=bn(t),a=e._container.getBoundingClientRect(),i;i={x:a.left,y:a.top};var r=e.viewbox();return{x:r.x+(o.x-i.x)/r.scale,y:r.y+(o.y-i.y)/r.scale}}function li(e,t,o){var a=gg(e,o),i=fg(t,a);return i}function ci(e,t){var o=M.create("g");M.classes(o).add(hs),M.append(e,o);var a=M.create("circle");M.attr(a,{cx:0,cy:0,r:4}),M.classes(a).add("djs-visual"),M.append(o,a);var i=M.create("circle");return M.attr(i,{cx:0,cy:0,r:10}),M.classes(i).add("djs-hit"),M.append(o,i),t&&M.classes(o).add(t),o}function yg(e,t,o,a){var i=M.create("g");M.append(e,i);var r=18,l=6,c=11,s=bg(t,o,a),d=l+c,u=M.create("rect");M.attr(u,{x:-r/2,y:-l/2,width:r,height:l}),M.classes(u).add("djs-visual"),M.append(i,u);var f=M.create("rect");return M.attr(f,{x:-s/2,y:-d/2,width:s,height:d}),M.classes(f).add("djs-hit"),M.append(i,f),ah(i,a==="v"?90:0),i}function gs(e,t,o){var a=M.create("g"),i=Ma(t,o),r=_t(t,o);return M.append(e,a),yg(a,t,o,r),M.classes(a).add(ms),M.classes(a).add(r==="h"?"horizontal":"vertical"),ut(a,i.x,i.y),a}function si(e){return Math.abs(Math.round(e*2/3))}function vg(e,t){var o=xg(e,t);return ps(e,o)}function bg(e,t,o){var a=t.x-e.x,i=t.y-e.y;return si(o==="h"?a:i)}function xg(e,t){for(var o=t.waypoints,a=1/0,i,r=0;r<o.length-1;r++){var l=o[r],c=o[r+1],s=mg(e,[l,c]);s<a&&(a=s,i=r)}return[o[i],o[i+1]]}function di(e){return CSS.escape(e)}function ys(e,t,o,a,i){function r(w,C,S){var v=w.index,j=w.point,_,B,V,T,L,F;return v<=0||w.bendpoint?!1:(_=C[v-1],B=C[v],V=Ma(_,B),T=_t(_,B),L=Math.abs(j.x-V.x),F=Math.abs(j.y-V.y),T&&L<=S&&F<=S)}function l(w,C){var S=w.waypoints,v,j,_,B;return C.index<=0||C.bendpoint||(v={start:S[C.index-1],end:S[C.index]},j=_t(v.start,v.end),!j)?null:(j==="h"?_=v.end.x-v.start.x:_=v.end.y-v.start.y,B=si(_)/2,B)}function c(w,C){var S=C.waypoints,v=li(t,S,w),j;if(v)return j=l(C,v),r(v,S,j)?i.start(w,C,v.index):a.start(w,C,v.index,!v.bendpoint),!0}function s(w,C,S){A.event.bind(w,C,function(v){o.triggerMouseEvent(C,v,S),v.stopPropagation()})}function d(w,C){var S=t.getLayer("overlays"),v=A.query('.djs-bendpoints[data-element-id="'+di(w.id)+'"]',S);return!v&&C&&(v=M.create("g"),M.attr(v,{"data-element-id":w.id}),M.classes(v).add("djs-bendpoints"),M.append(S,v),s(v,"mousedown",w),s(v,"click",w),s(v,"dblclick",w)),v}function u(w,C){return A.query('.djs-segment-dragger[data-segment-idx="'+w+'"]',C)}function f(w,C){C.waypoints.forEach(function(S,v){var j=ci(w);M.append(w,j),ut(j,S.x,S.y)}),ci(w,"floating")}function h(w,C){for(var S=C.waypoints,v,j,_,B=1;B<S.length;B++)v=S[B-1],j=S[B],_t(v,j)&&(_=gs(w,v,j),M.attr(_,{"data-segment-idx":B}),s(_,"mousemove",C))}function m(w){k.forEach(A.queryAll("."+hs,w),function(C){M.remove(C)})}function p(w){k.forEach(A.queryAll("."+ms,w),function(C){M.remove(C)})}function g(w){var C=d(w);return C||(C=d(w,!0),f(C,w),h(C,w)),C}function y(w){var C=d(w);C&&(p(C),m(C),h(C,w),f(C,w))}function x(w,C){var S=A.query(".floating",w),v=C.point;S&&ut(S,v.x,v.y)}function b(w,C,S){var v=u(C.index,w),j=S[C.index-1],_=S[C.index],B=C.point,V=Ma(j,_),T=_t(j,_),L,F;v&&(L=wg(v),F={x:B.x-V.x,y:B.y-V.y},T==="v"&&(F={x:F.y,y:F.x}),ut(L,F.x,F.y))}e.on("connection.changed",function(w){y(w.element)}),e.on("connection.remove",function(w){var C=d(w.element);C&&M.remove(C)}),e.on("element.marker.update",function(w){var C=w.element,S;C.waypoints&&(S=g(C),w.add?M.classes(S).add(w.marker):M.classes(S).remove(w.marker))}),e.on("element.mousemove",function(w){var C=w.element,S=C.waypoints,v,j;if(S){if(v=d(C,!0),j=li(t,S,w.originalEvent),!j)return;x(v,j),j.bendpoint||b(v,j,S)}}),e.on("element.mousedown",function(w){if(Et(w)){var C=w.originalEvent,S=w.element;if(S.waypoints)return c(C,S)}}),e.on("selection.changed",function(w){var C=w.newSelection,S=C[0];S&&S.waypoints&&g(S)}),e.on("element.hover",function(w){var C=w.element;C.waypoints&&(g(C),o.registerEvent(w.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(w){o.unregisterEvent(w.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(w){var C=w.element,S=w.newId;if(C.waypoints){var v=d(C);v&&M.attr(v,{"data-element-id":S})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}ys.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function wg(e){return A.query(".djs-visual",e)}var vs=Math.round,tn="reconnectStart",nn="reconnectEnd",eo="updateWaypoints";function ui(e,t,o,a,i,r){this._injector=e,this.start=function(l,c,s,d){var u=o.getGraphics(c),f=c.source,h=c.target,m=c.waypoints,p;!d&&s===0?p=tn:!d&&s===m.length-1?p=nn:p=eo;var g=p===eo?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(g,{connection:c,source:f,target:h});y===!1&&(y=i.allowed(g,{connection:c,source:h,target:f})),y!==!1&&a.init(l,"bendpoint.move",{data:{connection:c,connectionGfx:u,context:{allowed:y,bendpointIndex:s,connection:c,source:f,target:h,insert:d,type:p}}})},t.on("bendpoint.move.hover",function(l){var c=l.context,s=c.connection,d=s.source,u=s.target,f=l.hover,h=c.type;c.hover=f;var m;if(f){var p=h===eo?"connection.updateWaypoints":"connection.reconnect";if(m=c.allowed=i.allowed(p,{connection:s,source:h===tn?f:d,target:h===nn?f:u}),m){c.source=h===tn?f:d,c.target=h===nn?f:u;return}m===!1&&(m=c.allowed=i.allowed(p,{connection:s,source:h===nn?f:u,target:h===tn?f:d})),m&&(c.source=h===nn?f:u,c.target=h===tn?f:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var c=l.context,s=c.type;c.hover=null,c.source=null,c.target=null,s!==eo&&(c.allowed=!1)}),t.on("bendpoint.move.end",function(l){var c=l.context,s=c.allowed,d=c.bendpointIndex,u=c.connection,f=c.insert,h=u.waypoints.slice(),m=c.source,p=c.target,g=c.type,y=c.hints||{},x={x:vs(l.x),y:vs(l.y)};if(!s)return!1;g===eo?(f?h.splice(d,0,x):h[d]=x,y.bendpointMove={insert:f,bendpointIndex:d},h=this.cropWaypoints(u,h),r.updateWaypoints(u,jh(h),y)):(g===tn?(y.docking="source",Wo(c)&&(y.docking="target",y.newWaypoints=h.reverse())):g===nn&&(y.docking="target",Wo(c)&&(y.docking="source",y.newWaypoints=h.reverse())),r.reconnect(u,m,p,x,y))},this)}ui.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ui.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Wo(e){var t=e.hover,o=e.source,a=e.target,i=e.type;if(i===tn)return t&&a&&t===a&&o!==a;if(i===nn)return t&&o&&t===o&&o!==a}var Cg="reconnectStart",kg="reconnectEnd",bs="updateWaypoints",to="connect-ok",Uo="connect-not-ok",xs="connect-hover",ws="djs-updating",Cs="djs-dragging",ks=1100;function Es(e,t,o,a){this._injector=t;var i=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(r){var l=r.context,c=l.bendpointIndex,s=l.connection,d=l.insert,u=s.waypoints,f=u.slice();l.waypoints=u,d&&f.splice(c,0,{x:r.x,y:r.y}),s.waypoints=f;var h=l.draggerGfx=ci(a.getLayer("overlays"));M.classes(h).add("djs-dragging"),a.addMarker(s,Cs),a.addMarker(s,ws)}),o.on("bendpoint.move.hover",function(r){var l=r.context,c=l.allowed,s=l.hover,d=l.type;if(s){if(a.addMarker(s,xs),d===bs)return;c?(a.removeMarker(s,Uo),a.addMarker(s,to)):c===!1&&(a.removeMarker(s,to),a.addMarker(s,Uo))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],ks,function(r){var l=r.context,c=l.hover,s=l.target;c&&(a.removeMarker(c,xs),a.removeMarker(c,s?to:Uo))}),o.on("bendpoint.move.move",function(r){var l=r.context,c=l.allowed,s=l.bendpointIndex,d=l.draggerGfx,u=l.hover,f=l.type,h=l.connection,m=h.source,p=h.target,g=h.waypoints.slice(),y={x:r.x,y:r.y},x=l.hints||{},b={};i&&(x.connectionStart&&(b.connectionStart=x.connectionStart),x.connectionEnd&&(b.connectionEnd=x.connectionEnd),f===Cg?Wo(l)?(b.connectionEnd=b.connectionEnd||y,b.source=p,b.target=u||m,g=g.reverse()):(b.connectionStart=b.connectionStart||y,b.source=u||m,b.target=p):f===kg?Wo(l)?(b.connectionStart=b.connectionStart||y,b.source=u||p,b.target=m,g=g.reverse()):(b.connectionEnd=b.connectionEnd||y,b.source=m,b.target=u||p):(b.noCropping=!0,b.noLayout=!0,g[s]=y),f===bs&&(g=e.cropWaypoints(h,g)),b.waypoints=g,i.drawPreview(l,c,b)),ut(d,r.x,r.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],ks,function(r){var l=r.context,c=l.connection,s=l.draggerGfx,d=l.hover,u=l.target,f=l.waypoints;c.waypoints=f,M.remove(s),a.removeMarker(c,ws),a.removeMarker(c,Cs),d&&(a.removeMarker(d,to),a.removeMarker(d,u?to:Uo)),i&&i.cleanUp(l)})}Es.$inject=["bendpointMove","injector","eventBus","canvas"];var Ss="connect-hover",_s="djs-updating";function Bs(e,t,o){return fi(e,t,e[t]+o)}function fi(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function Eg(e,t,o,a){var i=Math.max(t[a],o[a]),r=Math.min(t[a],o[a]),l=20,c=Math.min(Math.max(r+l,e[a]),i-l);return fi(t,a,c)}function js(e){return e==="x"?"y":"x"}function Ts(e,t,o){var a,i;return e.original?e.original:(a=Te(t),i=js(o),fi(e,i,a[i]))}function Vs(e,t,o,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(f,h,m){var p,g=o.getGraphics(h),y=m-1,x=m,b=h.waypoints,w=b[y],C=b[x],S=li(o,b,f),v,j,_;v=_t(w,C),v&&(j=v==="v"?"x":"y",y===0&&(w=Ts(w,h.source,j)),x===b.length-1&&(C=Ts(C,h.target,j)),S?_=S.point:_={x:(w.x+C.x)/2,y:(w.y+C.y)/2},p={connection:h,segmentStartIndex:y,segmentEndIndex:x,segmentStart:w,segmentEnd:C,axis:j,dragPosition:_},a.init(f,_,"connectionSegment.move",{cursor:j==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:g,context:p}}))};function c(f,h){if(!l)return h;var m=f.waypoints,p;return f.waypoints=h,p=l.getCroppedWaypoints(f),f.waypoints=m,p}function s(f){i.update("connection",f.connection,f.connectionGfx)}function d(f,h,m){var p=f.newWaypoints,g=f.segmentStartIndex+h,y=p[g],x=f.segmentEndIndex+h,b=p[x],w=js(f.axis),C=Eg(m,y,b,w);ut(f.draggerGfx,C.x,C.y)}function u(f,h){var m=0,p=f.filter(function(g,y){return Pa(f[y-1],f[y+1],g)?(m=y<=h?m-1:m,!1):!0});return{waypoints:p,segmentOffset:m}}t.on("connectionSegment.move.start",function(f){var h=f.context,m=f.connection,p=o.getLayer("overlays");h.originalWaypoints=m.waypoints.slice(),h.draggerGfx=gs(p,h.segmentStart,h.segmentEnd),M.classes(h.draggerGfx).add("djs-dragging"),o.addMarker(m,_s)}),t.on("connectionSegment.move.move",function(f){var h=f.context,m=h.connection,p=h.segmentStartIndex,g=h.segmentEndIndex,y=h.segmentStart,x=h.segmentEnd,b=h.axis,w=h.originalWaypoints.slice(),C=Bs(y,b,f["d"+b]),S=Bs(x,b,f["d"+b]),v=w.length,j=0;w[p]=C,w[g]=S;var _,B;p<2&&(_=Vt(m.source,C),p===1?_==="intersect"&&(w.shift(),w[0]=C,j--):_!=="intersect"&&(w.unshift(y),j++)),g>v-3&&(B=Vt(m.target,S),g===v-2?B==="intersect"&&(w.pop(),w[w.length-1]=S):B!=="intersect"&&w.push(x)),h.newWaypoints=m.waypoints=c(m,w),d(h,j,f),h.newSegmentStartIndex=p+j,s(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,o.addMarker(f.hover,Ss)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var h=f.context.hover;h&&o.removeMarker(h,Ss)}),t.on("connectionSegment.move.cleanup",function(f){var h=f.context,m=h.connection;h.draggerGfx&&M.remove(h.draggerGfx),o.removeMarker(m,_s)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var h=f.context,m=h.connection;m.waypoints=h.originalWaypoints,s(f)}),t.on("connectionSegment.move.end",function(f){var h=f.context,m=h.connection,p=h.newWaypoints,g=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,g),x=y.waypoints,b=c(m,x),w=y.segmentOffset,C={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:g+w}};r.updateWaypoints(m,b,C)})}Vs.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Sg=Math.abs,Ps=Math.round;function _g(e,t,o){o=o===void 0?10:o;var a,i;for(a=0;a<t.length;a++)if(i=t[a],Sg(i-e)<=o)return i}function Bg(e){return{x:e.x,y:e.y}}function jg(e){return{x:e.x+e.width,y:e.y+e.height}}function Tn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Ps(e.x+e.width/2),y:Ps(e.y+e.height/2)}}function Do(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function wt(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return o===!1?r[t]=!1:(r[t]=!0,a=o-i,e[t]+=a,e["d"+t]+=a),i}function Ms(e){return e.children||[]}var Tg=Math.abs,Ns=Math.round,pi=10;function $s(e){function t(r,l){if(k.isArray(r)){for(var c=r.length;c--;)if(Tg(r[c]-l)<=pi)return r[c]}else{r=+r;var s=l%r;if(s<pi)return l-s;if(s>r-pi)return l-s+r}return l}function o(r,l){if(r.waypoints)return vg(l,r);if(r.width)return{x:Ns(r.width/2+r.x),y:Ns(r.height/2+r.y)}}function a(r){var l=r.context,c=l.snapPoints,s=l.connection,d=s.waypoints,u=l.segmentStart,f=l.segmentStartIndex,h=l.segmentEnd,m=l.segmentEndIndex,p=l.axis;if(c)return c;var g=[d[f-1],u,h,d[m+1]];return f<2&&g.unshift(o(s.source,r)),m>d.length-3&&g.unshift(o(s.target,r)),l.snapPoints=c={horizontal:[],vertical:[]},k.forEach(g,function(y){y&&(y=y.original||y,p==="y"&&c.horizontal.push(y.y),p==="x"&&c.vertical.push(y.x))}),c}e.on("connectionSegment.move.move",1500,function(r){var l=a(r),c=r.x,s=r.y,d,u;if(l){d=t(l.vertical,c),u=t(l.horizontal,s);var f=c-d,h=s-u;k.assign(r,{dx:r.dx-f,dy:r.dy-h,x:d,y:u}),(f||l.vertical.indexOf(c)!==-1)&&wt(r,"x",d),(h||l.horizontal.indexOf(s)!==-1)&&wt(r,"y",u)}});function i(r){var l=r.snapPoints,c=r.connection.waypoints,s=r.bendpointIndex;if(l)return l;var d=[c[s-1],c[s+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,c=l.hover,s=c&&o(c,r);!Ze(c)||!s||!s.x||!s.y||(wt(r,"x",s.x),wt(r,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,c=i(l),s=l.hover,d=s&&o(s,r),u=r.x,f=r.y,h,m;if(c){h=t(d?c.vertical.concat([d.x]):c.vertical,u),m=t(d?c.horizontal.concat([d.y]):c.horizontal,f);var p=u-h,g=f-m;k.assign(r,{dx:r.dx-p,dy:r.dy-g,x:r.x-p,y:r.y-g}),(p||c.vertical.indexOf(u)!==-1)&&wt(r,"x",h),(g||c.horizontal.indexOf(f)!==-1)&&wt(r,"y",m)}})}$s.$inject=["eventBus"];const Vg={__depends__:[qt,En],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",ys],bendpointMove:["type",ui],bendpointMovePreview:["type",Es],connectionSegmentMove:["type",Vs],bendpointSnapping:["type",$s]};var Pg="djs-dragger";function Ct(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Ct.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ct.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=o.source,l=o.target,c=o.waypoints,s=o.connectionStart,d=o.connectionEnd,u=o.noLayout,f=o.noCropping,h=o.noNoop,m,p=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),M.clear(a),i||(i=e.getConnection=Mg(function(g,y,x){return p.getConnection(g,y,x)})),t&&(m=i(t,r,l)),!m){!h&&this.drawNoopPreview(a,o);return}m.waypoints=c||[],this._layouter&&!u&&(m.waypoints=this._layouter.layoutConnection(m,{source:r,target:l,connectionStart:s,connectionEnd:d,waypoints:o.waypoints||m.waypoints})),(!m.waypoints||!m.waypoints.length)&&(m.waypoints=[r?Te(r):s,l?Te(l):d]),this._connectionDocking&&(r||l)&&!f&&(m.waypoints=this._connectionDocking.getCroppedWaypoints(m,r,l)),this._graphicsFactory.drawConnection(a,m,{stroke:"var(--element-dragger-color)"})},Ct.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,i=t.connectionStart||Te(o),r=t.connectionEnd||Te(a),l=this.cropWaypoints(i,r,o,a),c=this.createNoopConnection(l[0],l[1]);M.append(e,c)},Ct.prototype.cropWaypoints=function(e,t,o,a){var i=this._graphicsFactory,r=o&&i.getShapePath(o),l=a&&i.getShapePath(a),c=i.getConnectionPath({waypoints:[e,t]});return e=o&&Oa(r,c,!0)||e,t=a&&Oa(l,c,!1)||t,[e,t]},Ct.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&M.remove(e.connectionPreviewGfx)},Ct.prototype.getConnection=function(e){var t=Ng(e);return this._elementFactory.createConnection(t)},Ct.prototype.createConnectionPreviewGfx=function(){var e=M.create("g");return M.attr(e,{pointerEvents:"none"}),M.classes(e).add(Pg),M.append(this._canvas.getActiveLayer(),e),e},Ct.prototype.createNoopConnection=function(e,t){return Ea([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Mg(e){var t={};return function(o){var a=JSON.stringify(o),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function Ng(e){return k.isObject(e)?e:{}}const $g={__init__:["connectionPreview"],connectionPreview:["type",Ct]};var Og=new wo("ov"),Rg=500;function Fe(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Og,this._overlayDefaults=k.assign({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Ag(o.getContainer()),this._init()}Fe.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Fe.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},Fe.prototype.add=function(e,t,o){if(k.isObject(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=k.assign({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},Fe.prototype.remove=function(e){var t=this.get(e)||[];k.isArray(t)||(t=[t]);var o=this;k.forEach(t,function(a){var i=o._getOverlayContainer(a.element,!0);if(a&&(A.remove(a.html),A.remove(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},Fe.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Fe.prototype.show=function(){Jo(this._overlayRoot)},Fe.prototype.hide=function(){Jo(this._overlayRoot,!1)},Fe.prototype.clear=function(){this._overlays={},this._overlayContainers=[],A.clear(this._overlayRoot)},Fe.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,i=t.y;if(t.waypoints){var r=dt(t);a=r.x,i=r.y}Os(o,a,i),A.attr(e.html,"data-container-id",t.id)},Fe.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=dt(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var c;a.waypoints?c=dt(a).height:c=a.height,r=t.bottom*-1+c}Os(o,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Fe.prototype._createOverlayContainer=function(e){var t=A.domify('<div class="djs-overlays" />');A.assignStyle(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},Fe.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Rs(this._overlayRoot,o)},Fe.prototype._getOverlayContainer=function(e,t){var o=k.find(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},Fe.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),k.isString(a)&&(a=A.domify(a)),r=this._getOverlayContainer(o),i=A.domify('<div class="djs-overlay" data-overlay-id="'+t+'">'),A.assignStyle(i,{position:"absolute"}),i.appendChild(a),e.type&&A.classes(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(o),c=this._canvas.getRootElement();Jo(i,l===c),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Fe.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),i=o&&o.minZoom,r=o&&o.maxZoom,l=e.htmlContainer,c=this._canvas.getRootElement(),s=!0;(a!==c||o&&(k.isDefined(i)&&i>t.scale||k.isDefined(r)&&r<t.scale))&&(s=!1),Jo(l,s),this._updateOverlayScale(e,t)},Fe.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,i,r=e.htmlContainer,l,c="";o!==!0&&(o===!1?(a=1,i=1):(a=o.min,i=o.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)&&(c="scale("+l+","+l+")"),Rs(r,c)},Fe.prototype._updateOverlaysVisibilty=function(e){var t=this;k.forEach(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},Fe.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element,r=t.get({element:i});k.forEach(r,function(s){t.remove(s.id)});var l=t._getOverlayContainer(i);if(l){A.remove(l.html);var c=t._overlayContainers.indexOf(l);c!==-1&&t._overlayContainers.splice(c,1)}}),e.on("element.changed",Rg,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&&A.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 Ag(e){var t=A.domify('<div class="djs-overlay-container" />');return A.assignStyle(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Os(e,t,o){A.assignStyle(e,{left:t+"px",top:o+"px"})}function Jo(e,t){e.style.display=t===!1?"none":""}function Rs(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}const Lg={__init__:["overlays"],overlays:["type",Fe]},Ig=new wo;function Vn(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Vn.$inject=["eventBus"],Vn.prototype.schedule=function(e,t=Ig.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},Vn.prototype._schedule=function(e,t){const o=zg();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(i){o.reject(i)}}catch(i){console.error("Scheduler#_schedule execution failed",i)}}),promise:o.promise}},Vn.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Vn.prototype._cancel=function(e){clearTimeout(e.executionId)};function zg(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}const Fg={scheduler:["type",Vn]};var Hg="djs-element-hidden",Ko=".entry",Wg=1e3,As=8,Ug=300;function Ne(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}Ne.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ne.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var i=a.target,r=k.isArray(i)?i:[i],l=r.filter(function(s){return o.includes(s)});if(l.length){e.close();var c=r.filter(function(s){return e._elementRegistry.get(s.id)});c.length&&e._updateAndOpen(c.length>1?c:c[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current,i=k.isArray(a.target)?a.target:[a.target];i.includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},Ne.prototype._createContainer=function(){var e=A.domify('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ne.prototype.registerProvider=function(e,t){t||(t=e,e=Wg),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},Ne.prototype.getEntries=function(e){var t=this._getProviders(),o=k.isArray(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return k.forEach(t,function(i){if(k.isFunction(i[o])){var r=i[o](e);k.isFunction(r)?a=r(a):k.forEach(r,function(l,c){a[c]=l})}}),a},Ne.prototype.trigger=function(e,t,o){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=A.attr(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,o)},Ug);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,o)},Ne.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var i=this._current.target,r=this._current.entries,l=r[e];if(l){var c=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:o})!==!1){if(k.isFunction(c)){if(t==="click")return c(o,i,a)}else if(c[t])return c[t](o,i,a);o.preventDefault()}}}},Ne.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ne.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ne.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;k.forEach(t,function(i,r){var l=i.group||"default",c=A.domify(i.html||'<div class="entry" draggable="true"></div>'),s;A.attr(c,"data-action",r),s=A.query("[data-group="+di(l)+"]",o),s||(s=A.domify('<div class="group"></div>'),A.attr(s,"data-group",l),o.appendChild(s)),s.appendChild(c),i.className&&Dg(c,i.className),i.title&&A.attr(c,"title",i.title),i.imageUrl&&(a=A.domify("<img>"),A.attr(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",c.appendChild(a))}),A.classes(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ne.prototype._createHtml=function(e){var t=this,o=A.domify('<div class="djs-context-pad"></div>');return A.delegate.bind(o,Ko,"click",function(a){t.trigger("click",a)}),A.delegate.bind(o,Ko,"dragstart",function(a){t.trigger("dragstart",a)}),A.delegate.bind(o,Ko,"mouseover",function(a){t.trigger("mouseover",a)}),A.delegate.bind(o,Ko,"mouseout",function(a){t.trigger("mouseout",a)}),A.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},Ne.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()&&Kg(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ne.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ne.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return k.isArray(e)!==k.isArray(o)?!1:k.isArray(e)?e.length===o.length&&k.every(e,function(a){return o.includes(a)}):o===e},Ne.prototype.isShown=function(){return this.isOpen()&&A.classes(this._current.html).has("open")},Ne.prototype.show=function(){this.isOpen()&&(A.classes(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ne.prototype.hide=function(){this.isOpen()&&(A.classes(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ne.prototype._getPosition=function(e){if(!k.isArray(e)&&Ze(e)){var t=this._canvas.viewbox(),o=Jg(e),a=o.x*t.scale-t.x*t.scale,i=o.y*t.scale-t.y*t.scale;return{left:a+As*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer(),l=r.getBoundingClientRect(),c=this._getTargetBounds(e);return{left:c.right-l.left+As*this._canvas.zoom(),top:c.top-l.top}},Ne.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ne.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target,a=k.isArray(o)?o:[o],i=a.some(function(r){return t._canvas.hasMarker(r,Hg)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ne.prototype._getTargetBounds=function(e){var t=this,o=k.isArray(e)?e:[e],a=o.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 Dg(e,t){var o=A.classes(e);t=k.isArray(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function Jg(e){return e.waypoints[e.waypoints.length-1]}function Kg(e,t){return e=k.isArray(e)?e:[e],t=k.isArray(t)?t:[t],e.length===t.length&&k.every(e,function(o){return t.includes(o)})}const qg={__depends__:[Sa,Fg,Lg],contextPad:["type",Ne]};var Yg=250;function on(e){this._eventBus=e,this._tools=[],this._active=null}on.$inject=["eventBus"],on.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},on.prototype.isActive=function(e){return e&&this._active===e},on.prototype.length=function(e){return this._tools.length},on.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},on.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.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")}),o.on(a,Yg,function(i){this._active&&(Gg(i)||this.setActive(null))},this)};function Gg(e){var t=e.originalEvent&&e.originalEvent.target;return t&&A.closest(t,'.group[data-group="tools"]')}const hi={__depends__:[qt],__init__:["toolManager"],toolManager:["type",on]};function mi(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){var i=t._svg=a.svg;i.addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}mi.$inject=["eventBus"],mi.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Xg(0,0)};function Xg(e,t){var o=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),o}const gi={__init__:["mouse"],mouse:["type",mi]};var yi=1500,Ls="grab";function Pn(e,t,o,a,i,r){this._dragging=o,this._mouse=r;var l=this,c=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",yi,function(s){if(wl(s))return l.activateMove(s.originalEvent,!0),!1}),c&&c.addListener(yi,function(s){if(!(!Is(s.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),c&&c.addListener(yi,function(s){!Is(s.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(s){var d=s.originalEvent.target;if(!s.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(s.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(s){var d=t.viewbox().scale;t.scroll({dx:s.dx*d,dy:s.dy*d})}),e.on("hand.move.end",function(s){var d=s.context,u=d.reactivate;return!wl(s)&&u&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}Pn.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Pn.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ls,data:{context:o||{}}})},Pn.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ls,data:{context:{reactivate:o}}})},Pn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Pn.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Is(e){return Nl("Space",e)}const Zg={__depends__:[hi,gi],__init__:["handTool"],handTool:["type",Pn]};var zs="crosshair";function an(e,t,o,a,i,r,l){this._selection=i,this._dragging=o,this._mouse=l;var c=this,s={create:function(d){var u=t.getActiveLayer(),f;f=d.frame=M.create("rect"),M.attr(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),M.append(u,f)},update:function(d){var u=d.frame,f=d.bbox;M.attr(u,{x:f.x,y:f.y,width:f.width,height:f.height})},remove:function(d){d.frame&&M.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(){c.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,f=vi(d),h=a.filter(function(p){return p}),m=wa(d);c.select(h,f,m?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=vi(d),s.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=vi(d),s.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;s.remove(u)}),e.on("element.mousedown",1500,function(d){if(wa(d))return c.activateLasso(d.originalEvent),!0})}an.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],an.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:zs,data:{context:{}}})},an.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:zs,data:{context:{}},keepSelection:!0})},an.prototype.select=function(e,t,o=[]){var a=Zp(e,t);this._selection.select([...o,...k.values(a)])},an.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},an.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function vi(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}const Qg={__depends__:[hi,gi],__init__:["lassoTool"],lassoTool:["type",an]};var Fs="connect-ok",Hs="connect-not-ok";function Mn(e,t,o,a,i,r,l){var c=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(s){var d=s.context,u=s.hover,f=d.canStartConnect=c.canStartConnect(u);f!==null&&(d.startTarget=u,a.addMarker(u,f?Fs:Hs))}),e.on(["global-connect.out","global-connect.cleanup"],function(s){var d=s.context.startTarget,u=s.context.canStartConnect;d&&a.removeMarker(d,u?Fs:Hs)}),e.on(["global-connect.ended"],function(s){var d=s.context,u=d.startTarget,f={x:s.x,y:s.y},h=c.canStartConnect(u);if(h)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,u,f)}),!1})}Mn.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Mn.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Mn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Mn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Mn.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const ey={__depends__:[Aa,En,qt,hi,gi],globalConnect:["type",Mn]};var ty=500,ny=1e3;function rn(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=M.create("rect");return M.attr(l,k.assign({x:0,y:0,rx:4,width:100,height:100},o)),l}e.on(["shape.added","shape.changed"],ty,function(r){var l=r.element,c=r.gfx,s=A.query(".djs-outline",c);s||(s=a.getOutline(l)||i(),M.append(c,s)),a.updateShapeOutline(s,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,c=r.gfx,s=A.query(".djs-outline",c);s||(s=i(),M.append(c,s)),a.updateConnectionOutline(s,l)})}rn.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&k.forEach(a,function(i){o=o||i.updateOutline(t,e)}),o||M.attr(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},rn.prototype.updateConnectionOutline=function(e,t){var o=dt(t);M.attr(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},rn.prototype.registerProvider=function(e,t){t||(t=e,e=ny),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},rn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},rn.prototype.getOutline=function(e){var t,o=this._getProviders();return k.forEach(o,function(a){k.isFunction(a.getOutline)&&(t=t||a.getOutline(e))}),t},rn.$inject=["eventBus","styles","elementRegistry"];var qo=6;function bi(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(i){o.isSelected(i.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}bi.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");M.clear(t);var o=e.length>1,a=this._canvas.getContainer();if(M.classes(a)[o?"add":"remove"]("djs-multi-select"),!!o){var i=oy(dt(e)),r=M.create("rect");M.attr(r,k.assign({rx:3},i)),M.classes(r).add("djs-selection-outline"),M.append(t,r)}},bi.$inject=["eventBus","canvas","selection"];function oy(e){return{x:e.x-qo,y:e.y-qo,width:e.width+qo*2,height:e.height+qo*2}}const Ws={__depends__:[wn],__init__:["outline","multiSelectionOutline"],outline:["type",rn],multiSelectionOutline:["type",bi]};var ay=500,iy=1250,ry=1500,Yo=Math.round;function ly(e){return{x:e.x+Yo(e.width/2),y:e.y+Yo(e.height/2)}}function Us(e,t,o,a,i){function r(c,s,d,u){return i.allowed("elements.move",{shapes:c,delta:s,position:d,target:u})}e.on("shape.move.start",ry,function(c){var s=c.context,d=c.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=cy(u),k.assign(s,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",iy,function(c){var s=c.context,d=s.validatedShapes,u;if(u=s.canExecute=r(d),!u)return!1}),e.on("shape.move.move",ay,function(c){var s=c.context,d=s.validatedShapes,u=c.hover,f={x:c.dx,y:c.dy},h={x:c.x,y:c.y},m;if(m=r(d,f,h,u),s.delta=f,s.canExecute=m,m===null){s.target=null;return}s.target=u}),e.on("shape.move.end",function(c){var s=c.context,d=s.delta,u=s.canExecute,f=u==="attach",h=s.shapes;if(u===!1)return!1;d.x=Yo(d.x),d.y=Yo(d.y),!(d.x===0&&d.y===0)&&o.moveElements(h,d,s.target,{primaryShape:s.shape,attach:f})}),e.on("element.mousedown",function(c){if(Et(c)){var s=vn(c);if(!s)throw new Error("must supply DOM mousedown event");return l(s,c.element)}});function l(c,s,d,u){if(k.isObject(d)&&(u=d,d=!1),!(s.waypoints||!s.parent)&&!M.classes(c.target).has("djs-hit-no-move")){var f=ly(s);return t.init(c,f,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:s,context:u||{}}}),!0}}this.start=l}Us.$inject=["eventBus","dragging","modeling","selection","rules"];function cy(e){var t=k.groupBy(e,"id");return k.filter(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Ds=499,xi="djs-dragging",Js="drop-ok",Ks="drop-not-ok",qs="new-parent",Ys="attach-ok";function Gs(e,t,o,a){function i(s){var d=r(s),u=sy(d);return u}function r(s){var d=Gp(s),u=d.flatMap(m=>(m.incoming||[]).concat(m.outgoing||[])),f=d.concat(u),h=[...new Set(f)];return h}function l(s,d){[Ys,Js,Ks,qs].forEach(function(u){u===d?t.addMarker(s,u):t.removeMarker(s,u)})}function c(s,d,u){a.addDragger(d,s.dragGroup),u&&t.addMarker(d,xi),s.allDraggedElements?s.allDraggedElements.push(d):s.allDraggedElements=[d]}e.on("shape.move.start",Ds,function(s){var d=s.context,u=d.shapes,f=d.allDraggedElements,h=i(u);if(!d.dragGroup){var m=M.create("g");M.attr(m,o.cls("djs-drag-group",["no-events"]));var p=t.getActiveLayer();M.append(p,m),d.dragGroup=m}h.forEach(function(g){a.addDragger(g,d.dragGroup)}),f?f=k.flatten([f,r(u)]):f=r(u),k.forEach(f,function(g){t.addMarker(g,xi)}),d.allDraggedElements=f,d.differentParents=dy(u)}),e.on("shape.move.move",Ds,function(s){var d=s.context,u=d.dragGroup,f=d.target,h=d.shape.parent,m=d.canExecute;f&&(m==="attach"?l(f,Ys):d.canExecute&&h&&f.id!==h.id?l(f,qs):l(f,d.canExecute?Js:Ks)),ut(u,s.dx,s.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(s){var d=s.context,u=d.target;u&&l(u,null)}),e.on("shape.move.cleanup",function(s){var d=s.context,u=d.allDraggedElements,f=d.dragGroup;k.forEach(u,function(h){t.removeMarker(h,xi)}),f&&M.remove(f)}),this.makeDraggable=c}Gs.$inject=["eventBus","canvas","styles","previewSupport"];function sy(e){var t=k.filter(e,function(o){return Ze(o)?k.find(e,k.matchPattern({id:o.source.id}))&&k.find(e,k.matchPattern({id:o.target.id})):!0});return t}function dy(e){return k.size(k.groupBy(e,function(t){return t.parent&&t.parent.id}))!==1}const uy={__depends__:[Sa,wn,Ws,En,qt,ja],__init__:["move","movePreview"],move:["type",Us],movePreview:["type",Gs]};var Xs=".djs-palette-toggle",Zs=".entry",fy=Xs+", "+Zs,wi="djs-palette-",py="shown",Ci="open",Qs="two-column",hy=1e3;function $e(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var i=a.tool;o.updateToolHighlight(i)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}$e.$inject=["eventBus","canvas"],$e.prototype.registerProvider=function(e,t){t||(t=e,e=hy),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},$e.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(gy,{})},$e.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},$e.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=A.domify($e.HTML_MARKUP);o.appendChild(a),A.classes(o).add(wi+py),A.delegate.bind(a,fy,"click",function(i){var r=i.delegateTarget;if(A.matches(r,Xs))return e.toggle();e.trigger("click",i)}),A.event.bind(a,"mousedown",function(i){i.stopPropagation()}),A.delegate.bind(a,Zs,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},$e.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},$e.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,i,r=A.classes(o),l=A.classes(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Qs,i),l.toggle(wi+Qs,i),"open"in e&&(r.toggle(Ci,e.open),l.toggle(wi+Ci,e.open)),a.fire("palette.changed",{twoColumn:i,open:this.isOpen()})},$e.prototype._update=function(){var e=A.query(".djs-palette-entries",this._container),t=this._entries=this.getEntries();A.clear(e),k.forEach(t,function(o,a){var i=o.group||"default",r=A.query("[data-group="+di(i)+"]",e);r||(r=A.domify('<div class="group"></div>'),A.attr(r,"data-group",i),e.appendChild(r));var l=o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),c=A.domify(l);if(r.appendChild(c),!o.separator&&(A.attr(c,"data-action",a),o.title&&A.attr(c,"title",o.title),o.className&&my(c,o.className),o.imageUrl)){var s=A.domify("<img>");A.attr(s,"src",o.imageUrl),c.appendChild(s)}}),this.open()},$e.prototype.trigger=function(e,t,o){var a,i,r=t.delegateTarget||t.target;return r?(a=A.attr(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,o)):t.preventDefault()},$e.prototype.triggerEntry=function(e,t,o,a){var i=this._entries,r,l;if(r=i[e],!!r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if(k.isFunction(l)){if(t==="click")return l(o,a)}else if(l[t])return l[t](o,a);o.preventDefault()}},$e.prototype._layoutChanged=function(){this._toggleState({})},$e.prototype._needsCollapse=function(e,t){var o=50,a=Object.keys(t).length*46;return e<a+o},$e.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},$e.prototype.open=function(){this._toggleState({open:!0})},$e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$e.prototype.isActiveTool=function(e){return e&&this._activeTool===e},$e.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=A.query(".djs-palette-entries",this._container),this._toolsContainer=A.query("[data-group=tools]",t)),o=this._toolsContainer,k.forEach(o.children,function(a){var i=a.getAttribute("data-action");if(i){var r=A.classes(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},$e.prototype.isOpen=function(){return A.classes(this._container).has(Ci)},$e.prototype._getParentContainer=function(){return this._canvas.getContainer()},$e.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function my(e,t){var o=A.classes(e),a=k.isArray(t)?t:t.split(/\s+/g);a.forEach(function(i){o.add(i)})}function gy(e,t){var o=t.getPaletteEntries();return k.isFunction(o)?o(e):(k.forEach(o,function(a,i){e[i]=a}),e)}const yy={__init__:["palette"],palette:["type",$e]};function ed(e,t,o,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=o.getGraphics(r)),i.gfx&&e.fire(Qp(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)})}ed.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const vy={__init__:["changeSupport"],changeSupport:["type",ed]};var Go=Math.max,Xo=Math.min,by=20;function xy(e,t,o){var a=o.x,i=o.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 Zo(e,t,o){var a=t[e],i=o.min&&o.min[e],r=o.max&&o.max[e];return k.isNumber(i)&&(a=(/top|left/.test(e)?Xo:Go)(a,i)),k.isNumber(r)&&(a=(/top|left/.test(e)?Go:Xo)(a,r)),a}function wy(e,t){if(!t)return e;var o=be(e);return rc({top:Zo("top",o,t),right:Zo("right",o,t),bottom:Zo("bottom",o,t),left:Zo("left",o,t)})}function Cy(e,t,o,a){var i=be(t),r={top:/n/.test(e)?i.bottom-o.height:i.top,left:/w/.test(e)?i.right-o.width:i.left,bottom:/s/.test(e)?i.top+o.height:i.bottom,right:/e/.test(e)?i.left+o.width:i.right},l=a?be(a):r,c={top:Xo(r.top,l.top),left:Xo(r.left,l.left),bottom:Go(r.bottom,l.bottom),right:Go(r.right,l.right)};return rc(c)}function no(e,t){return typeof e<"u"?e:by}function ky(e,t){var o,a,i,r;return typeof t=="object"?(o=no(t.left),a=no(t.right),i=no(t.top),r=no(t.bottom)):o=a=i=r=no(t),{x:e.x-o,y:e.y-i,width:e.width+o+a,height:e.height+i+r}}function Ey(e){return!(e.waypoints||e.type==="label")}function Sy(e,t){var o;if(e.length===void 0?o=k.filter(e.children,Ey):o=e,o.length)return ky(dt(o),t)}var td=10;function oo(e,t,o,a){this._dragging=a,this._rules=t;var i=this;function r(s,d){var u=s.shape,f=s.direction,h=s.resizeConstraints,m;s.delta=d,m=xy(u,f,d),s.newBounds=wy(m,h),s.canExecute=i.canResize(s)}function l(s){var d=s.resizeConstraints,u=s.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(s)),s.resizeConstraints={min:be(u)})}function c(s){var d=s.shape,u=s.canExecute,f=s.newBounds;if(u){if(f=Eh(f),!_y(d,f))return;o.resizeShape(d,f)}}e.on("resize.start",function(s){l(s.context)}),e.on("resize.move",function(s){var d={x:s.dx,y:s.dy};r(s.context,d)}),e.on("resize.end",function(s){c(s.context)})}oo.prototype.canResize=function(e){var t=this._rules,o=k.pick(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},oo.prototype.activate=function(e,t,o){var a=this._dragging,i,r;if(typeof o=="string"&&(o={direction:o}),i=k.assign({shape:t},o),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,nd(t,r),"resize",{autoActivate:!0,cursor:By(r),data:{shape:t,context:i}})},oo.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction,a,i;return a=e.minDimensions||{width:td,height:td},i=Sy(t,e.childrenBoxPadding),Cy(o,t,a,i)},oo.$inject=["eventBus","rules","modeling","dragging"];function _y(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function nd(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.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 By(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 od="djs-resizing",ad="resize-not-ok",jy=500;function id(e,t,o){function a(r){var l=r.shape,c=r.newBounds,s=r.frame;s||(s=r.frame=o.addFrame(l,t.getActiveLayer()),t.addMarker(l,od)),c.width>5&&M.attr(s,{x:c.x,width:c.width}),c.height>5&&M.attr(s,{y:c.y,height:c.height}),r.canExecute?M.classes(s).remove(ad):M.classes(s).add(ad)}function i(r){var l=r.shape,c=r.frame;c&&M.remove(r.frame),t.removeMarker(l,od)}e.on("resize.move",jy,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}id.$inject=["eventBus","canvas","previewSupport"];var Qo=-6,ea=8,ta=20,ao="djs-resizer",Ty=["n","w","s","e","nw","ne","se","sw"];function It(e,t,o,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;o.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}It.prototype.makeDraggable=function(e,t,o){var a=this._resize;function i(r){Et(r)&&a.activate(r,e,o)}A.event.bind(t,"mousedown",i),A.event.bind(t,"touchstart",i)},It.prototype._createResizer=function(e,t,o,a){var i=this._getResizersParent(),r=Vy(a),l=M.create("g");M.classes(l).add(ao),M.classes(l).add(ao+"-"+e.id),M.classes(l).add(ao+"-"+a),M.append(i,l);var c=M.create("rect");M.attr(c,{x:-ea/2+r.x,y:-ea/2+r.y,width:ea,height:ea}),M.classes(c).add(ao+"-visual"),M.append(l,c);var s=M.create("rect");return M.attr(s,{x:-ta/2+r.x,y:-ta/2+r.y,width:ta,height:ta}),M.classes(s).add(ao+"-hit"),M.append(l,s),oh(l,t,o),l},It.prototype.createResizer=function(e,t){var o=nd(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},It.prototype.addResizer=function(e){var t=this;Ze(e)||!this._resize.canResize({shape:e})||k.forEach(Ty,function(o){t.createResizer(e,o)})},It.prototype.removeResizers=function(){var e=this._getResizersParent();M.clear(e)},It.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},It.$inject=["eventBus","canvas","selection","resize"];function Vy(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Qo:e.indexOf("w")!==-1&&(t.x=Qo),e.indexOf("s")!==-1?t.y=-Qo:e.indexOf("n")!==-1&&(t.y=Qo),t}const Py={__depends__:[En,qt,ja],__init__:["resize","resizePreview","resizeHandles"],resize:["type",oo],resizePreview:["type",id],resizeHandles:["type",It]};function io(e,t,o,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,o.registerProvider(this),e.on("element.dblclick",c=>{l(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{i.removeResizers()}),e.on("create.end",500,c=>{const{context:s,isTouch:d}=c,u=s.shape,{canExecute:f}=c.context;d||f&&(s.hints&&s.hints.createElementsBehavior===!1||l(u))}),e.on("autoPlace.end",500,c=>{l(c.shape)});function l(c,s){(s||Za(c,["userTask","scriptTask","subprocess"])||c.isDirectEdit)&&o.activate(c)}}io.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],io.prototype.activate=function(e){const t=Ro(e);if(t===void 0)return;const o={text:t},a=this.getEditingBBox(e);_e(o,a);const i={};return(Za(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&_e(i,{centerVertically:!0}),Qa(e)&&_e(i,{autoResize:!0}),_e(o,{options:i}),o},io.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),c=this._textRenderer.getDefaultStyle(),s=this._textRenderer.getExternalStyle(),d=s.fontSize*l,u=s.lineHeight,f=c.fontSize*l,h=c.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Za(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(_e(r,{width:a.width,height:a.height}),_e(m,{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,g=7*l,y=4*l;if(o.labelTarget&&(_e(r,{width:p,height:a.height+g+y,x:i.x-p/2,y:a.y-g}),_e(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})),Qa(o)&&!Wc(o)&&!Zn(o)){const x=Uc(e),b=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),w=d+g+y;_e(r,{width:p,height:w,x:b.x-p/2,y:b.y-w/2}),_e(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})}return{bounds:r,style:m}},io.prototype.update=function(e,t){let o;My(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function My(e){return!e||!e.trim()}const Ny={__depends__:[vy,Py,Ad],__init__:["labelEditingProvider"],labelEditingProvider:["type",io]};function zt(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}zt.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},zt.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},zt.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},zt.prototype.getSnapLocations=function(){return this._snapLocations},zt.prototype.setSnapLocations=function(e){this._snapLocations=e},zt.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new na,o.initDefaults(this._defaultSnaps)),o};function na(){this._snapValues={}}na.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},na.prototype.snap=function(e,t,o,a){var i=this._snapValues[t];return i&&_g(e[o],i[o],a)},na.prototype.initDefaults=function(e){var t=this;k.forEach(e||{},function(o,a){k.forEach(o,function(i){t.add(a,i)})})};var $y=1250;function mt(e,t,o){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"],$y,function(i){var r=i.context,l=r.shape,c=r.snapContext,s=r.target;if(!(i.originalEvent&&Ml(i.originalEvent))&&!(Do(i)||!s)){var d=c.pointsForTarget(s);d.initialized||(d=a.addSnapTargetPoints(d,l,s),d.initialized=!0),o.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}mt.$inject=["elementRegistry","eventBus","snapping"],mt.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,i=o.snapContext;i||(i=o.snapContext=new zt);var r;t.get(a.id)?r=Tn(a,e):r={x:e.x+Tn(a).x,y:e.y+Tn(a).y};var l={x:r.x-a.width/2,y:r.y-a.height/2},c={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}),Sn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:c.x-e.x,y:c.y-e.y})),i},mt.prototype.addSnapTargetPoints=function(e,t,o){var a=this.getSnapTargets(t,o);return k.forEach(a,function(i){if(Sn(i)){Sn(t)&&e.add("mid",Tn(i));return}if(Ze(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",Tn(i))}),!k.isNumber(t.x)||!k.isNumber(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Tn(t)),e},mt.prototype.getSnapTargets=function(e,t){return Ms(t).filter(function(o){return!Oy(o)})};function Oy(e){return!!e.hidden}function Nn(e){e.invoke(mt,this)}Ht(Nn,mt),Nn.$inject=["injector"],Nn.prototype.initSnap=function(e){return mt.prototype.initSnap.call(this,e)},Nn.prototype.addSnapTargetPoints=function(e,t,o){return mt.prototype.addSnapTargetPoints.call(this,e,t,o)},Nn.prototype.getSnapTargets=function(e,t){return mt.prototype.getSnapTargets.call(this,e,t)};var Ry=1250;function ro(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],Ry,function(a){var i=a.context,r=i.shape,l=r.parent,c=i.direction,s=i.snapContext;if(!(a.originalEvent&&Ml(a.originalEvent))&&!Do(a)){var d=s.pointsForTarget(l);d.initialized||(d=o.addSnapTargetPoints(d,r,l,c),d.initialized=!0),Iy(c)&&wt(a,"x",a.x),zy(c)&&wt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}ro.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new zt);var r=rd(o,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},ro.prototype.addSnapTargetPoints=function(e,t,o,a){var i=this.getSnapTargets(t,o);return k.forEach(i,function(r){e.add("corner",jg(r)),e.add("corner",Bg(r))}),e.add("corner",rd(t,a)),e},ro.$inject=["eventBus","snapping"],ro.prototype.getSnapTargets=function(e,t){return Ms(t).filter(function(o){return!Ay(o,e)&&!Ze(o)&&!Ly(o)&&!Sn(o)})};function rd(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.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 Ay(e,t){return e.host===t}function Ly(e){return!!e.hidden}function Iy(e){return e==="n"||e==="s"}function zy(e){return e==="e"||e==="w"}var Fy=7,Hy=1e3;function Ft(e){this._canvas=e,this._asyncHide=k.debounce(k.bind(this.hide,this),Hy)}Ft.$inject=["canvas"],Ft.prototype.snap=function(e,t){var o=e.context,a=o.snapContext,i=a.getSnapLocations(),r={x:Do(e,"x"),y:Do(e,"y")};k.forEach(i,function(l){var c=a.getSnapOrigin(l),s={x:e.x+c.x,y:e.y+c.y};if(k.forEach(["x","y"],function(d){var u;r[d]||(u=t.snap(s,l,d,Fy),u!==void 0&&(r[d]={value:u,originValue:u-c[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 c=r[l];k.isObject(c)&&wt(e,l,c.originValue)})},Ft.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=M.create("path");return M.attr(o,{d:"M0,0 L0,0"}),M.classes(o).add("djs-snap-line"),M.append(t,o),{update:function(a){k.isNumber(a)?e==="horizontal"?M.attr(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):M.attr(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):M.attr(o,{display:"none"})}}},Ft.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ft.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Ft.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ft.prototype.hide=function(){k.forEach(this._snapLines,function(e){e.update()})};const Wy={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",mt],resizeSnapping:["type",ro],snapping:["type",Ft]}],__init__:["createMoveSnapping"],createMoveSnapping:["type",Nn]};function $n(e){Ke.call(this,e),this.init()}$n.$inject=["eventBus"],Yt($n,Ke),$n.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,c){return o(r)},!0)})},$n.prototype.init=function(){};function lo(e){$n.call(this,e)}lo.$inject=["eventBus"],Ht(lo,$n),lo.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},i=a.targetParent,r=a.targetAttach;if(r)return!1;i&&(o.parent=i);try{return ki(t,o)}finally{i&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){e.connection;var t=e.source,o=e.target;return ki(t,o)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return eh(t)})},lo.prototype.canConnect=ki;function ki(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}const Uy={__init__:["myRuleProvider"],myRuleProvider:["type",lo]};function Ei(e,t,o,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}Ei.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Ei.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(s,d,u,f,h){function m(p){const g=t.createShape(_e({type:s},h));e.start(p,g)}return{group:d,className:u,title:f,action:{dragstart:m,click:m}}}const c={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(s){o.activateHand(s)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(s){a.activateSelection(s)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(s){i.toggle(s)}}},"tool-separator":{group:"tools",separator:!0}};for(const s in r.palette){const d=r.palette[s];c[s]=l(d.type,d.group,d.className,d.title,d.options)}return c};const Dy={__init__:["paletteProvider"],paletteProvider:["type",Ei]};var ld=50,Jy=250;function Ky(e,t){t||(t={});function o(p){return p.source===e?1:-1}var a=t.defaultDistance||ld,i=t.direction||"e",r=t.filter,l=t.getWeight||o,c=t.maxDistance||Jy,s=t.reference||"start";r||(r=qy);function d(p,g){return i==="n"?s==="start"?be(p).top-be(g).bottom:s==="center"?be(p).top-Te(g).y:be(p).top-be(g).top:i==="w"?s==="start"?be(p).left-be(g).right:s==="center"?be(p).left-Te(g).x:be(p).left-be(g).left:i==="s"?s==="start"?be(g).top-be(p).bottom:s==="center"?Te(g).y-be(p).bottom:be(g).bottom-be(p).bottom:s==="start"?be(g).left-be(p).right:s==="center"?Te(g).x-be(p).right:be(g).right-be(p).right}var u=e.incoming.filter(r).map(function(p){var g=l(p),y=g<0?d(p.source,e):d(e,p.source);return{id:p.source.id,distance:y,weight:g}}),f=e.outgoing.filter(r).map(function(p){var g=l(p),y=g>0?d(e,p.target):d(p.target,e);return{id:p.target.id,distance:y,weight:g}}),h=u.concat(f).reduce(function(p,g){return p[g.id+"__weight_"+g.weight]=g,p},{}),m=k.reduce(h,function(p,g){var y=g.distance,x=g.weight;return y<0||y>c||(p[String(y)]||(p[String(y)]=0),p[String(y)]+=1*x,(!p.distance||p[p.distance]<p[String(y)])&&(p.distance=y)),p},{});return m.distance||a}function qy(){return!0}var Yy=100;function cd(e,t,o){e.on("autoPlace",Yy,function(a){var i=a.shape,r=a.source;return Gy(r,i)}),e.on("autoPlace.end",function(a){o.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}),c=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:c}),c}}cd.$inject=["eventBus","modeling","canvas"];function Gy(e,t,o){o||(o={});var a=o.defaultDistance||ld,i=Te(e),r=be(e);return{x:r.right+a+t.width/2,y:i.y}}function sd(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}sd.$inject=["eventBus","selection"];const Xy={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",cd],autoPlaceSelectionBehavior:["type",sd]},Zy=10,Qy=(e,t)=>e.type===t;function ev(e){return e.incoming.map(t=>t.source)}function tv(e){return e.outgoing.map(t=>t.target)}function Si(e){return tv(e).concat(ev(e))}function nv(e){let t=Si(e);return e.host&&(t=t.concat(Si(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(Si(a)),[]))),t.filter(o=>o.type!=="myline")}function ov(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height},i=nv(e);return k.find(i,r=>r===o?!1:Vt(r,a,Zy)==="intersect")}function av(e,t,o,a){let i;for(;i=ov(e,o,t);)o=a(t,o,i);return o}function iv(e){return function(t,o,a){const i={x:o.x,y:o.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const c=r==="x"?"width":"height",{margin:s,minDistance:d}=l;s<0?i[r]=Math.min(a[r]+s-t[c]/2,o[r]-d+s):i[r]=Math.max(a[r]+a[c]+s+t[c]/2,o[r]+d+s)}),i}}function rv(e,t){return lv(e,t)}function lv(e,t){const o=be(e),a=Te(e),i=Ky(e,{filter:u=>Qy(u,"myline")}),r=30,l=80,s={x:o.right+i+t.width/2,y:a.y+cv("left",l)};return av(e,t,s,iv({y:{margin:r,minDistance:l}}))}function cv(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function dd(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return rv(a,o)})}dd.$inject=["eventBus"];const sv={__depends__:[Xy],__init__:["myAutoPlace"],myAutoPlace:["type",dd]};function _i(e,t,o,a,i,r,l){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}_i.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],_i.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function c(){o.removeElements([e])}function s(f,h,m){t.start(f,h,m)}function d(f,h,m,p){typeof m!="string"&&(p=m);function g(x,b){const w=a.createShape(_e({type:f},p));r.start(x,w,{source:b})}function y(x,b){const w=a.createShape(_e({type:f},p));i.append(b,w)}return{group:"model",className:h,title:m,action:{dragstart:g,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:c,dragstart:c}}};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:s,dragstart:s}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:c,dragstart:c}},u};const dv={__init__:["ContextPadProvider"],ContextPadProvider:["type",_i]},uv=n.defineComponent({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let c,s=1;const d=()=>{s=1,c.get("canvas").zoom("fit-viewport")},u=()=>{const V=c.get("eventBus");V.on("element.dblclick",T=>{i("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{i("elementClick",T.element.businessObject)}),V.on("create.end",T=>{i("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{i("elementCreate",T.shape.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let V={__init__:["myOptions"],myOptions:["type",f]};c=new $i({canvas:{container:r.value},modules:[Vg,Aa,$g,qg,Jl,rg,Zg,Qg,ey,ns,fc,uy,Ws,yy,mc,V,sv,is,Ny,dv,Dy,Uy,Wy,ls]});const T=c.get("canvas"),L=c.get("elementFactory");d();const F=L.createRoot();T.setRootElement(F),u()};n.onMounted(()=>{h()});const m=V=>{const T=V==null?1:s+V;c.get("canvas").zoom(T),s=T},p=()=>{c.get("commandStack").redo()},g=()=>{c.get("commandStack").undo()},y=()=>{c.get("canvas").zoom(1);const V=c.get("elementRegistry").getAll();var T=cs(V);return T},x=V=>{c.clear(),d(),ss(V,c)},b=V=>{c.get("myImporter").update(V.id,V)};return t({reset:()=>{d()},zoom:V=>{m(V)},redo:()=>{p()},undo:()=>{g()},getData:()=>y(),setData:V=>{x(V)},updateElemet:V=>{b(V)}}),(V,T)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),ud=te(ag),fd=te(uv),fv=[uo,gr,yr,vr,br,xr,wr,Cr,kr,Er,Sr,Tr,Vr,Pr,Mr,va,mr,Nr,$r,Or,Ar,Ir,zr,Gr,Fr,Hr,Wr,Ur,Dr,Jr,Kr,qr,Yr,el,tl,nl,ol,al,il,rl,ll,cl,Xr,Zr,ba,sl,dl,ul,fl,pl,hl,ml,jp,ud,fd],pv={install:e=>{fv.forEach(t=>{e.component(t.name,t)})}};N.EncryptionFactory=tr,N.EventBus=ha,N.HashingFactory=Qd,N.INJECT_KEYS=Ie,N.JAutoComplete=Er,N.JBarcode=zr,N.JButton=uo,N.JButtonSelect=el,N.JButtons=gr,N.JCascaderSelect=wr,N.JCheckbox=Cr,N.JCodeMirror=Gr,N.JCollapse=hl,N.JComp=ol,N.JCount=Fr,N.JCountUp=Hr,N.JDataPanel=Wr,N.JDialog=Vr,N.JDialogFull=Pr,N.JDivider=Ur,N.JDrawer=Mr,N.JDynamicLayer=mr,N.JEcharts=Ir,N.JEditor=ml,N.JForm=al,N.JFormItem=il,N.JGuid=ll,N.JHpanel=Dr,N.JIcon=vr,N.JInput=yr,N.JInputButton=Jr,N.JInputCode=Kr,N.JInputColor=qr,N.JInputLayer=dl,N.JInputRows=sl,N.JInputTag=Nr,N.JLayer=va,N.JLayerForm=ul,N.JLayout=Sr,N.JMenu=Zr,N.JNumber=kr,N.JPage=rl,N.JPanel=cl,N.JRadio=br,N.JRate=$r,N.JSelect=xr,N.JSlider=Or,N.JSliderCaptcha=Xr,N.JSwitch=fl,N.JTable=Tr,N.JTablePanel=ba,N.JTabs=pl,N.JTitle=Yr,N.JTree=tl,N.JTreeSelect=nl,N.JUpload=Ar,N.JWorkflow=fd,N.JWorkflowViewer=ud,N.assign=_e,N.buildShortUUID=po,N.buildUUID=Ut,N.clearJson=An,N.clone=fo,N.deepClone=vt,N.default=pv,N.eventBus=tu,N.formatToDate=In,N.formatToDateTime=Gi,N.fullScreenLoading=un,N.getCompConfig=Dt,N.getCompType=pa,N.getFunction=ua,N.getIsInputComp=ho,N.getIsTableInputComp=qi,N.getLabel=Yi,N.getObjType=Ai,N.getTextWidth=dn,N.is=Ri,N.isArray=so,N.isNullOrEmpty=yt,N.isObject=Id,N.loadBMap=or,N.lowerFirst=Dd,N.myAesDecrypt=eu,N.numberToChinese=Ii,N.numberToThousandSeparator=zi,N.pagination=Hd,N.paginationEx=Wd,N.set=Li,N.setGroupMap=Hi,N.toArray=Ui,N.toDecimal=Ln,N.toLeafArray=Ki,N.toSimpleTree=Kd,N.toTree=Jd,N.uniqueArray=Ud,N.upFirst=Fi,N.useAppInject=ze,N.useAppProvide=nu,N.useAuthPageInject=sr,N.useAuthPageProvide=dr,N.useCompInject=ir,N.useCompProvide=ga,N.useFormInject=Jt,N.useFormProvide=ma,N.useHMenuInject=lr,N.useHMenuProvide=cr,N.useInject=ct,N.useLayer=yn,N.useLayerInject=ou,N.useLayerProvide=ur,N.useMenuInject=gn,N.useMenuProvide=rr,N.usePageInject=fr,N.usePageProvide=pr,N.useProvide=st,N.useSortable=nr,N.useTableInject=ar,N.useTableProvide=go,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
16
+ getCompValue)=>{ return ${j} }`;let _;const B=ua(j);if(B.res)try{_=B.fn(a,i,r,l,c,s,d,u,f,h,m,p,g,y,w)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(B.msg),"";return Number.isNaN(_)?"":(o.decimal!==void 0&&(_=_.toFixed(o.decimal)),_)}),S=n.computed(()=>{let v=C.value;return o.thousandSeparator&&(v=zi(v)),o.isChinese&&(v=Ii(v)),v});return n.watch(C,v=>{x("update:modelValue",v),x("change",{value:v,data:S.value})}),(v,j)=>{const _=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(_,{modelValue:S.value,"onUpdate:modelValue":j[0]||(j[0]=B=>S.value=B),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),sf={key:0},Hr=te(n.defineComponent({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=n.computed(()=>({...o})),i=n.ref(),r=n.ref(null),l=n.computed(()=>o.options);n.onMounted(()=>{o.animation&&c()}),n.watch(()=>o.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=o.decimals,r.value.reset(),r.value.update(o.endValue))},{deep:!0}),n.watch(()=>o.endValue,h=>{r.value&&r.value.update&&r.value.update(h)});const c=()=>{r.value||(l.value.startVal=o.startValue,l.value.decimalPlaces=o.decimals,l.value.duration=o.duration,r.value=new Sd.CountUp(i.value,Number(o.endValue),l.value),r.value.start(()=>{o.callback?.(r.value)}))};return n.onUnmounted(()=>{r.value=null}),n.onBeforeUnmount(()=>{r.value=null}),t({myProps:a,el:i,init:c,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,m)=>(n.openBlock(),n.createElementBlock("span",{ref_key:"el",ref:i},[e.animation?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("span",sf,n.toDisplayString(e.endValue),1))],512))}})),df={class:"j-block j-data-panel"},uf={key:0,class:"j-data-panel-header"},ff={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},pf={class:"j-data-panel-header-right"},hf={class:"j-data-panel-body"},Wr=te(n.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",df,[e.title?(n.openBlock(),n.createElementBlock("div",uf,[n.createElementVNode("div",ff,n.toDisplayString(e.title),1),n.createElementVNode("div",pf,[n.renderSlot(t.$slots,"titleRight")])])):n.createCommentVNode("",!0),n.createElementVNode("div",hf,[n.renderSlot(t.$slots,"default")])]))}})),mf={class:"j-divider-content"},Ur=te(n.defineComponent({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=n.computed(()=>{const i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=n.computed(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(`j-divider-container j-divider-${e.contentPosition}`),style:n.normalizeStyle(o.value)},[n.createElementVNode("div",{class:"j-divider-line j-divider-line-left",style:n.normalizeStyle(a.value)},null,4),n.createElementVNode("div",mf,[n.createElementVNode("span",null,n.toDisplayString(e.content||""),1)]),n.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:n.normalizeStyle(a.value)},null,4)],6))}})),gf={class:"j-hpanel"},yf={class:"j-hpanel-main"},Dr=te(n.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",gf,[n.renderSlot(t.$slots,"left"),n.createElementVNode("div",yf,[n.renderSlot(t.$slots,"default")]),n.renderSlot(t.$slots,"right")]))}})),Jr=te(n.defineComponent({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.ref(),r=n.ref(),l=async(u,f)=>{o.ok&&(u("保存数据中..."),r.value=await o.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),f(),i.value.close())},c=()=>o.beforeClose?o.beforeClose(r.value):!0,s=()=>{o.closed?.()},d=()=>{i.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(r.value)},200)};return n.watch(()=>o.modelValue,u=>{r.value=u},{immediate:!0}),(u,f)=>{const h=n.resolveComponent("j-button"),m=n.resolveComponent("j-layer");return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(h,n.mergeProps({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),n.createVNode(m,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":c,onOk:l,onClosed:s},{default:n.withCtx(()=>[n.renderSlot(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Kr=te(n.defineComponent({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.computed({get:()=>o.modelValue,set:f=>{a("update:modelValue",f)}}),r=n.ref(""),l=f=>{r.value=f},c=()=>r.value,s=f=>o.beforeClose?o.beforeClose(f):!0,d=f=>{a("change",f)},u=n.computed(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(f,h)=>{const m=n.resolveComponent("j-code-mirror"),p=n.resolveComponent("j-layout"),g=n.resolveComponent("j-input-button");return n.openBlock(),n.createBlock(g,{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":s,ok:c,open:l,onChange:d},{default:n.withCtx(()=>[n.createVNode(p,{"right-move":!1,right:560},n.createSlots({default:n.withCtx(()=>[n.createVNode(m,{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:n.withCtx(()=>[n.createVNode(m,{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"])}}})),qr=te(n.defineComponent({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l=n.ref(),c=n.computed({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(g){l.value=g,i("update:modelValue",g),i("input",g)}}),s=g=>{i("input",g)},d=g=>{i("focus",g)},u=g=>{i("blur",g)},f=()=>{i("clear"),i("update:modelValue","")},h=g=>{i("change",g)},m=g=>{i("color-change",g)},p=g=>{i("active-change",g)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(g,y)=>{const x=n.resolveComponent("el-color-picker"),b=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[n.createVNode(b,n.mergeProps({ref_key:"inputRef",ref:r,modelValue:c.value,"onUpdate:modelValue":y[1]||(y[1]=w=>c.value=w),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},g.$attrs,{onInput:s,onFocus:d,onBlur:u,onClear:f,onChange:h}),{[e.inputType]:n.withCtx(()=>[n.createVNode(x,{modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=w=>c.value=w),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:m,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)}}})),Yr=te(n.defineComponent({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"}},setup(e){const t=e,o=n.computed(()=>t.class||""),a=n.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)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-title",o.value]),style:n.normalizeStyle(a.value)},n.toDisplayString(e.title),7))}})),Gr=te(n.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:o}){const a=e,i=o,r=n.ref(),l=n.ref("");let c=null;const s=g=>{switch(g){case"application/javascript":case"javascript":case"text/javascript":return cn.javascript();case"css":case"text/css":return jd.css();case"html":case"text/html":return Td.html();case"json":case"application/json":return Vd.json();case"sql":case"text/x-sql":return Pd.sql();case"xml":case"text/xml":return Md.xml();case"python":case"text/x-python":return Nd.python();case"markdown":case"text/markdown":return $d.markdown();case"java":case"text/x-java":return Od.java();case"vue":case"text/x-vue":return cn.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return cn.javascript({jsx:!1,typescript:!0});case"jsx":return cn.javascript({jsx:!0,typescript:!1});case"tsx":return cn.javascript({jsx:!0,typescript:!0});default:return cn.javascript()}},d=()=>{const g=[Bd.basicSetup,lt.lineNumbers(),lt.highlightActiveLineGutter(),lt.highlightSpecialChars(),la.history(),lt.drawSelection(),lt.dropCursor(),sn.indentOnInput(),sn.bracketMatching(),ra.closeBrackets(),lt.rectangularSelection(),sn.foldGutter(),lt.keymap.of([...ra.closeBracketsKeymap,...la.defaultKeymap,...la.historyKeymap,...sn.foldKeymap]),sn.syntaxHighlighting(sn.defaultHighlightStyle)];return g.push(s(a.mode)),a.readonly&&g.push(ia.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&g.push(ra.autocompletion({override:[y=>{const x=y.matchBefore(/\w*/);if(!x||x.from===x.to)return null;const b=a.handleHint(x.text);return b.length===0?null:{from:x.from,options:b.map(w=>({label:typeof w=="string"?w:w.label||w.name||"",detail:typeof w=="string"?"":w.detail||"",type:typeof w=="string"?"variable":w.type||"variable",apply:typeof w=="string"?w:w.apply||w.name||w.label||""}))}}]})),g.push(lt.EditorView.updateListener.of(y=>{if(y.docChanged){const x=y.state.doc.toString();l.value=x,i("update:value",x),i("change",{value:x})}})),g},u=async()=>{if(!r.value)return;const g=ia.EditorState.create({doc:a.value,extensions:d()});c=new lt.EditorView({state:g,parent:r.value}),l.value=a.value},f=()=>{if(!c)return;const g=c.state.doc.toString();c&&c.destroy();const y=ia.EditorState.create({doc:g,extensions:d()});r.value&&(c=new lt.EditorView({state:y,parent:r.value}));const x=c.state.doc.toString();x!==a.value&&c.dispatch({changes:{from:0,to:x.length,insert:a.value}})},h=()=>{if(!c)return;const g=c.state.doc.length;c.dispatch({selection:{anchor:g,head:g},scrollIntoView:!0}),setTimeout(()=>{if(c){const y=c.state.doc.length;c.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},m=()=>{let g=_d.format(a.value);g=g.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",g),i("change",{value:g})};let p=null;return n.watch(()=>a.value,g=>{g!==l.value&&(l.value=g,c&&f(),setTimeout(()=>{c&&a.isScrollToBottom&&h()}))}),n.watch(()=>a.mode,()=>{c&&f()}),n.onMounted(async()=>{await n.nextTick(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(p=new ResizeObserver(()=>{c&&c.dispatch({scrollIntoView:!0})}),p.observe(r.value))}),n.onUnmounted(()=>{p&&r.value&&(p.unobserve(r.value),p.disconnect(),p=null),c&&(c.destroy(),c=null)}),t({sqlFormatter:m}),(g,y)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:n.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),vf=n.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("actionRef"),i=n.ref("0"),r=n.computed(()=>{const{actionStyle:c,toLeft:s}=o;return{...c,left:s?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:s?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=n.computed(()=>Number.parseInt(i.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:c=>{i.value=c}}),(c,s)=>{const d=n.resolveComponent("j-icon");return n.openBlock(),n.createElementBlock("div",{ref_key:"actionRef",ref:a,style:n.normalizeStyle(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(n.openBlock(),n.createBlock(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(n.openBlock(),n.createBlock(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),bf=n.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("barRef"),i=n.ref("0"),r=n.computed(()=>{const{barStyle:l,toLeft:c}=o;return{...l,width:c?"0":i.value,transition:c?"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,c)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"barRef",ref:a,style:n.normalizeStyle(r.value)},null,4))}}),xf=n.defineComponent({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("contentRef"),i=n.computed(()=>{const{contentStyle:l}=o;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=n.computed(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(l,c)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"contentRef",ref:a,class:n.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:n.normalizeStyle(i.value)},[n.createElementVNode("div",{style:n.normalizeStyle(r.value),class:"j-spine-text"},n.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Xr=te(n.defineComponent({name:"JSliderCaptcha",__name:"slider-captcha",props:n.mergeModels({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:n.mergeModels(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,i=n.useModel(e,"modelValue"),r=n.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=n.useTemplateRef("wrapperRef"),c=n.useTemplateRef("barRef"),s=n.useTemplateRef("contentRef"),d=n.useTemplateRef("actionRef");n.watch(()=>r.isPassing,x=>{if(x){const{endTime:b,startTime:w}=r,C=(b-w)/1e3;a("success",{isPassing:x,time:C.toFixed(1)}),i.value=x}}),n.watchEffect(()=>{r.isPassing=!!i.value});function u(x){return"pageX"in x?x.pageX:"touches"in x&&x.touches[0]?x.touches[0].pageX:0}function f(x){r.isPassing||d.value&&(a("start",x),r.moveDistance=u(x)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function h(x){const b=l.value?.offsetWidth??220,w=x?.offsetWidth??40,C=b-w-6;return{actionWidth:w,offset:C,wrapperWidth:b}}function m(x){const{isMoving:b,moveDistance:w}=r;if(b){const C=n.unref(d),S=n.unref(c);if(!C||!S)return;const{actionWidth:v,offset:j,wrapperWidth:_}=h(C.getEl()),B=u(x)-w;a("move",{event:x,moveDistance:w,moveX:B}),B>0&&B<=j?(C.setLeft(`${B}px`),S.setWidth(`${B+v/2}px`)):B>j&&(C.setLeft(`${_-v}px`),S.setWidth(`${_-v/2}px`),g())}}function p(x){const{isMoving:b,isPassing:w,moveDistance:C}=r;if(b&&!w){a("end",x);const S=d.value,v=n.unref(c);if(!S||!v)return;const j=u(x)-C,{actionWidth:_,offset:B,wrapperWidth:V}=h(S.getEl());j<B?y():(S.setLeft(`${V-_}px`),v.setWidth(`${V-_/2}px`),g()),r.isMoving=!1}}function g(){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 x=n.unref(d),b=n.unref(c),w=n.unref(s);!x||!b||!w||(w.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,x.setLeft("0"),b.setWidth("0")},300))}return(x,b)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"wrapperRef",ref:l,class:n.normalizeClass(["j-slider-captcha slider-border",o.class]),style:n.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:p,onMousemove:m,onMouseup:p,onTouchend:p,onTouchmove:m},[n.createVNode(bf,{ref_key:"barRef",ref:c,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),n.createVNode(xf,{ref_key:"contentRef",ref:s,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),n.createVNode(vf,{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))}})),wf=n.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:c}=gn(),{getHMoreMenus:s}=lr(),d=n.ref([]);o.pId==="moreId"?d.value=s.value:d.value=r(i()[o.pId||""]||[],[]);const u=p=>{const g=d.value.find(y=>y.active);g?.value!==p.value&&(g&&(g.active=!1),a("click",p))},{list:f,containerProps:h,wrapperProps:m}=ca.useVirtualList(d,{itemHeight:44});return(p,g)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-sub-menu-content",{"j-menu-dark":n.unref(c)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},n.unref(h)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(m))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(f),y=>(n.openBlock(),n.createBlock(vo,{key:y.data.value,"parent-actives":n.unref(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),Cf={class:"j-menu-item-label"},kf={class:"j-menu-item-label"},Ef={key:1,class:n.normalizeClass(["j-menu-item-arrow","sub"])},Sf={class:"j-menu-item-label"},vo=n.defineComponent({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=ze(),{activeMenuId:a}=gn(),i=t,r=l=>{i("click",l)};return(l,c)=>{const s=n.resolveComponent("j-icon"),d=n.resolveComponent("el-tooltip"),u=n.resolveComponent("el-popover");return e.collapsed&&!e.item.hasChildren?(n.openBlock(),n.createBlock(d,{key:0,placement:"right"},{content:n.withCtx(()=>[n.createElementVNode("span",null,n.toDisplayString(n.unref(o)(e.item.label)),1)]),default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}]),onClick:c[0]||(c[0]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",Cf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?(n.openBlock(),n.createBlock(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,"popper-class":"j-sub-menu"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,style:n.normalizeStyle({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):n.createCommentVNode("",!0),n.createElementVNode("div",kf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(n.openBlock(),n.createElementBlock("div",Ef)):n.createCommentVNode("",!0)],6)],2)]),default:n.withCtx(()=>[n.createVNode(wf,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:c[1]||(c[1]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:n.normalizeStyle({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):n.createCommentVNode("",!0),n.createElementVNode("div",Sf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2))}}}),_f=n.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=gn(),l=f=>{a("click",f)},c=n.computed(()=>o.menuList),{list:s,containerProps:d,wrapperProps:u}=ca.useVirtualList(c,{itemHeight:44});return(f,h)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":n.unref(r)==="dark"}]},n.unref(d)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(u))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(s),m=>(n.openBlock(),n.createBlock(vo,{key:m.data.value,"parent-actives":n.unref(i)?.pid?.split(".")||[],item:m.data,collapsed:e.collapsed,class:n.normalizeClass({"menu-item-entering":m.data.entering,"menu-item-leaving":m.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),Bf=n.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=gn(),l=n.ref(),c=n.ref(0);let s=null;n.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(s=new ResizeObserver(()=>{l.value&&(c.value=l.value.offsetWidth)}),s.observe(l.value))});const d=n.computed(()=>{const m=[];let p=0,g=0;const y=o.menuList.length;return o.menuList.forEach(x=>{g++;const b=(dn(x.label)||0)+32+16+4+8;p+=b,(g===y&&p<=c.value||g<y&&p+56<=c.value)&&m.push(x)}),m.length<o.menuList.length&&m.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),m}),u=n.computed(()=>{const m=[];let p=0;const g=d.value.length;return o.menuList.forEach(y=>{p++,p>=g&&m.push(y)}),m}),f=n.computed(()=>{const m=i.value?.pid?.split(".")||[];return(m.length>1&&u.value.findIndex(p=>p.value===m[1])>-1||u.value.findIndex(p=>p.value===i.value?.value)>-1)&&m.push("moreId"),m}),h=m=>{a("click",m)};return cr({getHMoreMenus:u}),n.onUnmounted(()=>{s&&l.value&&(s.unobserve(l.value),s.disconnect(),s=null)}),(m,p)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"menuRef",ref:l,class:n.normalizeClass(["j-menu-horizontal",{"j-menu-dark":n.unref(r)==="dark"}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,g=>(n.openBlock(),n.createBlock(vo,{key:g.value,"parent-actives":f.value,item:g,"is-horizontal":"",onClick:h},null,8,["parent-actives","item"]))),128))],2))}}),jf=n.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=gn(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],c=n.computed(()=>(o.menuList.forEach((m,p)=>{m.color=l[p%l.length]}),o.menuList)),s=n.computed(()=>i.value?.pid?.split(".")||[]),d=m=>{a("click",m)},{list:u,containerProps:f,wrapperProps:h}=ca.useVirtualList(c,{itemHeight:96});return(m,p)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu-vertical",{"j-menu-dark":n.unref(r)==="dark"}]},n.unref(f)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(h))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(u),g=>(n.openBlock(),n.createBlock(vo,{key:g.data.value,"parent-actives":s.value,item:g.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),Zr=te(n.defineComponent({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let i={};const r=n.ref("");r.value=o.activeId||"";const l=(g,y,x,b,w)=>{x=x||[];for(let C=0,S=x.length;C<S;C++){const v=x[C],j={};j.pid=y,j.indent=b,r.value===v.value&&(j.active=!0),Object.keys(v).forEach(B=>{B!=="children"&&(j[B]=v[B])}),w&&w.includes(v.value)&&(j.open=!0),g.push(j);const _=v.children||[];_.length>0&&(j.hasChildren=!0,w||(i[j.value]=_),(!w||j.open&&!o.collapsed)&&l(g,`${y}.${j.value}`,_,b+1,w))}},c=(g,y)=>{const x=[];return l(x,"0",g,0,y),x},s=n.ref([]);let d=[];const u=()=>{i={},d=c(o.menus);const g=[];if(r.value&&o.mode==="inline"){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}s.value=c(o.menus,g)};n.watch(()=>o.menus,()=>{u()},{immediate:!0}),n.watch(()=>o.mode,()=>{u()});const f=()=>{if(s.value.find(y=>y.active)?.value!==r.value){const y=d.find(x=>x.value===r.value);if(y){const x=[];o.mode==="inline"&&x.push(...y.pid.split(".")),s.value=c(o.menus,x)}}},h=n.computed(()=>d.find(g=>g.value===r.value));n.watch(()=>o.activeId,()=>{r.value=o.activeId||"",f()}),n.watch(()=>o.collapsed,()=>{if(o.collapsed)s.value=c(o.menus,[]);else{const g=[];if(r.value){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}s.value=c(o.menus,g)}});const m=n.computed(()=>o.theme),p=g=>{if(console.log(g),g.hasChildren){if(o.collapsed)return;const y=[];y.push(...g.pid.split(".")),g.open||y.push(g.value);const x=c(o.menus,y),b=new Set(s.value.map(C=>C.value)),w=new Set(x.map(C=>C.value));x.forEach(C=>{b.has(C.value)||(C.entering=!0)}),s.value.forEach(C=>{w.has(C.value)||(C.leaving=!0)}),s.value=x,setTimeout(()=>{s.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(r.value===g.value)return;r.value=g.value,a("click",g)}};return rr({getMenuMap:()=>i,toArray:c,activeMenu:h,activeMenuId:r,theme:m}),(g,y)=>e.mode==="inline"?(n.openBlock(),n.createBlock(_f,{key:0,"menu-list":s.value,collapsed:e.collapsed,onClick:p},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(n.openBlock(),n.createBlock(Bf,{key:1,"menu-list":s.value,onClick:p},null,8,["menu-list"])):(n.openBlock(),n.createBlock(jf,{key:2,"menu-list":s.value,onClick:p},null,8,["menu-list"]))}})),Tf={class:"j-keyword-panel"},Vf={key:0},Pf={key:1,class:"columns-wrapper"},Mf=n.defineComponent({name:"JKeywordPanel",__name:"keyword-panel",props:n.mergeModels({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=ze(),a=e,i=n.useModel(e,"checkAll"),r=n.useModel(e,"checkFields"),l=n.ref(!1),c=n.ref(""),s=n.computed(()=>a.columns.filter(h=>h.config?.filter?.isSearchKeyword?c.value?h.config?.label?.indexOf(c.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,m)=>{const p=n.resolveComponent("j-icon"),g=n.resolveComponent("el-input"),y=n.resolveComponent("j-checkbox");return n.openBlock(),n.createElementBlock("div",Tf,[n.createElementVNode("div",{class:n.normalizeClass(["range-item",{active:i.value}]),onClick:d},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索全部")),1),i.value?(n.openBlock(),n.createBlock(p,{key:0,icon:"mdi:check"})):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:"range-item",onClick:m[0]||(m[0]=x=>l.value=!l.value)},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索特定字段")),1),n.createVNode(p,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?(n.openBlock(),n.createElementBlock("div",Vf,[n.createVNode(g,{modelValue:c.value,"onUpdate:modelValue":m[1]||(m[1]=x=>c.value=x),modelModifiers:{trim:!0},class:"no-border background",placeholder:n.unref(o)("搜索"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createElementBlock("div",Pf,[n.createVNode(y,{modelValue:r.value,"onUpdate:modelValue":m[2]||(m[2]=x=>r.value=x),options:s.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):n.createCommentVNode("",!0)])}}}),Nf={key:0,class:"title"},$f={class:"content"},Of={class:"relation"},Rf={style:{width:"72px"}},Af={class:"btn-wrapper"},Lf={class:"field-wrapper"},If={class:"buttons"},Qr=n.defineComponent({name:"JFilterPanel",__name:"filter-panel",props:n.mergeModels({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:n.mergeModels(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=ze(),i=e,r=n.useModel(e,"relation"),l=n.useModel(e,"isPin"),c=n.ref([]),s=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:f.value.join(","),options:u.value}),config:{appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,width:l.value?132:160,change:({value:b,row:w})=>{const S=i.columns.find(_=>_.id===b)?.config||{};let v="eq",j="text";["options"].includes(S.dataType||"")?v="in":["dateTime"].includes(S.dataType||"")&&(v="range",j="dateTime"),w.method=v,w.type=S.valueType||j}}},{id:"method",type:"j-select",getCompConfig:({row:b})=>{const C=i.columns.find(S=>S.id===b.field)?.config||{};return["options","switch"].includes(C.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(C.dataType||"")?{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:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{width:l.value?120:144,appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:b})=>{b.value=void 0}}},{id:"value",type:"input",getCompType:({row:b})=>{const C=i.columns.find(S=>S.id===b.field)?.config||{};if(["options","dataItem","switch"].includes(C.dataType||"")){if(["in","nin"].includes(b.method)||["eq","ne"].includes(b.method))return"j-select"}else if(["dateTime"].includes(C.dataType||""))return["range"].includes(b.method)?"j-date-range":["formula"].includes(b.method)?"j-select":"j-date";return"j-input"},getCompConfig:({row:b})=>{if(["empty","not_empty"].includes(b.method||""))return{display:!1};const C=i.columns.find(v=>v.id===b.field)?.config||{},S={display:!0,placeholder:"",clearable:!0,filterable:!0};return["options","dataItem"].includes(C.dataType||"")?(S.collapseTags=!0,S.collapseTagsTooltip=!0,S.dataType=C.dataType,S.dataCode=C.dataCode,S.options=C.options):["switch"].includes(C.dataType||"")?(S.options=[],S.dataType="options",C.activeValue==null?S.options.push({label:"是",value:"1"}):S.options.push({label:"是",value:C.activeValue}),C.inactiveValue==null?S.options.push({label:"否",value:"0"}):S.options.push({label:"否",value:C.inactiveValue})):["dateTime"].includes(C.dataType||"")&&(["formula"].includes(b.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.type="datetime",["range"].includes(b.method)?(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:{width:l.value?234:296,appendTo:l.value?void 0:".j-filter-panel"}}];n.onMounted(()=>{c.value=i.searchFieldList});const u=n.computed(()=>i.columns.filter(b=>!b.children?.length).map(b=>({label:b.config?.label,value:b.id,dataType:b.config?.dataType,options:b.config?.options}))),f=n.computed(()=>c.value.map(b=>b.field)),h=({data:b})=>{if(f.value.includes(b.value))return;const C=i.columns.find(j=>j.id===b.value)?.config||{};let S="eq",v="text";["options","dataItem"].includes(C.dataType||"")?S="in":["dateTime"].includes(C.dataType||"")&&(S="range",v="dateTime"),c.value.push({field:b.value,method:S,type:C.valueType||v})},m=o,p=()=>{c.value.length=0},g=()=>{l.value?m("filter"):m("close",!0)},y=()=>{c.value.forEach(b=>{b.value=void 0}),m("filter")};return t({getSearchFields:()=>c.value}),(b,w)=>{const C=n.resolveComponent("j-icon"),S=n.resolveComponent("j-select"),v=n.resolveComponent("j-button-select"),j=n.resolveComponent("j-button"),_=n.resolveComponent("j-input-rows"),B=n.resolveComponent("el-tooltip");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-filter-panel",{"is-pin":l.value}])},[l.value?(n.openBlock(),n.createElementBlock("div",Nf,[n.createVNode(C,{icon:"mdi:filter-outline"}),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选")),1)])):n.createCommentVNode("",!0),n.createElementVNode("div",$f,[n.createElementVNode("div",Of,[n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选出符合以下")),1),n.createElementVNode("div",Rf,[n.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=V=>r.value=V),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("条件的数据")),1)]),n.createElementVNode("div",Af,[n.createVNode(v,{label:"添加过滤条件",options:u.value,"model-value":f.value.join(","),onChange:h},null,8,["options","model-value"]),c.value.length>0?(n.openBlock(),n.createBlock(j,{key:0,type:"text",danger:"",label:"删除全部",onClick:p})):n.createCommentVNode("",!0)]),n.createElementVNode("div",Lf,[n.createVNode(_,{modelValue:c.value,"onUpdate:modelValue":w[1]||(w[1]=V=>c.value=V),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),n.createVNode(B,{placement:"bottom",content:l.value?n.unref(a)("取消固定"):n.unref(a)("固定显示")},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"pin-btn",onClick:s},[n.createVNode(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),n.createElementVNode("div",If,[n.createVNode(j,{label:n.unref(a)("筛选"),type:"primary",onClick:g},null,8,["label"]),n.createVNode(j,{label:n.unref(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),zf={class:"j-order-panel"},Ff={class:"content"},Hf={class:"btn-wrapper"},Wf={class:"field-wrapper"},Uf={class:"buttons"},Df=n.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=ze(),i=e,r=o,l=n.computed(()=>i.columns.filter(p=>!p.children?.length&&p.config?.sorter?.isNot!==!0).map(p=>({label:p.config?.label,value:p.id}))),c=n.ref([]),s=n.computed(()=>c.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})=>{s.value.includes(p.value)||c.value.push({label:p.label,value:p.value,sord:"ASC"})},f=p=>{c.value=JSON.parse(JSON.stringify(p))},h=()=>{r("save",JSON.parse(JSON.stringify(c.value)))},m=()=>{c.value=[],r("clear")};return t({init:f}),(p,g)=>{const y=n.resolveComponent("j-button-select"),x=n.resolveComponent("j-input-rows"),b=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",zf,[n.createElementVNode("div",Ff,[n.createElementVNode("div",Hf,[n.createVNode(y,{label:"添加排序规则",options:l.value,"model-value":s.value.join(","),onChange:u},null,8,["options","model-value"])]),n.createElementVNode("div",Wf,[n.createVNode(x,{modelValue:c.value,"onUpdate:modelValue":g[0]||(g[0]=w=>c.value=w),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),n.createElementVNode("div",Uf,[n.createVNode(b,{label:n.unref(a)("排序"),type:"primary",onClick:h},null,8,["label"]),c.value.length>0?(n.openBlock(),n.createBlock(b,{key:0,label:n.unref(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:m},null,8,["label"])):n.createCommentVNode("",!0)])])}}}),Jf={class:"j-column-panel"},Kf={class:"content"},qf={class:"search-wrapper"},Yf={class:"tree-wrapper"},Gf={class:"buttons"},Xf=n.defineComponent({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=ze(),i=e,r=o,l=n.ref(),c=n.ref(""),s={},d=n.ref([]),u=n.ref([]),f=(v,j)=>{const _=[],B=new Map;v.forEach(T=>{B.set(T.id,T),s[T.id]=T});const V=new Set;return j&&j.length>0&&j.forEach(T=>{const L=B.get(T.id);if(L){V.add(L.id);const F={id:L.id,label:L.config?.label||L.id,type:L.type,display:L.config?.display!==!1};L.children&&L.children.length>0&&(F.children=f(L.children,T.children)),_.push(F)}}),v.forEach(T=>{if(!V.has(T.id)){const L={id:T.id,label:T.config?.label||T.id,type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(L.children=f(T.children)),_.push(L)}}),_},h=(v,j)=>j.length===0?v:v.map(_=>{const B=j.some(T=>_.label.toLowerCase().includes(T.toLowerCase())),V=_.children?h(_.children,j):[];return B||V.length>0?{..._,children:V.length>0?V:_.children}:null}).filter(Boolean),m=n.computed(()=>{if(!c.value)return u.value;const v=c.value.split(/\s+/).filter(Boolean);return h(u.value,v)}),p=n.ref([]),g=n.computed(()=>{const v=new Map;if(i.columnConfig&&i.columnConfig.length>0){const j=_=>{_.forEach(B=>{v.set(B.id,B),B.children&&j(B.children)})};j(i.columnConfig)}return v}),y=()=>{const v=j=>{const _=[];return j.forEach(B=>{let V=!0;if(g.value.size>0){const T=g.value.get(B.id);T?V=T.display:V=B.config?.display!==!1}else V=B.config?.display!==!1;V&&(_.push(B.id),B.children&&_.push(...v(B.children)))}),_};p.value=v(i.columns)},x=(v,{node:j})=>{v.includes(j.id)?p.value.push(j.id):p.value=p.value.filter(B=>B!==j.id)},b=(v,j,_)=>_==="inner"?!1:v.parent===j.parent,w=()=>{const v=j=>j.map(_=>{const B={..._,display:p.value.includes(_.id)};return _.children&&(B.children=v(_.children)),B});r("save",v(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),c.value="",l.value){const v=l.value;v.setCheck&&v.setCheck(p.value);const j=v.$refs?.treeRef||v;j?.setCheckedKeys&&j.setCheckedKeys(p.value)}};return t({init:()=>{y(),d.value=f(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(v,j)=>{const _=n.resolveComponent("j-icon"),B=n.resolveComponent("el-input"),V=n.resolveComponent("j-tree"),T=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Jf,[n.createElementVNode("div",Kf,[n.createElementVNode("div",qf,[n.createVNode(B,{modelValue:c.value,"onUpdate:modelValue":j[0]||(j[0]=L=>c.value=L),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(_,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",Yf,[n.createVNode(V,{ref_key:"treeRef",ref:l,list:m.value,"is-tree-data":!0,"default-checked-keys":p.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!c.value,"allow-drop":b,check:x},null,8,["list","default-checked-keys","draggable"])])]),n.createElementVNode("div",Gf,[n.createVNode(T,{label:n.unref(a)("确定"),type:"primary",onClick:w},null,8,["label"]),n.createVNode(T,{label:n.unref(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),Zf={class:"j-table-panel-left"},Qf={class:"j-table-panel-top"},ep={class:"j-table-panel-top-left"},tp={class:"j-table-panel-top-right"},np={key:0,style:{width:"200px"}},op={class:"j-table-panel-main"},ap={key:0,class:"j-table-panel-filter-panel"},ba=te(n.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},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:o}){const{t:a}=ze(),{openLayer:i}=yn(),r=e,l=o;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const c=n.ref();let s=[];const d=n.ref(0),u=n.ref(1);let f=r.pageSize||100,h="";const m=n.ref([]),p=n.ref(!1),g=n.computed(()=>r.batchButtons&&r.batchButtons.length>0),y=n.computed(()=>m.value.length>0),x=n.computed(()=>g.value&&y.value&&r.isMultiple||p.value),b=n.computed(()=>r.isPage&&!x.value);g.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const w=G=>r.rowKey?r.rowKey.split(",").map(Ae=>G[Ae.trim()]).join("::"):"",C=(G,Q)=>{if(!Q||Q.length===0)return G.filter(Z=>Z.config?.display!==!1).map(Z=>Z.children&&Z.children.length>0?{...Z,children:C(Z.children)}:Z);const Ae=new Map(G.map(Z=>[Z.id,Z])),Oe=[];return Q.forEach(Z=>{const Re=Ae.get(Z.id);if(Re){if(Z.display){let On=Re;Re.children&&Re.children.length>0&&(On={...Re,children:C(Re.children,Z.children)}),Oe.push(On)}Ae.delete(Z.id)}}),G.forEach(Z=>{if(Ae.has(Z.id)&&Z.config?.display!==!1){let Re=Z;Z.children&&Z.children.length>0&&(Re={...Z,children:C(Z.children)}),Oe.push(Re)}}),Oe},S=n.computed(()=>C(r.columns,ye.value)),v=n.computed(()=>Ki(r.columns,G=>G.config.label)),j=n.ref(""),_=n.computed(()=>v.value.some(G=>G.config?.filter?.isSearchKeyword)),B=n.ref(),V=n.ref(!0),T=n.ref([]),L=n.computed(()=>V.value?"搜索全部":`搜索范围:${v.value.filter(G=>T.value.includes(G.id)).map(G=>G.config?.label).join("、")}`),F=()=>{B.value.init()},z=n.ref(),P=n.ref(!1),E=n.ref(!1),$=n.ref(!1),R=n.ref([]),q=n.ref("and"),ee=n.ref(),ce=n.ref(!1),de=n.ref([]),Pe=()=>{ee.value.init(de.value)},J=G=>{de.value=G,ce.value=!1,Ye()},fe=()=>{de.value=[],Ye()},ge=n.ref(),re=n.ref(!1),ye=n.ref(),je=n.computed(()=>ye.value!=null),U=()=>{ge.value?.init()},ne=G=>{console.log("handleColumnSave:",G),ye.value=G,re.value=!1},se=n.ref(!1),Ce=()=>{se.value=!se.value},Ue=()=>{m.value=[],c.value&&(c.value.setSelection?.([]),p.value&&(p.value=!1,c.value.setRecords(s)))},Qe=()=>{p.value=!p.value,p.value?c.value?.setRecords(m.value):c.value?.setRecords(s),c.value?.setSelection?.(m.value)},ve=n.computed(()=>{if(m.value.length>0&&r.isMultiple){const G=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:p.value?"全部":"仅选中",config:{type:"text"},click:Qe},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:Ue}],Q=r.batchButtons.map(Ae=>({...Ae,click:()=>{Ae.click&&Ae.click({data:m.value,openLayer:i})}}));return[...G,...Q]}return r.buttons}),it=async()=>{const G={},Q={};Q.rel=q.value;const Ae=z.value?.getSearchFields?.()||R.value;Q.cond=Ae.filter(Z=>Z.value!==void 0&&Z.value!==null&&Z.value!=="").map(Z=>({field:Z.field,method:Z.method,value:Z.value,type:Z.type})),Q.cond.length>0?$.value=!0:$.value=!1,G.filter=Q;const Oe=de.value.map(Z=>Z.value+" "+Z.sord).join(",");if(j.value&&(G.keyword={value:j.value,fields:V.value?v.value.filter(Z=>Z.config?.filter?.isSearchKeyword).map(Z=>Z.id):n.unref(T)}),r.loadData){if(r.isPage){G.pagination={rows:f,page:u.value,sort:Oe||h||r.sort||r.rowKey};const Z=await r.loadData(G)||{};s=Z.rows||[],d.value=Z.records||0}else G.sort=Oe,s=await r.loadData(G)||[],d.value=s.length;c.value.setRecords(s),g.value?(m.value=[],p.value=!1):r.rowKey&&m.value.length>0&&c.value?.setSelection?.(m.value)}},Ye=async()=>{u.value=1,await it()},gt=({rows:G,page:Q})=>{f=G,u.value=Q,it()},I=async()=>{m.value=[],p.value=!1,u.value=1,await it()},Y=async()=>{m.value=[],p.value=!1,await it()},H=async()=>{await I()},W=G=>{l("ready",G)},K=G=>{let Q=[];if(!r.isMultiple){m.value=G,l("select",G);return}if(g.value)Q=G;else if(!r.rowKey)Q=G;else{const Ae=new Map(G.map(Z=>[w(Z),Z])),Oe=new Map(m.value.map(Z=>[w(Z),Z]));s.forEach(Z=>{const Re=w(Z);Ae.has(Re)?Oe.set(Re,Ae.get(Re)):Oe.delete(Re)}),Q=Array.from(Oe.values())}m.value=Q,l("select",Q),p.value&&Q.length===0?(p.value=!1,c.value&&c.value.setRecords(s)):p.value&&Q.length>0&&c.value&&(c.value.setRecords(Q),c.value.setSelection?.(Q))},ie=()=>m.value||[],ue=G=>{m.value=G,c.value?.setSelection?.(G)},he=()=>c.value?.getInstance?.();return n.onMounted(async()=>{r.immediate&&await Y()}),t({refreshData:Y,resetData:I,getSelection:ie,setSelection:ue,clearSelection:()=>{Ue()},getInstance:he}),(G,Q)=>{const Ae=n.resolveComponent("j-buttons"),Oe=n.resolveComponent("j-icon"),Z=n.resolveComponent("el-popover"),Re=n.resolveComponent("el-tooltip"),On=n.resolveComponent("el-input"),ln=n.resolveComponent("j-button"),Bi=n.resolveComponent("j-table");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-table-panel-wrapper",{fullscreen:se.value,"no-padding":e.noPadding||se.value}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":se.value}])},[n.createElementVNode("div",Zf,[n.createElementVNode("div",Qf,[n.createElementVNode("div",ep,[n.createVNode(Ae,{list:ve.value},null,8,["list"])]),n.createElementVNode("div",tp,[_.value&&!x.value?(n.openBlock(),n.createElementBlock("div",np,[n.createVNode(On,{modelValue:j.value,"onUpdate:modelValue":Q[2]||(Q[2]=O=>j.value=O),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:n.withKeys(Ye,["enter"]),onClear:Ye},{prefix:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:search"})]),suffix:n.withCtx(()=>[n.createVNode(Re,{placement:"bottom",content:L.value},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:F,onHide:Ye},{reference:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:n.withCtx(()=>[n.createVNode(Mf,{ref_key:"keywordPanelRef",ref:B,"check-all":V.value,"onUpdate:checkAll":Q[0]||(Q[0]=O=>V.value=O),"check-fields":T.value,"onUpdate:checkFields":Q[1]||(Q[1]=O=>T.value=O),columns:v.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),!P.value&&!x.value?(n.openBlock(),n.createBlock(Z,{key:1,visible:E.value,"onUpdate:visible":Q[6]||(Q[6]=O=>E.value=O),placement:"bottom","popper-style":"padding: 0",width:644,trigger:"click",persistent:!1,onHide:Ye},{reference:n.withCtx(()=>[n.createVNode(ln,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:n.normalizeClass({active:$.value})},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Qr,{ref_key:"filterPanelRef",ref:z,"is-pin":P.value,"onUpdate:isPin":Q[3]||(Q[3]=O=>P.value=O),relation:q.value,"onUpdate:relation":Q[4]||(Q[4]=O=>q.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ye,onClose:Q[5]||(Q[5]=O=>E.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):n.createCommentVNode("",!0),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:2,placement:"bottom",content:n.unref(a)("排序")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:ce.value,"onUpdate:visible":Q[7]||(Q[7]=O=>ce.value=O),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Pe},{reference:n.withCtx(()=>[n.createVNode(ln,{class:n.normalizeClass({active:de.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Df,{ref_key:"orderPanelRef",ref:ee,columns:v.value,onSave:J,onClear:fe},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:3,placement:"bottom",content:n.unref(a)("显示字段")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:re.value,"onUpdate:visible":Q[8]||(Q[8]=O=>re.value=O),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:U},{reference:n.withCtx(()=>[n.createVNode(ln,{class:n.normalizeClass({active:je.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Xf,{ref_key:"columnPanelRef",ref:ge,columns:e.columns,"column-config":ye.value,onSave:ne},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:4,placement:"bottom",content:n.unref(a)("刷新")},{default:n.withCtx(()=>[n.createVNode(ln,{type:"text",icon:"mdi:refresh",onClick:H})]),_:1},8,["content"])),n.createVNode(Re,{placement:"bottom",content:se.value?n.unref(a)("退出全屏"):n.unref(a)("全屏")},{default:n.withCtx(()=>[n.createVNode(ln,{type:"text",icon:se.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:Ce},null,8,["icon"])]),_:1},8,["content"])])]),n.createElementVNode("div",op,[n.createVNode(Bi,{ref_key:"tableRef",ref:c,"table-page":u.value,"onUpdate:tablePage":Q[9]||(Q[9]=O=>u.value=O),columns:S.value,records:n.unref(s),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":b.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"highlight-mode":e.highlightMode,onLoadPageData:gt,onReady:W,onSelectionChanged:K},null,8,["table-page","columns","records","is-tree","is-show-number","is-multiple","is-page","page-sizes","page-size","page-total","row-key","actions","actions-max-count","actions-label","highlight-mode"])])]),P.value&&!x.value?(n.openBlock(),n.createElementBlock("div",ap,[n.createVNode(Qr,{ref_key:"filterPanelRef",ref:z,"is-pin":P.value,"onUpdate:isPin":Q[10]||(Q[10]=O=>P.value=O),relation:q.value,"onUpdate:relation":Q[11]||(Q[11]=O=>q.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ye},null,8,["is-pin","relation","search-field-list","columns"])])):n.createCommentVNode("",!0)],2)],2)}}})),ip={class:"j-button-select"},rp={class:"search-wraper"},lp={class:"options-wraper"},cp=["onClick"],el=te(n.defineComponent({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:i}=ze(),r=n.ref(""),l=n.computed(()=>r.value===""?o.options:o.options.filter(d=>(d.label||"").includes(r.value))),c=n.computed(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),s=d=>{if(d.disabled||c.value.includes(d.value))return;const f=[...c.value,d.value].join(",");a("update:modelValue",f),a("change",{value:f,data:d})};return(d,u)=>{const f=n.resolveComponent("j-button"),h=n.resolveComponent("j-icon"),m=n.resolveComponent("el-input"),p=n.resolveComponent("el-popover");return n.openBlock(),n.createBlock(p,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:n.withCtx(()=>[n.createVNode(f,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:n.withCtx(()=>[n.createElementVNode("div",ip,[n.createElementVNode("div",rp,[n.createVNode(m,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=g=>r.value=g),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索"),class:"no-border",clearable:""},{prefix:n.withCtx(()=>[n.createVNode(h,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",lp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,g=>(n.openBlock(),n.createElementBlock("div",{key:g.value,class:n.normalizeClass(["option-item",{active:c.value.includes(g.value)||g.disabled}]),onClick:n.withModifiers(y=>s(g),["stop"])},[g.icon?(n.openBlock(),n.createBlock(h,{key:0,class:"j-button-select-icon",icon:g.icon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)(g.label)),1)],10,cp))),128))])])]),_:1},8,["width"])}}})),sp={class:"j-tree-item-text"},dp={key:2,class:"j-tree-item-button-group"},up={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},tl=te(n.defineComponent({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},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:o}){const a=e,i=o,{useData:r,t:l}=ze(),{getTreeData:c,loadData:s}=r(),d=n.ref(),u=n.ref(!1),f=n.ref(""),h=n.ref([]),m={children:"children",label:"label",disabled:"disabled"},p=n.computed(()=>c?c({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),g=n.computed(()=>a.dataCode||a.dataType?p.value:a.list?n.unref(a.list):h.value),y=async()=>{u.value=!0,a.loadData&&(h.value=await a.loadData()||[]),s&&await s(a.dataType,a.dataCode),u.value=!1,n.nextTick(()=>{a.afterLoadData&&a.afterLoadData(g.value||[])})},x=(z,P=!0)=>{d.value?.setCurrentKey(z,P)},b=()=>d.value?.getCurrentKey(),w=(z,P=!1)=>{d.value?.setCheckedKeys(z,P)},C=(z=!1)=>d.value?.getCheckedKeys(z),S=async(z,P,E,$)=>{if(f.value=z.value,a.nodeClickFlow&&a.runFlow){const R=JSON.parse(a.nodeClickFlow);await a.runFlow(R,{value:z.value})}a.click&&a.click(z.value,z,$)},v=(z,{checkedKeys:P,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})=>{a.check&&a.check(P,{node:z,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})},j=(z,P,E,$)=>{i("node-drop",z,P,E,$)},_=z=>{const P=vt(a.treeButtons);return z&&a.filterButton?a.filterButton({buttons:P,node:z}):P},{openLayer:B}=yn(),V=(z,P)=>{z.config?.disabled||z.click&&z.click({data:P,openLayer:B})},T=n.ref(""),L=(z,P)=>{T.value=z?P.value:"",console.log(T.value,"row")},F=(z,P,E)=>a.allowDrop?a.allowDrop(z,P,E):!(E=="inner"&&!P.data.canInner);return n.onMounted(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),n.watch(()=>a.list,()=>{u.value=!0,n.nextTick(()=>{u.value=!1})}),n.watch(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:x,getValue:b,setCheck:w,getCheck:C}),(z,P)=>{const E=n.resolveComponent("j-icon"),$=n.resolveComponent("j-button"),R=n.resolveComponent("el-dropdown-item"),q=n.resolveComponent("el-dropdown-menu"),ee=n.resolveComponent("el-dropdown"),ce=n.resolveComponent("el-tree"),de=n.resolveComponent("el-empty"),Pe=n.resolveDirective("loading");return n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&g.value.length>0?(n.openBlock(),n.createBlock(ce,{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:g.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:m,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":F,"expand-on-click-node":e.expandOnClickNode,onNodeClick:S,onCheck:v,onNodeDrop:j},{default:n.withCtx(({node:J})=>[n.createElementVNode("div",{class:n.normalizeClass(["j-tree-item-wraper",{"is-focus":T.value===J.data.value}])},[J.data.openIcon?(n.openBlock(),n.createBlock(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:J.data.openIcon,color:J.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),J.data[e.iconKey]||e.defaultIcon?(n.openBlock(),n.createBlock(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:J.data[e.iconKey]||e.defaultIcon||"",color:J.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),n.createElementVNode("div",sp,n.toDisplayString(J.label),1),_(J.data).length?(n.openBlock(),n.createElementBlock("div",dp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_(J.data),(fe,ge)=>(n.openBlock(),n.createBlock(ee,{key:ge,trigger:"click",onVisibleChange:re=>L(re,J.data)},{dropdown:n.withCtx(()=>[n.createVNode(q,null,{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(fe.children,(re,ye)=>(n.openBlock(),n.createBlock(R,{key:ye,disabled:re.disabled,divided:re.divided,onClick:n.withModifiers(je=>V(re,J.data),["stop"])},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"j-flex-item",style:n.normalizeStyle({color:re.danger?"var(--j-color-danger)":re.color||e.buttonIconColor||"var(--j-color-text-2)"})},[re.icon||e.buttonDefaultIcon?(n.openBlock(),n.createBlock(E,{key:0,icon:re.icon||e.buttonDefaultIcon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(l)(re.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:n.withCtx(()=>[n.createVNode($,{icon:fe.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):n.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"])):(n.openBlock(),n.createElementBlock("div",up,[n.createVNode(de,{description:n.unref(l)(e.emptyDes)},null,8,["description"])]))],2)),[[Pe,u.value]])}}})),nl=te(n.defineComponent({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:"label"},valueKey:{default:"value"},pidKey:{default:"pid"},idKey:{default:"id"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,{useData:a}=ze(),{getTreeData:i}=a(),r=n.computed(()=>(console.log(i),i?(console.log("test",i({dataType:o.dataType,dataCode:o.dataCode,labelKey:o.labelKey,valueKey:o.valueKey,pidKey:o.pidKey,idKey:o.idKey,notLoad:!1})),i({dataType:o.dataType,dataCode:o.dataCode,labelKey:o.labelKey,valueKey:o.valueKey,pidKey:o.pidKey,idKey:o.idKey,notLoad:!1})||[]):[])),l=n.computed(()=>(console.log("treeSelectData",o),o.dataCode||o.dataType?r.value:o.options||[])),c=t,s=n.computed({get(){return o.modelValue},set(u){c("update:modelValue",u)}}),d=u=>{c("change",u)};return(u,f)=>{const h=n.resolveComponent("el-tree-select");return n.openBlock(),n.createBlock(h,{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=m=>s.value=m),data:l.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,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"])}}})),ol=te(Br),fp=Rd;async function pp(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const i=new fp({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:c})=>c):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function hp(e,t,o){const a=o.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:c})=>!!i==!!l?r-c:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await pp(e,t,r);if(l!=="")return{name:e,errors:l}}}function mp(e,t){const o=(r,l,c,s,d)=>{Object.keys(l).forEach(u=>{let f=u;c&&(f=`${c}.${u}`);const h=l[u],{rules:m,myGridtableId:p}=t(f,c?l:void 0,()=>s,d);if(m.length){const g=a(f,h,m);r.push(g)}p&&h.forEach(g=>{o(r,g,p,h,c?l:void 0)})})},a=(r,l,c)=>hp(r,l,c);return{validateForm:async()=>{const r=n.unref(e),l=[];o(l,r,"");const c=await Promise.all(l),s={};return c.forEach(d=>{d&&(s[d.name]={msg:d.errors})}),s},validateField:a}}const al=te(n.defineComponent({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,i=o,{useData:r,existField:l,httpGet:c,httpPost:s,success:d,warning:u,error:f,info:h,t:m}=ze();let p;r&&(p=r());const g=I=>{f&&f(I)},y=n.ref(!1),x=n.computed(()=>a.config?.gutter||16),b=n.computed(()=>a.config?.span||24),w=n.computed(()=>a.config?.labelWidth),C=n.computed(()=>a.config?.labelPosition||"right"),S=n.computed(()=>_.length===1&&(_[0].type==="j-tabs"||_[0].type==="j-layout"||_[0].config?.isAutoWindow)),v=n.reactive({}),j=n.ref({}),_=[],B={},V=n.ref({});let T={},L={},F=[],z={};const P=I=>{i("change",I)},E=I=>ho(B[I]?.type||"")&&!B[I]?.config?.notInput||B[I]?.config?.isInput,$=I=>["j-table","j-input-rows","j-input-cards"].includes(B[I]?.type||"");let R;const q=(I,Y)=>{Object.keys(I).forEach(H=>{const W=I[H];Y&&(H=Y+"."+H),W!=null&&typeof W=="object"&&!so(W)&&q(W,H),v[H]=W})},ee=(I,Y)=>{let H=I.id;return H||(I.config?.table&&I.config?.field?H=`${I.config.table}.${I.config.field}`:I.config?.table?H=I.config?.table:I.config?.field&&(H=I.config?.field),Y&&$(Y)&&(H=`${Y}.${H}`)),H||po("j")},ce=(I,Y,H,W="")=>{I.forEach(K=>{K.id=ee(K,W);const ie={id:K.id,slot:K.slot,type:K.type||"",getCompType:K.getCompType,getCompConfig:K.getCompConfig,config:{},children:[]};Y.push(ie);const{children:ue}=K;fo(ie,K,["children","config"]),fo(ie.config,K.config||{},[]),B[K.id]&&console.warn("有重复的组件id:"+K.id),B[K.id]=ie,a.readonly===!0&&(ie.config.readonly=!0);let he=!1,De;W!==""&&$(W)&&(he=!0,ie.config=K.config||{},ie.config.parentTableId=W,De=B[W]?.config?.table);const G=ie.config||{};if(E(K.id))!H&&he===!1&&(G?.defaultValue===0?v[K.id]=G?.defaultValue:v[K.id]=G?.defaultValue||void 0),G.table&&G.field?T[`${G.table}_${G.field}`.toLowerCase()]=K.id:G.field&&(he?T[`${De}_${G.field}`.toLowerCase()]=K.id:T[`${G.field}`.toLowerCase()]=K.id);else if(he&&G.field)T[`${De}_${G.field}`.toLowerCase()]=K.id;else if($(K.id))!H&&!G.isSubTable&&(v[K.id]=[]),G.table&&(T[G.table.toLowerCase()||""]=K.id),G.isSubTable||F.push(ie);else if(G?.defaultValue)v[K.id]=G?.defaultValue;else if(K.type==="collapse"&&G?.isExpand){const Q=[];(G?.groups||[]).forEach(Ae=>{Q.push(Ae.i)}),v[K.id]=Q}ue&&ue.length>0&&ce(ue,ie.children,H,ie.id)})},de=async(I,Y)=>{y.value=!1;const H=!!Y;_.splice(0,_.length),T={},L={},F=[],R=Y,An(v),V.value={},H&&q(Y,""),ce(I,_,H),z=vt(v),n.nextTick(()=>{y.value=!0,n.nextTick(()=>{Ye(a.config?.codeInit,{})})})},Pe=(I,Y,H)=>{const W=[];return Y.forEach(K=>{const ie={};Object.keys(K).forEach(ue=>{if(!H||H(ue,K[ue],I)){const he=se(ue);if(he?.type==="j-table")ie[he?.id||""]=Pe(ue,K[ue],H);else{let De=T[`${I}_${ue}`.toLowerCase()]||ue;De=De.indexOf(".")!==-1?De.split(".")[1]:De,ie[De]=K[ue]}}}),W.push(ie)}),W},J=(I,Y)=>{Object.keys(I||{}).forEach(H=>{let W=I[H];const K=se(H);if(K===void 0)W&&(so(W)&&(W=W[0]||{}),typeof W=="object"?Object.keys(W).forEach(ie=>{if(!Y||Y(H,W[ie],H)){let ue=ie;H!=="main"&&(ue=`${H}_${ie}`),L[ue]=H,v[T[ue.toLowerCase()]||ie]=W[ie]}}):v[H]=W);else if($(K.id||"")){if(!Array.isArray(W)){console.warn("表格数据不是数组:"+H);return}W?.length>0?v[T[H.toLowerCase()]||H]=Pe(H,W,Y):v[T[H.toLowerCase()]||H]=[]}else(!Y||Y(H,W,H))&&(v[T[H.toLowerCase()]||H]=W)}),R&&Object.keys(v).forEach(H=>{const W=se(H);(W===void 0||!["tabs","collapse"].includes(W.type||""))&&Li(R,H,v[H])})},fe=(I,Y=!1)=>{const H={};return Object.keys(I).forEach(W=>{if(W==="parentRow")return;const K=B[W];if(K){const ie=K.config?.table,ue=K.config?.field;if(Y)ue?H[ue]=I[W]:H[W]=I[W];else if($(W)){const he=[];I[W].forEach(De=>{he.push(fe(De,!0))}),H[ie||W]=he}else ie&&ue?(H[ie]=H[ie]||{},H[ie][ue]=I[W]):ue&&(H[ue]=I[W])}else Y?W!=="_X_ROW_KEY"&&W!=="_isHover"&&(H[W]=I[W]):L[W]?(H[L[W]]=H[L[W]]||{},H[L[W]][W.replace(`${L[W]}_`,"")]=I[W]):H[W]=I[W]}),H},ge=(I=!0)=>I?fe(v):v,re=(I,Y,H,W)=>{let K=B[I];if(K==null){const ue=I.split(".");K=B[ue[ue.length-1]]||{}}if(!K)return{};const ie=Dt({config:{...K.config||{},...V.value[K.id]||{}},getCompConfig:K.getCompConfig,formData:v,getTableData:H,row:Y,pRowData:W});return ie._componentId=K?.id,ie},ye=(I,Y,H,W)=>{const K=re(I,Y,H,W);if(K.isNotRule!==!0&&K.display!==!1){const ie=K.rule||[],ue=ie.find(he=>he.type==="only");return ue&&(ue.validator=async(he,De)=>{if(De){const G={table:he.table,key:he.key,keyName:he.keyName,field:he.field,keyValue:he.getKeyValue?he.getKeyValue():"",value:De,paramNames:he.paramNames,getParams:he.getParams,withProjectId:he.withProjectId,getValue:he.getValue,formData:v};if(!await l(G))throw m(he.message)||m("数据值重复")}}),{rules:ie,myGridtableId:$(K._componentId)?K._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:je}=mp(v,ye),U=async()=>{j.value={};const I=await je();return Object.keys(I).length>0?(j.value=I,g(`${m(B[Object.keys(I)[0]]?.config?.label)}:${m(I[Object.keys(I)[0]].msg)}`),!1):!0},ne=()=>{j.value={},An(v),Object.keys(z||{}).forEach(I=>{v[I]=z[I]})},se=I=>{let Y=B[I];return Y===void 0&&T[I.toLowerCase()]&&(Y=B[T[I.toLowerCase()]]),Y},Ce=({id:I,i:Y,value:H,type:W})=>{if(W==="add")v[I].push(H);else if(W==="delete")v[I].splice(Y,1);else{const K=se(I);K&&(K.config.parentTableId?v[K.config.parentTableId][Y][I]=H:v[I]=H)}},Ue=({id:I,i:Y})=>{const H=se(I);if(H){if(H.config.parentTableId){const W=v[H.config.parentTableId],K=H.id?H.id.replace(`${H.config.parentTableId}.`,""):"";if(Y!=null)return(W[Y]||{})[K||""];const ie=[];return W&&W.forEach(ue=>{ie.push(ue[K||""])}),ie}if($(H.id||"")){const W=[];return v[H.id||""].forEach(K=>{W.push(fe(K,!0))}),W}return v[H.id||""]}if(v[I])return v[I]},Qe=async({id:I,i:Y})=>{const H=Ue({id:I,i:Y}),W=se(I);if(W&&p?.getLabel)if(Y!==void 0){const K=H[Y],ie=v[W.config.parentTableId||""][Y],ue=Dt({config:W.config,getCompConfig:W.getCompConfig,formData:v,tableData:v[W.config.parentTableId||""],row:ie});return await p?.getLabel({value:K,config:ue,formData:v,tableData:v[W.config.parentTableId||""],row:ie})}else{const K=Dt({config:W.config,getCompConfig:W.getCompConfig,formData:v});return await p?.getLabel({value:H,config:K,formData:v})}return H},ve=async(I,Y)=>p?.loadViewDataList?await p?.loadViewDataList(I,Y,!1):[],it=I=>(I.set=Ce,I.get=Ue,I.setFormData=J,I.getFormData=ge,I.getLabel=Qe,I.getViewData=ve,I.getDateNow=Y=>Gi(new Date,Y||"YYYY-MM-DD HH:mm:ss"),I.httpGet=c||(()=>{console.log("当前状态不支持")}),I.httpPost=s||(()=>{console.log("当前状态不支持")}),I.loading=Y=>{un(Y)},I.showMsg=({text:Y,type:H})=>{switch(H){case"success":d&&d(Y);break;case"warning":u&&u(Y);break;case"error":f&&f(Y);break;case"info":h&&h(Y);break;default:h&&h(Y);break}console.log("showMsg",Y,H)},I),Ye=async(I,Y)=>{if(I&&I.trim()){I=`async (jcode) => {${I}}`;const{res:H,fn:W}=ua(I);H&&await W(it(Y))}},gt=(I,Y)=>{V.value[I]={...V.value[I]||{},...Y}};return a.schema&&de(a.schema),ma({formData:v,compsConfig:V,errorFields:j,isAutoWindow:S,gutter:x,span:b,labelWidth:w,labelPosition:C,getValue:Ue,formChange:P}),ga({contextType:"form"}),t({init:de,reset:ne,validate:U,setValue:Ce,getValue:Ue,getLabel:Qe,setFormData:J,getFormData:ge,setCompConfig:gt}),(I,Y)=>{const H=n.resolveComponent("j-form-item"),W=n.resolveComponent("el-row"),K=n.resolveComponent("el-form");return y.value?(n.openBlock(),n.createBlock(K,{key:0,class:n.normalizeClass([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":w.value,size:e.config?.size,onSubmit:Y[0]||(Y[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[S.value?(n.openBlock(),n.createBlock(H,n.mergeProps({key:0},_[0],{"is-not-col":""}),null,16)):(n.openBlock(),n.createBlock(W,{key:1,gutter:x.value},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,ie=>n.createVNode(H,n.mergeProps({key:ie.id,ref_for:!0},ie),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):n.createCommentVNode("",!0)}}})),il=te(_r),gp={class:"j-page"},rl=te(n.defineComponent({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=n.ref(!1),i=n.reactive([]),r={},l=n.reactive({}),c=new ha,s=new Map,d=(p,g,y,...x)=>{const b=`${p}:${g}`;return y?.immediate&&s.set(b,x),c.emit(b,...x)},u=(p,g,y)=>{const x=`${p}:${g}`;c.on(x,y);const b=s.get(x);b&&(s.delete(x),y(...b))},f=(p,g,y)=>{const x=`${p}:${g}`;s.delete(x),c.off(x,y)},h=(p,g)=>{p.forEach(y=>{y.id=y.id||po("c");const x={id:y.id,slot:y.slot,type:y.type,config:{},children:[]},{children:b}=y;r[y.id]=x,fo(x.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l.value[y.id]=y.config.defaultValue),g.push(x),b&&b.length>0&&h(b,x.children)})},m=p=>{a.value=!1,i.splice(0,i.length),An(r),An(l),h(p,i),n.nextTick(()=>{a.value=!0})};return o.schema&&m(o.schema),pr({registerMethod:(p,g,y)=>(u(p,g,y),()=>{f(p,g,y)})}),ga({contextType:"page"}),t({init:m,call:d,on:u,off:f}),(p,g)=>{const y=n.resolveComponent("j-comp");return n.openBlock(),n.createElementBlock("div",gp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i,x=>(n.openBlock(),n.createBlock(y,{key:x.id,id:x.id,type:x.type,config:x.config,children:x.children},null,8,["id","type","config","children"]))),128))])}}})),ll=te(n.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,i=n.ref("");return n.watch(()=>o.modelValue,r=>{r?i.value=r:(i.value=Ut(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const c=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(c,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=s=>i.value=s),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),yp={key:0,class:"j-panel-top"},vp=["title"],bp={style:{margin:"0","font-size":"14px"}},xp={key:1},wp={key:1,class:"j-panel-bottom"},cl=te(n.defineComponent({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=yn(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,i)=>{const r=n.resolveComponent("j-button"),l=n.resolveComponent("el-tooltip"),c=n.resolveComponent("j-buttons");return n.openBlock(),n.createElementBlock("div",{class:"j-block",style:n.normalizeStyle({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[n.createElementVNode("div",{class:"j-panel",style:n.normalizeStyle({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?(n.openBlock(),n.createElementBlock("div",yp,[e.notTitle?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:"j-panel-top-left",title:e.title||""},[n.renderSlot(a.$slots,"title",{},()=>[n.createElementVNode("span",bp,n.toDisplayString(e.title||""),1)])],8,vp)),e.toolBtns&&e.toolBtns.length>0?(n.openBlock(),n.createElementBlock("span",xp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.toolBtns,s=>(n.openBlock(),n.createBlock(l,{key:s.id,placement:"top",content:s.label||""},{default:n.withCtx(()=>[n.createVNode(r,n.mergeProps({ref_for:!0},s.config,{onClick:d=>o(s),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"j-panel-body",style:n.normalizeStyle(e.bodyStyle)},[n.renderSlot(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?(n.openBlock(),n.createElementBlock("div",wp,[n.createVNode(c,{list:e.bootmBtns},null,8,["list"]),n.createVNode(c,{list:e.bootmRightBtns},null,8,["list"])])):n.createCommentVNode("",!0)],4)],4)}}})),Cp={class:"j-input-rows"},kp={key:0,class:"j-input-rows-num"},Ep={key:1,class:"j-input-rows-char"},sl=te(n.defineComponent({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=C=>C==null,a=e,i=t,{formData:r}=Jt(),l=n.computed(()=>a.editConfig.isAddBtn!==!1),c=n.computed(()=>a.editConfig.addBtnText||"添加"),s=n.computed(()=>a.editConfig.buttonsAlign||"left"),d=n.computed(()=>a.editConfig.isRemoveBtn!==!1),u=n.computed(()=>a.editConfig.readonly),f=n.computed(()=>a.editConfig.drag),h=n.computed(()=>a.editConfig.isNullValue!==!1),m=n.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"],g=n.ref([]);a.modelValue&&a.modelValue.length>0?(g.value=a.modelValue||[],g.value.forEach(C=>{C._i||(C._i=Ut())})):(g.value=[],i("update:modelValue",g.value)),n.watch(()=>a.modelValue,C=>{g.value=a.modelValue||[],g.value=C||[],g.value.forEach(S=>{S._i||(S._i=Ut())})},{deep:!0});const x=()=>{const C={_i:Ut()};a.columns.forEach(S=>{const v=S.config?.valueRowKey||S.id||"";v&&(C[v]=vt(S.config?.defaultValue))}),g.value.push(C),i("change",{id:a.id,value:C,data:C,formData:r,tableData:g.value,type:"add"})},b=C=>{const S=g.value[C];g.value.splice(C,1),i("change",{id:a.id,value:S,data:S,formData:r,tableData:g.value,type:"delete"})},w=C=>{i("rowChange",C)};return n.onMounted(()=>{if(!f.value||!m.value)return;const C=m.value,{initSortable:S}=nr(C,{handle:".j-input-rows-drag",onEnd:v=>{const{oldIndex:j,newIndex:_}=v;if(o(j)||o(_)||j===_||j<0||_<0)return;const B=g.value.splice(j,1)[0];g.value.splice(_,0,B),i("change",{id:a.id,value:B,data:B,formData:r,tableData:g.value,type:"sort"})}});S()}),go({getTableData:()=>g.value,rowChange:w}),(C,S)=>{const v=n.resolveComponent("j-comp"),j=n.resolveComponent("j-icon"),_=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Cp,[n.createElementVNode("div",{ref_key:"inputRowsRef",ref:m,class:"j-input-rows-container"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value,(B,V)=>(n.openBlock(),n.createElementBlock("div",{key:B._i+V,class:n.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(n.openBlock(),n.createElementBlock("div",kp,n.toDisplayString(V+1),1)):n.createCommentVNode("",!0),e.showChar?(n.openBlock(),n.createElementBlock("div",Ep,n.toDisplayString(p[V%26]),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.columns,T=>(n.openBlock(),n.createBlock(v,n.mergeProps({key:T.id,ref_for:!0},T,{row:B}),null,16,["row"]))),128)),f.value?(n.openBlock(),n.createBlock(j,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):n.createCommentVNode("",!0),d.value&&(h.value||g.value.length>1)&&!u.value?(n.openBlock(),n.createBlock(j,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:T=>b(V)},null,8,["onClick"])):n.createCommentVNode("",!0)],2))),128))],512),!u.value&&l.value?(n.openBlock(),n.createElementBlock("div",{key:0,style:n.normalizeStyle({"text-align":s.value}),class:"j-input-rows-actions"},[l.value?(n.openBlock(),n.createBlock(_,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:x},null,8,["label"])):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0)])}}})),Sp={class:"j-input-layer"},dl=te(n.defineComponent({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=p=>!!(p==null||typeof p=="string"&&p.trim()===""||Array.isArray(p)&&p.length===0),a=e,i=t,r=n.ref(),l=n.ref(),c=n.ref(""),s=n.computed({get(){return a.modelValue},set(p){i("update:modelValue",p)}}),d=n.computed({get(){return o(s.value)?"":o(c.value)?a.getText?a.getText(s.value):s.value:c.value},set(p){p||f()}});n.watch(()=>a.modelValue,()=>{c.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},f=()=>{c.value="",s.value="",i("change",{value:"",data:void 0})},h=async()=>{if(!l.value)return;const p=l.value.getSelection();if(a.isMultiSelect){const g=[],y=[];p.forEach(x=>{const b=x[a.labelKey],w=x[a.valueKey];g.push(b!=null?String(b):""),w===0||w?y.push(String(w)):y.push("")}),c.value=g.join(","),s.value=y.join(","),i("change",{value:y.join(","),data:p})}else if(p.length>0){const g=p[0],y=g[a.labelKey],x=g[a.valueKey];c.value=y!=null?String(y):"";const b=x!=null?String(x):"";s.value=b,i("change",{value:b,data:g})}else c.value="",s.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},m=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(p,g)=>{const y=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",Sp,[e.onlyButton?(n.openBlock(),n.createBlock(n.unref(uo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):(n.openBlock(),n.createBlock(y,{key:0,modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=x=>d.value=x),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:f},n.createSlots({_:2},[e.readonly?void 0:{name:"append",fn:n.withCtx(()=>[n.createVNode(n.unref(uo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),n.createVNode(n.unref(va),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:h,onClosed:m},{default:n.withCtx(()=>[n.createVNode(n.unref(ba),{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"])])}}})),ul=te(n.defineComponent({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]}},setup(e){const t=e,o=Jt(),{t:a}=ze(),i=n.computed(()=>t.formConfig?.gutter||16),r=n.computed(()=>t.formConfig?.span||24),l=n.computed(()=>t.formConfig?.labelWidth||o.labelWidth?.value),c=n.computed(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),s=n.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=n.ref(!1),u=()=>{d.value=!0};return ma({...o,isAutoWindow:s,gutter:i,span:r,labelWidth:l}),(f,h)=>{const m=n.resolveComponent("j-button"),p=n.resolveComponent("j-form-item"),g=n.resolveComponent("el-row"),y=n.resolveComponent("el-form"),x=n.resolveComponent("j-dialog");return n.openBlock(),n.createElementBlock("div",null,[n.createVNode(m,n.mergeProps(f.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),n.createVNode(x,{visible:d.value,"onUpdate:visible":h[1]||(h[1]=b=>d.value=b),title:n.unref(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:n.withCtx(()=>[n.createVNode(y,{class:n.normalizeClass(["j-block","j-layer-form"]),"label-position":c.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createBlock(p,n.normalizeProps(n.mergeProps({key:0},e.schema[0])),null,16)):(n.openBlock(),n.createBlock(g,{key:1,gutter:i.value},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.schema,b=>(n.openBlock(),n.createBlock(p,n.mergeProps({key:b.id,ref_for:!0},b),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}})),fl=te(n.defineComponent({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.computed({get(){return o.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return n.onMounted(()=>{o.autoFocus&&setTimeout(()=>{const l=i.value===o.activeValue?o.inactiveValue:o.activeValue;i.value=l,r(l)},100)}),(l,c)=>{const s=n.resolveComponent("el-switch");return n.openBlock(),n.createBlock(s,n.mergeProps(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":c[0]||(c[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}),n.createSlots({_:2},[l.$slots["active-action"]?{name:"active-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}})),pl=te(n.defineComponent({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=d=>{o("update:modelValue",d)},i=(d,u)=>{o("tab-click",d,u)},r=d=>{o("tab-change",d)},l=d=>{o("tab-remove",d)},c=()=>{o("tab-add")},s=(d,u)=>{o("edit",d,u)};return(d,u)=>{const f=n.resolveComponent("el-tabs");return n.openBlock(),n.createBlock(f,n.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:c,onEdit:s}),{default:n.withCtx(()=>[n.renderSlot(d.$slots,"default")]),_:3},16,["model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),hl=te(n.defineComponent({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=r=>{o("update:modelValue",r)},i=r=>{o("change",r)};return(r,l)=>{const c=n.resolveComponent("el-collapse");return n.openBlock(),n.createBlock(c,n.mergeProps(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:n.withCtx(()=>[n.renderSlot(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),_p={class:"j-editor"},ml=te(Lr(n.defineComponent({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,i=n.ref(),r=n.ref(),l=n.shallowRef(),c=n.computed(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let s=!1;const d=f=>{if(!f)return"";let h=f;return o.apiUrl&&o.token&&(h=h.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),h},u=f=>{if(!f)return"";let h=f;if(o.apiUrl){const m=`${o.apiUrl}/system/annexesfile/`;h=h.split(m).join("{learun_img_api}"),o.token&&(h=h.split(`token=${o.token}`).join("{learun_img_token}"))}return h};return n.onMounted(()=>{const f={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};f.onChange=m=>{if(s)return;const p=m.getHtml(),g=u(p);a("update:value",g),a("change",{value:g})};const h=Ni.createEditor({selector:i.value,html:d(o.value),config:f,mode:"default"});l.value=h,Ni.createToolbar({editor:h,selector:r.value,mode:"default"})}),n.watch(()=>o.value,f=>{const h=l.value;if(h){const m=h.getHtml(),p=d(f);u(m)!==f&&(s=!0,h.setHtml(p),s=!1)}}),n.watch(()=>o.readonly,f=>{const h=l.value;h&&(f?h.disable():h.enable())}),n.onBeforeUnmount(()=>{const f=l.value;f?.destroy()}),(f,h)=>(n.openBlock(),n.createElementBlock("div",_p,[n.createElementVNode("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),n.createElementVNode("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:n.normalizeStyle(c.value)},null,4)]))}}),[["__scopeId","data-v-60cd5d0b"]])),Bp={key:0,class:"j-map-loading"},jp=te(n.defineComponent({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(!0),l=n.ref();let c=null,s=null,d=null,u=null;const f=async()=>{r.value=!0;try{c=await or(a.mapKey)}catch(x){console.error("Failed to load Baidu Map:",x),r.value=!1;return}if(s!=null){m(a.lng,a.lat),r.value=!1;return}if(!l.value)return;s=new c.Map(l.value,{enableMapClick:!1});const y=new c.Point(121.480248,31.236276);s.centerAndZoom(y,17),d=new c.Marker(y,{enableDragging:!0}),s.addOverlay(d),d.addEventListener("dragend",x=>{h(x.point)}),s.addControl(new c.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new c.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",x=>{h(x.point)}),u.addEventListener("locationError",x=>{alert(x.message)}),s.addControl(u),s.addEventListener("click",x=>{h(x.point)}),s.enableScrollWheelZoom(!0),m(a.lng,a.lat),r.value=!1},h=y=>{new c.Geocoder().getLocation(y,b=>{d.setPosition(y),s.panTo(y),i("update:address",b.address),i("update:lng",y.lng),i("update:lat",y.lat),i("change",{value:{address:b.address,lng:y.lng,lat:y.lat}})})},m=(y,x)=>{if(y&&x&&c){const b=new c.Point(y,x);d&&d.setPosition(b),s&&s.panTo(b)}};let p=null;return t({setPoint:m,querySearchAsync:(y,x)=>{!s||!c||(p||(p=new c.LocalSearch(s,{onSearchComplete:b=>{const w=[];if(b){const C=b.getCurrentNumPois();for(let S=0;S<C;S++)w.push(b.getPoi(S))}x(w)}})),p.search(y))}}),n.onMounted(()=>{f()}),(y,x)=>(n.openBlock(),n.createElementBlock("div",{class:"j-map",style:n.normalizeStyle({height:e.height})},[r.value?(n.openBlock(),n.createElementBlock("div",Bp,[n.createVNode(Wt,{icon:"mdi:loading",class:"is-loading",size:30})])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}));function gl(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function vn(e){return e.originalEvent||e.srcEvent}function xa(e){gl(e),gl(vn(e))}function bn(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 yl=1500;function vl(e,t,o){var a=this,i=o.get("dragging",!1);function r(l){if(!l.hover){var c=l.originalEvent,s=a._findTargetGfx(c),d=s&&e.get(s);s&&d&&(l.stopPropagation(),i.hover({element:d,gfx:s}),i.move(c))}}i&&t.on("drag.start",function(l){t.once("drag.move",yl,function(c){r(c)})}),(function(){var l,c;t.on("element.hover",function(s){l=s.gfx,c=s.element}),t.on("element.hover",yl,function(s){c&&t.fire("element.out",{element:c,gfx:l})}),t.on("element.out",function(){l=null,c=null})})(),this._findTargetGfx=function(l){var c,s;if(l instanceof MouseEvent)return c=bn(l),s=document.elementFromPoint(c.x,c.y),Tp(s)}}vl.$inject=["elementRegistry","eventBus","injector"];function Tp(e){return A.closest(e,"svg, .djs-element",!0)}const Vp={__init__:["hoverFix"],hoverFix:["type",vl]};function bl(){return/mac/i.test(navigator.platform)}function xl(e,t){return(vn(e)||e).button===t}function Et(e){return xl(e,0)}function Pp(e){return xl(e,1)}function wl(e){var t=vn(e)||e;return Et(e)?bl()?t.metaKey:t.ctrlKey:!1}function wa(e){var t=vn(e)||e;return Et(e)&&t.shiftKey}function zn(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Mp(e){return["M",e.x,e.y]}function Ca(e){return["L",e.x,e.y]}function Np(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function $p(e,t){const o=e.length,a=[Mp(e[0])];for(let i=1;i<o;i++){const r=e[i-1],l=e[i],c=e[i+1];if(!c||!t){a.push(Ca(l));continue}const s=Math.min(t,ka(l.x-r.x,l.y-r.y),ka(c.x-l.x,c.y-l.y));if(!s){a.push(Ca(l));continue}const d=bo(l,r,s),u=bo(l,r,s*.5),f=bo(l,c,s),h=bo(l,c,s*.5);a.push(Ca(d)),a.push(Np(u,h,f))}return a}function bo(e,t,o){const a=t.x-e.x,i=t.y-e.y,r=ka(a,i),l=o/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 Ea(e,t,o){k.isNumber(t)&&(o=t,t=null),t||(t={});const a=M.create("path",t);return k.isNumber(o)&&(a.dataset.cornerRadius=String(o)),Cl(a,e)}function Cl(e,t){const o=parseInt(e.dataset.cornerRadius,10)||0;return M.attr(e,{d:zn($p(t,o))}),e}function Op(e){return!0}function xo(e){return Et(e)||Pp(e)}var kl=500;function El(e,t,o){var a=this;function i(_,B,V){if(!c(_,B)){var T,L,F;V?L=t.getGraphics(V):(T=B.delegateTarget||B.target,T&&(L=T,V=t.get(L))),!(!L||!V)&&(F=e.fire(_,{element:V,gfx:L,originalEvent:B}),F===!1&&(B.stopPropagation(),B.preventDefault()))}}var r={};function l(_){return r[_]}function c(_,B){var V=d[_]||Et;return!V(B)}var s={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":Op,"element.mousedown":xo,"element.mouseup":xo,"element.click":xo,"element.dblclick":xo};function u(_,B,V){var T=s[_];if(!T)throw new Error("unmapped DOM event name <"+_+">");return i(T,B,V)}var f="svg, .djs-element";function h(_,B,V,T){var L=r[V]=function(F){i(V,F)};T&&(d[V]=T),L.$delegate=A.delegate.bind(_,f,B,L)}function m(_,B,V){var T=l(V);T&&A.delegate.unbind(_,B,T.$delegate)}function p(_){k.forEach(s,function(B,V){h(_,V,B)})}function g(_){k.forEach(s,function(B,V){m(_,V,B)})}e.on("canvas.destroy",function(_){g(_.svg)}),e.on("canvas.init",function(_){p(_.svg)}),e.on(["shape.added","connection.added"],function(_){var B=_.element,V=_.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:V})}),e.on(["shape.changed","connection.changed"],kl,function(_){var B=_.element,V=_.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:V})}),e.on("interactionEvents.createHit",kl,function(_){var B=_.element,V=_.gfx;a.createDefaultHit(B,V)}),e.on("interactionEvents.updateHit",function(_){var B=_.element,V=_.gfx;a.updateDefaultHit(B,V)});var y=S("djs-hit djs-hit-stroke"),x=S("djs-hit djs-hit-click-stroke"),b=S("djs-hit djs-hit-all"),w=S("djs-hit djs-hit-no-move"),C={all:b,"click-stroke":x,stroke:y,"no-move":w};function S(_,B){return B=k.assign({stroke:"white",strokeWidth:15},B||{}),o.cls(_,["no-fill","no-border"],B)}function v(_,B){var V=C[B];if(!V)throw new Error("invalid hit type <"+B+">");return M.attr(_,V),_}function j(_,B){M.append(_,B)}this.removeHits=function(_){var B=A.queryAll(".djs-hit",_);k.forEach(B,M.remove)},this.createDefaultHit=function(_,B){var V=_.waypoints,T=_.isFrame,L;return V?this.createWaypointsHit(B,V):(L=T?"stroke":"all",this.createBoxHit(B,L,{width:_.width,height:_.height}))},this.createWaypointsHit=function(_,B){var V=Ea(B);return v(V,"stroke"),j(_,V),V},this.createBoxHit=function(_,B,V){V=k.assign({x:0,y:0},V);var T=M.create("rect");return v(T,B),M.attr(T,V),j(_,T),T},this.updateDefaultHit=function(_,B){var V=A.query(".djs-hit",B);if(V)return _.waypoints?Cl(V,_.waypoints):M.attr(V,{width:_.width,height:_.height}),V},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=h,this.unregisterEvent=m}El.$inject=["eventBus","elementRegistry","styles"];const Sa={__init__:["interactionEvents"],interactionEvents:["type",El]};function xn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;o.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}xn.$inject=["eventBus","canvas"],xn.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},xn.prototype.get=function(){return this._selectedElements},xn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},xn.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();k.isArray(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){var c=i.findRoot(l);return r===c}),t?k.forEach(e,function(l){o.indexOf(l)===-1&&o.push(l)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var Sl="hover",_l="selected";function Bl(e,t){this._canvas=e;function o(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){o(i.element,Sl)}),t.on("element.out",function(i){a(i.element,Sl)}),t.on("selection.changed",function(i){function r(d){a(d,_l)}function l(d){o(d,_l)}var c=i.oldSelection,s=i.newSelection;k.forEach(c,function(d){s.indexOf(d)===-1&&r(d)}),k.forEach(s,function(d){c.indexOf(d)===-1&&l(d)})})}Bl.$inject=["canvas","eventBus"];function jl(e,t,o,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,c=r.elements,s=r.hints||{},d=s.autoSelect;if(l){if(d===!1)return;k.isArray(d)?t.select(d):t.select(c.filter(Rp))}}),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),c=k.find(r,function(s){return l.id===s.id});c||t.select(l)}),e.on("element.click",function(i){if(Et(i)){var r=i.element;r===o.getRootElement()&&(r=null);var l=t.isSelected(r),c=t.get().length>1,s=wa(i);if(l&&c)return s?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,s)}})}jl.$inject=["eventBus","selection","canvas","elementRegistry"];function Rp(e){return!e.hidden}const wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Sa],selection:["type",xn],selectionVisuals:["type",Bl],selectionBehavior:["type",jl]};var Ap=/^djs-cursor-.*$/;function _a(e){var t=A.classes(document.body);t.removeMatching(Ap),e&&t.add("djs-cursor-"+e)}function Tl(){_a(null)}var Lp=5e3;function Vl(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Lp,o),function(){e.off(t,o)}}function Pl(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Cn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ml(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Nl(e,t){return e=k.isArray(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var kn=Math.round,$l="djs-drag-active";function Kt(e){e.preventDefault()}function Ip(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function zp(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ol(e,t,o,a){var i={threshold:5,trapClick:!0},r;function l(w){var C=t.viewbox(),S=t._container.getBoundingClientRect();return{x:C.x+(w.x-S.left)/C.scale,y:C.y+(w.y-S.top)/C.scale}}function c(w,C){C=C||r;var S=e.createEvent(k.assign({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+w,S)===!1?!1:e.fire(C.prefix+"."+w,S)}function s(w){var C=w.filter(function(S){return a.get(S.id)});C.length&&o.select(C)}function d(w,C){var S=r.payload,v=r.displacement,j=r.globalStart,_=bn(w),B=Cn(_,j),V=r.localStart,T=l(_),L=Cn(T,V);if(!r.active&&(C||zp(B)>r.threshold)){if(k.assign(S,{x:kn(V.x+v.x),y:kn(V.y+v.y),dx:0,dy:0},{originalEvent:w}),c("start")===!1)return y();r.active=!0,r.keepSelection||(S.previousSelection=o.get(),o.select(null)),r.cursor&&_a(r.cursor),t.addMarker(t.getRootElement(),$l)}xa(w),r.active&&(k.assign(S,{x:kn(T.x+v.x),y:kn(T.y+v.y),dx:kn(L.x),dy:kn(L.y)},{originalEvent:w}),c("move"))}function u(w){var C,S=!0;r.active&&(w&&(r.payload.originalEvent=w,xa(w)),S=c("end")),S===!1&&c("rejected"),C=x(S!==!0),c("ended",C)}function f(w){Nl("Escape",w)&&(Kt(w),y())}function h(w){var C;r.active&&(C=Vl(e),setTimeout(C,400),Kt(w)),u(w)}function m(w){d(w)}function p(w){var C=r.payload;C.hoverGfx=w.gfx,C.hover=w.element,c("hover")}function g(w){c("out");var C=r.payload;C.hoverGfx=null,C.hover=null}function y(w){var C;if(r){var S=r.active;S&&c("cancel"),C=x(w),S&&c("canceled",C)}}function x(w){var C,S;c("cleanup"),Tl(),r.trapClick?S=h:S=u,A.event.unbind(document,"mousemove",d),A.event.unbind(document,"dragstart",Kt),A.event.unbind(document,"selectstart",Kt),A.event.unbind(document,"mousedown",S,!0),A.event.unbind(document,"mouseup",S,!0),A.event.unbind(document,"keyup",f),A.event.unbind(document,"touchstart",m,!0),A.event.unbind(document,"touchcancel",y,!0),A.event.unbind(document,"touchmove",d,!0),A.event.unbind(document,"touchend",u,!0),e.off("element.hover",p),e.off("element.out",g),t.removeMarker(t.getRootElement(),$l);var v=r.payload.previousSelection;return w!==!1&&v&&!o.get().length&&s(v),C=r,r=null,C}function b(w,C,S,v){r&&y(!1),typeof C=="string"&&(v=S,S=C,C=null),v=k.assign({},i,v||{});var j=v.data||{},_,B,V,T,L;v.trapClick?T=h:T=u,w?(_=vn(w)||w,B=bn(w),xa(w),_.type==="dragstart"&&Kt(_)):(_=null,B={x:0,y:0}),V=l(B),C||(C=V),L=Ip(_),r=k.assign({prefix:S,data:j,payload:{},globalStart:B,displacement:Cn(C,V),localStart:V,isTouch:L},v),v.manual||(L?(A.event.bind(document,"touchstart",m,!0),A.event.bind(document,"touchcancel",y,!0),A.event.bind(document,"touchmove",d,!0),A.event.bind(document,"touchend",u,!0)):(A.event.bind(document,"mousemove",d),A.event.bind(document,"dragstart",Kt),A.event.bind(document,"selectstart",Kt),A.event.bind(document,"mousedown",T,!0),A.event.bind(document,"mouseup",T,!0)),A.event.bind(document,"keyup",f),e.on("element.hover",p),e.on("element.out",g)),c("init"),v.autoActivate&&d(w,!0)}e.on("diagram.destroy",y),this.init=b,this.move=d,this.hover=p,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(w){k.assign(i,w)}}Ol.$inject=["eventBus","canvas","selection","elementRegistry"];const qt={__depends__:[Vp,wn],dragging:["type",Ol]};function Ba(e){return e.childNodes[0]}function wo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}wo.prototype.next=function(){return this._prefix+ ++this._counter};const Fp=new wo("ps");var Hp=["marker-start","marker-mid","marker-end"],Wp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function St(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}St.$inject=["elementRegistry","eventBus","canvas","styles"],St.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")},St.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},St.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var i=M.clone(o),r=o.getBoundingClientRect();return this._cloneMarkers(Ba(i),a),M.attr(i,this._styles.cls(a,[],{x:r.top,y:r.left})),M.append(t,i),M.attr(i,"data-preview-support-element-id",e.id),i},St.prototype.addFrame=function(e,t){var o=M.create("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return M.append(t,o),M.attr(o,"data-preview-support-element-id",e.id),o},St.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,o)}),Kp(e)&&Hp.forEach(function(i){if(M.attr(e,i)){var r=Up(e,i,a._canvas.getContainer());r&&a._cloneMarker(o,e,r,i,t)}})},St.prototype._cloneMarker=function(e,t,o,a,i="djs-dragger"){var r=[o.id,i,Fp.next()].join("-"),l=A.query("marker#"+o.id,e);e=e||this._canvas._svg;var c=l||M.clone(o);c.id=r,M.classes(c).add(i);var s=A.query(":scope > defs",e);s||(s=M.create("defs"),M.append(e,s)),M.append(s,c);var d=Jp(c.id);M.attr(t,a,d)};function Up(e,t,o){var a=Dp(M.attr(e,t));return A.query("marker#"+a,o||document)}function Dp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Jp(e){return"url(#"+e+")"}function Kp(e){return Wp.indexOf(e.nodeName)!==-1}const ja={__init__:["previewSupport"],previewSupport:["type",St]};function Ta(e){this._commandStack=e.get("commandStack",!1)}Ta.$inject=["injector"],Ta.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};const En={__init__:["rules"],rules:["type",Ta]};function qp(e){return k.filter(e,function(t){return!k.find(e,function(o){return o!==t&&Rl(t,o)})})}function Rl(e,t){if(t){if(e===t)return t;if(e.parent)return Rl(e.parent,t)}}function Al(e,t,o){var a=!0;return e.push(t),a}function Va(e,t,o){o=o||0,k.isArray(e)||(e=[e]),k.forEach(e,function(a,i){var r=t(a,i,o);k.isArray(r)&&r.length&&Va(r,t,o+1)})}function Yp(e,t,o){var a=[],i=[];return Va(e,function(r,l,c){Al(a,r);var s=r.children;if(s&&Al(i,s))return s}),a}function Gp(e,t){return Yp(e)}function Xp(e,t,o){k.isUndefined(t)&&(t=!0),k.isObject(t)&&(o=t,t=!0),o=o||{};var a=Fn(o.allShapes),i=Fn(o.allConnections),r=Fn(o.enclosedElements),l=Fn(o.enclosedConnections),c=Fn(o.topLevel,t&&k.groupBy(e,function(u){return u.id}));function s(u){c[u.source.id]&&c[u.target.id]&&(c[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,s),k.forEach(u.outgoing,s),u.children}return Va(e,d),{allShapes:a,allConnections:i,topLevel:c,enclosedConnections:l,enclosedElements:r}}function dt(e,t){t=!!t,k.isArray(e)||(e=[e]);var o,a,i,r;return k.forEach(e,function(l){var c=l;l.waypoints&&!t&&(c=dt(l.waypoints,!0));var s=c.x,d=c.y,u=c.height||0,f=c.width||0;(s<o||o===void 0)&&(o=s),(d<a||a===void 0)&&(a=d),(s+f>i||i===void 0)&&(i=s+f),(d+u>r||r===void 0)&&(r=d+u)}),{x:o,y:a,height:r-a,width:i-o}}function Zp(e,t){var o={};return k.forEach(e,function(a){var i=a;i.waypoints&&(i=dt(i)),!k.isNumber(t.y)&&i.x>t.x&&(o[a.id]=a),!k.isNumber(t.x)&&i.y>t.y&&(o[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))&&(o[a.id]=a)}),o}function Qp(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function eh(e){return!!(e&&e.isFrame)}function Fn(e,t){return k.assign({},e||{},t||{})}function Ze(e){return k.isObject(e)&&k.has(e,"waypoints")}function Sn(e){return k.isObject(e)&&k.has(e,"labelTarget")}var th="drop-ok",Ll="drop-not-ok",Il="attach-ok",zl="new-parent",Fl="create",nh=2e3;function Hl(e,t,o,a,i){function r(s,d,u,f,h){if(!d)return!1;s=k.filter(s,function(b){var w=b.labelTarget;return!b.parent&&!(Sn(b)&&s.indexOf(w)!==-1)});var m=k.find(s,function(b){return!Ze(b)}),p=!1,g=!1,y=!1;Ul(s)&&(p=i.allowed("shape.attach",{position:u,shape:m,target:d})),p||(Ul(s)?y=i.allowed("shape.create",{position:u,shape:m,source:f,target:d}):y=i.allowed("elements.create",{elements:s,position:u,target:d}));var x=h.connectionTarget;return y||p?(m&&f&&(g=i.allowed("connection.create",{source:x===f?m:f,target:x===f?f:m,hints:{targetParent:d,targetAttach:p}})),{attach:p,connect:g}):y===null||p===null?null:!1}function l(s,d){[Il,th,Ll,zl].forEach(function(u){u===d?e.addMarker(s,u):e.removeMarker(s,u)})}o.on(["create.move","create.hover"],function(s){var d=s.context,u=d.elements,f=s.hover,h=d.source,m=d.hints||{};if(!f){d.canExecute=!1,d.target=null;return}Wl(s);var p={x:s.x,y:s.y},g=d.canExecute=f&&r(u,f,p,h,m);f&&g!==null&&(d.target=f,g&&g.attach?l(f,Il):l(f,g?zl:Ll))}),o.on(["create.end","create.out","create.cleanup"],function(s){var d=s.hover;d&&l(d,null)}),o.on("create.end",function(s){var d=s.context,u=d.source,f=d.shape,h=d.elements,m=d.target,p=d.canExecute,g=p&&p.attach,y=p&&p.connect,x=d.hints||{};if(p===!1||!m)return!1;Wl(s);var b={x:s.x,y:s.y};y?f=a.appendShape(u,f,b,m,{attach:g,connection:y===!0?{}:y,connectionTarget:x.connectionTarget}):(h=a.createElements(h,b,m,k.assign({},x,{attach:g})),f=k.find(h,function(w){return!Ze(w)})),k.assign(d,{elements:h,shape:f}),k.assign(s,{elements:h,shape:f})});function c(){var s=t.context();s&&s.prefix===Fl&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",c),o.once(["create.cancel","create.end"],nh,function(){o.off("elements.changed",c)})}),this.start=function(s,d,u){k.isArray(d)||(d=[d]);var f=k.find(d,function(p){return!Ze(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}),m=dt(h);k.forEach(d,function(p){Ze(p)&&(p.waypoints=k.map(p.waypoints,function(g){return{x:g.x-m.x-m.width/2,y:g.y-m.y-m.height/2}})),k.assign(p,{x:p.x-m.x-m.width/2,y:p.y-m.y-m.height/2})}),t.init(s,Fl,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:d,context:u}})}}}Hl.$inject=["canvas","dragging","eventBus","modeling","rules"];function Wl(e){var t=e.context,o=t.createConstraints;o&&(o.left&&(e.x=Math.max(e.x,o.left)),o.right&&(e.x=Math.min(e.x,o.right)),o.top&&(e.y=Math.max(e.y,o.top)),o.bottom&&(e.y=Math.min(e.y,o.bottom)))}function Ul(e){return e&&e.length===1&&!Ze(e[0])}function oh(e,t,o,a,i){var r=M.createTransform();r.setTranslate(t,o);var l=M.createTransform();l.setRotate(0,0,0);var c=M.createTransform();c.setScale(1,1),M.transform(e,[r,l,c])}function ut(e,t,o){var a=M.createTransform();a.setTranslate(t,o),M.transform(e,a)}function ah(e,t){var o=M.createTransform();o.setRotate(t,0,0),M.transform(e,o)}var ih=750;function Dl(e,t,o,a,i){function r(l){var c=M.create("g");M.attr(c,i.cls("djs-drag-group",["no-events"]));var s=M.create("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=o._createContainer("connection",s),o.drawConnection(Ba(u),d)):(u=o._createContainer("shape",s),o.drawShape(Ba(u),d),ut(u,d.x,d.y)),a.addDragger(d,c,u))}),c}t.on("create.move",ih,function(l){var c=l.hover,s=l.context,d=s.elements,u=s.dragGroup;u||(u=s.dragGroup=r(d));var f;c?(u.parentNode||(f=e.getActiveLayer(),M.append(f,u)),ut(u,l.x,l.y)):M.remove(u)}),t.on("create.cleanup",function(l){var c=l.context,s=c.dragGroup;s&&M.remove(s)})}Dl.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Jl={__depends__:[qt,ja,En,wn],__init__:["create","createPreview"],create:["type",Hl],createPreview:["type",Dl]};function Hn(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pa(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var i=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),r=Hn(e,t);return Math.abs(i/r)<=a}var rh=2;function _t(e,t){var o=Array.from(arguments).flat();const a={x:"v",y:"h"};for(const[i,r]of Object.entries(a))if(lh(i,o))return r;return!1}function lh(e,t){const o=t[0];return k.every(t,function(a){return Math.abs(o[e]-a[e])<=rh})}function Kl(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function Ma(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var ch=/,?([a-z]),?/gi,ql=parseFloat,Me=Math,Bt=Me.PI,ft=Me.min,pt=Me.max,Yl=Me.pow,jt=Me.abs,sh=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,dh=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Gl=Array.isArray||function(e){return e instanceof Array};function uh(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fh(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function ph(e){function t(){var o=Array.prototype.slice.call(arguments,0),a=o.join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return uh(i,a)?(fh(r,a),i[a]):(r.length>=1e3&&delete i[r.shift()],r.push(a),i[a]=e(...arguments),i[a])}return t}function hh(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(sh,function(a,i,r){var l=[],c=i.toLowerCase();for(r.replace(dh,function(s,d){d&&l.push(+d)}),c=="m"&&l.length>2&&(o.push([i,...l.splice(0,2)]),c="l",i=i=="m"?"l":"L");l.length>=t[c]&&(o.push([i,...l.splice(0,t[c])]),!!t[c]););}),o.toString=$a,o}function mh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function gh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Na(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function $a(){return this.join(",").replace(ch,"$1")}function yh(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var i=e[o],r=t[o]=new Array(i.length),l=0,c=i.length;l<c;l++)r[l]=i[l];return t.toString=$a,t}function Xl(e,t,o,a,i,r,l,c,s){var d=1-s,u=Yl(d,3),f=Yl(d,2),h=s*s,m=h*s,p=u*e+f*3*s*o+d*3*s*s*i+m*l,g=u*t+f*3*s*a+d*3*s*s*r+m*c;return{x:Co(p),y:Co(g)}}function Zl(e){var t=kh(...e);return Na(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Tt(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function vh(e,t){return e=Na(e),t=Na(t),Tt(t,e.x,e.y)||Tt(t,e.x2,e.y)||Tt(t,e.x,e.y2)||Tt(t,e.x2,e.y2)||Tt(e,t.x,t.y)||Tt(e,t.x2,t.y)||Tt(e,t.x,t.y2)||Tt(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 Ql(e,t,o,a,i){var r=-3*t+9*o-9*a+3*i,l=e*r+6*t-12*o+6*a;return e*l-3*t+3*o}function ec(e,t,o,a,i,r,l,c,s){s==null&&(s=1),s=s>1?1:s<0?0:s;for(var d=s/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],m=0,p=0;p<u;p++){var g=d*f[p]+d,y=Ql(g,e,o,i,l),x=Ql(g,t,a,r,c),b=y*y+x*x;m+=h[p]*Me.sqrt(b)}return d*m}function bh(e,t,o,a,i,r,l,c){if(!(pt(e,o)<ft(i,l)||ft(e,o)>pt(i,l)||pt(t,a)<ft(r,c)||ft(t,a)>pt(r,c))){var s=(e*a-t*o)*(i-l)-(e-o)*(i*c-r*l),d=(e*a-t*o)*(r-c)-(t-a)*(i*c-r*l),u=(e-o)*(r-c)-(t-a)*(i-l);if(u){var f=Co(s/u),h=Co(d/u),m=+f.toFixed(2),p=+h.toFixed(2);if(!(m<+ft(e,o).toFixed(2)||m>+pt(e,o).toFixed(2)||m<+ft(i,l).toFixed(2)||m>+pt(i,l).toFixed(2)||p<+ft(t,a).toFixed(2)||p>+pt(t,a).toFixed(2)||p<+ft(r,c).toFixed(2)||p>+pt(r,c).toFixed(2)))return{x:f,y:h}}}}function Co(e){return Math.round(e*1e11)/1e11}function xh(e,t,o){var a=Zl(e),i=Zl(t);if(!vh(a,i))return[];var r=ec(...e),l=ec(...t),c=nc(e)?1:~~(r/5)||1,s=nc(t)?1:~~(l/5)||1,d=new Array(c+1),u=new Array(s+1),f={},h=[],m,p;for(m=0;m<c+1;m++){var g=Xl(...e,m/c);d[m]={x:g.x,y:g.y,t:m/c}}for(m=0;m<s+1;m++)g=Xl(...t,m/s),u[m]={x:g.x,y:g.y,t:m/s};for(m=0;m<c;m++)for(p=0;p<s;p++){var y=d[m],x=d[m+1],b=u[p],w=u[p+1],C=jt(x.x-y.x)<.01?"y":"x",S=jt(w.x-b.x)<.01?"y":"x",v=bh(y.x,y.y,x.x,x.y,b.x,b.y,w.x,w.y),j;if(v){if(j=v.x.toFixed(9)+"#"+v.y.toFixed(9),f[j])continue;f[j]=!0;var _=y.t+jt((v[C]-y[C])/(x[C]-y[C]))*(x.t-y.t),B=b.t+jt((v[S]-b[S])/(w[S]-b[S]))*(w.t-b.t);_>=0&&_<=1&&B>=0&&B<=1&&h.push({x:v.x,y:v.y,t1:_,t2:B})}}return h}function tc(e,t,o){e=ic(e),t=ic(t);for(var a,i,r,l,c,s,d,u,f,h,m=o?0:[],p=0,g=e.length;p<g;p++){var y=e[p];if(y[0]=="M")a=c=y[1],i=s=y[2];else{y[0]=="C"?(f=[a,i,...y.slice(1)],a=f[6],i=f[7]):(f=[a,i,a,i,c,s,c,s],a=c,i=s);for(var x=0,b=t.length;x<b;x++){var w=t[x];if(w[0]=="M")r=d=w[1],l=u=w[2];else{w[0]=="C"?(h=[r,l,...w.slice(1)],r=h[6],l=h[7]):(h=[r,l,r,l,d,u,d,u],r=d,l=u);var C=xh(f,h);{for(var S=0,v=C.length;S<v;S++)C[S].segment1=p,C[S].segment2=x,C[S].bez1=f,C[S].bez2=h;m=m.concat(C)}}}}}return m}function wh(e){return Gl(e)&&Gl(e[0])}function Ch(e){if(mh(e))return e;var t=new Array(e.length),o=0,a=0,i=0,r=0,l=0,c;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],i=o,r=a,l++,t[0]=["M",o,a]);for(var s,d,u=l,f=e.length;u<f;u++){if(d=e[u],c=d[0],t[u]=s=new Array(d.length),c!=c.toUpperCase())switch(s[0]=c.toUpperCase(),s[0]){case"A":s[1]=d[1],s[2]=d[2],s[3]=d[3],s[4]=d[4],s[5]=d[5],s[6]=+d[6]+o,s[7]=+d[7]+a;break;case"V":s[1]=+d[1]+a;break;case"H":s[1]=+d[1]+o;break;case"M":i=+d[1]+o,r=+d[2]+a;default:for(var h=1,m=d.length;h<m;h++)s[h]=+d[h]+(h%2?o:a)}else for(var p=0,g=d.length;p<g;p++)s[p]=d[p];switch(c=c.toUpperCase(),s[0]){case"Z":o=+i,a=+r;break;case"H":o=s[1];break;case"V":a=s[1];break;case"M":i=s[s.length-2],r=s[s.length-1];default:o=s[s.length-2],a=s[s.length-1]}}return t.toString=$a,t}function nc(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ko(e,t,o,a){return[e,t,o,a,o,a]}function oc(e,t,o,a,i,r){var l=.3333333333333333,c=2/3;return[l*e+c*o,l*t+c*a,l*i+c*o,l*r+c*a,i,r]}function ac(e,t,o,a,i,r,l,c,s,d){var u=Bt*120/180,f=Bt/180*(+i||0),h=[],m,p=ph(function(re,ye,je){var U=re*Me.cos(je)-ye*Me.sin(je),ne=re*Me.sin(je)+ye*Me.cos(je);return{x:U,y:ne}});if(d)j=d[0],_=d[1],S=d[2],v=d[3];else{m=p(e,t,-f),e=m.x,t=m.y,m=p(c,s,-f),c=m.x,s=m.y;var g=(e-c)/2,y=(t-s)/2,x=g*g/(o*o)+y*y/(a*a);x>1&&(x=Me.sqrt(x),o=x*o,a=x*a);var b=o*o,w=a*a,C=(r==l?-1:1)*Me.sqrt(jt((b*w-b*y*y-w*g*g)/(b*y*y+w*g*g))),S=C*o*y/a+(e+c)/2,v=C*-a*g/o+(t+s)/2,j=Me.asin(((t-v)/a).toFixed(9)),_=Me.asin(((s-v)/a).toFixed(9));j=e<S?Bt-j:j,_=c<S?Bt-_:_,j<0&&(j=Bt*2+j),_<0&&(_=Bt*2+_),l&&j>_&&(j=j-Bt*2),!l&&_>j&&(_=_-Bt*2)}var B=_-j;if(jt(B)>u){var V=_,T=c,L=s;_=j+u*(l&&_>j?1:-1),c=S+o*Me.cos(_),s=v+a*Me.sin(_),h=ac(c,s,o,a,i,0,l,T,L,[_,V,S,v])}B=_-j;var F=Me.cos(j),z=Me.sin(j),P=Me.cos(_),E=Me.sin(_),$=Me.tan(B/4),R=4/3*o*$,q=4/3*a*$,ee=[e,t],ce=[e+R*z,t-q*F],de=[c+R*E,s-q*P],Pe=[c,s];if(ce[0]=2*ee[0]-ce[0],ce[1]=2*ee[1]-ce[1],d)return[ce,de,Pe].concat(h);h=[ce,de,Pe].concat(h).join().split(",");for(var J=[],fe=0,ge=h.length;fe<ge;fe++)J[fe]=fe%2?p(h[fe-1],h[fe],f).y:p(h[fe],h[fe+1],f).x;return J}function kh(e,t,o,a,i,r,l,c){for(var s=[],d=[[],[]],u,f,h,m,p,g,y,x,b=0;b<2;++b){if(b==0?(f=6*e-12*o+6*i,u=-3*e+9*o-9*i+3*l,h=3*o-3*e):(f=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*c,h=3*a-3*t),jt(u)<1e-12){if(jt(f)<1e-12)continue;m=-h/f,0<m&&m<1&&s.push(m);continue}y=f*f-4*h*u,x=Me.sqrt(y),!(y<0)&&(p=(-f+x)/(2*u),0<p&&p<1&&s.push(p),g=(-f-x)/(2*u),0<g&&g<1&&s.push(g))}for(var w=s.length,C=w,S;w--;)m=s[w],S=1-m,d[0][w]=S*S*S*e+3*S*S*m*o+3*S*m*m*i+m*m*m*l,d[1][w]=S*S*S*t+3*S*S*m*a+3*S*m*m*r+m*m*m*c;return d[0][C]=e,d[1][C]=t,d[0][C+1]=l,d[1][C+1]=c,d[0].length=d[1].length=C+2,{x0:ft(...d[0]),y0:ft(...d[1]),x1:pt(...d[0]),y1:pt(...d[1])}}function ic(e){if(wh(e)||(e=hh(e)),gh(e))return e;for(var t=yh(Ch(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(h,m,p){var g,y;if(!h)return["C",m.x,m.y,m.x,m.y,m.x,m.y];switch(!(h[0]in{T:1,Q:1})&&(m.qx=m.qy=null),h[0]){case"M":m.X=h[1],m.Y=h[2];break;case"A":h=["C",...ac(m.x,m.y,...h.slice(1))];break;case"S":p=="C"||p=="S"?(g=m.x*2-m.bx,y=m.y*2-m.by):(g=m.x,y=m.y),h=["C",g,y,...h.slice(1)];break;case"T":p=="Q"||p=="T"?(m.qx=m.x*2-m.qx,m.qy=m.y*2-m.qy):(m.qx=m.x,m.qy=m.y),h=["C",...oc(m.x,m.y,m.qx,m.qy,h[1],h[2])];break;case"Q":m.qx=h[1],m.qy=h[2],h=["C",...oc(m.x,m.y,h[1],h[2],h[3],h[4])];break;case"L":h=["C",...ko(m.x,m.y,h[1],h[2])];break;case"H":h=["C",...ko(m.x,m.y,h[1],m.y)];break;case"V":h=["C",...ko(m.x,m.y,m.x,h[1])];break;case"Z":h=["C",...ko(m.x,m.y,m.X,m.Y)];break}return h},i=function(h,m){if(h[m].length>7){h[m].shift();for(var p=h[m];p.length;)r[m]="A",h.splice(m++,0,["C",...p.splice(0,6)]);h.splice(m,1),d=t.length}},r=[],l="",c="",s=0,d=t.length;s<d;s++){t[s]&&(l=t[s][0]),l!="C"&&(r[s]=l,s&&(c=r[s-1])),t[s]=a(t[s],o,c),r[s]!="A"&&l=="C"&&(r[s]="C"),i(t,s);var u=t[s],f=u.length;o.x=u[f-2],o.y=u[f-1],o.bx=ql(u[f-4])||o.x,o.by=ql(u[f-3])||o.y}return t}function Eh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Wn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function rc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Sh(e){return Wn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function _h(e){for(var t=e.waypoints,o=t.reduce(function(d,u,f){var h=t[f-1];if(h){var m=d[d.length-1],p=m&&m.endLength||0,g=Th(h,u);d.push({start:h,end:u,startLength:p,endLength:p+g,length:g})}return d},[]),a=o.reduce(function(d,u){return d+u.length},0),i=a/2,r=0,l=o[r];l.endLength<i;)l=o[++r];var c=(i-l.startLength)/l.length,s={x:l.start.x+(l.end.x-l.start.x)*c,y:l.start.y+(l.end.y-l.start.y)*c};return s}function Te(e){return Ze(e)?_h(e):Sh(e)}function Vt(e,t,o){o=o||0,k.isObject(o)||(o={x:o,y:o});var a=be(e),i=be(t),r=a.bottom+o.y<=i.top,l=a.left-o.x>=i.right,c=a.top-o.y>=i.bottom,s=a.right+o.x<=i.left,d=r?"top":c?"bottom":null,u=s?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function Oa(e,t,o){var a=Bh(e,t);return a.length===1||a.length===2&&Hn(a[0],a[1])<1?Wn(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}),Wn(a[o?0:a.length-1])):null}function Bh(e,t){return tc(e,t)}function jh(e){e=e.slice();for(var t=0,o,a,i;e[t];)o=e[t],a=e[t-1],i=e[t+1],Hn(o,i)===0||Pa(a,i,o)?e.splice(t,1):t++;return e}function Th(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lc(e,t,o,a){function i(l,c){return a.allowed("connection.create",{source:l,target:c})}function r(l,c){return i(c,l)}e.on("connect.hover",function(l){var c=l.context,s=c.start,d=l.hover,u;if(c.hover=d,u=c.canExecute=i(s,d),!k.isNil(u)){if(u!==!1){c.source=s,c.target=d;return}u=c.canExecute=r(s,d),!k.isNil(u)&&u!==!1&&(c.source=d,c.target=s)}}),e.on(["connect.out","connect.cleanup"],function(l){var c=l.context;c.hover=null,c.source=null,c.target=null,c.canExecute=!1}),e.on("connect.end",function(l){var c=l.context,s=c.canExecute,d=c.connectionStart,u={x:l.x,y:l.y},f=c.source,h=c.target;if(!s)return!1;var m=null,p={connectionStart:Ra(c)?u:d,connectionEnd:Ra(c)?d:u};k.isObject(s)&&(m=s),c.connection=o.connect(f,h,m,p)}),this.start=function(l,c,s,d){k.isObject(s)||(d=s,s=Te(c)),t.init(l,"connect",{autoActivate:d,data:{shape:c,context:{start:c,connectionStart:s}}})}}lc.$inject=["eventBus","dragging","modeling","rules"];function Ra(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var Vh=1100,Ph=900,cc="connect-ok",sc="connect-not-ok";function dc(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=r.canExecute,c=r.hover,s=r.source,d=r.start,u=r.startPosition,f=r.target,h=r.connectionStart||u,m=r.connectionEnd||{x:i.x,y:i.y},p=h,g=m;Ra(r)&&(p=m,g=h),a.drawPreview(r,l,{source:s||d,target:f||c,connectionStart:p,connectionEnd:g})}),t.on("connect.hover",Ph,function(i){var r=i.context,l=i.hover,c=r.canExecute;c!==null&&o.addMarker(l,c?cc:sc)}),t.on(["connect.out","connect.cleanup"],Vh,function(i){var r=i.hover;r&&(o.removeMarker(r,cc),o.removeMarker(r,sc))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}dc.$inject=["injector","eventBus","canvas"];const Aa={__depends__:[wn,En,qt],__init__:["connectPreview"],connect:["type",lc],connectPreview:["type",dc]};var Mh=15;function uc(e,t){var o;function a(c){return l(c.originalEvent)}e.on("canvas.focus.changed",function(c){c.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function i(c){var s=o.start,d=o.button,u=bn(c),f=Cn(u,s);if(!o.dragging&&Nh(f)>Mh&&(o.dragging=!0,d===0&&Vl(e),_a("grab")),o.dragging){var h=o.last||o.start;f=Cn(u,h),t.scroll({dx:f.x,dy:f.y}),o.last=u}c.preventDefault()}function r(c){A.event.unbind(document,"mousemove",i),A.event.unbind(document,"mouseup",r),o=null,Tl()}function l(c){if(!A.closest(c.target,".djs-draggable")){var s=c.button;if(!(s>=2||c.ctrlKey||c.shiftKey||c.altKey))return o={button:s,start:bn(c)},A.event.bind(document,"mousemove",i),A.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!o}}uc.$inject=["eventBus","canvas"];function Nh(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const fc={__init__:["moveCanvas"],moveCanvas:["type",uc]};function La(e){return Math.log(e)/Math.log(10)}function pc(e,t){var o=La(e.min),a=La(e.max),i=Math.abs(o)+Math.abs(a);return i/t}function $h(e,t){return Math.max(e.min,Math.min(e.max,t))}var Oh=Math.sign||function(e){return e>=0?1:-1},Ia={min:.2,max:4},hc=10,Rh=.1,Ah=.75;function ht(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=k.bind(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Ah;var a=this;t.on("canvas.focus.changed",function(i){a._init(i.focused&&e.enabled!==!1)})}ht.$inject=["config.zoomScroll","eventBus","canvas"],ht.prototype.scroll=function(t){this._canvas.scroll(t)},ht.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ht.prototype.zoom=function(t,o){var a=pc(Ia,hc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Rh&&(this._zoom(t,o,a),this._totalDelta=0)},ht.prototype._handleWheel=function(t){if(this._canvas.isFocused()){var o=this._container;t.preventDefault();var a=t.ctrlKey||bl()&&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 c=o.getBoundingClientRect(),s={x:t.clientX-c.left,y:t.clientY-c.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Oh(t.deltaY)*r,this.zoom(l,s)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},ht.prototype.stepZoom=function(t,o){var a=pc(Ia,hc);this._zoom(t,o,a)},ht.prototype._zoom=function(e,t,o){var a=this._canvas,i=e>0?1:-1,r=La(a.zoom()),l=Math.round(r/o)*o;l+=o*i;var c=Math.pow(10,l);a.zoom($h(Ia,c),t)},ht.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&A.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},ht.prototype._init=function(e){this.toggle(e)};const mc={__init__:["zoomScroll"],zoomScroll:["type",ht]};function Be(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)}Be.$inject=["eventBus","injector"],Be.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},Be.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let i=this._fire(e,"canExecute",o);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},Be.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Be.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()}},Be.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()}},Be.prototype.register=function(e,t){this._setHandler(e,t)},Be.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},Be.prototype.canUndo=function(){return!!this._getUndoAction()},Be.prototype.canRedo=function(){return!!this._getRedoAction()},Be.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Be.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Be.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Be.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let i;o=this._eventBus.createEvent(o);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,o),o.cancelBubble)break;return i},Be.prototype._createId=function(){return this._uid++},Be.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Be.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,i=this._getHandler(o);if(!i)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},Be.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},Be.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:k.uniqueBy("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Be.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=k.isArray(e)?e:[e],t.dirty=t.dirty.concat(e))},Be.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},Be.prototype._revertedAction=function(e){this._stackIdx--},Be.prototype._getHandler=function(e){return this._handlerMap[e]},Be.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 Lh={commandStack:["type",Be]};function Yt(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function Eo(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function Pt(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function za(e,t){return!e||!t?-1:e.indexOf(t)}function _n(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Ih=1e3;function Ke(e){this._eventBus=e}Ke.$inject=["eventBus"];function zh(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}Ke.prototype.on=function(e,t,o,a,i,r){if((k.isFunction(t)||k.isNumber(t))&&(r=i,i=a,a=o,o=t,t=null),k.isFunction(o)&&(r=i,i=a,a=o,o=Ih),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(c){var s=["commandStack",c,t].filter(function(d){return d}).join(".");l.on(s,o,i?zh(a,r):a,r)})},Ke.prototype.canExecute=bt("canExecute"),Ke.prototype.preExecute=bt("preExecute"),Ke.prototype.preExecuted=bt("preExecuted"),Ke.prototype.execute=bt("execute"),Ke.prototype.executed=bt("executed"),Ke.prototype.postExecute=bt("postExecute"),Ke.prototype.postExecuted=bt("postExecuted"),Ke.prototype.revert=bt("revert"),Ke.prototype.reverted=bt("reverted");function bt(e){return function(o,a,i,r,l){(k.isFunction(o)||k.isNumber(o))&&(l=r,r=i,i=a,a=o,o=null),this.on(o,e,a,i,r,l)}}var Fh=250,gc=1400;function Fa(e,t,o){Ke.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",gc,function(i){var r=i.context,l=r.shapes,c=r.validatedShapes;r.shapes=yc(l),r.validatedShapes=yc(c)}),a&&t.on("shape.move.start",Fh,function(i){var r=i.context,l=r.shapes,c=[];k.forEach(l,function(s){k.forEach(s.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&c.push(d),s.labelTarget&&c.push(s)})}),k.forEach(c,function(s){a.makeDraggable(r,s,!0)})}),this.preExecuted("elements.move",gc,function(i){var r=i.context,l=r.closure,c=l.enclosedElements,s=[];k.forEach(c,function(d){k.forEach(d.labels,function(u){c[u.id]||s.push(u)})}),l.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context,l=r.connection||r.shape;_n(l.labels,function(c){o.removeShape(c,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,c=l.labelTarget;c&&(r.labelTargetIndex=za(c.labels,l),r.labelTarget=c,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,c=r.labelTarget,s=r.labelTargetIndex;c&&(Pt(c.labels,l,s),l.labelTarget=c)})}Yt(Fa,Ke),Fa.$inject=["injector","eventBus","modeling"];function yc(e){return k.filter(e,function(t){return e.indexOf(t.labelTarget)===-1})}const Hh={__init__:["labelSupport"],labelSupport:["type",Fa]};function vc(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const o=Math.random()*16|0;return(t==="x"?o:o&3|8).toString(16)})}function bc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function Wh(e,t,o,a){var i=o.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 c=this.indexOf(r);if(typeof l>"u"){if(c!==-1)return;l=this.length}c!==-1&&this.splice(c,1),this.splice(l,0,r),c===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Uh(e){return e.__refs_collection===!0}function Dh(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function xc(e,t,o){var a=Wh(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,o)})}function Jh(e,t,o){var a=t.inverse,i=o[t.name];Object.defineProperty(o,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,o),i=r,e.set(i,a,o)}}})}function at(e,t){if(!(this instanceof at))return new at(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}at.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?xc(this,t,e):Jh(this,t,e)},at.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Uh(o)||xc(this,t,e),o},at.prototype.ensureBound=function(e,t){Dh(e,t)||this.bind(e,t)},at.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},at.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var Ha=new at({name:"children",enumerable:!0,collection:!0},{name:"parent"}),wc=new at({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Cc=new at({name:"attachers",collection:!0},{name:"host"}),kc=new at({name:"outgoing",collection:!0},{name:"source"}),Ec=new at({name:"incoming",collection:!0},{name:"target"});function Bn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),Ha.bind(this,"parent"),wc.bind(this,"labels"),kc.bind(this,"outgoing"),Ec.bind(this,"incoming")}function Un(){Bn.call(this),Ha.bind(this,"children"),Cc.bind(this,"host"),Cc.bind(this,"attachers")}Yt(Un,Bn);function Sc(){Bn.call(this),Ha.bind(this,"children")}Yt(Sc,Un);function _c(){Un.call(this),wc.bind(this,"labelTarget")}Yt(_c,Un);function Bc(){Bn.call(this),kc.bind(this,"source"),Ec.bind(this,"target")}Yt(Bc,Bn);var Kh={connection:Bc,shape:Un,label:_c,root:Sc};function qh(e,t){var o=Kh[e];if(!o)throw new Error("unknown type: <"+e+">");return k.assign(new o,t)}function Yh(e){return e instanceof Bn}function Mt(){this._uid=12}Mt.prototype.createRoot=function(e){return this.create("root",e)},Mt.prototype.createLabel=function(e){return this.create("label",e)},Mt.prototype.createShape=function(e){return this.create("shape",e)},Mt.prototype.createConnection=function(e){return this.create("connection",e)},Mt.prototype.create=function(e,t){return t=k.assign({},t||{}),t.id||(t.id=e+"_"+this._uid++),qh(e,t)};const Gh={width:90,height:20};function Gt(){Mt.call(this),this._translate=bc}Ht(Gt,Mt),Gt.$inject=[],Gt.prototype.baseCreate=Mt.prototype.create,Gt.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,_e({type:"label"},Gh,t)):this.createFlowElement(e,t)},Gt.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:vc()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=_e({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Gt.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 So(e,t){this._modeling=e,this._canvas=t}So.$inject=["modeling","canvas"],So.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;k.forEach(o,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)})},So.prototype.postExecute=function(e){};function _o(e){this._modeling=e}_o.$inject=["modeling"],_o.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:i.attach}),e.shape=a},_o.prototype.postExecute=function(e){var t=e.hints||{};Xh(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 Xh(e,t){return k.some(e.outgoing,function(o){return o.target===t})}function Bo(e,t){this._canvas=e,this._layouter=t}Bo.$inject=["canvas","layouter"],Bo.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!o||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},Bo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var jo=Math.round;function Wa(e){this._modeling=e}Wa.$inject=["modeling"],Wa.prototype.preExecute=function(e){var t=e.elements,o=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 c=k.filter(t,function(f){return!f.hidden}),s=dt(c);k.forEach(t,function(f){Ze(f)&&(f.waypoints=k.map(f.waypoints,function(h){return{x:jo(h.x-s.x-s.width/2+i.x),y:jo(h.y-s.y-s.height/2+i.y)}})),k.assign(f,{x:jo(f.x-s.x-s.width/2+i.x),y:jo(f.y-s.y-s.height/2+i.y)})});var d=qp(t),u={};k.forEach(t,function(f){if(Ze(f)){u[f.id]=k.isNumber(a)?l.createConnection(u[f.source.id],u[f.target.id],a,f,f.parent||o,r):l.createConnection(u[f.source.id],u[f.target.id],f,f.parent||o,r);return}var h=k.assign({},r);d.indexOf(f)===-1&&(h.autoResize=!1),Sn(f)&&(h=k.omit(h,["attach"])),u[f.id]=k.isNumber(a)?l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,a,h):l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,h)}),e.elements=k.values(u)};var jc=Math.round;function Nt(e){this._canvas=e}Nt.$inject=["canvas"],Nt.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?k.assign(t,o):k.assign(t,{x:o.x-jc(t.width/2),y:o.y-jc(t.height/2)}),this._canvas.addShape(t,a,i),t},Nt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Dn(e){Nt.call(this,e)}Yt(Dn,Nt),Dn.$inject=["canvas"];var Zh=Nt.prototype.execute;Dn.prototype.execute=function(e){var t=e.shape;return em(t),t.labelTarget=e.labelTarget,Zh.call(this,e)};var Qh=Nt.prototype.revert;Dn.prototype.revert=function(e){return e.shape.labelTarget=null,Qh.call(this,e)};function em(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Jn(e,t){this._canvas=e,this._modeling=t}Jn.$inject=["canvas","modeling"],Jn.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;_n(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),_n(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},Jn.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=za(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Jn.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(o.children,t,a),this._canvas.addConnection(t,o),t};function Ua(e,t){this._modeling=e,this._elementRegistry=t}Ua.$inject=["modeling","elementRegistry"],Ua.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;k.forEach(a,function(i){o.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function Kn(e,t){this._canvas=e,this._modeling=t}Kn.$inject=["canvas","modeling"],Kn.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;_n(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),_n(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),_n(o.children,function(a){Ze(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},Kn.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=za(a.children,o),t.removeShape(o),o},Kn.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,i=e.oldParentIndex;return Pt(a.children,o,i),t.addShape(o,a),o};function To(e){this._modeling=e}To.$inject=["modeling"];var Tc={x:"y",y:"x"};To.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,i=e.dimension;function r(y,x){y.range.min=Math.min(x[a],y.range.min),y.range.max=Math.max(x[a]+x[i],y.range.max)}function l(y){return y[a]+y[i]/2}function c(y){return y.length-1}function s(y){return y.max-y.min}function d(y,x){var b={y:0};b[a]=y-l(x),b[a]&&(b[Tc[a]]=0,t.moveElements([x],b,x.parent))}var u=o[0],f=c(o),h=o[f],m,p,g=0;k.forEach(o,function(y,x){var b,w,C;if(y.elements.length<2){x&&x!==o.length-1&&(r(y,y.elements[0]),g+=s(y.range));return}b=k.sortBy(y.elements,a),w=b[0],x===f&&(w=b[c(b)]),C=l(w),y.range=null,k.forEach(b,function(S){if(d(C,S),y.range===null){y.range={min:S[a],max:S[a]+S[i]};return}r(y,S)}),x&&x!==o.length-1&&(g+=s(y.range))}),p=Math.abs(h.range.min-u.range.max),m=Math.round((p-g)/(o.length-1)),!(m<o.length-1)&&k.forEach(o,function(y,x){var b={},w;y===u||y===h||(w=o[x-1],y.range.max=0,k.forEach(y.elements,function(C,S){b[Tc[a]]=0,b[a]=w.range.max-C[a]+m,y.range.min!==C[a]&&(b[a]+=C[a]-y.range.min),b[a]&&t.moveElements([C],b,C.parent),y.range.max=Math.max(C[a]+C[i],S?y.range.max:0)}))})},To.prototype.postExecute=function(e){};function Vo(e,t){this._layouter=e,this._canvas=t}Vo.$inject=["layouter","canvas"],Vo.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return k.assign(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Vo.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Da(){}Da.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Eo(r.children,t),Pt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x+=o.x,l.y+=o.y,l.original&&(l.original.x+=o.x,l.original.y+=o.y)}),t},Da.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return Eo(o.children,t),Pt(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 Po(e,t,o){var a=Pl(t),i=Pl(o),r=Cn(e,a),l={x:r.x*(o.width/t.width),y:r.y*(o.height/t.height)};return Wn({x:i.x+l.x,y:i.y+l.y})}function Ja(e,t,o){var a=Mo(e),i=Pc(a,t),r=a[0];return i.length?i[i.length-1]:Po(r.original||r,o,t)}function Ka(e,t,o){var a=Mo(e),i=Pc(a,t),r=a[a.length-1];return i.length?i[0]:Po(r.original||r,o,t)}function qa(e,t,o){var a=Mo(e),i=Vc(t,o),r=a[0];return Po(r.original||r,i,t)}function Ya(e,t,o){var a=Mo(e),i=Vc(t,o),r=a[a.length-1];return Po(r.original||r,i,t)}function Vc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Mo(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Pc(e,t){var o=k.map(e,nm);return k.filter(o,function(a){return tm(a,t)})}function tm(e,t){return Vt(t,e,1)==="intersect"}function nm(e){return e.original||e}function Ga(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ga.prototype.add=function(e,t){return this.addAll([e],t)},Ga.prototype.addAll=function(e,t){var o=Xp(e,!!t,this);return k.assign(this,o),this};function qn(e){this._modeling=e}qn.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},qn.prototype.moveClosure=function(e,t,o,a,i){var r=this._modeling,l=e.allShapes,c=e.allConnections,s=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===o&&(u=!0),k.forEach(l,function(f){r.moveShape(f,t,d[f.id]&&!u&&o,{recurse:!1,layout:!1})}),k.forEach(c,function(f){var h=!!l[f.source.id],m=!!l[f.target.id];s[f.id]&&h&&m?r.moveConnection(f,t,d[f.id]&&!u&&o):r.layoutConnection(f,{connectionStart:h&&qa(f,f.source,t),connectionEnd:m&&Ya(f,f.target,t)})})},qn.prototype.getClosure=function(e){return new Ga().addAll(e,!0)};function No(e){this._helper=new qn(e)}No.$inject=["modeling"],No.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},No.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function Xt(e){this._modeling=e,this._helper=new qn(e)}Xt.$inject=["modeling"],Xt.prototype.execute=function(e){var t=e.shape,o=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=Eo(r.children,t),Pt(a.children,t,i),k.assign(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Xt.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&(k.forEach(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:Ya(r,t,o)})}),k.forEach(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:qa(r,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Xt.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,i=e.delta;return Pt(o.children,t,a),k.assign(t,{parent:o,x:t.x-i.x,y:t.y-i.y}),t},Xt.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Xt.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Yn(e){this._modeling=e}Yn.$inject=["modeling"],Yn.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!o)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),o&&(e.oldTarget=a.target,a.target=o),a},Yn.prototype.postExecute=function(e){var t=e.connection,o=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&&(o&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||Mc(k.isArray(i)?i[0]:i)),a&&(!o||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||Mc(k.isArray(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},Yn.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),o&&(i.target=o),a&&(i.waypoints=a),i};function Mc(e){return e.original||e}function xt(e,t){this._modeling=e,this._rules=t}xt.$inject=["modeling","rules"],xt.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=e.hints||{},c;function s(p,g,y){return a.allowed("connection.reconnect",{connection:y,source:p,target:g})}var d={x:r.x,y:r.y},u={x:i.x,y:i.y,width:i.width,height:i.height};c=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&o.updateAttachment(c,i.host);var f;l.moveChildren!==!1&&(f=i.children.slice(),o.moveElements(f,{x:0,y:0},c,l));var h=i.incoming.slice(),m=i.outgoing.slice();k.forEach(h,function(p){var g=p.source,y=s(g,c,p);y&&t.reconnectEnd(p,c,Ka(p,c,u),l)}),k.forEach(m,function(p){var g=p.target,y=s(c,g,p);y&&t.reconnectStart(p,c,Ja(p,c,u),l)})},xt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},xt.prototype.execute=function(e){},xt.prototype.revert=function(e){},xt.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},xt.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},xt.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Gn(e){this._modeling=e}Gn.$inject=["modeling"],Gn.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Gn.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds,i=e.hints||{};i.layout!==!1&&(k.forEach(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:Ka(r,o,a)})}),k.forEach(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ja(r,o,a)})}))},Gn.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function om(e,t){var o=[];return k.forEach(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;k.forEach(i.concat(r),function(l){var c=l.source,s=l.target;(Xn(e,c)||Xn(e,s)||Xn(t,c)||Xn(t,s))&&(Xn(o,l)||o.push(l))})}),o}function Xn(e,t){return e.indexOf(t)!==-1}function am(e,t,o){var a=e.x,i=e.y,r=e.width,l=e.height,c=o.x,s=o.y;switch(t){case"n":return{x:a,y:i+s,width:r,height:l-s};case"s":return{x:a,y:i,width:r,height:l+s};case"w":return{x:a+c,y:i,width:r-c,height:l};case"e":return{x:a,y:i,width:r+c,height:l};default:throw new Error("unknown direction: "+t)}}function $t(e){this._modeling=e}$t.$inject=["modeling"],$t.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),k.forEach(i,function(c){l[c.id]=rm(c)}),this.resizeShapes(i,t,o),this.updateConnectionWaypoints(om(a,i),t,o,r,a,i,l)},$t.prototype.execute=function(){},$t.prototype.revert=function(){},$t.prototype.moveShapes=function(e,t){var o=this;k.forEach(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},$t.prototype.resizeShapes=function(e,t,o){var a=this;k.forEach(e,function(i){var r=am(i,o,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},$t.prototype.updateConnectionWaypoints=function(e,t,o,a,i,r,l){var c=this,s=i.concat(r);k.forEach(e,function(d){var u=d.source,f=d.target,h=im(d),m=$c(o),p={};Ot(s,u)&&Ot(s,f)?(h=k.map(h,function(g){return Oc(g,a,o)&&(g[m]=g[m]+t[m]),g.original&&Oc(g.original,a,o)&&(g.original[m]=g.original[m]+t[m]),g}),c._modeling.updateWaypoints(d,h,{labelBehavior:!1})):(Ot(s,u)||Ot(s,f))&&(Ot(i,u)?p.connectionStart=qa(d,u,t):Ot(i,f)?p.connectionEnd=Ya(d,f,t):Ot(r,u)?p.connectionStart=Ja(d,u,l[u.id]):Ot(r,f)&&(p.connectionEnd=Ka(d,f,l[f.id])),c._modeling.layoutConnection(d,p))})};function Nc(e){return k.assign({},e)}function im(e){return k.map(e.waypoints,function(t){return t=Nc(t),t.original&&(t.original=Nc(t.original)),t})}function $c(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Oc(e,t,o){var a=$c(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function Ot(e,t){return e.indexOf(t)!==-1}function rm(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function $o(e){this._modeling=e}$o.$inject=["modeling"],$o.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Rc(o),t.collapsed=!t.collapsed;var a=Ac(o,t.collapsed);return[t].concat(a)},$o.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,i=Lc(a,o);return t.collapsed=!t.collapsed,[t].concat(i)};function Rc(e){var t={};return k.forEach(e,function(o){t[o.id]=o.hidden,o.children&&(t=k.assign({},t,Rc(o.children)))}),t}function Ac(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(Ac(a.children,a.collapsed||t)))}),o}function Lc(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Lc(a.children,t)))}),o}function Oo(e){this._modeling=e}Oo.$inject=["modeling"],Oo.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Ic(a,t),zc(o,t),t.host=o,t},Oo.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,Ic(o,t),zc(a,t,i),t};function Ic(e,t){return Eo(e&&e.attachers,t)}function zc(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),Pt(a,t,o)}}function Xa(){}Xa.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},Xa.prototype.revert=function(e){var t=e.connection,o=e.oldWaypoints;return t.waypoints=o,t};function me(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}me.$inject=["eventBus","elementFactory","commandStack"],me.prototype.getHandlers=function(){return{"shape.append":_o,"shape.create":Nt,"shape.delete":Kn,"shape.move":Xt,"shape.resize":Gn,"shape.replace":xt,"shape.toggleCollapse":$o,spaceTool:$t,"label.create":Dn,"connection.create":Bo,"connection.delete":Jn,"connection.move":Da,"connection.layout":Vo,"connection.updateWaypoints":Xa,"connection.reconnect":Yn,"elements.create":Wa,"elements.move":No,"elements.delete":Ua,"elements.distribute":To,"elements.align":So,"element.updateAttachment":Oo}},me.prototype.registerHandlers=function(e){k.forEach(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},me.prototype.moveShape=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},me.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},me.prototype.moveElements=function(e,t,o,a){a=a||{};var i=a.attach,r=o,l;i===!0?(l=o,r=o.parent):i===!1&&(l=null);var c={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",c)},me.prototype.moveConnection=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},me.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},me.prototype.createConnection=function(e,t,o,a,i,r){typeof o=="object"&&(r=i,i=a,a=o,o=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:o,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},me.prototype.createShape=function(e,t,o,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,c;e=this._create("shape",e),r?(l=o.parent,c=o):l=o;var s={position:t,shape:e,parent:l,parentIndex:a,host:c,hints:i};return this._commandStack.execute("shape.create",s),s.shape},me.prototype.createElements=function(e,t,o,a,i){k.isArray(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:o,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},me.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var i={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",i),i.shape},me.prototype.appendShape=function(e,t,o,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:o,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},me.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},me.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},me.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},me.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},me.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},me.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},me.prototype.resizeShape=function(e,t,o,a){var i={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",i)},me.prototype.createSpace=function(e,t,o,a,i){var r={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},me.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},me.prototype.reconnect=function(e,t,o,a,i){var r={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},me.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,k.assign(a,{docking:"source"}))},me.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,k.assign(a,{docking:"target"}))},me.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},me.prototype._create=function(e,t){return Yh(t)?t:this._elementFactory.create(e,t)},me.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function Fc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Za(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function lm(e,t){Array.isArray(e)&&e.forEach(t)}function Ro(e){const t=e.businessObject;if(t)return t.name||""}function cm(e,t){const o=e.businessObject;return o.name=t,e}const sm={height:20},Hc=15;function Qa(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Wc(e){return Zn(e.label)}function dm(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=um(e),r=Math.atan((a.y-o.y)/(a.x-o.x));let{x:l,y:c}=i;return Math.abs(r)<Math.PI/2?c-=Hc:l+=Hc,{x:l,y:c}}function um(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function Uc(e){return e.waypoints?dm(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+sm.height/2}}function Zn(e){return e&&!!e.labelTarget}const fm={width:0,height:0};function Dc(e,t){function o(c,s){const d=c.label||c,u=c.labelTarget||c;return cm(d,s),[d,u]}function a(c){const{element:s,newLabel:d}=c,{businessObject:u}=s;if(!Zn(s)&&Qa(s)&&!Wc(s)&&!Jc(d)){let h=Uc(s);h={x:h.x,y:h.y+7},e.createLabel(s,h,{id:u.id+"_label",businessObject:u})}}function i(c){return c.oldLabel=Ro(c.element),o(c.element,c.newLabel)}function r(c){return o(c.element,c.oldLabel)}function l(c){const{element:s,newLabel:d}=c,u=s.label||s,f=c.hints||{};let{newBounds:h}=c;if(!Zn(u))return;if(Zn(u)&&Jc(d)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const m=Ro(u);typeof h>"u"&&(h=t.getExternalLabelBounds(u,m)),h&&e.resizeShape(u,h,fm)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}Dc.$inject=["modeling","textRenderer"];function Jc(e){return!e||!e.trim()}function Qn(e,t,o){me.call(this,e,t,o)}Ht(Qn,me),Qn.$inject=["eventBus","elementFactory","commandStack"],Qn.prototype.getHandlers=function(){const e=me.prototype.getHandlers.call(this);return e["element.updateLabel"]=Dc,e},Qn.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function ei(e,t){Ke.call(this,e);function o(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"],o)}Ht(ei,Ke),ei.$inject=["eventBus","connectionDocking"];function Kc(){}Kc.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Te(t.source||e.source),t.connectionEnd||Te(t.target||e.target)]};var Ao=20,pm=5,Lo=Math.round,qc=20,hm={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function mm(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function gm(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Yc(e,t,o){var a=Vt(t,e,pm),i=o.split(":")[0],r=Lo((t.x-e.x)/2+e.x),l=Lo((t.y-e.y)/2+e.y),c,s,d=gm(i,a),u=/h|r|l/.test(i),f=!1,h=!1;return d?(c=u?{x:r,y:e.y}:{x:e.x,y:l},s=u?"h:h":"v:v"):(f=mm(a,i),s=u?"h:v":"v:h",f?u?(h=l===e.y,c={x:e.x+Ao*(/l/.test(i)?-1:1),y:h?l+Ao:l}):(h=r===e.x,c={x:h?r+Ao:r,y:e.y+Ao*(/t/.test(i)?-1:1)}):c={x:r,y:l}),{waypoints:ti(e,c,s).concat(c),directions:s,turnNextDirections:h}}function ym(e,t,o){return Yc(e,t,o)}function vm(e,t,o){var a=Yc(t,e,Gc(o));return{waypoints:a.waypoints.slice().reverse(),directions:Gc(a.directions),turnNextDirections:a.turnNextDirections}}function bm(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=o+":"+a,r=ti(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:r,directions:i}}function Gc(e){return e.split(":").reverse().join(":")}function xm(e,t,o){var a=Lo((t.x-e.x)/2+e.x),i=Lo((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function ti(e,t,o){if(o=o||"h:h",!Tm(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Zc(o)){var a=ym(e,t,o),i=vm(e,t,o),r=bm(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return xm(e,t,o)}function wm(e,t,o){var a=ti(e,t,o);return a.unshift(e),a.push(t),es(a)}function Cm(e,t,o,a,i){var r=i&&i.preferredLayouts||[],l=k.without(r,"straight")[0]||"h:h",c=hm[l]||0,s=Vt(e,t,c),d=jm(s,l);o=o||Te(e),a=a||Te(t);var u=d.split(":"),f=Qc(o,e,u[0],Vm(s)),h=Qc(a,t,u[1],s);return wm(f,h,d)}function km(e,t,o,a,i,r){k.isArray(o)&&(i=o,r=a,o=Te(e),a=Te(t)),r=k.assign({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts,c=l.indexOf("straight")!==-1,s;return s=c&&Sm(e,t,o,a,r),s||(s=r.connectionEnd&&Bm(t,e,a,i),s)||(s=r.connectionStart&&_m(e,t,o,i),s)?s:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:Cm(e,t,o,a,r)}function Em(e,t,o){return e>=t&&e<=o}function Xc(e,t,o){var a={x:"width",y:"height"};return Em(t[e],o[e],o[e]+o[a[e]])}function Sm(e,t,o,a,i){var r={},l,c;return c=Vt(e,t),/^(top|bottom|left|right)$/.test(c)?(/top|bottom/.test(c)&&(l="x"),/left|right/.test(c)&&(l="y"),i.preserveDocking==="target"?Xc(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y,original:{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y}},{x:a.x,y:a.y}]):null:Xc(l,o,t)?(r[l]=o[l],[{x:o.x,y:o.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 _m(e,t,o,a){return ni(e,t,o,a)}function Bm(e,t,o,a){var i=a.slice().reverse();return i=ni(e,t,o,i),i?i.reverse():null}function ni(e,t,o,a){function i(u){return u.length<3?!0:u.length>4?!1:!!k.find(u,function(f,h){var m=u[h-1];return m&&Hn(f,m)<3})}function r(u,f,h){var m=_t(f,u);switch(m){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 m;for(m=u.length-2;m!==0;m--)if(Kl(u[m],f,qc)||Kl(u[m],h,qc))return u.slice(m);return u}if(i(a))return null;var c=a[0],s=a.slice(),d;return s[0]=o,s[1]=r(s[1],c,o),d=l(s,e,t),d!==s&&(s=ni(e,t,o,d)),s&&_t(s)?null:s}function jm(e,t){if(Zc(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 Tm(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Zc(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 Qc(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function es(e){return e.reduce(function(t,o,a){var i=t[t.length-1],r=e[a+1];return Pa(i,r,o,0)||t.push(o),t},[])}function oi(){}Ht(oi,Kc);const Zt=(e,t)=>e.type===t;oi.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,c,s;return l===void 0&&(r=Io(i&&i[0],o),l=Io(i&&i[i.length-1],a)),r||(r=Io(i&&i[0],o)),l||(l=Io(i&&i[i.length-1],a)),Zt(e,"myline")&&(o===a?c={preferredLayouts:Pm(o,e)}:Zt(o,"gatewayAnd")||Zt(o,"gatewayXor")||Zt(o,"gatewayInclusive")?c={preferredLayouts:["v:h"]}:Zt(a,"gatewayAnd")||Zt(a,"gatewayXor")||Zt(a,"gatewayInclusive")?c={preferredLayouts:["h:v"]}:c={preferredLayouts:["h:h"]}),c&&(c=_e(c,t),s=es(km(o,a,r,l,i,c))),s||[r,l]};function Io(e,t){return e?e.original||e:Te(t)}function Pm(e,t){const{waypoints:o}=t,a=o&&o.length&&Vt(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function ts(e){return k.assign({original:e.point.original||e.point},e.actual)}function Rt(e,t){this._elementRegistry=e,this._graphicsFactory=t}Rt.$inject=["elementRegistry","graphicsFactory"],Rt.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,o),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(ts(a)),r.push(ts(i)),r},Rt.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,i,r,l;return i=o?0:a.length-1,r=a[i],l=this._getIntersection(t,e,o),{point:r,actual:l||r,idx:i}},Rt.prototype._getIntersection=function(e,t,o){var a=this._getShapePath(e),i=this._getConnectionPath(t);return Oa(a,i,o)},Rt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Rt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Rt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const ns={__depends__:[Lh,Hh,wn],__init__:["modeling","elementUpdater"],modeling:["type",Qn],layouter:["type",oi],elementUpdater:["type",ei],elementFactory:["type",Gt],connectionDocking:["type",Rt]};var Mm=1e3;function Qt(e,t){var o=this;t=t||Mm,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,c=i.gfx,s=i.attrs;if(o.canRender(l))return r==="render.shape"?o.drawShape(c,l,s):o.drawConnection(c,l,s)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(o.canRender(i))return a.type==="render.getShapePath"?o.getShapePath(i):o.getConnectionPath(i)})}Qt.prototype.canRender=function(e){},Qt.prototype.drawShape=function(e,t){},Qt.prototype.drawConnection=function(e,t){},Qt.prototype.getShapePath=function(e){},Qt.prototype.getConnectionPath=function(e){};function Nm(e){return e.businessObject}function zo(e,t){return e.businessObject.strokeWidth||t||1}function rt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ve(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function $m(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2,i=[["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]];return zn(i)}function Om(e,t){const{x:o,y:a,width:i,height:r}=e,l=[["M",o+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 zn(l)}function Rm(e){const{x:t,y:o,width:a,height:i}=e,r=a/2,l=i/2,c=[["M",t+r,o],["l",r,l],["l",-r,l],["l",-r,-l],["z"]];return zn(c)}function Am(e){const{x:t,y:o,width:a,height:i}=e,r=[["M",t,o],["l",a,0],["l",0,i],["l",-a,0],["z"]];return zn(r)}const ai=10,ii=.95,At=(e,t)=>e.type===t;function en(e,t,o,a,i,r,l){Qt.call(this,e,l);const c="var(--j-color-bg-container)",s="var(--j-color-text)",d={};Object.keys(r.palette).forEach(P=>{const E=r.palette[P];d[E.type]=E.options});const{computeStyle:u}=t;function f(P){return z[P]}function h(P){return t.computeStyle(P,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:s,strokeWidth:2})}function m(P){return t.computeStyle(P,{strokeLinecap:"round",strokeLinejoin:"round",stroke:s,strokeWidth:2,fill:"white"})}function p(P,E,$,R){$=h($);const q=Ea(E,$,R);return M.append(P,q),q}function g(P,E,$){return p(P,E,$,5)}function y(P,E,$,R,q){Fc(R)&&(q=R,R=0),R=R||0,q=u(q,{stroke:s,strokeWidth:2,fill:c}),q.fill==="none"&&delete q.fillOpacity;const ee=E/2,ce=$/2,de=M.create("circle");return M.attr(de,{cx:ee,cy:ce,r:Math.round((E+$)/4-R)}),M.attr(de,q),M.append(P,de),de}function x(P,E,$,R,q,ee){Fc(q)&&(ee=q,q=0),q=q||0,ee=u(ee,{stroke:s,strokeWidth:2,fill:c});const ce=M.create("rect");return M.attr(ce,{x:q,y:q,width:E-q*2,height:$-q*2,rx:R,ry:R}),M.attr(ce,ee),M.append(P,ce),ce}function b(P,E,$){$=u($,["no-fill"],{strokeWidth:2,stroke:s});const R=M.create("path");return M.attr(R,{d:E}),M.attr(R,$),M.append(P,R),R}function w(P,E,$,R){const q=E/2,ee=$/2,de=[{x:q,y:0},{x:E,y:ee},{x:q,y:$},{x:0,y:ee}].map(J=>J.x+","+J.y).join(" ");R=u(R,{stroke:s,strokeWidth:2,fill:c});const Pe=M.create("polygon");return M.attr(Pe,{points:de}),M.attr(Pe,R),M.append(P,Pe),Pe}function C(P,E,$,R){return b(E,$,_e({"data-marker":P},R))}function S(P,E,$){$=_e({size:{width:100}},$);const R=i.createText(E||"",$);return M.classes(R).add("djs-label"),M.append(P,R),R}function v(P,E,$){const R=Nm(E);return S(P,R.name,{box:E,align:$,padding:5,style:{fill:Ve(E,s)}})}function j(P,E){const $={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return S(P,Ro(E),{box:$,fitBox:!0,style:_e({},i.getExternalStyle(),{fill:Ve(E,s)})})}function _(P,E,$){const R=$&&$.indexOf("SubProcessMarker")!==-1;let q;R?q={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:q={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},lm($,ee=>{f(ee)(P,E,q)})}function B(P){return P.replace(/[^0-9a-zA-z]+/g,"_")}function V(P,E){const{ref:$={x:0,y:0},scale:R=1,element:q,parentGfx:ee=a._svg}=E,ce=M.create("marker",{id:P,viewBox:"0 0 20 20",refX:$.x,refY:$.y,markerWidth:20*R,markerHeight:20*R,orient:"auto"});M.append(ce,q);let de=A.query(":scope > defs",ee);de||(de=M.create("defs"),M.append(ee,de)),M.append(de,ce)}function T(P,E,$,R){const q=E+"-"+B($)+"-"+B(R)+"-"+vc();return L(P,q,E,$,R),"url(#"+q+")"}function L(P,E,$,R,q){{const ee=M.create("path",{d:"M 1 5 L 11 10 L 1 15 Z",...m({fill:q,stroke:q,strokeWidth:1})});V(E,{element:ee,ref:{x:11,y:10},scale:.5,parentGfx:P})}}function F(P,E,$,R){const q=d[E.type]?.icon||E.icon;if(q){const ee=o.getScaledPath(q,{abspos:{x:$,y:R}});b(P,ee,{strokeWidth:0,fill:Ve(E,d[E.type]?.iconFill||E.iconFill)})}}const z={event(P,E,$){return"fillOpacity"in $||($.fillOpacity=ii),y(P,E.width,E.height,$)},startEvent(P,E){const $={fill:rt(E,d.startEvent?.fill||E.fill),stroke:Ve(E,d.startEvent?.stroke||E.stroke),strokeWidth:zo(E,d.startEvent?.strokeWidth||E.strokeWidth)},R=f("event")(P,E,$);return F(P,E,18,18),R},endEvent(P,E){const $=f("event")(P,E,{strokeWidth:zo(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:rt(E,d.endEvent?.fill||E.fill),stroke:Ve(E,d.endEvent?.stroke||E.stroke)});return F(P,E,18,18),$},gateway(P,E){const $={fillOpacity:ii,strokeWidth:zo(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)};return w(P,E.width,E.height,$)},gatewayAnd(P,E){const $=f("gateway")(P,E),R=o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[E.type]?.width||E.width,containerHeight:d[E.type]?.height||E.height,position:{mx:.47,my:.29}});return b(P,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayXor(P,E){const $=f("gateway")(P,E),R=o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}});return b(P,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayInclusive(P,E){const $=f("gateway")(P,E);return y(P,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Ve(E,c),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},activity(P,E,$){return $=$||{},"fillOpacity"in $||($.fillOpacity=ii),x(P,E.width,E.height,ai,$)},task(P,E){const $={fill:rt(E,c),stroke:Ve(E,s)},R=f("activity")(P,E,$);return v(P,E,"center-middle"),_(P,E),R},userTask(P,E){const $=f("task")(P,E),R=15,q=12,ee=o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:R,y:q}});b(P,ee,{strokeWidth:.5,fill:rt(E,c),stroke:Ve(E,s)});const ce=o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:R,y:q}});b(P,ce,{strokeWidth:.5,fill:rt(E,c),stroke:Ve(E,s)});const de=o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:R,y:q}});return b(P,de,{strokeWidth:.5,fill:Ve(E,s),stroke:Ve(E,s)}),$},scriptTask(P,E){const $=f("task")(P,E),R=o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(P,R,{strokeWidth:1,stroke:Ve(E,s)}),$},SubProcessMarker(P,E){const $=x(P,14,14,0,{strokeWidth:1,fill:rt(E,c),stroke:Ve(E,s)});ut($,E.width/2-7.5,E.height-20);const R=o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});C("sub-process",P,R,{fill:rt(E,c),stroke:Ve(E,s)})},subprocess(P,E,$){$=_e({fill:rt(E,c),stroke:Ve(E,s)},$);const R=f("activity")(P,E,$);return v(P,E,"center-middle"),_(P,E,["SubProcessMarker"]),R},label(P,E){return j(P,E)},myline(P,E){const $=rt(E,r.lineStroke||c),R=Ve(E,r.lineStroke||s);return g(P,E.waypoints,{markerEnd:T(P,"sequenceflow-end",$,R),stroke:R})},default(P,E){const $={strokeWidth:zo(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)},R=x(P,E.width,E.height,E.radius||ai,$);return v(P,E,"center-middle"),_(P,E),F(P,E,E.iconX,E.iconY),R}};this.handlers=z,this._drawPath=b}Ht(en,Qt),en.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],en.prototype.canRender=function(){return!0},en.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},en.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},en.prototype.getShapePath=function(e){return At(e,"startEvent")||At(e,"endEvent")?$m(e):At(e,"userTask")||At(e,"scriptTask")||At(e,"subprocess")?Om(e,ai):At(e,"gatewayAnd")||At(e,"gatewayXor")||At(e,"gatewayInclusive")?Rm(e):Am(e)};var Lm=0,Im={width:150,height:50};function zm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Fm(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 Hm(e,t){t.textContent=e;var o;try{var a,i=e==="";return t.textContent=i?"dummy":e,o=t.getBBox(),a={width:o.width+o.x*2,height:o.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function Wm(e,t,o){for(var a=e.shift(),i=a,r;;){if(r=Hm(i,o),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return Um(e,i,a,r);i=Jm(i,r.width,t)}}function Um(e,t,o,a){if(t.length<o.length){var i=o.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var os="­";function Dm(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(o.length>1)for(;a=o.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===os)&&i.pop();break}var l=i[i.length-1];return l&&l===os&&(i[i.length-1]="-"),i.join("")}function Jm(e,t,o){var a=Math.max(e.length*(o/t),1),i=Dm(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Km(){var e=document.getElementById("helper-svg");return e||(e=M.create("svg"),M.attr(e,{id:"helper-svg"}),A.assignStyle(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Fo(e){this._config=k.assign({},{size:Im,padding:Lm,style:{},align:"center-top"},e||{})}Fo.prototype.createText=function(e,t){return this.layoutText(e,t).element},Fo.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Fo.prototype.layoutText=function(e,t){var o=k.assign({},this._config.size,t.box),a=k.assign({},this._config.style,t.style),i=zm(t.align||this._config.align),r=Fm(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,c=qm(a),s=e.split(/\u00AD?\r?\n/),d=[],u=o.width-r.left-r.right,f=M.create("text");M.attr(f,{x:0,y:0}),M.attr(f,a);var h=Km();for(M.append(h,f);s.length;)d.push(Wm(s,u,f));i.vertical==="middle"&&(r.top=r.bottom=0);var m=k.reduce(d,function(b,w,C){return b+(c||w.height)},0)+r.top+r.bottom,p=k.reduce(d,function(b,w,C){return w.width>b?w.width:b},0),g=r.top;i.vertical==="middle"&&(g+=(o.height-m)/2),g-=(c||d[0].height)/4;var y=M.create("text");M.attr(y,a),k.forEach(d,function(b){var w;switch(g+=c||b.height,i.horizontal){case"left":w=r.left;break;case"right":w=(l?p:u)-r.right-b.width;break;default:w=Math.max(((l?p:u)-b.width)/2+r.left,0)}var C=M.create("tspan");M.attr(C,{x:w,y:g}),C.textContent=b.text,M.append(y,C)}),M.remove(f);var x={width:p,height:m};return{dimensions:x,element:y}};function qm(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const Ym=12,Gm=1.2,Xm=30;function as(e){const t=_e({fontFamily:"Arial, sans-serif",fontSize:Ym,fontWeight:"normal",lineHeight:Gm},e&&e.defaultStyle||{}),o=parseInt(t.fontSize,10)-1,a=_e({},t,{fontSize:o},e&&e.externalStyle||{}),i=new Fo({style:t});this.getExternalLabelBounds=function(r,l){const c=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-c.width/2),y:Math.round(r.y),width:Math.ceil(c.width),height:Math.ceil(c.height)}},this.getTextAnnotationBounds=function(r,l){const c=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(Xm,Math.round(c.height))}},this.createText=function(r,l){return i.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return a}}as.$inject=["config.textRenderer"];function Zm(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,i;o.abspos?(a=o.abspos.x,i=o.abspos.y):(a=o.containerWidth*o.position.mx,i=o.containerHeight*o.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(o.position){const s=o.containerHeight/r.height*o.yScaleFactor,d=o.containerWidth/r.width*o.xScaleFactor;for(let u=0;u<r.heightElements.length;u++)l["y"+u]=r.heightElements[u]*s;for(let u=0;u<r.widthElements.length;u++)l["x"+u]=r.widthElements[u]*d}return ng(r.d,{mx:a,my:i,e:l})}}const Qm=/\{([^}]+)\}/g,eg=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function tg(e,t,o){let a=o;return t.replace(eg,(i,r,l,c,s)=>{r=r||c,a&&(r in a&&(a=a[r]),typeof a=="function"&&s&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function ng(e,t){return String(e).replace(Qm,(o,a)=>tg(o,a,t))}const is={__init__:["myRenderer"],myRenderer:["type",en],textRenderer:["type",as],pathMap:["type",Zm]};function rs(e,t){return _e({id:e.id,type:e.type,businessObject:e},t)}function og(e,t,o){const a=e.waypoint;return!a||a.length<2?[Te(t),Te(o)]:a.map(i=>({x:i.x,y:i.y}))}function Lt(e,t,o,a,i,r){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=i,this._translate=bc,this._textRenderer=r,this._modeling=t}Lt.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Lt.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(rs(e,{source:a,target:i,waypoints:og(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(rs(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Lt.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},Lt.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=_e(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name: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}),o&&this.addLabel(r,o)}}},Lt.prototype._getSource=function(e){return this._getElement(e.from)},Lt.prototype._getTarget=function(e){return this._getElement(e.to)},Lt.prototype._getElement=function(e){return this._elementRegistry.get(e)};const ls={myImporter:["type",Lt]},cs=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},ss=(e,t)=>{const o=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{o.add(r)}),i.forEach(r=>{o.add(r)})},ag=n.defineComponent({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let c,s=1;const d=()=>{s=1,c.get("canvas").zoom("fit-viewport")},u=()=>{const v=c.get("eventBus");v.on("element.dblclick",j=>{i("elementDblclick",j.element.businessObject)}),v.on("element.click",j=>{i("elementClick",j.element.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let v={__init__:["myOptions"],myOptions:["type",f]};c=new $i({canvas:{container:r.value},modules:[Aa,Jl,ns,fc,mc,v,is,ls]});const j=c.get("canvas"),_=c.get("elementFactory");d();const B=_.createRoot();j.setRootElement(B),u()};n.onMounted(()=>{h()});const m=v=>{const j=v==null?1:s+v;c.get("canvas").zoom(j),s=j},p=()=>{c.get("canvas").zoom(1);const v=c.get("elementRegistry").getAll();var j=cs(v);return j},g=v=>{c.clear(),d(),ss(v,c)},y=v=>{c.get("myImporter").update(v.id,v)};return t({reset:()=>{d()},zoom:v=>{m(v)},getData:()=>p(),setData:v=>{g(v)},updateElemet:v=>{y(v)}}),(v,j)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}});function ri(e){return e&&e[e.length-1]}function ds(e){return e.y}function us(e){return e.x}var ig={left:us,center:us,right:function(e){return e.x+e.width},top:ds,middle:ds,bottom:function(e){return e.y+e.height}};function jn(e,t){this._modeling=e,this._rules=t}jn.$inject=["modeling","rules"],jn.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},jn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},jn.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,i=o.dimension,r={},l={},c=!1,s,d,u;function f(h,m){return Math.round((h[a]+m[a]+m[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ri(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if(k.forEach(t,function(h){var m=h[a]+Math.round(h[i]/2);l[m]?l[m].elements.push(h):l[m]={elements:[h],center:m}}),s=k.sortBy(l,function(h){return h.elements.length>1&&(c=!0),h.elements.length}),c)return r[e]=ri(s).center,r;d=t[0],t=k.sortBy(t,function(h){return h[a]+h[i]}),u=ri(t),r[e]=f(d,u)}return r},jn.prototype.trigger=function(e,t){var o=this._modeling,a,i=k.filter(e,function(s){return!(s.waypoints||s.host||s.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),k.isArray(a)&&(i=a),!(i.length<2||!a)){var r=ig[t],l=k.sortBy(i,r),c=this._alignmentPosition(t,l);o.alignElements(l,c)}};const rg={__init__:["alignElements"],alignElements:["type",jn]};var Ho=Math.round,lg=Math.max;function cg(e,t){var o=e.x,a=e.y;return[["M",o,a],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function sg(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var fs=10;function dg(e,t){var o,a;for(o=0;a=e[o];o++)if(Hn(a,t)<=fs)return{point:e[o],bendpoint:!0,index:o};return null}function ug(e,t){var o=tc(cg(t,fs),sg(e)),a=o[0],i=o[o.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=lg(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Ho(a.x+i.x)/2,y:Ho(a.y+i.y)/2},index:a.segment2}:{point:{x:Ho(a.x),y:Ho(a.y)},index:a.segment2}:null}function fg(e,t){return dg(e,t)||ug(e,t)}function pg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function hg(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[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 ps(e,t){var o=t[0],a=t[1],i={x:a.x-o.x,y:a.y-o.y},r=hg([o.x,o.y],[i.x,i.y],[e.x,e.y]);return{x:o.x+r*i.x,y:o.y+r*i.y}}function mg(e,t){var o=ps(e,t),a={x:o.x-e.x,y:o.y-e.y};return pg(a)}var hs="djs-bendpoint",ms="djs-segment-dragger";function gg(e,t){var o=bn(t),a=e._container.getBoundingClientRect(),i;i={x:a.left,y:a.top};var r=e.viewbox();return{x:r.x+(o.x-i.x)/r.scale,y:r.y+(o.y-i.y)/r.scale}}function li(e,t,o){var a=gg(e,o),i=fg(t,a);return i}function ci(e,t){var o=M.create("g");M.classes(o).add(hs),M.append(e,o);var a=M.create("circle");M.attr(a,{cx:0,cy:0,r:4}),M.classes(a).add("djs-visual"),M.append(o,a);var i=M.create("circle");return M.attr(i,{cx:0,cy:0,r:10}),M.classes(i).add("djs-hit"),M.append(o,i),t&&M.classes(o).add(t),o}function yg(e,t,o,a){var i=M.create("g");M.append(e,i);var r=18,l=6,c=11,s=bg(t,o,a),d=l+c,u=M.create("rect");M.attr(u,{x:-r/2,y:-l/2,width:r,height:l}),M.classes(u).add("djs-visual"),M.append(i,u);var f=M.create("rect");return M.attr(f,{x:-s/2,y:-d/2,width:s,height:d}),M.classes(f).add("djs-hit"),M.append(i,f),ah(i,a==="v"?90:0),i}function gs(e,t,o){var a=M.create("g"),i=Ma(t,o),r=_t(t,o);return M.append(e,a),yg(a,t,o,r),M.classes(a).add(ms),M.classes(a).add(r==="h"?"horizontal":"vertical"),ut(a,i.x,i.y),a}function si(e){return Math.abs(Math.round(e*2/3))}function vg(e,t){var o=xg(e,t);return ps(e,o)}function bg(e,t,o){var a=t.x-e.x,i=t.y-e.y;return si(o==="h"?a:i)}function xg(e,t){for(var o=t.waypoints,a=1/0,i,r=0;r<o.length-1;r++){var l=o[r],c=o[r+1],s=mg(e,[l,c]);s<a&&(a=s,i=r)}return[o[i],o[i+1]]}function di(e){return CSS.escape(e)}function ys(e,t,o,a,i){function r(w,C,S){var v=w.index,j=w.point,_,B,V,T,L,F;return v<=0||w.bendpoint?!1:(_=C[v-1],B=C[v],V=Ma(_,B),T=_t(_,B),L=Math.abs(j.x-V.x),F=Math.abs(j.y-V.y),T&&L<=S&&F<=S)}function l(w,C){var S=w.waypoints,v,j,_,B;return C.index<=0||C.bendpoint||(v={start:S[C.index-1],end:S[C.index]},j=_t(v.start,v.end),!j)?null:(j==="h"?_=v.end.x-v.start.x:_=v.end.y-v.start.y,B=si(_)/2,B)}function c(w,C){var S=C.waypoints,v=li(t,S,w),j;if(v)return j=l(C,v),r(v,S,j)?i.start(w,C,v.index):a.start(w,C,v.index,!v.bendpoint),!0}function s(w,C,S){A.event.bind(w,C,function(v){o.triggerMouseEvent(C,v,S),v.stopPropagation()})}function d(w,C){var S=t.getLayer("overlays"),v=A.query('.djs-bendpoints[data-element-id="'+di(w.id)+'"]',S);return!v&&C&&(v=M.create("g"),M.attr(v,{"data-element-id":w.id}),M.classes(v).add("djs-bendpoints"),M.append(S,v),s(v,"mousedown",w),s(v,"click",w),s(v,"dblclick",w)),v}function u(w,C){return A.query('.djs-segment-dragger[data-segment-idx="'+w+'"]',C)}function f(w,C){C.waypoints.forEach(function(S,v){var j=ci(w);M.append(w,j),ut(j,S.x,S.y)}),ci(w,"floating")}function h(w,C){for(var S=C.waypoints,v,j,_,B=1;B<S.length;B++)v=S[B-1],j=S[B],_t(v,j)&&(_=gs(w,v,j),M.attr(_,{"data-segment-idx":B}),s(_,"mousemove",C))}function m(w){k.forEach(A.queryAll("."+hs,w),function(C){M.remove(C)})}function p(w){k.forEach(A.queryAll("."+ms,w),function(C){M.remove(C)})}function g(w){var C=d(w);return C||(C=d(w,!0),f(C,w),h(C,w)),C}function y(w){var C=d(w);C&&(p(C),m(C),h(C,w),f(C,w))}function x(w,C){var S=A.query(".floating",w),v=C.point;S&&ut(S,v.x,v.y)}function b(w,C,S){var v=u(C.index,w),j=S[C.index-1],_=S[C.index],B=C.point,V=Ma(j,_),T=_t(j,_),L,F;v&&(L=wg(v),F={x:B.x-V.x,y:B.y-V.y},T==="v"&&(F={x:F.y,y:F.x}),ut(L,F.x,F.y))}e.on("connection.changed",function(w){y(w.element)}),e.on("connection.remove",function(w){var C=d(w.element);C&&M.remove(C)}),e.on("element.marker.update",function(w){var C=w.element,S;C.waypoints&&(S=g(C),w.add?M.classes(S).add(w.marker):M.classes(S).remove(w.marker))}),e.on("element.mousemove",function(w){var C=w.element,S=C.waypoints,v,j;if(S){if(v=d(C,!0),j=li(t,S,w.originalEvent),!j)return;x(v,j),j.bendpoint||b(v,j,S)}}),e.on("element.mousedown",function(w){if(Et(w)){var C=w.originalEvent,S=w.element;if(S.waypoints)return c(C,S)}}),e.on("selection.changed",function(w){var C=w.newSelection,S=C[0];S&&S.waypoints&&g(S)}),e.on("element.hover",function(w){var C=w.element;C.waypoints&&(g(C),o.registerEvent(w.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(w){o.unregisterEvent(w.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(w){var C=w.element,S=w.newId;if(C.waypoints){var v=d(C);v&&M.attr(v,{"data-element-id":S})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}ys.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function wg(e){return A.query(".djs-visual",e)}var vs=Math.round,tn="reconnectStart",nn="reconnectEnd",eo="updateWaypoints";function ui(e,t,o,a,i,r){this._injector=e,this.start=function(l,c,s,d){var u=o.getGraphics(c),f=c.source,h=c.target,m=c.waypoints,p;!d&&s===0?p=tn:!d&&s===m.length-1?p=nn:p=eo;var g=p===eo?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(g,{connection:c,source:f,target:h});y===!1&&(y=i.allowed(g,{connection:c,source:h,target:f})),y!==!1&&a.init(l,"bendpoint.move",{data:{connection:c,connectionGfx:u,context:{allowed:y,bendpointIndex:s,connection:c,source:f,target:h,insert:d,type:p}}})},t.on("bendpoint.move.hover",function(l){var c=l.context,s=c.connection,d=s.source,u=s.target,f=l.hover,h=c.type;c.hover=f;var m;if(f){var p=h===eo?"connection.updateWaypoints":"connection.reconnect";if(m=c.allowed=i.allowed(p,{connection:s,source:h===tn?f:d,target:h===nn?f:u}),m){c.source=h===tn?f:d,c.target=h===nn?f:u;return}m===!1&&(m=c.allowed=i.allowed(p,{connection:s,source:h===nn?f:u,target:h===tn?f:d})),m&&(c.source=h===nn?f:u,c.target=h===tn?f:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var c=l.context,s=c.type;c.hover=null,c.source=null,c.target=null,s!==eo&&(c.allowed=!1)}),t.on("bendpoint.move.end",function(l){var c=l.context,s=c.allowed,d=c.bendpointIndex,u=c.connection,f=c.insert,h=u.waypoints.slice(),m=c.source,p=c.target,g=c.type,y=c.hints||{},x={x:vs(l.x),y:vs(l.y)};if(!s)return!1;g===eo?(f?h.splice(d,0,x):h[d]=x,y.bendpointMove={insert:f,bendpointIndex:d},h=this.cropWaypoints(u,h),r.updateWaypoints(u,jh(h),y)):(g===tn?(y.docking="source",Wo(c)&&(y.docking="target",y.newWaypoints=h.reverse())):g===nn&&(y.docking="target",Wo(c)&&(y.docking="source",y.newWaypoints=h.reverse())),r.reconnect(u,m,p,x,y))},this)}ui.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ui.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Wo(e){var t=e.hover,o=e.source,a=e.target,i=e.type;if(i===tn)return t&&a&&t===a&&o!==a;if(i===nn)return t&&o&&t===o&&o!==a}var Cg="reconnectStart",kg="reconnectEnd",bs="updateWaypoints",to="connect-ok",Uo="connect-not-ok",xs="connect-hover",ws="djs-updating",Cs="djs-dragging",ks=1100;function Es(e,t,o,a){this._injector=t;var i=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(r){var l=r.context,c=l.bendpointIndex,s=l.connection,d=l.insert,u=s.waypoints,f=u.slice();l.waypoints=u,d&&f.splice(c,0,{x:r.x,y:r.y}),s.waypoints=f;var h=l.draggerGfx=ci(a.getLayer("overlays"));M.classes(h).add("djs-dragging"),a.addMarker(s,Cs),a.addMarker(s,ws)}),o.on("bendpoint.move.hover",function(r){var l=r.context,c=l.allowed,s=l.hover,d=l.type;if(s){if(a.addMarker(s,xs),d===bs)return;c?(a.removeMarker(s,Uo),a.addMarker(s,to)):c===!1&&(a.removeMarker(s,to),a.addMarker(s,Uo))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],ks,function(r){var l=r.context,c=l.hover,s=l.target;c&&(a.removeMarker(c,xs),a.removeMarker(c,s?to:Uo))}),o.on("bendpoint.move.move",function(r){var l=r.context,c=l.allowed,s=l.bendpointIndex,d=l.draggerGfx,u=l.hover,f=l.type,h=l.connection,m=h.source,p=h.target,g=h.waypoints.slice(),y={x:r.x,y:r.y},x=l.hints||{},b={};i&&(x.connectionStart&&(b.connectionStart=x.connectionStart),x.connectionEnd&&(b.connectionEnd=x.connectionEnd),f===Cg?Wo(l)?(b.connectionEnd=b.connectionEnd||y,b.source=p,b.target=u||m,g=g.reverse()):(b.connectionStart=b.connectionStart||y,b.source=u||m,b.target=p):f===kg?Wo(l)?(b.connectionStart=b.connectionStart||y,b.source=u||p,b.target=m,g=g.reverse()):(b.connectionEnd=b.connectionEnd||y,b.source=m,b.target=u||p):(b.noCropping=!0,b.noLayout=!0,g[s]=y),f===bs&&(g=e.cropWaypoints(h,g)),b.waypoints=g,i.drawPreview(l,c,b)),ut(d,r.x,r.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],ks,function(r){var l=r.context,c=l.connection,s=l.draggerGfx,d=l.hover,u=l.target,f=l.waypoints;c.waypoints=f,M.remove(s),a.removeMarker(c,ws),a.removeMarker(c,Cs),d&&(a.removeMarker(d,to),a.removeMarker(d,u?to:Uo)),i&&i.cleanUp(l)})}Es.$inject=["bendpointMove","injector","eventBus","canvas"];var Ss="connect-hover",_s="djs-updating";function Bs(e,t,o){return fi(e,t,e[t]+o)}function fi(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function Eg(e,t,o,a){var i=Math.max(t[a],o[a]),r=Math.min(t[a],o[a]),l=20,c=Math.min(Math.max(r+l,e[a]),i-l);return fi(t,a,c)}function js(e){return e==="x"?"y":"x"}function Ts(e,t,o){var a,i;return e.original?e.original:(a=Te(t),i=js(o),fi(e,i,a[i]))}function Vs(e,t,o,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(f,h,m){var p,g=o.getGraphics(h),y=m-1,x=m,b=h.waypoints,w=b[y],C=b[x],S=li(o,b,f),v,j,_;v=_t(w,C),v&&(j=v==="v"?"x":"y",y===0&&(w=Ts(w,h.source,j)),x===b.length-1&&(C=Ts(C,h.target,j)),S?_=S.point:_={x:(w.x+C.x)/2,y:(w.y+C.y)/2},p={connection:h,segmentStartIndex:y,segmentEndIndex:x,segmentStart:w,segmentEnd:C,axis:j,dragPosition:_},a.init(f,_,"connectionSegment.move",{cursor:j==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:g,context:p}}))};function c(f,h){if(!l)return h;var m=f.waypoints,p;return f.waypoints=h,p=l.getCroppedWaypoints(f),f.waypoints=m,p}function s(f){i.update("connection",f.connection,f.connectionGfx)}function d(f,h,m){var p=f.newWaypoints,g=f.segmentStartIndex+h,y=p[g],x=f.segmentEndIndex+h,b=p[x],w=js(f.axis),C=Eg(m,y,b,w);ut(f.draggerGfx,C.x,C.y)}function u(f,h){var m=0,p=f.filter(function(g,y){return Pa(f[y-1],f[y+1],g)?(m=y<=h?m-1:m,!1):!0});return{waypoints:p,segmentOffset:m}}t.on("connectionSegment.move.start",function(f){var h=f.context,m=f.connection,p=o.getLayer("overlays");h.originalWaypoints=m.waypoints.slice(),h.draggerGfx=gs(p,h.segmentStart,h.segmentEnd),M.classes(h.draggerGfx).add("djs-dragging"),o.addMarker(m,_s)}),t.on("connectionSegment.move.move",function(f){var h=f.context,m=h.connection,p=h.segmentStartIndex,g=h.segmentEndIndex,y=h.segmentStart,x=h.segmentEnd,b=h.axis,w=h.originalWaypoints.slice(),C=Bs(y,b,f["d"+b]),S=Bs(x,b,f["d"+b]),v=w.length,j=0;w[p]=C,w[g]=S;var _,B;p<2&&(_=Vt(m.source,C),p===1?_==="intersect"&&(w.shift(),w[0]=C,j--):_!=="intersect"&&(w.unshift(y),j++)),g>v-3&&(B=Vt(m.target,S),g===v-2?B==="intersect"&&(w.pop(),w[w.length-1]=S):B!=="intersect"&&w.push(x)),h.newWaypoints=m.waypoints=c(m,w),d(h,j,f),h.newSegmentStartIndex=p+j,s(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,o.addMarker(f.hover,Ss)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var h=f.context.hover;h&&o.removeMarker(h,Ss)}),t.on("connectionSegment.move.cleanup",function(f){var h=f.context,m=h.connection;h.draggerGfx&&M.remove(h.draggerGfx),o.removeMarker(m,_s)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var h=f.context,m=h.connection;m.waypoints=h.originalWaypoints,s(f)}),t.on("connectionSegment.move.end",function(f){var h=f.context,m=h.connection,p=h.newWaypoints,g=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,g),x=y.waypoints,b=c(m,x),w=y.segmentOffset,C={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:g+w}};r.updateWaypoints(m,b,C)})}Vs.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Sg=Math.abs,Ps=Math.round;function _g(e,t,o){o=o===void 0?10:o;var a,i;for(a=0;a<t.length;a++)if(i=t[a],Sg(i-e)<=o)return i}function Bg(e){return{x:e.x,y:e.y}}function jg(e){return{x:e.x+e.width,y:e.y+e.height}}function Tn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Ps(e.x+e.width/2),y:Ps(e.y+e.height/2)}}function Do(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function wt(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return o===!1?r[t]=!1:(r[t]=!0,a=o-i,e[t]+=a,e["d"+t]+=a),i}function Ms(e){return e.children||[]}var Tg=Math.abs,Ns=Math.round,pi=10;function $s(e){function t(r,l){if(k.isArray(r)){for(var c=r.length;c--;)if(Tg(r[c]-l)<=pi)return r[c]}else{r=+r;var s=l%r;if(s<pi)return l-s;if(s>r-pi)return l-s+r}return l}function o(r,l){if(r.waypoints)return vg(l,r);if(r.width)return{x:Ns(r.width/2+r.x),y:Ns(r.height/2+r.y)}}function a(r){var l=r.context,c=l.snapPoints,s=l.connection,d=s.waypoints,u=l.segmentStart,f=l.segmentStartIndex,h=l.segmentEnd,m=l.segmentEndIndex,p=l.axis;if(c)return c;var g=[d[f-1],u,h,d[m+1]];return f<2&&g.unshift(o(s.source,r)),m>d.length-3&&g.unshift(o(s.target,r)),l.snapPoints=c={horizontal:[],vertical:[]},k.forEach(g,function(y){y&&(y=y.original||y,p==="y"&&c.horizontal.push(y.y),p==="x"&&c.vertical.push(y.x))}),c}e.on("connectionSegment.move.move",1500,function(r){var l=a(r),c=r.x,s=r.y,d,u;if(l){d=t(l.vertical,c),u=t(l.horizontal,s);var f=c-d,h=s-u;k.assign(r,{dx:r.dx-f,dy:r.dy-h,x:d,y:u}),(f||l.vertical.indexOf(c)!==-1)&&wt(r,"x",d),(h||l.horizontal.indexOf(s)!==-1)&&wt(r,"y",u)}});function i(r){var l=r.snapPoints,c=r.connection.waypoints,s=r.bendpointIndex;if(l)return l;var d=[c[s-1],c[s+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,c=l.hover,s=c&&o(c,r);!Ze(c)||!s||!s.x||!s.y||(wt(r,"x",s.x),wt(r,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,c=i(l),s=l.hover,d=s&&o(s,r),u=r.x,f=r.y,h,m;if(c){h=t(d?c.vertical.concat([d.x]):c.vertical,u),m=t(d?c.horizontal.concat([d.y]):c.horizontal,f);var p=u-h,g=f-m;k.assign(r,{dx:r.dx-p,dy:r.dy-g,x:r.x-p,y:r.y-g}),(p||c.vertical.indexOf(u)!==-1)&&wt(r,"x",h),(g||c.horizontal.indexOf(f)!==-1)&&wt(r,"y",m)}})}$s.$inject=["eventBus"];const Vg={__depends__:[qt,En],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",ys],bendpointMove:["type",ui],bendpointMovePreview:["type",Es],connectionSegmentMove:["type",Vs],bendpointSnapping:["type",$s]};var Pg="djs-dragger";function Ct(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Ct.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ct.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=o.source,l=o.target,c=o.waypoints,s=o.connectionStart,d=o.connectionEnd,u=o.noLayout,f=o.noCropping,h=o.noNoop,m,p=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),M.clear(a),i||(i=e.getConnection=Mg(function(g,y,x){return p.getConnection(g,y,x)})),t&&(m=i(t,r,l)),!m){!h&&this.drawNoopPreview(a,o);return}m.waypoints=c||[],this._layouter&&!u&&(m.waypoints=this._layouter.layoutConnection(m,{source:r,target:l,connectionStart:s,connectionEnd:d,waypoints:o.waypoints||m.waypoints})),(!m.waypoints||!m.waypoints.length)&&(m.waypoints=[r?Te(r):s,l?Te(l):d]),this._connectionDocking&&(r||l)&&!f&&(m.waypoints=this._connectionDocking.getCroppedWaypoints(m,r,l)),this._graphicsFactory.drawConnection(a,m,{stroke:"var(--element-dragger-color)"})},Ct.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,i=t.connectionStart||Te(o),r=t.connectionEnd||Te(a),l=this.cropWaypoints(i,r,o,a),c=this.createNoopConnection(l[0],l[1]);M.append(e,c)},Ct.prototype.cropWaypoints=function(e,t,o,a){var i=this._graphicsFactory,r=o&&i.getShapePath(o),l=a&&i.getShapePath(a),c=i.getConnectionPath({waypoints:[e,t]});return e=o&&Oa(r,c,!0)||e,t=a&&Oa(l,c,!1)||t,[e,t]},Ct.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&M.remove(e.connectionPreviewGfx)},Ct.prototype.getConnection=function(e){var t=Ng(e);return this._elementFactory.createConnection(t)},Ct.prototype.createConnectionPreviewGfx=function(){var e=M.create("g");return M.attr(e,{pointerEvents:"none"}),M.classes(e).add(Pg),M.append(this._canvas.getActiveLayer(),e),e},Ct.prototype.createNoopConnection=function(e,t){return Ea([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Mg(e){var t={};return function(o){var a=JSON.stringify(o),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function Ng(e){return k.isObject(e)?e:{}}const $g={__init__:["connectionPreview"],connectionPreview:["type",Ct]};var Og=new wo("ov"),Rg=500;function Fe(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Og,this._overlayDefaults=k.assign({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Ag(o.getContainer()),this._init()}Fe.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Fe.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},Fe.prototype.add=function(e,t,o){if(k.isObject(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=k.assign({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},Fe.prototype.remove=function(e){var t=this.get(e)||[];k.isArray(t)||(t=[t]);var o=this;k.forEach(t,function(a){var i=o._getOverlayContainer(a.element,!0);if(a&&(A.remove(a.html),A.remove(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},Fe.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Fe.prototype.show=function(){Jo(this._overlayRoot)},Fe.prototype.hide=function(){Jo(this._overlayRoot,!1)},Fe.prototype.clear=function(){this._overlays={},this._overlayContainers=[],A.clear(this._overlayRoot)},Fe.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,i=t.y;if(t.waypoints){var r=dt(t);a=r.x,i=r.y}Os(o,a,i),A.attr(e.html,"data-container-id",t.id)},Fe.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=dt(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var c;a.waypoints?c=dt(a).height:c=a.height,r=t.bottom*-1+c}Os(o,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Fe.prototype._createOverlayContainer=function(e){var t=A.domify('<div class="djs-overlays" />');A.assignStyle(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},Fe.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Rs(this._overlayRoot,o)},Fe.prototype._getOverlayContainer=function(e,t){var o=k.find(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},Fe.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),k.isString(a)&&(a=A.domify(a)),r=this._getOverlayContainer(o),i=A.domify('<div class="djs-overlay" data-overlay-id="'+t+'">'),A.assignStyle(i,{position:"absolute"}),i.appendChild(a),e.type&&A.classes(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(o),c=this._canvas.getRootElement();Jo(i,l===c),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Fe.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),i=o&&o.minZoom,r=o&&o.maxZoom,l=e.htmlContainer,c=this._canvas.getRootElement(),s=!0;(a!==c||o&&(k.isDefined(i)&&i>t.scale||k.isDefined(r)&&r<t.scale))&&(s=!1),Jo(l,s),this._updateOverlayScale(e,t)},Fe.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,i,r=e.htmlContainer,l,c="";o!==!0&&(o===!1?(a=1,i=1):(a=o.min,i=o.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)&&(c="scale("+l+","+l+")"),Rs(r,c)},Fe.prototype._updateOverlaysVisibilty=function(e){var t=this;k.forEach(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},Fe.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element,r=t.get({element:i});k.forEach(r,function(s){t.remove(s.id)});var l=t._getOverlayContainer(i);if(l){A.remove(l.html);var c=t._overlayContainers.indexOf(l);c!==-1&&t._overlayContainers.splice(c,1)}}),e.on("element.changed",Rg,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&&A.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 Ag(e){var t=A.domify('<div class="djs-overlay-container" />');return A.assignStyle(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Os(e,t,o){A.assignStyle(e,{left:t+"px",top:o+"px"})}function Jo(e,t){e.style.display=t===!1?"none":""}function Rs(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}const Lg={__init__:["overlays"],overlays:["type",Fe]},Ig=new wo;function Vn(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Vn.$inject=["eventBus"],Vn.prototype.schedule=function(e,t=Ig.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},Vn.prototype._schedule=function(e,t){const o=zg();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(i){o.reject(i)}}catch(i){console.error("Scheduler#_schedule execution failed",i)}}),promise:o.promise}},Vn.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Vn.prototype._cancel=function(e){clearTimeout(e.executionId)};function zg(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}const Fg={scheduler:["type",Vn]};var Hg="djs-element-hidden",Ko=".entry",Wg=1e3,As=8,Ug=300;function Ne(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}Ne.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ne.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var i=a.target,r=k.isArray(i)?i:[i],l=r.filter(function(s){return o.includes(s)});if(l.length){e.close();var c=r.filter(function(s){return e._elementRegistry.get(s.id)});c.length&&e._updateAndOpen(c.length>1?c:c[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current,i=k.isArray(a.target)?a.target:[a.target];i.includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},Ne.prototype._createContainer=function(){var e=A.domify('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ne.prototype.registerProvider=function(e,t){t||(t=e,e=Wg),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},Ne.prototype.getEntries=function(e){var t=this._getProviders(),o=k.isArray(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return k.forEach(t,function(i){if(k.isFunction(i[o])){var r=i[o](e);k.isFunction(r)?a=r(a):k.forEach(r,function(l,c){a[c]=l})}}),a},Ne.prototype.trigger=function(e,t,o){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=A.attr(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,o)},Ug);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,o)},Ne.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var i=this._current.target,r=this._current.entries,l=r[e];if(l){var c=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:o})!==!1){if(k.isFunction(c)){if(t==="click")return c(o,i,a)}else if(c[t])return c[t](o,i,a);o.preventDefault()}}}},Ne.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ne.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ne.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;k.forEach(t,function(i,r){var l=i.group||"default",c=A.domify(i.html||'<div class="entry" draggable="true"></div>'),s;A.attr(c,"data-action",r),s=A.query("[data-group="+di(l)+"]",o),s||(s=A.domify('<div class="group"></div>'),A.attr(s,"data-group",l),o.appendChild(s)),s.appendChild(c),i.className&&Dg(c,i.className),i.title&&A.attr(c,"title",i.title),i.imageUrl&&(a=A.domify("<img>"),A.attr(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",c.appendChild(a))}),A.classes(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ne.prototype._createHtml=function(e){var t=this,o=A.domify('<div class="djs-context-pad"></div>');return A.delegate.bind(o,Ko,"click",function(a){t.trigger("click",a)}),A.delegate.bind(o,Ko,"dragstart",function(a){t.trigger("dragstart",a)}),A.delegate.bind(o,Ko,"mouseover",function(a){t.trigger("mouseover",a)}),A.delegate.bind(o,Ko,"mouseout",function(a){t.trigger("mouseout",a)}),A.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},Ne.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()&&Kg(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ne.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ne.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return k.isArray(e)!==k.isArray(o)?!1:k.isArray(e)?e.length===o.length&&k.every(e,function(a){return o.includes(a)}):o===e},Ne.prototype.isShown=function(){return this.isOpen()&&A.classes(this._current.html).has("open")},Ne.prototype.show=function(){this.isOpen()&&(A.classes(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ne.prototype.hide=function(){this.isOpen()&&(A.classes(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ne.prototype._getPosition=function(e){if(!k.isArray(e)&&Ze(e)){var t=this._canvas.viewbox(),o=Jg(e),a=o.x*t.scale-t.x*t.scale,i=o.y*t.scale-t.y*t.scale;return{left:a+As*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer(),l=r.getBoundingClientRect(),c=this._getTargetBounds(e);return{left:c.right-l.left+As*this._canvas.zoom(),top:c.top-l.top}},Ne.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ne.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target,a=k.isArray(o)?o:[o],i=a.some(function(r){return t._canvas.hasMarker(r,Hg)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ne.prototype._getTargetBounds=function(e){var t=this,o=k.isArray(e)?e:[e],a=o.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 Dg(e,t){var o=A.classes(e);t=k.isArray(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function Jg(e){return e.waypoints[e.waypoints.length-1]}function Kg(e,t){return e=k.isArray(e)?e:[e],t=k.isArray(t)?t:[t],e.length===t.length&&k.every(e,function(o){return t.includes(o)})}const qg={__depends__:[Sa,Fg,Lg],contextPad:["type",Ne]};var Yg=250;function on(e){this._eventBus=e,this._tools=[],this._active=null}on.$inject=["eventBus"],on.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},on.prototype.isActive=function(e){return e&&this._active===e},on.prototype.length=function(e){return this._tools.length},on.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},on.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.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")}),o.on(a,Yg,function(i){this._active&&(Gg(i)||this.setActive(null))},this)};function Gg(e){var t=e.originalEvent&&e.originalEvent.target;return t&&A.closest(t,'.group[data-group="tools"]')}const hi={__depends__:[qt],__init__:["toolManager"],toolManager:["type",on]};function mi(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){var i=t._svg=a.svg;i.addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}mi.$inject=["eventBus"],mi.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Xg(0,0)};function Xg(e,t){var o=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),o}const gi={__init__:["mouse"],mouse:["type",mi]};var yi=1500,Ls="grab";function Pn(e,t,o,a,i,r){this._dragging=o,this._mouse=r;var l=this,c=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",yi,function(s){if(wl(s))return l.activateMove(s.originalEvent,!0),!1}),c&&c.addListener(yi,function(s){if(!(!Is(s.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),c&&c.addListener(yi,function(s){!Is(s.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(s){var d=s.originalEvent.target;if(!s.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(s.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(s){var d=t.viewbox().scale;t.scroll({dx:s.dx*d,dy:s.dy*d})}),e.on("hand.move.end",function(s){var d=s.context,u=d.reactivate;return!wl(s)&&u&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}Pn.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Pn.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ls,data:{context:o||{}}})},Pn.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ls,data:{context:{reactivate:o}}})},Pn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Pn.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Is(e){return Nl("Space",e)}const Zg={__depends__:[hi,gi],__init__:["handTool"],handTool:["type",Pn]};var zs="crosshair";function an(e,t,o,a,i,r,l){this._selection=i,this._dragging=o,this._mouse=l;var c=this,s={create:function(d){var u=t.getActiveLayer(),f;f=d.frame=M.create("rect"),M.attr(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),M.append(u,f)},update:function(d){var u=d.frame,f=d.bbox;M.attr(u,{x:f.x,y:f.y,width:f.width,height:f.height})},remove:function(d){d.frame&&M.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(){c.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,f=vi(d),h=a.filter(function(p){return p}),m=wa(d);c.select(h,f,m?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=vi(d),s.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=vi(d),s.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;s.remove(u)}),e.on("element.mousedown",1500,function(d){if(wa(d))return c.activateLasso(d.originalEvent),!0})}an.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],an.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:zs,data:{context:{}}})},an.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:zs,data:{context:{}},keepSelection:!0})},an.prototype.select=function(e,t,o=[]){var a=Zp(e,t);this._selection.select([...o,...k.values(a)])},an.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},an.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function vi(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}const Qg={__depends__:[hi,gi],__init__:["lassoTool"],lassoTool:["type",an]};var Fs="connect-ok",Hs="connect-not-ok";function Mn(e,t,o,a,i,r,l){var c=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(s){var d=s.context,u=s.hover,f=d.canStartConnect=c.canStartConnect(u);f!==null&&(d.startTarget=u,a.addMarker(u,f?Fs:Hs))}),e.on(["global-connect.out","global-connect.cleanup"],function(s){var d=s.context.startTarget,u=s.context.canStartConnect;d&&a.removeMarker(d,u?Fs:Hs)}),e.on(["global-connect.ended"],function(s){var d=s.context,u=d.startTarget,f={x:s.x,y:s.y},h=c.canStartConnect(u);if(h)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,u,f)}),!1})}Mn.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Mn.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Mn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Mn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Mn.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const ey={__depends__:[Aa,En,qt,hi,gi],globalConnect:["type",Mn]};var ty=500,ny=1e3;function rn(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=M.create("rect");return M.attr(l,k.assign({x:0,y:0,rx:4,width:100,height:100},o)),l}e.on(["shape.added","shape.changed"],ty,function(r){var l=r.element,c=r.gfx,s=A.query(".djs-outline",c);s||(s=a.getOutline(l)||i(),M.append(c,s)),a.updateShapeOutline(s,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,c=r.gfx,s=A.query(".djs-outline",c);s||(s=i(),M.append(c,s)),a.updateConnectionOutline(s,l)})}rn.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&k.forEach(a,function(i){o=o||i.updateOutline(t,e)}),o||M.attr(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},rn.prototype.updateConnectionOutline=function(e,t){var o=dt(t);M.attr(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},rn.prototype.registerProvider=function(e,t){t||(t=e,e=ny),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},rn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},rn.prototype.getOutline=function(e){var t,o=this._getProviders();return k.forEach(o,function(a){k.isFunction(a.getOutline)&&(t=t||a.getOutline(e))}),t},rn.$inject=["eventBus","styles","elementRegistry"];var qo=6;function bi(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(i){o.isSelected(i.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}bi.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");M.clear(t);var o=e.length>1,a=this._canvas.getContainer();if(M.classes(a)[o?"add":"remove"]("djs-multi-select"),!!o){var i=oy(dt(e)),r=M.create("rect");M.attr(r,k.assign({rx:3},i)),M.classes(r).add("djs-selection-outline"),M.append(t,r)}},bi.$inject=["eventBus","canvas","selection"];function oy(e){return{x:e.x-qo,y:e.y-qo,width:e.width+qo*2,height:e.height+qo*2}}const Ws={__depends__:[wn],__init__:["outline","multiSelectionOutline"],outline:["type",rn],multiSelectionOutline:["type",bi]};var ay=500,iy=1250,ry=1500,Yo=Math.round;function ly(e){return{x:e.x+Yo(e.width/2),y:e.y+Yo(e.height/2)}}function Us(e,t,o,a,i){function r(c,s,d,u){return i.allowed("elements.move",{shapes:c,delta:s,position:d,target:u})}e.on("shape.move.start",ry,function(c){var s=c.context,d=c.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=cy(u),k.assign(s,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",iy,function(c){var s=c.context,d=s.validatedShapes,u;if(u=s.canExecute=r(d),!u)return!1}),e.on("shape.move.move",ay,function(c){var s=c.context,d=s.validatedShapes,u=c.hover,f={x:c.dx,y:c.dy},h={x:c.x,y:c.y},m;if(m=r(d,f,h,u),s.delta=f,s.canExecute=m,m===null){s.target=null;return}s.target=u}),e.on("shape.move.end",function(c){var s=c.context,d=s.delta,u=s.canExecute,f=u==="attach",h=s.shapes;if(u===!1)return!1;d.x=Yo(d.x),d.y=Yo(d.y),!(d.x===0&&d.y===0)&&o.moveElements(h,d,s.target,{primaryShape:s.shape,attach:f})}),e.on("element.mousedown",function(c){if(Et(c)){var s=vn(c);if(!s)throw new Error("must supply DOM mousedown event");return l(s,c.element)}});function l(c,s,d,u){if(k.isObject(d)&&(u=d,d=!1),!(s.waypoints||!s.parent)&&!M.classes(c.target).has("djs-hit-no-move")){var f=ly(s);return t.init(c,f,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:s,context:u||{}}}),!0}}this.start=l}Us.$inject=["eventBus","dragging","modeling","selection","rules"];function cy(e){var t=k.groupBy(e,"id");return k.filter(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Ds=499,xi="djs-dragging",Js="drop-ok",Ks="drop-not-ok",qs="new-parent",Ys="attach-ok";function Gs(e,t,o,a){function i(s){var d=r(s),u=sy(d);return u}function r(s){var d=Gp(s),u=d.flatMap(m=>(m.incoming||[]).concat(m.outgoing||[])),f=d.concat(u),h=[...new Set(f)];return h}function l(s,d){[Ys,Js,Ks,qs].forEach(function(u){u===d?t.addMarker(s,u):t.removeMarker(s,u)})}function c(s,d,u){a.addDragger(d,s.dragGroup),u&&t.addMarker(d,xi),s.allDraggedElements?s.allDraggedElements.push(d):s.allDraggedElements=[d]}e.on("shape.move.start",Ds,function(s){var d=s.context,u=d.shapes,f=d.allDraggedElements,h=i(u);if(!d.dragGroup){var m=M.create("g");M.attr(m,o.cls("djs-drag-group",["no-events"]));var p=t.getActiveLayer();M.append(p,m),d.dragGroup=m}h.forEach(function(g){a.addDragger(g,d.dragGroup)}),f?f=k.flatten([f,r(u)]):f=r(u),k.forEach(f,function(g){t.addMarker(g,xi)}),d.allDraggedElements=f,d.differentParents=dy(u)}),e.on("shape.move.move",Ds,function(s){var d=s.context,u=d.dragGroup,f=d.target,h=d.shape.parent,m=d.canExecute;f&&(m==="attach"?l(f,Ys):d.canExecute&&h&&f.id!==h.id?l(f,qs):l(f,d.canExecute?Js:Ks)),ut(u,s.dx,s.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(s){var d=s.context,u=d.target;u&&l(u,null)}),e.on("shape.move.cleanup",function(s){var d=s.context,u=d.allDraggedElements,f=d.dragGroup;k.forEach(u,function(h){t.removeMarker(h,xi)}),f&&M.remove(f)}),this.makeDraggable=c}Gs.$inject=["eventBus","canvas","styles","previewSupport"];function sy(e){var t=k.filter(e,function(o){return Ze(o)?k.find(e,k.matchPattern({id:o.source.id}))&&k.find(e,k.matchPattern({id:o.target.id})):!0});return t}function dy(e){return k.size(k.groupBy(e,function(t){return t.parent&&t.parent.id}))!==1}const uy={__depends__:[Sa,wn,Ws,En,qt,ja],__init__:["move","movePreview"],move:["type",Us],movePreview:["type",Gs]};var Xs=".djs-palette-toggle",Zs=".entry",fy=Xs+", "+Zs,wi="djs-palette-",py="shown",Ci="open",Qs="two-column",hy=1e3;function $e(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var i=a.tool;o.updateToolHighlight(i)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}$e.$inject=["eventBus","canvas"],$e.prototype.registerProvider=function(e,t){t||(t=e,e=hy),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},$e.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(gy,{})},$e.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},$e.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=A.domify($e.HTML_MARKUP);o.appendChild(a),A.classes(o).add(wi+py),A.delegate.bind(a,fy,"click",function(i){var r=i.delegateTarget;if(A.matches(r,Xs))return e.toggle();e.trigger("click",i)}),A.event.bind(a,"mousedown",function(i){i.stopPropagation()}),A.delegate.bind(a,Zs,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},$e.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},$e.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,i,r=A.classes(o),l=A.classes(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Qs,i),l.toggle(wi+Qs,i),"open"in e&&(r.toggle(Ci,e.open),l.toggle(wi+Ci,e.open)),a.fire("palette.changed",{twoColumn:i,open:this.isOpen()})},$e.prototype._update=function(){var e=A.query(".djs-palette-entries",this._container),t=this._entries=this.getEntries();A.clear(e),k.forEach(t,function(o,a){var i=o.group||"default",r=A.query("[data-group="+di(i)+"]",e);r||(r=A.domify('<div class="group"></div>'),A.attr(r,"data-group",i),e.appendChild(r));var l=o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),c=A.domify(l);if(r.appendChild(c),!o.separator&&(A.attr(c,"data-action",a),o.title&&A.attr(c,"title",o.title),o.className&&my(c,o.className),o.imageUrl)){var s=A.domify("<img>");A.attr(s,"src",o.imageUrl),c.appendChild(s)}}),this.open()},$e.prototype.trigger=function(e,t,o){var a,i,r=t.delegateTarget||t.target;return r?(a=A.attr(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,o)):t.preventDefault()},$e.prototype.triggerEntry=function(e,t,o,a){var i=this._entries,r,l;if(r=i[e],!!r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if(k.isFunction(l)){if(t==="click")return l(o,a)}else if(l[t])return l[t](o,a);o.preventDefault()}},$e.prototype._layoutChanged=function(){this._toggleState({})},$e.prototype._needsCollapse=function(e,t){var o=50,a=Object.keys(t).length*46;return e<a+o},$e.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},$e.prototype.open=function(){this._toggleState({open:!0})},$e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$e.prototype.isActiveTool=function(e){return e&&this._activeTool===e},$e.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=A.query(".djs-palette-entries",this._container),this._toolsContainer=A.query("[data-group=tools]",t)),o=this._toolsContainer,k.forEach(o.children,function(a){var i=a.getAttribute("data-action");if(i){var r=A.classes(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},$e.prototype.isOpen=function(){return A.classes(this._container).has(Ci)},$e.prototype._getParentContainer=function(){return this._canvas.getContainer()},$e.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function my(e,t){var o=A.classes(e),a=k.isArray(t)?t:t.split(/\s+/g);a.forEach(function(i){o.add(i)})}function gy(e,t){var o=t.getPaletteEntries();return k.isFunction(o)?o(e):(k.forEach(o,function(a,i){e[i]=a}),e)}const yy={__init__:["palette"],palette:["type",$e]};function ed(e,t,o,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=o.getGraphics(r)),i.gfx&&e.fire(Qp(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)})}ed.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const vy={__init__:["changeSupport"],changeSupport:["type",ed]};var Go=Math.max,Xo=Math.min,by=20;function xy(e,t,o){var a=o.x,i=o.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 Zo(e,t,o){var a=t[e],i=o.min&&o.min[e],r=o.max&&o.max[e];return k.isNumber(i)&&(a=(/top|left/.test(e)?Xo:Go)(a,i)),k.isNumber(r)&&(a=(/top|left/.test(e)?Go:Xo)(a,r)),a}function wy(e,t){if(!t)return e;var o=be(e);return rc({top:Zo("top",o,t),right:Zo("right",o,t),bottom:Zo("bottom",o,t),left:Zo("left",o,t)})}function Cy(e,t,o,a){var i=be(t),r={top:/n/.test(e)?i.bottom-o.height:i.top,left:/w/.test(e)?i.right-o.width:i.left,bottom:/s/.test(e)?i.top+o.height:i.bottom,right:/e/.test(e)?i.left+o.width:i.right},l=a?be(a):r,c={top:Xo(r.top,l.top),left:Xo(r.left,l.left),bottom:Go(r.bottom,l.bottom),right:Go(r.right,l.right)};return rc(c)}function no(e,t){return typeof e<"u"?e:by}function ky(e,t){var o,a,i,r;return typeof t=="object"?(o=no(t.left),a=no(t.right),i=no(t.top),r=no(t.bottom)):o=a=i=r=no(t),{x:e.x-o,y:e.y-i,width:e.width+o+a,height:e.height+i+r}}function Ey(e){return!(e.waypoints||e.type==="label")}function Sy(e,t){var o;if(e.length===void 0?o=k.filter(e.children,Ey):o=e,o.length)return ky(dt(o),t)}var td=10;function oo(e,t,o,a){this._dragging=a,this._rules=t;var i=this;function r(s,d){var u=s.shape,f=s.direction,h=s.resizeConstraints,m;s.delta=d,m=xy(u,f,d),s.newBounds=wy(m,h),s.canExecute=i.canResize(s)}function l(s){var d=s.resizeConstraints,u=s.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(s)),s.resizeConstraints={min:be(u)})}function c(s){var d=s.shape,u=s.canExecute,f=s.newBounds;if(u){if(f=Eh(f),!_y(d,f))return;o.resizeShape(d,f)}}e.on("resize.start",function(s){l(s.context)}),e.on("resize.move",function(s){var d={x:s.dx,y:s.dy};r(s.context,d)}),e.on("resize.end",function(s){c(s.context)})}oo.prototype.canResize=function(e){var t=this._rules,o=k.pick(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},oo.prototype.activate=function(e,t,o){var a=this._dragging,i,r;if(typeof o=="string"&&(o={direction:o}),i=k.assign({shape:t},o),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,nd(t,r),"resize",{autoActivate:!0,cursor:By(r),data:{shape:t,context:i}})},oo.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction,a,i;return a=e.minDimensions||{width:td,height:td},i=Sy(t,e.childrenBoxPadding),Cy(o,t,a,i)},oo.$inject=["eventBus","rules","modeling","dragging"];function _y(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function nd(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.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 By(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 od="djs-resizing",ad="resize-not-ok",jy=500;function id(e,t,o){function a(r){var l=r.shape,c=r.newBounds,s=r.frame;s||(s=r.frame=o.addFrame(l,t.getActiveLayer()),t.addMarker(l,od)),c.width>5&&M.attr(s,{x:c.x,width:c.width}),c.height>5&&M.attr(s,{y:c.y,height:c.height}),r.canExecute?M.classes(s).remove(ad):M.classes(s).add(ad)}function i(r){var l=r.shape,c=r.frame;c&&M.remove(r.frame),t.removeMarker(l,od)}e.on("resize.move",jy,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}id.$inject=["eventBus","canvas","previewSupport"];var Qo=-6,ea=8,ta=20,ao="djs-resizer",Ty=["n","w","s","e","nw","ne","se","sw"];function It(e,t,o,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;o.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}It.prototype.makeDraggable=function(e,t,o){var a=this._resize;function i(r){Et(r)&&a.activate(r,e,o)}A.event.bind(t,"mousedown",i),A.event.bind(t,"touchstart",i)},It.prototype._createResizer=function(e,t,o,a){var i=this._getResizersParent(),r=Vy(a),l=M.create("g");M.classes(l).add(ao),M.classes(l).add(ao+"-"+e.id),M.classes(l).add(ao+"-"+a),M.append(i,l);var c=M.create("rect");M.attr(c,{x:-ea/2+r.x,y:-ea/2+r.y,width:ea,height:ea}),M.classes(c).add(ao+"-visual"),M.append(l,c);var s=M.create("rect");return M.attr(s,{x:-ta/2+r.x,y:-ta/2+r.y,width:ta,height:ta}),M.classes(s).add(ao+"-hit"),M.append(l,s),oh(l,t,o),l},It.prototype.createResizer=function(e,t){var o=nd(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},It.prototype.addResizer=function(e){var t=this;Ze(e)||!this._resize.canResize({shape:e})||k.forEach(Ty,function(o){t.createResizer(e,o)})},It.prototype.removeResizers=function(){var e=this._getResizersParent();M.clear(e)},It.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},It.$inject=["eventBus","canvas","selection","resize"];function Vy(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Qo:e.indexOf("w")!==-1&&(t.x=Qo),e.indexOf("s")!==-1?t.y=-Qo:e.indexOf("n")!==-1&&(t.y=Qo),t}const Py={__depends__:[En,qt,ja],__init__:["resize","resizePreview","resizeHandles"],resize:["type",oo],resizePreview:["type",id],resizeHandles:["type",It]};function io(e,t,o,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,o.registerProvider(this),e.on("element.dblclick",c=>{l(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{i.removeResizers()}),e.on("create.end",500,c=>{const{context:s,isTouch:d}=c,u=s.shape,{canExecute:f}=c.context;d||f&&(s.hints&&s.hints.createElementsBehavior===!1||l(u))}),e.on("autoPlace.end",500,c=>{l(c.shape)});function l(c,s){(s||Za(c,["userTask","scriptTask","subprocess"])||c.isDirectEdit)&&o.activate(c)}}io.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],io.prototype.activate=function(e){const t=Ro(e);if(t===void 0)return;const o={text:t},a=this.getEditingBBox(e);_e(o,a);const i={};return(Za(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&_e(i,{centerVertically:!0}),Qa(e)&&_e(i,{autoResize:!0}),_e(o,{options:i}),o},io.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),c=this._textRenderer.getDefaultStyle(),s=this._textRenderer.getExternalStyle(),d=s.fontSize*l,u=s.lineHeight,f=c.fontSize*l,h=c.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Za(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(_e(r,{width:a.width,height:a.height}),_e(m,{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,g=7*l,y=4*l;if(o.labelTarget&&(_e(r,{width:p,height:a.height+g+y,x:i.x-p/2,y:a.y-g}),_e(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})),Qa(o)&&!Wc(o)&&!Zn(o)){const x=Uc(e),b=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),w=d+g+y;_e(r,{width:p,height:w,x:b.x-p/2,y:b.y-w/2}),_e(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})}return{bounds:r,style:m}},io.prototype.update=function(e,t){let o;My(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function My(e){return!e||!e.trim()}const Ny={__depends__:[vy,Py,Ad],__init__:["labelEditingProvider"],labelEditingProvider:["type",io]};function zt(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}zt.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},zt.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},zt.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},zt.prototype.getSnapLocations=function(){return this._snapLocations},zt.prototype.setSnapLocations=function(e){this._snapLocations=e},zt.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new na,o.initDefaults(this._defaultSnaps)),o};function na(){this._snapValues={}}na.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},na.prototype.snap=function(e,t,o,a){var i=this._snapValues[t];return i&&_g(e[o],i[o],a)},na.prototype.initDefaults=function(e){var t=this;k.forEach(e||{},function(o,a){k.forEach(o,function(i){t.add(a,i)})})};var $y=1250;function mt(e,t,o){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"],$y,function(i){var r=i.context,l=r.shape,c=r.snapContext,s=r.target;if(!(i.originalEvent&&Ml(i.originalEvent))&&!(Do(i)||!s)){var d=c.pointsForTarget(s);d.initialized||(d=a.addSnapTargetPoints(d,l,s),d.initialized=!0),o.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}mt.$inject=["elementRegistry","eventBus","snapping"],mt.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,i=o.snapContext;i||(i=o.snapContext=new zt);var r;t.get(a.id)?r=Tn(a,e):r={x:e.x+Tn(a).x,y:e.y+Tn(a).y};var l={x:r.x-a.width/2,y:r.y-a.height/2},c={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}),Sn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:c.x-e.x,y:c.y-e.y})),i},mt.prototype.addSnapTargetPoints=function(e,t,o){var a=this.getSnapTargets(t,o);return k.forEach(a,function(i){if(Sn(i)){Sn(t)&&e.add("mid",Tn(i));return}if(Ze(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",Tn(i))}),!k.isNumber(t.x)||!k.isNumber(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Tn(t)),e},mt.prototype.getSnapTargets=function(e,t){return Ms(t).filter(function(o){return!Oy(o)})};function Oy(e){return!!e.hidden}function Nn(e){e.invoke(mt,this)}Ht(Nn,mt),Nn.$inject=["injector"],Nn.prototype.initSnap=function(e){return mt.prototype.initSnap.call(this,e)},Nn.prototype.addSnapTargetPoints=function(e,t,o){return mt.prototype.addSnapTargetPoints.call(this,e,t,o)},Nn.prototype.getSnapTargets=function(e,t){return mt.prototype.getSnapTargets.call(this,e,t)};var Ry=1250;function ro(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],Ry,function(a){var i=a.context,r=i.shape,l=r.parent,c=i.direction,s=i.snapContext;if(!(a.originalEvent&&Ml(a.originalEvent))&&!Do(a)){var d=s.pointsForTarget(l);d.initialized||(d=o.addSnapTargetPoints(d,r,l,c),d.initialized=!0),Iy(c)&&wt(a,"x",a.x),zy(c)&&wt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}ro.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new zt);var r=rd(o,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},ro.prototype.addSnapTargetPoints=function(e,t,o,a){var i=this.getSnapTargets(t,o);return k.forEach(i,function(r){e.add("corner",jg(r)),e.add("corner",Bg(r))}),e.add("corner",rd(t,a)),e},ro.$inject=["eventBus","snapping"],ro.prototype.getSnapTargets=function(e,t){return Ms(t).filter(function(o){return!Ay(o,e)&&!Ze(o)&&!Ly(o)&&!Sn(o)})};function rd(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.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 Ay(e,t){return e.host===t}function Ly(e){return!!e.hidden}function Iy(e){return e==="n"||e==="s"}function zy(e){return e==="e"||e==="w"}var Fy=7,Hy=1e3;function Ft(e){this._canvas=e,this._asyncHide=k.debounce(k.bind(this.hide,this),Hy)}Ft.$inject=["canvas"],Ft.prototype.snap=function(e,t){var o=e.context,a=o.snapContext,i=a.getSnapLocations(),r={x:Do(e,"x"),y:Do(e,"y")};k.forEach(i,function(l){var c=a.getSnapOrigin(l),s={x:e.x+c.x,y:e.y+c.y};if(k.forEach(["x","y"],function(d){var u;r[d]||(u=t.snap(s,l,d,Fy),u!==void 0&&(r[d]={value:u,originValue:u-c[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 c=r[l];k.isObject(c)&&wt(e,l,c.originValue)})},Ft.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=M.create("path");return M.attr(o,{d:"M0,0 L0,0"}),M.classes(o).add("djs-snap-line"),M.append(t,o),{update:function(a){k.isNumber(a)?e==="horizontal"?M.attr(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):M.attr(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):M.attr(o,{display:"none"})}}},Ft.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ft.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Ft.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ft.prototype.hide=function(){k.forEach(this._snapLines,function(e){e.update()})};const Wy={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",mt],resizeSnapping:["type",ro],snapping:["type",Ft]}],__init__:["createMoveSnapping"],createMoveSnapping:["type",Nn]};function $n(e){Ke.call(this,e),this.init()}$n.$inject=["eventBus"],Yt($n,Ke),$n.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,c){return o(r)},!0)})},$n.prototype.init=function(){};function lo(e){$n.call(this,e)}lo.$inject=["eventBus"],Ht(lo,$n),lo.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},i=a.targetParent,r=a.targetAttach;if(r)return!1;i&&(o.parent=i);try{return ki(t,o)}finally{i&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){e.connection;var t=e.source,o=e.target;return ki(t,o)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return eh(t)})},lo.prototype.canConnect=ki;function ki(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}const Uy={__init__:["myRuleProvider"],myRuleProvider:["type",lo]};function Ei(e,t,o,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}Ei.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Ei.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(s,d,u,f,h){function m(p){const g=t.createShape(_e({type:s},h));e.start(p,g)}return{group:d,className:u,title:f,action:{dragstart:m,click:m}}}const c={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(s){o.activateHand(s)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(s){a.activateSelection(s)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(s){i.toggle(s)}}},"tool-separator":{group:"tools",separator:!0}};for(const s in r.palette){const d=r.palette[s];c[s]=l(d.type,d.group,d.className,d.title,d.options)}return c};const Dy={__init__:["paletteProvider"],paletteProvider:["type",Ei]};var ld=50,Jy=250;function Ky(e,t){t||(t={});function o(p){return p.source===e?1:-1}var a=t.defaultDistance||ld,i=t.direction||"e",r=t.filter,l=t.getWeight||o,c=t.maxDistance||Jy,s=t.reference||"start";r||(r=qy);function d(p,g){return i==="n"?s==="start"?be(p).top-be(g).bottom:s==="center"?be(p).top-Te(g).y:be(p).top-be(g).top:i==="w"?s==="start"?be(p).left-be(g).right:s==="center"?be(p).left-Te(g).x:be(p).left-be(g).left:i==="s"?s==="start"?be(g).top-be(p).bottom:s==="center"?Te(g).y-be(p).bottom:be(g).bottom-be(p).bottom:s==="start"?be(g).left-be(p).right:s==="center"?Te(g).x-be(p).right:be(g).right-be(p).right}var u=e.incoming.filter(r).map(function(p){var g=l(p),y=g<0?d(p.source,e):d(e,p.source);return{id:p.source.id,distance:y,weight:g}}),f=e.outgoing.filter(r).map(function(p){var g=l(p),y=g>0?d(e,p.target):d(p.target,e);return{id:p.target.id,distance:y,weight:g}}),h=u.concat(f).reduce(function(p,g){return p[g.id+"__weight_"+g.weight]=g,p},{}),m=k.reduce(h,function(p,g){var y=g.distance,x=g.weight;return y<0||y>c||(p[String(y)]||(p[String(y)]=0),p[String(y)]+=1*x,(!p.distance||p[p.distance]<p[String(y)])&&(p.distance=y)),p},{});return m.distance||a}function qy(){return!0}var Yy=100;function cd(e,t,o){e.on("autoPlace",Yy,function(a){var i=a.shape,r=a.source;return Gy(r,i)}),e.on("autoPlace.end",function(a){o.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}),c=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:c}),c}}cd.$inject=["eventBus","modeling","canvas"];function Gy(e,t,o){o||(o={});var a=o.defaultDistance||ld,i=Te(e),r=be(e);return{x:r.right+a+t.width/2,y:i.y}}function sd(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}sd.$inject=["eventBus","selection"];const Xy={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",cd],autoPlaceSelectionBehavior:["type",sd]},Zy=10,Qy=(e,t)=>e.type===t;function ev(e){return e.incoming.map(t=>t.source)}function tv(e){return e.outgoing.map(t=>t.target)}function Si(e){return tv(e).concat(ev(e))}function nv(e){let t=Si(e);return e.host&&(t=t.concat(Si(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(Si(a)),[]))),t.filter(o=>o.type!=="myline")}function ov(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height},i=nv(e);return k.find(i,r=>r===o?!1:Vt(r,a,Zy)==="intersect")}function av(e,t,o,a){let i;for(;i=ov(e,o,t);)o=a(t,o,i);return o}function iv(e){return function(t,o,a){const i={x:o.x,y:o.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const c=r==="x"?"width":"height",{margin:s,minDistance:d}=l;s<0?i[r]=Math.min(a[r]+s-t[c]/2,o[r]-d+s):i[r]=Math.max(a[r]+a[c]+s+t[c]/2,o[r]+d+s)}),i}}function rv(e,t){return lv(e,t)}function lv(e,t){const o=be(e),a=Te(e),i=Ky(e,{filter:u=>Qy(u,"myline")}),r=30,l=80,s={x:o.right+i+t.width/2,y:a.y+cv("left",l)};return av(e,t,s,iv({y:{margin:r,minDistance:l}}))}function cv(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function dd(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return rv(a,o)})}dd.$inject=["eventBus"];const sv={__depends__:[Xy],__init__:["myAutoPlace"],myAutoPlace:["type",dd]};function _i(e,t,o,a,i,r,l){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}_i.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],_i.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function c(){o.removeElements([e])}function s(f,h,m){t.start(f,h,m)}function d(f,h,m,p){typeof m!="string"&&(p=m);function g(x,b){const w=a.createShape(_e({type:f},p));r.start(x,w,{source:b})}function y(x,b){const w=a.createShape(_e({type:f},p));i.append(b,w)}return{group:"model",className:h,title:m,action:{dragstart:g,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:c,dragstart:c}}};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:s,dragstart:s}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:c,dragstart:c}},u};const dv={__init__:["ContextPadProvider"],ContextPadProvider:["type",_i]},uv=n.defineComponent({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let c,s=1;const d=()=>{s=1,c.get("canvas").zoom("fit-viewport")},u=()=>{const V=c.get("eventBus");V.on("element.dblclick",T=>{i("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{i("elementClick",T.element.businessObject)}),V.on("create.end",T=>{i("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{i("elementCreate",T.shape.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let V={__init__:["myOptions"],myOptions:["type",f]};c=new $i({canvas:{container:r.value},modules:[Vg,Aa,$g,qg,Jl,rg,Zg,Qg,ey,ns,fc,uy,Ws,yy,mc,V,sv,is,Ny,dv,Dy,Uy,Wy,ls]});const T=c.get("canvas"),L=c.get("elementFactory");d();const F=L.createRoot();T.setRootElement(F),u()};n.onMounted(()=>{h()});const m=V=>{const T=V==null?1:s+V;c.get("canvas").zoom(T),s=T},p=()=>{c.get("commandStack").redo()},g=()=>{c.get("commandStack").undo()},y=()=>{c.get("canvas").zoom(1);const V=c.get("elementRegistry").getAll();var T=cs(V);return T},x=V=>{c.clear(),d(),ss(V,c)},b=V=>{c.get("myImporter").update(V.id,V)};return t({reset:()=>{d()},zoom:V=>{m(V)},redo:()=>{p()},undo:()=>{g()},getData:()=>y(),setData:V=>{x(V)},updateElemet:V=>{b(V)}}),(V,T)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),ud=te(ag),fd=te(uv),fv=[uo,gr,yr,vr,br,xr,wr,Cr,kr,Er,Sr,Tr,Vr,Pr,Mr,va,mr,Nr,$r,Or,Ar,Ir,zr,Gr,Fr,Hr,Wr,Ur,Dr,Jr,Kr,qr,Yr,el,tl,nl,ol,al,il,rl,ll,cl,Xr,Zr,ba,sl,dl,ul,fl,pl,hl,ml,jp,ud,fd],pv={install:e=>{fv.forEach(t=>{e.component(t.name,t)})}};N.EncryptionFactory=tr,N.EventBus=ha,N.HashingFactory=Qd,N.INJECT_KEYS=Ie,N.JAutoComplete=Er,N.JBarcode=zr,N.JButton=uo,N.JButtonSelect=el,N.JButtons=gr,N.JCascaderSelect=wr,N.JCheckbox=Cr,N.JCodeMirror=Gr,N.JCollapse=hl,N.JComp=ol,N.JCount=Fr,N.JCountUp=Hr,N.JDataPanel=Wr,N.JDialog=Vr,N.JDialogFull=Pr,N.JDivider=Ur,N.JDrawer=Mr,N.JDynamicLayer=mr,N.JEcharts=Ir,N.JEditor=ml,N.JForm=al,N.JFormItem=il,N.JGuid=ll,N.JHpanel=Dr,N.JIcon=vr,N.JInput=yr,N.JInputButton=Jr,N.JInputCode=Kr,N.JInputColor=qr,N.JInputLayer=dl,N.JInputRows=sl,N.JInputTag=Nr,N.JLayer=va,N.JLayerForm=ul,N.JLayout=Sr,N.JMenu=Zr,N.JNumber=kr,N.JPage=rl,N.JPanel=cl,N.JRadio=br,N.JRate=$r,N.JSelect=xr,N.JSlider=Or,N.JSliderCaptcha=Xr,N.JSwitch=fl,N.JTable=Tr,N.JTablePanel=ba,N.JTabs=pl,N.JTitle=Yr,N.JTree=tl,N.JTreeSelect=nl,N.JUpload=Ar,N.JWorkflow=fd,N.JWorkflowViewer=ud,N.assign=_e,N.buildShortUUID=po,N.buildUUID=Ut,N.clearJson=An,N.clone=fo,N.deepClone=vt,N.default=pv,N.eventBus=tu,N.formatToDate=In,N.formatToDateTime=Gi,N.fullScreenLoading=un,N.getCompConfig=Dt,N.getCompType=pa,N.getFunction=ua,N.getIsInputComp=ho,N.getIsTableInputComp=qi,N.getLabel=Yi,N.getObjType=Ai,N.getTextWidth=dn,N.is=Ri,N.isArray=so,N.isNullOrEmpty=yt,N.isObject=Id,N.loadBMap=or,N.lowerFirst=Dd,N.myAesDecrypt=eu,N.numberToChinese=Ii,N.numberToThousandSeparator=zi,N.pagination=Hd,N.paginationEx=Wd,N.set=Li,N.setGroupMap=Hi,N.toArray=Ui,N.toDecimal=Ln,N.toLeafArray=Ki,N.toSimpleTree=Kd,N.toTree=Jd,N.uniqueArray=Ud,N.upFirst=Fi,N.useAppInject=ze,N.useAppProvide=nu,N.useAuthPageInject=sr,N.useAuthPageProvide=dr,N.useCompInject=ir,N.useCompProvide=ga,N.useFormInject=Jt,N.useFormProvide=ma,N.useHMenuInject=lr,N.useHMenuProvide=cr,N.useInject=ct,N.useLayer=yn,N.useLayerInject=ou,N.useLayerProvide=ur,N.useMenuInject=gn,N.useMenuProvide=rr,N.usePageInject=fr,N.usePageProvide=pr,N.useProvide=st,N.useSortable=nr,N.useTableInject=ar,N.useTableProvide=go,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));